diff --git a/.gitattributes b/.gitattributes index 2bffe04..3ed717f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,4 +5,9 @@ # Ignore binary files >:( *.png binary -*.jpg binary \ No newline at end of file +*.jpg binary +*.ogg binary +*.efkefc binary +*.efkmodel binary +*.woff binary +*.wasm binary \ No newline at end of file diff --git a/audio/bgm/Battle1.ogg b/audio/bgm/Battle1.ogg new file mode 100644 index 0000000..8adfbb5 Binary files /dev/null and b/audio/bgm/Battle1.ogg differ diff --git a/audio/bgm/Battle2.ogg b/audio/bgm/Battle2.ogg new file mode 100644 index 0000000..da888bf Binary files /dev/null and b/audio/bgm/Battle2.ogg differ diff --git a/audio/bgm/Battle3.ogg b/audio/bgm/Battle3.ogg new file mode 100644 index 0000000..873c391 Binary files /dev/null and b/audio/bgm/Battle3.ogg differ diff --git a/audio/bgm/Battle4.ogg b/audio/bgm/Battle4.ogg new file mode 100644 index 0000000..b13ada0 Binary files /dev/null and b/audio/bgm/Battle4.ogg differ diff --git a/audio/bgm/Battle5.ogg b/audio/bgm/Battle5.ogg new file mode 100644 index 0000000..4926acf Binary files /dev/null and b/audio/bgm/Battle5.ogg differ diff --git a/audio/bgm/Battle6.ogg b/audio/bgm/Battle6.ogg new file mode 100644 index 0000000..9d50c44 Binary files /dev/null and b/audio/bgm/Battle6.ogg differ diff --git a/audio/bgm/Battle7.ogg b/audio/bgm/Battle7.ogg new file mode 100644 index 0000000..ec40877 Binary files /dev/null and b/audio/bgm/Battle7.ogg differ diff --git a/audio/bgm/Battle8.ogg b/audio/bgm/Battle8.ogg new file mode 100644 index 0000000..39b81b4 Binary files /dev/null and b/audio/bgm/Battle8.ogg differ diff --git a/audio/bgm/Castle1.ogg b/audio/bgm/Castle1.ogg new file mode 100644 index 0000000..d62b0f2 Binary files /dev/null and b/audio/bgm/Castle1.ogg differ diff --git a/audio/bgm/Castle2.ogg b/audio/bgm/Castle2.ogg new file mode 100644 index 0000000..59e8eb4 Binary files /dev/null and b/audio/bgm/Castle2.ogg differ diff --git a/audio/bgm/Castle3.ogg b/audio/bgm/Castle3.ogg new file mode 100644 index 0000000..6c75658 Binary files /dev/null and b/audio/bgm/Castle3.ogg differ diff --git a/audio/bgm/Dungeon1.ogg b/audio/bgm/Dungeon1.ogg new file mode 100644 index 0000000..3f43916 Binary files /dev/null and b/audio/bgm/Dungeon1.ogg differ diff --git a/audio/bgm/Dungeon2.ogg b/audio/bgm/Dungeon2.ogg new file mode 100644 index 0000000..f80b09c Binary files /dev/null and b/audio/bgm/Dungeon2.ogg differ diff --git a/audio/bgm/Dungeon3.ogg b/audio/bgm/Dungeon3.ogg new file mode 100644 index 0000000..fdfec7d Binary files /dev/null and b/audio/bgm/Dungeon3.ogg differ diff --git a/audio/bgm/Dungeon4.ogg b/audio/bgm/Dungeon4.ogg new file mode 100644 index 0000000..9f8bc7e Binary files /dev/null and b/audio/bgm/Dungeon4.ogg differ diff --git a/audio/bgm/Dungeon5.ogg b/audio/bgm/Dungeon5.ogg new file mode 100644 index 0000000..c0a42fa Binary files /dev/null and b/audio/bgm/Dungeon5.ogg differ diff --git a/audio/bgm/Dungeon6.ogg b/audio/bgm/Dungeon6.ogg new file mode 100644 index 0000000..9c82c1a Binary files /dev/null and b/audio/bgm/Dungeon6.ogg differ diff --git a/audio/bgm/Dungeon7.ogg b/audio/bgm/Dungeon7.ogg new file mode 100644 index 0000000..c801fc0 Binary files /dev/null and b/audio/bgm/Dungeon7.ogg differ diff --git a/audio/bgm/Field1.ogg b/audio/bgm/Field1.ogg new file mode 100644 index 0000000..841b192 Binary files /dev/null and b/audio/bgm/Field1.ogg differ diff --git a/audio/bgm/Field2.ogg b/audio/bgm/Field2.ogg new file mode 100644 index 0000000..f67b124 Binary files /dev/null and b/audio/bgm/Field2.ogg differ diff --git a/audio/bgm/Field3.ogg b/audio/bgm/Field3.ogg new file mode 100644 index 0000000..b0a6ec3 Binary files /dev/null and b/audio/bgm/Field3.ogg differ diff --git a/audio/bgm/Field4.ogg b/audio/bgm/Field4.ogg new file mode 100644 index 0000000..dd21009 Binary files /dev/null and b/audio/bgm/Field4.ogg differ diff --git a/audio/bgm/Scene1.ogg b/audio/bgm/Scene1.ogg new file mode 100644 index 0000000..fab61fc Binary files /dev/null and b/audio/bgm/Scene1.ogg differ diff --git a/audio/bgm/Scene2.ogg b/audio/bgm/Scene2.ogg new file mode 100644 index 0000000..97f1cc7 Binary files /dev/null and b/audio/bgm/Scene2.ogg differ diff --git a/audio/bgm/Scene3.ogg b/audio/bgm/Scene3.ogg new file mode 100644 index 0000000..a6dc386 Binary files /dev/null and b/audio/bgm/Scene3.ogg differ diff --git a/audio/bgm/Scene4.ogg b/audio/bgm/Scene4.ogg new file mode 100644 index 0000000..49890aa Binary files /dev/null and b/audio/bgm/Scene4.ogg differ diff --git a/audio/bgm/Scene5.ogg b/audio/bgm/Scene5.ogg new file mode 100644 index 0000000..396620f Binary files /dev/null and b/audio/bgm/Scene5.ogg differ diff --git a/audio/bgm/Scene6.ogg b/audio/bgm/Scene6.ogg new file mode 100644 index 0000000..c45643e Binary files /dev/null and b/audio/bgm/Scene6.ogg differ diff --git a/audio/bgm/Scene7.ogg b/audio/bgm/Scene7.ogg new file mode 100644 index 0000000..77cd4dc Binary files /dev/null and b/audio/bgm/Scene7.ogg differ diff --git a/audio/bgm/Scene8.ogg b/audio/bgm/Scene8.ogg new file mode 100644 index 0000000..182c64d Binary files /dev/null and b/audio/bgm/Scene8.ogg differ diff --git a/audio/bgm/Scene9.ogg b/audio/bgm/Scene9.ogg new file mode 100644 index 0000000..30ac29b Binary files /dev/null and b/audio/bgm/Scene9.ogg differ diff --git a/audio/bgm/Ship1.ogg b/audio/bgm/Ship1.ogg new file mode 100644 index 0000000..a828169 Binary files /dev/null and b/audio/bgm/Ship1.ogg differ diff --git a/audio/bgm/Ship2.ogg b/audio/bgm/Ship2.ogg new file mode 100644 index 0000000..d36f21f Binary files /dev/null and b/audio/bgm/Ship2.ogg differ diff --git a/audio/bgm/Ship3.ogg b/audio/bgm/Ship3.ogg new file mode 100644 index 0000000..a0c511b Binary files /dev/null and b/audio/bgm/Ship3.ogg differ diff --git a/audio/bgm/Theme1.ogg b/audio/bgm/Theme1.ogg new file mode 100644 index 0000000..afc4a45 Binary files /dev/null and b/audio/bgm/Theme1.ogg differ diff --git a/audio/bgm/Theme2.ogg b/audio/bgm/Theme2.ogg new file mode 100644 index 0000000..c73de25 Binary files /dev/null and b/audio/bgm/Theme2.ogg differ diff --git a/audio/bgm/Theme3.ogg b/audio/bgm/Theme3.ogg new file mode 100644 index 0000000..3d68df4 Binary files /dev/null and b/audio/bgm/Theme3.ogg differ diff --git a/audio/bgm/Theme4.ogg b/audio/bgm/Theme4.ogg new file mode 100644 index 0000000..ce0d986 Binary files /dev/null and b/audio/bgm/Theme4.ogg differ diff --git a/audio/bgm/Theme5.ogg b/audio/bgm/Theme5.ogg new file mode 100644 index 0000000..740ccdf Binary files /dev/null and b/audio/bgm/Theme5.ogg differ diff --git a/audio/bgm/Theme6.ogg b/audio/bgm/Theme6.ogg new file mode 100644 index 0000000..78e6303 Binary files /dev/null and b/audio/bgm/Theme6.ogg differ diff --git a/audio/bgm/Town1.ogg b/audio/bgm/Town1.ogg new file mode 100644 index 0000000..92993cd Binary files /dev/null and b/audio/bgm/Town1.ogg differ diff --git a/audio/bgm/Town2.ogg b/audio/bgm/Town2.ogg new file mode 100644 index 0000000..1e2eddf Binary files /dev/null and b/audio/bgm/Town2.ogg differ diff --git a/audio/bgm/Town3.ogg b/audio/bgm/Town3.ogg new file mode 100644 index 0000000..93afff6 Binary files /dev/null and b/audio/bgm/Town3.ogg differ diff --git a/audio/bgm/Town4.ogg b/audio/bgm/Town4.ogg new file mode 100644 index 0000000..f01ba4a Binary files /dev/null and b/audio/bgm/Town4.ogg differ diff --git a/audio/bgm/Town5.ogg b/audio/bgm/Town5.ogg new file mode 100644 index 0000000..18a55a4 Binary files /dev/null and b/audio/bgm/Town5.ogg differ diff --git a/audio/bgm/Town6.ogg b/audio/bgm/Town6.ogg new file mode 100644 index 0000000..94f106b Binary files /dev/null and b/audio/bgm/Town6.ogg differ diff --git a/audio/bgm/Town7.ogg b/audio/bgm/Town7.ogg new file mode 100644 index 0000000..ad6b5cb Binary files /dev/null and b/audio/bgm/Town7.ogg differ diff --git a/audio/bgm/Town8.ogg b/audio/bgm/Town8.ogg new file mode 100644 index 0000000..7b99d07 Binary files /dev/null and b/audio/bgm/Town8.ogg differ diff --git a/audio/bgs/City.ogg b/audio/bgs/City.ogg new file mode 100644 index 0000000..2e83f03 Binary files /dev/null and b/audio/bgs/City.ogg differ diff --git a/audio/bgs/Clock.ogg b/audio/bgs/Clock.ogg new file mode 100644 index 0000000..ec5bf9c Binary files /dev/null and b/audio/bgs/Clock.ogg differ diff --git a/audio/bgs/Darkness.ogg b/audio/bgs/Darkness.ogg new file mode 100644 index 0000000..484b578 Binary files /dev/null and b/audio/bgs/Darkness.ogg differ diff --git a/audio/bgs/Drips.ogg b/audio/bgs/Drips.ogg new file mode 100644 index 0000000..aeed3e6 Binary files /dev/null and b/audio/bgs/Drips.ogg differ diff --git a/audio/bgs/Fire1.ogg b/audio/bgs/Fire1.ogg new file mode 100644 index 0000000..5831cba Binary files /dev/null and b/audio/bgs/Fire1.ogg differ diff --git a/audio/bgs/Fire2.ogg b/audio/bgs/Fire2.ogg new file mode 100644 index 0000000..cebeb6e Binary files /dev/null and b/audio/bgs/Fire2.ogg differ diff --git a/audio/bgs/Fire3.ogg b/audio/bgs/Fire3.ogg new file mode 100644 index 0000000..f087047 Binary files /dev/null and b/audio/bgs/Fire3.ogg differ diff --git a/audio/bgs/Night.ogg b/audio/bgs/Night.ogg new file mode 100644 index 0000000..08323b8 Binary files /dev/null and b/audio/bgs/Night.ogg differ diff --git a/audio/bgs/People1.ogg b/audio/bgs/People1.ogg new file mode 100644 index 0000000..866d1dc Binary files /dev/null and b/audio/bgs/People1.ogg differ diff --git a/audio/bgs/People2.ogg b/audio/bgs/People2.ogg new file mode 100644 index 0000000..44cfc76 Binary files /dev/null and b/audio/bgs/People2.ogg differ diff --git a/audio/bgs/Quake1.ogg b/audio/bgs/Quake1.ogg new file mode 100644 index 0000000..7d540ba Binary files /dev/null and b/audio/bgs/Quake1.ogg differ diff --git a/audio/bgs/Quake2.ogg b/audio/bgs/Quake2.ogg new file mode 100644 index 0000000..5c4b37b Binary files /dev/null and b/audio/bgs/Quake2.ogg differ diff --git a/audio/bgs/Rain1.ogg b/audio/bgs/Rain1.ogg new file mode 100644 index 0000000..e25050a Binary files /dev/null and b/audio/bgs/Rain1.ogg differ diff --git a/audio/bgs/Rain2.ogg b/audio/bgs/Rain2.ogg new file mode 100644 index 0000000..93ec6c6 Binary files /dev/null and b/audio/bgs/Rain2.ogg differ diff --git a/audio/bgs/Rain3.ogg b/audio/bgs/Rain3.ogg new file mode 100644 index 0000000..806f3c5 Binary files /dev/null and b/audio/bgs/Rain3.ogg differ diff --git a/audio/bgs/Rain4.ogg b/audio/bgs/Rain4.ogg new file mode 100644 index 0000000..8a1fa24 Binary files /dev/null and b/audio/bgs/Rain4.ogg differ diff --git a/audio/bgs/River.ogg b/audio/bgs/River.ogg new file mode 100644 index 0000000..6933ee6 Binary files /dev/null and b/audio/bgs/River.ogg differ diff --git a/audio/bgs/Sea.ogg b/audio/bgs/Sea.ogg new file mode 100644 index 0000000..c22c77d Binary files /dev/null and b/audio/bgs/Sea.ogg differ diff --git a/audio/bgs/Storm1.ogg b/audio/bgs/Storm1.ogg new file mode 100644 index 0000000..e170733 Binary files /dev/null and b/audio/bgs/Storm1.ogg differ diff --git a/audio/bgs/Storm2.ogg b/audio/bgs/Storm2.ogg new file mode 100644 index 0000000..b2ea879 Binary files /dev/null and b/audio/bgs/Storm2.ogg differ diff --git a/audio/bgs/Waterfall1.ogg b/audio/bgs/Waterfall1.ogg new file mode 100644 index 0000000..ad543f4 Binary files /dev/null and b/audio/bgs/Waterfall1.ogg differ diff --git a/audio/bgs/Waterfall2.ogg b/audio/bgs/Waterfall2.ogg new file mode 100644 index 0000000..29dafd2 Binary files /dev/null and b/audio/bgs/Waterfall2.ogg differ diff --git a/audio/bgs/Wave1.ogg b/audio/bgs/Wave1.ogg new file mode 100644 index 0000000..352e72b Binary files /dev/null and b/audio/bgs/Wave1.ogg differ diff --git a/audio/bgs/Wave2.ogg b/audio/bgs/Wave2.ogg new file mode 100644 index 0000000..2d1a987 Binary files /dev/null and b/audio/bgs/Wave2.ogg differ diff --git a/audio/bgs/Wind1.ogg b/audio/bgs/Wind1.ogg new file mode 100644 index 0000000..6af2914 Binary files /dev/null and b/audio/bgs/Wind1.ogg differ diff --git a/audio/bgs/Wind2.ogg b/audio/bgs/Wind2.ogg new file mode 100644 index 0000000..b2e6365 Binary files /dev/null and b/audio/bgs/Wind2.ogg differ diff --git a/audio/bgs/Wind3.ogg b/audio/bgs/Wind3.ogg new file mode 100644 index 0000000..8b0f658 Binary files /dev/null and b/audio/bgs/Wind3.ogg differ diff --git a/audio/bgs/Wind4.ogg b/audio/bgs/Wind4.ogg new file mode 100644 index 0000000..5a97e67 Binary files /dev/null and b/audio/bgs/Wind4.ogg differ diff --git a/audio/bgs/Wind5.ogg b/audio/bgs/Wind5.ogg new file mode 100644 index 0000000..a3dba76 Binary files /dev/null and b/audio/bgs/Wind5.ogg differ diff --git a/audio/me/Curse1.ogg b/audio/me/Curse1.ogg new file mode 100644 index 0000000..434a9b0 Binary files /dev/null and b/audio/me/Curse1.ogg differ diff --git a/audio/me/Curse2.ogg b/audio/me/Curse2.ogg new file mode 100644 index 0000000..75f4abe Binary files /dev/null and b/audio/me/Curse2.ogg differ diff --git a/audio/me/Defeat1.ogg b/audio/me/Defeat1.ogg new file mode 100644 index 0000000..de834c3 Binary files /dev/null and b/audio/me/Defeat1.ogg differ diff --git a/audio/me/Defeat2.ogg b/audio/me/Defeat2.ogg new file mode 100644 index 0000000..4ae4465 Binary files /dev/null and b/audio/me/Defeat2.ogg differ diff --git a/audio/me/Fanfare1.ogg b/audio/me/Fanfare1.ogg new file mode 100644 index 0000000..243b42f Binary files /dev/null and b/audio/me/Fanfare1.ogg differ diff --git a/audio/me/Fanfare2.ogg b/audio/me/Fanfare2.ogg new file mode 100644 index 0000000..e364227 Binary files /dev/null and b/audio/me/Fanfare2.ogg differ diff --git a/audio/me/Fanfare3.ogg b/audio/me/Fanfare3.ogg new file mode 100644 index 0000000..0955f36 Binary files /dev/null and b/audio/me/Fanfare3.ogg differ diff --git a/audio/me/Gag.ogg b/audio/me/Gag.ogg new file mode 100644 index 0000000..554bfab Binary files /dev/null and b/audio/me/Gag.ogg differ diff --git a/audio/me/Gameover1.ogg b/audio/me/Gameover1.ogg new file mode 100644 index 0000000..cac6ad8 Binary files /dev/null and b/audio/me/Gameover1.ogg differ diff --git a/audio/me/Gameover2.ogg b/audio/me/Gameover2.ogg new file mode 100644 index 0000000..a934bff Binary files /dev/null and b/audio/me/Gameover2.ogg differ diff --git a/audio/me/Horror.ogg b/audio/me/Horror.ogg new file mode 100644 index 0000000..d898cba Binary files /dev/null and b/audio/me/Horror.ogg differ diff --git a/audio/me/Inn1.ogg b/audio/me/Inn1.ogg new file mode 100644 index 0000000..ae66385 Binary files /dev/null and b/audio/me/Inn1.ogg differ diff --git a/audio/me/Inn2.ogg b/audio/me/Inn2.ogg new file mode 100644 index 0000000..2254497 Binary files /dev/null and b/audio/me/Inn2.ogg differ diff --git a/audio/me/Item.ogg b/audio/me/Item.ogg new file mode 100644 index 0000000..0e69546 Binary files /dev/null and b/audio/me/Item.ogg differ diff --git a/audio/me/Like.ogg b/audio/me/Like.ogg new file mode 100644 index 0000000..054dafd Binary files /dev/null and b/audio/me/Like.ogg differ diff --git a/audio/me/Musical1.ogg b/audio/me/Musical1.ogg new file mode 100644 index 0000000..5b9d8a9 Binary files /dev/null and b/audio/me/Musical1.ogg differ diff --git a/audio/me/Musical2.ogg b/audio/me/Musical2.ogg new file mode 100644 index 0000000..c140f25 Binary files /dev/null and b/audio/me/Musical2.ogg differ diff --git a/audio/me/Musical3.ogg b/audio/me/Musical3.ogg new file mode 100644 index 0000000..bce13b8 Binary files /dev/null and b/audio/me/Musical3.ogg differ diff --git a/audio/me/Mystery.ogg b/audio/me/Mystery.ogg new file mode 100644 index 0000000..8b31f69 Binary files /dev/null and b/audio/me/Mystery.ogg differ diff --git a/audio/me/Organ.ogg b/audio/me/Organ.ogg new file mode 100644 index 0000000..a2018d2 Binary files /dev/null and b/audio/me/Organ.ogg differ diff --git a/audio/me/Refresh.ogg b/audio/me/Refresh.ogg new file mode 100644 index 0000000..84c054d Binary files /dev/null and b/audio/me/Refresh.ogg differ diff --git a/audio/me/Shock1.ogg b/audio/me/Shock1.ogg new file mode 100644 index 0000000..dd0d670 Binary files /dev/null and b/audio/me/Shock1.ogg differ diff --git a/audio/me/Shock2.ogg b/audio/me/Shock2.ogg new file mode 100644 index 0000000..c422d0d Binary files /dev/null and b/audio/me/Shock2.ogg differ diff --git a/audio/me/Shock3.ogg b/audio/me/Shock3.ogg new file mode 100644 index 0000000..2f66c22 Binary files /dev/null and b/audio/me/Shock3.ogg differ diff --git a/audio/me/Victory1.ogg b/audio/me/Victory1.ogg new file mode 100644 index 0000000..16a9028 Binary files /dev/null and b/audio/me/Victory1.ogg differ diff --git a/audio/me/Victory2.ogg b/audio/me/Victory2.ogg new file mode 100644 index 0000000..9077b32 Binary files /dev/null and b/audio/me/Victory2.ogg differ diff --git a/audio/me/Victory3.ogg b/audio/me/Victory3.ogg new file mode 100644 index 0000000..0d87221 Binary files /dev/null and b/audio/me/Victory3.ogg differ diff --git a/audio/se/Absorb1.ogg b/audio/se/Absorb1.ogg new file mode 100644 index 0000000..7ab46a1 Binary files /dev/null and b/audio/se/Absorb1.ogg differ diff --git a/audio/se/Absorb2.ogg b/audio/se/Absorb2.ogg new file mode 100644 index 0000000..8693424 Binary files /dev/null and b/audio/se/Absorb2.ogg differ diff --git a/audio/se/Applause1.ogg b/audio/se/Applause1.ogg new file mode 100644 index 0000000..9c64c63 Binary files /dev/null and b/audio/se/Applause1.ogg differ diff --git a/audio/se/Applause2.ogg b/audio/se/Applause2.ogg new file mode 100644 index 0000000..dcee506 Binary files /dev/null and b/audio/se/Applause2.ogg differ diff --git a/audio/se/Attack1.ogg b/audio/se/Attack1.ogg new file mode 100644 index 0000000..db69c32 Binary files /dev/null and b/audio/se/Attack1.ogg differ diff --git a/audio/se/Attack2.ogg b/audio/se/Attack2.ogg new file mode 100644 index 0000000..171c2d3 Binary files /dev/null and b/audio/se/Attack2.ogg differ diff --git a/audio/se/Attack3.ogg b/audio/se/Attack3.ogg new file mode 100644 index 0000000..6e73fa1 Binary files /dev/null and b/audio/se/Attack3.ogg differ diff --git a/audio/se/Autodoor.ogg b/audio/se/Autodoor.ogg new file mode 100644 index 0000000..7178181 Binary files /dev/null and b/audio/se/Autodoor.ogg differ diff --git a/audio/se/Barrier.ogg b/audio/se/Barrier.ogg new file mode 100644 index 0000000..b6be142 Binary files /dev/null and b/audio/se/Barrier.ogg differ diff --git a/audio/se/Battle1.ogg b/audio/se/Battle1.ogg new file mode 100644 index 0000000..0de9187 Binary files /dev/null and b/audio/se/Battle1.ogg differ diff --git a/audio/se/Battle2.ogg b/audio/se/Battle2.ogg new file mode 100644 index 0000000..d747f8a Binary files /dev/null and b/audio/se/Battle2.ogg differ diff --git a/audio/se/Battle3.ogg b/audio/se/Battle3.ogg new file mode 100644 index 0000000..0285876 Binary files /dev/null and b/audio/se/Battle3.ogg differ diff --git a/audio/se/Battle4.ogg b/audio/se/Battle4.ogg new file mode 100644 index 0000000..bdd4b00 Binary files /dev/null and b/audio/se/Battle4.ogg differ diff --git a/audio/se/Battle5.ogg b/audio/se/Battle5.ogg new file mode 100644 index 0000000..c05b121 Binary files /dev/null and b/audio/se/Battle5.ogg differ diff --git a/audio/se/Battle6.ogg b/audio/se/Battle6.ogg new file mode 100644 index 0000000..283187f Binary files /dev/null and b/audio/se/Battle6.ogg differ diff --git a/audio/se/Bell1.ogg b/audio/se/Bell1.ogg new file mode 100644 index 0000000..5f71690 Binary files /dev/null and b/audio/se/Bell1.ogg differ diff --git a/audio/se/Bell2.ogg b/audio/se/Bell2.ogg new file mode 100644 index 0000000..fbaadce Binary files /dev/null and b/audio/se/Bell2.ogg differ diff --git a/audio/se/Bell3.ogg b/audio/se/Bell3.ogg new file mode 100644 index 0000000..9170b09 Binary files /dev/null and b/audio/se/Bell3.ogg differ diff --git a/audio/se/Bite.ogg b/audio/se/Bite.ogg new file mode 100644 index 0000000..b80dfd8 Binary files /dev/null and b/audio/se/Bite.ogg differ diff --git a/audio/se/Blind.ogg b/audio/se/Blind.ogg new file mode 100644 index 0000000..3da49b3 Binary files /dev/null and b/audio/se/Blind.ogg differ diff --git a/audio/se/Blow1.ogg b/audio/se/Blow1.ogg new file mode 100644 index 0000000..666ea86 Binary files /dev/null and b/audio/se/Blow1.ogg differ diff --git a/audio/se/Blow10.ogg b/audio/se/Blow10.ogg new file mode 100644 index 0000000..c26cfe3 Binary files /dev/null and b/audio/se/Blow10.ogg differ diff --git a/audio/se/Blow2.ogg b/audio/se/Blow2.ogg new file mode 100644 index 0000000..afa64b0 Binary files /dev/null and b/audio/se/Blow2.ogg differ diff --git a/audio/se/Blow3.ogg b/audio/se/Blow3.ogg new file mode 100644 index 0000000..d21a827 Binary files /dev/null and b/audio/se/Blow3.ogg differ diff --git a/audio/se/Blow4.ogg b/audio/se/Blow4.ogg new file mode 100644 index 0000000..c8d3fa4 Binary files /dev/null and b/audio/se/Blow4.ogg differ diff --git a/audio/se/Blow5.ogg b/audio/se/Blow5.ogg new file mode 100644 index 0000000..da94663 Binary files /dev/null and b/audio/se/Blow5.ogg differ diff --git a/audio/se/Blow6.ogg b/audio/se/Blow6.ogg new file mode 100644 index 0000000..a1db190 Binary files /dev/null and b/audio/se/Blow6.ogg differ diff --git a/audio/se/Blow7.ogg b/audio/se/Blow7.ogg new file mode 100644 index 0000000..c78688a Binary files /dev/null and b/audio/se/Blow7.ogg differ diff --git a/audio/se/Blow8.ogg b/audio/se/Blow8.ogg new file mode 100644 index 0000000..93dd29a Binary files /dev/null and b/audio/se/Blow8.ogg differ diff --git a/audio/se/Blow9.ogg b/audio/se/Blow9.ogg new file mode 100644 index 0000000..48ace89 Binary files /dev/null and b/audio/se/Blow9.ogg differ diff --git a/audio/se/Book1.ogg b/audio/se/Book1.ogg new file mode 100644 index 0000000..eb7f41d Binary files /dev/null and b/audio/se/Book1.ogg differ diff --git a/audio/se/Book2.ogg b/audio/se/Book2.ogg new file mode 100644 index 0000000..251458f Binary files /dev/null and b/audio/se/Book2.ogg differ diff --git a/audio/se/Bow1.ogg b/audio/se/Bow1.ogg new file mode 100644 index 0000000..272f47d Binary files /dev/null and b/audio/se/Bow1.ogg differ diff --git a/audio/se/Bow2.ogg b/audio/se/Bow2.ogg new file mode 100644 index 0000000..a78906e Binary files /dev/null and b/audio/se/Bow2.ogg differ diff --git a/audio/se/Bow3.ogg b/audio/se/Bow3.ogg new file mode 100644 index 0000000..925d480 Binary files /dev/null and b/audio/se/Bow3.ogg differ diff --git a/audio/se/Bow4.ogg b/audio/se/Bow4.ogg new file mode 100644 index 0000000..2054004 Binary files /dev/null and b/audio/se/Bow4.ogg differ diff --git a/audio/se/Bow5.ogg b/audio/se/Bow5.ogg new file mode 100644 index 0000000..99b330d Binary files /dev/null and b/audio/se/Bow5.ogg differ diff --git a/audio/se/Break.ogg b/audio/se/Break.ogg new file mode 100644 index 0000000..8197c1a Binary files /dev/null and b/audio/se/Break.ogg differ diff --git a/audio/se/Breath.ogg b/audio/se/Breath.ogg new file mode 100644 index 0000000..579a826 Binary files /dev/null and b/audio/se/Breath.ogg differ diff --git a/audio/se/Buzzer1.ogg b/audio/se/Buzzer1.ogg new file mode 100644 index 0000000..a37fa73 Binary files /dev/null and b/audio/se/Buzzer1.ogg differ diff --git a/audio/se/Buzzer2.ogg b/audio/se/Buzzer2.ogg new file mode 100644 index 0000000..bf72abd Binary files /dev/null and b/audio/se/Buzzer2.ogg differ diff --git a/audio/se/Buzzer3.ogg b/audio/se/Buzzer3.ogg new file mode 100644 index 0000000..1ae40bd Binary files /dev/null and b/audio/se/Buzzer3.ogg differ diff --git a/audio/se/Cancel1.ogg b/audio/se/Cancel1.ogg new file mode 100644 index 0000000..e901475 Binary files /dev/null and b/audio/se/Cancel1.ogg differ diff --git a/audio/se/Cancel2.ogg b/audio/se/Cancel2.ogg new file mode 100644 index 0000000..1b4f295 Binary files /dev/null and b/audio/se/Cancel2.ogg differ diff --git a/audio/se/Cancel3.ogg b/audio/se/Cancel3.ogg new file mode 100644 index 0000000..a875b44 Binary files /dev/null and b/audio/se/Cancel3.ogg differ diff --git a/audio/se/Cat.ogg b/audio/se/Cat.ogg new file mode 100644 index 0000000..47be13a Binary files /dev/null and b/audio/se/Cat.ogg differ diff --git a/audio/se/Chain.ogg b/audio/se/Chain.ogg new file mode 100644 index 0000000..366b558 Binary files /dev/null and b/audio/se/Chain.ogg differ diff --git a/audio/se/Chest1.ogg b/audio/se/Chest1.ogg new file mode 100644 index 0000000..ddc95b2 Binary files /dev/null and b/audio/se/Chest1.ogg differ diff --git a/audio/se/Chest2.ogg b/audio/se/Chest2.ogg new file mode 100644 index 0000000..5a320f9 Binary files /dev/null and b/audio/se/Chest2.ogg differ diff --git a/audio/se/Chicken.ogg b/audio/se/Chicken.ogg new file mode 100644 index 0000000..55b361d Binary files /dev/null and b/audio/se/Chicken.ogg differ diff --git a/audio/se/Chime1.ogg b/audio/se/Chime1.ogg new file mode 100644 index 0000000..c12b813 Binary files /dev/null and b/audio/se/Chime1.ogg differ diff --git a/audio/se/Chime2.ogg b/audio/se/Chime2.ogg new file mode 100644 index 0000000..3846564 Binary files /dev/null and b/audio/se/Chime2.ogg differ diff --git a/audio/se/Close1.ogg b/audio/se/Close1.ogg new file mode 100644 index 0000000..6534d78 Binary files /dev/null and b/audio/se/Close1.ogg differ diff --git a/audio/se/Close2.ogg b/audio/se/Close2.ogg new file mode 100644 index 0000000..36ae426 Binary files /dev/null and b/audio/se/Close2.ogg differ diff --git a/audio/se/Close3.ogg b/audio/se/Close3.ogg new file mode 100644 index 0000000..ba70d91 Binary files /dev/null and b/audio/se/Close3.ogg differ diff --git a/audio/se/Coin.ogg b/audio/se/Coin.ogg new file mode 100644 index 0000000..67f1add Binary files /dev/null and b/audio/se/Coin.ogg differ diff --git a/audio/se/Collapse1.ogg b/audio/se/Collapse1.ogg new file mode 100644 index 0000000..e55101c Binary files /dev/null and b/audio/se/Collapse1.ogg differ diff --git a/audio/se/Collapse2.ogg b/audio/se/Collapse2.ogg new file mode 100644 index 0000000..ccb1e5c Binary files /dev/null and b/audio/se/Collapse2.ogg differ diff --git a/audio/se/Collapse3.ogg b/audio/se/Collapse3.ogg new file mode 100644 index 0000000..3a81c44 Binary files /dev/null and b/audio/se/Collapse3.ogg differ diff --git a/audio/se/Collapse4.ogg b/audio/se/Collapse4.ogg new file mode 100644 index 0000000..3330621 Binary files /dev/null and b/audio/se/Collapse4.ogg differ diff --git a/audio/se/Computer.ogg b/audio/se/Computer.ogg new file mode 100644 index 0000000..8ca6b7d Binary files /dev/null and b/audio/se/Computer.ogg differ diff --git a/audio/se/Confuse.ogg b/audio/se/Confuse.ogg new file mode 100644 index 0000000..d45c72f Binary files /dev/null and b/audio/se/Confuse.ogg differ diff --git a/audio/se/Cow.ogg b/audio/se/Cow.ogg new file mode 100644 index 0000000..a7f6d62 Binary files /dev/null and b/audio/se/Cow.ogg differ diff --git a/audio/se/Crash.ogg b/audio/se/Crash.ogg new file mode 100644 index 0000000..3f1b245 Binary files /dev/null and b/audio/se/Crash.ogg differ diff --git a/audio/se/Crossbow.ogg b/audio/se/Crossbow.ogg new file mode 100644 index 0000000..0a0946f Binary files /dev/null and b/audio/se/Crossbow.ogg differ diff --git a/audio/se/Crow.ogg b/audio/se/Crow.ogg new file mode 100644 index 0000000..9f8259f Binary files /dev/null and b/audio/se/Crow.ogg differ diff --git a/audio/se/Cry1.ogg b/audio/se/Cry1.ogg new file mode 100644 index 0000000..cc1b641 Binary files /dev/null and b/audio/se/Cry1.ogg differ diff --git a/audio/se/Cry2.ogg b/audio/se/Cry2.ogg new file mode 100644 index 0000000..c8a9fb7 Binary files /dev/null and b/audio/se/Cry2.ogg differ diff --git a/audio/se/Cursor1.ogg b/audio/se/Cursor1.ogg new file mode 100644 index 0000000..7e7d3e9 Binary files /dev/null and b/audio/se/Cursor1.ogg differ diff --git a/audio/se/Cursor2.ogg b/audio/se/Cursor2.ogg new file mode 100644 index 0000000..aab2233 Binary files /dev/null and b/audio/se/Cursor2.ogg differ diff --git a/audio/se/Cursor3.ogg b/audio/se/Cursor3.ogg new file mode 100644 index 0000000..22a6736 Binary files /dev/null and b/audio/se/Cursor3.ogg differ diff --git a/audio/se/Cursor4.ogg b/audio/se/Cursor4.ogg new file mode 100644 index 0000000..af476f0 Binary files /dev/null and b/audio/se/Cursor4.ogg differ diff --git a/audio/se/Damage1.ogg b/audio/se/Damage1.ogg new file mode 100644 index 0000000..7f90caf Binary files /dev/null and b/audio/se/Damage1.ogg differ diff --git a/audio/se/Damage2.ogg b/audio/se/Damage2.ogg new file mode 100644 index 0000000..783a90c Binary files /dev/null and b/audio/se/Damage2.ogg differ diff --git a/audio/se/Damage3.ogg b/audio/se/Damage3.ogg new file mode 100644 index 0000000..d2c91e3 Binary files /dev/null and b/audio/se/Damage3.ogg differ diff --git a/audio/se/Damage4.ogg b/audio/se/Damage4.ogg new file mode 100644 index 0000000..38979de Binary files /dev/null and b/audio/se/Damage4.ogg differ diff --git a/audio/se/Damage5.ogg b/audio/se/Damage5.ogg new file mode 100644 index 0000000..414f376 Binary files /dev/null and b/audio/se/Damage5.ogg differ diff --git a/audio/se/Darkness1.ogg b/audio/se/Darkness1.ogg new file mode 100644 index 0000000..3b19fae Binary files /dev/null and b/audio/se/Darkness1.ogg differ diff --git a/audio/se/Darkness2.ogg b/audio/se/Darkness2.ogg new file mode 100644 index 0000000..b70813d Binary files /dev/null and b/audio/se/Darkness2.ogg differ diff --git a/audio/se/Darkness3.ogg b/audio/se/Darkness3.ogg new file mode 100644 index 0000000..0de106c Binary files /dev/null and b/audio/se/Darkness3.ogg differ diff --git a/audio/se/Darkness4.ogg b/audio/se/Darkness4.ogg new file mode 100644 index 0000000..4fded2d Binary files /dev/null and b/audio/se/Darkness4.ogg differ diff --git a/audio/se/Darkness5.ogg b/audio/se/Darkness5.ogg new file mode 100644 index 0000000..c48a304 Binary files /dev/null and b/audio/se/Darkness5.ogg differ diff --git a/audio/se/Darkness6.ogg b/audio/se/Darkness6.ogg new file mode 100644 index 0000000..c2277af Binary files /dev/null and b/audio/se/Darkness6.ogg differ diff --git a/audio/se/Darkness7.ogg b/audio/se/Darkness7.ogg new file mode 100644 index 0000000..28052d2 Binary files /dev/null and b/audio/se/Darkness7.ogg differ diff --git a/audio/se/Darkness8.ogg b/audio/se/Darkness8.ogg new file mode 100644 index 0000000..a9ddd96 Binary files /dev/null and b/audio/se/Darkness8.ogg differ diff --git a/audio/se/Decision1.ogg b/audio/se/Decision1.ogg new file mode 100644 index 0000000..f7a1b6d Binary files /dev/null and b/audio/se/Decision1.ogg differ diff --git a/audio/se/Decision2.ogg b/audio/se/Decision2.ogg new file mode 100644 index 0000000..5a3567a Binary files /dev/null and b/audio/se/Decision2.ogg differ diff --git a/audio/se/Decision3.ogg b/audio/se/Decision3.ogg new file mode 100644 index 0000000..36b75e3 Binary files /dev/null and b/audio/se/Decision3.ogg differ diff --git a/audio/se/Decision4.ogg b/audio/se/Decision4.ogg new file mode 100644 index 0000000..9202910 Binary files /dev/null and b/audio/se/Decision4.ogg differ diff --git a/audio/se/Decision5.ogg b/audio/se/Decision5.ogg new file mode 100644 index 0000000..4711677 Binary files /dev/null and b/audio/se/Decision5.ogg differ diff --git a/audio/se/Devil1.ogg b/audio/se/Devil1.ogg new file mode 100644 index 0000000..9d7b29b Binary files /dev/null and b/audio/se/Devil1.ogg differ diff --git a/audio/se/Devil2.ogg b/audio/se/Devil2.ogg new file mode 100644 index 0000000..504715c Binary files /dev/null and b/audio/se/Devil2.ogg differ diff --git a/audio/se/Devil3.ogg b/audio/se/Devil3.ogg new file mode 100644 index 0000000..99d18c5 Binary files /dev/null and b/audio/se/Devil3.ogg differ diff --git a/audio/se/Disappointment.ogg b/audio/se/Disappointment.ogg new file mode 100644 index 0000000..aa16371 Binary files /dev/null and b/audio/se/Disappointment.ogg differ diff --git a/audio/se/Dive.ogg b/audio/se/Dive.ogg new file mode 100644 index 0000000..4c4949c Binary files /dev/null and b/audio/se/Dive.ogg differ diff --git a/audio/se/Dog.ogg b/audio/se/Dog.ogg new file mode 100644 index 0000000..6567f7d Binary files /dev/null and b/audio/se/Dog.ogg differ diff --git a/audio/se/Door1.ogg b/audio/se/Door1.ogg new file mode 100644 index 0000000..7d29e62 Binary files /dev/null and b/audio/se/Door1.ogg differ diff --git a/audio/se/Door2.ogg b/audio/se/Door2.ogg new file mode 100644 index 0000000..9818041 Binary files /dev/null and b/audio/se/Door2.ogg differ diff --git a/audio/se/Door3.ogg b/audio/se/Door3.ogg new file mode 100644 index 0000000..35676a6 Binary files /dev/null and b/audio/se/Door3.ogg differ diff --git a/audio/se/Door4.ogg b/audio/se/Door4.ogg new file mode 100644 index 0000000..62fbcff Binary files /dev/null and b/audio/se/Door4.ogg differ diff --git a/audio/se/Door5.ogg b/audio/se/Door5.ogg new file mode 100644 index 0000000..b292931 Binary files /dev/null and b/audio/se/Door5.ogg differ diff --git a/audio/se/Door6.ogg b/audio/se/Door6.ogg new file mode 100644 index 0000000..3f0dec4 Binary files /dev/null and b/audio/se/Door6.ogg differ diff --git a/audio/se/Door7.ogg b/audio/se/Door7.ogg new file mode 100644 index 0000000..e64034a Binary files /dev/null and b/audio/se/Door7.ogg differ diff --git a/audio/se/Door8.ogg b/audio/se/Door8.ogg new file mode 100644 index 0000000..5976bb6 Binary files /dev/null and b/audio/se/Door8.ogg differ diff --git a/audio/se/Down1.ogg b/audio/se/Down1.ogg new file mode 100644 index 0000000..414ebe7 Binary files /dev/null and b/audio/se/Down1.ogg differ diff --git a/audio/se/Down2.ogg b/audio/se/Down2.ogg new file mode 100644 index 0000000..e0839b6 Binary files /dev/null and b/audio/se/Down2.ogg differ diff --git a/audio/se/Down3.ogg b/audio/se/Down3.ogg new file mode 100644 index 0000000..be12cdb Binary files /dev/null and b/audio/se/Down3.ogg differ diff --git a/audio/se/Down4.ogg b/audio/se/Down4.ogg new file mode 100644 index 0000000..094c018 Binary files /dev/null and b/audio/se/Down4.ogg differ diff --git a/audio/se/Down5.ogg b/audio/se/Down5.ogg new file mode 100644 index 0000000..61c176f Binary files /dev/null and b/audio/se/Down5.ogg differ diff --git a/audio/se/Down6.ogg b/audio/se/Down6.ogg new file mode 100644 index 0000000..b8572d7 Binary files /dev/null and b/audio/se/Down6.ogg differ diff --git a/audio/se/Down7.ogg b/audio/se/Down7.ogg new file mode 100644 index 0000000..f52f345 Binary files /dev/null and b/audio/se/Down7.ogg differ diff --git a/audio/se/Earth1.ogg b/audio/se/Earth1.ogg new file mode 100644 index 0000000..1863008 Binary files /dev/null and b/audio/se/Earth1.ogg differ diff --git a/audio/se/Earth2.ogg b/audio/se/Earth2.ogg new file mode 100644 index 0000000..a4d6f0d Binary files /dev/null and b/audio/se/Earth2.ogg differ diff --git a/audio/se/Earth3.ogg b/audio/se/Earth3.ogg new file mode 100644 index 0000000..d8bf971 Binary files /dev/null and b/audio/se/Earth3.ogg differ diff --git a/audio/se/Earth4.ogg b/audio/se/Earth4.ogg new file mode 100644 index 0000000..8698e9f Binary files /dev/null and b/audio/se/Earth4.ogg differ diff --git a/audio/se/Earth5.ogg b/audio/se/Earth5.ogg new file mode 100644 index 0000000..c816d22 Binary files /dev/null and b/audio/se/Earth5.ogg differ diff --git a/audio/se/Electrocardiogram.ogg b/audio/se/Electrocardiogram.ogg new file mode 100644 index 0000000..bd2a8a7 Binary files /dev/null and b/audio/se/Electrocardiogram.ogg differ diff --git a/audio/se/Equip1.ogg b/audio/se/Equip1.ogg new file mode 100644 index 0000000..fd0612f Binary files /dev/null and b/audio/se/Equip1.ogg differ diff --git a/audio/se/Equip2.ogg b/audio/se/Equip2.ogg new file mode 100644 index 0000000..3d39797 Binary files /dev/null and b/audio/se/Equip2.ogg differ diff --git a/audio/se/Equip3.ogg b/audio/se/Equip3.ogg new file mode 100644 index 0000000..c9b6fcc Binary files /dev/null and b/audio/se/Equip3.ogg differ diff --git a/audio/se/Evasion1.ogg b/audio/se/Evasion1.ogg new file mode 100644 index 0000000..5a13d99 Binary files /dev/null and b/audio/se/Evasion1.ogg differ diff --git a/audio/se/Evasion2.ogg b/audio/se/Evasion2.ogg new file mode 100644 index 0000000..14f6e50 Binary files /dev/null and b/audio/se/Evasion2.ogg differ diff --git a/audio/se/Explosion1.ogg b/audio/se/Explosion1.ogg new file mode 100644 index 0000000..ffaec41 Binary files /dev/null and b/audio/se/Explosion1.ogg differ diff --git a/audio/se/Explosion2.ogg b/audio/se/Explosion2.ogg new file mode 100644 index 0000000..13aaae0 Binary files /dev/null and b/audio/se/Explosion2.ogg differ diff --git a/audio/se/Explosion3.ogg b/audio/se/Explosion3.ogg new file mode 100644 index 0000000..629539f Binary files /dev/null and b/audio/se/Explosion3.ogg differ diff --git a/audio/se/Explosion4.ogg b/audio/se/Explosion4.ogg new file mode 100644 index 0000000..501acdb Binary files /dev/null and b/audio/se/Explosion4.ogg differ diff --git a/audio/se/Fall.ogg b/audio/se/Fall.ogg new file mode 100644 index 0000000..46f7100 Binary files /dev/null and b/audio/se/Fall.ogg differ diff --git a/audio/se/Fire1.ogg b/audio/se/Fire1.ogg new file mode 100644 index 0000000..f4ada0d Binary files /dev/null and b/audio/se/Fire1.ogg differ diff --git a/audio/se/Fire2.ogg b/audio/se/Fire2.ogg new file mode 100644 index 0000000..203cb57 Binary files /dev/null and b/audio/se/Fire2.ogg differ diff --git a/audio/se/Fire3.ogg b/audio/se/Fire3.ogg new file mode 100644 index 0000000..bc86d61 Binary files /dev/null and b/audio/se/Fire3.ogg differ diff --git a/audio/se/Fire4.ogg b/audio/se/Fire4.ogg new file mode 100644 index 0000000..27f1e8e Binary files /dev/null and b/audio/se/Fire4.ogg differ diff --git a/audio/se/Fire5.ogg b/audio/se/Fire5.ogg new file mode 100644 index 0000000..81870bb Binary files /dev/null and b/audio/se/Fire5.ogg differ diff --git a/audio/se/Fire6.ogg b/audio/se/Fire6.ogg new file mode 100644 index 0000000..43ca813 Binary files /dev/null and b/audio/se/Fire6.ogg differ diff --git a/audio/se/Fire7.ogg b/audio/se/Fire7.ogg new file mode 100644 index 0000000..5903670 Binary files /dev/null and b/audio/se/Fire7.ogg differ diff --git a/audio/se/Fire8.ogg b/audio/se/Fire8.ogg new file mode 100644 index 0000000..16d8a0f Binary files /dev/null and b/audio/se/Fire8.ogg differ diff --git a/audio/se/Fire9.ogg b/audio/se/Fire9.ogg new file mode 100644 index 0000000..824e221 Binary files /dev/null and b/audio/se/Fire9.ogg differ diff --git a/audio/se/Flash1.ogg b/audio/se/Flash1.ogg new file mode 100644 index 0000000..8671496 Binary files /dev/null and b/audio/se/Flash1.ogg differ diff --git a/audio/se/Flash2.ogg b/audio/se/Flash2.ogg new file mode 100644 index 0000000..568e2a4 Binary files /dev/null and b/audio/se/Flash2.ogg differ diff --git a/audio/se/Flash3.ogg b/audio/se/Flash3.ogg new file mode 100644 index 0000000..4c80357 Binary files /dev/null and b/audio/se/Flash3.ogg differ diff --git a/audio/se/Float1.ogg b/audio/se/Float1.ogg new file mode 100644 index 0000000..cb0bcba Binary files /dev/null and b/audio/se/Float1.ogg differ diff --git a/audio/se/Float2.ogg b/audio/se/Float2.ogg new file mode 100644 index 0000000..4795031 Binary files /dev/null and b/audio/se/Float2.ogg differ diff --git a/audio/se/Fog1.ogg b/audio/se/Fog1.ogg new file mode 100644 index 0000000..42a054b Binary files /dev/null and b/audio/se/Fog1.ogg differ diff --git a/audio/se/Fog2.ogg b/audio/se/Fog2.ogg new file mode 100644 index 0000000..df19c12 Binary files /dev/null and b/audio/se/Fog2.ogg differ diff --git a/audio/se/Frog.ogg b/audio/se/Frog.ogg new file mode 100644 index 0000000..1ed847a Binary files /dev/null and b/audio/se/Frog.ogg differ diff --git a/audio/se/Gate1.ogg b/audio/se/Gate1.ogg new file mode 100644 index 0000000..c01913d Binary files /dev/null and b/audio/se/Gate1.ogg differ diff --git a/audio/se/Gate2.ogg b/audio/se/Gate2.ogg new file mode 100644 index 0000000..0b06060 Binary files /dev/null and b/audio/se/Gate2.ogg differ diff --git a/audio/se/Growl.ogg b/audio/se/Growl.ogg new file mode 100644 index 0000000..6ba190c Binary files /dev/null and b/audio/se/Growl.ogg differ diff --git a/audio/se/Gun1.ogg b/audio/se/Gun1.ogg new file mode 100644 index 0000000..fe92091 Binary files /dev/null and b/audio/se/Gun1.ogg differ diff --git a/audio/se/Gun2.ogg b/audio/se/Gun2.ogg new file mode 100644 index 0000000..2685d31 Binary files /dev/null and b/audio/se/Gun2.ogg differ diff --git a/audio/se/Gun3.ogg b/audio/se/Gun3.ogg new file mode 100644 index 0000000..77920da Binary files /dev/null and b/audio/se/Gun3.ogg differ diff --git a/audio/se/Hammer.ogg b/audio/se/Hammer.ogg new file mode 100644 index 0000000..335bc25 Binary files /dev/null and b/audio/se/Hammer.ogg differ diff --git a/audio/se/Heal1.ogg b/audio/se/Heal1.ogg new file mode 100644 index 0000000..a076c80 Binary files /dev/null and b/audio/se/Heal1.ogg differ diff --git a/audio/se/Heal2.ogg b/audio/se/Heal2.ogg new file mode 100644 index 0000000..656f451 Binary files /dev/null and b/audio/se/Heal2.ogg differ diff --git a/audio/se/Heal3.ogg b/audio/se/Heal3.ogg new file mode 100644 index 0000000..84a7931 Binary files /dev/null and b/audio/se/Heal3.ogg differ diff --git a/audio/se/Heal4.ogg b/audio/se/Heal4.ogg new file mode 100644 index 0000000..b1e2065 Binary files /dev/null and b/audio/se/Heal4.ogg differ diff --git a/audio/se/Heal5.ogg b/audio/se/Heal5.ogg new file mode 100644 index 0000000..233ed74 Binary files /dev/null and b/audio/se/Heal5.ogg differ diff --git a/audio/se/Heal6.ogg b/audio/se/Heal6.ogg new file mode 100644 index 0000000..3017d65 Binary files /dev/null and b/audio/se/Heal6.ogg differ diff --git a/audio/se/Heal7.ogg b/audio/se/Heal7.ogg new file mode 100644 index 0000000..de95cea Binary files /dev/null and b/audio/se/Heal7.ogg differ diff --git a/audio/se/Horn.ogg b/audio/se/Horn.ogg new file mode 100644 index 0000000..36351b9 Binary files /dev/null and b/audio/se/Horn.ogg differ diff --git a/audio/se/Horse.ogg b/audio/se/Horse.ogg new file mode 100644 index 0000000..42a0abe Binary files /dev/null and b/audio/se/Horse.ogg differ diff --git a/audio/se/Ice1.ogg b/audio/se/Ice1.ogg new file mode 100644 index 0000000..67169e1 Binary files /dev/null and b/audio/se/Ice1.ogg differ diff --git a/audio/se/Ice10.ogg b/audio/se/Ice10.ogg new file mode 100644 index 0000000..c8bc391 Binary files /dev/null and b/audio/se/Ice10.ogg differ diff --git a/audio/se/Ice11.ogg b/audio/se/Ice11.ogg new file mode 100644 index 0000000..140de2e Binary files /dev/null and b/audio/se/Ice11.ogg differ diff --git a/audio/se/Ice2.ogg b/audio/se/Ice2.ogg new file mode 100644 index 0000000..c514716 Binary files /dev/null and b/audio/se/Ice2.ogg differ diff --git a/audio/se/Ice3.ogg b/audio/se/Ice3.ogg new file mode 100644 index 0000000..6d05994 Binary files /dev/null and b/audio/se/Ice3.ogg differ diff --git a/audio/se/Ice4.ogg b/audio/se/Ice4.ogg new file mode 100644 index 0000000..64fe083 Binary files /dev/null and b/audio/se/Ice4.ogg differ diff --git a/audio/se/Ice5.ogg b/audio/se/Ice5.ogg new file mode 100644 index 0000000..0ef1cf7 Binary files /dev/null and b/audio/se/Ice5.ogg differ diff --git a/audio/se/Ice6.ogg b/audio/se/Ice6.ogg new file mode 100644 index 0000000..4f6610c Binary files /dev/null and b/audio/se/Ice6.ogg differ diff --git a/audio/se/Ice7.ogg b/audio/se/Ice7.ogg new file mode 100644 index 0000000..67db920 Binary files /dev/null and b/audio/se/Ice7.ogg differ diff --git a/audio/se/Ice8.ogg b/audio/se/Ice8.ogg new file mode 100644 index 0000000..6f8f8d2 Binary files /dev/null and b/audio/se/Ice8.ogg differ diff --git a/audio/se/Ice9.ogg b/audio/se/Ice9.ogg new file mode 100644 index 0000000..3c26a40 Binary files /dev/null and b/audio/se/Ice9.ogg differ diff --git a/audio/se/Item1.ogg b/audio/se/Item1.ogg new file mode 100644 index 0000000..a677969 Binary files /dev/null and b/audio/se/Item1.ogg differ diff --git a/audio/se/Item2.ogg b/audio/se/Item2.ogg new file mode 100644 index 0000000..2f6028f Binary files /dev/null and b/audio/se/Item2.ogg differ diff --git a/audio/se/Item3.ogg b/audio/se/Item3.ogg new file mode 100644 index 0000000..fddd663 Binary files /dev/null and b/audio/se/Item3.ogg differ diff --git a/audio/se/Jump1.ogg b/audio/se/Jump1.ogg new file mode 100644 index 0000000..e629380 Binary files /dev/null and b/audio/se/Jump1.ogg differ diff --git a/audio/se/Jump2.ogg b/audio/se/Jump2.ogg new file mode 100644 index 0000000..1cd80f2 Binary files /dev/null and b/audio/se/Jump2.ogg differ diff --git a/audio/se/Key.ogg b/audio/se/Key.ogg new file mode 100644 index 0000000..54d9cef Binary files /dev/null and b/audio/se/Key.ogg differ diff --git a/audio/se/Knock.ogg b/audio/se/Knock.ogg new file mode 100644 index 0000000..511c132 Binary files /dev/null and b/audio/se/Knock.ogg differ diff --git a/audio/se/Laser1.ogg b/audio/se/Laser1.ogg new file mode 100644 index 0000000..e68fe41 Binary files /dev/null and b/audio/se/Laser1.ogg differ diff --git a/audio/se/Laser2.ogg b/audio/se/Laser2.ogg new file mode 100644 index 0000000..ce3f6f2 Binary files /dev/null and b/audio/se/Laser2.ogg differ diff --git a/audio/se/Laugh.ogg b/audio/se/Laugh.ogg new file mode 100644 index 0000000..46b8206 Binary files /dev/null and b/audio/se/Laugh.ogg differ diff --git a/audio/se/Launch.ogg b/audio/se/Launch.ogg new file mode 100644 index 0000000..4527bf4 Binary files /dev/null and b/audio/se/Launch.ogg differ diff --git a/audio/se/Leakage.ogg b/audio/se/Leakage.ogg new file mode 100644 index 0000000..a6d1c8f Binary files /dev/null and b/audio/se/Leakage.ogg differ diff --git a/audio/se/Liquid.ogg b/audio/se/Liquid.ogg new file mode 100644 index 0000000..4fb7cc6 Binary files /dev/null and b/audio/se/Liquid.ogg differ diff --git a/audio/se/Load1.ogg b/audio/se/Load1.ogg new file mode 100644 index 0000000..81a632f Binary files /dev/null and b/audio/se/Load1.ogg differ diff --git a/audio/se/Load2.ogg b/audio/se/Load2.ogg new file mode 100644 index 0000000..61a84e6 Binary files /dev/null and b/audio/se/Load2.ogg differ diff --git a/audio/se/Machine.ogg b/audio/se/Machine.ogg new file mode 100644 index 0000000..e615d43 Binary files /dev/null and b/audio/se/Machine.ogg differ diff --git a/audio/se/Magic1.ogg b/audio/se/Magic1.ogg new file mode 100644 index 0000000..e9a5dd2 Binary files /dev/null and b/audio/se/Magic1.ogg differ diff --git a/audio/se/Magic10.ogg b/audio/se/Magic10.ogg new file mode 100644 index 0000000..0689420 Binary files /dev/null and b/audio/se/Magic10.ogg differ diff --git a/audio/se/Magic11.ogg b/audio/se/Magic11.ogg new file mode 100644 index 0000000..fac536f Binary files /dev/null and b/audio/se/Magic11.ogg differ diff --git a/audio/se/Magic12.ogg b/audio/se/Magic12.ogg new file mode 100644 index 0000000..6328794 Binary files /dev/null and b/audio/se/Magic12.ogg differ diff --git a/audio/se/Magic2.ogg b/audio/se/Magic2.ogg new file mode 100644 index 0000000..403b186 Binary files /dev/null and b/audio/se/Magic2.ogg differ diff --git a/audio/se/Magic3.ogg b/audio/se/Magic3.ogg new file mode 100644 index 0000000..b650891 Binary files /dev/null and b/audio/se/Magic3.ogg differ diff --git a/audio/se/Magic4.ogg b/audio/se/Magic4.ogg new file mode 100644 index 0000000..ed28619 Binary files /dev/null and b/audio/se/Magic4.ogg differ diff --git a/audio/se/Magic5.ogg b/audio/se/Magic5.ogg new file mode 100644 index 0000000..bbaa56f Binary files /dev/null and b/audio/se/Magic5.ogg differ diff --git a/audio/se/Magic6.ogg b/audio/se/Magic6.ogg new file mode 100644 index 0000000..a2f5ec7 Binary files /dev/null and b/audio/se/Magic6.ogg differ diff --git a/audio/se/Magic7.ogg b/audio/se/Magic7.ogg new file mode 100644 index 0000000..a6a8075 Binary files /dev/null and b/audio/se/Magic7.ogg differ diff --git a/audio/se/Magic8.ogg b/audio/se/Magic8.ogg new file mode 100644 index 0000000..9660f96 Binary files /dev/null and b/audio/se/Magic8.ogg differ diff --git a/audio/se/Magic9.ogg b/audio/se/Magic9.ogg new file mode 100644 index 0000000..32cb51b Binary files /dev/null and b/audio/se/Magic9.ogg differ diff --git a/audio/se/Miss.ogg b/audio/se/Miss.ogg new file mode 100644 index 0000000..5ac784b Binary files /dev/null and b/audio/se/Miss.ogg differ diff --git a/audio/se/Monster1.ogg b/audio/se/Monster1.ogg new file mode 100644 index 0000000..fe1855f Binary files /dev/null and b/audio/se/Monster1.ogg differ diff --git a/audio/se/Monster10.ogg b/audio/se/Monster10.ogg new file mode 100644 index 0000000..a0d7ca7 Binary files /dev/null and b/audio/se/Monster10.ogg differ diff --git a/audio/se/Monster2.ogg b/audio/se/Monster2.ogg new file mode 100644 index 0000000..09add24 Binary files /dev/null and b/audio/se/Monster2.ogg differ diff --git a/audio/se/Monster3.ogg b/audio/se/Monster3.ogg new file mode 100644 index 0000000..06794d0 Binary files /dev/null and b/audio/se/Monster3.ogg differ diff --git a/audio/se/Monster4.ogg b/audio/se/Monster4.ogg new file mode 100644 index 0000000..fd3dfeb Binary files /dev/null and b/audio/se/Monster4.ogg differ diff --git a/audio/se/Monster5.ogg b/audio/se/Monster5.ogg new file mode 100644 index 0000000..f844a54 Binary files /dev/null and b/audio/se/Monster5.ogg differ diff --git a/audio/se/Monster6.ogg b/audio/se/Monster6.ogg new file mode 100644 index 0000000..2548934 Binary files /dev/null and b/audio/se/Monster6.ogg differ diff --git a/audio/se/Monster7.ogg b/audio/se/Monster7.ogg new file mode 100644 index 0000000..e4f996b Binary files /dev/null and b/audio/se/Monster7.ogg differ diff --git a/audio/se/Monster8.ogg b/audio/se/Monster8.ogg new file mode 100644 index 0000000..53864fa Binary files /dev/null and b/audio/se/Monster8.ogg differ diff --git a/audio/se/Monster9.ogg b/audio/se/Monster9.ogg new file mode 100644 index 0000000..ebc836c Binary files /dev/null and b/audio/se/Monster9.ogg differ diff --git a/audio/se/Move1.ogg b/audio/se/Move1.ogg new file mode 100644 index 0000000..210f5a3 Binary files /dev/null and b/audio/se/Move1.ogg differ diff --git a/audio/se/Move10.ogg b/audio/se/Move10.ogg new file mode 100644 index 0000000..c837af3 Binary files /dev/null and b/audio/se/Move10.ogg differ diff --git a/audio/se/Move2.ogg b/audio/se/Move2.ogg new file mode 100644 index 0000000..57854a9 Binary files /dev/null and b/audio/se/Move2.ogg differ diff --git a/audio/se/Move3.ogg b/audio/se/Move3.ogg new file mode 100644 index 0000000..a95ffa5 Binary files /dev/null and b/audio/se/Move3.ogg differ diff --git a/audio/se/Move4.ogg b/audio/se/Move4.ogg new file mode 100644 index 0000000..8536f2b Binary files /dev/null and b/audio/se/Move4.ogg differ diff --git a/audio/se/Move5.ogg b/audio/se/Move5.ogg new file mode 100644 index 0000000..db4dde3 Binary files /dev/null and b/audio/se/Move5.ogg differ diff --git a/audio/se/Move6.ogg b/audio/se/Move6.ogg new file mode 100644 index 0000000..de597b8 Binary files /dev/null and b/audio/se/Move6.ogg differ diff --git a/audio/se/Move7.ogg b/audio/se/Move7.ogg new file mode 100644 index 0000000..7b78f5d Binary files /dev/null and b/audio/se/Move7.ogg differ diff --git a/audio/se/Move8.ogg b/audio/se/Move8.ogg new file mode 100644 index 0000000..ffe0885 Binary files /dev/null and b/audio/se/Move8.ogg differ diff --git a/audio/se/Move9.ogg b/audio/se/Move9.ogg new file mode 100644 index 0000000..5aeb51d Binary files /dev/null and b/audio/se/Move9.ogg differ diff --git a/audio/se/Neon.ogg b/audio/se/Neon.ogg new file mode 100644 index 0000000..f0dc969 Binary files /dev/null and b/audio/se/Neon.ogg differ diff --git a/audio/se/Noise.ogg b/audio/se/Noise.ogg new file mode 100644 index 0000000..74150f6 Binary files /dev/null and b/audio/se/Noise.ogg differ diff --git a/audio/se/Open1.ogg b/audio/se/Open1.ogg new file mode 100644 index 0000000..6abc71c Binary files /dev/null and b/audio/se/Open1.ogg differ diff --git a/audio/se/Open2.ogg b/audio/se/Open2.ogg new file mode 100644 index 0000000..e7ea907 Binary files /dev/null and b/audio/se/Open2.ogg differ diff --git a/audio/se/Open3.ogg b/audio/se/Open3.ogg new file mode 100644 index 0000000..a815c8f Binary files /dev/null and b/audio/se/Open3.ogg differ diff --git a/audio/se/Open4.ogg b/audio/se/Open4.ogg new file mode 100644 index 0000000..a544746 Binary files /dev/null and b/audio/se/Open4.ogg differ diff --git a/audio/se/Open5.ogg b/audio/se/Open5.ogg new file mode 100644 index 0000000..e46c4f9 Binary files /dev/null and b/audio/se/Open5.ogg differ diff --git a/audio/se/Open6.ogg b/audio/se/Open6.ogg new file mode 100644 index 0000000..cd5a4de Binary files /dev/null and b/audio/se/Open6.ogg differ diff --git a/audio/se/Open7.ogg b/audio/se/Open7.ogg new file mode 100644 index 0000000..8f1cecb Binary files /dev/null and b/audio/se/Open7.ogg differ diff --git a/audio/se/Open8.ogg b/audio/se/Open8.ogg new file mode 100644 index 0000000..314c156 Binary files /dev/null and b/audio/se/Open8.ogg differ diff --git a/audio/se/Open9.ogg b/audio/se/Open9.ogg new file mode 100644 index 0000000..0830955 Binary files /dev/null and b/audio/se/Open9.ogg differ diff --git a/audio/se/Paralyze1.ogg b/audio/se/Paralyze1.ogg new file mode 100644 index 0000000..4f86c28 Binary files /dev/null and b/audio/se/Paralyze1.ogg differ diff --git a/audio/se/Paralyze2.ogg b/audio/se/Paralyze2.ogg new file mode 100644 index 0000000..65b9e32 Binary files /dev/null and b/audio/se/Paralyze2.ogg differ diff --git a/audio/se/Paralyze3.ogg b/audio/se/Paralyze3.ogg new file mode 100644 index 0000000..9b54482 Binary files /dev/null and b/audio/se/Paralyze3.ogg differ diff --git a/audio/se/Parry.ogg b/audio/se/Parry.ogg new file mode 100644 index 0000000..2fa3161 Binary files /dev/null and b/audio/se/Parry.ogg differ diff --git a/audio/se/Particles1.ogg b/audio/se/Particles1.ogg new file mode 100644 index 0000000..33b3530 Binary files /dev/null and b/audio/se/Particles1.ogg differ diff --git a/audio/se/Particles2.ogg b/audio/se/Particles2.ogg new file mode 100644 index 0000000..34b763f Binary files /dev/null and b/audio/se/Particles2.ogg differ diff --git a/audio/se/Particles3.ogg b/audio/se/Particles3.ogg new file mode 100644 index 0000000..78bac8c Binary files /dev/null and b/audio/se/Particles3.ogg differ diff --git a/audio/se/Particles4.ogg b/audio/se/Particles4.ogg new file mode 100644 index 0000000..0dc762c Binary files /dev/null and b/audio/se/Particles4.ogg differ diff --git a/audio/se/Phone.ogg b/audio/se/Phone.ogg new file mode 100644 index 0000000..358ca8e Binary files /dev/null and b/audio/se/Phone.ogg differ diff --git a/audio/se/Poison.ogg b/audio/se/Poison.ogg new file mode 100644 index 0000000..01f13ec Binary files /dev/null and b/audio/se/Poison.ogg differ diff --git a/audio/se/Pollen.ogg b/audio/se/Pollen.ogg new file mode 100644 index 0000000..7489760 Binary files /dev/null and b/audio/se/Pollen.ogg differ diff --git a/audio/se/Powerup.ogg b/audio/se/Powerup.ogg new file mode 100644 index 0000000..d998b13 Binary files /dev/null and b/audio/se/Powerup.ogg differ diff --git a/audio/se/Push.ogg b/audio/se/Push.ogg new file mode 100644 index 0000000..459d090 Binary files /dev/null and b/audio/se/Push.ogg differ diff --git a/audio/se/Raise1.ogg b/audio/se/Raise1.ogg new file mode 100644 index 0000000..b12b9fb Binary files /dev/null and b/audio/se/Raise1.ogg differ diff --git a/audio/se/Raise2.ogg b/audio/se/Raise2.ogg new file mode 100644 index 0000000..946ca3e Binary files /dev/null and b/audio/se/Raise2.ogg differ diff --git a/audio/se/Raise3.ogg b/audio/se/Raise3.ogg new file mode 100644 index 0000000..4b63c52 Binary files /dev/null and b/audio/se/Raise3.ogg differ diff --git a/audio/se/Recovery.ogg b/audio/se/Recovery.ogg new file mode 100644 index 0000000..27f1a92 Binary files /dev/null and b/audio/se/Recovery.ogg differ diff --git a/audio/se/Reflection.ogg b/audio/se/Reflection.ogg new file mode 100644 index 0000000..206add9 Binary files /dev/null and b/audio/se/Reflection.ogg differ diff --git a/audio/se/Resonance.ogg b/audio/se/Resonance.ogg new file mode 100644 index 0000000..3587fed Binary files /dev/null and b/audio/se/Resonance.ogg differ diff --git a/audio/se/Run.ogg b/audio/se/Run.ogg new file mode 100644 index 0000000..f443d46 Binary files /dev/null and b/audio/se/Run.ogg differ diff --git a/audio/se/Saint1.ogg b/audio/se/Saint1.ogg new file mode 100644 index 0000000..213cc04 Binary files /dev/null and b/audio/se/Saint1.ogg differ diff --git a/audio/se/Saint2.ogg b/audio/se/Saint2.ogg new file mode 100644 index 0000000..a8b9010 Binary files /dev/null and b/audio/se/Saint2.ogg differ diff --git a/audio/se/Saint3.ogg b/audio/se/Saint3.ogg new file mode 100644 index 0000000..6b98be5 Binary files /dev/null and b/audio/se/Saint3.ogg differ diff --git a/audio/se/Saint4.ogg b/audio/se/Saint4.ogg new file mode 100644 index 0000000..a708de3 Binary files /dev/null and b/audio/se/Saint4.ogg differ diff --git a/audio/se/Saint5.ogg b/audio/se/Saint5.ogg new file mode 100644 index 0000000..19c2244 Binary files /dev/null and b/audio/se/Saint5.ogg differ diff --git a/audio/se/Saint6.ogg b/audio/se/Saint6.ogg new file mode 100644 index 0000000..9a4276a Binary files /dev/null and b/audio/se/Saint6.ogg differ diff --git a/audio/se/Saint7.ogg b/audio/se/Saint7.ogg new file mode 100644 index 0000000..0ff55de Binary files /dev/null and b/audio/se/Saint7.ogg differ diff --git a/audio/se/Saint8.ogg b/audio/se/Saint8.ogg new file mode 100644 index 0000000..2344e2b Binary files /dev/null and b/audio/se/Saint8.ogg differ diff --git a/audio/se/Saint9.ogg b/audio/se/Saint9.ogg new file mode 100644 index 0000000..74b5703 Binary files /dev/null and b/audio/se/Saint9.ogg differ diff --git a/audio/se/Sand.ogg b/audio/se/Sand.ogg new file mode 100644 index 0000000..9e000dc Binary files /dev/null and b/audio/se/Sand.ogg differ diff --git a/audio/se/Save1.ogg b/audio/se/Save1.ogg new file mode 100644 index 0000000..1a396c5 Binary files /dev/null and b/audio/se/Save1.ogg differ diff --git a/audio/se/Save2.ogg b/audio/se/Save2.ogg new file mode 100644 index 0000000..ec5e121 Binary files /dev/null and b/audio/se/Save2.ogg differ diff --git a/audio/se/Scream.ogg b/audio/se/Scream.ogg new file mode 100644 index 0000000..2d7f6e3 Binary files /dev/null and b/audio/se/Scream.ogg differ diff --git a/audio/se/Sheep.ogg b/audio/se/Sheep.ogg new file mode 100644 index 0000000..2f4482e Binary files /dev/null and b/audio/se/Sheep.ogg differ diff --git a/audio/se/Shop1.ogg b/audio/se/Shop1.ogg new file mode 100644 index 0000000..3237dd4 Binary files /dev/null and b/audio/se/Shop1.ogg differ diff --git a/audio/se/Shop2.ogg b/audio/se/Shop2.ogg new file mode 100644 index 0000000..f28285d Binary files /dev/null and b/audio/se/Shop2.ogg differ diff --git a/audio/se/Shot1.ogg b/audio/se/Shot1.ogg new file mode 100644 index 0000000..2f00387 Binary files /dev/null and b/audio/se/Shot1.ogg differ diff --git a/audio/se/Shot2.ogg b/audio/se/Shot2.ogg new file mode 100644 index 0000000..87b9ffa Binary files /dev/null and b/audio/se/Shot2.ogg differ diff --git a/audio/se/Shot3.ogg b/audio/se/Shot3.ogg new file mode 100644 index 0000000..adbcad4 Binary files /dev/null and b/audio/se/Shot3.ogg differ diff --git a/audio/se/Silence.ogg b/audio/se/Silence.ogg new file mode 100644 index 0000000..ee9595b Binary files /dev/null and b/audio/se/Silence.ogg differ diff --git a/audio/se/Siren.ogg b/audio/se/Siren.ogg new file mode 100644 index 0000000..f63257c Binary files /dev/null and b/audio/se/Siren.ogg differ diff --git a/audio/se/Skill1.ogg b/audio/se/Skill1.ogg new file mode 100644 index 0000000..dbeb64e Binary files /dev/null and b/audio/se/Skill1.ogg differ diff --git a/audio/se/Skill2.ogg b/audio/se/Skill2.ogg new file mode 100644 index 0000000..5ce9fb1 Binary files /dev/null and b/audio/se/Skill2.ogg differ diff --git a/audio/se/Skill3.ogg b/audio/se/Skill3.ogg new file mode 100644 index 0000000..103a7b9 Binary files /dev/null and b/audio/se/Skill3.ogg differ diff --git a/audio/se/Slash1.ogg b/audio/se/Slash1.ogg new file mode 100644 index 0000000..6e434a2 Binary files /dev/null and b/audio/se/Slash1.ogg differ diff --git a/audio/se/Slash10.ogg b/audio/se/Slash10.ogg new file mode 100644 index 0000000..dfed51a Binary files /dev/null and b/audio/se/Slash10.ogg differ diff --git a/audio/se/Slash2.ogg b/audio/se/Slash2.ogg new file mode 100644 index 0000000..580397a Binary files /dev/null and b/audio/se/Slash2.ogg differ diff --git a/audio/se/Slash3.ogg b/audio/se/Slash3.ogg new file mode 100644 index 0000000..2c8295c Binary files /dev/null and b/audio/se/Slash3.ogg differ diff --git a/audio/se/Slash4.ogg b/audio/se/Slash4.ogg new file mode 100644 index 0000000..2ce79db Binary files /dev/null and b/audio/se/Slash4.ogg differ diff --git a/audio/se/Slash5.ogg b/audio/se/Slash5.ogg new file mode 100644 index 0000000..a875b2e Binary files /dev/null and b/audio/se/Slash5.ogg differ diff --git a/audio/se/Slash6.ogg b/audio/se/Slash6.ogg new file mode 100644 index 0000000..cfdeb2b Binary files /dev/null and b/audio/se/Slash6.ogg differ diff --git a/audio/se/Slash7.ogg b/audio/se/Slash7.ogg new file mode 100644 index 0000000..3a09bfb Binary files /dev/null and b/audio/se/Slash7.ogg differ diff --git a/audio/se/Slash8.ogg b/audio/se/Slash8.ogg new file mode 100644 index 0000000..cce6881 Binary files /dev/null and b/audio/se/Slash8.ogg differ diff --git a/audio/se/Slash9.ogg b/audio/se/Slash9.ogg new file mode 100644 index 0000000..cd9ed18 Binary files /dev/null and b/audio/se/Slash9.ogg differ diff --git a/audio/se/Sleep.ogg b/audio/se/Sleep.ogg new file mode 100644 index 0000000..8c022ec Binary files /dev/null and b/audio/se/Sleep.ogg differ diff --git a/audio/se/Sound1.ogg b/audio/se/Sound1.ogg new file mode 100644 index 0000000..a512fd3 Binary files /dev/null and b/audio/se/Sound1.ogg differ diff --git a/audio/se/Sound2.ogg b/audio/se/Sound2.ogg new file mode 100644 index 0000000..5d607f6 Binary files /dev/null and b/audio/se/Sound2.ogg differ diff --git a/audio/se/Sound3.ogg b/audio/se/Sound3.ogg new file mode 100644 index 0000000..046ac13 Binary files /dev/null and b/audio/se/Sound3.ogg differ diff --git a/audio/se/Splash.ogg b/audio/se/Splash.ogg new file mode 100644 index 0000000..4b34c67 Binary files /dev/null and b/audio/se/Splash.ogg differ diff --git a/audio/se/Stare.ogg b/audio/se/Stare.ogg new file mode 100644 index 0000000..942285f Binary files /dev/null and b/audio/se/Stare.ogg differ diff --git a/audio/se/Starlight.ogg b/audio/se/Starlight.ogg new file mode 100644 index 0000000..2d817b7 Binary files /dev/null and b/audio/se/Starlight.ogg differ diff --git a/audio/se/Summon.ogg b/audio/se/Summon.ogg new file mode 100644 index 0000000..451cf08 Binary files /dev/null and b/audio/se/Summon.ogg differ diff --git a/audio/se/Switch1.ogg b/audio/se/Switch1.ogg new file mode 100644 index 0000000..38d89ef Binary files /dev/null and b/audio/se/Switch1.ogg differ diff --git a/audio/se/Switch2.ogg b/audio/se/Switch2.ogg new file mode 100644 index 0000000..0efc55f Binary files /dev/null and b/audio/se/Switch2.ogg differ diff --git a/audio/se/Switch3.ogg b/audio/se/Switch3.ogg new file mode 100644 index 0000000..5ea1f2d Binary files /dev/null and b/audio/se/Switch3.ogg differ diff --git a/audio/se/Sword1.ogg b/audio/se/Sword1.ogg new file mode 100644 index 0000000..19f88ac Binary files /dev/null and b/audio/se/Sword1.ogg differ diff --git a/audio/se/Sword2.ogg b/audio/se/Sword2.ogg new file mode 100644 index 0000000..1b0ac8d Binary files /dev/null and b/audio/se/Sword2.ogg differ diff --git a/audio/se/Sword3.ogg b/audio/se/Sword3.ogg new file mode 100644 index 0000000..8ff7524 Binary files /dev/null and b/audio/se/Sword3.ogg differ diff --git a/audio/se/Sword4.ogg b/audio/se/Sword4.ogg new file mode 100644 index 0000000..5ccc956 Binary files /dev/null and b/audio/se/Sword4.ogg differ diff --git a/audio/se/Sword5.ogg b/audio/se/Sword5.ogg new file mode 100644 index 0000000..b2ac437 Binary files /dev/null and b/audio/se/Sword5.ogg differ diff --git a/audio/se/Sword6.ogg b/audio/se/Sword6.ogg new file mode 100644 index 0000000..437fd9f Binary files /dev/null and b/audio/se/Sword6.ogg differ diff --git a/audio/se/Sword7.ogg b/audio/se/Sword7.ogg new file mode 100644 index 0000000..b102307 Binary files /dev/null and b/audio/se/Sword7.ogg differ diff --git a/audio/se/Teleport.ogg b/audio/se/Teleport.ogg new file mode 100644 index 0000000..0761d88 Binary files /dev/null and b/audio/se/Teleport.ogg differ diff --git a/audio/se/Thunder1.ogg b/audio/se/Thunder1.ogg new file mode 100644 index 0000000..a75e683 Binary files /dev/null and b/audio/se/Thunder1.ogg differ diff --git a/audio/se/Thunder10.ogg b/audio/se/Thunder10.ogg new file mode 100644 index 0000000..7eb440b Binary files /dev/null and b/audio/se/Thunder10.ogg differ diff --git a/audio/se/Thunder11.ogg b/audio/se/Thunder11.ogg new file mode 100644 index 0000000..2affb2e Binary files /dev/null and b/audio/se/Thunder11.ogg differ diff --git a/audio/se/Thunder12.ogg b/audio/se/Thunder12.ogg new file mode 100644 index 0000000..0df94ea Binary files /dev/null and b/audio/se/Thunder12.ogg differ diff --git a/audio/se/Thunder13.ogg b/audio/se/Thunder13.ogg new file mode 100644 index 0000000..4f4a2ac Binary files /dev/null and b/audio/se/Thunder13.ogg differ diff --git a/audio/se/Thunder14.ogg b/audio/se/Thunder14.ogg new file mode 100644 index 0000000..77118d4 Binary files /dev/null and b/audio/se/Thunder14.ogg differ diff --git a/audio/se/Thunder2.ogg b/audio/se/Thunder2.ogg new file mode 100644 index 0000000..2fca432 Binary files /dev/null and b/audio/se/Thunder2.ogg differ diff --git a/audio/se/Thunder3.ogg b/audio/se/Thunder3.ogg new file mode 100644 index 0000000..c991e73 Binary files /dev/null and b/audio/se/Thunder3.ogg differ diff --git a/audio/se/Thunder4.ogg b/audio/se/Thunder4.ogg new file mode 100644 index 0000000..049b95d Binary files /dev/null and b/audio/se/Thunder4.ogg differ diff --git a/audio/se/Thunder5.ogg b/audio/se/Thunder5.ogg new file mode 100644 index 0000000..b4eefc8 Binary files /dev/null and b/audio/se/Thunder5.ogg differ diff --git a/audio/se/Thunder6.ogg b/audio/se/Thunder6.ogg new file mode 100644 index 0000000..18ff9c0 Binary files /dev/null and b/audio/se/Thunder6.ogg differ diff --git a/audio/se/Thunder7.ogg b/audio/se/Thunder7.ogg new file mode 100644 index 0000000..6837774 Binary files /dev/null and b/audio/se/Thunder7.ogg differ diff --git a/audio/se/Thunder8.ogg b/audio/se/Thunder8.ogg new file mode 100644 index 0000000..9592cf8 Binary files /dev/null and b/audio/se/Thunder8.ogg differ diff --git a/audio/se/Thunder9.ogg b/audio/se/Thunder9.ogg new file mode 100644 index 0000000..d59e552 Binary files /dev/null and b/audio/se/Thunder9.ogg differ diff --git a/audio/se/Transceiver.ogg b/audio/se/Transceiver.ogg new file mode 100644 index 0000000..11601d5 Binary files /dev/null and b/audio/se/Transceiver.ogg differ diff --git a/audio/se/Twine.ogg b/audio/se/Twine.ogg new file mode 100644 index 0000000..3a2d08d Binary files /dev/null and b/audio/se/Twine.ogg differ diff --git a/audio/se/Up1.ogg b/audio/se/Up1.ogg new file mode 100644 index 0000000..6adb685 Binary files /dev/null and b/audio/se/Up1.ogg differ diff --git a/audio/se/Up2.ogg b/audio/se/Up2.ogg new file mode 100644 index 0000000..e052742 Binary files /dev/null and b/audio/se/Up2.ogg differ diff --git a/audio/se/Up3.ogg b/audio/se/Up3.ogg new file mode 100644 index 0000000..038d2a6 Binary files /dev/null and b/audio/se/Up3.ogg differ diff --git a/audio/se/Up4.ogg b/audio/se/Up4.ogg new file mode 100644 index 0000000..ebe0e5d Binary files /dev/null and b/audio/se/Up4.ogg differ diff --git a/audio/se/Up5.ogg b/audio/se/Up5.ogg new file mode 100644 index 0000000..71be3ff Binary files /dev/null and b/audio/se/Up5.ogg differ diff --git a/audio/se/Up6.ogg b/audio/se/Up6.ogg new file mode 100644 index 0000000..58b9090 Binary files /dev/null and b/audio/se/Up6.ogg differ diff --git a/audio/se/Up7.ogg b/audio/se/Up7.ogg new file mode 100644 index 0000000..ea593e2 Binary files /dev/null and b/audio/se/Up7.ogg differ diff --git a/audio/se/Up8.ogg b/audio/se/Up8.ogg new file mode 100644 index 0000000..7c999ad Binary files /dev/null and b/audio/se/Up8.ogg differ diff --git a/audio/se/Water1.ogg b/audio/se/Water1.ogg new file mode 100644 index 0000000..bb7e316 Binary files /dev/null and b/audio/se/Water1.ogg differ diff --git a/audio/se/Water2.ogg b/audio/se/Water2.ogg new file mode 100644 index 0000000..a842fda Binary files /dev/null and b/audio/se/Water2.ogg differ diff --git a/audio/se/Water3.ogg b/audio/se/Water3.ogg new file mode 100644 index 0000000..1b29708 Binary files /dev/null and b/audio/se/Water3.ogg differ diff --git a/audio/se/Water4.ogg b/audio/se/Water4.ogg new file mode 100644 index 0000000..ccb96fb Binary files /dev/null and b/audio/se/Water4.ogg differ diff --git a/audio/se/Water5.ogg b/audio/se/Water5.ogg new file mode 100644 index 0000000..28bd3cc Binary files /dev/null and b/audio/se/Water5.ogg differ diff --git a/audio/se/Wind1.ogg b/audio/se/Wind1.ogg new file mode 100644 index 0000000..b024c43 Binary files /dev/null and b/audio/se/Wind1.ogg differ diff --git a/audio/se/Wind10.ogg b/audio/se/Wind10.ogg new file mode 100644 index 0000000..16ff744 Binary files /dev/null and b/audio/se/Wind10.ogg differ diff --git a/audio/se/Wind11.ogg b/audio/se/Wind11.ogg new file mode 100644 index 0000000..364b34f Binary files /dev/null and b/audio/se/Wind11.ogg differ diff --git a/audio/se/Wind2.ogg b/audio/se/Wind2.ogg new file mode 100644 index 0000000..a42f9ef Binary files /dev/null and b/audio/se/Wind2.ogg differ diff --git a/audio/se/Wind3.ogg b/audio/se/Wind3.ogg new file mode 100644 index 0000000..aa967a8 Binary files /dev/null and b/audio/se/Wind3.ogg differ diff --git a/audio/se/Wind4.ogg b/audio/se/Wind4.ogg new file mode 100644 index 0000000..dc1cc4b Binary files /dev/null and b/audio/se/Wind4.ogg differ diff --git a/audio/se/Wind5.ogg b/audio/se/Wind5.ogg new file mode 100644 index 0000000..5c49d3d Binary files /dev/null and b/audio/se/Wind5.ogg differ diff --git a/audio/se/Wind6.ogg b/audio/se/Wind6.ogg new file mode 100644 index 0000000..23840ff Binary files /dev/null and b/audio/se/Wind6.ogg differ diff --git a/audio/se/Wind7.ogg b/audio/se/Wind7.ogg new file mode 100644 index 0000000..b8bf210 Binary files /dev/null and b/audio/se/Wind7.ogg differ diff --git a/audio/se/Wind8.ogg b/audio/se/Wind8.ogg new file mode 100644 index 0000000..8d29729 Binary files /dev/null and b/audio/se/Wind8.ogg differ diff --git a/audio/se/Wind9.ogg b/audio/se/Wind9.ogg new file mode 100644 index 0000000..0524135 Binary files /dev/null and b/audio/se/Wind9.ogg differ diff --git a/audio/se/Wolf.ogg b/audio/se/Wolf.ogg new file mode 100644 index 0000000..b4d2338 Binary files /dev/null and b/audio/se/Wolf.ogg differ diff --git a/css/game.css b/css/game.css new file mode 100644 index 0000000..f114975 --- /dev/null +++ b/css/game.css @@ -0,0 +1,116 @@ +body { + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} +#errorPrinter { + position: absolute; + left: 50%; + top: 50%; + width: 640px; + height: 100px; + transform: translate(-50%, -50%); + text-align: center; + text-shadow: 1px 1px 3px #000; + font-size: 20px; + color: #fff; + z-index: 9; +} +#errorName { + color: #ff0; + font-weight: bold; + -moz-user-select: text; + -webkit-user-select: text; + -ms-user-select: text; + user-select: text; +} +#errorMessage { + color: #fff; + -moz-user-select: text; + -webkit-user-select: text; + -ms-user-select: text; + user-select: text; +} +#retryButton { + font-size: 20px; + color: #fff; + background-color: #000; + border-radius: 8px; + margin: 20px; + padding: 10px; +} +#fpsCounterBox { + position: absolute; + left: 5px; + top: 5px; + width: 90px; + height: 40px; + background: #222; + opacity: 0.8; + z-index: 8; +} +#fpsCounterLabel { + position: absolute; + top: 0px; + left: 0px; + padding: 5px 10px; + height: 30px; + line-height: 32px; + font-size: 12px; + font-family: rmmz-numberfont, sans-serif; + color: #fff; + text-align: left; +} +#fpsCounterNumber { + position: absolute; + top: 0px; + right: 0px; + padding: 5px 10px; + height: 30px; + line-height: 30px; + font-size: 24px; + font-family: rmmz-numberfont, monospace; + color: #fff; + text-align: right; +} +#loadingSpinner { + margin: auto; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + width: 120px; + height: 120px; + z-index: 10; +} +#loadingSpinnerImage { + margin: 0px; + padding: 0px; + border-radius: 50%; + width: 96px; + height: 96px; + border: 12px solid rgba(255, 255, 255, 0.25); + border-top: 12px solid rgba(255, 255, 255, 1); + animation: fadein 2s ease, spin 1.5s linear infinite; +} +@keyframes fadein { + 0% { + opacity: 0; + } + 20% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/data/Actors.json b/data/Actors.json new file mode 100644 index 0000000..73b2fe2 --- /dev/null +++ b/data/Actors.json @@ -0,0 +1,11 @@ +[ +null, +{"id":1,"battlerName":"Actor1_1","characterIndex":0,"characterName":"Actor1","classId":1,"equips":[2,0,0,3,0],"faceIndex":0,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Reid","nickname":"","note":"","profile":""}, +{"id":2,"battlerName":"Actor1_2","characterIndex":1,"characterName":"Actor1","classId":1,"equips":[1,0,0,9,0],"faceIndex":1,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Priscilla","nickname":"","note":"","profile":""}, +{"id":3,"battlerName":"Actor1_3","characterIndex":2,"characterName":"Actor1","classId":5,"equips":[31,0,65,5,0],"faceIndex":2,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Gale","nickname":"","note":"","profile":""}, +{"id":4,"battlerName":"Actor1_4","characterIndex":3,"characterName":"Actor1","classId":5,"equips":[31,0,0,5,0],"faceIndex":3,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Michelle","nickname":"","note":"","profile":""}, +{"id":5,"battlerName":"Actor1_5","characterIndex":4,"characterName":"Actor1","classId":2,"equips":[7,0,0,20,0],"faceIndex":4,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Albert","nickname":"","note":"","profile":""}, +{"id":6,"battlerName":"Actor1_6","characterIndex":5,"characterName":"Actor1","classId":2,"equips":[7,0,65,21,0],"faceIndex":5,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Kasey","nickname":"","note":"","profile":""}, +{"id":7,"battlerName":"Actor1_7","characterIndex":6,"characterName":"Actor1","classId":3,"equips":[7,0,0,20,0],"faceIndex":6,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Eliot","nickname":"","note":"","profile":""}, +{"id":8,"battlerName":"Actor1_8","characterIndex":7,"characterName":"Actor1","classId":3,"equips":[7,0,0,20,0],"faceIndex":7,"faceName":"Actor1","traits":[],"initialLevel":1,"maxLevel":99,"name":"Roza","nickname":"","note":"","profile":""} +] \ No newline at end of file diff --git a/data/Animations.json b/data/Animations.json new file mode 100644 index 0000000..7db9f65 --- /dev/null +++ b/data/Animations.json @@ -0,0 +1,123 @@ +[ +null, +{"id":1,"displayType":0,"effectName":"HitPhysical","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]}],"name":"Hit Physical","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":50,"soundTimings":[{"frame":0,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":2,"displayType":0,"effectName":"HitEffect","flashTimings":[{"frame":1,"duration":30,"color":[255,255,255,255]}],"name":"Hit Effect","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":60,"soundTimings":[{"frame":0,"se":{"name":"Evasion2","pan":0,"pitch":150,"volume":80}},{"frame":1,"se":{"name":"Damage4","pan":0,"pitch":120,"volume":90}},{"frame":2,"se":{"name":"Powerup","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":3,"displayType":0,"effectName":"HitFire","flashTimings":[{"frame":0,"duration":30,"color":[255,119,102,221]},{"frame":2,"duration":30,"color":[255,136,51,153]}],"name":"Hit Fire","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":90}},{"frame":0,"se":{"name":"Fire1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":4,"displayType":0,"effectName":"HitIce","flashTimings":[{"frame":0,"duration":30,"color":[119,187,255,221]},{"frame":2,"duration":30,"color":[187,221,221,153]}],"name":"Hit Ice","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":100}},{"frame":0,"se":{"name":"Ice3","pan":0,"pitch":75,"volume":90}}],"speed":100}, +{"id":5,"displayType":0,"effectName":"HitThunder","flashTimings":[{"frame":0,"duration":30,"color":[255,255,102,221]},{"frame":2,"duration":30,"color":[255,255,119,153]}],"name":"Hit Thunder","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder8","pan":0,"pitch":80,"volume":100}},{"frame":0,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":6,"displayType":0,"effectName":"SlashPhysical","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,187]}],"name":"Slash Physical","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Slash1","pan":0,"pitch":140,"volume":80}}],"speed":100}, +{"id":7,"displayType":0,"effectName":"SlashEffect","flashTimings":[{"frame":1,"duration":30,"color":[255,255,255,255]}],"name":"Slash Effect","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Evasion2","pan":0,"pitch":150,"volume":80}},{"frame":0,"se":{"name":"Slash1","pan":0,"pitch":140,"volume":80}},{"frame":2,"se":{"name":"Powerup","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":8,"displayType":0,"effectName":"SlashFire","flashTimings":[{"frame":0,"duration":30,"color":[255,119,102,221]},{"frame":1,"duration":30,"color":[255,136,51,153]}],"name":"Slash Fire","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":120,"volume":90}},{"frame":2,"se":{"name":"Sword5","pan":0,"pitch":100,"volume":100}},{"frame":4,"se":{"name":"Fire1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":9,"displayType":0,"effectName":"SlashIce","flashTimings":[{"frame":0,"duration":30,"color":[119,187,255,221]},{"frame":1,"duration":30,"color":[187,221,221,153]}],"name":"Slash Ice","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Slash1","pan":0,"pitch":140,"volume":80}},{"frame":0,"se":{"name":"Ice3","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":10,"displayType":0,"effectName":"SlashThunder","flashTimings":[{"frame":0,"duration":30,"color":[255,255,102,221]},{"frame":1,"duration":30,"color":[255,255,119,153]}],"name":"Slash Thunder","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Slash1","pan":0,"pitch":140,"volume":80}},{"frame":0,"se":{"name":"Thunder8","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":11,"displayType":0,"effectName":"PiercePhysical","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]}],"name":"Pierce Physical","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":60,"soundTimings":[{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":120,"volume":90}},{"frame":4,"se":{"name":"Sword5","pan":0,"pitch":120,"volume":90}}],"speed":100}, +{"id":12,"displayType":0,"effectName":"PierceEffect","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]}],"name":"Pierce Effect","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":80,"soundTimings":[{"frame":0,"se":{"name":"Evasion2","pan":0,"pitch":150,"volume":80}},{"frame":1,"se":{"name":"Thunder4","pan":0,"pitch":120,"volume":90}},{"frame":8,"se":{"name":"Powerup","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":13,"displayType":0,"effectName":"PierceFire","flashTimings":[{"frame":0,"duration":30,"color":[255,119,102,221]},{"frame":3,"duration":30,"color":[255,136,51,153]}],"name":"Pierce Fire","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":80,"soundTimings":[{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":120,"volume":90}},{"frame":2,"se":{"name":"Sword5","pan":0,"pitch":100,"volume":100}},{"frame":3,"se":{"name":"Fire1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":14,"displayType":0,"effectName":"PierceIce","flashTimings":[{"frame":0,"duration":30,"color":[119,187,255,221]},{"frame":3,"duration":30,"color":[187,221,221,153]}],"name":"Pierce Ice","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":80,"soundTimings":[{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":120,"volume":90}},{"frame":2,"se":{"name":"Sword5","pan":0,"pitch":100,"volume":100}},{"frame":3,"se":{"name":"Ice3","pan":0,"pitch":75,"volume":100}}],"speed":100}, +{"id":15,"displayType":0,"effectName":"PierceThunder","flashTimings":[{"frame":0,"duration":60,"color":[255,255,102,221]},{"frame":3,"duration":60,"color":[255,255,85,153]}],"name":"Pierce Thunder","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":80,"soundTimings":[{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":120,"volume":90}},{"frame":2,"se":{"name":"Sword5","pan":0,"pitch":100,"volume":100}},{"frame":3,"se":{"name":"Thunder8","pan":0,"pitch":80,"volume":100}}],"speed":100}, +{"id":16,"displayType":0,"effectName":"ClawPhysical","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]}],"name":"Claw Physical","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":17,"displayType":0,"effectName":"ClawEffect","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]}],"name":"Claw Effect","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Evasion2","pan":0,"pitch":150,"volume":80}},{"frame":1,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":2,"se":{"name":"Powerup","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":18,"displayType":0,"effectName":"ClawFire","flashTimings":[{"frame":0,"duration":30,"color":[255,119,102,221]}],"name":"Claw Fire","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Attack2","pan":0,"pitch":100,"volume":90}},{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Fire1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":19,"displayType":0,"effectName":"ClawIce","flashTimings":[{"frame":0,"duration":30,"color":[119,187,255,221]}],"name":"Claw Ice","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Ice3","pan":0,"pitch":75,"volume":100}}],"speed":100}, +{"id":20,"displayType":0,"effectName":"ClawThunder","flashTimings":[{"frame":0,"duration":30,"color":[255,255,102,221]}],"name":"Claw Thunder","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Thunder8","pan":0,"pitch":80,"volume":100}}],"speed":100}, +{"id":21,"displayType":0,"effectName":"HitSpecial1","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]},{"frame":29,"duration":30,"color":[255,255,255,255]},{"frame":59,"duration":70,"color":[255,255,255,255]},{"frame":99,"duration":70,"color":[255,255,255,255]}],"name":"Hit Special 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":2,"se":{"name":"Blow1","pan":0,"pitch":120,"volume":90}},{"frame":5,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":9,"se":{"name":"Blow1","pan":0,"pitch":120,"volume":90}},{"frame":27,"se":{"name":"Thunder5","pan":0,"pitch":120,"volume":90}},{"frame":34,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":44,"se":{"name":"Thunder5","pan":0,"pitch":120,"volume":90}},{"frame":44,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":51,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":69,"se":{"name":"Thunder5","pan":0,"pitch":120,"volume":90}},{"frame":84,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":91,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":99,"se":{"name":"Thunder5","pan":0,"pitch":120,"volume":90}}],"speed":100}, +{"id":22,"displayType":1,"effectName":"HitSpecial2","flashTimings":[{"frame":9,"duration":27,"color":[255,255,255,255]},{"frame":27,"duration":27,"color":[255,255,255,255]},{"frame":54,"duration":35,"color":[255,255,255,255]},{"frame":89,"duration":30,"color":[255,255,255,255]}],"name":"Hit Special 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":200,"soundTimings":[{"frame":0,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":90}},{"frame":2,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":5,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":100}},{"frame":7,"se":{"name":"Blow2","pan":0,"pitch":100,"volume":100}},{"frame":9,"se":{"name":"Blow1","pan":0,"pitch":100,"volume":100}},{"frame":12,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":90}},{"frame":14,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":100}},{"frame":17,"se":{"name":"Blow2","pan":0,"pitch":100,"volume":100}},{"frame":18,"se":{"name":"Blow3","pan":0,"pitch":70,"volume":90}},{"frame":22,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":100}},{"frame":24,"se":{"name":"Blow2","pan":0,"pitch":100,"volume":100}},{"frame":27,"se":{"name":"Blow3","pan":0,"pitch":70,"volume":90}},{"frame":34,"se":{"name":"Blow3","pan":0,"pitch":100,"volume":100}},{"frame":44,"se":{"name":"Blow2","pan":0,"pitch":100,"volume":100}},{"frame":54,"se":{"name":"Blow3","pan":0,"pitch":70,"volume":90}},{"frame":59,"se":{"name":"Damage2","pan":0,"pitch":120,"volume":100}},{"frame":79,"se":{"name":"Damage2","pan":0,"pitch":120,"volume":100}}],"speed":100}, +{"id":23,"displayType":0,"effectName":"SlashSpecial1","flashTimings":[{"frame":0,"duration":27,"color":[255,255,255,255]},{"frame":27,"duration":28,"color":[255,255,255,255]},{"frame":55,"duration":30,"color":[255,255,255,255]}],"name":"Slash Special 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":1,"se":{"name":"Slash1","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}},{"frame":5,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}},{"frame":7,"se":{"name":"Slash1","pan":0,"pitch":120,"volume":90}},{"frame":9,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}},{"frame":11,"se":{"name":"Slash4","pan":0,"pitch":120,"volume":90}},{"frame":15,"se":{"name":"Slash1","pan":0,"pitch":100,"volume":90}},{"frame":17,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}},{"frame":19,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}},{"frame":23,"se":{"name":"Slash1","pan":0,"pitch":120,"volume":90}},{"frame":27,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}},{"frame":47,"se":{"name":"Evasion2","pan":0,"pitch":120,"volume":90}}],"speed":100}, +{"id":24,"displayType":1,"effectName":"SlashSpecial2","flashTimings":[{"frame":0,"duration":17,"color":[255,255,255,255]},{"frame":29,"duration":40,"color":[255,68,0,102]}],"name":"Slash Special 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":0,"se":{"name":"Sword4","pan":0,"pitch":100,"volume":90}},{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":110,"volume":90}},{"frame":3,"se":{"name":"Wind4","pan":0,"pitch":100,"volume":80}},{"frame":7,"se":{"name":"Slash8","pan":0,"pitch":100,"volume":90}},{"frame":7,"se":{"name":"Wind4","pan":0,"pitch":100,"volume":100}},{"frame":9,"se":{"name":"Slash1","pan":0,"pitch":90,"volume":90}},{"frame":16,"se":{"name":"Ice3","pan":0,"pitch":90,"volume":90}}],"speed":100}, +{"id":25,"displayType":2,"effectName":"SlashSpecial3","flashTimings":[{"frame":0,"duration":22,"color":[255,255,255,255]},{"frame":22,"duration":37,"color":[255,255,255,255]},{"frame":59,"duration":40,"color":[255,255,255,255]},{"frame":99,"duration":15,"color":[255,255,255,255]}],"name":"Slash Special 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":100}},{"frame":8,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":100}},{"frame":11,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":100}},{"frame":22,"se":{"name":"Slash3","pan":0,"pitch":100,"volume":100}},{"frame":28,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":100}},{"frame":33,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":100}},{"frame":37,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":100}},{"frame":43,"se":{"name":"Slash3","pan":0,"pitch":100,"volume":100}},{"frame":59,"se":{"name":"Slash1","pan":0,"pitch":100,"volume":100}},{"frame":59,"se":{"name":"Evasion1","pan":0,"pitch":150,"volume":70}},{"frame":79,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":100}},{"frame":79,"se":{"name":"Evasion1","pan":0,"pitch":150,"volume":70}},{"frame":95,"se":{"name":"Slash1","pan":0,"pitch":100,"volume":100}},{"frame":99,"se":{"name":"Slash3","pan":0,"pitch":120,"volume":90}}],"speed":100}, +{"id":26,"displayType":0,"effectName":"PierceSpecial1","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,255]},{"frame":31,"duration":32,"color":[255,255,255,255]},{"frame":62,"duration":31,"color":[255,255,255,255]},{"frame":99,"duration":27,"color":[255,255,255,255]}],"name":"Pierce Special 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind6","pan":0,"pitch":130,"volume":90}},{"frame":2,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":3,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":4,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":5,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":6,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":11,"se":{"name":"Wind6","pan":0,"pitch":130,"volume":90}},{"frame":15,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":19,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":21,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":26,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":31,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":35,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":38,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":41,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":46,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":52,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":56,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":62,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":66,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":69,"se":{"name":"Sword5","pan":0,"pitch":130,"volume":90}},{"frame":74,"se":{"name":"Slash1","pan":0,"pitch":150,"volume":90}},{"frame":89,"se":{"name":"Sword4","pan":0,"pitch":130,"volume":90}},{"frame":89,"se":{"name":"Slash2","pan":0,"pitch":130,"volume":90}}],"speed":100}, +{"id":27,"displayType":0,"effectName":"PierceSpecial2","flashTimings":[{"frame":0,"duration":31,"color":[255,255,255,255]},{"frame":31,"duration":8,"color":[255,255,255,255]},{"frame":39,"duration":30,"color":[255,255,255,255]},{"frame":69,"duration":30,"color":[255,255,255,255]},{"frame":99,"duration":30,"color":[255,255,255,255]}],"name":"Pierce Special 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":0,"se":{"name":"Wind5","pan":0,"pitch":80,"volume":80}},{"frame":2,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":100}},{"frame":4,"se":{"name":"Sword5","pan":0,"pitch":150,"volume":100}},{"frame":6,"se":{"name":"Slash2","pan":0,"pitch":150,"volume":100}},{"frame":7,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":100}},{"frame":9,"se":{"name":"Sword5","pan":0,"pitch":150,"volume":80}},{"frame":10,"se":{"name":"Slash2","pan":0,"pitch":150,"volume":100}},{"frame":13,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":100}},{"frame":16,"se":{"name":"Sword5","pan":0,"pitch":150,"volume":100}},{"frame":17,"se":{"name":"Slash2","pan":0,"pitch":150,"volume":100}},{"frame":19,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":80}},{"frame":23,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":100}},{"frame":27,"se":{"name":"Sword5","pan":0,"pitch":150,"volume":100}},{"frame":31,"se":{"name":"Slash2","pan":0,"pitch":150,"volume":100}},{"frame":39,"se":{"name":"Sword5","pan":0,"pitch":150,"volume":100}},{"frame":43,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":100}}],"speed":100}, +{"id":28,"displayType":0,"effectName":"ClawSpecial","flashTimings":[{"frame":0,"duration":30,"color":[255,119,153,187]},{"frame":30,"duration":30,"color":[255,119,153,187]},{"frame":74,"duration":30,"color":[255,119,153,187]}],"name":"Claw Special","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":0,"se":{"name":"Attack3","pan":0,"pitch":100,"volume":80}},{"frame":1,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":80}},{"frame":3,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":4,"se":{"name":"Slash3","pan":0,"pitch":100,"volume":80}},{"frame":6,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":7,"se":{"name":"Slash2","pan":0,"pitch":100,"volume":80}},{"frame":9,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":10,"se":{"name":"Slash3","pan":0,"pitch":100,"volume":80}},{"frame":16,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":17,"se":{"name":"Slash1","pan":0,"pitch":80,"volume":90}},{"frame":21,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":25,"se":{"name":"Slash3","pan":0,"pitch":100,"volume":80}},{"frame":29,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":30,"se":{"name":"Slash1","pan":0,"pitch":80,"volume":90}},{"frame":41,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":41,"se":{"name":"Slash1","pan":0,"pitch":80,"volume":90}},{"frame":74,"se":{"name":"Attack2","pan":0,"pitch":150,"volume":90}},{"frame":74,"se":{"name":"Slash1","pan":0,"pitch":80,"volume":90}}],"speed":100}, +{"id":29,"displayType":0,"effectName":"ArrowSpecial","flashTimings":[{"frame":2,"duration":3,"color":[255,255,204,204]},{"frame":5,"duration":3,"color":[255,255,204,204]},{"frame":8,"duration":3,"color":[255,255,204,204]},{"frame":13,"duration":3,"color":[255,255,204,204]},{"frame":24,"duration":10,"color":[255,255,204,204]},{"frame":49,"duration":20,"color":[255,255,204,204]}],"name":"Arrow Special","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Crossbow","pan":0,"pitch":100,"volume":100}},{"frame":2,"se":{"name":"Attack3","pan":0,"pitch":150,"volume":90}},{"frame":5,"se":{"name":"Attack3","pan":0,"pitch":150,"volume":90}},{"frame":8,"se":{"name":"Battle3","pan":0,"pitch":150,"volume":90}},{"frame":13,"se":{"name":"Battle3","pan":0,"pitch":150,"volume":90}},{"frame":13,"se":{"name":"Wind6","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":30,"displayType":0,"effectName":"GeneralSpecial1","flashTimings":[{"frame":1,"duration":30,"color":[255,170,119,204]},{"frame":5,"duration":30,"color":[255,255,255,204]},{"frame":8,"duration":30,"color":[255,170,119,204]},{"frame":12,"duration":30,"color":[255,255,255,187]},{"frame":15,"duration":30,"color":[255,255,187,221]},{"frame":17,"duration":30,"color":[255,255,187,221]},{"frame":22,"duration":30,"color":[255,255,255,187]},{"frame":25,"duration":30,"color":[255,170,119,204]},{"frame":31,"duration":30,"color":[255,255,187,221]},{"frame":35,"duration":30,"color":[255,255,255,187]},{"frame":39,"duration":50,"color":[255,170,119,204]},{"frame":49,"duration":30,"color":[255,255,187,221]},{"frame":54,"duration":30,"color":[255,255,255,187]},{"frame":64,"duration":50,"color":[255,170,119,204]},{"frame":99,"duration":50,"color":[255,170,119,204]}],"name":"General Special 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":1,"se":{"name":"Slash1","pan":0,"pitch":110,"volume":100}},{"frame":5,"se":{"name":"Slash4","pan":0,"pitch":90,"volume":100}},{"frame":8,"se":{"name":"Slash5","pan":0,"pitch":90,"volume":100}},{"frame":12,"se":{"name":"Slash2","pan":0,"pitch":110,"volume":100}},{"frame":15,"se":{"name":"Slash1","pan":0,"pitch":120,"volume":100}},{"frame":17,"se":{"name":"Damage2","pan":0,"pitch":110,"volume":100}},{"frame":22,"se":{"name":"Slash2","pan":0,"pitch":110,"volume":100}},{"frame":25,"se":{"name":"Slash1","pan":0,"pitch":120,"volume":100}},{"frame":35,"se":{"name":"Damage2","pan":0,"pitch":110,"volume":100}},{"frame":41,"se":{"name":"Slash2","pan":0,"pitch":110,"volume":100}},{"frame":49,"se":{"name":"Slash1","pan":0,"pitch":120,"volume":100}},{"frame":89,"se":{"name":"Damage2","pan":0,"pitch":110,"volume":100}},{"frame":95,"se":{"name":"Slash2","pan":0,"pitch":110,"volume":100}},{"frame":104,"se":{"name":"Slash1","pan":0,"pitch":120,"volume":100}}],"speed":100}, +{"id":31,"displayType":0,"effectName":"GeneralSpecial2","flashTimings":[{"frame":0,"duration":10,"color":[255,255,255,255]},{"frame":1,"duration":10,"color":[255,255,255,255]},{"frame":5,"duration":10,"color":[255,255,255,255]},{"frame":8,"duration":10,"color":[255,255,255,255]},{"frame":11,"duration":10,"color":[255,255,255,255]},{"frame":15,"duration":10,"color":[255,255,255,255]},{"frame":19,"duration":10,"color":[255,255,255,255]},{"frame":25,"duration":30,"color":[255,255,255,255]},{"frame":34,"duration":10,"color":[255,255,255,255]},{"frame":39,"duration":10,"color":[255,255,255,255]},{"frame":44,"duration":30,"color":[255,255,255,255]}],"name":"General Special 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder3","pan":0,"pitch":90,"volume":90}},{"frame":1,"se":{"name":"Slash1","pan":0,"pitch":110,"volume":100}},{"frame":5,"se":{"name":"Slash1","pan":0,"pitch":110,"volume":100}},{"frame":8,"se":{"name":"Thunder3","pan":0,"pitch":90,"volume":90}},{"frame":11,"se":{"name":"Slash1","pan":0,"pitch":110,"volume":100}},{"frame":15,"se":{"name":"Slash1","pan":0,"pitch":110,"volume":100}},{"frame":19,"se":{"name":"Thunder3","pan":0,"pitch":90,"volume":90}},{"frame":25,"se":{"name":"Slash3","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":32,"displayType":2,"effectName":"Breath","flashTimings":[{"frame":4,"duration":15,"color":[255,102,0,204]},{"frame":14,"duration":15,"color":[255,102,0,204]},{"frame":24,"duration":15,"color":[255,102,0,204]},{"frame":34,"duration":15,"color":[255,102,0,204]},{"frame":44,"duration":15,"color":[255,102,0,204]},{"frame":54,"duration":15,"color":[255,102,0,204]},{"frame":64,"duration":15,"color":[255,102,0,204]},{"frame":74,"duration":15,"color":[255,102,0,204]}],"name":"Breath","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":200,"soundTimings":[{"frame":0,"se":{"name":"Fire3","pan":0,"pitch":70,"volume":90}},{"frame":1,"se":{"name":"Thunder1","pan":0,"pitch":50,"volume":90}}],"speed":100}, +{"id":33,"displayType":2,"effectName":"Pollen","flashTimings":[{"frame":3,"duration":30,"color":[255,85,238,204]},{"frame":5,"duration":30,"color":[255,85,238,204]},{"frame":7,"duration":30,"color":[255,85,238,187]},{"frame":9,"duration":30,"color":[255,85,238,170]},{"frame":29,"duration":50,"color":[255,85,238,153]},{"frame":59,"duration":50,"color":[255,85,238,120]}],"name":"Pollen","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":200,"soundTimings":[{"frame":0,"se":{"name":"Darkness4","pan":0,"pitch":60,"volume":90}},{"frame":0,"se":{"name":"Darkness3","pan":0,"pitch":50,"volume":90}}],"speed":100}, +{"id":34,"displayType":2,"effectName":"SonicWave","flashTimings":[{"frame":2,"duration":25,"color":[255,221,170,170]},{"frame":29,"duration":25,"color":[255,221,170,170]},{"frame":59,"duration":25,"color":[255,221,170,170]},{"frame":89,"duration":25,"color":[255,221,170,100]}],"name":"SonicWave","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Sound3","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":35,"displayType":2,"effectName":"Fog","flashTimings":[{"frame":29,"duration":90,"color":[136,153,170,150]}],"name":"Fog","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Blind","pan":0,"pitch":70,"volume":90}},{"frame":0,"se":{"name":"Sand","pan":0,"pitch":110,"volume":90}}],"speed":100}, +{"id":36,"displayType":2,"effectName":"Song","flashTimings":[{"frame":19,"duration":30,"color":[221,221,255,136]},{"frame":24,"duration":30,"color":[255,255,255,170]},{"frame":34,"duration":30,"color":[255,170,255,170]},{"frame":54,"duration":50,"color":[255,170,255,170]}],"name":"Song","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Ice4","pan":0,"pitch":110,"volume":90}}],"speed":100}, +{"id":37,"displayType":2,"effectName":"Shout","flashTimings":[{"frame":0,"duration":10,"color":[255,255,0,153]},{"frame":9,"duration":10,"color":[255,255,0,136]},{"frame":19,"duration":10,"color":[255,255,0,136]},{"frame":29,"duration":10,"color":[255,255,0,136]},{"frame":39,"duration":30,"color":[255,255,0,136]}],"name":"Shout","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Monster1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":38,"displayType":0,"effectName":"Sweep","flashTimings":[{"frame":2,"duration":30,"color":[255,255,255,255]}],"name":"Sweep","offsetX":0,"offsetY":30,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind7","pan":0,"pitch":50,"volume":90}},{"frame":2,"se":{"name":"Blow2","pan":0,"pitch":70,"volume":100}}],"speed":100}, +{"id":39,"displayType":0,"effectName":"Bodyslam","flashTimings":[{"frame":2,"duration":30,"color":[255,255,255,255]}],"name":"Bodyslam","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder2","pan":0,"pitch":80,"volume":90}},{"frame":2,"se":{"name":"Thunder8","pan":0,"pitch":100,"volume":90}},{"frame":2,"se":{"name":"Blow3","pan":0,"pitch":50,"volume":100}}],"speed":100}, +{"id":40,"displayType":2,"effectName":"Flash","flashTimings":[{"frame":2,"duration":30,"color":[255,255,255,255]},{"frame":19,"duration":10,"color":[255,255,255,255]},{"frame":24,"duration":10,"color":[255,255,255,255]}],"name":"Flash","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":150,"soundTimings":[{"frame":0,"se":{"name":"Flash2","pan":0,"pitch":130,"volume":90}},{"frame":1,"se":{"name":"Sword1","pan":0,"pitch":50,"volume":90}}],"speed":100}, +{"id":41,"displayType":0,"effectName":"HealOne1","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,102]},{"frame":9,"duration":30,"color":[102,255,0,102]},{"frame":19,"duration":30,"color":[136,255,0,102]},{"frame":29,"duration":30,"color":[136,255,0,102]}],"name":"Heal One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Heal3","pan":0,"pitch":100,"volume":90}},{"frame":0,"se":{"name":"Saint2","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":42,"displayType":0,"effectName":"HealOne2","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,102]},{"frame":9,"duration":30,"color":[0,255,0,102]},{"frame":29,"duration":30,"color":[136,255,0,102]},{"frame":49,"duration":30,"color":[136,255,0,102]},{"frame":69,"duration":30,"color":[136,255,0,102]},{"frame":89,"duration":30,"color":[136,255,0,102]}],"name":"Heal One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Starlight","pan":0,"pitch":150,"volume":80}},{"frame":0,"se":{"name":"Saint2","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":43,"displayType":2,"effectName":"HealAll1","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,170]},{"frame":19,"duration":5,"color":[0,255,0,102]},{"frame":29,"duration":30,"color":[0,255,0,102]}],"name":"Heal All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Saint4","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Ice4","pan":0,"pitch":150,"volume":90}},{"frame":3,"se":{"name":"Heal1","pan":0,"pitch":150,"volume":90}},{"frame":4,"se":{"name":"Ice5","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":44,"displayType":2,"effectName":"HealAll2","flashTimings":[{"frame":0,"duration":10,"color":[255,255,0,170]},{"frame":19,"duration":5,"color":[255,255,0,102]},{"frame":29,"duration":30,"color":[255,255,0,102]}],"name":"Heal All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Ice1","pan":0,"pitch":100,"volume":90}},{"frame":8,"se":{"name":"Evasion2","pan":0,"pitch":50,"volume":90}},{"frame":9,"se":{"name":"Flash2","pan":0,"pitch":50,"volume":50}},{"frame":9,"se":{"name":"Ice4","pan":0,"pitch":100,"volume":80}}],"speed":100}, +{"id":45,"displayType":0,"effectName":"CureOne1","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,102]},{"frame":9,"duration":30,"color":[102,255,0,102]},{"frame":19,"duration":30,"color":[136,255,0,102]},{"frame":29,"duration":30,"color":[136,255,0,102]}],"name":"Cure One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":1,"se":{"name":"Ice1","pan":0,"pitch":100,"volume":90}},{"frame":2,"se":{"name":"Recovery","pan":0,"pitch":70,"volume":90}},{"frame":6,"se":{"name":"Ice4","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":46,"displayType":0,"effectName":"CureOne2","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,102]},{"frame":9,"duration":30,"color":[102,255,0,102]},{"frame":29,"duration":30,"color":[136,255,0,102]},{"frame":49,"duration":30,"color":[136,255,0,102]}],"name":"Cure One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Ice1","pan":0,"pitch":90,"volume":90}},{"frame":2,"se":{"name":"Ice4","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":47,"displayType":2,"effectName":"CureAll1","flashTimings":[{"frame":0,"duration":10,"color":[255,255,255,170]},{"frame":19,"duration":5,"color":[153,255,255,102]},{"frame":24,"duration":30,"color":[255,255,255,102]}],"name":"Cure All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Starlight","pan":0,"pitch":150,"volume":80}},{"frame":1,"se":{"name":"Ice4","pan":0,"pitch":120,"volume":90}},{"frame":6,"se":{"name":"Ice1","pan":0,"pitch":100,"volume":90}},{"frame":9,"se":{"name":"Heal3","pan":0,"pitch":120,"volume":90}}],"speed":100}, +{"id":48,"displayType":2,"effectName":"CureAll2","flashTimings":[{"frame":0,"duration":10,"color":[255,255,255,170]},{"frame":19,"duration":5,"color":[153,255,255,170]},{"frame":24,"duration":10,"color":[255,255,255,102]},{"frame":49,"duration":20,"color":[255,255,255,102]}],"name":"Cure All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":150,"soundTimings":[{"frame":0,"se":{"name":"Ice4","pan":0,"pitch":100,"volume":90}},{"frame":0,"se":{"name":"Saint4","pan":0,"pitch":150,"volume":80}}],"speed":100}, +{"id":49,"displayType":0,"effectName":"Revive1","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,102]},{"frame":9,"duration":30,"color":[102,255,0,102]},{"frame":29,"duration":30,"color":[136,255,0,102]},{"frame":49,"duration":30,"color":[255,255,255,102]}],"name":"Revive 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Starlight","pan":0,"pitch":130,"volume":90}},{"frame":4,"se":{"name":"Skill1","pan":0,"pitch":70,"volume":90}}],"speed":100}, +{"id":50,"displayType":0,"effectName":"Revive2","flashTimings":[{"frame":0,"duration":10,"color":[0,255,0,102]},{"frame":9,"duration":30,"color":[102,255,0,102]},{"frame":29,"duration":30,"color":[255,255,255,102]},{"frame":49,"duration":30,"color":[255,255,255,102]}],"name":"Revive 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Magic2","pan":0,"pitch":100,"volume":90}},{"frame":9,"se":{"name":"Ice4","pan":0,"pitch":150,"volume":100}},{"frame":13,"se":{"name":"Up3","pan":0,"pitch":130,"volume":80}}],"speed":100}, +{"id":51,"displayType":0,"effectName":"Powerup1","flashTimings":[{"frame":5,"duration":15,"color":[255,187,0,136]},{"frame":19,"duration":30,"color":[255,204,102,102]}],"name":"Power up 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Up4","pan":0,"pitch":100,"volume":90}},{"frame":2,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":52,"displayType":0,"effectName":"Powerup2","flashTimings":[{"frame":5,"duration":20,"color":[255,255,0,119]},{"frame":19,"duration":15,"color":[255,255,0,102]},{"frame":34,"duration":15,"color":[255,255,255,102]}],"name":"Power up 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Powerup","pan":0,"pitch":100,"volume":90}},{"frame":4,"se":{"name":"Magic4","pan":0,"pitch":120,"volume":80}}],"speed":100}, +{"id":53,"displayType":0,"effectName":"Powerup3","flashTimings":[{"frame":0,"duration":10,"color":[255,255,255,255]},{"frame":19,"duration":50,"color":[255,153,0,119]}],"name":"Power up 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":70,"soundTimings":[{"frame":0,"se":{"name":"Up1","pan":0,"pitch":80,"volume":80}},{"frame":9,"se":{"name":"Ice4","pan":0,"pitch":90,"volume":80}}],"speed":100}, +{"id":54,"displayType":0,"effectName":"Powerdown1","flashTimings":[{"frame":5,"duration":15,"color":[85,0,255,102]},{"frame":19,"duration":30,"color":[85,0,255,68]}],"name":"Power down 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Down2","pan":0,"pitch":100,"volume":90}},{"frame":2,"se":{"name":"Magic2","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":55,"displayType":0,"effectName":"Powerdown2","flashTimings":[{"frame":0,"duration":30,"color":[0,0,0,170]},{"frame":29,"duration":30,"color":[85,0,136,170]}],"name":"Power down 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Stare","pan":0,"pitch":110,"volume":70}},{"frame":6,"se":{"name":"Earth2","pan":0,"pitch":70,"volume":80}}],"speed":100}, +{"id":56,"displayType":0,"effectName":"Powerdown3","flashTimings":[{"frame":9,"duration":20,"color":[255,255,255,170]},{"frame":39,"duration":30,"color":[170,255,0,170]},{"frame":49,"duration":30,"color":[255,255,119,170]}],"name":"Power down 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Blind","pan":0,"pitch":120,"volume":80}},{"frame":59,"se":{"name":"Darkness7","pan":0,"pitch":100,"volume":80}},{"frame":69,"se":{"name":"Darkness8","pan":0,"pitch":100,"volume":80}}],"speed":100}, +{"id":57,"displayType":0,"effectName":"Bind","flashTimings":[{"frame":9,"duration":20,"color":[255,255,255,170]},{"frame":39,"duration":30,"color":[170,255,0,170]},{"frame":49,"duration":30,"color":[255,255,119,170]}],"name":"Bind","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":70,"soundTimings":[{"frame":0,"se":{"name":"Wind5","pan":0,"pitch":80,"volume":90}},{"frame":2,"se":{"name":"Darkness4","pan":0,"pitch":60,"volume":100}},{"frame":5,"se":{"name":"Darkness1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":58,"displayType":0,"effectName":"Absorb","flashTimings":[{"frame":29,"duration":60,"color":[170,0,136,136]}],"name":"Absorb","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Darkness1","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Twine","pan":0,"pitch":150,"volume":70}},{"frame":1,"se":{"name":"Particles1","pan":0,"pitch":150,"volume":70}}],"speed":100}, +{"id":59,"displayType":0,"effectName":"Poison","flashTimings":[{"frame":29,"duration":60,"color":[68,0,187,170]}],"name":"Poison","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Poison","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":60,"displayType":0,"effectName":"Blind","flashTimings":[{"frame":9,"duration":20,"color":[0,0,0,119]},{"frame":59,"duration":30,"color":[0,0,0,119]},{"frame":89,"duration":50,"color":[0,0,0,119]}],"name":"Blind","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":2,"se":{"name":"Blind","pan":0,"pitch":100,"volume":90}},{"frame":3,"se":{"name":"Darkness2","pan":0,"pitch":80,"volume":50}}],"speed":100}, +{"id":61,"displayType":0,"effectName":"Silence","flashTimings":[{"frame":39,"duration":50,"color":[170,255,255,170]}],"name":"Silence","offsetX":0,"offsetY":0,"rotation":{"x":90,"y":0,"z":0},"scale":80,"soundTimings":[{"frame":0,"se":{"name":"Silence","pan":0,"pitch":100,"volume":90}},{"frame":5,"se":{"name":"Sound2","pan":0,"pitch":80,"volume":70}},{"frame":59,"se":{"name":"Flash1","pan":0,"pitch":70,"volume":70}}],"speed":100}, +{"id":62,"displayType":0,"effectName":"Sleep","flashTimings":[{"frame":9,"duration":10,"color":[255,255,255,102]},{"frame":39,"duration":30,"color":[170,170,238,170]}],"name":"Sleep","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":1,"se":{"name":"Up1","pan":0,"pitch":50,"volume":70}},{"frame":5,"se":{"name":"Sleep","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":63,"displayType":0,"effectName":"Confusion","flashTimings":[{"frame":9,"duration":10,"color":[255,255,255,68]},{"frame":39,"duration":30,"color":[255,136,255,170]}],"name":"Confusion","offsetX":15,"offsetY":-30,"rotation":{"x":0,"y":0,"z":0},"scale":50,"soundTimings":[{"frame":0,"se":{"name":"Absorb2","pan":0,"pitch":50,"volume":80}},{"frame":4,"se":{"name":"Raise2","pan":0,"pitch":70,"volume":80}}],"speed":100}, +{"id":64,"displayType":0,"effectName":"Paralyze","flashTimings":[{"frame":9,"duration":20,"color":[255,255,255,170]},{"frame":39,"duration":30,"color":[170,255,0,170]},{"frame":49,"duration":30,"color":[255,255,119,170]}],"name":"Paralyze","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Darkness1","pan":0,"pitch":150,"volume":90}},{"frame":3,"se":{"name":"Paralyze3","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":65,"displayType":0,"effectName":"Death","flashTimings":[{"frame":14,"duration":30,"color":[255,0,0,187]},{"frame":79,"duration":50,"color":[255,0,0,187]}],"name":"Death","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":1,"se":{"name":"Stare","pan":0,"pitch":120,"volume":90}},{"frame":44,"se":{"name":"Darkness5","pan":0,"pitch":90,"volume":80}}],"speed":100}, +{"id":66,"displayType":0,"effectName":"FireOne1","flashTimings":[{"frame":9,"duration":30,"color":[255,170,51,204]},{"frame":39,"duration":30,"color":[255,170,51,204]}],"name":"Fire One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Fire8","pan":0,"pitch":90,"volume":80}}],"speed":100}, +{"id":67,"displayType":0,"effectName":"FireOne2","flashTimings":[{"frame":9,"duration":30,"color":[255,170,51,204]}],"name":"Fire One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Fire9","pan":0,"pitch":150,"volume":80}}],"speed":100}, +{"id":68,"displayType":1,"effectName":"FireAll1","flashTimings":[{"frame":9,"duration":30,"color":[255,221,51,204]},{"frame":29,"duration":30,"color":[187,102,102,68]},{"frame":49,"duration":30,"color":[255,221,51,204]},{"frame":79,"duration":50,"color":[187,102,102,68]}],"name":"Fire All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Fire8","pan":0,"pitch":70,"volume":80}}],"speed":100}, +{"id":69,"displayType":2,"effectName":"FireAll2","flashTimings":[{"frame":9,"duration":50,"color":[255,221,51,204]},{"frame":29,"duration":30,"color":[255,102,102,136]}],"name":"Fire All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Fire8","pan":0,"pitch":70,"volume":80}}],"speed":100}, +{"id":70,"displayType":2,"effectName":"FireAll3","flashTimings":[{"frame":29,"duration":50,"color":[255,221,51,204]},{"frame":49,"duration":30,"color":[255,102,102,136]}],"name":"Fire All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Fire8","pan":0,"pitch":70,"volume":80}}],"speed":100}, +{"id":71,"displayType":0,"effectName":"IceOne1","flashTimings":[{"frame":19,"duration":80,"color":[119,204,255,153]}],"name":"Ice One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Starlight","pan":0,"pitch":150,"volume":80}},{"frame":1,"se":{"name":"Wind1","pan":0,"pitch":80,"volume":70}},{"frame":3,"se":{"name":"Crash","pan":0,"pitch":150,"volume":90}},{"frame":9,"se":{"name":"Ice11","pan":0,"pitch":100,"volume":90}},{"frame":13,"se":{"name":"Sword2","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":72,"displayType":0,"effectName":"IceOne2","flashTimings":[{"frame":19,"duration":50,"color":[119,204,255,153]}],"name":"Ice One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Ice4","pan":0,"pitch":100,"volume":90}},{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":73,"displayType":1,"effectName":"IceAll1","flashTimings":[{"frame":29,"duration":25,"color":[119,204,153,204]},{"frame":99,"duration":50,"color":[119,204,255,204]}],"name":"Ice All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder4","pan":0,"pitch":150,"volume":90}},{"frame":5,"se":{"name":"Flash2","pan":0,"pitch":150,"volume":90}},{"frame":16,"se":{"name":"Earth1","pan":0,"pitch":130,"volume":70}},{"frame":17,"se":{"name":"Ice5","pan":0,"pitch":100,"volume":90}},{"frame":89,"se":{"name":"Ice11","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":74,"displayType":2,"effectName":"IceAll2","flashTimings":[{"frame":29,"duration":80,"color":[170,204,255,153]}],"name":"Ice All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind6","pan":0,"pitch":80,"volume":90}},{"frame":2,"se":{"name":"Thunder6","pan":0,"pitch":90,"volume":80}},{"frame":0,"se":{"name":"Ice10","pan":0,"pitch":90,"volume":80}}],"speed":100}, +{"id":75,"displayType":2,"effectName":"IceAll3","flashTimings":[{"frame":29,"duration":25,"color":[170,204,255,204]},{"frame":59,"duration":50,"color":[170,204,255,204]}],"name":"Ice All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":70,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":9,"se":{"name":"Ice10","pan":0,"pitch":100,"volume":80}},{"frame":19,"se":{"name":"Crash","pan":0,"pitch":150,"volume":70}},{"frame":23,"se":{"name":"Ice5","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":76,"displayType":0,"effectName":"ThunderOne1","flashTimings":[{"frame":9,"duration":50,"color":[255,255,255,204]}],"name":"Thunder One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder6","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":77,"displayType":0,"effectName":"ThunderOne2","flashTimings":[{"frame":9,"duration":30,"color":[119,255,170,204]},{"frame":29,"duration":30,"color":[255,255,255,204]}],"name":"Thunder One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder3","pan":0,"pitch":100,"volume":90}},{"frame":0,"se":{"name":"Thunder8","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":78,"displayType":1,"effectName":"ThunderAll1","flashTimings":[{"frame":0,"duration":50,"color":[255,255,119,153]},{"frame":29,"duration":20,"color":[255,255,136,204]},{"frame":59,"duration":20,"color":[255,255,255,204]}],"name":"Thunder All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":0,"se":{"name":"Thunder1","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Paralyze1","pan":0,"pitch":150,"volume":90}},{"frame":49,"se":{"name":"Thunder1","pan":0,"pitch":150,"volume":90}},{"frame":50,"se":{"name":"Paralyze1","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":79,"displayType":2,"effectName":"ThunderAll2","flashTimings":[{"frame":0,"duration":50,"color":[255,255,119,153]},{"frame":29,"duration":20,"color":[255,255,136,204]}],"name":"Thunder All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":150,"soundTimings":[{"frame":0,"se":{"name":"Thunder10","pan":0,"pitch":120,"volume":100}},{"frame":1,"se":{"name":"Thunder9","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":80,"displayType":2,"effectName":"ThunderAll3","flashTimings":[{"frame":29,"duration":50,"color":[255,255,119,153]},{"frame":49,"duration":10,"color":[255,255,136,204]},{"frame":79,"duration":20,"color":[255,255,255,204]}],"name":"Thunder All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":75,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":59,"se":{"name":"Thunder9","pan":0,"pitch":100,"volume":90}},{"frame":59,"se":{"name":"Paralyze1","pan":0,"pitch":100,"volume":75}},{"frame":79,"se":{"name":"Paralyze1","pan":0,"pitch":100,"volume":75}}],"speed":100}, +{"id":81,"displayType":0,"effectName":"WaterOne1","flashTimings":[{"frame":19,"duration":60,"color":[170,204,255,204]}],"name":"Water One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Water5","pan":0,"pitch":100,"volume":90}},{"frame":19,"se":{"name":"Water2","pan":0,"pitch":130,"volume":90}}],"speed":100}, +{"id":82,"displayType":0,"effectName":"WaterOne2","flashTimings":[{"frame":19,"duration":60,"color":[170,204,255,204]}],"name":"Water One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Dive","pan":0,"pitch":135,"volume":90}},{"frame":6,"se":{"name":"Water1","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":83,"displayType":1,"effectName":"WaterAll1","flashTimings":[{"frame":19,"duration":30,"color":[170,204,255,204]},{"frame":59,"duration":80,"color":[170,204,255,204]}],"name":"Water All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Water5","pan":0,"pitch":100,"volume":90}},{"frame":11,"se":{"name":"Water4","pan":0,"pitch":90,"volume":90}},{"frame":13,"se":{"name":"Water1","pan":0,"pitch":90,"volume":90}},{"frame":59,"se":{"name":"Water1","pan":0,"pitch":90,"volume":90}},{"frame":59,"se":{"name":"Water4","pan":0,"pitch":90,"volume":90}}],"speed":100}, +{"id":84,"displayType":2,"effectName":"WaterAll2","flashTimings":[{"frame":19,"duration":20,"color":[170,204,255,204]},{"frame":49,"duration":20,"color":[170,204,255,204]},{"frame":79,"duration":20,"color":[170,204,255,204]}],"name":"Water All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Water1","pan":0,"pitch":50,"volume":90}}],"speed":100}, +{"id":85,"displayType":2,"effectName":"WaterAll3","flashTimings":[{"frame":29,"duration":50,"color":[170,204,255,204]},{"frame":59,"duration":20,"color":[170,204,255,204]},{"frame":89,"duration":20,"color":[170,204,255,204]},{"frame":119,"duration":50,"color":[170,204,255,204]}],"name":"Water All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":70,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":9,"se":{"name":"Wind1","pan":0,"pitch":120,"volume":75}},{"frame":23,"se":{"name":"Water1","pan":0,"pitch":50,"volume":90}},{"frame":59,"se":{"name":"Water2","pan":0,"pitch":50,"volume":90}},{"frame":59,"se":{"name":"Water1","pan":0,"pitch":50,"volume":90}}],"speed":100}, +{"id":86,"displayType":0,"effectName":"EarthOne1","flashTimings":[{"frame":0,"duration":30,"color":[255,221,170,170]},{"frame":9,"duration":30,"color":[255,221,170,170]}],"name":"Earth One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Earth1","pan":0,"pitch":150,"volume":90}},{"frame":5,"se":{"name":"Break","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":87,"displayType":0,"effectName":"EarthOne2","flashTimings":[{"frame":19,"duration":30,"color":[255,221,170,170]}],"name":"Earth One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Thunder2","pan":0,"pitch":50,"volume":90}},{"frame":0,"se":{"name":"Earth5","pan":0,"pitch":100,"volume":100}},{"frame":29,"se":{"name":"Fire3","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":88,"displayType":1,"effectName":"EarthAll1","flashTimings":[{"frame":0,"duration":10,"color":[255,221,170,170]},{"frame":14,"duration":30,"color":[255,221,170,170]}],"name":"Earth All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":5,"se":{"name":"Earth1","pan":0,"pitch":150,"volume":90}},{"frame":5,"se":{"name":"Fire3","pan":0,"pitch":150,"volume":90}},{"frame":79,"se":{"name":"Earth3","pan":0,"pitch":140,"volume":90}},{"frame":79,"se":{"name":"Fire1","pan":0,"pitch":150,"volume":90}},{"frame":79,"se":{"name":"Sand","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":89,"displayType":2,"effectName":"EarthAll2","flashTimings":[{"frame":0,"duration":20,"color":[255,221,170,170]},{"frame":29,"duration":50,"color":[255,221,170,170]}],"name":"Earth All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Earth4","pan":0,"pitch":100,"volume":100}},{"frame":1,"se":{"name":"Earth1","pan":0,"pitch":100,"volume":100}},{"frame":3,"se":{"name":"Earth5","pan":0,"pitch":100,"volume":100}},{"frame":89,"se":{"name":"Sand","pan":0,"pitch":100,"volume":100}}],"speed":100}, +{"id":90,"displayType":2,"effectName":"EarthAll3","flashTimings":[{"frame":29,"duration":50,"color":[255,221,170,170]},{"frame":59,"duration":20,"color":[255,221,170,170]},{"frame":89,"duration":20,"color":[255,221,170,170]},{"frame":119,"duration":50,"color":[255,221,170,170]}],"name":"Earth All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":70,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":44,"se":{"name":"Earth2","pan":0,"pitch":125,"volume":75}},{"frame":69,"se":{"name":"Earth4","pan":0,"pitch":125,"volume":75}},{"frame":69,"se":{"name":"Earth1","pan":0,"pitch":125,"volume":75}}],"speed":100}, +{"id":91,"displayType":0,"effectName":"WindOne1","flashTimings":[{"frame":9,"duration":30,"color":[255,255,255,170]}],"name":"Wind One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind5","pan":0,"pitch":80,"volume":90}}],"speed":100}, +{"id":92,"displayType":0,"effectName":"WindOne2","flashTimings":[{"frame":9,"duration":40,"color":[255,255,255,170]},{"frame":39,"duration":30,"color":[255,255,255,204]},{"frame":79,"duration":30,"color":[119,255,0,85]}],"name":"Wind One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":150,"soundTimings":[{"frame":0,"se":{"name":"Wind3","pan":0,"pitch":140,"volume":90}},{"frame":4,"se":{"name":"Wind5","pan":0,"pitch":140,"volume":90}},{"frame":14,"se":{"name":"Wind3","pan":0,"pitch":140,"volume":90}},{"frame":19,"se":{"name":"Wind5","pan":0,"pitch":140,"volume":90}}],"speed":100}, +{"id":93,"displayType":1,"effectName":"WindAll1","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,170]},{"frame":39,"duration":30,"color":[170,255,0,170]}],"name":"Wind All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind5","pan":0,"pitch":120,"volume":90}},{"frame":2,"se":{"name":"Wind2","pan":0,"pitch":150,"volume":90}},{"frame":5,"se":{"name":"Wind2","pan":0,"pitch":150,"volume":90}},{"frame":8,"se":{"name":"Wind2","pan":0,"pitch":150,"volume":90}},{"frame":29,"se":{"name":"Sand","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":94,"displayType":2,"effectName":"WindAll2","flashTimings":[{"frame":19,"duration":20,"color":[170,255,0,170]},{"frame":49,"duration":20,"color":[255,255,255,170]},{"frame":79,"duration":20,"color":[170,255,0,170]}],"name":"Wind All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind5","pan":0,"pitch":80,"volume":100}},{"frame":1,"se":{"name":"Sand","pan":0,"pitch":70,"volume":100}}],"speed":100}, +{"id":95,"displayType":2,"effectName":"WindAll3","flashTimings":[{"frame":29,"duration":50,"color":[170,255,0,170]},{"frame":59,"duration":20,"color":[170,255,0,102]},{"frame":89,"duration":20,"color":[255,255,255,170]},{"frame":139,"duration":50,"color":[170,255,0,136]}],"name":"Wind All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":75,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":29,"se":{"name":"Wind2","pan":0,"pitch":125,"volume":75}},{"frame":49,"se":{"name":"Skill2","pan":0,"pitch":100,"volume":90}},{"frame":79,"se":{"name":"Wind3","pan":0,"pitch":140,"volume":65}},{"frame":79,"se":{"name":"Skill1","pan":0,"pitch":100,"volume":90}},{"frame":109,"se":{"name":"Wind3","pan":0,"pitch":140,"volume":65}},{"frame":129,"se":{"name":"Wind3","pan":0,"pitch":140,"volume":65}}],"speed":100}, +{"id":96,"displayType":0,"effectName":"LightOne1","flashTimings":[{"frame":0,"duration":30,"color":[255,255,255,136]},{"frame":39,"duration":50,"color":[255,255,255,170]}],"name":"Light One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Up3","pan":0,"pitch":100,"volume":90}},{"frame":14,"se":{"name":"Reflection","pan":0,"pitch":150,"volume":90}},{"frame":14,"se":{"name":"Sword4","pan":0,"pitch":150,"volume":90}},{"frame":19,"se":{"name":"Reflection","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":97,"displayType":0,"effectName":"LightOne2","flashTimings":[{"frame":0,"duration":10,"color":[255,255,0,136]},{"frame":9,"duration":20,"color":[255,255,255,136]},{"frame":39,"duration":50,"color":[255,255,255,170]}],"name":"Light One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Ice3","pan":0,"pitch":70,"volume":90}},{"frame":3,"se":{"name":"Saint4","pan":0,"pitch":115,"volume":90}}],"speed":100}, +{"id":98,"displayType":1,"effectName":"LightAll1","flashTimings":[{"frame":29,"duration":10,"color":[255,255,0,136]},{"frame":39,"duration":20,"color":[255,255,255,136]},{"frame":69,"duration":50,"color":[255,255,255,170]}],"name":"Light All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Starlight","pan":0,"pitch":150,"volume":90}},{"frame":1,"se":{"name":"Ice5","pan":0,"pitch":100,"volume":90}},{"frame":2,"se":{"name":"Up1","pan":0,"pitch":80,"volume":90}},{"frame":64,"se":{"name":"Sword2","pan":0,"pitch":150,"volume":90}},{"frame":74,"se":{"name":"Sword2","pan":0,"pitch":150,"volume":90}},{"frame":84,"se":{"name":"Sword2","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":99,"displayType":2,"effectName":"LightAll2","flashTimings":[{"frame":0,"duration":20,"color":[255,255,255,204]},{"frame":29,"duration":30,"color":[255,255,255,136]},{"frame":69,"duration":50,"color":[255,255,255,170]}],"name":"Light All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Skill1","pan":0,"pitch":100,"volume":100}},{"frame":8,"se":{"name":"Explosion1","pan":0,"pitch":150,"volume":100}},{"frame":8,"se":{"name":"Saint4","pan":0,"pitch":120,"volume":100}},{"frame":59,"se":{"name":"Explosion4","pan":0,"pitch":150,"volume":100}}],"speed":100}, +{"id":100,"displayType":2,"effectName":"LightAll3","flashTimings":[{"frame":29,"duration":50,"color":[255,255,255,204]},{"frame":79,"duration":30,"color":[255,255,255,136]},{"frame":139,"duration":50,"color":[255,255,255,170]}],"name":"Light All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":70,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":9,"se":{"name":"Skill3","pan":0,"pitch":110,"volume":75}},{"frame":19,"se":{"name":"Ice4","pan":0,"pitch":100,"volume":90}},{"frame":27,"se":{"name":"Ice3","pan":0,"pitch":100,"volume":90}},{"frame":59,"se":{"name":"Wind2","pan":0,"pitch":150,"volume":90}},{"frame":79,"se":{"name":"Wind2","pan":0,"pitch":150,"volume":90}},{"frame":89,"se":{"name":"Wind2","pan":0,"pitch":150,"volume":90}},{"frame":119,"se":{"name":"Magic12","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":101,"displayType":0,"effectName":"DarknessOne1","flashTimings":[{"frame":0,"duration":20,"color":[0,0,0,204]},{"frame":29,"duration":20,"color":[0,0,0,204]},{"frame":49,"duration":20,"color":[0,0,0,170]}],"name":"Darkness One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Darkness1","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":102,"displayType":0,"effectName":"DarknessOne2","flashTimings":[{"frame":0,"duration":20,"color":[0,0,0,204]},{"frame":29,"duration":20,"color":[0,0,0,204]},{"frame":49,"duration":20,"color":[0,0,0,170]},{"frame":99,"duration":50,"color":[0,0,0,136]}],"name":"Darkness One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":80,"soundTimings":[{"frame":0,"se":{"name":"Darkness3","pan":0,"pitch":100,"volume":90}},{"frame":59,"se":{"name":"Darkness1","pan":0,"pitch":130,"volume":90}}],"speed":100}, +{"id":103,"displayType":1,"effectName":"DarknessAll1","flashTimings":[{"frame":0,"duration":20,"color":[0,0,0,136]},{"frame":89,"duration":20,"color":[0,0,0,170]},{"frame":129,"duration":50,"color":[0,0,0,204]}],"name":"Darkness All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Darkness4","pan":0,"pitch":100,"volume":90}},{"frame":9,"se":{"name":"Thunder3","pan":0,"pitch":50,"volume":90}},{"frame":69,"se":{"name":"Fire9","pan":0,"pitch":50,"volume":90}},{"frame":79,"se":{"name":"Fire9","pan":0,"pitch":150,"volume":90}},{"frame":89,"se":{"name":"Fire9","pan":0,"pitch":150,"volume":90}},{"frame":99,"se":{"name":"Fire9","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":104,"displayType":2,"effectName":"DarknessAll2","flashTimings":[{"frame":0,"duration":20,"color":[0,0,0,204]},{"frame":29,"duration":20,"color":[0,0,0,204]},{"frame":49,"duration":20,"color":[0,0,0,170]},{"frame":99,"duration":50,"color":[0,0,0,136]}],"name":"Darkness All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":150,"soundTimings":[{"frame":0,"se":{"name":"Teleport","pan":0,"pitch":100,"volume":90}},{"frame":29,"se":{"name":"Blind","pan":0,"pitch":100,"volume":80}},{"frame":29,"se":{"name":"Float2","pan":0,"pitch":140,"volume":80}}],"speed":100}, +{"id":105,"displayType":2,"effectName":"DarknessAll3","flashTimings":[{"frame":29,"duration":50,"color":[0,0,0,204]},{"frame":79,"duration":30,"color":[0,0,0,136]},{"frame":139,"duration":40,"color":[0,0,0,170]}],"name":"Darkness All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Wind2","pan":0,"pitch":70,"volume":65}},{"frame":0,"se":{"name":"Magic1","pan":0,"pitch":100,"volume":80}},{"frame":9,"se":{"name":"Darkness4","pan":0,"pitch":90,"volume":75}},{"frame":64,"se":{"name":"Magic10","pan":0,"pitch":120,"volume":75}},{"frame":64,"se":{"name":"Blind","pan":0,"pitch":120,"volume":75}}],"speed":100}, +{"id":106,"displayType":0,"effectName":"NeutralOne1","flashTimings":[{"frame":0,"duration":30,"color":[255,255,0,204]},{"frame":49,"duration":30,"color":[85,255,0,119]}],"name":"Neutral One 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Darkness1","pan":0,"pitch":150,"volume":90}},{"frame":0,"se":{"name":"Magic5","pan":0,"pitch":150,"volume":90}},{"frame":44,"se":{"name":"Particles1","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":107,"displayType":0,"effectName":"NeutralOne2","flashTimings":[{"frame":0,"duration":30,"color":[255,102,0,204]},{"frame":49,"duration":30,"color":[255,102,0,204]}],"name":"Neutral One 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":70,"soundTimings":[{"frame":0,"se":{"name":"Explosion2","pan":0,"pitch":150,"volume":90}},{"frame":0,"se":{"name":"Particles1","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":108,"displayType":1,"effectName":"NeutralAll1","flashTimings":[{"frame":0,"duration":30,"color":[255,255,0,204]},{"frame":69,"duration":15,"color":[255,102,0,204]},{"frame":89,"duration":30,"color":[255,102,0,204]}],"name":"Neutral All 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Particles4","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":109,"displayType":2,"effectName":"NeutralAll2","flashTimings":[{"frame":0,"duration":30,"color":[255,102,0,204]},{"frame":49,"duration":30,"color":[255,102,0,204]}],"name":"Neutral All 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Fire9","pan":0,"pitch":140,"volume":90}}],"speed":100}, +{"id":110,"displayType":2,"effectName":"NeutralAll3","flashTimings":[{"frame":79,"duration":30,"color":[255,102,0,204]},{"frame":109,"duration":30,"color":[255,102,0,204]},{"frame":129,"duration":50,"color":[255,102,0,204]}],"name":"Neutral All 3","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Particles4","pan":0,"pitch":140,"volume":90}},{"frame":59,"se":{"name":"Fire8","pan":0,"pitch":140,"volume":90}},{"frame":69,"se":{"name":"Fire7","pan":0,"pitch":140,"volume":90}},{"frame":79,"se":{"name":"Fire8","pan":0,"pitch":140,"volume":90}},{"frame":89,"se":{"name":"Fire7","pan":0,"pitch":140,"volume":50}},{"frame":99,"se":{"name":"Fire8","pan":0,"pitch":140,"volume":90}}],"speed":100}, +{"id":111,"displayType":0,"effectName":"ShootNormal","flashTimings":[{"frame":0,"duration":5,"color":[255,0,0,119]},{"frame":9,"duration":5,"color":[255,0,0,119]},{"frame":19,"duration":10,"color":[255,0,0,119]}],"name":"Shoot Normal","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Gun1","pan":0,"pitch":100,"volume":90}}],"speed":100}, +{"id":112,"displayType":0,"effectName":"ShootBarrage","flashTimings":[{"frame":0,"duration":5,"color":[255,255,0,119]},{"frame":9,"duration":5,"color":[255,255,0,119]},{"frame":19,"duration":5,"color":[255,0,0,119]}],"name":"Shoot Barrage","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Gun2","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":113,"displayType":1,"effectName":"ShootAll","flashTimings":[{"frame":0,"duration":5,"color":[255,0,0,119]},{"frame":9,"duration":5,"color":[255,0,0,119]},{"frame":19,"duration":10,"color":[255,0,0,119]}],"name":"Shoot All","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Gun1","pan":0,"pitch":150,"volume":90}},{"frame":0,"se":{"name":"Crash","pan":0,"pitch":150,"volume":40}},{"frame":9,"se":{"name":"Gun1","pan":0,"pitch":150,"volume":90}},{"frame":19,"se":{"name":"Gun3","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":114,"displayType":2,"effectName":"ShootSpecial","flashTimings":[{"frame":69,"duration":10,"color":[255,136,0,153]},{"frame":119,"duration":10,"color":[255,136,0,153]},{"frame":139,"duration":10,"color":[255,0,0,170]},{"frame":154,"duration":30,"color":[255,0,0,204]},{"frame":199,"duration":30,"color":[255,255,0,136]}],"name":"Shoot Special","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Phone","pan":0,"pitch":150,"volume":40}},{"frame":24,"se":{"name":"Skill1","pan":0,"pitch":150,"volume":70}},{"frame":69,"se":{"name":"Skill2","pan":0,"pitch":150,"volume":70}},{"frame":109,"se":{"name":"Wind6","pan":0,"pitch":150,"volume":70}},{"frame":124,"se":{"name":"Wind6","pan":0,"pitch":150,"volume":70}},{"frame":149,"se":{"name":"Explosion2","pan":0,"pitch":100,"volume":70}},{"frame":169,"se":{"name":"Fire2","pan":0,"pitch":150,"volume":70}}],"speed":100}, +{"id":115,"displayType":0,"effectName":"LaserOne","flashTimings":[{"frame":5,"duration":30,"color":[255,136,0,170]},{"frame":39,"duration":30,"color":[255,136,0,153]},{"frame":59,"duration":30,"color":[255,136,0,153]}],"name":"Laser One","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Laser1","pan":0,"pitch":50,"volume":90}},{"frame":0,"se":{"name":"Paralyze2","pan":0,"pitch":50,"volume":90}},{"frame":0,"se":{"name":"Evasion2","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":116,"displayType":2,"effectName":"LaserAll","flashTimings":[{"frame":5,"duration":30,"color":[255,136,0,119]},{"frame":39,"duration":30,"color":[255,136,0,119]}],"name":"Laser All","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Powerup","pan":0,"pitch":150,"volume":90}},{"frame":29,"se":{"name":"Fire6","pan":0,"pitch":150,"volume":90}},{"frame":64,"se":{"name":"Fire3","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":117,"displayType":0,"effectName":"LightPillar1","flashTimings":[{"frame":5,"duration":30,"color":[255,255,255,102]},{"frame":39,"duration":30,"color":[102,170,0,102]}],"name":"Light Pillar 1","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Magic2","pan":0,"pitch":150,"volume":75}},{"frame":0,"se":{"name":"Up3","pan":0,"pitch":150,"volume":90}},{"frame":39,"se":{"name":"Magic4","pan":0,"pitch":150,"volume":90}},{"frame":39,"se":{"name":"Darkness4","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":118,"displayType":0,"effectName":"LightPillar2","flashTimings":[{"frame":5,"duration":30,"color":[255,255,255,102]},{"frame":39,"duration":30,"color":[255,255,255,255]}],"name":"Light Pillar 2","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":0,"se":{"name":"Magic2","pan":0,"pitch":150,"volume":75}},{"frame":0,"se":{"name":"Up3","pan":0,"pitch":150,"volume":90}},{"frame":39,"se":{"name":"Float1","pan":0,"pitch":150,"volume":90}},{"frame":39,"se":{"name":"Darkness4","pan":0,"pitch":150,"volume":90}}],"speed":100}, +{"id":119,"displayType":0,"effectName":"BallsOfLight","flashTimings":[{"frame":5,"duration":30,"color":[255,255,255,119]},{"frame":39,"duration":30,"color":[255,255,255,255]}],"name":"Balls of Light","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":120,"soundTimings":[{"frame":0,"se":{"name":"Particles1","pan":0,"pitch":110,"volume":60}},{"frame":0,"se":{"name":"Teleport","pan":0,"pitch":110,"volume":90}}],"speed":100}, +{"id":120,"displayType":0,"effectName":"Radiation","flashTimings":[{"frame":5,"duration":30,"color":[255,255,255,255]},{"frame":39,"duration":30,"color":[255,255,255,255]}],"name":"Radiation","offsetX":0,"offsetY":0,"rotation":{"x":0,"y":0,"z":0},"scale":100,"soundTimings":[{"frame":5,"se":{"name":"Flash2","pan":0,"pitch":100,"volume":90}}],"speed":100} +] \ No newline at end of file diff --git a/data/Armors.json b/data/Armors.json new file mode 100644 index 0000000..cbe9619 --- /dev/null +++ b/data/Armors.json @@ -0,0 +1,103 @@ +[ +null, +{"id":1,"atypeId":1,"description":"","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"-----Armors","note":"","params":[0,0,0,1,0,0,0,0],"price":100}, +{"id":2,"atypeId":1,"description":"[General Equipment] Linen clothing with high\nbreathability.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"Linen Clothing","note":"","params":[0,0,0,1,0,0,0,0],"price":100}, +{"id":3,"atypeId":1,"description":"[General Equipment] A vest made of tanned hide.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"Leather Vest","note":"","params":[0,0,0,3,0,0,0,0],"price":200}, +{"id":4,"atypeId":1,"description":"[General Equipment] Durable clothing that can\nwithstand rough travels.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"Adventurer’s Clothing","note":"","params":[0,0,0,7,0,0,0,0],"price":550}, +{"id":5,"atypeId":1,"description":"[General Equipment] A vest made of leather\nhardened with glue.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"Hard Leather","note":"","params":[0,0,0,15,0,0,0,0],"price":980}, +{"id":6,"atypeId":1,"description":"[General Equipment] Tanned hide clothing reinforced\nwith steel plates.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"Brigandine","note":"","params":[0,0,0,20,0,0,0,0],"price":1560}, +{"id":7,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":8,"atypeId":3,"description":"[Light Equipment] Armor made of tough cloth.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":136,"name":"Cloth Armor","note":"","params":[0,0,0,4,0,0,0,0],"price":260}, +{"id":9,"atypeId":3,"description":"[Light Equipment] Armor made of layered hide.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":136,"name":"Leather Armor","note":"","params":[0,0,0,8,0,0,0,0],"price":550}, +{"id":10,"atypeId":3,"description":"[Light Equipment] A breastplate made of bronze.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":136,"name":"Bronze Breastplate","note":"","params":[0,0,0,13,0,0,0,0],"price":840}, +{"id":11,"atypeId":3,"description":"[Light Equipment] A breastplate made of iron steel.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":136,"name":"Iron Breastplate","note":"","params":[0,0,0,20,0,0,0,0],"price":1280}, +{"id":12,"atypeId":3,"description":"[Light Equipment] A breastplate made of mithril.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":136,"name":"Mithril Breastplate","note":"","params":[0,0,0,27,0,0,0,0],"price":2800}, +{"id":13,"atypeId":3,"description":"[Light Equipment] A breastplate made of dragon scales.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":136,"name":"Dragon Breastplate","note":"","params":[0,0,0,35,0,0,0,0],"price":4680}, +{"id":14,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":15,"atypeId":4,"description":"[Heavy Equipment] Armor made of bronze.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":137,"name":"Bronze Armor","note":"","params":[0,0,0,15,0,0,0,0],"price":680}, +{"id":16,"atypeId":4,"description":"[Heavy Equipment] Armor made of iron steel.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":137,"name":"Iron Armor","note":"","params":[0,0,0,24,0,0,0,0],"price":1480}, +{"id":17,"atypeId":4,"description":"[Heavy Equipment] Armor made of mithril.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":137,"name":"Mithril Armor","note":"","params":[0,0,0,37,0,0,0,0],"price":3250}, +{"id":18,"atypeId":4,"description":"[Heavy Equipment] Armor made of dragon scales.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":137,"name":"Dragon Armor","note":"","params":[0,0,0,50,0,0,0,0],"price":5260}, +{"id":19,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":20,"atypeId":2,"description":"[Magic Equipment] A basic, widely prevalent robe.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":139,"name":"Cotton Robe","note":"","params":[0,0,0,4,2,3,0,0],"price":150}, +{"id":21,"atypeId":2,"description":"[Magic Equipment] A high-quality cloak made of silk.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":139,"name":"Silk Cloak","note":"","params":[0,0,0,9,4,6,0,0],"price":560}, +{"id":22,"atypeId":2,"description":"[Magic Equipment] A robe inscribed with runic letters.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":139,"name":"Tactician’s Robe","note":"","params":[0,0,0,15,7,11,0,0],"price":1220}, +{"id":23,"atypeId":2,"description":"[Magic Equipment] A robe interwoven with magical\npowers.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":139,"name":"Sage’s Robe","note":"","params":[0,0,0,21,15,18,0,0],"price":2980}, +{"id":24,"atypeId":2,"description":"[Magic Equipment] A cloak that houses the power of\nspirits.","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":139,"name":"Elemental Cloak","note":"","params":[0,0,0,28,20,32,0,0],"price":5760}, +{"id":25,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":26,"atypeId":1,"description":"","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"-----Shields","note":"","params":[0,0,0,1,0,0,0,0],"price":100}, +{"id":27,"atypeId":5,"description":"[Small Shield] A small shield for deflecting attacks.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":129,"name":"Buckler","note":"","params":[0,0,0,5,0,0,0,0],"price":300}, +{"id":28,"atypeId":5,"description":"[Small Shield] A round, wooden shield reinforced\nwith an iron frame.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":129,"name":"Round Buckler","note":"","params":[0,0,0,10,0,0,0,0],"price":670}, +{"id":29,"atypeId":5,"description":"[Small Shield] A round shield with attack spikes\nattached.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":129,"name":"Spiked Buckler","note":"","params":[0,0,0,15,0,0,0,0],"price":1320}, +{"id":30,"atypeId":5,"description":"[Small Shield] A small shield made of mithril.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":129,"name":"Mithril Buckler","note":"","params":[0,0,0,21,0,0,0,0],"price":2750}, +{"id":31,"atypeId":5,"description":"[Small Shield] A small shield made of dragon scales.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":129,"name":"Dragon Buckler","note":"","params":[0,0,0,28,0,0,0,0],"price":5280}, +{"id":32,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":33,"atypeId":6,"description":"[Large Shield] A large, average wooden shield.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":128,"name":"Wooden Shield","note":"","params":[0,0,0,7,0,0,0,0],"price":550}, +{"id":34,"atypeId":6,"description":"[Large Shield] A large shield made of bronze plates.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":128,"name":"Bronze Shield","note":"","params":[0,0,0,12,0,0,0,0],"price":960}, +{"id":35,"atypeId":6,"description":"[Large Shield] A large shield made of iron steel.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":128,"name":"Iron Shield","note":"","params":[0,0,0,17,0,0,0,0],"price":1480}, +{"id":36,"atypeId":6,"description":"[Large Shield] A large shield made of mithril.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":128,"name":"Mithril Shield","note":"","params":[0,0,0,25,0,0,0,0],"price":2980}, +{"id":37,"atypeId":6,"description":"[Large Shield] A large shield made of dragon scales.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":128,"name":"Dragon Shield","note":"","params":[0,0,0,38,0,0,0,0],"price":6120}, +{"id":38,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":39,"atypeId":2,"description":"[Magic Equipment] A bangle enchanted with protective\nmagic.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":144,"name":"Wooden Bangle","note":"","params":[0,0,0,2,0,3,0,0],"price":300}, +{"id":40,"atypeId":2,"description":"[Magic Equipment] A bangle enchanted with protective\nmagic.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":144,"name":"Bronze Bangle","note":"","params":[0,0,0,5,0,6,0,0],"price":650}, +{"id":41,"atypeId":2,"description":"[Magic Equipment] A bangle enchanted with protective\nmagic.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":144,"name":"Iron Bangle","note":"","params":[0,0,0,10,0,9,0,0],"price":1280}, +{"id":42,"atypeId":2,"description":"[Magic Equipment] A bangle enchanted with protective\nmagic.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":144,"name":"Mithril Bangle","note":"","params":[0,0,0,16,0,12,0,0],"price":2680}, +{"id":43,"atypeId":2,"description":"[Magic Equipment] A bangle enchanted with protective\nmagic.","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":144,"name":"Dragon Bangle","note":"","params":[0,0,0,23,0,15,0,0],"price":4860}, +{"id":44,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":45,"atypeId":1,"description":"","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"-----Helmets","note":"","params":[0,0,0,1,0,0,0,0],"price":100}, +{"id":46,"atypeId":1,"description":"[General Equipment] A cloth headband for protecting\nthe forehead.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":150,"name":"Bandana","note":"","params":[0,0,0,1,0,0,0,0],"price":50}, +{"id":47,"atypeId":1,"description":"[General Equipment] A leather headband for protecting\nthe forehead.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":150,"name":"Leather Bandana","note":"","params":[0,0,0,4,0,0,0,0],"price":120}, +{"id":48,"atypeId":1,"description":"[General Equipment] A hat made of leather.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Leather Hat","note":"","params":[0,0,0,8,0,0,0,0],"price":480}, +{"id":49,"atypeId":1,"description":"[General Equipment] A thick cloth layered and wrapped\naround the head for protection.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Turban","note":"","params":[0,0,0,12,0,0,0,0],"price":980}, +{"id":50,"atypeId":1,"description":"[General Equipment] A fancy hat with bird feathers\nattached.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Feathered Hat","note":"","params":[0,0,0,16,0,0,0,0],"price":1890}, +{"id":51,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":52,"atypeId":3,"description":"[Light Equipment] A hat made of tanned hide.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Leather Cap","note":"","params":[0,0,0,3,0,0,0,0],"price":100}, +{"id":53,"atypeId":3,"description":"[Light Equipment] A light helmet made of wood.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Wooden Cap","note":"","params":[0,0,0,7,0,0,0,0],"price":300}, +{"id":54,"atypeId":3,"description":"[Light Equipment] A light helmet reinforced with\nbronze plates.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Bronze Cap","note":"","params":[0,0,0,12,0,0,0,0],"price":720}, +{"id":55,"atypeId":3,"description":"[Light Equipment] A light helmet reinforced with\niron plates.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Iron Cap","note":"","params":[0,0,0,18,0,0,0,0],"price":1680}, +{"id":56,"atypeId":3,"description":"[Light Equipment] A light helmet reinforced with\nmithril.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Mithril Cap","note":"","params":[0,0,0,24,0,0,0,0],"price":3250}, +{"id":57,"atypeId":3,"description":"[Light Equipment] A light helmet reinforced with\ndragon scales.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":130,"name":"Dragon Cap","note":"","params":[0,0,0,30,0,0,0,0],"price":5480}, +{"id":58,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":59,"atypeId":4,"description":"[Heavy Equipment] A hood made with fine, woven chains.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":132,"name":"Chainmail Coif","note":"","params":[0,0,0,5,0,0,0,0],"price":250}, +{"id":60,"atypeId":4,"description":"[Heavy Equipment] A helmet made with thick bronze\nplates.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":132,"name":"Bronze Helm","note":"","params":[0,0,0,12,0,0,0,0],"price":750}, +{"id":61,"atypeId":4,"description":"[Heavy Equipment] A helmet made with thick iron\nplates.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":132,"name":"Iron Helm","note":"","params":[0,0,0,20,0,0,0,0],"price":1580}, +{"id":62,"atypeId":4,"description":"[Heavy Equipment] A helmet made of mithril.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":132,"name":"Mithril Helm","note":"","params":[0,0,0,28,0,0,0,0],"price":3480}, +{"id":63,"atypeId":4,"description":"[Heavy Equipment] A helmet made with dragon scales.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":132,"name":"Dragon Helm","note":"","params":[0,0,0,34,0,0,0,0],"price":6780}, +{"id":64,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":65,"atypeId":2,"description":"[Magic Equipment] A triangular, tanned hide hat with\na wide brim.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":133,"name":"Pointed Hat","note":"","params":[0,0,0,2,0,5,0,0],"price":100}, +{"id":66,"atypeId":2,"description":"[Magic Equipment] A simple crown enchanted with\nprotective magic.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":133,"name":"Circlet","note":"","params":[0,0,0,5,0,10,0,0],"price":360}, +{"id":67,"atypeId":2,"description":"[Magic Equipment] A silver crown enchanted with\nprotective magic.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":133,"name":"Silver Circlet","note":"","params":[0,0,0,8,0,15,0,0],"price":980}, +{"id":68,"atypeId":2,"description":"[Magic Equipment] A pure gold crown enchanted with\nprotective magic.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":133,"name":"Gold Circlet","note":"","params":[0,0,0,16,0,25,0,0],"price":1980}, +{"id":69,"atypeId":2,"description":"[Magic Equipment] A mithril crown enchanted with\nprotective magic.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":133,"name":"Mithril Circlet","note":"","params":[0,0,0,20,0,30,0,0],"price":3680}, +{"id":70,"atypeId":2,"description":"[Magic Equipment] A sage’s crown enchanted with\nprotective magic.","etypeId":3,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":133,"name":"Master Circlet","note":"","params":[0,0,0,25,0,36,0,0],"price":5860}, +{"id":71,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":72,"atypeId":1,"description":"","etypeId":4,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":135,"name":"-----Accessories","note":"","params":[0,0,0,1,0,0,0,0],"price":100}, +{"id":73,"atypeId":1,"description":"[Accessory] A charm that increases Defense.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":147,"name":"Guard Stone","note":"","params":[0,0,0,5,0,5,0,0],"price":500}, +{"id":74,"atypeId":1,"description":"[Accessory] A ring that increases Defense.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":145,"name":"Guard Ring","note":"","params":[0,0,0,10,0,10,0,0],"price":1000}, +{"id":75,"atypeId":1,"description":"[Accessory] A charm that increases Attack.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":147,"name":"Power Stone","note":"","params":[0,0,5,0,5,0,0,0],"price":500}, +{"id":76,"atypeId":1,"description":"[Accessory] A ring that increases Attack.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":145,"name":"Power Ring","note":"","params":[0,0,5,0,10,0,0,0],"price":1000}, +{"id":77,"atypeId":1,"description":"[Accessory] A charm that increases Agility.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":147,"name":"Speed Stone","note":"","params":[0,0,0,0,0,0,5,0],"price":500}, +{"id":78,"atypeId":1,"description":"[Accessory] A ring that increases Agility.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":145,"name":"Speed Ring","note":"","params":[0,0,0,0,0,0,5,0],"price":1000}, +{"id":79,"atypeId":1,"description":"[Accessory] A charm that increases Luck.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":147,"name":"Lucky Stone","note":"","params":[0,0,0,0,0,0,0,5],"price":500}, +{"id":80,"atypeId":1,"description":"[Accessory] A ring that increases Luck.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":145,"name":"Lucky Ring","note":"","params":[0,0,0,0,0,0,0,10],"price":1000}, +{"id":81,"atypeId":1,"description":"[Accessory] A charm that increases M.Attack.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":147,"name":"Magical Stone","note":"","params":[0,0,0,0,5,5,0,0],"price":500}, +{"id":82,"atypeId":1,"description":"[Accessory] A ring that increases M.Attack.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":145,"name":"Magical Ring","note":"","params":[0,0,0,0,10,10,0,0],"price":1000}, +{"id":83,"atypeId":1,"description":"[Accessory] A charm that increases the Hit Rate of\nattacks.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":22,"dataId":0,"value":1.5}],"iconIndex":147,"name":"Shooter Stone","note":"","params":[0,0,0,0,0,0,0,0],"price":500}, +{"id":84,"atypeId":1,"description":"[Accessory] A ring that increases the Hit Rate of\nattacks.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":22,"dataId":0,"value":2}],"iconIndex":145,"name":"Shooter Ring","note":"","params":[0,0,0,0,0,0,0,0],"price":100}, +{"id":85,"atypeId":1,"description":"[Accessory] A charm that reduces MP Cost by 20%.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":23,"dataId":4,"value":0.8}],"iconIndex":147,"name":"Master Stone","note":"","params":[0,0,0,0,0,0,0,0],"price":500}, +{"id":86,"atypeId":1,"description":"[Accessory] A ring that reduces MP Cost by 50%.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":23,"dataId":4,"value":0.5}],"iconIndex":145,"name":"Master Ring","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":87,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":88,"atypeId":1,"description":"[Accessory] A ring that helps prevent Poison and\nParalysis states.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":13,"dataId":4,"value":0.6},{"code":13,"dataId":12,"value":0.6},{"code":13,"dataId":17,"value":0.6}],"iconIndex":145,"name":"Poison Guard","note":"","params":[0,0,0,1,0,0,0,0],"price":300}, +{"id":89,"atypeId":1,"description":"[Accessory] A ring that entirely prevents Poison\nand Paralysis states.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":14,"dataId":4,"value":1},{"code":14,"dataId":12,"value":1},{"code":14,"dataId":17,"value":1}],"iconIndex":145,"name":"Super Poison Guard","note":"","params":[0,0,0,5,0,0,0,0],"price":3000}, +{"id":90,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":91,"atypeId":1,"description":"[Accessory] A ring that helps prevent Sleep,\nSilence, Confusion, Charm, and Rage states.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":13,"dataId":6,"value":0.6},{"code":13,"dataId":7,"value":0.6},{"code":13,"dataId":9,"value":0.6},{"code":13,"dataId":10,"value":0.6},{"code":13,"dataId":8,"value":0.6}],"iconIndex":145,"name":"Mental Guard","note":"","params":[0,0,0,1,0,0,0,0],"price":500}, +{"id":92,"atypeId":1,"description":"[Accessory] A ring that entirely prevents Sleep,\nSilence, Confusion, Charm, and Rage states.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":14,"dataId":6,"value":1},{"code":14,"dataId":8,"value":1},{"code":14,"dataId":7,"value":1},{"code":14,"dataId":9,"value":1},{"code":14,"dataId":10,"value":1}],"iconIndex":145,"name":"Super Mental Guard","note":"","params":[0,0,0,1,0,0,0,0],"price":5000}, +{"id":93,"atypeId":0,"description":"","etypeId":2,"traits":[{"code":22,"dataId":1,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0}, +{"id":94,"atypeId":1,"description":"[Accessory] Raises the chance of performing a\npreemptive attack.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":64,"dataId":3,"value":1}],"iconIndex":147,"name":"Enemy Radar","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":95,"atypeId":1,"description":"[Accessory] Prevents surprise attacks.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":64,"dataId":2,"value":1}],"iconIndex":205,"name":"Warning Bell","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":96,"atypeId":1,"description":"[Accessory] Allows you to carryover TP over into the\nnext battle.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":62,"dataId":3,"value":1}],"iconIndex":144,"name":"Stocker","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":97,"atypeId":1,"description":"[Accessory] Increases TP Charge Rate.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":23,"dataId":5,"value":2}],"iconIndex":145,"name":"Ring of Guts","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":98,"atypeId":1,"description":"[Accessory] Decreases MP Cost Rate.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":23,"dataId":4,"value":0.5}],"iconIndex":144,"name":"MP Keeper","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":99,"atypeId":1,"description":"[Accessory] Damage inflicted by Fire, Water, Wind,\nand Earth attacks is halved.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":11,"dataId":2,"value":0.5},{"code":11,"dataId":5,"value":0.5},{"code":11,"dataId":6,"value":0.5},{"code":11,"dataId":7,"value":0.5}],"iconIndex":145,"name":"Elemental Guard","note":"","params":[0,0,0,0,0,0,0,0],"price":1000}, +{"id":100,"atypeId":1,"description":"[Accessory] Sharpens eyesight and increases hit rate.","etypeId":5,"traits":[{"code":22,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0.5}],"iconIndex":151,"name":"Spectacles","note":"","params":[0,0,0,0,0,0,0,0],"price":500} +] \ No newline at end of file diff --git a/data/Classes.json b/data/Classes.json new file mode 100644 index 0000000..ec9a13b --- /dev/null +++ b/data/Classes.json @@ -0,0 +1,11 @@ +[ +null, +{"id":1,"expParams":[30,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":1},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.1},{"code":41,"dataId":2,"value":1},{"code":51,"dataId":2,"value":0},{"code":51,"dataId":1,"value":1},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":3,"value":0},{"code":52,"dataId":5,"value":0}],"learnings":[{"level":2,"note":"","skillId":172},{"level":5,"note":"","skillId":173},{"level":8,"note":"","skillId":175},{"level":12,"note":"","skillId":176},{"level":15,"note":"","skillId":174},{"level":20,"note":"","skillId":178}],"name":"Swordsman","note":"","params":[[1,544,618,691,764,838,911,984,1058,1131,1204,1278,1351,1424,1497,1571,1644,1717,1791,1864,1937,2011,2084,2157,2231,2304,2377,2450,2524,2597,2670,2744,2817,2890,2964,3037,3110,3184,3257,3330,3403,3477,3550,3623,3697,3770,3843,3917,3990,4063,4136,4210,4283,4356,4430,4503,4576,4650,4723,4796,4870,4943,5016,5089,5163,5236,5309,5383,5456,5529,5603,5676,5749,5823,5896,5969,6042,6116,6189,6262,6336,6409,6482,6556,6629,6702,6776,6849,6922,6995,7069,7142,7215,7289,7362,7435,7509,7582,7655,7728],[0,41,50,59,68,76,85,94,102,111,120,129,137,146,155,163,172,181,190,198,207,216,224,233,242,251,259,268,277,285,294,303,312,320,329,338,346,355,364,373,381,390,399,407,416,425,434,442,451,460,468,477,486,495,503,512,521,529,538,547,556,564,573,582,590,599,608,617,625,634,643,651,660,669,678,686,695,704,712,721,730,739,747,756,765,773,782,791,800,808,817,826,834,843,852,861,869,878,887,895],[1,19,21,23,25,27,29,30,32,34,36,38,39,41,43,45,47,48,50,52,54,56,57,59,61,63,65,66,68,70,72,74,75,77,79,81,83,85,86,88,90,92,94,95,97,99,101,103,104,106,108,110,112,113,115,117,119,121,122,124,126,128,130,131,133,135,137,139,141,142,144,146,148,150,151,153,155,157,159,160,162,164,166,168,169,171,173,175,177,178,180,182,184,186,187,189,191,193,195,196],[1,17,19,21,22,24,25,27,29,30,32,33,35,36,38,40,41,43,44,46,48,49,51,52,54,55,57,59,60,62,63,65,67,68,70,71,73,74,76,78,79,81,82,84,86,87,89,90,92,93,95,97,98,100,101,103,104,106,108,109,111,112,114,116,117,119,120,122,123,125,127,128,130,131,133,135,136,138,139,141,142,144,146,147,149,150,152,154,155,157,158,160,161,163,165,166,168,169,171,172],[1,15,17,18,19,20,22,23,24,25,26,28,29,30,31,32,34,35,36,37,38,40,41,42,43,44,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,64,65,66,67,68,70,71,72,73,74,76,77,78,79,81,82,83,84,85,87,88,89,90,91,93,94,95,96,97,99,100,101,102,103,105,106,107,108,109,111,112,113,114,115,117,118,119,120,121,123,124,125,126,127,129,130,131,132,133],[1,17,19,20,22,23,25,26,28,29,31,32,33,35,36,38,39,41,42,44,45,46,48,49,51,52,54,55,57,58,60,61,62,64,65,67,68,70,71,73,74,75,77,78,80,81,83,84,86,87,88,90,91,93,94,96,97,99,100,102,103,104,106,107,109,110,112,113,115,116,117,119,120,122,123,125,126,128,129,131,132,133,135,136,138,139,141,142,144,145,146,148,149,151,152,154,155,157,158,159],[1,29,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,182,185,188,191,194,197,200,203,206,209,212,215,218,221,224,227,230,233,236,239,242,245,248,251,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312,315,318,321,324,327],[1,27,31,34,37,40,43,46,49,52,56,59,62,65,68,71,74,77,80,84,87,90,93,96,99,102,105,108,112,115,118,121,124,127,130,133,136,140,143,146,149,152,155,158,161,164,168,171,174,177,180,183,186,189,192,196,199,202,205,208,211,214,217,220,224,227,230,233,236,239,242,245,248,252,255,258,261,264,267,270,273,276,280,283,286,289,292,295,298,301,304,308,311,314,317,320,323,326,329,332]]}, +{"id":2,"expParams":[20,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":1},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.04},{"code":41,"dataId":1,"value":0},{"code":51,"dataId":6,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":2,"value":0}],"learnings":[{"level":1,"note":"","skillId":99},{"level":3,"note":"","skillId":75},{"level":5,"note":"","skillId":103},{"level":5,"note":"","skillId":187},{"level":8,"note":"","skillId":100},{"level":11,"note":"","skillId":74},{"level":15,"note":"","skillId":193},{"level":15,"note":"","skillId":92},{"level":18,"note":"","skillId":76},{"level":18,"note":"","skillId":104},{"level":21,"note":"","skillId":101},{"level":21,"note":"","skillId":132},{"level":25,"note":"","skillId":189}],"name":"Sorcerer","note":"","params":[[1,297,343,389,435,480,526,572,618,663,709,755,801,846,892,938,984,1029,1075,1121,1166,1212,1258,1304,1349,1395,1441,1487,1532,1578,1624,1670,1715,1761,1807,1852,1898,1944,1990,2035,2081,2127,2173,2218,2264,2310,2356,2401,2447,2493,2538,2584,2630,2676,2721,2767,2813,2859,2904,2950,2996,3042,3087,3133,3179,3225,3270,3316,3362,3407,3453,3499,3545,3590,3636,3682,3728,3773,3819,3865,3911,3956,4002,4048,4093,4139,4185,4231,4276,4322,4368,4414,4459,4505,4551,4597,4642,4688,4734,4779],[0,131,147,162,177,192,208,223,238,253,268,284,299,314,329,344,360,375,390,405,421,436,451,466,481,497,512,527,542,557,573,588,603,618,634,649,664,679,694,710,725,740,755,770,786,801,816,831,847,862,877,892,907,923,938,953,968,983,999,1014,1029,1044,1060,1075,1090,1105,1120,1136,1151,1166,1181,1196,1212,1227,1242,1257,1273,1288,1303,1318,1333,1349,1364,1379,1394,1409,1425,1440,1455,1470,1486,1501,1516,1531,1546,1562,1577,1592,1607,1622],[1,12,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,83,84,85,86,87,88,89,90,91,93,94,95,96,97,98,99,100,101,103,104,105,106,107,108,109,110,111,113,114,115,116,117,118,119,120,121],[1,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,104],[1,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217],[1,20,23,25,27,29,31,33,35,37,39,41,44,46,48,50,52,54,56,58,60,62,64,67,69,71,73,75,77,79,81,83,85,87,90,92,94,96,98,100,102,104,106,108,110,113,115,117,119,121,123,125,127,129,131,133,136,138,140,142,144,146,148,150,152,154,156,159,161,163,165,167,169,171,173,175,177,179,182,184,186,188,190,192,194,196,198,200,202,205,207,209,211,213,215,217,219,221,223,225],[1,22,25,28,30,33,35,38,41,43,46,48,51,53,56,59,61,64,66,69,72,74,77,79,82,84,87,90,92,95,97,100,103,105,108,110,113,115,118,121,123,126,128,131,134,136,139,141,144,146,149,152,154,157,159,162,164,167,170,172,175,177,180,183,185,188,190,193,195,198,201,203,206,208,211,214,216,219,221,224,226,229,232,234,237,239,242,245,247,250,252,255,257,260,263,265,268,270,273,275],[1,18,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219]]}, +{"id":3,"expParams":[25,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":1},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.04},{"code":41,"dataId":1,"value":0},{"code":51,"dataId":6,"value":0},{"code":51,"dataId":3,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":2,"value":0}],"learnings":[{"level":1,"note":"","skillId":52},{"level":1,"note":"","skillId":60},{"level":1,"note":"","skillId":83},{"level":1,"note":"","skillId":81},{"level":3,"note":"","skillId":141},{"level":3,"note":"","skillId":85},{"level":3,"note":"","skillId":87},{"level":5,"note":"","skillId":56},{"level":5,"note":"","skillId":186},{"level":5,"note":"","skillId":89},{"level":8,"note":"","skillId":53},{"level":8,"note":"","skillId":61},{"level":10,"note":"","skillId":144},{"level":13,"note":"","skillId":57},{"level":15,"note":"","skillId":188},{"level":15,"note":"","skillId":54},{"level":18,"note":"","skillId":62},{"level":18,"note":"","skillId":142},{"level":25,"note":"","skillId":145}],"name":"Priest","note":"","params":[[1,308,366,423,481,538,596,653,711,768,825,883,940,998,1055,1113,1170,1228,1285,1342,1400,1457,1515,1572,1630,1687,1744,1802,1859,1917,1974,2032,2089,2147,2204,2261,2319,2376,2434,2491,2549,2606,2663,2721,2778,2836,2893,2951,3008,3066,3123,3180,3238,3295,3353,3410,3468,3525,3583,3640,3697,3755,3812,3870,3927,3985,4042,4099,4157,4214,4272,4329,4387,4444,4502,4559,4616,4674,4731,4789,4846,4904,4961,5018,5076,5133,5191,5248,5306,5363,5421,5478,5535,5593,5650,5708,5765,5823,5880,5937],[0,133,150,167,183,200,216,233,249,266,282,299,316,332,349,365,382,398,415,431,448,465,481,498,514,531,547,564,580,597,613,630,647,663,680,696,713,729,746,762,779,796,812,829,845,862,878,895,911,928,944,961,978,994,1011,1027,1044,1060,1077,1093,1110,1127,1143,1160,1176,1193,1209,1226,1242,1259,1276,1292,1309,1325,1342,1358,1375,1391,1408,1424,1441,1458,1474,1491,1507,1524,1540,1557,1573,1590,1607,1623,1640,1656,1673,1689,1706,1722,1739,1755],[1,13,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,33,34,35,36,37,39,40,41,42,43,45,46,47,48,49,51,52,53,54,55,56,58,59,60,61,62,64,65,66,67,68,70,71,72,73,74,76,77,78,79,80,82,83,84,85,86,88,89,90,91,92,93,95,96,97,98,99,101,102,103,104,105,107,108,109,110,111,113,114,115,116,117,119,120,121,122,123,125,126,127,128,129,130],[0,14,16,17,18,19,20,21,23,24,25,26,27,28,29,31,32,33,34,35,36,38,39,40,41,42,43,44,46,47,48,49,50,51,53,54,55,56,57,58,59,61,62,63,64,65,66,68,69,70,71,72,73,74,76,77,78,79,80,81,83,84,85,86,87,88,89,91,92,93,94,95,96,98,99,100,101,102,103,104,106,107,108,109,110,111,113,114,115,116,117,118,119,121,122,123,124,125,126,127],[0,14,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,67,68,69,70,71,72,73,75,76,77,78,79,80,81,82,84,85,86,87,88,89,90,92,93,94,95,96,97,98,99,101,102,103,104,105,106,107,109,110,111,112,113,114,115,116,118,119,120,121,122,123,124,125],[0,15,17,18,19,21,22,23,25,26,27,29,30,31,33,34,35,37,38,39,41,42,43,45,46,47,49,50,51,53,54,55,57,58,59,61,62,63,65,66,67,69,70,71,73,74,75,77,78,79,80,82,83,84,86,87,88,90,91,92,94,95,96,98,99,100,102,103,104,106,107,108,110,111,112,114,115,116,118,119,120,122,123,124,126,127,128,130,131,132,134,135,136,138,139,140,142,143,144,145],[0,24,27,30,32,35,38,40,43,45,48,51,53,56,59,61,64,66,69,72,74,77,80,82,85,87,90,93,95,98,101,103,106,108,111,114,116,119,122,124,127,129,132,135,137,140,143,145,148,150,153,156,158,161,163,166,169,171,174,177,179,182,184,187,190,192,195,198,200,203,205,208,211,213,216,219,221,224,226,229,232,234,237,240,242,245,247,250,253,255,258,261,263,266,268,271,274,276,279,281],[0,32,36,40,43,47,51,54,58,62,65,69,73,76,80,84,87,91,95,98,102,106,109,113,117,120,124,128,131,135,139,142,146,150,153,157,161,164,168,172,175,179,183,186,190,194,197,201,205,208,212,216,219,223,227,230,234,238,241,245,249,252,256,260,263,267,271,274,278,282,285,289,293,296,300,304,307,311,315,318,322,326,329,333,337,340,344,348,351,355,359,362,366,370,373,377,381,384,388,391]]}, +{"id":4,"expParams":[30,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":1},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.04},{"code":41,"dataId":2,"value":0},{"code":51,"dataId":2,"value":0},{"code":51,"dataId":12,"value":0},{"code":51,"dataId":4,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":3,"value":0},{"code":52,"dataId":4,"value":0},{"code":52,"dataId":5,"value":0},{"code":52,"dataId":6,"value":0}],"learnings":[{"level":1,"note":"","skillId":196},{"level":3,"note":"","skillId":197},{"level":3,"note":"","skillId":200},{"level":5,"note":"","skillId":198},{"level":8,"note":"","skillId":201},{"level":13,"note":"","skillId":202},{"level":16,"note":"","skillId":199},{"level":20,"note":"","skillId":203}],"name":"Knight","note":"","params":[[1,592,666,739,813,886,960,1033,1106,1180,1253,1327,1400,1474,1547,1620,1694,1767,1841,1914,1988,2061,2134,2208,2281,2355,2428,2502,2575,2648,2722,2795,2869,2942,3016,3089,3162,3236,3309,3383,3456,3530,3603,3676,3750,3823,3897,3970,4044,4117,4190,4264,4337,4411,4484,4558,4631,4704,4778,4851,4925,4998,5072,5145,5218,5292,5365,5439,5512,5586,5659,5732,5806,5879,5953,6026,6100,6173,6246,6320,6393,6467,6540,6614,6687,6760,6834,6907,6981,7054,7128,7201,7274,7348,7421,7495,7568,7642,7715,7788],[0,50,60,69,78,87,97,106,115,124,134,143,152,161,171,180,189,198,207,217,226,235,244,254,263,272,281,291,300,309,318,328,337,346,355,364,374,383,392,401,411,420,429,438,448,457,466,475,485,494,503,512,521,531,540,549,558,568,577,586,595,605,614,623,632,642,651,660,669,678,688,697,706,715,725,734,743,752,762,771,780,789,799,808,817,826,835,845,854,863,872,882,891,900,909,919,928,937,946,955],[1,18,20,22,24,25,27,29,30,32,34,35,37,39,41,42,44,46,47,49,51,52,54,56,57,59,61,63,64,66,68,69,71,73,74,76,78,79,81,83,85,86,88,90,91,93,95,96,98,100,101,103,105,107,108,110,112,113,115,117,118,120,122,124,125,127,129,130,132,134,135,137,139,140,142,144,146,147,149,151,152,154,156,157,159,161,162,164,166,168,169,171,173,174,176,178,179,181,183,184],[0,18,20,22,24,25,27,29,30,32,34,35,37,39,40,42,44,45,47,49,50,52,54,56,57,59,61,62,64,66,67,69,71,72,74,76,77,79,81,82,84,86,88,89,91,93,94,96,98,99,101,103,104,106,108,109,111,113,114,116,118,120,121,123,125,126,128,130,131,133,135,136,138,140,141,143,145,146,148,150,152,153,155,157,158,160,162,163,165,167,168,170,172,173,175,177,178,180,182,183],[1,15,17,18,20,21,23,24,26,27,29,30,32,33,35,36,38,39,40,42,43,45,46,48,49,51,52,54,55,57,58,60,61,63,64,65,67,68,70,71,73,74,76,77,79,80,82,83,85,86,87,89,90,92,93,95,96,98,99,101,102,104,105,107,108,110,111,112,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,136,137,139,140,142,143,145,146,148,149,151,152,154,155,157,158,159],[1,20,22,24,26,28,29,31,33,35,36,38,40,42,43,45,47,49,51,52,54,56,58,59,61,63,65,66,68,70,72,73,75,77,79,81,82,84,86,88,89,91,93,95,96,98,100,102,103,105,107,109,111,112,114,116,118,119,121,123,125,126,128,130,132,133,135,137,139,141,142,144,146,148,149,151,153,155,156,158,160,162,163,165,167,169,171,172,174,176,178,179,181,183,185,186,188,190,192,193],[0,25,28,31,34,37,40,43,46,49,52,54,57,60,63,66,69,72,75,78,81,83,86,89,92,95,98,101,104,107,110,112,115,118,121,124,127,130,133,136,139,141,144,147,150,153,156,159,162,165,167,170,173,176,179,182,185,188,191,194,196,199,202,205,208,211,214,217,220,223,225,228,231,234,237,240,243,246,249,252,254,257,260,263,266,269,272,275,278,281,283,286,289,292,295,298,301,304,307,309],[0,21,24,27,29,32,35,37,40,43,45,48,51,53,56,59,61,64,67,69,72,75,77,80,83,85,88,91,93,96,99,101,104,107,109,112,115,117,120,123,125,128,131,133,136,139,141,144,147,149,152,155,157,160,163,165,168,171,173,176,179,181,184,187,189,192,195,197,200,203,205,208,211,213,216,219,221,224,227,229,232,235,237,240,243,245,248,251,253,256,259,261,264,267,269,272,275,277,280,282]]}, +{"id":5,"expParams":[30,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.04},{"code":41,"dataId":2,"value":0},{"code":51,"dataId":3,"value":0},{"code":51,"dataId":11,"value":0},{"code":51,"dataId":10,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":3,"value":0},{"code":52,"dataId":5,"value":1}],"learnings":[{"level":1,"note":"","skillId":175},{"level":2,"note":"","skillId":172},{"level":5,"note":"","skillId":216},{"level":8,"note":"","skillId":217},{"level":12,"note":"","skillId":218},{"level":15,"note":"","skillId":174},{"level":20,"note":"","skillId":219}],"name":"Martial Artist","note":"","params":[[1,639,717,794,872,949,1027,1104,1182,1259,1337,1414,1492,1569,1647,1724,1802,1879,1957,2034,2112,2189,2267,2344,2422,2499,2577,2654,2732,2809,2887,2964,3042,3119,3197,3274,3352,3429,3507,3584,3662,3739,3817,3894,3972,4049,4127,4204,4282,4359,4436,4514,4591,4669,4746,4824,4901,4979,5056,5134,5211,5289,5366,5444,5521,5599,5676,5754,5831,5909,5986,6064,6141,6219,6296,6374,6451,6529,6606,6684,6761,6839,6916,6994,7071,7149,7226,7304,7381,7459,7536,7614,7691,7769,7846,7924,8001,8079,8156,8233],[0,44,54,63,72,81,91,100,109,118,127,137,146,155,164,173,183,192,201,210,219,229,238,247,256,265,275,284,293,302,311,321,330,339,348,357,367,376,385,394,403,413,422,431,440,449,459,468,477,486,495,505,514,523,532,542,551,560,569,578,588,597,606,615,624,634,643,652,661,670,680,689,698,707,716,726,735,744,753,762,772,781,790,799,808,818,827,836,845,854,864,873,882,891,900,910,919,928,937,946],[1,18,20,22,24,26,28,29,31,33,35,37,38,40,42,44,46,48,49,51,53,55,57,58,60,62,64,66,68,69,71,73,75,77,78,80,82,84,86,88,89,91,93,95,97,98,100,102,104,106,107,109,111,113,115,117,118,120,122,124,126,127,129,131,133,135,137,138,140,142,144,146,147,149,151,153,155,157,158,160,162,164,166,167,169,171,173,175,177,178,180,182,184,186,187,189,191,193,195,196],[1,20,22,24,25,27,29,30,32,34,35,37,39,40,42,44,45,47,49,50,52,54,55,57,59,60,62,64,65,67,69,70,72,74,75,77,79,80,82,84,85,87,89,90,92,94,95,97,99,100,102,104,105,107,109,110,112,114,115,117,119,120,122,124,125,127,129,130,132,134,135,137,139,140,142,144,145,147,149,150,152,154,155,157,159,160,162,164,165,167,169,170,172,174,175,177,179,180,182,183],[1,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,104],[1,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110],[1,34,38,41,44,47,51,54,57,60,64,67,70,73,77,80,83,86,89,93,96,99,102,106,109,112,115,119,122,125,128,132,135,138,141,144,148,151,154,157,161,164,167,170,174,177,180,183,187,190,193,196,199,203,206,209,212,216,219,222,225,229,232,235,238,242,245,248,251,254,258,261,264,267,271,274,277,280,284,287,290,293,297,300,303,306,309,313,316,319,322,326,329,332,335,339,342,345,348,351],[1,26,30,33,36,39,42,46,49,52,55,58,62,65,68,71,74,78,81,84,87,90,94,97,100,103,106,110,113,116,119,122,126,129,132,135,138,141,145,148,151,154,157,161,164,167,170,173,177,180,183,186,189,193,196,199,202,205,209,212,215,218,221,225,228,231,234,237,240,244,247,250,253,256,260,263,266,269,272,276,279,282,285,288,292,295,298,301,304,308,311,314,317,320,324,327,330,333,336,339]]}, +{"id":6,"expParams":[30,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":1},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.1},{"code":41,"dataId":1,"value":1},{"code":41,"dataId":2,"value":1},{"code":51,"dataId":2,"value":0},{"code":51,"dataId":6,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":3,"value":0},{"code":52,"dataId":5,"value":0},{"code":52,"dataId":2,"value":1}],"learnings":[{"level":2,"note":"","skillId":172},{"level":5,"note":"","skillId":173},{"level":8,"note":"","skillId":175},{"level":12,"note":"","skillId":176},{"level":15,"note":"","skillId":174},{"level":20,"note":"","skillId":177},{"level":1,"note":"","skillId":107},{"level":5,"note":"","skillId":190},{"level":5,"note":"","skillId":187},{"level":8,"note":"","skillId":108},{"level":8,"note":"","skillId":191},{"level":12,"note":"","skillId":111},{"level":15,"note":"","skillId":192},{"level":20,"note":"","skillId":109}],"name":"Magic Swordsman","note":"","params":[[1,544,618,691,764,838,911,984,1058,1131,1204,1278,1351,1424,1497,1571,1644,1717,1791,1864,1937,2011,2084,2157,2231,2304,2377,2450,2524,2597,2670,2744,2817,2890,2964,3037,3110,3184,3257,3330,3403,3477,3550,3623,3697,3770,3843,3917,3990,4063,4136,4210,4283,4356,4430,4503,4576,4650,4723,4796,4870,4943,5016,5089,5163,5236,5309,5383,5456,5529,5603,5676,5749,5823,5896,5969,6042,6116,6189,6262,6336,6409,6482,6556,6629,6702,6776,6849,6922,6995,7069,7142,7215,7289,7362,7435,7509,7582,7655,7728],[0,117,131,145,159,172,186,200,213,227,241,254,268,282,295,309,323,336,350,364,377,391,405,418,432,446,459,473,487,500,514,528,541,555,569,582,596,610,623,637,651,664,678,692,705,719,733,746,760,774,787,801,815,829,842,856,870,883,897,911,924,938,952,965,979,993,1006,1020,1034,1047,1061,1075,1088,1102,1116,1129,1143,1157,1170,1184,1198,1211,1225,1239,1252,1266,1280,1293,1307,1321,1334,1348,1362,1375,1389,1403,1416,1430,1444,1457],[1,19,21,23,24,26,28,29,31,33,34,36,38,39,41,42,44,46,47,49,51,52,54,56,57,59,61,62,64,65,67,69,70,72,74,75,77,79,80,82,84,85,87,88,90,92,93,95,97,98,100,102,103,105,107,108,110,111,113,115,116,118,120,121,123,125,126,128,130,131,133,134,136,138,139,141,143,144,146,148,149,151,153,154,156,157,159,161,162,164,166,167,169,171,172,174,176,177,179,180],[1,19,21,23,25,26,28,30,31,33,35,36,38,40,41,43,45,46,48,50,51,53,55,56,58,60,61,63,65,66,68,70,71,73,75,76,78,80,81,83,85,86,88,90,91,93,95,96,98,100,101,103,105,107,108,110,112,113,115,117,118,120,122,123,125,127,128,130,132,133,135,137,138,140,142,143,145,147,148,150,152,153,155,157,158,160,162,163,165,167,168,170,172,173,175,177,178,180,182,183],[1,19,21,23,25,26,28,30,32,33,35,37,39,40,42,44,46,47,49,51,52,54,56,58,59,61,63,65,66,68,70,72,73,75,77,78,80,82,84,85,87,89,91,92,94,96,98,99,101,103,104,106,108,110,111,113,115,117,118,120,122,124,125,127,129,131,132,134,136,137,139,141,143,144,146,148,150,151,153,155,157,158,160,162,163,165,167,169,170,172,174,176,177,179,181,183,184,186,188,189],[1,19,21,23,25,26,28,30,31,33,35,37,38,40,42,43,45,47,49,50,52,54,55,57,59,61,62,64,66,67,69,71,73,74,76,78,79,81,83,85,86,88,90,91,93,95,97,98,100,102,103,105,107,109,110,112,114,115,117,119,121,122,124,126,127,129,131,133,134,136,138,139,141,143,145,146,148,150,151,153,155,157,158,160,162,163,165,167,169,170,172,174,175,177,179,181,182,184,186,187],[1,21,24,27,29,32,34,37,39,42,45,47,50,52,55,57,60,62,65,68,70,73,75,78,80,83,86,88,91,93,96,98,101,103,106,109,111,114,116,119,121,124,127,129,132,134,137,139,142,144,147,150,152,155,157,160,162,165,167,170,173,175,178,180,183,185,188,191,193,196,198,201,203,206,208,211,214,216,219,221,224,226,229,232,234,237,239,242,244,247,249,252,255,257,260,262,265,267,270,272],[1,24,27,30,33,35,38,41,43,46,49,52,54,57,60,62,65,68,70,73,76,79,81,84,87,89,92,95,98,100,103,106,108,111,114,116,119,122,125,127,130,133,135,138,141,143,146,149,152,154,157,160,162,165,168,171,173,176,179,181,184,187,189,192,195,198,200,203,206,208,211,214,216,219,222,225,227,230,233,235,238,241,244,246,249,252,254,257,260,262,265,268,271,273,276,279,281,284,287,289]]}, +{"id":7,"expParams":[30,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.04},{"code":41,"dataId":2,"value":0},{"code":51,"dataId":7,"value":0},{"code":51,"dataId":8,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":3,"value":0}],"learnings":[{"level":2,"note":"","skillId":226},{"level":5,"note":"","skillId":197},{"level":8,"note":"","skillId":208},{"level":12,"note":"","skillId":227},{"level":15,"note":"","skillId":228},{"level":20,"note":"","skillId":229}],"name":"Hunter","note":"","params":[[1,335,384,433,481,530,578,627,676,724,773,821,870,919,967,1016,1064,1113,1162,1210,1259,1307,1356,1405,1453,1502,1550,1599,1647,1696,1745,1793,1842,1890,1939,1988,2036,2085,2133,2182,2231,2279,2328,2376,2425,2474,2522,2571,2619,2668,2716,2765,2814,2862,2911,2959,3008,3057,3105,3154,3202,3251,3300,3348,3397,3445,3494,3543,3591,3640,3688,3737,3786,3834,3883,3931,3980,4028,4077,4126,4174,4223,4271,4320,4369,4417,4466,4514,4563,4612,4660,4709,4757,4806,4855,4903,4952,5000,5049,5097],[0,70,80,90,100,109,119,129,139,148,158,168,177,187,197,207,216,226,236,246,255,265,275,284,294,304,314,323,333,343,353,362,372,382,391,401,411,421,430,440,450,459,469,479,489,498,508,518,528,537,547,557,566,576,586,596,605,615,625,635,644,654,664,673,683,693,703,712,722,732,741,751,761,771,780,790,800,810,819,829,839,848,858,868,878,887,897,907,917,926,936,946,955,965,975,985,994,1004,1014,1023],[1,17,19,20,22,23,24,26,27,29,30,31,33,34,36,37,38,40,41,43,44,45,47,48,50,51,52,54,55,57,58,59,61,62,64,65,66,68,69,71,72,73,75,76,78,79,80,82,83,85,86,87,89,90,92,93,94,96,97,99,100,101,103,104,106,107,108,110,111,113,114,115,117,118,120,121,122,124,125,127,128,129,131,132,134,135,136,138,139,141,142,143,145,146,148,149,150,152,153,154],[1,14,16,17,18,20,21,22,23,25,26,27,29,30,31,32,34,35,36,37,39,40,41,43,44,45,46,48,49,50,51,53,54,55,57,58,59,60,62,63,64,66,67,68,69,71,72,73,74,76,77,78,80,81,82,83,85,86,87,88,90,91,92,94,95,96,97,99,100,101,103,104,105,106,108,109,110,111,113,114,115,117,118,119,120,122,123,124,125,127,128,129,131,132,133,134,136,137,138,139],[1,15,17,18,20,21,23,24,26,27,29,30,32,33,35,36,38,39,40,42,43,45,46,48,49,51,52,54,55,57,58,60,61,63,64,65,67,68,70,71,73,74,76,77,79,80,82,83,85,86,87,89,90,92,93,95,96,98,99,101,102,104,105,107,108,110,111,112,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,136,137,139,140,142,143,145,146,148,149,151,152,154,155,157,158,159],[1,16,18,19,21,22,24,25,26,28,29,31,32,34,35,36,38,39,41,42,44,45,46,48,49,51,52,54,55,56,58,59,61,62,64,65,66,68,69,71,72,74,75,76,78,79,81,82,84,85,86,88,89,91,92,94,95,96,98,99,101,102,104,105,106,108,109,111,112,114,115,116,118,119,121,122,124,125,126,128,129,131,132,134,135,136,138,139,141,142,144,145,146,148,149,151,152,154,155,156],[1,33,37,40,44,47,50,54,57,61,64,67,71,74,78,81,84,88,91,94,98,101,105,108,111,115,118,122,125,128,132,135,139,142,145,149,152,155,159,162,166,169,172,176,179,183,186,189,193,196,199,203,206,210,213,216,220,223,227,230,233,237,240,244,247,250,254,257,260,264,267,271,274,277,281,284,288,291,294,298,301,305,308,311,315,318,321,325,328,332,335,338,342,345,349,352,355,359,362,365],[1,31,35,39,43,46,50,54,58,61,65,69,73,76,80,84,88,91,95,99,103,106,110,114,118,121,125,129,133,136,140,144,148,151,155,159,163,166,170,174,178,181,185,189,193,196,200,204,208,211,215,219,222,226,230,234,237,241,245,249,252,256,260,264,267,271,275,279,282,286,290,294,297,301,305,309,312,316,320,324,327,331,335,339,342,346,350,354,357,361,365,369,372,376,380,384,387,391,395,398]]}, +{"id":8,"expParams":[30,20,30,30],"traits":[{"code":23,"dataId":0,"value":1},{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":22,"dataId":2,"value":0.04},{"code":41,"dataId":2,"value":0},{"code":51,"dataId":1,"value":0},{"code":52,"dataId":1,"value":0},{"code":52,"dataId":3,"value":0},{"code":55,"dataId":1,"value":1}],"learnings":[{"level":1,"note":"","skillId":206},{"level":3,"note":"","skillId":207},{"level":3,"note":"","skillId":208},{"level":5,"note":"","skillId":174},{"level":8,"note":"","skillId":209},{"level":10,"note":"","skillId":211},{"level":15,"note":"","skillId":210}],"name":"Bandit","note":"","params":[[1,379,428,476,524,572,620,668,716,764,812,860,909,957,1005,1053,1101,1149,1197,1245,1293,1341,1389,1438,1486,1534,1582,1630,1678,1726,1774,1822,1870,1918,1967,2015,2063,2111,2159,2207,2255,2303,2351,2399,2447,2496,2544,2592,2640,2688,2736,2784,2832,2880,2928,2976,3025,3073,3121,3169,3217,3265,3313,3361,3409,3457,3505,3554,3602,3650,3698,3746,3794,3842,3890,3938,3986,4034,4083,4131,4179,4227,4275,4323,4371,4419,4467,4515,4563,4612,4660,4708,4756,4804,4852,4900,4948,4996,5044,5092],[0,61,72,83,94,105,115,126,137,148,158,169,180,191,202,212,223,234,245,255,266,277,288,299,309,320,331,342,352,363,374,385,396,406,417,428,439,449,460,471,482,493,503,514,525,536,546,557,568,579,589,600,611,622,633,643,654,665,676,686,697,708,719,730,740,751,762,773,783,794,805,816,827,837,848,859,870,880,891,902,913,924,934,945,956,967,977,988,999,1010,1021,1031,1042,1053,1064,1074,1085,1096,1107,1117],[1,14,16,17,19,20,21,23,24,25,27,28,30,31,32,34,35,36,38,39,40,42,43,45,46,47,49,50,51,53,54,56,57,58,60,61,62,64,65,66,68,69,71,72,73,75,76,77,79,80,81,83,84,86,87,88,90,91,92,94,95,97,98,99,101,102,103,105,106,107,109,110,112,113,114,116,117,118,120,121,123,124,125,127,128,129,131,132,133,135,136,138,139,140,142,143,144,146,147,148],[1,15,17,18,19,20,21,22,24,25,26,27,28,29,30,32,33,34,35,36,37,39,40,41,42,43,44,45,47,48,49,50,51,52,54,55,56,57,58,59,60,62,63,64,65,66,67,69,70,71,72,73,74,75,77,78,79,80,81,82,84,85,86,87,88,89,90,92,93,94,95,96,97,99,100,101,102,103,104,105,107,108,109,110,111,112,114,115,116,117,118,119,120,122,123,124,125,126,127,128],[1,13,15,16,18,19,20,22,23,24,26,27,28,30,31,32,34,35,36,38,39,40,42,43,44,46,47,49,50,51,53,54,55,57,58,59,61,62,63,65,66,67,69,70,71,73,74,75,77,78,79,81,82,84,85,86,88,89,90,92,93,94,96,97,98,100,101,102,104,105,106,108,109,110,112,113,115,116,117,119,120,121,123,124,125,127,128,129,131,132,133,135,136,137,139,140,141,143,144,145],[1,16,18,19,21,22,24,25,27,28,30,31,33,34,36,37,39,40,42,43,45,46,48,49,51,52,54,55,57,58,60,61,63,64,66,67,69,70,72,73,75,76,78,79,81,82,84,85,87,88,90,91,93,94,96,97,99,100,102,103,105,106,108,109,111,112,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,136,138,139,141,142,144,145,147,148,150,151,153,154,156,157,159,160,162,163],[1,37,42,46,50,54,58,63,67,71,75,79,84,88,92,96,100,105,109,113,117,121,126,130,134,138,142,147,151,155,159,163,168,172,176,180,184,188,193,197,201,205,209,214,218,222,226,230,235,239,243,247,251,256,260,264,268,272,277,281,285,289,293,298,302,306,310,314,318,323,327,331,335,339,344,348,352,356,360,365,369,373,377,381,386,390,394,398,402,407,411,415,419,423,428,432,436,440,444,448],[1,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135,138,142,146,150,154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,233,237,241,245,249,253,257,261,265,269,273,277,281,285,289,293,297,301,305,309,313,317,321,325,329,332,336,340,344,348,352,356,360,364,368,372,376,380,384,388,392,396,400,404,408,412,416,420,424,427]]} +] \ No newline at end of file diff --git a/data/CommonEvents.json b/data/CommonEvents.json new file mode 100644 index 0000000..2bc9c27 --- /dev/null +++ b/data/CommonEvents.json @@ -0,0 +1,7 @@ +[ +null, +{"id":1,"list":[{"code":0,"indent":0,"parameters":[]}],"name":"","switchId":1,"trigger":0}, +{"id":2,"list":[{"code":0,"indent":0,"parameters":[]}],"name":"","switchId":1,"trigger":0}, +{"id":3,"list":[{"code":0,"indent":0,"parameters":[]}],"name":"","switchId":1,"trigger":0}, +{"id":4,"list":[{"code":0,"indent":0,"parameters":[]}],"name":"","switchId":1,"trigger":0} +] \ No newline at end of file diff --git a/data/Enemies.json b/data/Enemies.json new file mode 100644 index 0000000..4a0e1c6 --- /dev/null +++ b/data/Enemies.json @@ -0,0 +1,8 @@ +[ +null, +{"id":1,"actions":[{"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":1},{"skillId":20,"rating":5,"conditionType":0,"conditionParam1":0,"conditionParam2":0}],"battlerHue":0,"battlerName":"Goblin","dropItems":[{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0}],"exp":10,"traits":[{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":31,"dataId":1,"value":0}],"gold":5,"name":"Goblin","note":"","params":[200,0,25,20,20,20,20,20]}, +{"id":2,"actions":[{"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":1},{"skillId":23,"rating":3,"conditionType":1,"conditionParam1":0,"conditionParam2":2}],"battlerHue":0,"battlerName":"Gnome","dropItems":[{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0}],"exp":10,"traits":[{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":31,"dataId":1,"value":0}],"gold":8,"name":"Gnome","note":"","params":[250,0,20,25,20,20,20,20]}, +{"id":3,"actions":[{"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":1}],"battlerHue":0,"battlerName":"Crow","dropItems":[{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0}],"exp":15,"traits":[{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.1},{"code":31,"dataId":1,"value":0}],"gold":8,"name":"Crow","note":"","params":[250,50,25,20,20,20,25,20]}, +{"id":4,"actions":[{"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":1},{"skillId":52,"rating":4,"conditionType":2,"conditionParam1":0,"conditionParam2":0.3}],"battlerHue":0,"battlerName":"Treant","dropItems":[{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0}],"exp":30,"traits":[{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":31,"dataId":1,"value":0},{"code":11,"dataId":2,"value":2}],"gold":15,"name":"Treant","note":"","params":[500,50,30,20,30,30,30,30]}, +{"id":5,"actions":[{"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":1},{"skillId":99,"rating":4,"conditionType":1,"conditionParam1":0,"conditionParam2":2},{"skillId":13,"rating":6,"conditionType":2,"conditionParam1":0,"conditionParam2":0.3}],"battlerHue":0,"battlerName":"Hi_monster","dropItems":[{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0}],"exp":100,"traits":[{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":31,"dataId":1,"value":0},{"code":63,"dataId":1,"value":1}],"gold":50,"name":"Hi_monster","note":"","params":[1000,50,40,20,40,40,40,40]} +] \ No newline at end of file diff --git a/data/Items.json b/data/Items.json new file mode 100644 index 0000000..05cd004 --- /dev/null +++ b/data/Items.json @@ -0,0 +1,33 @@ +[ +null, +{"id":1,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Below are spaces for when you would like to display\nitems above the recovery items.","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"-----Reserved","note":"","occasion":3,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":2,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":3,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":4,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":5,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":6,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"-----Recovery Items","note":"","occasion":3,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":7,"animationId":41,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Restores HP by 500 points.","effects":[{"code":11,"dataId":0,"value1":0,"value2":500}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Potion","note":"","occasion":0,"price":100,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":8,"animationId":41,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Restores HP by 1500 points.","effects":[{"code":11,"dataId":0,"value1":0,"value2":1500}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Super Potion","note":"","occasion":0,"price":250,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":9,"animationId":41,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Completely restores HP.","effects":[{"code":11,"dataId":0,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Full Potion","note":"","occasion":0,"price":550,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":10,"animationId":41,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Restores MP by 300 points.","effects":[{"code":12,"dataId":0,"value1":0,"value2":300}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Magic Water","note":"","occasion":0,"price":300,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":11,"animationId":49,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"b.mhp / 2","type":3,"variance":20},"description":"Raises the subject from the dead. (Restores HP by half.)","effects":[{"code":22,"dataId":1,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Stimulant","note":"","occasion":0,"price":500,"repeats":1,"scope":9,"speed":0,"successRate":100,"tpGain":0}, +{"id":12,"animationId":46,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Removes all status ailments.\nCannot revive a someone from being dead.","effects":[{"code":22,"dataId":4,"value1":1,"value2":0},{"code":22,"dataId":5,"value1":1,"value2":0},{"code":22,"dataId":6,"value1":1,"value2":0},{"code":22,"dataId":7,"value1":1,"value2":0},{"code":22,"dataId":8,"value1":1,"value2":0},{"code":22,"dataId":9,"value1":1,"value2":0},{"code":22,"dataId":10,"value1":1,"value2":0},{"code":22,"dataId":13,"value1":1,"value2":0},{"code":22,"dataId":12,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Dispel Herb","note":"","occasion":0,"price":200,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":13,"animationId":45,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Cures Poison or Paralysis states.","effects":[{"code":22,"dataId":4,"value1":1,"value2":0},{"code":22,"dataId":12,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Antidote","note":"","occasion":0,"price":80,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":14,"animationId":41,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Restores HP and MP by half.","effects":[{"code":11,"dataId":0,"value1":0.5,"value2":0},{"code":12,"dataId":0,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Miracle Drop","note":"","occasion":0,"price":450,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":15,"animationId":41,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Completely restores HP and MP.","effects":[{"code":11,"dataId":0,"value1":1,"value2":0},{"code":12,"dataId":0,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Elixir","note":"","occasion":0,"price":1200,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":16,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":17,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"-----Specialty Items","note":"","occasion":3,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":18,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Halves the number of enemies you will encounter\nfor a while.","effects":[{"code":21,"dataId":29,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Encounter Decreaser","note":"","occasion":2,"price":100,"repeats":1,"scope":11,"speed":0,"successRate":100,"tpGain":0}, +{"id":19,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases items and money gained from battle for\na while.","effects":[{"code":21,"dataId":30,"value1":1,"value2":0}],"hitType":0,"iconIndex":176,"itypeId":1,"name":"Drop Increaser","note":"","occasion":0,"price":300,"repeats":1,"scope":11,"speed":0,"successRate":100,"tpGain":0}, +{"id":20,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":21,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"","note":"","occasion":0,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":22,"animationId":0,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"itypeId":1,"name":"-----Enhancement Items","note":"","occasion":3,"price":0,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":23,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases max HP by 50 points.","effects":[{"code":42,"dataId":0,"value1":50,"value2":0}],"hitType":0,"iconIndex":32,"itypeId":1,"name":"HP Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":24,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases max MP by 10 points.","effects":[{"code":42,"dataId":1,"value1":10,"value2":0}],"hitType":0,"iconIndex":33,"itypeId":1,"name":"MP Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":25,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases Attack by 3 points.","effects":[{"code":42,"dataId":2,"value1":3,"value2":0}],"hitType":0,"iconIndex":34,"itypeId":1,"name":"Attack Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":26,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases Defense by 3 points.","effects":[{"code":42,"dataId":3,"value1":3,"value2":0}],"hitType":0,"iconIndex":35,"itypeId":1,"name":"Defense Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":27,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases M.Attack by 3 points.","effects":[{"code":42,"dataId":4,"value1":3,"value2":0}],"hitType":0,"iconIndex":36,"itypeId":1,"name":"Magic Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":28,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases M.Defense by 3 points.","effects":[{"code":42,"dataId":5,"value1":3,"value2":0}],"hitType":0,"iconIndex":37,"itypeId":1,"name":"Resistance Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":29,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases Agility by 3 points.","effects":[{"code":42,"dataId":6,"value1":3,"value2":0}],"hitType":0,"iconIndex":38,"itypeId":1,"name":"Agility Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0}, +{"id":30,"animationId":51,"consumable":true,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases Luck by 3 points.","effects":[{"code":42,"dataId":7,"value1":3,"value2":0}],"hitType":0,"iconIndex":39,"itypeId":1,"name":"Luck Increase","note":"","occasion":2,"price":3000,"repeats":1,"scope":7,"speed":0,"successRate":100,"tpGain":0} +] \ No newline at end of file diff --git a/data/MapInfos.json b/data/MapInfos.json new file mode 100644 index 0000000..c5a786d --- /dev/null +++ b/data/MapInfos.json @@ -0,0 +1,3 @@ +[ +null +] \ No newline at end of file diff --git a/data/Skills.json b/data/Skills.json new file mode 100644 index 0000000..ce335cc --- /dev/null +++ b/data/Skills.json @@ -0,0 +1,238 @@ +[ +null, +{"id":1,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 attacks!","message2":"","mpCost":0,"name":"Attack","note":"Skill #1 corresponds to the Attack command.","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":0,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":2,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[{"code":21,"dataId":2,"value1":1,"value2":0}],"hitType":0,"iconIndex":81,"message1":"%1 guards.","message2":"","mpCost":0,"name":"Guard","note":"Skill #2 corresponds to the Guard command.","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":2000,"stypeId":0,"successRate":100,"tpCost":0,"tpGain":10,"messageType":1}, +{"id":3,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Below are spaces for when you would like to display\nthings above skills when you open the menu.","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Reserved","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":4,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":5,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":6,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":7,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":8,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":9,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":10,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":11,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Enemy","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":12,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Performs a series of attacks on an enemy.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 attacks!","message2":"","mpCost":0,"name":"Dual Attack","note":"","occasion":1,"repeats":2,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":13,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Performs a double attack on a random enemy.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 attacks!","message2":"","mpCost":0,"name":"Double Attack","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":4,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":14,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Performs a triple attack on a random enemy.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 attacks!","message2":"","mpCost":0,"name":"Triple Attack","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":5,"speed":0,"stypeId":2,"successRate":100,"tpCost":15,"tpGain":0,"messageType":1}, +{"id":15,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"The user flees from battle.","effects":[{"code":41,"dataId":0,"value1":0,"value2":0}],"hitType":0,"iconIndex":82,"message1":"%1 flees.","message2":"","mpCost":0,"name":"Escape","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":16,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Waits to see what happens.","effects":[],"hitType":0,"iconIndex":81,"message1":"%1 is waiting to see what happens.","message2":"","mpCost":0,"name":"Wait and See","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":0,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":10,"messageType":1}, +{"id":17,"animationId":58,"damage":{"critical":false,"elementId":0,"formula":"a.atk * 2 - b.def","type":5,"variance":20},"description":"Absorbs HP from an enemy.","effects":[],"hitType":1,"iconIndex":5,"message1":"%1 sucks blood!","message2":"","mpCost":0,"name":"Blood Suck","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":18,"animationId":41,"damage":{"critical":false,"elementId":0,"formula":"b.mhp / 4","type":3,"variance":20},"description":"Restores the user’s HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 meditates!","message2":"","mpCost":0,"name":"Meditate","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":19,"animationId":15,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":1,"variance":20},"description":"Stabs an enemy with paralyzing needles.","effects":[{"code":21,"dataId":12,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":9,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Tranquilizer","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":20,"animationId":39,"damage":{"critical":false,"elementId":0,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Inflicts damage and causes an enemy to lose balance.","effects":[{"code":21,"dataId":13,"value1":0.5,"value2":0}],"hitType":1,"iconIndex":78,"message1":"%1 does bodyslam!","message2":"","mpCost":0,"name":"Bodyslam","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":21,"animationId":77,"damage":{"critical":true,"elementId":4,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage and Paralysis state.","effects":[{"code":21,"dataId":12,"value1":0.3,"value2":0}],"hitType":0,"iconIndex":66,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Shock","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":22,"animationId":54,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Covers an enemy in slime and lowers their Agility.","effects":[{"code":32,"dataId":6,"value1":5,"value2":0}],"hitType":0,"iconIndex":9,"message1":"%1 shoots out slime!","message2":"","mpCost":0,"name":"Slime","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":23,"animationId":59,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Sprays an enemy with venom and inflicts Poison state.","effects":[{"code":21,"dataId":4,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":2,"message1":"%1 uses %2!","message2":"","mpCost":0,"name":"Venom","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":24,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Rouses the user’s fighting spirit and fortifies\ntheir abilities.","effects":[{"code":31,"dataId":2,"value1":5,"value2":0},{"code":31,"dataId":3,"value1":5,"value2":0},{"code":31,"dataId":5,"value1":5,"value2":0},{"code":31,"dataId":4,"value1":5,"value2":0},{"code":31,"dataId":6,"value1":5,"value2":0}],"hitType":0,"iconIndex":70,"message1":"%1 rouses their fighting spirit!","message2":"","mpCost":0,"name":"Shout","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":25,"animationId":58,"damage":{"critical":false,"elementId":0,"formula":"5 + a.mat * 0.2","type":6,"variance":5},"description":"Absorbs MP from an enemy.","effects":[],"hitType":1,"iconIndex":80,"message1":"%1 dances bizarrely!","message2":"","mpCost":0,"name":"Bizarre Dance","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":26,"animationId":64,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Glares at an enemy and paralyzes them.","effects":[{"code":21,"dataId":12,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":9,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Petrify","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":27,"animationId":11,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Blinds an enemy.","effects":[{"code":21,"dataId":5,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":3,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Eye Poke","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":28,"animationId":94,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Blinds all enemies.","effects":[{"code":21,"dataId":5,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":3,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Sandstorm","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":29,"animationId":40,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Blinds all enemies.","effects":[{"code":21,"dataId":5,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":3,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Flash","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":30,"animationId":35,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Poisons all enemies.","effects":[{"code":21,"dataId":4,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":2,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Toxic Fog","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":31,"animationId":36,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Puts all enemies to sleep.","effects":[{"code":21,"dataId":10,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":80,"message1":"%1 sings a Lullaby!","message2":"","mpCost":0,"name":"Lullaby","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":32,"animationId":36,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Charms all enemies.","effects":[{"code":21,"dataId":9,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":80,"message1":"%1 sings an Alluring Melody!","message2":"","mpCost":0,"name":"Alluring Melody","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":33,"animationId":36,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Seals all enemies’ magic.","effects":[{"code":21,"dataId":6,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":80,"message1":"%1 sings a Song of Silence!","message2":"","mpCost":0,"name":"Song of Silence","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":34,"animationId":34,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Confuses all enemies.","effects":[{"code":21,"dataId":8,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":6,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Sonic Wave","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":35,"animationId":87,"damage":{"critical":true,"elementId":6,"formula":"30 + a.atk","type":1,"variance":20},"description":"Inflicts Earth-type damage on all enemies.","effects":[],"hitType":1,"iconIndex":68,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Stone Throw","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":36,"animationId":93,"damage":{"critical":true,"elementId":7,"formula":"50 + a.atk * 2","type":1,"variance":20},"description":"Inflicts Wind-type damage on all enemies.","effects":[],"hitType":1,"iconIndex":69,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Dust Devil","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":37,"animationId":68,"damage":{"critical":true,"elementId":2,"formula":"30 + a.atk * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on all enemies.","effects":[],"hitType":0,"iconIndex":64,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Fire Breath","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":38,"animationId":74,"damage":{"critical":true,"elementId":3,"formula":"30 + a.atk * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on all enemies.","effects":[],"hitType":0,"iconIndex":65,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Ice Breath","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":39,"animationId":89,"damage":{"critical":true,"elementId":6,"formula":"100 + a.atk","type":1,"variance":20},"description":"Inflicts Earth-type damage on all enemies.","effects":[],"hitType":0,"iconIndex":68,"message1":"%1 causes an Earthquake!","message2":"","mpCost":0,"name":"Earthquake","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":40,"animationId":85,"damage":{"critical":true,"elementId":5,"formula":"100 + a.atk","type":1,"variance":20},"description":"Inflicts Water-type damage on all enemies.","effects":[],"hitType":0,"iconIndex":67,"message1":"%1 causes a Tsunami!","message2":"","mpCost":0,"name":"Tsunami","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":41,"animationId":16,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Inflicts damage on an enemy.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 attacks!","message2":"","mpCost":0,"name":"Scratch","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":42,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":43,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":44,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":45,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":46,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":47,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":48,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":49,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":50,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":51,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Basic Magic","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":52,"animationId":41,"damage":{"critical":false,"elementId":0,"formula":"500 + a.mat","type":3,"variance":20},"description":"Restores an ally’s HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":12,"name":"Heal I","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":53,"animationId":41,"damage":{"critical":false,"elementId":0,"formula":"1000 + a.mat","type":3,"variance":20},"description":"Restores an ally’s HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Heal II","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":54,"animationId":42,"damage":{"critical":false,"elementId":0,"formula":"2000 + a.mat","type":3,"variance":20},"description":"Restores an ally’s HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":34,"name":"Heal III","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":55,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":56,"animationId":43,"damage":{"critical":false,"elementId":0,"formula":"300 + a.mat","type":3,"variance":20},"description":"Restores all allies’ HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":25,"name":"Recover I","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":57,"animationId":43,"damage":{"critical":false,"elementId":0,"formula":"700 + a.mat","type":3,"variance":20},"description":"Restores all allies’ HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Recover II","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":58,"animationId":44,"damage":{"critical":false,"elementId":0,"formula":"1200 + a.mat","type":3,"variance":20},"description":"Restores all allies’ HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Recover III","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":59,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":60,"animationId":45,"damage":{"critical":false,"elementId":0,"formula":"200 + a.mat","type":0,"variance":20},"description":"Cures an ally’s Poison, Paralysis, or Sleep state.","effects":[{"code":22,"dataId":4,"value1":1,"value2":0},{"code":22,"dataId":10,"value1":1,"value2":0},{"code":22,"dataId":12,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":10,"name":"Cure I","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":61,"animationId":46,"damage":{"critical":false,"elementId":0,"formula":"200 + a.mat","type":0,"variance":20},"description":"Cures an ally’s status ailments other than Dead.","effects":[{"code":22,"dataId":4,"value1":1,"value2":0},{"code":22,"dataId":5,"value1":1,"value2":0},{"code":22,"dataId":6,"value1":1,"value2":0},{"code":22,"dataId":7,"value1":1,"value2":0},{"code":22,"dataId":8,"value1":1,"value2":0},{"code":22,"dataId":9,"value1":1,"value2":0},{"code":22,"dataId":10,"value1":1,"value2":0},{"code":22,"dataId":12,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Cure II","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":62,"animationId":47,"damage":{"critical":false,"elementId":0,"formula":"200 + a.mat","type":0,"variance":20},"description":"Cures all allies’ status ailments other than Dead.","effects":[{"code":22,"dataId":4,"value1":1,"value2":0},{"code":22,"dataId":5,"value1":1,"value2":0},{"code":22,"dataId":6,"value1":1,"value2":0},{"code":22,"dataId":7,"value1":1,"value2":0},{"code":22,"dataId":8,"value1":1,"value2":0},{"code":22,"dataId":9,"value1":1,"value2":0},{"code":22,"dataId":10,"value1":1,"value2":0},{"code":22,"dataId":12,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":45,"name":"Cure III","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":63,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":64,"animationId":49,"damage":{"critical":false,"elementId":0,"formula":"b.mhp / 10","type":3,"variance":20},"description":"Raises an ally from the dead.","effects":[{"code":22,"dataId":1,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Raise I","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":9,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":10,"messageType":1}, +{"id":65,"animationId":50,"damage":{"critical":false,"elementId":0,"formula":"b.mhp / 2","type":3,"variance":20},"description":"Raises an ally from the dead and greatly restores\ntheir HP.","effects":[{"code":22,"dataId":1,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":150,"name":"Raise II","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":9,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":10,"messageType":1}, +{"id":66,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":67,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":68,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":69,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":70,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":71,"animationId":59,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Poisons all enemies.","effects":[{"code":21,"dataId":4,"value1":0.5,"value2":0}],"hitType":2,"iconIndex":2,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Poison","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":72,"animationId":60,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Blinds all enemies.","effects":[{"code":21,"dataId":5,"value1":0.5,"value2":0}],"hitType":2,"iconIndex":3,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Blind","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":73,"animationId":34,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Confuses all enemies.","effects":[{"code":21,"dataId":8,"value1":0.5,"value2":0}],"hitType":2,"iconIndex":6,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Confuse","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":74,"animationId":61,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Seals all enemies’ magic.","effects":[{"code":21,"dataId":6,"value1":0.5,"value2":0}],"hitType":2,"iconIndex":4,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Silence","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":75,"animationId":62,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Puts all enemies to sleep.","effects":[{"code":21,"dataId":10,"value1":0.5,"value2":0}],"hitType":2,"iconIndex":8,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Sleep","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":76,"animationId":64,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Paralyzes all enemies.","effects":[{"code":21,"dataId":12,"value1":0.4,"value2":0}],"hitType":2,"iconIndex":9,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Paralyze","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":77,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":78,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":79,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":80,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":81,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases an ally’s Attack.\nUsable up to 2 times in a row.","effects":[{"code":31,"dataId":2,"value1":5,"value2":0}],"hitType":0,"iconIndex":34,"message1":"%1 casts %2!","message2":"","mpCost":12,"name":"Weapon Bless","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":82,"animationId":54,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Decreases all enemies’ Attack.\nUsable up to 2 times in a row.","effects":[{"code":32,"dataId":2,"value1":5,"value2":0}],"hitType":2,"iconIndex":50,"message1":"%1 casts %2!","message2":"","mpCost":8,"name":"Weapon Curse","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":83,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases an ally’s Defense.\nUsable up to 2 times in a row.","effects":[{"code":31,"dataId":3,"value1":5,"value2":0}],"hitType":0,"iconIndex":35,"message1":"%1 casts %2!","message2":"","mpCost":12,"name":"Armor Bless","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":84,"animationId":54,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Decreases all enemies’ Defense.\nUsable up to 2 times in a row.","effects":[{"code":32,"dataId":3,"value1":5,"value2":0}],"hitType":2,"iconIndex":51,"message1":"%1 casts %2!","message2":"","mpCost":8,"name":"Armor Curse","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":85,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases an ally’s M.Attack.\nUsable up to 2 times in a row.","effects":[{"code":31,"dataId":4,"value1":5,"value2":0}],"hitType":0,"iconIndex":36,"message1":"%1 casts %2!","message2":"","mpCost":12,"name":"Spirit Bless","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":86,"animationId":54,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Decreases all enemies’ M.Attack.\nUsable up to 2 times in a row.","effects":[{"code":32,"dataId":4,"value1":5,"value2":0}],"hitType":2,"iconIndex":52,"message1":"%1 casts %2!","message2":"","mpCost":8,"name":"Spirit Curse","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":87,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases an ally’s M.Defense.\nUsable up to 2 times in a row.","effects":[{"code":31,"dataId":5,"value1":5,"value2":0}],"hitType":0,"iconIndex":37,"message1":"%1 casts %2!","message2":"","mpCost":12,"name":"Divine Bless","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":88,"animationId":54,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Decreases all enemies’ M.Defense.\nUsable up to 2 times in a row.","effects":[{"code":32,"dataId":5,"value1":5,"value2":0}],"hitType":2,"iconIndex":53,"message1":"%1 casts %2!","message2":"","mpCost":8,"name":"Divine Curse","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":89,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases an ally’s Agility.\nUsable up to 2 times in a row.","effects":[{"code":31,"dataId":6,"value1":5,"value2":0}],"hitType":0,"iconIndex":38,"message1":"%1 casts %2!","message2":"","mpCost":12,"name":"Quicken Movement","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":90,"animationId":54,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Decreases all enemies’ Agility.\nUsable up to 2 times in a row.","effects":[{"code":32,"dataId":6,"value1":5,"value2":0}],"hitType":2,"iconIndex":54,"message1":"%1 casts %2!","message2":"","mpCost":8,"name":"Slow Movement","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":91,"animationId":58,"damage":{"critical":false,"elementId":0,"formula":"200 + a.mat * 4 - b.mdf * 2","type":5,"variance":20},"description":"Absorbs HP from an enemy.","effects":[],"hitType":2,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":10,"name":"Life Drain","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":92,"animationId":58,"damage":{"critical":false,"elementId":0,"formula":"10 + a.mat - b.mdf * 0.5","type":6,"variance":20},"description":"Absorbs MP from an enemy.","effects":[],"hitType":2,"iconIndex":72,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Mana Drain","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":10,"tpGain":5,"messageType":1}, +{"id":93,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":94,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":95,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":96,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":97,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":98,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":99,"animationId":66,"damage":{"critical":false,"elementId":2,"formula":"100 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Fire I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":100,"animationId":66,"damage":{"critical":false,"elementId":2,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":30,"name":"Fire II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":101,"animationId":67,"damage":{"critical":false,"elementId":2,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Fire III","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":102,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":103,"animationId":68,"damage":{"critical":false,"elementId":2,"formula":"100 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":30,"name":"Flame I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":104,"animationId":69,"damage":{"critical":false,"elementId":2,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Flame II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":105,"animationId":70,"damage":{"critical":false,"elementId":2,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Fire-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":90,"name":"Flame III","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":106,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":107,"animationId":71,"damage":{"critical":false,"elementId":3,"formula":"100 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Ice I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":108,"animationId":71,"damage":{"critical":false,"elementId":3,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":30,"name":"Ice II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":109,"animationId":72,"damage":{"critical":false,"elementId":3,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Ice III","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":110,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":111,"animationId":73,"damage":{"critical":false,"elementId":3,"formula":"100 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":30,"name":"Blizzard I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":112,"animationId":74,"damage":{"critical":false,"elementId":3,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Blizzard II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":113,"animationId":75,"damage":{"critical":false,"elementId":3,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Ice-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":90,"name":"Blizzard III","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":114,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":115,"animationId":76,"damage":{"critical":false,"elementId":4,"formula":"100 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":15,"name":"Thunder I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":116,"animationId":76,"damage":{"critical":false,"elementId":4,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":30,"name":"Thunder II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":117,"animationId":77,"damage":{"critical":false,"elementId":4,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Thunder III","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":118,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":119,"animationId":78,"damage":{"critical":false,"elementId":4,"formula":"100 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":30,"name":"Spark I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":120,"animationId":79,"damage":{"critical":false,"elementId":4,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Spark II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":121,"animationId":80,"damage":{"critical":false,"elementId":4,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Thunder-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":90,"name":"Spark III","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":122,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":123,"animationId":81,"damage":{"critical":false,"elementId":5,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Water-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":67,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Water I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":124,"animationId":82,"damage":{"critical":false,"elementId":5,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Water-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":67,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Water II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":125,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":126,"animationId":83,"damage":{"critical":false,"elementId":5,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Water-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":67,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Wave I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":127,"animationId":85,"damage":{"critical":false,"elementId":5,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Water-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":67,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Wave II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":128,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":129,"animationId":86,"damage":{"critical":false,"elementId":6,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Earth-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":68,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Stone I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":130,"animationId":87,"damage":{"critical":false,"elementId":6,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Earth-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":68,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Stone II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":131,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":132,"animationId":88,"damage":{"critical":false,"elementId":6,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Earth-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":68,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Quake I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":133,"animationId":90,"damage":{"critical":false,"elementId":6,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Earth-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":68,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Quake II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":134,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":135,"animationId":91,"damage":{"critical":false,"elementId":7,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Wind-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":69,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Wind I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":136,"animationId":92,"damage":{"critical":false,"elementId":7,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Wind-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":69,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Wind II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":137,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":138,"animationId":93,"damage":{"critical":false,"elementId":7,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Wind-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":69,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Tornado I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":139,"animationId":95,"damage":{"critical":false,"elementId":7,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Wind-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":69,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Tornado II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":140,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":141,"animationId":96,"damage":{"critical":false,"elementId":8,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Light-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":70,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Saint I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":142,"animationId":97,"damage":{"critical":false,"elementId":8,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Light-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":70,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Saint II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":143,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":144,"animationId":98,"damage":{"critical":false,"elementId":8,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Light-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":70,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Starlight I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":145,"animationId":99,"damage":{"critical":false,"elementId":8,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Light-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":70,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Starlight II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":146,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":147,"animationId":101,"damage":{"critical":false,"elementId":9,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Darkness-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":71,"message1":"%1 casts %2!","message2":"","mpCost":20,"name":"Shade I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":148,"animationId":102,"damage":{"critical":false,"elementId":9,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Darkness-type damage on an enemy.","effects":[],"hitType":2,"iconIndex":71,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Shade II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":149,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":150,"animationId":103,"damage":{"critical":false,"elementId":9,"formula":"300 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Darkness-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":71,"message1":"%1 casts %2!","message2":"","mpCost":40,"name":"Darkness I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":151,"animationId":105,"damage":{"critical":false,"elementId":9,"formula":"500 + a.mat * 2 - b.mdf * 2","type":1,"variance":20},"description":"Inflicts Darkness-type damage on all enemies.","effects":[],"hitType":2,"iconIndex":71,"message1":"%1 casts %2!","message2":"","mpCost":80,"name":"Darkness II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":152,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":153,"animationId":106,"damage":{"critical":false,"elementId":0,"formula":"300 + a.mat * 2","type":1,"variance":20},"description":"Inflicts damage on an enemy regardless of Defense.","effects":[],"hitType":2,"iconIndex":78,"message1":"%1 casts %2!","message2":"","mpCost":25,"name":"Burst I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-3,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":154,"animationId":107,"damage":{"critical":false,"elementId":0,"formula":"500 + a.mat * 2","type":1,"variance":20},"description":"Inflicts damage on an enemy regardless of Defense.","effects":[],"hitType":2,"iconIndex":78,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Burst II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":155,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":156,"animationId":108,"damage":{"critical":false,"elementId":0,"formula":"300 + a.mat * 2","type":1,"variance":20},"description":"Inflicts damage on all enemies regardless of Defense.","effects":[],"hitType":2,"iconIndex":78,"message1":"%1 casts %2!","message2":"","mpCost":50,"name":"Nuke I","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-6,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":157,"animationId":110,"damage":{"critical":false,"elementId":0,"formula":"500 + a.mat * 2","type":1,"variance":20},"description":"Inflicts damage on all enemies regardless of Defense.","effects":[],"hitType":2,"iconIndex":78,"message1":"%1 casts %2!","message2":"","mpCost":100,"name":"Nuke II","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":-10,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":158,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":159,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":160,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":161,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":162,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":163,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":164,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":165,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":166,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":167,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":168,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":169,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":170,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":171,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Swordsman Skills","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":172,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 5 - b.def * 2","type":1,"variance":20},"description":"Performs a powerful attack on an enemy.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":77,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Strong Attack","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":10,"tpGain":0,"messageType":1}, +{"id":173,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"30 + a.atk","type":1,"variance":20},"description":"Attacks all enemies.","effects":[],"hitType":1,"iconIndex":76,"message1":"%1 mows down the enemy!","message2":"","mpCost":0,"name":"Slash","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":20,"tpGain":0,"messageType":1}, +{"id":174,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Performs an attack on an enemy twice.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 dual attacks!","message2":"","mpCost":0,"name":"Dual Attack","note":"","occasion":1,"repeats":2,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":175,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Rouses the user’s fighting spirit and increases\nAttack. Usable up to 2 times in a row.","effects":[{"code":31,"dataId":2,"value1":5,"value2":0}],"hitType":0,"iconIndex":34,"message1":"%1 uses %2!","message2":"","mpCost":15,"name":"Willpower","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":10,"messageType":1}, +{"id":176,"animationId":41,"damage":{"critical":false,"elementId":0,"formula":"300 + a.mat","type":3,"variance":20},"description":"Restores an ally’s HP.","effects":[],"hitType":0,"iconIndex":72,"message1":"%1 performs %2!","message2":"","mpCost":6,"name":"First Aid","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":177,"animationId":25,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 8 - b.def * 3","type":1,"variance":20},"description":"Performs a super powerful attack on an enemy.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":77,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Maiden’s Stance","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":50,"tpGain":0,"messageType":1}, +{"id":178,"animationId":6,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 5 - b.def * 2","type":1,"variance":20},"description":"Performs a powerful attack on all enemies.","effects":[],"hitType":1,"iconIndex":76,"message1":"%1 mows down the enemy!","message2":"","mpCost":0,"name":"Spin Crash","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":100,"tpGain":0,"messageType":1}, +{"id":179,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":180,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":181,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":182,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":183,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":184,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":185,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Priest & Sorcerer Skills","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":186,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases all allies’ Defense and M.Defense.\nUsable up to 2 times in a row.","effects":[{"code":31,"dataId":3,"value1":5,"value2":0},{"code":31,"dataId":5,"value1":5,"value2":0}],"hitType":0,"iconIndex":70,"message1":"%1 offered a prayer!","message2":"","mpCost":0,"name":"Magic Barrier","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":1,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":187,"animationId":52,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Greatly increases the user’s M.Attack for 5 turns.","effects":[{"code":31,"dataId":4,"value1":5,"value2":0},{"code":31,"dataId":4,"value1":5,"value2":0}],"hitType":0,"iconIndex":70,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Spell Enhancement","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":1,"successRate":100,"tpCost":25,"tpGain":0,"messageType":1}, +{"id":188,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Rouses all allies’ fighting spirit and increases\nAttack. Usable up to 2 times in a row.","effects":[{"code":31,"dataId":2,"value1":5,"value2":0}],"hitType":0,"iconIndex":34,"message1":"%1 gave encouragement!","message2":"","mpCost":0,"name":"Yell","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":1,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":189,"animationId":110,"damage":{"critical":false,"elementId":0,"formula":"a.mat * 10","type":1,"variance":20},"description":"Inflicts damage on all enemies regardless of Defense.","effects":[],"hitType":2,"iconIndex":78,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Meteor","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":1,"successRate":100,"tpCost":100,"tpGain":0,"messageType":1}, +{"id":190,"animationId":46,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Bestows Fire-type for 5 turns.","effects":[{"code":21,"dataId":25,"value1":1,"value2":0}],"hitType":0,"iconIndex":64,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Fire Weapon","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":191,"animationId":46,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Bestows Ice-type for 5 turns.","effects":[{"code":21,"dataId":26,"value1":1,"value2":0}],"hitType":0,"iconIndex":65,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Ice Weapon","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":192,"animationId":46,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Bestows Thunder-type for 5 turns.","effects":[{"code":21,"dataId":27,"value1":1,"value2":0}],"hitType":0,"iconIndex":66,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Thunder Weapon","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":7,"speed":0,"stypeId":1,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":193,"animationId":42,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Reflects M.Attack aimed at the user for 5 turns.","effects":[{"code":21,"dataId":18,"value1":1,"value2":0}],"hitType":0,"iconIndex":81,"message1":"%1 casts %2!","message2":"","mpCost":0,"name":"Magic Mirror","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":1,"successRate":100,"tpCost":50,"tpGain":0,"messageType":1}, +{"id":194,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":195,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Knight Skills","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":196,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Automatically protects allies with low HP for 1 turn.","effects":[{"code":21,"dataId":19,"value1":1,"value2":0}],"hitType":0,"iconIndex":81,"message1":"%1 protects team.","message2":"","mpCost":50,"name":"Protect","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":2000,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":10,"messageType":1}, +{"id":197,"animationId":12,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Performs an attack on an enemy faster than anyone\nelse.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Falcon Thrust","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":2000,"stypeId":2,"successRate":100,"tpCost":15,"tpGain":0,"messageType":1}, +{"id":198,"animationId":11,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Performs an attack on an enemy twice.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Double Thrust","note":"","occasion":1,"repeats":2,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":25,"tpGain":0,"messageType":1}, +{"id":199,"animationId":12,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 4","type":1,"variance":20},"description":"Inflicts damage on all enemies regardless of Defense.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Armor Piercer","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":30,"tpGain":0,"messageType":1}, +{"id":200,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Rouses all allies’ fighting spirit and increases\nAttack. Usable up to 2 times in a row.","effects":[{"code":31,"dataId":2,"value1":5,"value2":0}],"hitType":0,"iconIndex":34,"message1":"%1 made a battle cry!","message2":"","mpCost":50,"name":"Battle Cry","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":8,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":2,"messageType":1}, +{"id":201,"animationId":93,"damage":{"critical":true,"elementId":7,"formula":"30 + a.atk","type":1,"variance":20},"description":"Attacks all enemies.","effects":[],"hitType":1,"iconIndex":69,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Windmill","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":20,"tpGain":0,"messageType":1}, +{"id":202,"animationId":52,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Slightly increases the user’s TP.","effects":[{"code":13,"dataId":0,"value1":30,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 cleared their mind!","message2":"","mpCost":30,"name":"Clear Mind","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":203,"animationId":26,"damage":{"critical":false,"elementId":-1,"formula":"(a.atk * 4 - b.def * 2)*0.9","type":1,"variance":20},"description":"Randomly performs 4 attacks on 4 enemies.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0}],"hitType":1,"iconIndex":76,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Wild Thrust","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":6,"speed":0,"stypeId":2,"successRate":100,"tpCost":45,"tpGain":0,"messageType":1}, +{"id":204,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":205,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Bandit Skills","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":206,"animationId":11,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":1,"variance":20},"description":"Blinds an enemy.","effects":[{"code":21,"dataId":5,"value1":0.5,"value2":0}],"hitType":1,"iconIndex":3,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Eye Poke","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":5,"tpGain":0,"messageType":1}, +{"id":207,"animationId":51,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases the user’s Agility.","effects":[{"code":31,"dataId":6,"value1":5,"value2":0},{"code":31,"dataId":6,"value1":5,"value2":0}],"hitType":2,"iconIndex":38,"message1":"%1 started %2!","message2":"","mpCost":12,"name":"Warm-up","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":5,"messageType":1}, +{"id":208,"animationId":40,"damage":{"critical":true,"elementId":0,"formula":"a.atk","type":0,"variance":20},"description":"Blinds all enemies.","effects":[{"code":21,"dataId":5,"value1":0.5,"value2":0}],"hitType":0,"iconIndex":3,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Flare","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":25,"tpGain":5,"messageType":1}, +{"id":209,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Increases items and money gained from battle for\na while.","effects":[{"code":21,"dataId":30,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 is observing their surroundings carefully.","message2":"","mpCost":30,"name":"Watchful Eye","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":210,"animationId":93,"damage":{"critical":true,"elementId":7,"formula":"50 + a.atk * 5 - b.def * 2","type":1,"variance":20},"description":"Inflicts Wind-type damage on all enemies.","effects":[],"hitType":1,"iconIndex":69,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Wind Call","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":40,"tpGain":0,"messageType":1}, +{"id":211,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"Makes the user harder to target.","effects":[{"code":21,"dataId":21,"value1":1,"value2":0}],"hitType":0,"iconIndex":82,"message1":"%1 hid.","message2":"","mpCost":0,"name":"Hide","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":25,"tpGain":0,"messageType":1}, +{"id":212,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":213,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":214,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":215,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Martial Artist Skills","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":216,"animationId":38,"damage":{"critical":false,"elementId":0,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Inflicts damage and causes all enemies to lose balance.","effects":[{"code":21,"dataId":13,"value1":0.5,"value2":0}],"hitType":1,"iconIndex":78,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Sweep","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":15,"tpGain":0,"messageType":1}, +{"id":217,"animationId":45,"damage":{"critical":false,"elementId":0,"formula":"200 + a.mat","type":0,"variance":20},"description":"Cures the user from being weakened.","effects":[{"code":34,"dataId":0,"value1":1,"value2":0},{"code":34,"dataId":1,"value1":1,"value2":0},{"code":34,"dataId":2,"value1":1,"value2":0},{"code":34,"dataId":3,"value1":1,"value2":0},{"code":34,"dataId":5,"value1":1,"value2":0},{"code":34,"dataId":4,"value1":1,"value2":0},{"code":34,"dataId":6,"value1":1,"value2":0},{"code":34,"dataId":7,"value1":1,"value2":0}],"hitType":0,"iconIndex":72,"message1":"%1 uses %2!","message2":"","mpCost":0,"name":"Qigong","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":11,"speed":0,"stypeId":2,"successRate":100,"tpCost":25,"tpGain":0,"messageType":1}, +{"id":218,"animationId":38,"damage":{"critical":true,"elementId":1,"formula":"a.atk * 5 - b.def * 2","type":1,"variance":20},"description":"Inflicts huge damage on all enemies.","effects":[],"hitType":1,"iconIndex":77,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Roundhouse Kick","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":50,"tpGain":0,"messageType":1}, +{"id":219,"animationId":28,"damage":{"critical":true,"elementId":1,"formula":"a.atk * 10","type":1,"variance":20},"description":"Inflicts damage on an enemy regardless of Defense.","effects":[],"hitType":1,"iconIndex":77,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Tiger Dance","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":100,"tpGain":0,"messageType":1}, +{"id":220,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":221,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":222,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":223,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":224,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":225,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"-----Hunter Skills","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":226,"animationId":-1,"damage":{"critical":true,"elementId":-1,"formula":"a.atk * 3 - b.def * 2","type":1,"variance":20},"description":"Decreases an enemy’s Attack and Defense.","effects":[{"code":21,"dataId":0,"value1":1,"value2":0},{"code":32,"dataId":2,"value1":5,"value2":0},{"code":32,"dataId":3,"value1":5,"value2":0}],"hitType":1,"iconIndex":78,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Point Shot","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":0,"successRate":100,"tpCost":10,"tpGain":5,"messageType":1}, +{"id":227,"animationId":-1,"damage":{"critical":true,"elementId":1,"formula":"a.atk * 2 - b.def","type":1,"variance":20},"description":"Shoots at the footing of all enemies and causes them\nto lose balance.","effects":[{"code":21,"dataId":13,"value1":1,"value2":0}],"hitType":1,"iconIndex":78,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Stun Shot","note":"","occasion":1,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":25,"tpGain":5,"messageType":1}, +{"id":228,"animationId":-1,"damage":{"critical":true,"elementId":1,"formula":"a.atk * 3 - b.def * 2","type":1,"variance":20},"description":"Inflicts damage on an enemy 5 times.","effects":[],"hitType":1,"iconIndex":78,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Team Shot","note":"","occasion":1,"repeats":5,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":2,"successRate":100,"tpCost":50,"tpGain":5,"messageType":1}, +{"id":229,"animationId":98,"damage":{"critical":true,"elementId":1,"formula":"a.atk * 4 - b.def * 2","type":1,"variance":20},"description":"Inflicts damage on all enemies 2 times.","effects":[],"hitType":1,"iconIndex":78,"message1":"%1 does %2!","message2":"","mpCost":0,"name":"Rain Shot","note":"","occasion":1,"repeats":2,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":2,"speed":0,"stypeId":2,"successRate":100,"tpCost":100,"tpGain":5,"messageType":1}, +{"id":230,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":231,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":232,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":233,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":234,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1}, +{"id":235,"animationId":0,"damage":{"critical":false,"elementId":0,"formula":"0","type":0,"variance":20},"description":"","effects":[],"hitType":0,"iconIndex":0,"message1":"","message2":"","mpCost":0,"name":"","note":"","occasion":0,"repeats":1,"requiredWtypeId1":0,"requiredWtypeId2":0,"scope":1,"speed":0,"stypeId":1,"successRate":100,"tpCost":0,"tpGain":0,"messageType":1} +] \ No newline at end of file diff --git a/data/States.json b/data/States.json new file mode 100644 index 0000000..1c2f860 --- /dev/null +++ b/data/States.json @@ -0,0 +1,33 @@ +[ +null, +{"id":1,"autoRemovalTiming":0,"chanceByDamage":100,"iconIndex":1,"maxTurns":1,"message1":"%1 has fallen!","message2":"%1 is slain!","message3":"","message4":"%1 revives!","minTurns":1,"motion":3,"name":"Dead","note":"State #1 will be added when HP hits 0.","overlay":0,"priority":100,"releaseByDamage":false,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":4,"stepsToRemove":100,"traits":[{"code":23,"dataId":9,"value":0}],"messageType":1}, +{"id":2,"autoRemovalTiming":2,"chanceByDamage":100,"iconIndex":0,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"Guard","note":"","overlay":0,"priority":0,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":true,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"traits":[{"code":62,"dataId":1,"value":0}],"messageType":1}, +{"id":3,"autoRemovalTiming":0,"chanceByDamage":100,"iconIndex":0,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"Immortal","note":"","overlay":0,"priority":0,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"traits":[{"code":14,"dataId":1,"value":0}],"messageType":1}, +{"id":4,"autoRemovalTiming":0,"chanceByDamage":100,"iconIndex":2,"maxTurns":1,"message1":"%1 is poisoned!","message2":"%1 is poisoned!","message3":"","message4":"%1 is no longer poisoned!","minTurns":1,"motion":1,"overlay":1,"name":"Poison","note":"","priority":50,"releaseByDamage":false,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"traits":[{"code":22,"dataId":7,"value":-0.1}],"messageType":1}, +{"id":5,"autoRemovalTiming":1,"chanceByDamage":100,"iconIndex":3,"maxTurns":5,"message1":"%1 is blinded!","message2":"%1 is blinded!","message3":"","message4":"%1 is no longer blinded!","minTurns":3,"motion":1,"name":"Blind","note":"","overlay":2,"priority":60,"releaseByDamage":false,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"traits":[{"code":22,"dataId":0,"value":-0.5}],"messageType":1}, +{"id":6,"autoRemovalTiming":1,"chanceByDamage":100,"iconIndex":4,"maxTurns":5,"message1":"%1 is silenced!","message2":"%1 is silenced!","message3":"","message4":"%1 is no longer silenced!","minTurns":3,"motion":1,"name":"Silence","note":"","overlay":3,"priority":65,"releaseByDamage":false,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"traits":[{"code":42,"dataId":1,"value":0}],"messageType":1}, +{"id":7,"autoRemovalTiming":1,"chanceByDamage":50,"iconIndex":5,"maxTurns":4,"message1":"%1 is enraged!","message2":"%1 is enraged!","message3":"","message4":"%1 is no longer enraged!","minTurns":2,"motion":1,"name":"Rage","note":"","overlay":4,"priority":70,"releaseByDamage":false,"removeAtBattleEnd":true,"removeByDamage":true,"removeByRestriction":false,"removeByWalking":false,"restriction":1,"stepsToRemove":100,"traits":[],"messageType":1}, +{"id":8,"autoRemovalTiming":1,"chanceByDamage":50,"iconIndex":6,"maxTurns":4,"message1":"%1 is confused!","message2":"%1 is confused!","message3":"","message4":"%1 is no longer confused!","minTurns":2,"motion":1,"name":"Confusion","note":"","overlay":5,"priority":75,"releaseByDamage":false,"removeAtBattleEnd":true,"removeByDamage":true,"removeByRestriction":false,"removeByWalking":false,"restriction":2,"stepsToRemove":100,"traits":[],"messageType":1}, +{"id":9,"autoRemovalTiming":1,"chanceByDamage":50,"iconIndex":7,"maxTurns":4,"message1":"%1 is charmed!","message2":"%1 is charmed!","message3":"","message4":"%1 is no longer charmed!","minTurns":2,"motion":1,"name":"Charm","note":"","overlay":6,"priority":80,"releaseByDamage":false,"removeAtBattleEnd":true,"removeByDamage":true,"removeByRestriction":false,"removeByWalking":false,"restriction":3,"stepsToRemove":100,"traits":[],"messageType":1}, +{"id":10,"autoRemovalTiming":1,"chanceByDamage":100,"iconIndex":8,"maxTurns":5,"message1":"%1 falls asleep!","message2":"%1 falls asleep!","message3":"%1 is sleeping.","message4":"%1 wakes up!","minTurns":3,"motion":2,"name":"Sleep","note":"","overlay":7,"priority":90,"releaseByDamage":true,"removeAtBattleEnd":true,"removeByDamage":true,"removeByRestriction":false,"removeByWalking":false,"restriction":4,"stepsToRemove":100,"traits":[{"code":22,"dataId":1,"value":-1}],"messageType":1}, +{"id":11,"autoRemovalTiming":0,"chanceByDamage":100,"traits":[],"iconIndex":0,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"","note":"","overlay":0,"priority":50,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":12,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":22,"dataId":1,"value":-1}],"iconIndex":9,"maxTurns":3,"message1":"%1 is paralyzed and can’t move!","message2":"%1 is paralyzed!","message3":"%1 is paralyzed and can’t move!","message4":"%1 is no longer paralyzed!","minTurns":3,"motion":2,"name":"Paralysis","note":"","overlay":8,"priority":95,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":4,"stepsToRemove":100,"messageType":1}, +{"id":13,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":22,"dataId":1,"value":-1}],"iconIndex":9,"maxTurns":2,"message1":"%1 lost balance!","message2":"%1 lost balance!","message3":"%1 is still off-balance...","message4":"%1 has regained balance!","minTurns":1,"motion":1,"name":"Stun","note":"","overlay":10,"priority":90,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":4,"stepsToRemove":100,"messageType":1}, +{"id":14,"autoRemovalTiming":0,"chanceByDamage":100,"traits":[],"iconIndex":0,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"","note":"","overlay":0,"priority":50,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":15,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":22,"dataId":7,"value":0.1}],"iconIndex":72,"maxTurns":4,"message1":"","message2":"","message3":"","message4":"","minTurns":4,"motion":0,"name":"HP Regeneration","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":16,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":22,"dataId":8,"value":0.1}],"iconIndex":72,"maxTurns":4,"message1":"","message2":"","message3":"","message4":"","minTurns":4,"motion":0,"name":"MP Regeneration","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":17,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":22,"dataId":9,"value":0.1}],"iconIndex":72,"maxTurns":4,"message1":"","message2":"","message3":"","message4":"","minTurns":4,"motion":0,"name":"TP Regeneration","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":18,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":22,"dataId":5,"value":1}],"iconIndex":70,"maxTurns":5,"message1":"","message2":"","message3":"","message4":"","minTurns":5,"motion":0,"name":"Magic Reflection","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":19,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":62,"dataId":2,"value":1}],"iconIndex":81,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"Protect","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":true,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":20,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":23,"dataId":0,"value":9}],"iconIndex":76,"maxTurns":5,"message1":"%1 became easier to hit!","message2":"","message3":"","message4":"","minTurns":5,"motion":0,"name":"Provoke","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":21,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":23,"dataId":0,"value":0}],"iconIndex":81,"maxTurns":5,"message1":"%1 became harder to hit!","message2":"","message3":"","message4":"","minTurns":5,"motion":0,"name":"Hide","note":"","overlay":0,"priority":40,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":22,"autoRemovalTiming":1,"chanceByDamage":100,"traits":[{"code":22,"dataId":6,"value":1}],"iconIndex":77,"maxTurns":3,"message1":"","message2":"","message3":"","message4":"","minTurns":3,"motion":0,"name":"Counter Attack","note":"","overlay":0,"priority":50,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":true,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":23,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":14,"dataId":4,"value":1},{"code":14,"dataId":5,"value":1},{"code":14,"dataId":6,"value":1},{"code":14,"dataId":7,"value":1},{"code":14,"dataId":8,"value":1},{"code":14,"dataId":9,"value":1},{"code":14,"dataId":10,"value":1},{"code":14,"dataId":12,"value":1},{"code":14,"dataId":13,"value":1}],"iconIndex":70,"maxTurns":5,"message1":"","message2":"","message3":"","message4":"","minTurns":5,"motion":0,"name":"Status Ailment Block","note":"","overlay":0,"priority":50,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":24,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":23,"dataId":4,"value":0.25}],"iconIndex":70,"maxTurns":5,"message1":"","message2":"","message3":"","message4":"","minTurns":5,"motion":0,"name":"Reduce MP Cost","note":"","overlay":0,"priority":50,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":25,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":31,"dataId":2,"value":1},{"code":11,"dataId":2,"value":0.5},{"code":21,"dataId":2,"value":1.1}],"iconIndex":64,"maxTurns":5,"message1":"%1 is now enveloped in an aura of fire.","message2":"%1 is now enveloped in an aura of fire.","message3":"","message4":"","minTurns":5,"motion":0,"name":"Fire Force","note":"","overlay":0,"priority":50,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":26,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":31,"dataId":3,"value":1},{"code":11,"dataId":3,"value":0.5},{"code":21,"dataId":2,"value":1.1}],"iconIndex":65,"maxTurns":5,"message1":"%1 is now enveloped in an icy aura.","message2":"%1 is now enveloped in an icy aura.","message3":"","message4":"","minTurns":5,"motion":0,"name":"Ice Force","note":"","overlay":0,"priority":50,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":27,"autoRemovalTiming":2,"chanceByDamage":100,"traits":[{"code":31,"dataId":4,"value":1},{"code":11,"dataId":4,"value":0.5},{"code":21,"dataId":2,"value":1.1}],"iconIndex":66,"maxTurns":5,"message1":"%1 is now enveloped in a thunderous aura.","message2":"%1 is now enveloped in a thunderous aura.","message3":"","message4":"","minTurns":5,"motion":0,"name":"Thunder Force","note":"","overlay":0,"priority":50,"removeAtBattleEnd":true,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":28,"autoRemovalTiming":0,"chanceByDamage":100,"traits":[],"iconIndex":0,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"","note":"","overlay":0,"priority":50,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":false,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":29,"autoRemovalTiming":0,"chanceByDamage":100,"traits":[{"code":64,"dataId":0,"value":1}],"iconIndex":72,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"Half Encounters","note":"","overlay":0,"priority":20,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":true,"restriction":0,"stepsToRemove":100,"messageType":1}, +{"id":30,"autoRemovalTiming":0,"chanceByDamage":100,"traits":[{"code":64,"dataId":4,"value":1},{"code":64,"dataId":5,"value":1}],"iconIndex":70,"maxTurns":1,"message1":"","message2":"","message3":"","message4":"","minTurns":1,"motion":0,"name":"Double Money/Items","note":"","overlay":0,"priority":20,"removeAtBattleEnd":false,"removeByDamage":false,"removeByRestriction":false,"removeByWalking":true,"restriction":0,"stepsToRemove":100,"messageType":1} +] \ No newline at end of file diff --git a/data/System.json b/data/System.json new file mode 100644 index 0000000..da509eb --- /dev/null +++ b/data/System.json @@ -0,0 +1 @@ +{"advanced":{"gameId":91059537,"screenWidth":816,"screenHeight":624,"uiAreaWidth":816,"uiAreaHeight":624,"numberFontFilename":"mplus-2p-bold-sub.woff","fallbackFonts":"Verdana, sans-serif","fontSize":26,"mainFontFilename":"mplus-1m-regular.woff","screenScale":1,"windowOpacity":192},"airship":{"bgm":{"name":"Ship3","pan":0,"pitch":100,"volume":90},"characterIndex":3,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"armorTypes":["","General Armor","Magic Armor","Light Armor","Heavy Armor","Small Shield","Large Shield"],"attackMotions":[{"type":0,"weaponImageId":0},{"type":1,"weaponImageId":1},{"type":1,"weaponImageId":2},{"type":1,"weaponImageId":3},{"type":1,"weaponImageId":4},{"type":1,"weaponImageId":5},{"type":1,"weaponImageId":6},{"type":2,"weaponImageId":7},{"type":2,"weaponImageId":8},{"type":2,"weaponImageId":9},{"type":0,"weaponImageId":10},{"type":0,"weaponImageId":11},{"type":0,"weaponImageId":12}],"battleBgm":{"name":"Battle1","pan":0,"pitch":100,"volume":90},"battleback1Name":"GrassMaze","battleback2Name":"GrassMaze","battlerHue":0,"battlerName":"Hi_monster","battleSystem":0,"boat":{"bgm":{"name":"Ship1","pan":0,"pitch":100,"volume":90},"characterIndex":0,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"currencyUnit":"G","defeatMe":{"name":"Defeat1","pan":0,"pitch":100,"volume":90},"editMapId":0,"elements":["","Physical","Fire","Ice","Thunder","Water","Earth","Wind","Light","Darkness"],"equipTypes":["","Weapon","Shield","Head","Body","Accessory"],"gameTitle":"Life of a Naomi","gameoverMe":{"name":"Gameover1","pan":0,"pitch":100,"volume":90},"itemCategories":[true,true,true,true],"locale":"en_US","magicSkills":[1],"menuCommands":[true,true,true,true,true,true],"optAutosave":true,"optDisplayTp":true,"optDrawTitle":true,"optExtraExp":false,"optFloorDeath":false,"optFollowers":true,"optKeyItemsNumber":false,"optSideView":false,"optSlipDeath":false,"optTransparent":false,"partyMembers":[1,4,6,7],"ship":{"bgm":{"name":"Ship2","pan":0,"pitch":100,"volume":90},"characterIndex":1,"characterName":"Vehicle","startMapId":0,"startX":0,"startY":0},"skillTypes":["","Magic","Special"],"sounds":[{"name":"Cursor3","pan":0,"pitch":100,"volume":90},{"name":"Decision2","pan":0,"pitch":100,"volume":90},{"name":"Cancel2","pan":0,"pitch":100,"volume":90},{"name":"Buzzer1","pan":0,"pitch":100,"volume":90},{"name":"Equip1","pan":0,"pitch":100,"volume":90},{"name":"Save2","pan":0,"pitch":100,"volume":90},{"name":"Load2","pan":0,"pitch":100,"volume":90},{"name":"Battle1","pan":0,"pitch":100,"volume":90},{"name":"Run","pan":0,"pitch":100,"volume":90},{"name":"Attack3","pan":0,"pitch":100,"volume":90},{"name":"Damage4","pan":0,"pitch":100,"volume":90},{"name":"Collapse1","pan":0,"pitch":100,"volume":90},{"name":"Collapse2","pan":0,"pitch":100,"volume":90},{"name":"Collapse3","pan":0,"pitch":100,"volume":90},{"name":"Damage5","pan":0,"pitch":100,"volume":90},{"name":"Collapse4","pan":0,"pitch":100,"volume":90},{"name":"Recovery","pan":0,"pitch":100,"volume":90},{"name":"Miss","pan":0,"pitch":100,"volume":90},{"name":"Evasion1","pan":0,"pitch":100,"volume":90},{"name":"Evasion2","pan":0,"pitch":100,"volume":90},{"name":"Reflection","pan":0,"pitch":100,"volume":90},{"name":"Shop1","pan":0,"pitch":100,"volume":90},{"name":"Item3","pan":0,"pitch":100,"volume":90},{"name":"Item3","pan":0,"pitch":100,"volume":90}],"startMapId":1,"startX":8,"startY":6,"switches":["","","","","","","","","","","","","","","","","","","","",""],"terms":{"basic":["Level","Lv","HP","HP","MP","MP","TP","TP","EXP","EXP"],"commands":["Fight","Escape","Attack","Guard","Item","Skill","Equip","Status","Formation","Save","Game End","Options","Weapon","Armor","Key Item","Equip","Optimize","Clear","New Game","Continue",null,"To Title","Cancel",null,"Buy","Sell"],"params":["Max HP","Max MP","Attack","Defense","M.Attack","M.Defense","Agility","Luck","Hit","Evasion"],"messages":{"alwaysDash":"Always Dash","commandRemember":"Command Remember","touchUI":"Touch UI","bgmVolume":"BGM Volume","bgsVolume":"BGS Volume","meVolume":"ME Volume","seVolume":"SE Volume","possession":"Possession","expTotal":"Current %1","expNext":"To Next %1","saveMessage":"Which file would you like to save to?","loadMessage":"Which file would you like to load?","file":"File","autosave":"Autosave","partyName":"%1’s Party","emerge":"%1 emerged!","preemptive":"%1 got the upper hand!","surprise":"%1 was surprised!","escapeStart":"%1 has started to escape!","escapeFailure":"However, it was unable to escape!","victory":"%1 was victorious!","defeat":"%1 was defeated.","obtainExp":"%1 %2 received!","obtainGold":"%1\\G found!","obtainItem":"%1 found!","levelUp":"%1 is now %2 %3!","obtainSkill":"%1 learned!","useItem":"%1 uses %2!","criticalToEnemy":"An excellent hit!!","criticalToActor":"A painful blow!!","actorDamage":"%1 took %2 damage!","actorRecovery":"%1 recovered %2 %3!","actorGain":"%1 gained %2 %3!","actorLoss":"%1 lost %2 %3!","actorDrain":"%1 was drained of %2 %3!","actorNoDamage":"%1 took no damage!","actorNoHit":"Miss! %1 took no damage!","enemyDamage":"%1 took %2 damage!","enemyRecovery":"%1 recovered %2 %3!","enemyGain":"%1 gained %2 %3!","enemyLoss":"%1 lost %2 %3!","enemyDrain":"%1 was drained of %2 %3!","enemyNoDamage":"%1 took no damage!","enemyNoHit":"Miss! %1 took no damage!","evasion":"%1 evaded the attack!","magicEvasion":"%1 nullified the magic!","magicReflection":"%1 reflected the magic!","counterAttack":"%1 made a counterattack!","substitute":"%1 protected %2!","buffAdd":"%1’s %2 went up!","debuffAdd":"%1’s %2 went down!","buffRemove":"%1’s %2 returned to normal!","actionFailure":"There was no effect on %1!"}},"testBattlers":[{"actorId":1,"level":1,"equips":[2,1,2,3,0]},{"actorId":4,"level":1,"equips":[31,0,0,5,0]},{"actorId":6,"level":1,"equips":[7,0,65,21,0]},{"actorId":7,"level":1,"equips":[7,0,0,20,0]}],"testTroopId":1,"title1Name":"Ruins","title2Name":"","titleBgm":{"name":"Theme4","pan":0,"pitch":100,"volume":90},"titleCommandWindow":{"background":0,"offsetX":0,"offsetY":0},"variables":["","","","","","","","","","","","","","","","","","","","",""],"versionId":51328477,"victoryMe":{"name":"Victory1","pan":0,"pitch":100,"volume":90},"weaponTypes":["","Dagger","Sword","Flail","Axe","Whip","Staff","Bow","Crossbow","Gun","Claw","Glove","Spear"],"windowTone":[0,0,0,0],"optSplashScreen":false,"optMessageSkip":true,"tileSize":48} \ No newline at end of file diff --git a/data/Tilesets.json b/data/Tilesets.json new file mode 100644 index 0000000..5b0a127 --- /dev/null +++ b/data/Tilesets.json @@ -0,0 +1,9 @@ +[ +null, +{"id":1,"flags":[16,1551,1536,1536,1536,1536,1536,1551,1536,1536,1536,1536,1536,1551,1551,1536,1536,1536,1551,1536,1536,1551,1536,1536,1536,1536,1551,1551,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1536,1536,1536,1536,1536,1551,1536,1551,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1536,1536,1552,1552,1552,1552,1551,1551,1551,1551,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1551,1536,1551,1536,1551,1551,1551,1536,1536,1551,1552,1552,1552,1552,1552,1536,1536,1536,1551,1551,1551,1551,1551,1536,1536,1536,1551,1551,1551,1551,1551,1536,1536,1536,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3584,3584,3584,3584,3648,3584,3584,3584,3584,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3584,3584,3584,3584,3648,3584,3584,3584,3584,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3584,3584,3584,3584,3648,3584,3584,3584,3584,3648,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3584,3584,3584,3584,3648,3584,3584,3584,3584,3648,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3584,3584,3584,3584,3648,3584,3584,3584,3584,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599],"mode":0,"name":"Overworld","note":"","tilesetNames":["World_A1","World_A2","","","","World_B","World_C","",""]}, +{"id":2,"flags":[16,1536,1536,1536,1536,1552,1552,1552,1552,1536,1536,1536,1536,1551,1551,1551,1552,1574,1574,1574,1574,1551,1536,1551,1551,1574,1574,1574,1574,1552,1552,1552,1552,1536,1536,1536,1551,1551,1551,1551,1552,1536,1536,1536,1536,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1551,1551,1536,1536,1551,1536,1551,1552,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1600,1536,1551,1552,1551,1551,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1536,1536,1536,1536,1552,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1552,1551,1551,1551,1552,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1615,1536,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1553,1553,1553,1553,1553,1553,1553,1553,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1553,1553,1551,1551,1551,1553,1553,1553,1551,1551,1553,1553,1553,1551,1551,1551,1553,1553,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1551,1551,1553,1553,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1664,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1544,1536,1544,1538,1536,1540,1551,1551,1537,1536,1537,1538,1536,1540,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1538,1536,1540,1542,1536,1536,1536,1536,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1546,1544,1548,1536,1536,1546,1544,1548,1538,1536,1540,1536,1536,1538,1536,1540,1538,1536,1540,1536,1536,1538,1536,1540,1551,1551,1551,1536,1536,1551,1551,1551,1551,1551,1551,1536,1536,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599],"mode":1,"name":"Outside","note":"","tilesetNames":["Outside_A1","Outside_A2","Outside_A3","Outside_A4","Outside_A5","Outside_B","Outside_C","",""]}, +{"id":3,"flags":[16,1536,1536,1536,1536,1574,1574,1574,1536,1536,1536,1536,1536,1574,1574,1574,1536,1536,1551,1536,1551,1536,1536,1536,1552,1552,1552,1551,1551,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1551,1536,1536,1536,1679,1679,1679,1679,1679,1551,1551,1551,1536,1536,1536,1679,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1679,1551,1551,1551,1551,1551,1552,1552,1552,1552,1551,1551,1551,1551,1679,1679,1679,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1552,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1536,1538,1536,1540,1544,1536,1544,1551,1551,1538,1536,1540,1537,1536,1537,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599],"mode":1,"name":"Inside","note":"","tilesetNames":["Inside_A1","Inside_A2","","Inside_A4","Inside_A5","Inside_B","Inside_C","",""]}, +{"id":4,"flags":[16,1551,1536,1536,1574,1574,1574,1574,1551,1551,1536,1536,1574,1574,1574,1536,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1536,1536,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1679,1552,1552,1552,1552,1551,1551,1551,1536,1679,1679,1679,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1552,1551,1551,1551,1551,1551,1551,1551,1552,1536,1536,1536,1536,1536,1536,1536,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1552,1552,1551,1552,1552,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1536,1536,1536,1536,1536,1536,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1680,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1553,1553,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1550,1550,1551,1550,1551,1551,1550,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1552,1551,1536,1536,1536,1536,1536,1536,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1536,1536,1551,1536,1536,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1536,1536,1536,1536,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1792,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3840,3840,3840,3840,3904,3840,3840,3840,3840,3904,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599],"mode":1,"name":"Dungeon","note":"","tilesetNames":["Dungeon_A1","Dungeon_A2","","Dungeon_A4","Dungeon_A5","Dungeon_B","Dungeon_C","",""]}, +{"id":5,"flags":[16,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1552,1552,1536,1536,1536,1551,1536,1536,1551,1551,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1551,1552,1552,1552,1552,1552,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1551,1551,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1552,1552,1552,1552,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1536,1536,1536,1536,1552,1552,1552,1551,1536,1536,1536,1536,1679,1679,1679,1551,1574,1542,1574,1568,1552,1552,1552,1551,1574,1542,1574,1574,1552,1552,1552,1551,1536,1536,1536,1536,1679,1679,1679,1551,1536,1536,1536,1536,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1552,1551,1536,1536,1551,1536,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1536,1536,1536,1551,1551,1551,1551,1551,1536,1551,1536,1552,1551,1551,1551,1551,1536,1536,1536,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1536,1551,1536,1551,1536,1551,1551,1551,1552,1551,1551,1551,1551,1551,1551,1551,1552,1551,1551,1551,1552,1551,1551,1551,1552,1551,1551,1551,1552,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1552,1552,1552,1552,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1552,1552,1552,1552,1552,1551,1551,1551,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1679,1679,1551,1551,1551,1552,1551,1552,1552,1552,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1536,1538,1536,1540,1544,1536,1544,1551,1551,1538,1536,1540,1537,1536,1537,1536,1536,1536,1536,1551,1551,1536,1536,1551,1551,1551,1536,1538,1536,1540,1542,1536,1536,1536,1551,1536,1536,1536,1551,1536,1536,1536,1536,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1551,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1546,1544,1548,1536,1536,1536,1536,1536,1538,1536,1540,1538,1536,1540,1542,1536,1538,1536,1540,1538,1536,1540,1542,1536,1551,1551,1551,1536,1536,1551,1536,1536,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3904,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,3855,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599],"mode":1,"name":"SF Outside","note":"","tilesetNames":["Outside_A1","Outside_A2","SF_Outside_A3","SF_Outside_A4","SF_Outside_A5","SF_Outside_B","SF_Outside_C","",""]}, +{"id":6,"flags":[16,1536,1536,1536,1536,1574,1574,1574,1536,1536,1536,1536,1536,1574,1574,1574,1551,1551,1551,1551,1551,1536,1536,1536,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1546,1548,1545,1542,1551,1551,1551,1551,1539,1541,1544,1542,1551,1551,1551,1551,1542,1538,1540,1680,1552,1552,1552,1552,1552,1552,1551,1679,1551,1551,1551,1551,1551,1551,1551,1679,1551,1551,1551,1551,1551,1551,1551,1536,1552,1552,1552,1552,1552,1552,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1552,1552,1549,1547,1551,1551,1551,1551,1551,1551,1550,1551,1551,1551,1679,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1544,1551,1538,1540,1551,1551,1551,1551,1544,1551,1538,1540,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1679,1551,1536,1536,1551,1551,1679,1679,1679,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1551,1552,1551,1551,1551,1536,1551,1551,1551,1551,1551,1551,1551,1551,1551,1679,1679,1551,1551,1551,1551,1551,1679,1679,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1536,1536,1536,1551,1551,1536,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1551,1551,1536,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1544,1551,1551,1551,1551,1551,1551,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1538,1536,1540,1551,1551,1551,1551,1551,1538,1536,1540,1551,1551,1551,1551,1551,1536,1536,1536,1551,1551,1551,1551,1551,1551,1552,1551,1551,1551,1552,1551,1552,1536,1551,1551,1551,1551,1551,1551,1552,1551,1679,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1551,1552,1552,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1552,1551,1552,1552,1552,1552,1552,1552,1551,1551,1551,1551,1551,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1551,1536,1538,1536,1540,1544,1536,1544,1551,1551,1538,1536,1540,1537,1536,1537,1536,1536,1536,1536,1551,1551,1536,1536,1551,1551,1551,1536,1538,1536,1540,1542,1536,1536,1536,1551,1536,1536,1536,1551,1536,1536,1536,1536,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1551,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1538,1536,1540,1542,1538,1536,1540,1542,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1546,1544,1548,1536,1536,1536,1536,1536,1538,1536,1540,1538,1540,1540,1542,1536,1538,1536,1540,1538,1540,1540,1542,1536,1551,1551,1551,1536,1536,1551,1536,1536,1551,1551,1551,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,2575,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3648,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,2063,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,3727,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,1536,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3584,3586,3586,3586,3586,3592,3592,3592,3592,3588,3588,3588,3588,3584,3584,3584,3584,3590,3592,3594,3594,3596,3596,3588,3588,3586,3586,3598,3594,3590,3596,3598,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599,3599],"mode":1,"name":"SF Inside","note":"","tilesetNames":["Inside_A1","Inside_A2","","SF_Inside_A4","SF_Outside_A5","SF_Inside_B","SF_Inside_C","",""]} +] \ No newline at end of file diff --git a/data/Troops.json b/data/Troops.json new file mode 100644 index 0000000..aabbfd4 --- /dev/null +++ b/data/Troops.json @@ -0,0 +1,8 @@ +[ +null, +{"id":1,"members":[{"enemyId":1,"x":336,"y":436,"hidden":false},{"enemyId":1,"x":480,"y":436,"hidden":false}],"name":"Goblin*2","pages":[{"conditions":{"actorHp":50,"actorId":1,"actorValid":false,"enemyHp":50,"enemyIndex":0,"enemyValid":false,"switchId":1,"switchValid":false,"turnA":0,"turnB":0,"turnEnding":false,"turnValid":false},"list":[{"code":0,"indent":0,"parameters":[]}],"span":0}]}, +{"id":2,"members":[{"enemyId":2,"x":337,"y":436,"hidden":false},{"enemyId":2,"x":480,"y":436,"hidden":false}],"name":"Gnome*2","pages":[{"conditions":{"actorHp":50,"actorId":1,"actorValid":false,"enemyHp":50,"enemyIndex":0,"enemyValid":false,"switchId":1,"switchValid":false,"turnA":0,"turnB":0,"turnEnding":false,"turnValid":false},"list":[{"code":0,"indent":0,"parameters":[]}],"span":0}]}, +{"id":3,"members":[{"enemyId":3,"x":337,"y":436,"hidden":false},{"enemyId":3,"x":479,"y":436,"hidden":false}],"name":"Crow*2","pages":[{"conditions":{"actorHp":50,"actorId":1,"actorValid":false,"enemyHp":50,"enemyIndex":0,"enemyValid":false,"switchId":1,"switchValid":false,"turnA":0,"turnB":0,"turnEnding":false,"turnValid":false},"list":[{"code":0,"indent":0,"parameters":[]}],"span":0}]}, +{"id":4,"members":[{"enemyId":4,"x":408,"y":436,"hidden":false}],"name":"Treant","pages":[{"conditions":{"actorHp":50,"actorId":1,"actorValid":false,"enemyHp":50,"enemyIndex":0,"enemyValid":false,"switchId":1,"switchValid":false,"turnA":0,"turnB":0,"turnEnding":false,"turnValid":false},"list":[{"code":0,"indent":0,"parameters":[]}],"span":0}]}, +{"id":5,"members":[{"enemyId":5,"x":408,"y":436,"hidden":false}],"name":"Hi_monster","pages":[{"conditions":{"actorHp":50,"actorId":1,"actorValid":false,"enemyHp":50,"enemyIndex":0,"enemyValid":false,"switchId":1,"switchValid":false,"turnA":0,"turnB":0,"turnEnding":false,"turnValid":false},"list":[{"code":0,"indent":0,"parameters":[]}],"span":0}]} +] \ No newline at end of file diff --git a/data/Weapons.json b/data/Weapons.json new file mode 100644 index 0000000..b2e2dd6 --- /dev/null +++ b/data/Weapons.json @@ -0,0 +1,53 @@ +[ +null, +{"id":1,"animationId":6,"description":"[Sword] A light and easy-to-wield short-bladed sword.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":97,"name":"Short Sword","note":"","params":[0,0,8,0,0,0,0,0],"price":300,"wtypeId":2}, +{"id":2,"animationId":6,"description":"[Sword] A long battle sword boasting a sharp cut.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":97,"name":"Long Sword","note":"","params":[0,0,12,0,0,0,0,0],"price":670,"wtypeId":2}, +{"id":3,"animationId":6,"description":"[Sword] A wide sword with a curved blade.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":97,"name":"Falchion","note":"","params":[0,0,18,0,0,0,0,0],"price":1480,"wtypeId":2}, +{"id":4,"animationId":6,"description":"[Sword] A long sword forged with mithril.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":97,"name":"Mithril Sword","note":"","params":[0,0,25,0,0,0,0,0],"price":3890,"wtypeId":2}, +{"id":5,"animationId":6,"description":"[Sword] A sword forged from the fangs of a dragon.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":97,"name":"Dragon Blade","note":"","params":[0,0,36,0,0,0,0,0],"price":6970,"wtypeId":2}, +{"id":6,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":7,"animationId":1,"description":"[Staff] An inexpensive and widely-used staff.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":101,"name":"Wooden Staff","note":"","params":[0,0,2,0,8,3,0,0],"price":280,"wtypeId":6}, +{"id":8,"animationId":1,"description":"[Staff] A wand that slightly increases its wielder’s\nmagical powers.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":101,"name":"Magic Wand","note":"","params":[0,0,3,0,12,6,0,0],"price":780,"wtypeId":6}, +{"id":9,"animationId":1,"description":"[Staff] A silver wand that increases its wielder’s\nmagical powers.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":101,"name":"Force Wand","note":"","params":[0,0,5,0,21,12,0,0],"price":1680,"wtypeId":6}, +{"id":10,"animationId":1,"description":"[Staff] A mithril rod that increases its wielder’s\nmagical powers.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":101,"name":"Mithril Rod","note":"","params":[0,0,12,0,32,24,0,0],"price":4120,"wtypeId":6}, +{"id":11,"animationId":1,"description":"[Staff] A dragon staff that increases its wielder’s\nmagical powers.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":101,"name":"Dragon Staff","note":"","params":[0,0,18,0,45,52,0,0],"price":7680,"wtypeId":6}, +{"id":12,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":13,"animationId":1,"description":"[Flail] A flail with a stone head attached to its\nhandle with a chain.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":98,"name":"Stone Flail","note":"","params":[0,0,7,0,0,0,0,0],"price":360,"wtypeId":3}, +{"id":14,"animationId":1,"description":"[Flail] A flail with a bronze head attached to its\nhandle with a chain.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":98,"name":"Bronze Flail","note":"","params":[0,0,12,0,0,0,0,0],"price":680,"wtypeId":3}, +{"id":15,"animationId":1,"description":"[Flail] A flail that has been strengthened with steel.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":98,"name":"Morning Star","note":"","params":[0,0,18,0,0,0,0,0],"price":1460,"wtypeId":3}, +{"id":16,"animationId":1,"description":"[Flail] A flail that has been strengthened with mithril.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":98,"name":"Mithril Flail","note":"","params":[0,0,23,0,0,0,0,0],"price":2980,"wtypeId":3}, +{"id":17,"animationId":1,"description":"[Flail] A flail that has been strengthened using fangs of a dragon.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":98,"name":"Dragon Flail","note":"","params":[0,0,29,0,0,0,0,0],"price":6180,"wtypeId":3}, +{"id":18,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":19,"animationId":6,"description":"[Axe] A small axe used for logging trees.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":99,"name":"Hand Axe","note":"","params":[0,0,10,0,0,0,0,0],"price":480,"wtypeId":4}, +{"id":20,"animationId":6,"description":"[Axe] A double-edged axe made for battle.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":99,"name":"Battle Axe","note":"","params":[0,0,18,0,0,0,0,0],"price":980,"wtypeId":4}, +{"id":21,"animationId":6,"description":"[Axe] A battle axe with a crescent-shaped blade.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":99,"name":"Bardiche","note":"","params":[0,0,25,0,0,0,0,0],"price":2180,"wtypeId":4}, +{"id":22,"animationId":6,"description":"[Axe] A battle axe forged with mithril.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":99,"name":"Mithril Axe","note":"","params":[0,0,32,0,0,0,0,0],"price":4500,"wtypeId":4}, +{"id":23,"animationId":6,"description":"[Axe] A battle axe forged from the fangs of a dragon.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":99,"name":"Dragon Axe","note":"","params":[0,0,45,0,0,0,0,0],"price":9600,"wtypeId":4}, +{"id":24,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":25,"animationId":11,"description":"[Spear] A short spear specialized for thrusting.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":107,"name":"Short Spear","note":"","params":[0,0,6,0,0,0,0,0],"price":320,"wtypeId":12}, +{"id":26,"animationId":11,"description":"[Spear] A spear with the longest handle possible.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":107,"name":"Long Spear","note":"","params":[0,0,12,0,0,0,0,0],"price":890,"wtypeId":12}, +{"id":27,"animationId":11,"description":"[Spear] A spear with an axe-head at its tip.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":107,"name":"Halberd","note":"","params":[0,0,18,0,0,0,0,0],"price":1760,"wtypeId":12}, +{"id":28,"animationId":11,"description":"[Spear] A spear forged with mithril.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":107,"name":"Mithril Spear","note":"","params":[0,0,24,0,0,0,0,0],"price":3420,"wtypeId":12}, +{"id":29,"animationId":11,"description":"[Spear] A spear forged from the fangs of a dragon.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":107,"name":"Dragon Spear","note":"","params":[0,0,32,0,0,0,0,0],"price":5980,"wtypeId":12}, +{"id":30,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":31,"animationId":1,"description":"[Glove] A battle glove with spikes attached to its\nknuckles.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0},{"code":54,"dataId":2,"value":1},{"code":34,"dataId":0,"value":1}],"iconIndex":106,"name":"Cestus","note":"","params":[0,0,5,5,0,0,0,0],"price":360,"wtypeId":11}, +{"id":32,"animationId":16,"description":"[Claw] A combat weapon with 4 short claws attached.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0},{"code":54,"dataId":2,"value":1},{"code":34,"dataId":0,"value":1}],"iconIndex":105,"name":"Bagh Naka","note":"","params":[0,0,12,8,0,0,0,0],"price":980,"wtypeId":10}, +{"id":33,"animationId":16,"description":"[Claw] A combat weapon with iron talons attached.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0},{"code":54,"dataId":2,"value":1},{"code":34,"dataId":0,"value":1}],"iconIndex":105,"name":"Iron Claw","note":"","params":[0,0,20,15,0,0,0,0],"price":1560,"wtypeId":10}, +{"id":34,"animationId":16,"description":"[Claw] A combat weapon with mithril talons attached.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0},{"code":54,"dataId":2,"value":1},{"code":34,"dataId":0,"value":1}],"iconIndex":105,"name":"Mithril Claw","note":"","params":[0,0,25,18,0,0,0,0],"price":3480,"wtypeId":10}, +{"id":35,"animationId":16,"description":"[Claw] A combat weapon with dragon talons attached.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0},{"code":54,"dataId":2,"value":1},{"code":34,"dataId":0,"value":1}],"iconIndex":105,"name":"Dragon Claw","note":"","params":[0,0,32,21,0,0,0,0],"price":6890,"wtypeId":10}, +{"id":36,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":37,"animationId":11,"description":"[Bow] A short bow made for hunting.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":102,"name":"Short Bow","note":"","params":[0,0,7,0,0,0,0,0],"price":310,"wtypeId":7}, +{"id":38,"animationId":11,"description":"[Bow] A long bow for battle with superior power.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":102,"name":"Long Bow","note":"","params":[0,0,12,0,0,0,0,0],"price":780,"wtypeId":7}, +{"id":39,"animationId":11,"description":"[Bow] A crossbow that shoots arrows with powerful\nsprings.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":103,"name":"Crossbow","note":"","params":[0,0,18,0,0,0,0,0],"price":1860,"wtypeId":8}, +{"id":40,"animationId":11,"description":"[Bow] A crossbow that shoots mithril arrows with\npowerful springs.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":103,"name":"Mithril Bow","note":"","params":[0,0,23,0,0,0,0,0],"price":3260,"wtypeId":8}, +{"id":41,"animationId":11,"description":"[Bow] A long bow for battle made with dragon’s\nwhiskers.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":102,"name":"Dragon Bow","note":"","params":[0,0,28,0,0,0,0,0],"price":5980,"wtypeId":7}, +{"id":42,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":43,"animationId":6,"description":"[Dagger] A knife used for day-to-day tasks.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":96,"name":"Knife","note":"","params":[0,0,5,0,0,0,0,0],"price":280,"wtypeId":1}, +{"id":44,"animationId":6,"description":"[Dagger] A short blade used in close combat.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":96,"name":"Daggar","note":"","params":[0,0,9,0,0,0,0,0],"price":690,"wtypeId":1}, +{"id":45,"animationId":6,"description":"[Dagger] A dagger with a thicker, sturdier blade.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":96,"name":"Machete","note":"","params":[0,0,12,0,0,0,0,0],"price":1280,"wtypeId":1}, +{"id":46,"animationId":6,"description":"[Dagger] A dagger forged with mithril.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":96,"name":"Mithril Daggar","note":"","params":[0,0,18,0,0,0,0,0],"price":2930,"wtypeId":1}, +{"id":47,"animationId":6,"description":"[Dagger] A dagger forged from the fangs of a dragon.","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":96,"name":"Dragon Daggar","note":"","params":[0,0,23,0,0,0,0,0],"price":5820,"wtypeId":1}, +{"id":48,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":49,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0}, +{"id":50,"animationId":0,"description":"","etypeId":1,"traits":[{"code":31,"dataId":1,"value":0},{"code":22,"dataId":0,"value":0}],"iconIndex":0,"name":"","note":"","params":[0,0,0,0,0,0,0,0],"price":0,"wtypeId":0} +] \ No newline at end of file diff --git a/effects/Absorb.efkefc b/effects/Absorb.efkefc new file mode 100644 index 0000000..5f4f422 Binary files /dev/null and b/effects/Absorb.efkefc differ diff --git a/effects/ArrowSpecial.efkefc b/effects/ArrowSpecial.efkefc new file mode 100644 index 0000000..17e6d32 Binary files /dev/null and b/effects/ArrowSpecial.efkefc differ diff --git a/effects/BallsOfLight.efkefc b/effects/BallsOfLight.efkefc new file mode 100644 index 0000000..2272fca Binary files /dev/null and b/effects/BallsOfLight.efkefc differ diff --git a/effects/Bind.efkefc b/effects/Bind.efkefc new file mode 100644 index 0000000..81779eb Binary files /dev/null and b/effects/Bind.efkefc differ diff --git a/effects/Blind.efkefc b/effects/Blind.efkefc new file mode 100644 index 0000000..be53c6f Binary files /dev/null and b/effects/Blind.efkefc differ diff --git a/effects/Bodyslam.efkefc b/effects/Bodyslam.efkefc new file mode 100644 index 0000000..d60a405 Binary files /dev/null and b/effects/Bodyslam.efkefc differ diff --git a/effects/Breath.efkefc b/effects/Breath.efkefc new file mode 100644 index 0000000..151f372 Binary files /dev/null and b/effects/Breath.efkefc differ diff --git a/effects/ClawEffect.efkefc b/effects/ClawEffect.efkefc new file mode 100644 index 0000000..335ff9a Binary files /dev/null and b/effects/ClawEffect.efkefc differ diff --git a/effects/ClawFire.efkefc b/effects/ClawFire.efkefc new file mode 100644 index 0000000..09e0ae1 Binary files /dev/null and b/effects/ClawFire.efkefc differ diff --git a/effects/ClawIce.efkefc b/effects/ClawIce.efkefc new file mode 100644 index 0000000..c0bea17 Binary files /dev/null and b/effects/ClawIce.efkefc differ diff --git a/effects/ClawPhysical.efkefc b/effects/ClawPhysical.efkefc new file mode 100644 index 0000000..742a258 Binary files /dev/null and b/effects/ClawPhysical.efkefc differ diff --git a/effects/ClawSpecial.efkefc b/effects/ClawSpecial.efkefc new file mode 100644 index 0000000..047e2c3 Binary files /dev/null and b/effects/ClawSpecial.efkefc differ diff --git a/effects/ClawThunder.efkefc b/effects/ClawThunder.efkefc new file mode 100644 index 0000000..47efe73 Binary files /dev/null and b/effects/ClawThunder.efkefc differ diff --git a/effects/Confusion.efkefc b/effects/Confusion.efkefc new file mode 100644 index 0000000..28f5202 Binary files /dev/null and b/effects/Confusion.efkefc differ diff --git a/effects/CureAll1.efkefc b/effects/CureAll1.efkefc new file mode 100644 index 0000000..a0a5de6 Binary files /dev/null and b/effects/CureAll1.efkefc differ diff --git a/effects/CureAll2.efkefc b/effects/CureAll2.efkefc new file mode 100644 index 0000000..939db66 Binary files /dev/null and b/effects/CureAll2.efkefc differ diff --git a/effects/CureOne1.efkefc b/effects/CureOne1.efkefc new file mode 100644 index 0000000..7f10d20 Binary files /dev/null and b/effects/CureOne1.efkefc differ diff --git a/effects/CureOne2.efkefc b/effects/CureOne2.efkefc new file mode 100644 index 0000000..48a08d3 Binary files /dev/null and b/effects/CureOne2.efkefc differ diff --git a/effects/DarknessAll1.efkefc b/effects/DarknessAll1.efkefc new file mode 100644 index 0000000..b12426d Binary files /dev/null and b/effects/DarknessAll1.efkefc differ diff --git a/effects/DarknessAll2.efkefc b/effects/DarknessAll2.efkefc new file mode 100644 index 0000000..f4c4959 Binary files /dev/null and b/effects/DarknessAll2.efkefc differ diff --git a/effects/DarknessAll3.efkefc b/effects/DarknessAll3.efkefc new file mode 100644 index 0000000..d6ebfc3 Binary files /dev/null and b/effects/DarknessAll3.efkefc differ diff --git a/effects/DarknessOne1.efkefc b/effects/DarknessOne1.efkefc new file mode 100644 index 0000000..164f849 Binary files /dev/null and b/effects/DarknessOne1.efkefc differ diff --git a/effects/DarknessOne2.efkefc b/effects/DarknessOne2.efkefc new file mode 100644 index 0000000..758f67e Binary files /dev/null and b/effects/DarknessOne2.efkefc differ diff --git a/effects/Death.efkefc b/effects/Death.efkefc new file mode 100644 index 0000000..bef67dc Binary files /dev/null and b/effects/Death.efkefc differ diff --git a/effects/EarthAll1.efkefc b/effects/EarthAll1.efkefc new file mode 100644 index 0000000..18a55fd Binary files /dev/null and b/effects/EarthAll1.efkefc differ diff --git a/effects/EarthAll2.efkefc b/effects/EarthAll2.efkefc new file mode 100644 index 0000000..2fc34b5 Binary files /dev/null and b/effects/EarthAll2.efkefc differ diff --git a/effects/EarthAll3.efkefc b/effects/EarthAll3.efkefc new file mode 100644 index 0000000..f845a24 Binary files /dev/null and b/effects/EarthAll3.efkefc differ diff --git a/effects/EarthOne1.efkefc b/effects/EarthOne1.efkefc new file mode 100644 index 0000000..07c52d6 Binary files /dev/null and b/effects/EarthOne1.efkefc differ diff --git a/effects/EarthOne2.efkefc b/effects/EarthOne2.efkefc new file mode 100644 index 0000000..4bde62d Binary files /dev/null and b/effects/EarthOne2.efkefc differ diff --git a/effects/FireAll1.efkefc b/effects/FireAll1.efkefc new file mode 100644 index 0000000..faa5a1d Binary files /dev/null and b/effects/FireAll1.efkefc differ diff --git a/effects/FireAll2.efkefc b/effects/FireAll2.efkefc new file mode 100644 index 0000000..2d3baa7 Binary files /dev/null and b/effects/FireAll2.efkefc differ diff --git a/effects/FireAll3.efkefc b/effects/FireAll3.efkefc new file mode 100644 index 0000000..f9f7452 Binary files /dev/null and b/effects/FireAll3.efkefc differ diff --git a/effects/FireOne1.efkefc b/effects/FireOne1.efkefc new file mode 100644 index 0000000..a180465 Binary files /dev/null and b/effects/FireOne1.efkefc differ diff --git a/effects/FireOne2.efkefc b/effects/FireOne2.efkefc new file mode 100644 index 0000000..869050e Binary files /dev/null and b/effects/FireOne2.efkefc differ diff --git a/effects/Flash.efkefc b/effects/Flash.efkefc new file mode 100644 index 0000000..4cd98b6 Binary files /dev/null and b/effects/Flash.efkefc differ diff --git a/effects/Fog.efkefc b/effects/Fog.efkefc new file mode 100644 index 0000000..1b72fce Binary files /dev/null and b/effects/Fog.efkefc differ diff --git a/effects/GeneralSpecial1.efkefc b/effects/GeneralSpecial1.efkefc new file mode 100644 index 0000000..993e9a8 Binary files /dev/null and b/effects/GeneralSpecial1.efkefc differ diff --git a/effects/GeneralSpecial2.efkefc b/effects/GeneralSpecial2.efkefc new file mode 100644 index 0000000..bf91f25 Binary files /dev/null and b/effects/GeneralSpecial2.efkefc differ diff --git a/effects/HealAll1.efkefc b/effects/HealAll1.efkefc new file mode 100644 index 0000000..787ebfd Binary files /dev/null and b/effects/HealAll1.efkefc differ diff --git a/effects/HealAll2.efkefc b/effects/HealAll2.efkefc new file mode 100644 index 0000000..191a93a Binary files /dev/null and b/effects/HealAll2.efkefc differ diff --git a/effects/HealOne1.efkefc b/effects/HealOne1.efkefc new file mode 100644 index 0000000..8fcd3ca Binary files /dev/null and b/effects/HealOne1.efkefc differ diff --git a/effects/HealOne2.efkefc b/effects/HealOne2.efkefc new file mode 100644 index 0000000..e8e4f8e Binary files /dev/null and b/effects/HealOne2.efkefc differ diff --git a/effects/HitEffect.efkefc b/effects/HitEffect.efkefc new file mode 100644 index 0000000..e2720f2 Binary files /dev/null and b/effects/HitEffect.efkefc differ diff --git a/effects/HitFire.efkefc b/effects/HitFire.efkefc new file mode 100644 index 0000000..b7fcc48 Binary files /dev/null and b/effects/HitFire.efkefc differ diff --git a/effects/HitIce.efkefc b/effects/HitIce.efkefc new file mode 100644 index 0000000..756579e Binary files /dev/null and b/effects/HitIce.efkefc differ diff --git a/effects/HitPhysical.efkefc b/effects/HitPhysical.efkefc new file mode 100644 index 0000000..a9f5894 Binary files /dev/null and b/effects/HitPhysical.efkefc differ diff --git a/effects/HitSpecial1.efkefc b/effects/HitSpecial1.efkefc new file mode 100644 index 0000000..3e4c793 Binary files /dev/null and b/effects/HitSpecial1.efkefc differ diff --git a/effects/HitSpecial2.efkefc b/effects/HitSpecial2.efkefc new file mode 100644 index 0000000..dcf08ec Binary files /dev/null and b/effects/HitSpecial2.efkefc differ diff --git a/effects/HitThunder.efkefc b/effects/HitThunder.efkefc new file mode 100644 index 0000000..dde1824 Binary files /dev/null and b/effects/HitThunder.efkefc differ diff --git a/effects/IceAll1.efkefc b/effects/IceAll1.efkefc new file mode 100644 index 0000000..5f81995 Binary files /dev/null and b/effects/IceAll1.efkefc differ diff --git a/effects/IceAll2.efkefc b/effects/IceAll2.efkefc new file mode 100644 index 0000000..d804739 Binary files /dev/null and b/effects/IceAll2.efkefc differ diff --git a/effects/IceAll3.efkefc b/effects/IceAll3.efkefc new file mode 100644 index 0000000..77cbeff Binary files /dev/null and b/effects/IceAll3.efkefc differ diff --git a/effects/IceOne1.efkefc b/effects/IceOne1.efkefc new file mode 100644 index 0000000..b22e455 Binary files /dev/null and b/effects/IceOne1.efkefc differ diff --git a/effects/IceOne2.efkefc b/effects/IceOne2.efkefc new file mode 100644 index 0000000..ed39ee3 Binary files /dev/null and b/effects/IceOne2.efkefc differ diff --git a/effects/LaserAll.efkefc b/effects/LaserAll.efkefc new file mode 100644 index 0000000..760e11a Binary files /dev/null and b/effects/LaserAll.efkefc differ diff --git a/effects/LaserOne.efkefc b/effects/LaserOne.efkefc new file mode 100644 index 0000000..a46c437 Binary files /dev/null and b/effects/LaserOne.efkefc differ diff --git a/effects/LightAll1.efkefc b/effects/LightAll1.efkefc new file mode 100644 index 0000000..81c6908 Binary files /dev/null and b/effects/LightAll1.efkefc differ diff --git a/effects/LightAll2.efkefc b/effects/LightAll2.efkefc new file mode 100644 index 0000000..648d2fb Binary files /dev/null and b/effects/LightAll2.efkefc differ diff --git a/effects/LightAll3.efkefc b/effects/LightAll3.efkefc new file mode 100644 index 0000000..c3de99a Binary files /dev/null and b/effects/LightAll3.efkefc differ diff --git a/effects/LightOne1.efkefc b/effects/LightOne1.efkefc new file mode 100644 index 0000000..9c35111 Binary files /dev/null and b/effects/LightOne1.efkefc differ diff --git a/effects/LightOne2.efkefc b/effects/LightOne2.efkefc new file mode 100644 index 0000000..51f9e3f Binary files /dev/null and b/effects/LightOne2.efkefc differ diff --git a/effects/LightPillar1.efkefc b/effects/LightPillar1.efkefc new file mode 100644 index 0000000..673fb37 Binary files /dev/null and b/effects/LightPillar1.efkefc differ diff --git a/effects/LightPillar2.efkefc b/effects/LightPillar2.efkefc new file mode 100644 index 0000000..4ad481d Binary files /dev/null and b/effects/LightPillar2.efkefc differ diff --git a/effects/Model/Ball.efkmodel b/effects/Model/Ball.efkmodel new file mode 100644 index 0000000..47ee1a4 Binary files /dev/null and b/effects/Model/Ball.efkmodel differ diff --git a/effects/Model/NightHand1.efkmodel b/effects/Model/NightHand1.efkmodel new file mode 100644 index 0000000..55d71aa Binary files /dev/null and b/effects/Model/NightHand1.efkmodel differ diff --git a/effects/Model/NightHand2.efkmodel b/effects/Model/NightHand2.efkmodel new file mode 100644 index 0000000..7b2eb96 Binary files /dev/null and b/effects/Model/NightHand2.efkmodel differ diff --git a/effects/Model/NightHand3.efkmodel b/effects/Model/NightHand3.efkmodel new file mode 100644 index 0000000..f65e9df Binary files /dev/null and b/effects/Model/NightHand3.efkmodel differ diff --git a/effects/Model/NightHand4.efkmodel b/effects/Model/NightHand4.efkmodel new file mode 100644 index 0000000..868f14e Binary files /dev/null and b/effects/Model/NightHand4.efkmodel differ diff --git a/effects/Model/Shield.efkmodel b/effects/Model/Shield.efkmodel new file mode 100644 index 0000000..3ee998e Binary files /dev/null and b/effects/Model/Shield.efkmodel differ diff --git a/effects/Model/Skull.efkmodel b/effects/Model/Skull.efkmodel new file mode 100644 index 0000000..6734252 Binary files /dev/null and b/effects/Model/Skull.efkmodel differ diff --git a/effects/NeutralAll1.efkefc b/effects/NeutralAll1.efkefc new file mode 100644 index 0000000..1101f30 Binary files /dev/null and b/effects/NeutralAll1.efkefc differ diff --git a/effects/NeutralAll2.efkefc b/effects/NeutralAll2.efkefc new file mode 100644 index 0000000..b2d1564 Binary files /dev/null and b/effects/NeutralAll2.efkefc differ diff --git a/effects/NeutralAll3.efkefc b/effects/NeutralAll3.efkefc new file mode 100644 index 0000000..dc2e8e6 Binary files /dev/null and b/effects/NeutralAll3.efkefc differ diff --git a/effects/NeutralOne1.efkefc b/effects/NeutralOne1.efkefc new file mode 100644 index 0000000..b777114 Binary files /dev/null and b/effects/NeutralOne1.efkefc differ diff --git a/effects/NeutralOne2.efkefc b/effects/NeutralOne2.efkefc new file mode 100644 index 0000000..e48aa70 Binary files /dev/null and b/effects/NeutralOne2.efkefc differ diff --git a/effects/Paralyze.efkefc b/effects/Paralyze.efkefc new file mode 100644 index 0000000..3d6a99a Binary files /dev/null and b/effects/Paralyze.efkefc differ diff --git a/effects/PierceEffect.efkefc b/effects/PierceEffect.efkefc new file mode 100644 index 0000000..226bb0c Binary files /dev/null and b/effects/PierceEffect.efkefc differ diff --git a/effects/PierceFire.efkefc b/effects/PierceFire.efkefc new file mode 100644 index 0000000..55ab5ed Binary files /dev/null and b/effects/PierceFire.efkefc differ diff --git a/effects/PierceIce.efkefc b/effects/PierceIce.efkefc new file mode 100644 index 0000000..307e59e Binary files /dev/null and b/effects/PierceIce.efkefc differ diff --git a/effects/PiercePhysical.efkefc b/effects/PiercePhysical.efkefc new file mode 100644 index 0000000..a06249f Binary files /dev/null and b/effects/PiercePhysical.efkefc differ diff --git a/effects/PierceSpecial1.efkefc b/effects/PierceSpecial1.efkefc new file mode 100644 index 0000000..35d8979 Binary files /dev/null and b/effects/PierceSpecial1.efkefc differ diff --git a/effects/PierceSpecial2.efkefc b/effects/PierceSpecial2.efkefc new file mode 100644 index 0000000..446d6ed Binary files /dev/null and b/effects/PierceSpecial2.efkefc differ diff --git a/effects/PierceThunder.efkefc b/effects/PierceThunder.efkefc new file mode 100644 index 0000000..208579f Binary files /dev/null and b/effects/PierceThunder.efkefc differ diff --git a/effects/Poison.efkefc b/effects/Poison.efkefc new file mode 100644 index 0000000..1530632 Binary files /dev/null and b/effects/Poison.efkefc differ diff --git a/effects/Pollen.efkefc b/effects/Pollen.efkefc new file mode 100644 index 0000000..9dded37 Binary files /dev/null and b/effects/Pollen.efkefc differ diff --git a/effects/Powerdown1.efkefc b/effects/Powerdown1.efkefc new file mode 100644 index 0000000..9abb81b Binary files /dev/null and b/effects/Powerdown1.efkefc differ diff --git a/effects/Powerdown2.efkefc b/effects/Powerdown2.efkefc new file mode 100644 index 0000000..56dd60d Binary files /dev/null and b/effects/Powerdown2.efkefc differ diff --git a/effects/Powerdown3.efkefc b/effects/Powerdown3.efkefc new file mode 100644 index 0000000..82ef457 Binary files /dev/null and b/effects/Powerdown3.efkefc differ diff --git a/effects/Powerup1.efkefc b/effects/Powerup1.efkefc new file mode 100644 index 0000000..5de4d3e Binary files /dev/null and b/effects/Powerup1.efkefc differ diff --git a/effects/Powerup2.efkefc b/effects/Powerup2.efkefc new file mode 100644 index 0000000..f642e21 Binary files /dev/null and b/effects/Powerup2.efkefc differ diff --git a/effects/Powerup3.efkefc b/effects/Powerup3.efkefc new file mode 100644 index 0000000..c82dfc0 Binary files /dev/null and b/effects/Powerup3.efkefc differ diff --git a/effects/Radiation.efkefc b/effects/Radiation.efkefc new file mode 100644 index 0000000..8d81c41 Binary files /dev/null and b/effects/Radiation.efkefc differ diff --git a/effects/Revive1.efkefc b/effects/Revive1.efkefc new file mode 100644 index 0000000..57605e0 Binary files /dev/null and b/effects/Revive1.efkefc differ diff --git a/effects/Revive2.efkefc b/effects/Revive2.efkefc new file mode 100644 index 0000000..733d3d7 Binary files /dev/null and b/effects/Revive2.efkefc differ diff --git a/effects/ShootAll.efkefc b/effects/ShootAll.efkefc new file mode 100644 index 0000000..027459f Binary files /dev/null and b/effects/ShootAll.efkefc differ diff --git a/effects/ShootBarrage.efkefc b/effects/ShootBarrage.efkefc new file mode 100644 index 0000000..dfe8f42 Binary files /dev/null and b/effects/ShootBarrage.efkefc differ diff --git a/effects/ShootNormal.efkefc b/effects/ShootNormal.efkefc new file mode 100644 index 0000000..69488f8 Binary files /dev/null and b/effects/ShootNormal.efkefc differ diff --git a/effects/ShootSpecial.efkefc b/effects/ShootSpecial.efkefc new file mode 100644 index 0000000..576be40 Binary files /dev/null and b/effects/ShootSpecial.efkefc differ diff --git a/effects/Shout.efkefc b/effects/Shout.efkefc new file mode 100644 index 0000000..d3b7dae Binary files /dev/null and b/effects/Shout.efkefc differ diff --git a/effects/Silence.efkefc b/effects/Silence.efkefc new file mode 100644 index 0000000..f516864 Binary files /dev/null and b/effects/Silence.efkefc differ diff --git a/effects/SlashEffect.efkefc b/effects/SlashEffect.efkefc new file mode 100644 index 0000000..1698067 Binary files /dev/null and b/effects/SlashEffect.efkefc differ diff --git a/effects/SlashFire.efkefc b/effects/SlashFire.efkefc new file mode 100644 index 0000000..d3890dc Binary files /dev/null and b/effects/SlashFire.efkefc differ diff --git a/effects/SlashIce.efkefc b/effects/SlashIce.efkefc new file mode 100644 index 0000000..68aea72 Binary files /dev/null and b/effects/SlashIce.efkefc differ diff --git a/effects/SlashPhysical.efkefc b/effects/SlashPhysical.efkefc new file mode 100644 index 0000000..de4d3ff Binary files /dev/null and b/effects/SlashPhysical.efkefc differ diff --git a/effects/SlashSpecial1.efkefc b/effects/SlashSpecial1.efkefc new file mode 100644 index 0000000..81a8e5a Binary files /dev/null and b/effects/SlashSpecial1.efkefc differ diff --git a/effects/SlashSpecial2.efkefc b/effects/SlashSpecial2.efkefc new file mode 100644 index 0000000..0fbcb3a Binary files /dev/null and b/effects/SlashSpecial2.efkefc differ diff --git a/effects/SlashSpecial3.efkefc b/effects/SlashSpecial3.efkefc new file mode 100644 index 0000000..7e8cf17 Binary files /dev/null and b/effects/SlashSpecial3.efkefc differ diff --git a/effects/SlashThunder.efkefc b/effects/SlashThunder.efkefc new file mode 100644 index 0000000..8bff924 Binary files /dev/null and b/effects/SlashThunder.efkefc differ diff --git a/effects/Sleep.efkefc b/effects/Sleep.efkefc new file mode 100644 index 0000000..fbc030e Binary files /dev/null and b/effects/Sleep.efkefc differ diff --git a/effects/Song.efkefc b/effects/Song.efkefc new file mode 100644 index 0000000..865406b Binary files /dev/null and b/effects/Song.efkefc differ diff --git a/effects/SonicWave.efkefc b/effects/SonicWave.efkefc new file mode 100644 index 0000000..21762fc Binary files /dev/null and b/effects/SonicWave.efkefc differ diff --git a/effects/Sweep.efkefc b/effects/Sweep.efkefc new file mode 100644 index 0000000..37df562 Binary files /dev/null and b/effects/Sweep.efkefc differ diff --git a/effects/Texture/Arrow.png b/effects/Texture/Arrow.png new file mode 100644 index 0000000..31b027b Binary files /dev/null and b/effects/Texture/Arrow.png differ diff --git a/effects/Texture/Circle.png b/effects/Texture/Circle.png new file mode 100644 index 0000000..d0ee566 Binary files /dev/null and b/effects/Texture/Circle.png differ diff --git a/effects/Texture/Feather.png b/effects/Texture/Feather.png new file mode 100644 index 0000000..86a43aa Binary files /dev/null and b/effects/Texture/Feather.png differ diff --git a/effects/Texture/Flower.png b/effects/Texture/Flower.png new file mode 100644 index 0000000..78150e2 Binary files /dev/null and b/effects/Texture/Flower.png differ diff --git a/effects/Texture/Fog.png b/effects/Texture/Fog.png new file mode 100644 index 0000000..6cbae74 Binary files /dev/null and b/effects/Texture/Fog.png differ diff --git a/effects/Texture/HexCircle.png b/effects/Texture/HexCircle.png new file mode 100644 index 0000000..50393ae Binary files /dev/null and b/effects/Texture/HexCircle.png differ diff --git a/effects/Texture/IceRock.png b/effects/Texture/IceRock.png new file mode 100644 index 0000000..bf949c4 Binary files /dev/null and b/effects/Texture/IceRock.png differ diff --git a/effects/Texture/LightRing.png b/effects/Texture/LightRing.png new file mode 100644 index 0000000..6e43845 Binary files /dev/null and b/effects/Texture/LightRing.png differ diff --git a/effects/Texture/Line1.png b/effects/Texture/Line1.png new file mode 100644 index 0000000..9f2dca0 Binary files /dev/null and b/effects/Texture/Line1.png differ diff --git a/effects/Texture/Line2.png b/effects/Texture/Line2.png new file mode 100644 index 0000000..ec90cc2 Binary files /dev/null and b/effects/Texture/Line2.png differ diff --git a/effects/Texture/Monster1.png b/effects/Texture/Monster1.png new file mode 100644 index 0000000..338cbcd Binary files /dev/null and b/effects/Texture/Monster1.png differ diff --git a/effects/Texture/Monster2.png b/effects/Texture/Monster2.png new file mode 100644 index 0000000..6cef345 Binary files /dev/null and b/effects/Texture/Monster2.png differ diff --git a/effects/Texture/Monster3.png b/effects/Texture/Monster3.png new file mode 100644 index 0000000..cd632f5 Binary files /dev/null and b/effects/Texture/Monster3.png differ diff --git a/effects/Texture/Note1.png b/effects/Texture/Note1.png new file mode 100644 index 0000000..0ed1514 Binary files /dev/null and b/effects/Texture/Note1.png differ diff --git a/effects/Texture/Note2.png b/effects/Texture/Note2.png new file mode 100644 index 0000000..ac245f1 Binary files /dev/null and b/effects/Texture/Note2.png differ diff --git a/effects/Texture/Note3.png b/effects/Texture/Note3.png new file mode 100644 index 0000000..8b3ddbe Binary files /dev/null and b/effects/Texture/Note3.png differ diff --git a/effects/Texture/Note4.png b/effects/Texture/Note4.png new file mode 100644 index 0000000..bb188ab Binary files /dev/null and b/effects/Texture/Note4.png differ diff --git a/effects/Texture/Particle100.png b/effects/Texture/Particle100.png new file mode 100644 index 0000000..947fd3f Binary files /dev/null and b/effects/Texture/Particle100.png differ diff --git a/effects/Texture/ParticleAlpha.png b/effects/Texture/ParticleAlpha.png new file mode 100644 index 0000000..b4fe9bc Binary files /dev/null and b/effects/Texture/ParticleAlpha.png differ diff --git a/effects/Texture/Period.png b/effects/Texture/Period.png new file mode 100644 index 0000000..a5e29fe Binary files /dev/null and b/effects/Texture/Period.png differ diff --git a/effects/Texture/Rhombus1.png b/effects/Texture/Rhombus1.png new file mode 100644 index 0000000..f5278f6 Binary files /dev/null and b/effects/Texture/Rhombus1.png differ diff --git a/effects/Texture/Rhombus2.png b/effects/Texture/Rhombus2.png new file mode 100644 index 0000000..78ee5f0 Binary files /dev/null and b/effects/Texture/Rhombus2.png differ diff --git a/effects/Texture/Ring.png b/effects/Texture/Ring.png new file mode 100644 index 0000000..3128681 Binary files /dev/null and b/effects/Texture/Ring.png differ diff --git a/effects/Texture/Rock.png b/effects/Texture/Rock.png new file mode 100644 index 0000000..3a872e7 Binary files /dev/null and b/effects/Texture/Rock.png differ diff --git a/effects/Texture/Shield.png b/effects/Texture/Shield.png new file mode 100644 index 0000000..3199cd5 Binary files /dev/null and b/effects/Texture/Shield.png differ diff --git a/effects/Texture/ShockWave1.png b/effects/Texture/ShockWave1.png new file mode 100644 index 0000000..37a533d Binary files /dev/null and b/effects/Texture/ShockWave1.png differ diff --git a/effects/Texture/ShockWave2.png b/effects/Texture/ShockWave2.png new file mode 100644 index 0000000..07f711c Binary files /dev/null and b/effects/Texture/ShockWave2.png differ diff --git a/effects/Texture/ShockWaveRing1.png b/effects/Texture/ShockWaveRing1.png new file mode 100644 index 0000000..01fbf4e Binary files /dev/null and b/effects/Texture/ShockWaveRing1.png differ diff --git a/effects/Texture/ShockWaveRing2.png b/effects/Texture/ShockWaveRing2.png new file mode 100644 index 0000000..4c98ec9 Binary files /dev/null and b/effects/Texture/ShockWaveRing2.png differ diff --git a/effects/Texture/Slash1.png b/effects/Texture/Slash1.png new file mode 100644 index 0000000..721f68a Binary files /dev/null and b/effects/Texture/Slash1.png differ diff --git a/effects/Texture/Slash2.png b/effects/Texture/Slash2.png new file mode 100644 index 0000000..c1d55a9 Binary files /dev/null and b/effects/Texture/Slash2.png differ diff --git a/effects/Texture/Snow.png b/effects/Texture/Snow.png new file mode 100644 index 0000000..1d019b9 Binary files /dev/null and b/effects/Texture/Snow.png differ diff --git a/effects/Texture/Special3_1.png b/effects/Texture/Special3_1.png new file mode 100644 index 0000000..66caa0d Binary files /dev/null and b/effects/Texture/Special3_1.png differ diff --git a/effects/Texture/Special3_2.png b/effects/Texture/Special3_2.png new file mode 100644 index 0000000..0f95c4e Binary files /dev/null and b/effects/Texture/Special3_2.png differ diff --git a/effects/Texture/Special3_3.png b/effects/Texture/Special3_3.png new file mode 100644 index 0000000..aa6de41 Binary files /dev/null and b/effects/Texture/Special3_3.png differ diff --git a/effects/Texture/Special3_4.png b/effects/Texture/Special3_4.png new file mode 100644 index 0000000..60f7e51 Binary files /dev/null and b/effects/Texture/Special3_4.png differ diff --git a/effects/Texture/Sphere.png b/effects/Texture/Sphere.png new file mode 100644 index 0000000..bdaa6e0 Binary files /dev/null and b/effects/Texture/Sphere.png differ diff --git a/effects/Texture/Spin.png b/effects/Texture/Spin.png new file mode 100644 index 0000000..1bc0a5d Binary files /dev/null and b/effects/Texture/Spin.png differ diff --git a/effects/Texture/Star.png b/effects/Texture/Star.png new file mode 100644 index 0000000..99f125d Binary files /dev/null and b/effects/Texture/Star.png differ diff --git a/effects/Texture/Star2.png b/effects/Texture/Star2.png new file mode 100644 index 0000000..6fc6bd4 Binary files /dev/null and b/effects/Texture/Star2.png differ diff --git a/effects/Texture/Thorns.png b/effects/Texture/Thorns.png new file mode 100644 index 0000000..44f6a32 Binary files /dev/null and b/effects/Texture/Thorns.png differ diff --git a/effects/Texture/ThunderC.png b/effects/Texture/ThunderC.png new file mode 100644 index 0000000..a733b8c Binary files /dev/null and b/effects/Texture/ThunderC.png differ diff --git a/effects/Texture/ThunderH.png b/effects/Texture/ThunderH.png new file mode 100644 index 0000000..833ea4f Binary files /dev/null and b/effects/Texture/ThunderH.png differ diff --git a/effects/Texture/ThunderV.png b/effects/Texture/ThunderV.png new file mode 100644 index 0000000..0d11d6b Binary files /dev/null and b/effects/Texture/ThunderV.png differ diff --git a/effects/Texture/Wind.png b/effects/Texture/Wind.png new file mode 100644 index 0000000..4b8bb5b Binary files /dev/null and b/effects/Texture/Wind.png differ diff --git a/effects/Texture/WindMark.png b/effects/Texture/WindMark.png new file mode 100644 index 0000000..274a1d1 Binary files /dev/null and b/effects/Texture/WindMark.png differ diff --git a/effects/Texture/WingL.png b/effects/Texture/WingL.png new file mode 100644 index 0000000..9f16580 Binary files /dev/null and b/effects/Texture/WingL.png differ diff --git a/effects/Texture/WingR.png b/effects/Texture/WingR.png new file mode 100644 index 0000000..7794951 Binary files /dev/null and b/effects/Texture/WingR.png differ diff --git a/effects/ThunderAll1.efkefc b/effects/ThunderAll1.efkefc new file mode 100644 index 0000000..b8c002a Binary files /dev/null and b/effects/ThunderAll1.efkefc differ diff --git a/effects/ThunderAll2.efkefc b/effects/ThunderAll2.efkefc new file mode 100644 index 0000000..87e84d5 Binary files /dev/null and b/effects/ThunderAll2.efkefc differ diff --git a/effects/ThunderAll3.efkefc b/effects/ThunderAll3.efkefc new file mode 100644 index 0000000..373fc14 Binary files /dev/null and b/effects/ThunderAll3.efkefc differ diff --git a/effects/ThunderOne1.efkefc b/effects/ThunderOne1.efkefc new file mode 100644 index 0000000..a6b5453 Binary files /dev/null and b/effects/ThunderOne1.efkefc differ diff --git a/effects/ThunderOne2.efkefc b/effects/ThunderOne2.efkefc new file mode 100644 index 0000000..6f33e23 Binary files /dev/null and b/effects/ThunderOne2.efkefc differ diff --git a/effects/WaterAll1.efkefc b/effects/WaterAll1.efkefc new file mode 100644 index 0000000..75b7cbd Binary files /dev/null and b/effects/WaterAll1.efkefc differ diff --git a/effects/WaterAll2.efkefc b/effects/WaterAll2.efkefc new file mode 100644 index 0000000..e9b0a05 Binary files /dev/null and b/effects/WaterAll2.efkefc differ diff --git a/effects/WaterAll3.efkefc b/effects/WaterAll3.efkefc new file mode 100644 index 0000000..f750eaf Binary files /dev/null and b/effects/WaterAll3.efkefc differ diff --git a/effects/WaterOne1.efkefc b/effects/WaterOne1.efkefc new file mode 100644 index 0000000..e9962be Binary files /dev/null and b/effects/WaterOne1.efkefc differ diff --git a/effects/WaterOne2.efkefc b/effects/WaterOne2.efkefc new file mode 100644 index 0000000..6d33924 Binary files /dev/null and b/effects/WaterOne2.efkefc differ diff --git a/effects/WindAll1.efkefc b/effects/WindAll1.efkefc new file mode 100644 index 0000000..a4a37cc Binary files /dev/null and b/effects/WindAll1.efkefc differ diff --git a/effects/WindAll2.efkefc b/effects/WindAll2.efkefc new file mode 100644 index 0000000..c309ca8 Binary files /dev/null and b/effects/WindAll2.efkefc differ diff --git a/effects/WindAll3.efkefc b/effects/WindAll3.efkefc new file mode 100644 index 0000000..121e214 Binary files /dev/null and b/effects/WindAll3.efkefc differ diff --git a/effects/WindOne1.efkefc b/effects/WindOne1.efkefc new file mode 100644 index 0000000..0c41814 Binary files /dev/null and b/effects/WindOne1.efkefc differ diff --git a/effects/WindOne2.efkefc b/effects/WindOne2.efkefc new file mode 100644 index 0000000..88a9f84 Binary files /dev/null and b/effects/WindOne2.efkefc differ diff --git a/fonts/mplus-1m-regular.woff b/fonts/mplus-1m-regular.woff new file mode 100644 index 0000000..5c7fcc0 Binary files /dev/null and b/fonts/mplus-1m-regular.woff differ diff --git a/fonts/mplus-2p-bold-sub.woff b/fonts/mplus-2p-bold-sub.woff new file mode 100644 index 0000000..1f5b7da Binary files /dev/null and b/fonts/mplus-2p-bold-sub.woff differ diff --git a/game.rmmzproject b/game.rmmzproject new file mode 100644 index 0000000..4567ea1 --- /dev/null +++ b/game.rmmzproject @@ -0,0 +1 @@ +RPGMZ 1.8.1 \ No newline at end of file diff --git a/icon/icon.png b/icon/icon.png new file mode 100644 index 0000000..57f74a7 Binary files /dev/null and b/icon/icon.png differ diff --git a/img/battlebacks1/Castle1.png b/img/battlebacks1/Castle1.png new file mode 100644 index 0000000..c4be94f Binary files /dev/null and b/img/battlebacks1/Castle1.png differ diff --git a/img/battlebacks1/Castle2.png b/img/battlebacks1/Castle2.png new file mode 100644 index 0000000..b82674b Binary files /dev/null and b/img/battlebacks1/Castle2.png differ diff --git a/img/battlebacks1/Castle3.png b/img/battlebacks1/Castle3.png new file mode 100644 index 0000000..f37e727 Binary files /dev/null and b/img/battlebacks1/Castle3.png differ diff --git a/img/battlebacks1/Clouds.png b/img/battlebacks1/Clouds.png new file mode 100644 index 0000000..6434345 Binary files /dev/null and b/img/battlebacks1/Clouds.png differ diff --git a/img/battlebacks1/Cobblestones1.png b/img/battlebacks1/Cobblestones1.png new file mode 100644 index 0000000..4100d46 Binary files /dev/null and b/img/battlebacks1/Cobblestones1.png differ diff --git a/img/battlebacks1/Cobblestones2.png b/img/battlebacks1/Cobblestones2.png new file mode 100644 index 0000000..836fe88 Binary files /dev/null and b/img/battlebacks1/Cobblestones2.png differ diff --git a/img/battlebacks1/Cobblestones3.png b/img/battlebacks1/Cobblestones3.png new file mode 100644 index 0000000..0c37c62 Binary files /dev/null and b/img/battlebacks1/Cobblestones3.png differ diff --git a/img/battlebacks1/Cobblestones4.png b/img/battlebacks1/Cobblestones4.png new file mode 100644 index 0000000..807563a Binary files /dev/null and b/img/battlebacks1/Cobblestones4.png differ diff --git a/img/battlebacks1/Cobblestones5.png b/img/battlebacks1/Cobblestones5.png new file mode 100644 index 0000000..8f35a3a Binary files /dev/null and b/img/battlebacks1/Cobblestones5.png differ diff --git a/img/battlebacks1/Colosseum.png b/img/battlebacks1/Colosseum.png new file mode 100644 index 0000000..d2c42cb Binary files /dev/null and b/img/battlebacks1/Colosseum.png differ diff --git a/img/battlebacks1/Crystal.png b/img/battlebacks1/Crystal.png new file mode 100644 index 0000000..2785504 Binary files /dev/null and b/img/battlebacks1/Crystal.png differ diff --git a/img/battlebacks1/Cyberspace.png b/img/battlebacks1/Cyberspace.png new file mode 100644 index 0000000..c8fee35 Binary files /dev/null and b/img/battlebacks1/Cyberspace.png differ diff --git a/img/battlebacks1/DecorativeTile1.png b/img/battlebacks1/DecorativeTile1.png new file mode 100644 index 0000000..f968e38 Binary files /dev/null and b/img/battlebacks1/DecorativeTile1.png differ diff --git a/img/battlebacks1/DecorativeTile2.png b/img/battlebacks1/DecorativeTile2.png new file mode 100644 index 0000000..86862f1 Binary files /dev/null and b/img/battlebacks1/DecorativeTile2.png differ diff --git a/img/battlebacks1/DemonCastle1.png b/img/battlebacks1/DemonCastle1.png new file mode 100644 index 0000000..676ddb3 Binary files /dev/null and b/img/battlebacks1/DemonCastle1.png differ diff --git a/img/battlebacks1/DemonCastle2.png b/img/battlebacks1/DemonCastle2.png new file mode 100644 index 0000000..3cf9c8c Binary files /dev/null and b/img/battlebacks1/DemonCastle2.png differ diff --git a/img/battlebacks1/DemonCastle3.png b/img/battlebacks1/DemonCastle3.png new file mode 100644 index 0000000..e2bf1dd Binary files /dev/null and b/img/battlebacks1/DemonCastle3.png differ diff --git a/img/battlebacks1/DemonicWorld.png b/img/battlebacks1/DemonicWorld.png new file mode 100644 index 0000000..0b45d59 Binary files /dev/null and b/img/battlebacks1/DemonicWorld.png differ diff --git a/img/battlebacks1/Desert.png b/img/battlebacks1/Desert.png new file mode 100644 index 0000000..f76dddf Binary files /dev/null and b/img/battlebacks1/Desert.png differ diff --git a/img/battlebacks1/Dirt.png b/img/battlebacks1/Dirt.png new file mode 100644 index 0000000..55b6754 Binary files /dev/null and b/img/battlebacks1/Dirt.png differ diff --git a/img/battlebacks1/DirtCave.png b/img/battlebacks1/DirtCave.png new file mode 100644 index 0000000..408c9db Binary files /dev/null and b/img/battlebacks1/DirtCave.png differ diff --git a/img/battlebacks1/DirtField.png b/img/battlebacks1/DirtField.png new file mode 100644 index 0000000..5d3e2c5 Binary files /dev/null and b/img/battlebacks1/DirtField.png differ diff --git a/img/battlebacks1/Fort1.png b/img/battlebacks1/Fort1.png new file mode 100644 index 0000000..77d52a9 Binary files /dev/null and b/img/battlebacks1/Fort1.png differ diff --git a/img/battlebacks1/Fort2.png b/img/battlebacks1/Fort2.png new file mode 100644 index 0000000..564d29a Binary files /dev/null and b/img/battlebacks1/Fort2.png differ diff --git a/img/battlebacks1/GrassMaze.png b/img/battlebacks1/GrassMaze.png new file mode 100644 index 0000000..768f4ef Binary files /dev/null and b/img/battlebacks1/GrassMaze.png differ diff --git a/img/battlebacks1/Grassland.png b/img/battlebacks1/Grassland.png new file mode 100644 index 0000000..3873bf6 Binary files /dev/null and b/img/battlebacks1/Grassland.png differ diff --git a/img/battlebacks1/Ground1.png b/img/battlebacks1/Ground1.png new file mode 100644 index 0000000..5c27c5e Binary files /dev/null and b/img/battlebacks1/Ground1.png differ diff --git a/img/battlebacks1/Ground2.png b/img/battlebacks1/Ground2.png new file mode 100644 index 0000000..ba4062b Binary files /dev/null and b/img/battlebacks1/Ground2.png differ diff --git a/img/battlebacks1/IceCave.png b/img/battlebacks1/IceCave.png new file mode 100644 index 0000000..0d136ed Binary files /dev/null and b/img/battlebacks1/IceCave.png differ diff --git a/img/battlebacks1/IceMaze.png b/img/battlebacks1/IceMaze.png new file mode 100644 index 0000000..4e6b616 Binary files /dev/null and b/img/battlebacks1/IceMaze.png differ diff --git a/img/battlebacks1/Lava1.png b/img/battlebacks1/Lava1.png new file mode 100644 index 0000000..fe82d71 Binary files /dev/null and b/img/battlebacks1/Lava1.png differ diff --git a/img/battlebacks1/Lava2.png b/img/battlebacks1/Lava2.png new file mode 100644 index 0000000..bd8d0ed Binary files /dev/null and b/img/battlebacks1/Lava2.png differ diff --git a/img/battlebacks1/LavaCave.png b/img/battlebacks1/LavaCave.png new file mode 100644 index 0000000..03a3445 Binary files /dev/null and b/img/battlebacks1/LavaCave.png differ diff --git a/img/battlebacks1/PoisonSwamp.png b/img/battlebacks1/PoisonSwamp.png new file mode 100644 index 0000000..f2fbb94 Binary files /dev/null and b/img/battlebacks1/PoisonSwamp.png differ diff --git a/img/battlebacks1/Road1.png b/img/battlebacks1/Road1.png new file mode 100644 index 0000000..1488a16 Binary files /dev/null and b/img/battlebacks1/Road1.png differ diff --git a/img/battlebacks1/Road2.png b/img/battlebacks1/Road2.png new file mode 100644 index 0000000..738bc8f Binary files /dev/null and b/img/battlebacks1/Road2.png differ diff --git a/img/battlebacks1/Road3.png b/img/battlebacks1/Road3.png new file mode 100644 index 0000000..d5d00c6 Binary files /dev/null and b/img/battlebacks1/Road3.png differ diff --git a/img/battlebacks1/RockCave.png b/img/battlebacks1/RockCave.png new file mode 100644 index 0000000..76cd548 Binary files /dev/null and b/img/battlebacks1/RockCave.png differ diff --git a/img/battlebacks1/Sand.png b/img/battlebacks1/Sand.png new file mode 100644 index 0000000..e78283b Binary files /dev/null and b/img/battlebacks1/Sand.png differ diff --git a/img/battlebacks1/Ship.png b/img/battlebacks1/Ship.png new file mode 100644 index 0000000..9cb9e88 Binary files /dev/null and b/img/battlebacks1/Ship.png differ diff --git a/img/battlebacks1/Smoke.png b/img/battlebacks1/Smoke.png new file mode 100644 index 0000000..b125fc0 Binary files /dev/null and b/img/battlebacks1/Smoke.png differ diff --git a/img/battlebacks1/Snowfield.png b/img/battlebacks1/Snowfield.png new file mode 100644 index 0000000..823082f Binary files /dev/null and b/img/battlebacks1/Snowfield.png differ diff --git a/img/battlebacks1/Space.png b/img/battlebacks1/Space.png new file mode 100644 index 0000000..427ae81 Binary files /dev/null and b/img/battlebacks1/Space.png differ diff --git a/img/battlebacks1/Stone1.png b/img/battlebacks1/Stone1.png new file mode 100644 index 0000000..a146f91 Binary files /dev/null and b/img/battlebacks1/Stone1.png differ diff --git a/img/battlebacks1/Stone2.png b/img/battlebacks1/Stone2.png new file mode 100644 index 0000000..ce996ba Binary files /dev/null and b/img/battlebacks1/Stone2.png differ diff --git a/img/battlebacks1/Stone3.png b/img/battlebacks1/Stone3.png new file mode 100644 index 0000000..23a39bc Binary files /dev/null and b/img/battlebacks1/Stone3.png differ diff --git a/img/battlebacks1/Temple.png b/img/battlebacks1/Temple.png new file mode 100644 index 0000000..c24bd6d Binary files /dev/null and b/img/battlebacks1/Temple.png differ diff --git a/img/battlebacks1/Tent.png b/img/battlebacks1/Tent.png new file mode 100644 index 0000000..d5020e5 Binary files /dev/null and b/img/battlebacks1/Tent.png differ diff --git a/img/battlebacks1/Wasteland.png b/img/battlebacks1/Wasteland.png new file mode 100644 index 0000000..892c7d1 Binary files /dev/null and b/img/battlebacks1/Wasteland.png differ diff --git a/img/battlebacks1/Wood1.png b/img/battlebacks1/Wood1.png new file mode 100644 index 0000000..9c4fdc2 Binary files /dev/null and b/img/battlebacks1/Wood1.png differ diff --git a/img/battlebacks1/Wood2.png b/img/battlebacks1/Wood2.png new file mode 100644 index 0000000..271fb3f Binary files /dev/null and b/img/battlebacks1/Wood2.png differ diff --git a/img/battlebacks2/Brick.png b/img/battlebacks2/Brick.png new file mode 100644 index 0000000..26bd07c Binary files /dev/null and b/img/battlebacks2/Brick.png differ diff --git a/img/battlebacks2/Bridge.png b/img/battlebacks2/Bridge.png new file mode 100644 index 0000000..c174e1c Binary files /dev/null and b/img/battlebacks2/Bridge.png differ diff --git a/img/battlebacks2/Castle1.png b/img/battlebacks2/Castle1.png new file mode 100644 index 0000000..6c32496 Binary files /dev/null and b/img/battlebacks2/Castle1.png differ diff --git a/img/battlebacks2/Castle2.png b/img/battlebacks2/Castle2.png new file mode 100644 index 0000000..39ab2cd Binary files /dev/null and b/img/battlebacks2/Castle2.png differ diff --git a/img/battlebacks2/Castle3.png b/img/battlebacks2/Castle3.png new file mode 100644 index 0000000..ffdafe6 Binary files /dev/null and b/img/battlebacks2/Castle3.png differ diff --git a/img/battlebacks2/Cliff.png b/img/battlebacks2/Cliff.png new file mode 100644 index 0000000..fca2a59 Binary files /dev/null and b/img/battlebacks2/Cliff.png differ diff --git a/img/battlebacks2/Clouds.png b/img/battlebacks2/Clouds.png new file mode 100644 index 0000000..2a5abda Binary files /dev/null and b/img/battlebacks2/Clouds.png differ diff --git a/img/battlebacks2/Colosseum.png b/img/battlebacks2/Colosseum.png new file mode 100644 index 0000000..6ece516 Binary files /dev/null and b/img/battlebacks2/Colosseum.png differ diff --git a/img/battlebacks2/Crystal.png b/img/battlebacks2/Crystal.png new file mode 100644 index 0000000..c22323a Binary files /dev/null and b/img/battlebacks2/Crystal.png differ diff --git a/img/battlebacks2/Cyberspace.png b/img/battlebacks2/Cyberspace.png new file mode 100644 index 0000000..f7c46c0 Binary files /dev/null and b/img/battlebacks2/Cyberspace.png differ diff --git a/img/battlebacks2/DarkSpace.png b/img/battlebacks2/DarkSpace.png new file mode 100644 index 0000000..7638947 Binary files /dev/null and b/img/battlebacks2/DarkSpace.png differ diff --git a/img/battlebacks2/DemonCastle1.png b/img/battlebacks2/DemonCastle1.png new file mode 100644 index 0000000..b1d4286 Binary files /dev/null and b/img/battlebacks2/DemonCastle1.png differ diff --git a/img/battlebacks2/DemonCastle2.png b/img/battlebacks2/DemonCastle2.png new file mode 100644 index 0000000..8df9da0 Binary files /dev/null and b/img/battlebacks2/DemonCastle2.png differ diff --git a/img/battlebacks2/DemonCastle3.png b/img/battlebacks2/DemonCastle3.png new file mode 100644 index 0000000..f0af09a Binary files /dev/null and b/img/battlebacks2/DemonCastle3.png differ diff --git a/img/battlebacks2/DemonicWorld.png b/img/battlebacks2/DemonicWorld.png new file mode 100644 index 0000000..5490f62 Binary files /dev/null and b/img/battlebacks2/DemonicWorld.png differ diff --git a/img/battlebacks2/Desert.png b/img/battlebacks2/Desert.png new file mode 100644 index 0000000..b55051d Binary files /dev/null and b/img/battlebacks2/Desert.png differ diff --git a/img/battlebacks2/DirtCave.png b/img/battlebacks2/DirtCave.png new file mode 100644 index 0000000..b6d0643 Binary files /dev/null and b/img/battlebacks2/DirtCave.png differ diff --git a/img/battlebacks2/Forest.png b/img/battlebacks2/Forest.png new file mode 100644 index 0000000..743741d Binary files /dev/null and b/img/battlebacks2/Forest.png differ diff --git a/img/battlebacks2/Fort1.png b/img/battlebacks2/Fort1.png new file mode 100644 index 0000000..05dae78 Binary files /dev/null and b/img/battlebacks2/Fort1.png differ diff --git a/img/battlebacks2/Fort2.png b/img/battlebacks2/Fort2.png new file mode 100644 index 0000000..0d6ce36 Binary files /dev/null and b/img/battlebacks2/Fort2.png differ diff --git a/img/battlebacks2/GrassMaze.png b/img/battlebacks2/GrassMaze.png new file mode 100644 index 0000000..b67e27a Binary files /dev/null and b/img/battlebacks2/GrassMaze.png differ diff --git a/img/battlebacks2/Grassland.png b/img/battlebacks2/Grassland.png new file mode 100644 index 0000000..8ed3603 Binary files /dev/null and b/img/battlebacks2/Grassland.png differ diff --git a/img/battlebacks2/IceCave.png b/img/battlebacks2/IceCave.png new file mode 100644 index 0000000..0a607cb Binary files /dev/null and b/img/battlebacks2/IceCave.png differ diff --git a/img/battlebacks2/IceMaze.png b/img/battlebacks2/IceMaze.png new file mode 100644 index 0000000..ea65d69 Binary files /dev/null and b/img/battlebacks2/IceMaze.png differ diff --git a/img/battlebacks2/Lava.png b/img/battlebacks2/Lava.png new file mode 100644 index 0000000..a99ba1c Binary files /dev/null and b/img/battlebacks2/Lava.png differ diff --git a/img/battlebacks2/LavaCave.png b/img/battlebacks2/LavaCave.png new file mode 100644 index 0000000..7fda535 Binary files /dev/null and b/img/battlebacks2/LavaCave.png differ diff --git a/img/battlebacks2/PoisonSwamp.png b/img/battlebacks2/PoisonSwamp.png new file mode 100644 index 0000000..41df320 Binary files /dev/null and b/img/battlebacks2/PoisonSwamp.png differ diff --git a/img/battlebacks2/Port.png b/img/battlebacks2/Port.png new file mode 100644 index 0000000..d9caedd Binary files /dev/null and b/img/battlebacks2/Port.png differ diff --git a/img/battlebacks2/RockCave.png b/img/battlebacks2/RockCave.png new file mode 100644 index 0000000..386f98f Binary files /dev/null and b/img/battlebacks2/RockCave.png differ diff --git a/img/battlebacks2/Room1.png b/img/battlebacks2/Room1.png new file mode 100644 index 0000000..5fe21c0 Binary files /dev/null and b/img/battlebacks2/Room1.png differ diff --git a/img/battlebacks2/Room2.png b/img/battlebacks2/Room2.png new file mode 100644 index 0000000..de72f61 Binary files /dev/null and b/img/battlebacks2/Room2.png differ diff --git a/img/battlebacks2/Room3.png b/img/battlebacks2/Room3.png new file mode 100644 index 0000000..a650414 Binary files /dev/null and b/img/battlebacks2/Room3.png differ diff --git a/img/battlebacks2/Ruins1.png b/img/battlebacks2/Ruins1.png new file mode 100644 index 0000000..0e04bf7 Binary files /dev/null and b/img/battlebacks2/Ruins1.png differ diff --git a/img/battlebacks2/Ruins2.png b/img/battlebacks2/Ruins2.png new file mode 100644 index 0000000..6c5f88f Binary files /dev/null and b/img/battlebacks2/Ruins2.png differ diff --git a/img/battlebacks2/Ruins3.png b/img/battlebacks2/Ruins3.png new file mode 100644 index 0000000..6d7825c Binary files /dev/null and b/img/battlebacks2/Ruins3.png differ diff --git a/img/battlebacks2/Ship.png b/img/battlebacks2/Ship.png new file mode 100644 index 0000000..db03f7a Binary files /dev/null and b/img/battlebacks2/Ship.png differ diff --git a/img/battlebacks2/Smoke.png b/img/battlebacks2/Smoke.png new file mode 100644 index 0000000..a4bd12c Binary files /dev/null and b/img/battlebacks2/Smoke.png differ diff --git a/img/battlebacks2/Snowfield.png b/img/battlebacks2/Snowfield.png new file mode 100644 index 0000000..4c8e1b5 Binary files /dev/null and b/img/battlebacks2/Snowfield.png differ diff --git a/img/battlebacks2/Stone1.png b/img/battlebacks2/Stone1.png new file mode 100644 index 0000000..5712881 Binary files /dev/null and b/img/battlebacks2/Stone1.png differ diff --git a/img/battlebacks2/Stone2.png b/img/battlebacks2/Stone2.png new file mode 100644 index 0000000..d8a2de1 Binary files /dev/null and b/img/battlebacks2/Stone2.png differ diff --git a/img/battlebacks2/Stone3.png b/img/battlebacks2/Stone3.png new file mode 100644 index 0000000..c13f53a Binary files /dev/null and b/img/battlebacks2/Stone3.png differ diff --git a/img/battlebacks2/Temple.png b/img/battlebacks2/Temple.png new file mode 100644 index 0000000..1f1ddb8 Binary files /dev/null and b/img/battlebacks2/Temple.png differ diff --git a/img/battlebacks2/Tent.png b/img/battlebacks2/Tent.png new file mode 100644 index 0000000..72f1b2c Binary files /dev/null and b/img/battlebacks2/Tent.png differ diff --git a/img/battlebacks2/Tower.png b/img/battlebacks2/Tower.png new file mode 100644 index 0000000..3af7579 Binary files /dev/null and b/img/battlebacks2/Tower.png differ diff --git a/img/battlebacks2/Town1.png b/img/battlebacks2/Town1.png new file mode 100644 index 0000000..3849a90 Binary files /dev/null and b/img/battlebacks2/Town1.png differ diff --git a/img/battlebacks2/Town2.png b/img/battlebacks2/Town2.png new file mode 100644 index 0000000..bf8f52e Binary files /dev/null and b/img/battlebacks2/Town2.png differ diff --git a/img/battlebacks2/Town3.png b/img/battlebacks2/Town3.png new file mode 100644 index 0000000..917d579 Binary files /dev/null and b/img/battlebacks2/Town3.png differ diff --git a/img/battlebacks2/Town4.png b/img/battlebacks2/Town4.png new file mode 100644 index 0000000..6fc4e68 Binary files /dev/null and b/img/battlebacks2/Town4.png differ diff --git a/img/battlebacks2/Town5.png b/img/battlebacks2/Town5.png new file mode 100644 index 0000000..30056ca Binary files /dev/null and b/img/battlebacks2/Town5.png differ diff --git a/img/battlebacks2/Wasteland.png b/img/battlebacks2/Wasteland.png new file mode 100644 index 0000000..351af92 Binary files /dev/null and b/img/battlebacks2/Wasteland.png differ diff --git a/img/characters/!$Gate1.png b/img/characters/!$Gate1.png new file mode 100644 index 0000000..e01667a Binary files /dev/null and b/img/characters/!$Gate1.png differ diff --git a/img/characters/!$Gate2.png b/img/characters/!$Gate2.png new file mode 100644 index 0000000..42dd0cf Binary files /dev/null and b/img/characters/!$Gate2.png differ diff --git a/img/characters/!$SF_Gate1.png b/img/characters/!$SF_Gate1.png new file mode 100644 index 0000000..17849e1 Binary files /dev/null and b/img/characters/!$SF_Gate1.png differ diff --git a/img/characters/!$SF_Gate2.png b/img/characters/!$SF_Gate2.png new file mode 100644 index 0000000..9d63ffd Binary files /dev/null and b/img/characters/!$SF_Gate2.png differ diff --git a/img/characters/!$SF_Gate3.png b/img/characters/!$SF_Gate3.png new file mode 100644 index 0000000..9e1bba7 Binary files /dev/null and b/img/characters/!$SF_Gate3.png differ diff --git a/img/characters/!Chest.png b/img/characters/!Chest.png new file mode 100644 index 0000000..280e270 Binary files /dev/null and b/img/characters/!Chest.png differ diff --git a/img/characters/!Crystal.png b/img/characters/!Crystal.png new file mode 100644 index 0000000..223cb16 Binary files /dev/null and b/img/characters/!Crystal.png differ diff --git a/img/characters/!Door1.png b/img/characters/!Door1.png new file mode 100644 index 0000000..5eec503 Binary files /dev/null and b/img/characters/!Door1.png differ diff --git a/img/characters/!Door2.png b/img/characters/!Door2.png new file mode 100644 index 0000000..f08460d Binary files /dev/null and b/img/characters/!Door2.png differ diff --git a/img/characters/!Flame.png b/img/characters/!Flame.png new file mode 100644 index 0000000..bc24f84 Binary files /dev/null and b/img/characters/!Flame.png differ diff --git a/img/characters/!Other1.png b/img/characters/!Other1.png new file mode 100644 index 0000000..f3a2abb Binary files /dev/null and b/img/characters/!Other1.png differ diff --git a/img/characters/!Other2.png b/img/characters/!Other2.png new file mode 100644 index 0000000..9559b3b Binary files /dev/null and b/img/characters/!Other2.png differ diff --git a/img/characters/!SF_Chest.png b/img/characters/!SF_Chest.png new file mode 100644 index 0000000..5eae705 Binary files /dev/null and b/img/characters/!SF_Chest.png differ diff --git a/img/characters/!SF_Door1.png b/img/characters/!SF_Door1.png new file mode 100644 index 0000000..e0cc5c9 Binary files /dev/null and b/img/characters/!SF_Door1.png differ diff --git a/img/characters/!SF_Door2.png b/img/characters/!SF_Door2.png new file mode 100644 index 0000000..01e6d1b Binary files /dev/null and b/img/characters/!SF_Door2.png differ diff --git a/img/characters/!SF_Switch1.png b/img/characters/!SF_Switch1.png new file mode 100644 index 0000000..08fb0cd Binary files /dev/null and b/img/characters/!SF_Switch1.png differ diff --git a/img/characters/!Switch1.png b/img/characters/!Switch1.png new file mode 100644 index 0000000..b1a15c4 Binary files /dev/null and b/img/characters/!Switch1.png differ diff --git a/img/characters/!Switch2.png b/img/characters/!Switch2.png new file mode 100644 index 0000000..6e437ca Binary files /dev/null and b/img/characters/!Switch2.png differ diff --git a/img/characters/!Weapon.png b/img/characters/!Weapon.png new file mode 100644 index 0000000..4f28004 Binary files /dev/null and b/img/characters/!Weapon.png differ diff --git a/img/characters/$BigMonster1.png b/img/characters/$BigMonster1.png new file mode 100644 index 0000000..de7409c Binary files /dev/null and b/img/characters/$BigMonster1.png differ diff --git a/img/characters/$BigMonster2.png b/img/characters/$BigMonster2.png new file mode 100644 index 0000000..2190f69 Binary files /dev/null and b/img/characters/$BigMonster2.png differ diff --git a/img/characters/Actor1.png b/img/characters/Actor1.png new file mode 100644 index 0000000..f2769dc Binary files /dev/null and b/img/characters/Actor1.png differ diff --git a/img/characters/Actor2.png b/img/characters/Actor2.png new file mode 100644 index 0000000..041f11e Binary files /dev/null and b/img/characters/Actor2.png differ diff --git a/img/characters/Actor3.png b/img/characters/Actor3.png new file mode 100644 index 0000000..838ab19 Binary files /dev/null and b/img/characters/Actor3.png differ diff --git a/img/characters/Damage1.png b/img/characters/Damage1.png new file mode 100644 index 0000000..2b6954e Binary files /dev/null and b/img/characters/Damage1.png differ diff --git a/img/characters/Damage2.png b/img/characters/Damage2.png new file mode 100644 index 0000000..c9ba400 Binary files /dev/null and b/img/characters/Damage2.png differ diff --git a/img/characters/Damage3.png b/img/characters/Damage3.png new file mode 100644 index 0000000..46a1943 Binary files /dev/null and b/img/characters/Damage3.png differ diff --git a/img/characters/Evil.png b/img/characters/Evil.png new file mode 100644 index 0000000..8f0c76a Binary files /dev/null and b/img/characters/Evil.png differ diff --git a/img/characters/Monster.png b/img/characters/Monster.png new file mode 100644 index 0000000..86a9961 Binary files /dev/null and b/img/characters/Monster.png differ diff --git a/img/characters/Nature.png b/img/characters/Nature.png new file mode 100644 index 0000000..79e8512 Binary files /dev/null and b/img/characters/Nature.png differ diff --git a/img/characters/People1.png b/img/characters/People1.png new file mode 100644 index 0000000..dbae017 Binary files /dev/null and b/img/characters/People1.png differ diff --git a/img/characters/People2.png b/img/characters/People2.png new file mode 100644 index 0000000..8f08602 Binary files /dev/null and b/img/characters/People2.png differ diff --git a/img/characters/People3.png b/img/characters/People3.png new file mode 100644 index 0000000..aa3fcc1 Binary files /dev/null and b/img/characters/People3.png differ diff --git a/img/characters/People4.png b/img/characters/People4.png new file mode 100644 index 0000000..cdd0851 Binary files /dev/null and b/img/characters/People4.png differ diff --git a/img/characters/SF_Actor1.png b/img/characters/SF_Actor1.png new file mode 100644 index 0000000..e99c0e8 Binary files /dev/null and b/img/characters/SF_Actor1.png differ diff --git a/img/characters/SF_Actor2.png b/img/characters/SF_Actor2.png new file mode 100644 index 0000000..3be702c Binary files /dev/null and b/img/characters/SF_Actor2.png differ diff --git a/img/characters/SF_Actor3.png b/img/characters/SF_Actor3.png new file mode 100644 index 0000000..55974c4 Binary files /dev/null and b/img/characters/SF_Actor3.png differ diff --git a/img/characters/SF_Damage1.png b/img/characters/SF_Damage1.png new file mode 100644 index 0000000..09fb14d Binary files /dev/null and b/img/characters/SF_Damage1.png differ diff --git a/img/characters/SF_Damage2.png b/img/characters/SF_Damage2.png new file mode 100644 index 0000000..784f5ee Binary files /dev/null and b/img/characters/SF_Damage2.png differ diff --git a/img/characters/SF_Monster.png b/img/characters/SF_Monster.png new file mode 100644 index 0000000..ff168d4 Binary files /dev/null and b/img/characters/SF_Monster.png differ diff --git a/img/characters/SF_People1.png b/img/characters/SF_People1.png new file mode 100644 index 0000000..63ee548 Binary files /dev/null and b/img/characters/SF_People1.png differ diff --git a/img/characters/SF_People2.png b/img/characters/SF_People2.png new file mode 100644 index 0000000..989799f Binary files /dev/null and b/img/characters/SF_People2.png differ diff --git a/img/characters/SF_People3.png b/img/characters/SF_People3.png new file mode 100644 index 0000000..937ad26 Binary files /dev/null and b/img/characters/SF_People3.png differ diff --git a/img/characters/SF_Vehicle.png b/img/characters/SF_Vehicle.png new file mode 100644 index 0000000..aca7f42 Binary files /dev/null and b/img/characters/SF_Vehicle.png differ diff --git a/img/characters/Vehicle.png b/img/characters/Vehicle.png new file mode 100644 index 0000000..07e0fc7 Binary files /dev/null and b/img/characters/Vehicle.png differ diff --git a/img/enemies/Actor1_3.png b/img/enemies/Actor1_3.png new file mode 100644 index 0000000..7fa1075 Binary files /dev/null and b/img/enemies/Actor1_3.png differ diff --git a/img/enemies/Actor1_4.png b/img/enemies/Actor1_4.png new file mode 100644 index 0000000..207136b Binary files /dev/null and b/img/enemies/Actor1_4.png differ diff --git a/img/enemies/Actor1_5.png b/img/enemies/Actor1_5.png new file mode 100644 index 0000000..dcb108c Binary files /dev/null and b/img/enemies/Actor1_5.png differ diff --git a/img/enemies/Actor1_6.png b/img/enemies/Actor1_6.png new file mode 100644 index 0000000..f1cc400 Binary files /dev/null and b/img/enemies/Actor1_6.png differ diff --git a/img/enemies/Actor2_1.png b/img/enemies/Actor2_1.png new file mode 100644 index 0000000..394f182 Binary files /dev/null and b/img/enemies/Actor2_1.png differ diff --git a/img/enemies/Actor2_2.png b/img/enemies/Actor2_2.png new file mode 100644 index 0000000..366ad32 Binary files /dev/null and b/img/enemies/Actor2_2.png differ diff --git a/img/enemies/Actor2_3.png b/img/enemies/Actor2_3.png new file mode 100644 index 0000000..3a6cae4 Binary files /dev/null and b/img/enemies/Actor2_3.png differ diff --git a/img/enemies/Actor2_4.png b/img/enemies/Actor2_4.png new file mode 100644 index 0000000..4cc861a Binary files /dev/null and b/img/enemies/Actor2_4.png differ diff --git a/img/enemies/Actor2_5.png b/img/enemies/Actor2_5.png new file mode 100644 index 0000000..a465747 Binary files /dev/null and b/img/enemies/Actor2_5.png differ diff --git a/img/enemies/Actor2_6.png b/img/enemies/Actor2_6.png new file mode 100644 index 0000000..2426c3d Binary files /dev/null and b/img/enemies/Actor2_6.png differ diff --git a/img/enemies/Actor2_7.png b/img/enemies/Actor2_7.png new file mode 100644 index 0000000..dc69a0f Binary files /dev/null and b/img/enemies/Actor2_7.png differ diff --git a/img/enemies/Actor3_1.png b/img/enemies/Actor3_1.png new file mode 100644 index 0000000..f2e0232 Binary files /dev/null and b/img/enemies/Actor3_1.png differ diff --git a/img/enemies/Actor3_2.png b/img/enemies/Actor3_2.png new file mode 100644 index 0000000..e4c8d8a Binary files /dev/null and b/img/enemies/Actor3_2.png differ diff --git a/img/enemies/Actor3_3.png b/img/enemies/Actor3_3.png new file mode 100644 index 0000000..00e6990 Binary files /dev/null and b/img/enemies/Actor3_3.png differ diff --git a/img/enemies/Actor3_4.png b/img/enemies/Actor3_4.png new file mode 100644 index 0000000..f69da50 Binary files /dev/null and b/img/enemies/Actor3_4.png differ diff --git a/img/enemies/Berserker.png b/img/enemies/Berserker.png new file mode 100644 index 0000000..738f119 Binary files /dev/null and b/img/enemies/Berserker.png differ diff --git a/img/enemies/Birdman.png b/img/enemies/Birdman.png new file mode 100644 index 0000000..930b3b6 Binary files /dev/null and b/img/enemies/Birdman.png differ diff --git a/img/enemies/Blackknight.png b/img/enemies/Blackknight.png new file mode 100644 index 0000000..1afb93a Binary files /dev/null and b/img/enemies/Blackknight.png differ diff --git a/img/enemies/Caitsith.png b/img/enemies/Caitsith.png new file mode 100644 index 0000000..39d3338 Binary files /dev/null and b/img/enemies/Caitsith.png differ diff --git a/img/enemies/Captain.png b/img/enemies/Captain.png new file mode 100644 index 0000000..b95055f Binary files /dev/null and b/img/enemies/Captain.png differ diff --git a/img/enemies/Crab.png b/img/enemies/Crab.png new file mode 100644 index 0000000..40aba7b Binary files /dev/null and b/img/enemies/Crab.png differ diff --git a/img/enemies/Crow.png b/img/enemies/Crow.png new file mode 100644 index 0000000..d85fbea Binary files /dev/null and b/img/enemies/Crow.png differ diff --git a/img/enemies/Darkelf.png b/img/enemies/Darkelf.png new file mode 100644 index 0000000..f09326e Binary files /dev/null and b/img/enemies/Darkelf.png differ diff --git a/img/enemies/Demon.png b/img/enemies/Demon.png new file mode 100644 index 0000000..5f19c16 Binary files /dev/null and b/img/enemies/Demon.png differ diff --git a/img/enemies/Demon_metamorphosis.png b/img/enemies/Demon_metamorphosis.png new file mode 100644 index 0000000..f0fd694 Binary files /dev/null and b/img/enemies/Demon_metamorphosis.png differ diff --git a/img/enemies/Demoncount.png b/img/enemies/Demoncount.png new file mode 100644 index 0000000..e14e7eb Binary files /dev/null and b/img/enemies/Demoncount.png differ diff --git a/img/enemies/Demonpot.png b/img/enemies/Demonpot.png new file mode 100644 index 0000000..7df680a Binary files /dev/null and b/img/enemies/Demonpot.png differ diff --git a/img/enemies/Dragon.png b/img/enemies/Dragon.png new file mode 100644 index 0000000..9ba9a49 Binary files /dev/null and b/img/enemies/Dragon.png differ diff --git a/img/enemies/Evilbook.png b/img/enemies/Evilbook.png new file mode 100644 index 0000000..772b1a1 Binary files /dev/null and b/img/enemies/Evilbook.png differ diff --git a/img/enemies/Evilgod.png b/img/enemies/Evilgod.png new file mode 100644 index 0000000..16e25f8 Binary files /dev/null and b/img/enemies/Evilgod.png differ diff --git a/img/enemies/Foxman.png b/img/enemies/Foxman.png new file mode 100644 index 0000000..215c2d7 Binary files /dev/null and b/img/enemies/Foxman.png differ diff --git a/img/enemies/Frilledlizard.png b/img/enemies/Frilledlizard.png new file mode 100644 index 0000000..0da1ddd Binary files /dev/null and b/img/enemies/Frilledlizard.png differ diff --git a/img/enemies/Gatekeeper.png b/img/enemies/Gatekeeper.png new file mode 100644 index 0000000..f654e48 Binary files /dev/null and b/img/enemies/Gatekeeper.png differ diff --git a/img/enemies/Gnome.png b/img/enemies/Gnome.png new file mode 100644 index 0000000..57ed77c Binary files /dev/null and b/img/enemies/Gnome.png differ diff --git a/img/enemies/Goblin.png b/img/enemies/Goblin.png new file mode 100644 index 0000000..68c986c Binary files /dev/null and b/img/enemies/Goblin.png differ diff --git a/img/enemies/God_of_light.png b/img/enemies/God_of_light.png new file mode 100644 index 0000000..c97bdfc Binary files /dev/null and b/img/enemies/God_of_light.png differ diff --git a/img/enemies/Goddess.png b/img/enemies/Goddess.png new file mode 100644 index 0000000..27e8c5d Binary files /dev/null and b/img/enemies/Goddess.png differ diff --git a/img/enemies/Goddess_of_death.png b/img/enemies/Goddess_of_death.png new file mode 100644 index 0000000..5893b29 Binary files /dev/null and b/img/enemies/Goddess_of_death.png differ diff --git a/img/enemies/Hakutaku.png b/img/enemies/Hakutaku.png new file mode 100644 index 0000000..0f39609 Binary files /dev/null and b/img/enemies/Hakutaku.png differ diff --git a/img/enemies/Harpy.png b/img/enemies/Harpy.png new file mode 100644 index 0000000..a5ca3d7 Binary files /dev/null and b/img/enemies/Harpy.png differ diff --git a/img/enemies/Hi_monster.png b/img/enemies/Hi_monster.png new file mode 100644 index 0000000..b263221 Binary files /dev/null and b/img/enemies/Hi_monster.png differ diff --git a/img/enemies/Highking.png b/img/enemies/Highking.png new file mode 100644 index 0000000..9e36805 Binary files /dev/null and b/img/enemies/Highking.png differ diff --git a/img/enemies/Hydra.png b/img/enemies/Hydra.png new file mode 100644 index 0000000..27f47e1 Binary files /dev/null and b/img/enemies/Hydra.png differ diff --git a/img/enemies/Ketos.png b/img/enemies/Ketos.png new file mode 100644 index 0000000..a9cf96e Binary files /dev/null and b/img/enemies/Ketos.png differ diff --git a/img/enemies/Kraken.png b/img/enemies/Kraken.png new file mode 100644 index 0000000..410dd3c Binary files /dev/null and b/img/enemies/Kraken.png differ diff --git a/img/enemies/Lich.png b/img/enemies/Lich.png new file mode 100644 index 0000000..15c9396 Binary files /dev/null and b/img/enemies/Lich.png differ diff --git a/img/enemies/Machinerybee.png b/img/enemies/Machinerybee.png new file mode 100644 index 0000000..52973ef Binary files /dev/null and b/img/enemies/Machinerybee.png differ diff --git a/img/enemies/Matango.png b/img/enemies/Matango.png new file mode 100644 index 0000000..6469832 Binary files /dev/null and b/img/enemies/Matango.png differ diff --git a/img/enemies/Mechascorpion.png b/img/enemies/Mechascorpion.png new file mode 100644 index 0000000..a78add7 Binary files /dev/null and b/img/enemies/Mechascorpion.png differ diff --git a/img/enemies/Medusa.png b/img/enemies/Medusa.png new file mode 100644 index 0000000..e70a554 Binary files /dev/null and b/img/enemies/Medusa.png differ diff --git a/img/enemies/Mercenary.png b/img/enemies/Mercenary.png new file mode 100644 index 0000000..4b1ea0a Binary files /dev/null and b/img/enemies/Mercenary.png differ diff --git a/img/enemies/Mimic.png b/img/enemies/Mimic.png new file mode 100644 index 0000000..56adbd0 Binary files /dev/null and b/img/enemies/Mimic.png differ diff --git a/img/enemies/Oddegg.png b/img/enemies/Oddegg.png new file mode 100644 index 0000000..c078855 Binary files /dev/null and b/img/enemies/Oddegg.png differ diff --git a/img/enemies/Petitdevil.png b/img/enemies/Petitdevil.png new file mode 100644 index 0000000..654914a Binary files /dev/null and b/img/enemies/Petitdevil.png differ diff --git a/img/enemies/Plasma.png b/img/enemies/Plasma.png new file mode 100644 index 0000000..3141401 Binary files /dev/null and b/img/enemies/Plasma.png differ diff --git a/img/enemies/SF_Agent.png b/img/enemies/SF_Agent.png new file mode 100644 index 0000000..fc3ac49 Binary files /dev/null and b/img/enemies/SF_Agent.png differ diff --git a/img/enemies/SF_Anaconda.png b/img/enemies/SF_Anaconda.png new file mode 100644 index 0000000..4487f18 Binary files /dev/null and b/img/enemies/SF_Anaconda.png differ diff --git a/img/enemies/SF_Armygorilla.png b/img/enemies/SF_Armygorilla.png new file mode 100644 index 0000000..e31c2b9 Binary files /dev/null and b/img/enemies/SF_Armygorilla.png differ diff --git a/img/enemies/SF_Armymonkey.png b/img/enemies/SF_Armymonkey.png new file mode 100644 index 0000000..b8853cb Binary files /dev/null and b/img/enemies/SF_Armymonkey.png differ diff --git a/img/enemies/SF_Blueogre.png b/img/enemies/SF_Blueogre.png new file mode 100644 index 0000000..6209320 Binary files /dev/null and b/img/enemies/SF_Blueogre.png differ diff --git a/img/enemies/SF_Boss.png b/img/enemies/SF_Boss.png new file mode 100644 index 0000000..cab71cd Binary files /dev/null and b/img/enemies/SF_Boss.png differ diff --git a/img/enemies/SF_Brownbear.png b/img/enemies/SF_Brownbear.png new file mode 100644 index 0000000..41c0f17 Binary files /dev/null and b/img/enemies/SF_Brownbear.png differ diff --git a/img/enemies/SF_Cyborg.png b/img/enemies/SF_Cyborg.png new file mode 100644 index 0000000..c0f3d01 Binary files /dev/null and b/img/enemies/SF_Cyborg.png differ diff --git a/img/enemies/SF_Demon_of_universe.png b/img/enemies/SF_Demon_of_universe.png new file mode 100644 index 0000000..3c240d5 Binary files /dev/null and b/img/enemies/SF_Demon_of_universe.png differ diff --git a/img/enemies/SF_Drone.png b/img/enemies/SF_Drone.png new file mode 100644 index 0000000..5a7fcf1 Binary files /dev/null and b/img/enemies/SF_Drone.png differ diff --git a/img/enemies/SF_Enmadaio.png b/img/enemies/SF_Enmadaio.png new file mode 100644 index 0000000..04d9337 Binary files /dev/null and b/img/enemies/SF_Enmadaio.png differ diff --git a/img/enemies/SF_Evilteddybear.png b/img/enemies/SF_Evilteddybear.png new file mode 100644 index 0000000..8a5d203 Binary files /dev/null and b/img/enemies/SF_Evilteddybear.png differ diff --git a/img/enemies/SF_Hannyamask.png b/img/enemies/SF_Hannyamask.png new file mode 100644 index 0000000..f7c4152 Binary files /dev/null and b/img/enemies/SF_Hannyamask.png differ diff --git a/img/enemies/SF_Hermit.png b/img/enemies/SF_Hermit.png new file mode 100644 index 0000000..457e717 Binary files /dev/null and b/img/enemies/SF_Hermit.png differ diff --git a/img/enemies/SF_Jiangshi.png b/img/enemies/SF_Jiangshi.png new file mode 100644 index 0000000..54b7bd6 Binary files /dev/null and b/img/enemies/SF_Jiangshi.png differ diff --git a/img/enemies/SF_Kamaitachi.png b/img/enemies/SF_Kamaitachi.png new file mode 100644 index 0000000..869d9b8 Binary files /dev/null and b/img/enemies/SF_Kamaitachi.png differ diff --git a/img/enemies/SF_Kappa.png b/img/enemies/SF_Kappa.png new file mode 100644 index 0000000..decf126 Binary files /dev/null and b/img/enemies/SF_Kappa.png differ diff --git a/img/enemies/SF_Madclown.png b/img/enemies/SF_Madclown.png new file mode 100644 index 0000000..c550efd Binary files /dev/null and b/img/enemies/SF_Madclown.png differ diff --git a/img/enemies/SF_Madscientist.png b/img/enemies/SF_Madscientist.png new file mode 100644 index 0000000..e1d4eca Binary files /dev/null and b/img/enemies/SF_Madscientist.png differ diff --git a/img/enemies/SF_Mafia.png b/img/enemies/SF_Mafia.png new file mode 100644 index 0000000..e5e3430 Binary files /dev/null and b/img/enemies/SF_Mafia.png differ diff --git a/img/enemies/SF_Mechasphere.png b/img/enemies/SF_Mechasphere.png new file mode 100644 index 0000000..1e836dc Binary files /dev/null and b/img/enemies/SF_Mechasphere.png differ diff --git a/img/enemies/SF_Phoenix.png b/img/enemies/SF_Phoenix.png new file mode 100644 index 0000000..971a02d Binary files /dev/null and b/img/enemies/SF_Phoenix.png differ diff --git a/img/enemies/SF_Redogre.png b/img/enemies/SF_Redogre.png new file mode 100644 index 0000000..cd516a0 Binary files /dev/null and b/img/enemies/SF_Redogre.png differ diff --git a/img/enemies/SF_Securityrobot.png b/img/enemies/SF_Securityrobot.png new file mode 100644 index 0000000..30cb1f2 Binary files /dev/null and b/img/enemies/SF_Securityrobot.png differ diff --git a/img/enemies/SF_Shadow.png b/img/enemies/SF_Shadow.png new file mode 100644 index 0000000..950386f Binary files /dev/null and b/img/enemies/SF_Shadow.png differ diff --git a/img/enemies/SF_Skullmask.png b/img/enemies/SF_Skullmask.png new file mode 100644 index 0000000..f0e971e Binary files /dev/null and b/img/enemies/SF_Skullmask.png differ diff --git a/img/enemies/SF_Slaughterrobot.png b/img/enemies/SF_Slaughterrobot.png new file mode 100644 index 0000000..35dbdbd Binary files /dev/null and b/img/enemies/SF_Slaughterrobot.png differ diff --git a/img/enemies/SF_Specialforces.png b/img/enemies/SF_Specialforces.png new file mode 100644 index 0000000..a2c6298 Binary files /dev/null and b/img/enemies/SF_Specialforces.png differ diff --git a/img/enemies/SF_Talkingmuppet.png b/img/enemies/SF_Talkingmuppet.png new file mode 100644 index 0000000..7026ad6 Binary files /dev/null and b/img/enemies/SF_Talkingmuppet.png differ diff --git a/img/enemies/SF_Timebomb.png b/img/enemies/SF_Timebomb.png new file mode 100644 index 0000000..0eac2f9 Binary files /dev/null and b/img/enemies/SF_Timebomb.png differ diff --git a/img/enemies/SF_Whitewolf.png b/img/enemies/SF_Whitewolf.png new file mode 100644 index 0000000..40446a9 Binary files /dev/null and b/img/enemies/SF_Whitewolf.png differ diff --git a/img/enemies/SF_Will_o_the_wisp.png b/img/enemies/SF_Will_o_the_wisp.png new file mode 100644 index 0000000..478f472 Binary files /dev/null and b/img/enemies/SF_Will_o_the_wisp.png differ diff --git a/img/enemies/SF_Wolf.png b/img/enemies/SF_Wolf.png new file mode 100644 index 0000000..a21dadc Binary files /dev/null and b/img/enemies/SF_Wolf.png differ diff --git a/img/enemies/SF_Workrobot.png b/img/enemies/SF_Workrobot.png new file mode 100644 index 0000000..4215242 Binary files /dev/null and b/img/enemies/SF_Workrobot.png differ diff --git a/img/enemies/SF_Zombiedog.png b/img/enemies/SF_Zombiedog.png new file mode 100644 index 0000000..533b2f0 Binary files /dev/null and b/img/enemies/SF_Zombiedog.png differ diff --git a/img/enemies/Sailor.png b/img/enemies/Sailor.png new file mode 100644 index 0000000..34297e1 Binary files /dev/null and b/img/enemies/Sailor.png differ diff --git a/img/enemies/Salamander.png b/img/enemies/Salamander.png new file mode 100644 index 0000000..c3e1fdc Binary files /dev/null and b/img/enemies/Salamander.png differ diff --git a/img/enemies/Sandworm.png b/img/enemies/Sandworm.png new file mode 100644 index 0000000..b93496d Binary files /dev/null and b/img/enemies/Sandworm.png differ diff --git a/img/enemies/Siren.png b/img/enemies/Siren.png new file mode 100644 index 0000000..3d124d2 Binary files /dev/null and b/img/enemies/Siren.png differ diff --git a/img/enemies/Sorcerer.png b/img/enemies/Sorcerer.png new file mode 100644 index 0000000..84f217a Binary files /dev/null and b/img/enemies/Sorcerer.png differ diff --git a/img/enemies/Stoneknight.png b/img/enemies/Stoneknight.png new file mode 100644 index 0000000..536b9fd Binary files /dev/null and b/img/enemies/Stoneknight.png differ diff --git a/img/enemies/Sylph.png b/img/enemies/Sylph.png new file mode 100644 index 0000000..084e513 Binary files /dev/null and b/img/enemies/Sylph.png differ diff --git a/img/enemies/Tigerbunny.png b/img/enemies/Tigerbunny.png new file mode 100644 index 0000000..491b28e Binary files /dev/null and b/img/enemies/Tigerbunny.png differ diff --git a/img/enemies/Treant.png b/img/enemies/Treant.png new file mode 100644 index 0000000..b547af4 Binary files /dev/null and b/img/enemies/Treant.png differ diff --git a/img/enemies/Undine.png b/img/enemies/Undine.png new file mode 100644 index 0000000..7947c81 Binary files /dev/null and b/img/enemies/Undine.png differ diff --git a/img/enemies/Unicorn.png b/img/enemies/Unicorn.png new file mode 100644 index 0000000..21247f8 Binary files /dev/null and b/img/enemies/Unicorn.png differ diff --git a/img/enemies/Witch.png b/img/enemies/Witch.png new file mode 100644 index 0000000..fce0ebf Binary files /dev/null and b/img/enemies/Witch.png differ diff --git a/img/enemies/Wolfman.png b/img/enemies/Wolfman.png new file mode 100644 index 0000000..900977c Binary files /dev/null and b/img/enemies/Wolfman.png differ diff --git a/img/enemies/Wraith.png b/img/enemies/Wraith.png new file mode 100644 index 0000000..8ebc002 Binary files /dev/null and b/img/enemies/Wraith.png differ diff --git a/img/enemies/Zombie.png b/img/enemies/Zombie.png new file mode 100644 index 0000000..e8e4dda Binary files /dev/null and b/img/enemies/Zombie.png differ diff --git a/img/faces/Actor1.png b/img/faces/Actor1.png new file mode 100644 index 0000000..613d25d Binary files /dev/null and b/img/faces/Actor1.png differ diff --git a/img/faces/Actor2.png b/img/faces/Actor2.png new file mode 100644 index 0000000..c8b8db8 Binary files /dev/null and b/img/faces/Actor2.png differ diff --git a/img/faces/Actor3.png b/img/faces/Actor3.png new file mode 100644 index 0000000..9f2b510 Binary files /dev/null and b/img/faces/Actor3.png differ diff --git a/img/faces/Evil.png b/img/faces/Evil.png new file mode 100644 index 0000000..6917c15 Binary files /dev/null and b/img/faces/Evil.png differ diff --git a/img/faces/Monster.png b/img/faces/Monster.png new file mode 100644 index 0000000..724c154 Binary files /dev/null and b/img/faces/Monster.png differ diff --git a/img/faces/Nature.png b/img/faces/Nature.png new file mode 100644 index 0000000..7eb1c83 Binary files /dev/null and b/img/faces/Nature.png differ diff --git a/img/faces/People1.png b/img/faces/People1.png new file mode 100644 index 0000000..1f2af4f Binary files /dev/null and b/img/faces/People1.png differ diff --git a/img/faces/People2.png b/img/faces/People2.png new file mode 100644 index 0000000..bb3afeb Binary files /dev/null and b/img/faces/People2.png differ diff --git a/img/faces/People3.png b/img/faces/People3.png new file mode 100644 index 0000000..d6108ff Binary files /dev/null and b/img/faces/People3.png differ diff --git a/img/faces/People4.png b/img/faces/People4.png new file mode 100644 index 0000000..21d8a43 Binary files /dev/null and b/img/faces/People4.png differ diff --git a/img/faces/SF_Actor1.png b/img/faces/SF_Actor1.png new file mode 100644 index 0000000..107b85f Binary files /dev/null and b/img/faces/SF_Actor1.png differ diff --git a/img/faces/SF_Actor2.png b/img/faces/SF_Actor2.png new file mode 100644 index 0000000..e1339c3 Binary files /dev/null and b/img/faces/SF_Actor2.png differ diff --git a/img/faces/SF_Actor3.png b/img/faces/SF_Actor3.png new file mode 100644 index 0000000..a2d8544 Binary files /dev/null and b/img/faces/SF_Actor3.png differ diff --git a/img/faces/SF_Monster.png b/img/faces/SF_Monster.png new file mode 100644 index 0000000..78c01f0 Binary files /dev/null and b/img/faces/SF_Monster.png differ diff --git a/img/faces/SF_People1.png b/img/faces/SF_People1.png new file mode 100644 index 0000000..05528e5 Binary files /dev/null and b/img/faces/SF_People1.png differ diff --git a/img/parallaxes/BlueSky.png b/img/parallaxes/BlueSky.png new file mode 100644 index 0000000..509d718 Binary files /dev/null and b/img/parallaxes/BlueSky.png differ diff --git a/img/parallaxes/Clouds.png b/img/parallaxes/Clouds.png new file mode 100644 index 0000000..afd749c Binary files /dev/null and b/img/parallaxes/Clouds.png differ diff --git a/img/parallaxes/DarkClouds.png b/img/parallaxes/DarkClouds.png new file mode 100644 index 0000000..81a11ad Binary files /dev/null and b/img/parallaxes/DarkClouds.png differ diff --git a/img/parallaxes/DarkSpace.png b/img/parallaxes/DarkSpace.png new file mode 100644 index 0000000..b3f90a0 Binary files /dev/null and b/img/parallaxes/DarkSpace.png differ diff --git a/img/parallaxes/Desert.png b/img/parallaxes/Desert.png new file mode 100644 index 0000000..d66a802 Binary files /dev/null and b/img/parallaxes/Desert.png differ diff --git a/img/parallaxes/DesertNight.png b/img/parallaxes/DesertNight.png new file mode 100644 index 0000000..5b0aed7 Binary files /dev/null and b/img/parallaxes/DesertNight.png differ diff --git a/img/parallaxes/Forest.png b/img/parallaxes/Forest.png new file mode 100644 index 0000000..600c245 Binary files /dev/null and b/img/parallaxes/Forest.png differ diff --git a/img/parallaxes/IslandofSky1.png b/img/parallaxes/IslandofSky1.png new file mode 100644 index 0000000..2a7cc67 Binary files /dev/null and b/img/parallaxes/IslandofSky1.png differ diff --git a/img/parallaxes/IslandofSky2.png b/img/parallaxes/IslandofSky2.png new file mode 100644 index 0000000..23d3244 Binary files /dev/null and b/img/parallaxes/IslandofSky2.png differ diff --git a/img/parallaxes/Lava.png b/img/parallaxes/Lava.png new file mode 100644 index 0000000..57d0022 Binary files /dev/null and b/img/parallaxes/Lava.png differ diff --git a/img/parallaxes/Mountains1.png b/img/parallaxes/Mountains1.png new file mode 100644 index 0000000..1b39a3f Binary files /dev/null and b/img/parallaxes/Mountains1.png differ diff --git a/img/parallaxes/Mountains2.png b/img/parallaxes/Mountains2.png new file mode 100644 index 0000000..80c2770 Binary files /dev/null and b/img/parallaxes/Mountains2.png differ diff --git a/img/parallaxes/Mountains3.png b/img/parallaxes/Mountains3.png new file mode 100644 index 0000000..b7e5293 Binary files /dev/null and b/img/parallaxes/Mountains3.png differ diff --git a/img/parallaxes/Ocean.png b/img/parallaxes/Ocean.png new file mode 100644 index 0000000..afb0870 Binary files /dev/null and b/img/parallaxes/Ocean.png differ diff --git a/img/parallaxes/RedSky.png b/img/parallaxes/RedSky.png new file mode 100644 index 0000000..3f80587 Binary files /dev/null and b/img/parallaxes/RedSky.png differ diff --git a/img/parallaxes/River.png b/img/parallaxes/River.png new file mode 100644 index 0000000..a3c3347 Binary files /dev/null and b/img/parallaxes/River.png differ diff --git a/img/parallaxes/SnowForest.png b/img/parallaxes/SnowForest.png new file mode 100644 index 0000000..faa121d Binary files /dev/null and b/img/parallaxes/SnowForest.png differ diff --git a/img/parallaxes/Space.png b/img/parallaxes/Space.png new file mode 100644 index 0000000..c2a6843 Binary files /dev/null and b/img/parallaxes/Space.png differ diff --git a/img/parallaxes/StarlitSky.png b/img/parallaxes/StarlitSky.png new file mode 100644 index 0000000..57adc1a Binary files /dev/null and b/img/parallaxes/StarlitSky.png differ diff --git a/img/parallaxes/Twilight.png b/img/parallaxes/Twilight.png new file mode 100644 index 0000000..a1bcc62 Binary files /dev/null and b/img/parallaxes/Twilight.png differ diff --git a/img/parallaxes/Universe.png b/img/parallaxes/Universe.png new file mode 100644 index 0000000..68602a9 Binary files /dev/null and b/img/parallaxes/Universe.png differ diff --git a/img/pictures/Actor1_1.png b/img/pictures/Actor1_1.png new file mode 100644 index 0000000..db6f317 Binary files /dev/null and b/img/pictures/Actor1_1.png differ diff --git a/img/pictures/Actor1_2.png b/img/pictures/Actor1_2.png new file mode 100644 index 0000000..2c6a221 Binary files /dev/null and b/img/pictures/Actor1_2.png differ diff --git a/img/pictures/Actor1_3.png b/img/pictures/Actor1_3.png new file mode 100644 index 0000000..3c6b8a1 Binary files /dev/null and b/img/pictures/Actor1_3.png differ diff --git a/img/pictures/Actor1_4.png b/img/pictures/Actor1_4.png new file mode 100644 index 0000000..227ebc9 Binary files /dev/null and b/img/pictures/Actor1_4.png differ diff --git a/img/pictures/Actor1_5.png b/img/pictures/Actor1_5.png new file mode 100644 index 0000000..e0f7612 Binary files /dev/null and b/img/pictures/Actor1_5.png differ diff --git a/img/pictures/Actor1_6.png b/img/pictures/Actor1_6.png new file mode 100644 index 0000000..8a23546 Binary files /dev/null and b/img/pictures/Actor1_6.png differ diff --git a/img/pictures/Actor1_7.png b/img/pictures/Actor1_7.png new file mode 100644 index 0000000..f9051da Binary files /dev/null and b/img/pictures/Actor1_7.png differ diff --git a/img/pictures/Actor1_8.png b/img/pictures/Actor1_8.png new file mode 100644 index 0000000..96f49ed Binary files /dev/null and b/img/pictures/Actor1_8.png differ diff --git a/img/pictures/Actor2_1.png b/img/pictures/Actor2_1.png new file mode 100644 index 0000000..3e6767d Binary files /dev/null and b/img/pictures/Actor2_1.png differ diff --git a/img/pictures/Actor2_2.png b/img/pictures/Actor2_2.png new file mode 100644 index 0000000..eed9f7f Binary files /dev/null and b/img/pictures/Actor2_2.png differ diff --git a/img/pictures/Actor2_3.png b/img/pictures/Actor2_3.png new file mode 100644 index 0000000..24487e0 Binary files /dev/null and b/img/pictures/Actor2_3.png differ diff --git a/img/pictures/Actor2_4.png b/img/pictures/Actor2_4.png new file mode 100644 index 0000000..4d1a2a4 Binary files /dev/null and b/img/pictures/Actor2_4.png differ diff --git a/img/pictures/Actor2_5.png b/img/pictures/Actor2_5.png new file mode 100644 index 0000000..b5d6f0a Binary files /dev/null and b/img/pictures/Actor2_5.png differ diff --git a/img/pictures/Actor2_6.png b/img/pictures/Actor2_6.png new file mode 100644 index 0000000..1aef179 Binary files /dev/null and b/img/pictures/Actor2_6.png differ diff --git a/img/pictures/Actor2_7.png b/img/pictures/Actor2_7.png new file mode 100644 index 0000000..068bb79 Binary files /dev/null and b/img/pictures/Actor2_7.png differ diff --git a/img/pictures/Actor2_8.png b/img/pictures/Actor2_8.png new file mode 100644 index 0000000..78571a7 Binary files /dev/null and b/img/pictures/Actor2_8.png differ diff --git a/img/pictures/Actor3_1.png b/img/pictures/Actor3_1.png new file mode 100644 index 0000000..3a6712a Binary files /dev/null and b/img/pictures/Actor3_1.png differ diff --git a/img/pictures/Actor3_2.png b/img/pictures/Actor3_2.png new file mode 100644 index 0000000..aec841b Binary files /dev/null and b/img/pictures/Actor3_2.png differ diff --git a/img/pictures/Actor3_3.png b/img/pictures/Actor3_3.png new file mode 100644 index 0000000..48ff4de Binary files /dev/null and b/img/pictures/Actor3_3.png differ diff --git a/img/pictures/Actor3_4.png b/img/pictures/Actor3_4.png new file mode 100644 index 0000000..c5e4fa8 Binary files /dev/null and b/img/pictures/Actor3_4.png differ diff --git a/img/pictures/Actor3_5.png b/img/pictures/Actor3_5.png new file mode 100644 index 0000000..6d1c6bc Binary files /dev/null and b/img/pictures/Actor3_5.png differ diff --git a/img/pictures/Actor3_6.png b/img/pictures/Actor3_6.png new file mode 100644 index 0000000..50703b7 Binary files /dev/null and b/img/pictures/Actor3_6.png differ diff --git a/img/pictures/Actor3_7.png b/img/pictures/Actor3_7.png new file mode 100644 index 0000000..e67163d Binary files /dev/null and b/img/pictures/Actor3_7.png differ diff --git a/img/pictures/Actor3_8.png b/img/pictures/Actor3_8.png new file mode 100644 index 0000000..244f41d Binary files /dev/null and b/img/pictures/Actor3_8.png differ diff --git a/img/pictures/Evil_1.png b/img/pictures/Evil_1.png new file mode 100644 index 0000000..0d3195e Binary files /dev/null and b/img/pictures/Evil_1.png differ diff --git a/img/pictures/Evil_2.png b/img/pictures/Evil_2.png new file mode 100644 index 0000000..5184229 Binary files /dev/null and b/img/pictures/Evil_2.png differ diff --git a/img/pictures/Evil_3.png b/img/pictures/Evil_3.png new file mode 100644 index 0000000..2bef5e8 Binary files /dev/null and b/img/pictures/Evil_3.png differ diff --git a/img/pictures/Evil_4.png b/img/pictures/Evil_4.png new file mode 100644 index 0000000..9ae1612 Binary files /dev/null and b/img/pictures/Evil_4.png differ diff --git a/img/pictures/Evil_5.png b/img/pictures/Evil_5.png new file mode 100644 index 0000000..e9a5b0c Binary files /dev/null and b/img/pictures/Evil_5.png differ diff --git a/img/pictures/Evil_6.png b/img/pictures/Evil_6.png new file mode 100644 index 0000000..571ae89 Binary files /dev/null and b/img/pictures/Evil_6.png differ diff --git a/img/pictures/Evil_7.png b/img/pictures/Evil_7.png new file mode 100644 index 0000000..f3fe5b1 Binary files /dev/null and b/img/pictures/Evil_7.png differ diff --git a/img/pictures/Evil_8.png b/img/pictures/Evil_8.png new file mode 100644 index 0000000..94961ff Binary files /dev/null and b/img/pictures/Evil_8.png differ diff --git a/img/pictures/Monster_1.png b/img/pictures/Monster_1.png new file mode 100644 index 0000000..a67dc88 Binary files /dev/null and b/img/pictures/Monster_1.png differ diff --git a/img/pictures/Monster_2.png b/img/pictures/Monster_2.png new file mode 100644 index 0000000..55b2951 Binary files /dev/null and b/img/pictures/Monster_2.png differ diff --git a/img/pictures/Monster_3.png b/img/pictures/Monster_3.png new file mode 100644 index 0000000..a098a8d Binary files /dev/null and b/img/pictures/Monster_3.png differ diff --git a/img/pictures/Monster_4.png b/img/pictures/Monster_4.png new file mode 100644 index 0000000..686e3d0 Binary files /dev/null and b/img/pictures/Monster_4.png differ diff --git a/img/pictures/Monster_5.png b/img/pictures/Monster_5.png new file mode 100644 index 0000000..61194b6 Binary files /dev/null and b/img/pictures/Monster_5.png differ diff --git a/img/pictures/Monster_6.png b/img/pictures/Monster_6.png new file mode 100644 index 0000000..87e6179 Binary files /dev/null and b/img/pictures/Monster_6.png differ diff --git a/img/pictures/Monster_7.png b/img/pictures/Monster_7.png new file mode 100644 index 0000000..2928531 Binary files /dev/null and b/img/pictures/Monster_7.png differ diff --git a/img/pictures/Monster_8.png b/img/pictures/Monster_8.png new file mode 100644 index 0000000..d54c7ea Binary files /dev/null and b/img/pictures/Monster_8.png differ diff --git a/img/pictures/Nature_1.png b/img/pictures/Nature_1.png new file mode 100644 index 0000000..3f6764e Binary files /dev/null and b/img/pictures/Nature_1.png differ diff --git a/img/pictures/Nature_2.png b/img/pictures/Nature_2.png new file mode 100644 index 0000000..727a8e3 Binary files /dev/null and b/img/pictures/Nature_2.png differ diff --git a/img/pictures/Nature_3.png b/img/pictures/Nature_3.png new file mode 100644 index 0000000..93641b5 Binary files /dev/null and b/img/pictures/Nature_3.png differ diff --git a/img/pictures/Nature_4.png b/img/pictures/Nature_4.png new file mode 100644 index 0000000..85a3555 Binary files /dev/null and b/img/pictures/Nature_4.png differ diff --git a/img/pictures/Nature_5.png b/img/pictures/Nature_5.png new file mode 100644 index 0000000..df1fc36 Binary files /dev/null and b/img/pictures/Nature_5.png differ diff --git a/img/pictures/Nature_6.png b/img/pictures/Nature_6.png new file mode 100644 index 0000000..8691408 Binary files /dev/null and b/img/pictures/Nature_6.png differ diff --git a/img/pictures/Nature_7.png b/img/pictures/Nature_7.png new file mode 100644 index 0000000..0c0a59b Binary files /dev/null and b/img/pictures/Nature_7.png differ diff --git a/img/pictures/Nature_8.png b/img/pictures/Nature_8.png new file mode 100644 index 0000000..e8ce77c Binary files /dev/null and b/img/pictures/Nature_8.png differ diff --git a/img/pictures/People1_1.png b/img/pictures/People1_1.png new file mode 100644 index 0000000..aa376e2 Binary files /dev/null and b/img/pictures/People1_1.png differ diff --git a/img/pictures/People1_2.png b/img/pictures/People1_2.png new file mode 100644 index 0000000..e1a23ce Binary files /dev/null and b/img/pictures/People1_2.png differ diff --git a/img/pictures/People1_3.png b/img/pictures/People1_3.png new file mode 100644 index 0000000..ea60da6 Binary files /dev/null and b/img/pictures/People1_3.png differ diff --git a/img/pictures/People1_4.png b/img/pictures/People1_4.png new file mode 100644 index 0000000..9b4d3d6 Binary files /dev/null and b/img/pictures/People1_4.png differ diff --git a/img/pictures/People1_5.png b/img/pictures/People1_5.png new file mode 100644 index 0000000..ff2bd27 Binary files /dev/null and b/img/pictures/People1_5.png differ diff --git a/img/pictures/People1_6.png b/img/pictures/People1_6.png new file mode 100644 index 0000000..20af0e0 Binary files /dev/null and b/img/pictures/People1_6.png differ diff --git a/img/pictures/People1_7.png b/img/pictures/People1_7.png new file mode 100644 index 0000000..e02e182 Binary files /dev/null and b/img/pictures/People1_7.png differ diff --git a/img/pictures/People1_8.png b/img/pictures/People1_8.png new file mode 100644 index 0000000..96066e6 Binary files /dev/null and b/img/pictures/People1_8.png differ diff --git a/img/pictures/People2_1.png b/img/pictures/People2_1.png new file mode 100644 index 0000000..62bd427 Binary files /dev/null and b/img/pictures/People2_1.png differ diff --git a/img/pictures/People2_2.png b/img/pictures/People2_2.png new file mode 100644 index 0000000..24b0f9d Binary files /dev/null and b/img/pictures/People2_2.png differ diff --git a/img/pictures/People2_3.png b/img/pictures/People2_3.png new file mode 100644 index 0000000..3916e8b Binary files /dev/null and b/img/pictures/People2_3.png differ diff --git a/img/pictures/People2_4.png b/img/pictures/People2_4.png new file mode 100644 index 0000000..43eb3fa Binary files /dev/null and b/img/pictures/People2_4.png differ diff --git a/img/pictures/People2_5.png b/img/pictures/People2_5.png new file mode 100644 index 0000000..625c196 Binary files /dev/null and b/img/pictures/People2_5.png differ diff --git a/img/pictures/People2_6.png b/img/pictures/People2_6.png new file mode 100644 index 0000000..0433c47 Binary files /dev/null and b/img/pictures/People2_6.png differ diff --git a/img/pictures/People2_7.png b/img/pictures/People2_7.png new file mode 100644 index 0000000..a5b7334 Binary files /dev/null and b/img/pictures/People2_7.png differ diff --git a/img/pictures/People2_8.png b/img/pictures/People2_8.png new file mode 100644 index 0000000..420ae1a Binary files /dev/null and b/img/pictures/People2_8.png differ diff --git a/img/pictures/People3_1.png b/img/pictures/People3_1.png new file mode 100644 index 0000000..533df62 Binary files /dev/null and b/img/pictures/People3_1.png differ diff --git a/img/pictures/People3_2.png b/img/pictures/People3_2.png new file mode 100644 index 0000000..15e80b8 Binary files /dev/null and b/img/pictures/People3_2.png differ diff --git a/img/pictures/People3_3.png b/img/pictures/People3_3.png new file mode 100644 index 0000000..7c43fee Binary files /dev/null and b/img/pictures/People3_3.png differ diff --git a/img/pictures/People3_4.png b/img/pictures/People3_4.png new file mode 100644 index 0000000..176451f Binary files /dev/null and b/img/pictures/People3_4.png differ diff --git a/img/pictures/People3_5.png b/img/pictures/People3_5.png new file mode 100644 index 0000000..b4362a0 Binary files /dev/null and b/img/pictures/People3_5.png differ diff --git a/img/pictures/People3_6.png b/img/pictures/People3_6.png new file mode 100644 index 0000000..d157cb3 Binary files /dev/null and b/img/pictures/People3_6.png differ diff --git a/img/pictures/People3_7.png b/img/pictures/People3_7.png new file mode 100644 index 0000000..ee1b4ea Binary files /dev/null and b/img/pictures/People3_7.png differ diff --git a/img/pictures/People3_8.png b/img/pictures/People3_8.png new file mode 100644 index 0000000..99840c1 Binary files /dev/null and b/img/pictures/People3_8.png differ diff --git a/img/pictures/People4_1.png b/img/pictures/People4_1.png new file mode 100644 index 0000000..511813e Binary files /dev/null and b/img/pictures/People4_1.png differ diff --git a/img/pictures/People4_2.png b/img/pictures/People4_2.png new file mode 100644 index 0000000..bf93b64 Binary files /dev/null and b/img/pictures/People4_2.png differ diff --git a/img/pictures/People4_3.png b/img/pictures/People4_3.png new file mode 100644 index 0000000..cd82bb0 Binary files /dev/null and b/img/pictures/People4_3.png differ diff --git a/img/pictures/People4_4.png b/img/pictures/People4_4.png new file mode 100644 index 0000000..8140eeb Binary files /dev/null and b/img/pictures/People4_4.png differ diff --git a/img/pictures/People4_5.png b/img/pictures/People4_5.png new file mode 100644 index 0000000..7666190 Binary files /dev/null and b/img/pictures/People4_5.png differ diff --git a/img/pictures/People4_6.png b/img/pictures/People4_6.png new file mode 100644 index 0000000..877c869 Binary files /dev/null and b/img/pictures/People4_6.png differ diff --git a/img/pictures/People4_7.png b/img/pictures/People4_7.png new file mode 100644 index 0000000..fb9d68b Binary files /dev/null and b/img/pictures/People4_7.png differ diff --git a/img/pictures/People4_8.png b/img/pictures/People4_8.png new file mode 100644 index 0000000..b42b328 Binary files /dev/null and b/img/pictures/People4_8.png differ diff --git a/img/pictures/SF_Actor1_1.png b/img/pictures/SF_Actor1_1.png new file mode 100644 index 0000000..734b7f1 Binary files /dev/null and b/img/pictures/SF_Actor1_1.png differ diff --git a/img/pictures/SF_Actor1_2.png b/img/pictures/SF_Actor1_2.png new file mode 100644 index 0000000..3d1dcda Binary files /dev/null and b/img/pictures/SF_Actor1_2.png differ diff --git a/img/pictures/SF_Actor1_3.png b/img/pictures/SF_Actor1_3.png new file mode 100644 index 0000000..f6b25ce Binary files /dev/null and b/img/pictures/SF_Actor1_3.png differ diff --git a/img/pictures/SF_Actor1_4.png b/img/pictures/SF_Actor1_4.png new file mode 100644 index 0000000..2c4be10 Binary files /dev/null and b/img/pictures/SF_Actor1_4.png differ diff --git a/img/pictures/SF_Actor1_5.png b/img/pictures/SF_Actor1_5.png new file mode 100644 index 0000000..ff6b84e Binary files /dev/null and b/img/pictures/SF_Actor1_5.png differ diff --git a/img/pictures/SF_Actor1_6.png b/img/pictures/SF_Actor1_6.png new file mode 100644 index 0000000..501aae6 Binary files /dev/null and b/img/pictures/SF_Actor1_6.png differ diff --git a/img/pictures/SF_Actor1_7.png b/img/pictures/SF_Actor1_7.png new file mode 100644 index 0000000..54b39fd Binary files /dev/null and b/img/pictures/SF_Actor1_7.png differ diff --git a/img/pictures/SF_Actor1_8.png b/img/pictures/SF_Actor1_8.png new file mode 100644 index 0000000..f552759 Binary files /dev/null and b/img/pictures/SF_Actor1_8.png differ diff --git a/img/pictures/SF_Actor2_1.png b/img/pictures/SF_Actor2_1.png new file mode 100644 index 0000000..f3fa51b Binary files /dev/null and b/img/pictures/SF_Actor2_1.png differ diff --git a/img/pictures/SF_Actor2_2.png b/img/pictures/SF_Actor2_2.png new file mode 100644 index 0000000..0c4321c Binary files /dev/null and b/img/pictures/SF_Actor2_2.png differ diff --git a/img/pictures/SF_Actor2_3.png b/img/pictures/SF_Actor2_3.png new file mode 100644 index 0000000..b27a211 Binary files /dev/null and b/img/pictures/SF_Actor2_3.png differ diff --git a/img/pictures/SF_Actor2_4.png b/img/pictures/SF_Actor2_4.png new file mode 100644 index 0000000..b9bb745 Binary files /dev/null and b/img/pictures/SF_Actor2_4.png differ diff --git a/img/pictures/SF_Actor2_5.png b/img/pictures/SF_Actor2_5.png new file mode 100644 index 0000000..9afad08 Binary files /dev/null and b/img/pictures/SF_Actor2_5.png differ diff --git a/img/pictures/SF_Actor2_6.png b/img/pictures/SF_Actor2_6.png new file mode 100644 index 0000000..75ba76a Binary files /dev/null and b/img/pictures/SF_Actor2_6.png differ diff --git a/img/pictures/SF_Actor2_7.png b/img/pictures/SF_Actor2_7.png new file mode 100644 index 0000000..329e4a4 Binary files /dev/null and b/img/pictures/SF_Actor2_7.png differ diff --git a/img/pictures/SF_Actor2_8.png b/img/pictures/SF_Actor2_8.png new file mode 100644 index 0000000..088f23d Binary files /dev/null and b/img/pictures/SF_Actor2_8.png differ diff --git a/img/pictures/SF_Actor3_1.png b/img/pictures/SF_Actor3_1.png new file mode 100644 index 0000000..2a7ee28 Binary files /dev/null and b/img/pictures/SF_Actor3_1.png differ diff --git a/img/pictures/SF_Actor3_2.png b/img/pictures/SF_Actor3_2.png new file mode 100644 index 0000000..9368b56 Binary files /dev/null and b/img/pictures/SF_Actor3_2.png differ diff --git a/img/pictures/SF_Actor3_3.png b/img/pictures/SF_Actor3_3.png new file mode 100644 index 0000000..0d54df3 Binary files /dev/null and b/img/pictures/SF_Actor3_3.png differ diff --git a/img/pictures/SF_Actor3_4.png b/img/pictures/SF_Actor3_4.png new file mode 100644 index 0000000..ad6b4fc Binary files /dev/null and b/img/pictures/SF_Actor3_4.png differ diff --git a/img/pictures/SF_Actor3_5.png b/img/pictures/SF_Actor3_5.png new file mode 100644 index 0000000..572ea85 Binary files /dev/null and b/img/pictures/SF_Actor3_5.png differ diff --git a/img/pictures/SF_Actor3_6.png b/img/pictures/SF_Actor3_6.png new file mode 100644 index 0000000..d75320e Binary files /dev/null and b/img/pictures/SF_Actor3_6.png differ diff --git a/img/pictures/SF_Actor3_7.png b/img/pictures/SF_Actor3_7.png new file mode 100644 index 0000000..73ebcfb Binary files /dev/null and b/img/pictures/SF_Actor3_7.png differ diff --git a/img/pictures/SF_Actor3_8.png b/img/pictures/SF_Actor3_8.png new file mode 100644 index 0000000..0338d4b Binary files /dev/null and b/img/pictures/SF_Actor3_8.png differ diff --git a/img/pictures/SF_Monster_1.png b/img/pictures/SF_Monster_1.png new file mode 100644 index 0000000..6aba2ed Binary files /dev/null and b/img/pictures/SF_Monster_1.png differ diff --git a/img/pictures/SF_Monster_2.png b/img/pictures/SF_Monster_2.png new file mode 100644 index 0000000..9211d4e Binary files /dev/null and b/img/pictures/SF_Monster_2.png differ diff --git a/img/pictures/SF_Monster_3.png b/img/pictures/SF_Monster_3.png new file mode 100644 index 0000000..4a4c01d Binary files /dev/null and b/img/pictures/SF_Monster_3.png differ diff --git a/img/pictures/SF_Monster_4.png b/img/pictures/SF_Monster_4.png new file mode 100644 index 0000000..3336298 Binary files /dev/null and b/img/pictures/SF_Monster_4.png differ diff --git a/img/pictures/SF_Monster_5.png b/img/pictures/SF_Monster_5.png new file mode 100644 index 0000000..c34f8f6 Binary files /dev/null and b/img/pictures/SF_Monster_5.png differ diff --git a/img/pictures/SF_Monster_6.png b/img/pictures/SF_Monster_6.png new file mode 100644 index 0000000..4981a3d Binary files /dev/null and b/img/pictures/SF_Monster_6.png differ diff --git a/img/pictures/SF_Monster_7.png b/img/pictures/SF_Monster_7.png new file mode 100644 index 0000000..1825d97 Binary files /dev/null and b/img/pictures/SF_Monster_7.png differ diff --git a/img/pictures/SF_Monster_8.png b/img/pictures/SF_Monster_8.png new file mode 100644 index 0000000..97f36cf Binary files /dev/null and b/img/pictures/SF_Monster_8.png differ diff --git a/img/pictures/SF_People1_1.png b/img/pictures/SF_People1_1.png new file mode 100644 index 0000000..c4de6da Binary files /dev/null and b/img/pictures/SF_People1_1.png differ diff --git a/img/pictures/SF_People1_2.png b/img/pictures/SF_People1_2.png new file mode 100644 index 0000000..f6db343 Binary files /dev/null and b/img/pictures/SF_People1_2.png differ diff --git a/img/pictures/SF_People1_3.png b/img/pictures/SF_People1_3.png new file mode 100644 index 0000000..6224e32 Binary files /dev/null and b/img/pictures/SF_People1_3.png differ diff --git a/img/pictures/SF_People1_4.png b/img/pictures/SF_People1_4.png new file mode 100644 index 0000000..574ba43 Binary files /dev/null and b/img/pictures/SF_People1_4.png differ diff --git a/img/pictures/SF_People1_5.png b/img/pictures/SF_People1_5.png new file mode 100644 index 0000000..9cd7e9e Binary files /dev/null and b/img/pictures/SF_People1_5.png differ diff --git a/img/pictures/SF_People1_6.png b/img/pictures/SF_People1_6.png new file mode 100644 index 0000000..0311025 Binary files /dev/null and b/img/pictures/SF_People1_6.png differ diff --git a/img/pictures/SF_People1_7.png b/img/pictures/SF_People1_7.png new file mode 100644 index 0000000..64368e9 Binary files /dev/null and b/img/pictures/SF_People1_7.png differ diff --git a/img/pictures/SF_People1_8.png b/img/pictures/SF_People1_8.png new file mode 100644 index 0000000..3cbb966 Binary files /dev/null and b/img/pictures/SF_People1_8.png differ diff --git a/img/sv_actors/Actor1_1.png b/img/sv_actors/Actor1_1.png new file mode 100644 index 0000000..8c9d731 Binary files /dev/null and b/img/sv_actors/Actor1_1.png differ diff --git a/img/sv_actors/Actor1_2.png b/img/sv_actors/Actor1_2.png new file mode 100644 index 0000000..e876b4c Binary files /dev/null and b/img/sv_actors/Actor1_2.png differ diff --git a/img/sv_actors/Actor1_3.png b/img/sv_actors/Actor1_3.png new file mode 100644 index 0000000..2a1df8b Binary files /dev/null and b/img/sv_actors/Actor1_3.png differ diff --git a/img/sv_actors/Actor1_4.png b/img/sv_actors/Actor1_4.png new file mode 100644 index 0000000..a9359df Binary files /dev/null and b/img/sv_actors/Actor1_4.png differ diff --git a/img/sv_actors/Actor1_5.png b/img/sv_actors/Actor1_5.png new file mode 100644 index 0000000..2ddff4e Binary files /dev/null and b/img/sv_actors/Actor1_5.png differ diff --git a/img/sv_actors/Actor1_6.png b/img/sv_actors/Actor1_6.png new file mode 100644 index 0000000..17ee87f Binary files /dev/null and b/img/sv_actors/Actor1_6.png differ diff --git a/img/sv_actors/Actor1_7.png b/img/sv_actors/Actor1_7.png new file mode 100644 index 0000000..05cc428 Binary files /dev/null and b/img/sv_actors/Actor1_7.png differ diff --git a/img/sv_actors/Actor1_8.png b/img/sv_actors/Actor1_8.png new file mode 100644 index 0000000..311693d Binary files /dev/null and b/img/sv_actors/Actor1_8.png differ diff --git a/img/sv_actors/Actor2_1.png b/img/sv_actors/Actor2_1.png new file mode 100644 index 0000000..6996e30 Binary files /dev/null and b/img/sv_actors/Actor2_1.png differ diff --git a/img/sv_actors/Actor2_2.png b/img/sv_actors/Actor2_2.png new file mode 100644 index 0000000..b0a3cf5 Binary files /dev/null and b/img/sv_actors/Actor2_2.png differ diff --git a/img/sv_actors/Actor2_3.png b/img/sv_actors/Actor2_3.png new file mode 100644 index 0000000..d8ce54f Binary files /dev/null and b/img/sv_actors/Actor2_3.png differ diff --git a/img/sv_actors/Actor2_4.png b/img/sv_actors/Actor2_4.png new file mode 100644 index 0000000..94ec572 Binary files /dev/null and b/img/sv_actors/Actor2_4.png differ diff --git a/img/sv_actors/Actor2_5.png b/img/sv_actors/Actor2_5.png new file mode 100644 index 0000000..05fcf10 Binary files /dev/null and b/img/sv_actors/Actor2_5.png differ diff --git a/img/sv_actors/Actor2_6.png b/img/sv_actors/Actor2_6.png new file mode 100644 index 0000000..49adcd5 Binary files /dev/null and b/img/sv_actors/Actor2_6.png differ diff --git a/img/sv_actors/Actor2_7.png b/img/sv_actors/Actor2_7.png new file mode 100644 index 0000000..1f08408 Binary files /dev/null and b/img/sv_actors/Actor2_7.png differ diff --git a/img/sv_actors/Actor2_8.png b/img/sv_actors/Actor2_8.png new file mode 100644 index 0000000..e88e6d0 Binary files /dev/null and b/img/sv_actors/Actor2_8.png differ diff --git a/img/sv_actors/Actor3_5.png b/img/sv_actors/Actor3_5.png new file mode 100644 index 0000000..ea0c781 Binary files /dev/null and b/img/sv_actors/Actor3_5.png differ diff --git a/img/sv_actors/Actor3_6.png b/img/sv_actors/Actor3_6.png new file mode 100644 index 0000000..b740f7f Binary files /dev/null and b/img/sv_actors/Actor3_6.png differ diff --git a/img/sv_actors/Actor3_7.png b/img/sv_actors/Actor3_7.png new file mode 100644 index 0000000..7c9fbbc Binary files /dev/null and b/img/sv_actors/Actor3_7.png differ diff --git a/img/sv_actors/Actor3_8.png b/img/sv_actors/Actor3_8.png new file mode 100644 index 0000000..3ac5ba9 Binary files /dev/null and b/img/sv_actors/Actor3_8.png differ diff --git a/img/sv_actors/SF_Actor1_1.png b/img/sv_actors/SF_Actor1_1.png new file mode 100644 index 0000000..9cc6621 Binary files /dev/null and b/img/sv_actors/SF_Actor1_1.png differ diff --git a/img/sv_actors/SF_Actor1_2.png b/img/sv_actors/SF_Actor1_2.png new file mode 100644 index 0000000..f28cbbb Binary files /dev/null and b/img/sv_actors/SF_Actor1_2.png differ diff --git a/img/sv_actors/SF_Actor1_3.png b/img/sv_actors/SF_Actor1_3.png new file mode 100644 index 0000000..8ae77de Binary files /dev/null and b/img/sv_actors/SF_Actor1_3.png differ diff --git a/img/sv_actors/SF_Actor1_4.png b/img/sv_actors/SF_Actor1_4.png new file mode 100644 index 0000000..dce7672 Binary files /dev/null and b/img/sv_actors/SF_Actor1_4.png differ diff --git a/img/sv_actors/SF_Actor1_5.png b/img/sv_actors/SF_Actor1_5.png new file mode 100644 index 0000000..40af3e9 Binary files /dev/null and b/img/sv_actors/SF_Actor1_5.png differ diff --git a/img/sv_actors/SF_Actor1_6.png b/img/sv_actors/SF_Actor1_6.png new file mode 100644 index 0000000..356e0b4 Binary files /dev/null and b/img/sv_actors/SF_Actor1_6.png differ diff --git a/img/sv_actors/SF_Actor1_7.png b/img/sv_actors/SF_Actor1_7.png new file mode 100644 index 0000000..b1220f4 Binary files /dev/null and b/img/sv_actors/SF_Actor1_7.png differ diff --git a/img/sv_actors/SF_Actor1_8.png b/img/sv_actors/SF_Actor1_8.png new file mode 100644 index 0000000..66a79a4 Binary files /dev/null and b/img/sv_actors/SF_Actor1_8.png differ diff --git a/img/sv_actors/SF_Actor2_1.png b/img/sv_actors/SF_Actor2_1.png new file mode 100644 index 0000000..9b899a5 Binary files /dev/null and b/img/sv_actors/SF_Actor2_1.png differ diff --git a/img/sv_actors/SF_Actor2_2.png b/img/sv_actors/SF_Actor2_2.png new file mode 100644 index 0000000..0c702f7 Binary files /dev/null and b/img/sv_actors/SF_Actor2_2.png differ diff --git a/img/sv_actors/SF_Actor2_3.png b/img/sv_actors/SF_Actor2_3.png new file mode 100644 index 0000000..c76ea93 Binary files /dev/null and b/img/sv_actors/SF_Actor2_3.png differ diff --git a/img/sv_actors/SF_Actor2_4.png b/img/sv_actors/SF_Actor2_4.png new file mode 100644 index 0000000..a4a9eb6 Binary files /dev/null and b/img/sv_actors/SF_Actor2_4.png differ diff --git a/img/sv_actors/SF_Actor2_5.png b/img/sv_actors/SF_Actor2_5.png new file mode 100644 index 0000000..346ea58 Binary files /dev/null and b/img/sv_actors/SF_Actor2_5.png differ diff --git a/img/sv_actors/SF_Actor2_6.png b/img/sv_actors/SF_Actor2_6.png new file mode 100644 index 0000000..e65010f Binary files /dev/null and b/img/sv_actors/SF_Actor2_6.png differ diff --git a/img/sv_actors/SF_Actor2_7.png b/img/sv_actors/SF_Actor2_7.png new file mode 100644 index 0000000..e031667 Binary files /dev/null and b/img/sv_actors/SF_Actor2_7.png differ diff --git a/img/sv_actors/SF_Actor2_8.png b/img/sv_actors/SF_Actor2_8.png new file mode 100644 index 0000000..449b180 Binary files /dev/null and b/img/sv_actors/SF_Actor2_8.png differ diff --git a/img/sv_actors/SF_Actor3_5.png b/img/sv_actors/SF_Actor3_5.png new file mode 100644 index 0000000..7db0d7f Binary files /dev/null and b/img/sv_actors/SF_Actor3_5.png differ diff --git a/img/sv_actors/SF_Actor3_6.png b/img/sv_actors/SF_Actor3_6.png new file mode 100644 index 0000000..ecab485 Binary files /dev/null and b/img/sv_actors/SF_Actor3_6.png differ diff --git a/img/sv_actors/SF_Actor3_7.png b/img/sv_actors/SF_Actor3_7.png new file mode 100644 index 0000000..966036b Binary files /dev/null and b/img/sv_actors/SF_Actor3_7.png differ diff --git a/img/sv_actors/SF_Actor3_8.png b/img/sv_actors/SF_Actor3_8.png new file mode 100644 index 0000000..8162eee Binary files /dev/null and b/img/sv_actors/SF_Actor3_8.png differ diff --git a/img/sv_enemies/Actor1_3.png b/img/sv_enemies/Actor1_3.png new file mode 100644 index 0000000..3657983 Binary files /dev/null and b/img/sv_enemies/Actor1_3.png differ diff --git a/img/sv_enemies/Actor1_4.png b/img/sv_enemies/Actor1_4.png new file mode 100644 index 0000000..390683d Binary files /dev/null and b/img/sv_enemies/Actor1_4.png differ diff --git a/img/sv_enemies/Actor1_5.png b/img/sv_enemies/Actor1_5.png new file mode 100644 index 0000000..8d10f75 Binary files /dev/null and b/img/sv_enemies/Actor1_5.png differ diff --git a/img/sv_enemies/Actor1_6.png b/img/sv_enemies/Actor1_6.png new file mode 100644 index 0000000..667b555 Binary files /dev/null and b/img/sv_enemies/Actor1_6.png differ diff --git a/img/sv_enemies/Actor2_1.png b/img/sv_enemies/Actor2_1.png new file mode 100644 index 0000000..5d0ed57 Binary files /dev/null and b/img/sv_enemies/Actor2_1.png differ diff --git a/img/sv_enemies/Actor2_2.png b/img/sv_enemies/Actor2_2.png new file mode 100644 index 0000000..454957c Binary files /dev/null and b/img/sv_enemies/Actor2_2.png differ diff --git a/img/sv_enemies/Actor2_3.png b/img/sv_enemies/Actor2_3.png new file mode 100644 index 0000000..30a1df2 Binary files /dev/null and b/img/sv_enemies/Actor2_3.png differ diff --git a/img/sv_enemies/Actor2_4.png b/img/sv_enemies/Actor2_4.png new file mode 100644 index 0000000..b7e6f4a Binary files /dev/null and b/img/sv_enemies/Actor2_4.png differ diff --git a/img/sv_enemies/Actor2_5.png b/img/sv_enemies/Actor2_5.png new file mode 100644 index 0000000..f4214f1 Binary files /dev/null and b/img/sv_enemies/Actor2_5.png differ diff --git a/img/sv_enemies/Actor2_6.png b/img/sv_enemies/Actor2_6.png new file mode 100644 index 0000000..e3f48a7 Binary files /dev/null and b/img/sv_enemies/Actor2_6.png differ diff --git a/img/sv_enemies/Actor2_7.png b/img/sv_enemies/Actor2_7.png new file mode 100644 index 0000000..4e57dde Binary files /dev/null and b/img/sv_enemies/Actor2_7.png differ diff --git a/img/sv_enemies/Actor3_1.png b/img/sv_enemies/Actor3_1.png new file mode 100644 index 0000000..c76c7b5 Binary files /dev/null and b/img/sv_enemies/Actor3_1.png differ diff --git a/img/sv_enemies/Actor3_2.png b/img/sv_enemies/Actor3_2.png new file mode 100644 index 0000000..804270f Binary files /dev/null and b/img/sv_enemies/Actor3_2.png differ diff --git a/img/sv_enemies/Actor3_3.png b/img/sv_enemies/Actor3_3.png new file mode 100644 index 0000000..f5b73a7 Binary files /dev/null and b/img/sv_enemies/Actor3_3.png differ diff --git a/img/sv_enemies/Actor3_4.png b/img/sv_enemies/Actor3_4.png new file mode 100644 index 0000000..a7ee8d3 Binary files /dev/null and b/img/sv_enemies/Actor3_4.png differ diff --git a/img/sv_enemies/Berserker.png b/img/sv_enemies/Berserker.png new file mode 100644 index 0000000..f51727c Binary files /dev/null and b/img/sv_enemies/Berserker.png differ diff --git a/img/sv_enemies/Birdman.png b/img/sv_enemies/Birdman.png new file mode 100644 index 0000000..313f2b2 Binary files /dev/null and b/img/sv_enemies/Birdman.png differ diff --git a/img/sv_enemies/Blackknight.png b/img/sv_enemies/Blackknight.png new file mode 100644 index 0000000..501632b Binary files /dev/null and b/img/sv_enemies/Blackknight.png differ diff --git a/img/sv_enemies/Caitsith.png b/img/sv_enemies/Caitsith.png new file mode 100644 index 0000000..9a1693d Binary files /dev/null and b/img/sv_enemies/Caitsith.png differ diff --git a/img/sv_enemies/Captain.png b/img/sv_enemies/Captain.png new file mode 100644 index 0000000..42dfc8a Binary files /dev/null and b/img/sv_enemies/Captain.png differ diff --git a/img/sv_enemies/Crab.png b/img/sv_enemies/Crab.png new file mode 100644 index 0000000..ddfe4c5 Binary files /dev/null and b/img/sv_enemies/Crab.png differ diff --git a/img/sv_enemies/Crow.png b/img/sv_enemies/Crow.png new file mode 100644 index 0000000..978d089 Binary files /dev/null and b/img/sv_enemies/Crow.png differ diff --git a/img/sv_enemies/Darkelf.png b/img/sv_enemies/Darkelf.png new file mode 100644 index 0000000..e1239eb Binary files /dev/null and b/img/sv_enemies/Darkelf.png differ diff --git a/img/sv_enemies/Demon.png b/img/sv_enemies/Demon.png new file mode 100644 index 0000000..1d88781 Binary files /dev/null and b/img/sv_enemies/Demon.png differ diff --git a/img/sv_enemies/Demon_metamorphosis.png b/img/sv_enemies/Demon_metamorphosis.png new file mode 100644 index 0000000..387a52f Binary files /dev/null and b/img/sv_enemies/Demon_metamorphosis.png differ diff --git a/img/sv_enemies/Demoncount.png b/img/sv_enemies/Demoncount.png new file mode 100644 index 0000000..2277c27 Binary files /dev/null and b/img/sv_enemies/Demoncount.png differ diff --git a/img/sv_enemies/Demonpot.png b/img/sv_enemies/Demonpot.png new file mode 100644 index 0000000..d447a09 Binary files /dev/null and b/img/sv_enemies/Demonpot.png differ diff --git a/img/sv_enemies/Dragon.png b/img/sv_enemies/Dragon.png new file mode 100644 index 0000000..7e47f22 Binary files /dev/null and b/img/sv_enemies/Dragon.png differ diff --git a/img/sv_enemies/Evilbook.png b/img/sv_enemies/Evilbook.png new file mode 100644 index 0000000..28d0e59 Binary files /dev/null and b/img/sv_enemies/Evilbook.png differ diff --git a/img/sv_enemies/Evilgod.png b/img/sv_enemies/Evilgod.png new file mode 100644 index 0000000..b249130 Binary files /dev/null and b/img/sv_enemies/Evilgod.png differ diff --git a/img/sv_enemies/Foxman.png b/img/sv_enemies/Foxman.png new file mode 100644 index 0000000..152a518 Binary files /dev/null and b/img/sv_enemies/Foxman.png differ diff --git a/img/sv_enemies/Frilledlizard.png b/img/sv_enemies/Frilledlizard.png new file mode 100644 index 0000000..7c8fdb7 Binary files /dev/null and b/img/sv_enemies/Frilledlizard.png differ diff --git a/img/sv_enemies/Gatekeeper.png b/img/sv_enemies/Gatekeeper.png new file mode 100644 index 0000000..c266efc Binary files /dev/null and b/img/sv_enemies/Gatekeeper.png differ diff --git a/img/sv_enemies/Gnome.png b/img/sv_enemies/Gnome.png new file mode 100644 index 0000000..61fa2bd Binary files /dev/null and b/img/sv_enemies/Gnome.png differ diff --git a/img/sv_enemies/Goblin.png b/img/sv_enemies/Goblin.png new file mode 100644 index 0000000..bd83ce2 Binary files /dev/null and b/img/sv_enemies/Goblin.png differ diff --git a/img/sv_enemies/God_of_light.png b/img/sv_enemies/God_of_light.png new file mode 100644 index 0000000..e602253 Binary files /dev/null and b/img/sv_enemies/God_of_light.png differ diff --git a/img/sv_enemies/Goddess.png b/img/sv_enemies/Goddess.png new file mode 100644 index 0000000..90327df Binary files /dev/null and b/img/sv_enemies/Goddess.png differ diff --git a/img/sv_enemies/Goddess_of_death.png b/img/sv_enemies/Goddess_of_death.png new file mode 100644 index 0000000..17d09e4 Binary files /dev/null and b/img/sv_enemies/Goddess_of_death.png differ diff --git a/img/sv_enemies/Hakutaku.png b/img/sv_enemies/Hakutaku.png new file mode 100644 index 0000000..264ca81 Binary files /dev/null and b/img/sv_enemies/Hakutaku.png differ diff --git a/img/sv_enemies/Harpy.png b/img/sv_enemies/Harpy.png new file mode 100644 index 0000000..324570c Binary files /dev/null and b/img/sv_enemies/Harpy.png differ diff --git a/img/sv_enemies/Hi_monster.png b/img/sv_enemies/Hi_monster.png new file mode 100644 index 0000000..ab4148d Binary files /dev/null and b/img/sv_enemies/Hi_monster.png differ diff --git a/img/sv_enemies/Highking.png b/img/sv_enemies/Highking.png new file mode 100644 index 0000000..81ff69a Binary files /dev/null and b/img/sv_enemies/Highking.png differ diff --git a/img/sv_enemies/Hydra.png b/img/sv_enemies/Hydra.png new file mode 100644 index 0000000..c71f08f Binary files /dev/null and b/img/sv_enemies/Hydra.png differ diff --git a/img/sv_enemies/Ketos.png b/img/sv_enemies/Ketos.png new file mode 100644 index 0000000..79f8826 Binary files /dev/null and b/img/sv_enemies/Ketos.png differ diff --git a/img/sv_enemies/Kraken.png b/img/sv_enemies/Kraken.png new file mode 100644 index 0000000..2406eac Binary files /dev/null and b/img/sv_enemies/Kraken.png differ diff --git a/img/sv_enemies/Lich.png b/img/sv_enemies/Lich.png new file mode 100644 index 0000000..bd71329 Binary files /dev/null and b/img/sv_enemies/Lich.png differ diff --git a/img/sv_enemies/Machinerybee.png b/img/sv_enemies/Machinerybee.png new file mode 100644 index 0000000..cc3ba33 Binary files /dev/null and b/img/sv_enemies/Machinerybee.png differ diff --git a/img/sv_enemies/Matango.png b/img/sv_enemies/Matango.png new file mode 100644 index 0000000..14fed78 Binary files /dev/null and b/img/sv_enemies/Matango.png differ diff --git a/img/sv_enemies/Mechascorpion.png b/img/sv_enemies/Mechascorpion.png new file mode 100644 index 0000000..c0dfcf3 Binary files /dev/null and b/img/sv_enemies/Mechascorpion.png differ diff --git a/img/sv_enemies/Medusa.png b/img/sv_enemies/Medusa.png new file mode 100644 index 0000000..5d692ce Binary files /dev/null and b/img/sv_enemies/Medusa.png differ diff --git a/img/sv_enemies/Mercenary.png b/img/sv_enemies/Mercenary.png new file mode 100644 index 0000000..f6b8598 Binary files /dev/null and b/img/sv_enemies/Mercenary.png differ diff --git a/img/sv_enemies/Mimic.png b/img/sv_enemies/Mimic.png new file mode 100644 index 0000000..557271c Binary files /dev/null and b/img/sv_enemies/Mimic.png differ diff --git a/img/sv_enemies/Oddegg.png b/img/sv_enemies/Oddegg.png new file mode 100644 index 0000000..3aeaa50 Binary files /dev/null and b/img/sv_enemies/Oddegg.png differ diff --git a/img/sv_enemies/Petitdevil.png b/img/sv_enemies/Petitdevil.png new file mode 100644 index 0000000..ac3d19e Binary files /dev/null and b/img/sv_enemies/Petitdevil.png differ diff --git a/img/sv_enemies/Plasma.png b/img/sv_enemies/Plasma.png new file mode 100644 index 0000000..f0096a3 Binary files /dev/null and b/img/sv_enemies/Plasma.png differ diff --git a/img/sv_enemies/SF_Agent.png b/img/sv_enemies/SF_Agent.png new file mode 100644 index 0000000..354d39c Binary files /dev/null and b/img/sv_enemies/SF_Agent.png differ diff --git a/img/sv_enemies/SF_Anaconda.png b/img/sv_enemies/SF_Anaconda.png new file mode 100644 index 0000000..65bff37 Binary files /dev/null and b/img/sv_enemies/SF_Anaconda.png differ diff --git a/img/sv_enemies/SF_ArmyGorilla.png b/img/sv_enemies/SF_ArmyGorilla.png new file mode 100644 index 0000000..5bfe9b1 Binary files /dev/null and b/img/sv_enemies/SF_ArmyGorilla.png differ diff --git a/img/sv_enemies/SF_Armymonkey.png b/img/sv_enemies/SF_Armymonkey.png new file mode 100644 index 0000000..910ef5b Binary files /dev/null and b/img/sv_enemies/SF_Armymonkey.png differ diff --git a/img/sv_enemies/SF_Blueogre.png b/img/sv_enemies/SF_Blueogre.png new file mode 100644 index 0000000..5f9009f Binary files /dev/null and b/img/sv_enemies/SF_Blueogre.png differ diff --git a/img/sv_enemies/SF_Boss.png b/img/sv_enemies/SF_Boss.png new file mode 100644 index 0000000..ce44b8c Binary files /dev/null and b/img/sv_enemies/SF_Boss.png differ diff --git a/img/sv_enemies/SF_Brownbear.png b/img/sv_enemies/SF_Brownbear.png new file mode 100644 index 0000000..082ab41 Binary files /dev/null and b/img/sv_enemies/SF_Brownbear.png differ diff --git a/img/sv_enemies/SF_Cyborg.png b/img/sv_enemies/SF_Cyborg.png new file mode 100644 index 0000000..a56207f Binary files /dev/null and b/img/sv_enemies/SF_Cyborg.png differ diff --git a/img/sv_enemies/SF_Demon_of_universe.png b/img/sv_enemies/SF_Demon_of_universe.png new file mode 100644 index 0000000..1022dfb Binary files /dev/null and b/img/sv_enemies/SF_Demon_of_universe.png differ diff --git a/img/sv_enemies/SF_Drone.png b/img/sv_enemies/SF_Drone.png new file mode 100644 index 0000000..59325bb Binary files /dev/null and b/img/sv_enemies/SF_Drone.png differ diff --git a/img/sv_enemies/SF_Enmadaio.png b/img/sv_enemies/SF_Enmadaio.png new file mode 100644 index 0000000..3d7a22d Binary files /dev/null and b/img/sv_enemies/SF_Enmadaio.png differ diff --git a/img/sv_enemies/SF_Evilteddybear.png b/img/sv_enemies/SF_Evilteddybear.png new file mode 100644 index 0000000..49c5a17 Binary files /dev/null and b/img/sv_enemies/SF_Evilteddybear.png differ diff --git a/img/sv_enemies/SF_Hannyamask.png b/img/sv_enemies/SF_Hannyamask.png new file mode 100644 index 0000000..d7f08b3 Binary files /dev/null and b/img/sv_enemies/SF_Hannyamask.png differ diff --git a/img/sv_enemies/SF_Hermit.png b/img/sv_enemies/SF_Hermit.png new file mode 100644 index 0000000..db71e1f Binary files /dev/null and b/img/sv_enemies/SF_Hermit.png differ diff --git a/img/sv_enemies/SF_Jiangshi.png b/img/sv_enemies/SF_Jiangshi.png new file mode 100644 index 0000000..96d5773 Binary files /dev/null and b/img/sv_enemies/SF_Jiangshi.png differ diff --git a/img/sv_enemies/SF_Kamaitachi.png b/img/sv_enemies/SF_Kamaitachi.png new file mode 100644 index 0000000..7fb304b Binary files /dev/null and b/img/sv_enemies/SF_Kamaitachi.png differ diff --git a/img/sv_enemies/SF_Kappa.png b/img/sv_enemies/SF_Kappa.png new file mode 100644 index 0000000..273a2bc Binary files /dev/null and b/img/sv_enemies/SF_Kappa.png differ diff --git a/img/sv_enemies/SF_Madclown.png b/img/sv_enemies/SF_Madclown.png new file mode 100644 index 0000000..0a8ae5c Binary files /dev/null and b/img/sv_enemies/SF_Madclown.png differ diff --git a/img/sv_enemies/SF_Madscientist.png b/img/sv_enemies/SF_Madscientist.png new file mode 100644 index 0000000..5e657a9 Binary files /dev/null and b/img/sv_enemies/SF_Madscientist.png differ diff --git a/img/sv_enemies/SF_Mafia.png b/img/sv_enemies/SF_Mafia.png new file mode 100644 index 0000000..52a17f3 Binary files /dev/null and b/img/sv_enemies/SF_Mafia.png differ diff --git a/img/sv_enemies/SF_Mechasphere.png b/img/sv_enemies/SF_Mechasphere.png new file mode 100644 index 0000000..03add87 Binary files /dev/null and b/img/sv_enemies/SF_Mechasphere.png differ diff --git a/img/sv_enemies/SF_Phoenix.png b/img/sv_enemies/SF_Phoenix.png new file mode 100644 index 0000000..d420717 Binary files /dev/null and b/img/sv_enemies/SF_Phoenix.png differ diff --git a/img/sv_enemies/SF_Redogre.png b/img/sv_enemies/SF_Redogre.png new file mode 100644 index 0000000..a66c3f1 Binary files /dev/null and b/img/sv_enemies/SF_Redogre.png differ diff --git a/img/sv_enemies/SF_Securityrobot.png b/img/sv_enemies/SF_Securityrobot.png new file mode 100644 index 0000000..51179b2 Binary files /dev/null and b/img/sv_enemies/SF_Securityrobot.png differ diff --git a/img/sv_enemies/SF_Shadow.png b/img/sv_enemies/SF_Shadow.png new file mode 100644 index 0000000..1cca521 Binary files /dev/null and b/img/sv_enemies/SF_Shadow.png differ diff --git a/img/sv_enemies/SF_Skullmask.png b/img/sv_enemies/SF_Skullmask.png new file mode 100644 index 0000000..176e282 Binary files /dev/null and b/img/sv_enemies/SF_Skullmask.png differ diff --git a/img/sv_enemies/SF_Slaughterrobot.png b/img/sv_enemies/SF_Slaughterrobot.png new file mode 100644 index 0000000..b963c6c Binary files /dev/null and b/img/sv_enemies/SF_Slaughterrobot.png differ diff --git a/img/sv_enemies/SF_Specialforces.png b/img/sv_enemies/SF_Specialforces.png new file mode 100644 index 0000000..ee210f6 Binary files /dev/null and b/img/sv_enemies/SF_Specialforces.png differ diff --git a/img/sv_enemies/SF_Talkingmuppet.png b/img/sv_enemies/SF_Talkingmuppet.png new file mode 100644 index 0000000..e662195 Binary files /dev/null and b/img/sv_enemies/SF_Talkingmuppet.png differ diff --git a/img/sv_enemies/SF_Timebomb.png b/img/sv_enemies/SF_Timebomb.png new file mode 100644 index 0000000..5dff5b5 Binary files /dev/null and b/img/sv_enemies/SF_Timebomb.png differ diff --git a/img/sv_enemies/SF_Whitewolf.png b/img/sv_enemies/SF_Whitewolf.png new file mode 100644 index 0000000..3a05c0b Binary files /dev/null and b/img/sv_enemies/SF_Whitewolf.png differ diff --git a/img/sv_enemies/SF_Will_o_the_wisp.png b/img/sv_enemies/SF_Will_o_the_wisp.png new file mode 100644 index 0000000..cc15842 Binary files /dev/null and b/img/sv_enemies/SF_Will_o_the_wisp.png differ diff --git a/img/sv_enemies/SF_Wolf.png b/img/sv_enemies/SF_Wolf.png new file mode 100644 index 0000000..04ddf89 Binary files /dev/null and b/img/sv_enemies/SF_Wolf.png differ diff --git a/img/sv_enemies/SF_Workrobot.png b/img/sv_enemies/SF_Workrobot.png new file mode 100644 index 0000000..0574055 Binary files /dev/null and b/img/sv_enemies/SF_Workrobot.png differ diff --git a/img/sv_enemies/SF_Zombiedog.png b/img/sv_enemies/SF_Zombiedog.png new file mode 100644 index 0000000..915cd32 Binary files /dev/null and b/img/sv_enemies/SF_Zombiedog.png differ diff --git a/img/sv_enemies/Sailor.png b/img/sv_enemies/Sailor.png new file mode 100644 index 0000000..3e93e99 Binary files /dev/null and b/img/sv_enemies/Sailor.png differ diff --git a/img/sv_enemies/Salamander.png b/img/sv_enemies/Salamander.png new file mode 100644 index 0000000..1f704fe Binary files /dev/null and b/img/sv_enemies/Salamander.png differ diff --git a/img/sv_enemies/Sandworm.png b/img/sv_enemies/Sandworm.png new file mode 100644 index 0000000..d0c30b7 Binary files /dev/null and b/img/sv_enemies/Sandworm.png differ diff --git a/img/sv_enemies/Siren.png b/img/sv_enemies/Siren.png new file mode 100644 index 0000000..65c7f41 Binary files /dev/null and b/img/sv_enemies/Siren.png differ diff --git a/img/sv_enemies/Sorcerer.png b/img/sv_enemies/Sorcerer.png new file mode 100644 index 0000000..c9c7de0 Binary files /dev/null and b/img/sv_enemies/Sorcerer.png differ diff --git a/img/sv_enemies/Stoneknight.png b/img/sv_enemies/Stoneknight.png new file mode 100644 index 0000000..fe1435a Binary files /dev/null and b/img/sv_enemies/Stoneknight.png differ diff --git a/img/sv_enemies/Sylph.png b/img/sv_enemies/Sylph.png new file mode 100644 index 0000000..bd7cc98 Binary files /dev/null and b/img/sv_enemies/Sylph.png differ diff --git a/img/sv_enemies/Tigerbunny.png b/img/sv_enemies/Tigerbunny.png new file mode 100644 index 0000000..543c6f1 Binary files /dev/null and b/img/sv_enemies/Tigerbunny.png differ diff --git a/img/sv_enemies/Treant.png b/img/sv_enemies/Treant.png new file mode 100644 index 0000000..976ba8b Binary files /dev/null and b/img/sv_enemies/Treant.png differ diff --git a/img/sv_enemies/Undine.png b/img/sv_enemies/Undine.png new file mode 100644 index 0000000..17ccda9 Binary files /dev/null and b/img/sv_enemies/Undine.png differ diff --git a/img/sv_enemies/Unicorn.png b/img/sv_enemies/Unicorn.png new file mode 100644 index 0000000..6d9acaa Binary files /dev/null and b/img/sv_enemies/Unicorn.png differ diff --git a/img/sv_enemies/Witch.png b/img/sv_enemies/Witch.png new file mode 100644 index 0000000..44d93d2 Binary files /dev/null and b/img/sv_enemies/Witch.png differ diff --git a/img/sv_enemies/Wolfman.png b/img/sv_enemies/Wolfman.png new file mode 100644 index 0000000..365a2ed Binary files /dev/null and b/img/sv_enemies/Wolfman.png differ diff --git a/img/sv_enemies/Wraith.png b/img/sv_enemies/Wraith.png new file mode 100644 index 0000000..6c89e29 Binary files /dev/null and b/img/sv_enemies/Wraith.png differ diff --git a/img/sv_enemies/Zombie.png b/img/sv_enemies/Zombie.png new file mode 100644 index 0000000..c8efd61 Binary files /dev/null and b/img/sv_enemies/Zombie.png differ diff --git a/img/system/Balloon.png b/img/system/Balloon.png new file mode 100644 index 0000000..969069e Binary files /dev/null and b/img/system/Balloon.png differ diff --git a/img/system/ButtonSet.png b/img/system/ButtonSet.png new file mode 100644 index 0000000..954ad7b Binary files /dev/null and b/img/system/ButtonSet.png differ diff --git a/img/system/GameOver.png b/img/system/GameOver.png new file mode 100644 index 0000000..5c19209 Binary files /dev/null and b/img/system/GameOver.png differ diff --git a/img/system/IconSet.png b/img/system/IconSet.png new file mode 100644 index 0000000..356ac49 Binary files /dev/null and b/img/system/IconSet.png differ diff --git a/img/system/Shadow1.png b/img/system/Shadow1.png new file mode 100644 index 0000000..b3ecae1 Binary files /dev/null and b/img/system/Shadow1.png differ diff --git a/img/system/Shadow2.png b/img/system/Shadow2.png new file mode 100644 index 0000000..7de1760 Binary files /dev/null and b/img/system/Shadow2.png differ diff --git a/img/system/Splash.png b/img/system/Splash.png new file mode 100644 index 0000000..49eb7ff Binary files /dev/null and b/img/system/Splash.png differ diff --git a/img/system/States.png b/img/system/States.png new file mode 100644 index 0000000..ecc0078 Binary files /dev/null and b/img/system/States.png differ diff --git a/img/system/Weapons1.png b/img/system/Weapons1.png new file mode 100644 index 0000000..10da0ba Binary files /dev/null and b/img/system/Weapons1.png differ diff --git a/img/system/Weapons2.png b/img/system/Weapons2.png new file mode 100644 index 0000000..fa5de02 Binary files /dev/null and b/img/system/Weapons2.png differ diff --git a/img/system/Weapons3.png b/img/system/Weapons3.png new file mode 100644 index 0000000..cf1af2d Binary files /dev/null and b/img/system/Weapons3.png differ diff --git a/img/system/Window.png b/img/system/Window.png new file mode 100644 index 0000000..084bf62 Binary files /dev/null and b/img/system/Window.png differ diff --git a/img/tilesets/Dungeon_A1.png b/img/tilesets/Dungeon_A1.png new file mode 100644 index 0000000..34458d0 Binary files /dev/null and b/img/tilesets/Dungeon_A1.png differ diff --git a/img/tilesets/Dungeon_A1.txt b/img/tilesets/Dungeon_A1.txt new file mode 100644 index 0000000..881cd0f --- /dev/null +++ b/img/tilesets/Dungeon_A1.txt @@ -0,0 +1,16 @@ +Water A|水場A +Deep Water|深い水場 +Swamp Grass|水草 +Lotus Pads (Flowers)|蓮の葉(花) +Lava|溶岩 +Waterfall A (Lava Cave)|滝A(溶岩洞窟) +Water B (Grass Maze)|水場B(草迷宮) +Waterfall B (Grass Maze)|滝B(草迷宮) +Water C (Dirt Cave)|水場C(土洞窟) +Waterfall C (Dirt Cave)|滝C(土洞窟) +Water D (Rock Cave)|水場D(岩洞窟) +Waterfall D (Rock Cave)|滝D(岩洞窟) +Water E (Crystal)|水場E(水晶) +Waterfall E (Crystal)|滝E(水晶) +Canal|水路 +Waterfall (Stone Wall)|滝F(石壁) diff --git a/img/tilesets/Dungeon_A2.png b/img/tilesets/Dungeon_A2.png new file mode 100644 index 0000000..606400e Binary files /dev/null and b/img/tilesets/Dungeon_A2.png differ diff --git a/img/tilesets/Dungeon_A2.txt b/img/tilesets/Dungeon_A2.txt new file mode 100644 index 0000000..1fc02f7 --- /dev/null +++ b/img/tilesets/Dungeon_A2.txt @@ -0,0 +1,32 @@ +Ground A (Dirt Cave)|床A(土洞窟) +Ground B (Grass Maze)|床B(草迷宮) +Dark Ground A (Dirt Cave)|濃い床A(土洞窟) +Dark Ground B (Grass Maze)|濃い床B(草迷宮) +Hole A (Dirt Cave)|穴A(土洞窟) +Hole B (Grass Maze)|穴B(草迷宮) +Hole I (Stone Floor)|穴I(石の床) +Ground Cracks|床のひび割れ +Ground C (Rock Cave)|床C(岩洞窟) +Ground D (Crystal)|床D(水晶) +Dark Ground C (Rock Cave)|濃い床C(岩洞窟) +Dark Ground D (Crystal)|濃い床D(水晶) +Hole C (Rock Cave)|穴C(岩洞窟) +Hole D (Crystal)|穴D(水晶) +Hole J|穴J +Soil on Ground|床の汚れ +Ground E (Lava Cave)|床E(溶岩洞窟) +Ground F (In Body)|床F(体内) +Dark Ground E (Lava Cave)|濃い床E(溶岩洞窟) +Rug A|じゅうたんA +Hole E (Lava Cave)|穴E(溶岩洞窟) +Hole F (In Body)|穴F(体内) +Fencepost|柵 +Moss on Ground|床の苔 +Ground G (Ice Cave)|床G(氷洞窟) +Ground H (Demonic World)|床H(魔界) +Dark Ground G (Ice Cave)|濃い床G(氷洞窟) +Rug B|じゅうたんB +Hole G (Ice Cave)|穴G(氷洞窟) +Hole H (Demonic World)|穴H(魔界) +Raised Stone|石段 +Poison Swamp|毒の沼 diff --git a/img/tilesets/Dungeon_A4.png b/img/tilesets/Dungeon_A4.png new file mode 100644 index 0000000..1059bc1 Binary files /dev/null and b/img/tilesets/Dungeon_A4.png differ diff --git a/img/tilesets/Dungeon_A4.txt b/img/tilesets/Dungeon_A4.txt new file mode 100644 index 0000000..22ef370 --- /dev/null +++ b/img/tilesets/Dungeon_A4.txt @@ -0,0 +1,48 @@ +Wall A (Dirt Cave)|壁A(土洞窟) +Wall B (Rock Cave)|壁B(岩洞窟) +Wall C (Lava Cave)|壁C(溶岩洞窟) +Wall D (Ice Cave)|壁D(氷洞窟) +Wall E (Grass Maze)|壁E(草迷宮) +Wall F (Crystal)|壁F(水晶) +Wall G (In Body)|壁G(体内) +Wall H (Demonic World)|壁H(魔界) +Wall A (Dirt Cave)|壁A(土洞窟) +Wall B (Rock Cave)|壁B(岩洞窟) +Wall C (Lava Cave)|壁C(溶岩洞窟) +Wall D (Ice Cave)|壁D(氷洞窟) +Wall E (Grass Maze)|壁E(草迷宮) +Wall F (Crystal)|壁F(水晶) +Wall G (In Body)|壁G(体内) +Wall H (Demonic World)|壁H(魔界) +Wall I (Stone)|壁I(石) +Wall J (Brick)|壁J(レンガ) +Wall K (Stone)|壁K(石) +Wall L (Marble)|壁L(大理石) +Wall M (Moss)|壁M(苔) +Wall N (Castle)|壁N(城) +Wall O (Fort)|壁O(砦) +Wall P (Demon Castle)|壁P(魔王城) +Wall I (Stone)|壁I(石) +Wall J (Brick)|壁J(レンガ) +Wall K (Stone)|壁K(石) +Wall L (Marble)|壁L(大理石) +Wall M (Moss)|壁M(苔) +Wall N (Castle)|壁N(城) +Wall O (Fort)|壁O(砦) +Wall P (Demon Castle)|壁P(魔王城) +Wall Q (Mecha)|壁Q(メカ) +Wall R (Stone)|壁R(石) +Wall S (Frozen)|壁S(凍結) +Wall T (Dirt Cave, Gold)|壁T(土洞窟・黄金) +Ledge A (Dirt Cave)|段差A(土洞窟) +Ledge B (Rock Cave)|段差B(岩洞窟) +Ledge C (Lava Cave)|段差C(溶岩洞窟) +Ledge D (Ice Cave)|段差D(氷洞窟) +Wall Q (Mecha)|壁Q(メカ) +Wall R (Stone)|壁R(石) +Wall S (Frozen)|壁S(凍結) +Wall T (Dirt Cave, Gold)|壁T(土洞窟・黄金) +Ledge A (Dirt Cave)|段差A(土洞窟) +Ledge B (Rock Cave)|段差B(岩洞窟) +Ledge C (Lava Cave)|段差C(溶岩洞窟) +Ledge D (Ice Cave)|段差D(氷洞窟) diff --git a/img/tilesets/Dungeon_A5.png b/img/tilesets/Dungeon_A5.png new file mode 100644 index 0000000..ccdf9ec Binary files /dev/null and b/img/tilesets/Dungeon_A5.png differ diff --git a/img/tilesets/Dungeon_A5.txt b/img/tilesets/Dungeon_A5.txt new file mode 100644 index 0000000..b4466b8 --- /dev/null +++ b/img/tilesets/Dungeon_A5.txt @@ -0,0 +1,128 @@ +Darkness|暗闇 +Floating Floor A (Dirt)|浮かぶ床A(土) +Floating Floor B (Rock)|浮かぶ床B(岩) +Translucent Floor A|半透明の床A +Translucent Floor B|半透明の床B +Stairs A (Dirt)|階段A(土) +Stairs B (Translucent)|階段B(半透明) +Wire Mesh|金網 +Transparent|透明 +Floating Floor A (Dirt)|浮かぶ床A(土) +Floating Floor B (Rock)|浮かぶ床B(岩) +Translucent Floor A|半透明の床A +Translucent Floor B|半透明の床B +Stairs A (Rock)|階段A(岩) +Stairs B (Translucent)|階段B(半透明) +Wire Mesh|金網 +Ground A (Wood)|床A(木製) +Ground B (Wood)|床B(木製) +Ground (Wood, Ruins)|床A(木製・廃墟) +Ground (Wood, Ruins)|床B(木製・廃墟) +Cobblestones A|石畳A +Cobblestones B|石畳B +Cobblestones C|石畳C +Cobblestones D|石畳D +Cobblestones E|石畳E +Decorative Tile A|化粧タイルA +Decorative Tile B|化粧タイルB +Interior Floor A|内装床A +Interior Floor B (Light)|内装床B(明かり) +Tile Floor A|タイル床A +Tile Floor B|タイル床B +Tile Floor C|タイル床C +Cobblestones F|石畳F +Ground C (Rock Cave, Red Crystal)|床C(岩洞窟・赤水晶) +Ground D (Rock Cave, Blue Crystal)|床D(岩洞窟・青水晶) +Ground E (Rock Cave, Green Crystal)|床E(岩洞窟・緑水晶) +Ground F (Dirt)|床F(土) +Ground G (Demon Castle)|床G(魔王城) +Ground H (Gold)|床H(黄金) +Ground I (Ice)|床I(氷) +Stairs A (Dirt Cave, Left)|階段A(土洞窟・左) +Stairs A (Dirt Cave, Center)|階段A(土洞窟・中央) +Stairs A (Dirt Cave, Right)|階段A(土洞窟・右) +Stairs A (Dirt Cave)|階段A(土洞窟) +Stairs B (Rock Cave, Left)|階段B(岩洞窟・左) +Stairs B (Rock Cave, Center)|階段B(岩洞窟・中央) +Stairs B (Rock Cave, Right)|階段B(岩洞窟・右) +Stairs B (Rock Cave)|階段B(岩洞窟) +Stairs C (Lava Cave, Left)|階段C(溶岩洞窟・左) +Stairs C (Lava Cave, Center)|階段C(溶岩洞窟・中央) +Stairs C (Lava Cave, Right)|階段C(溶岩洞窟・右) +Stairs C (Lava Cave)|階段C(溶岩洞窟) +Stairs D (Ice Cave, Left)|階段D(氷洞窟・左) +Stairs D (Ice Cave, Center)|階段D(氷洞窟・中央) +Stairs D (Ice Cave, Right)|階段D(氷洞窟・右) +Stairs D (Ice Cave)|階段D(氷洞窟) +Stairs E (Grass Maze, Left)|階段E(草迷宮・左) +Stairs E (Grass Maze, Center)|階段E(草迷宮・中央) +Stairs E (Grass Maze, Right)|階段E(草迷宮・右) +Stairs E (Grass Maze)|階段E(草迷宮) +Stairs F (Crystal, Left)|階段F(水晶・左) +Stairs F (Crystal, Center)|階段F(水晶・中央) +Stairs F (Crystal, Right)|階段F(水晶・右) +Stairs F (Crystal)|階段F(水晶) +Stairs G (In Body, Left)|階段G(体内・左) +Stairs G (In Body, Center)|階段G(体内・中央) +Stairs G (In Body, Right)|階段G(体内・右) +Stairs G (In Body)|階段G(体内) +Stairs H (Demonic World, Left)|階段H(魔界・左) +Stairs H (Demonic World, Center)|階段H(魔界・中央) +Stairs H (Demonic World, Right)|階段H(魔界・右) +Stairs H (Demonic World)|階段H(魔界) +Stairs I (Stone, Left)|階段I(石・左) +Stairs I (Stone, Center)|階段I(石・中央) +Stairs I (Stone, Right)|階段I(石・右) +Stairs I (Stone)|階段I(石) +Stairs J (Ruins, Left)|階段J(廃墟・左) +Stairs J (Ruins, Center)|階段J(廃墟・中央) +Stairs J (Ruins, Right)|階段J(廃墟・右) +Stairs J (Ruins)|階段J(廃墟) +Stairs K (Stone, Left)|階段K(石・左) +Stairs K (Stone, Center)|階段K(石・中央) +Stairs K (Stone, Right)|階段K(石・右) +Stairs K (Stone)|階段K(石) +Stairs L (Ruins, Left)|階段L(廃墟・左) +Stairs L (Ruins, Center)|階段L(廃墟・中央) +Stairs L (Ruins, Right)|階段L(廃墟・右) +Stairs L (Ruins)|階段L(廃墟) +Ground (Dirt Cave, Ruins)|床A(土洞窟・廃墟) +Ground (Rock Cave, Ruins)|床B(岩洞窟・廃墟) +Ground (Lava Cave, Ruins)|床C(溶岩洞窟・廃墟) +Ground (Ice Cave, Ruins)|床D(氷洞窟・廃墟) +Ground (Grass Maze, Ruins)|床E(草迷宮・廃墟) +Ground (Crystal, Ruins)|床F(水晶・廃墟) +Ground (In Body, Ruins)|床G(体内・廃墟) +Ground (Demonic World, Ruins)|床H(魔界・廃墟) +Cobblestones A (Ruins)|石畳A(廃墟) +Cobblestones B (Ruins)|石畳B(廃墟) +Cobblestones C (Ruins)|石畳C(廃墟) +Cobblestones D (Ruins)|石畳D(廃墟) +Cobblestones E (Ruins)|石畳E(廃墟) +Decorative Tile A (Ruins)|化粧タイルA(廃墟) +Decorative Tile B (Ruins)|化粧タイルB(廃墟) +Interior Floor A (Ruins)|内装床A(廃墟) +Tile Floor A (Ruins)|タイル床A(廃墟) +Tile Floor B (Ruins)|タイル床B(廃墟) +Tile Floor C (Ruins)|タイル床C(廃墟) +Cobblestones F (Ruins)|石畳F(廃墟) +Ground F (Dirt, Ruins)|床F(土・廃墟) +Ground G (Demon Castle, Ruins)|床G(魔王城・廃墟) +Ground I (Ice, Ruins)|床I(氷・廃墟) +Relief Floor Tile (Silver)|レリーフ床(銀) +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Directional Floor Tile A (Down)|方向床A(下) +Directional Floor Tile B (Up)|方向床B(上) +Relief Floor Tile A (Gold)|レリーフ床A(金) +Relief Floor Tile B (Gold)|レリーフ床B(金) +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Directional Floor Tile C (Left)|方向床C(左) +Directional Floor Tile D (Right)|方向床D(右) +Relief Floor Tile C (Gold)|レリーフ床C(金) +Relief Floor Tile D (Gold, Ruins)|レリーフ床D(金・廃墟) diff --git a/img/tilesets/Dungeon_B.png b/img/tilesets/Dungeon_B.png new file mode 100644 index 0000000..5033fe0 Binary files /dev/null and b/img/tilesets/Dungeon_B.png differ diff --git a/img/tilesets/Dungeon_B.txt b/img/tilesets/Dungeon_B.txt new file mode 100644 index 0000000..c4d2ad4 --- /dev/null +++ b/img/tilesets/Dungeon_B.txt @@ -0,0 +1,256 @@ +Transparent|透明 +Wall Moss|壁の苔 +Stairs A (Up)|階段A(上り) +Stairs B (Up)|階段B(上り) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Vines A|ツタA +Fissures A|亀裂A +Wall Fern|壁のシダ +Stairs A (Down)|階段A(下り) +Stairs B (Down)|階段B(下り) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Vines A|ツタA +Crumbling Wall|崩れた壁 +Dug-Up Ground|掘られた床 +Stairs C (Up)|階段C(上り) +Stairs D (Up)|階段D(上り) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Vines B (Down)|ツタB(下り) +Crumbling Wall|崩れた壁 +Dug-Up Ground|掘られた床 +Stairs C (Down)|階段C(下り) +Stairs D (Down)|階段D(下り) +Hole A (Metal Ladder)|穴A(鉄ばしご) +Hole B (Wood Ladder)|穴B(木製はしご) +Hole C (Rope)|穴C(ロープ) +Hole D|穴D +Gravel A (Dirt Cave)|砂利A(土洞窟) +Gravel B (Rock Cave)|砂利B(岩洞窟) +Gravel C (Lava Cave)|砂利C(溶岩洞窟) +Ice Pieces |氷の欠片 +Small Sprouts A (Grass Maze)|小さな芽A(草迷宮) +Small Crystals|小さな水晶 +Detritus (In Body)|床装飾(体内) +Small Sprouts B (Demonic World)|小さな芽B(魔界) +Boulder A (Dirt Cave)|岩A(土洞窟) +Boulder B (Rock Cave)|岩B(岩洞窟) +Boulder C (Lava Cave)|岩C(溶岩洞窟) +Lump of Ice|氷塊 +Boulder D (Grass Maze)|岩D(草迷宮) +Crystal|水晶 +Spherical Lump|球状突起物 +Boulder E (Demonic World)|岩E(魔界) +Tall Rock A (Dirt Cave)|大きな岩A(土洞窟) +Tall Rock B (Rock Cave)|大きな岩B(岩洞窟) +Tall Rock C (Lava Cave)|大きな岩C(溶岩洞窟) +Tall Lump of Ice|大きな氷塊 +Tall Rock D (Grass Maze)|大きな岩D(草迷宮) +Large Crystal|大きな水晶 +Large Growth|大型突起物 +Tall Rock E (Demonic World)|大きな岩E(魔界) +Tall Rock A (Dirt Cave)|大きな岩A(土洞窟) +Tall Rock B (Rock Cave)|大きな岩B(岩洞窟) +Tall Rock C (Lava Cave)|大きな岩C(溶岩洞窟) +Tall Lump of Ice|大きな氷塊 +Tall Rock D (Grass Maze)|大きな岩D(草迷宮) +Large Crystal|大きな水晶 +Large Growth|大型突起物 +Tall Rock E (Demonic World)|大きな岩E(魔界) +Monument A|石碑A +Monument B|石碑B +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument (Light)|大きな石碑(光) +Large Monument (Light)|大きな石碑(光) +Large Monument (Light)|大きな石碑(光) +Monument A|石碑A +Monument C|石碑C +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument (Light)|大きな石碑(光) +Large Monument (Light)|大きな石碑(光) +Large Monument (Light)|大きな石碑(光) +Statue|石像 +Angel Statue|天使像 +Goddess Statue|女神像 +Dais|台座 +God Statue|神像 +Demon Statue|悪魔像 +Dragon Statue|竜像 +Dragon Statue|竜像 +Statue|石像 +Angel Statue|天使像 +Goddess Statue|女神像 +Broken Statue|壊れた像 +God Statue|神像 +Demon Statue|悪魔像 +Dragon Statue|竜像 +Dragon Statue|竜像 +Obelisk|オベリスク +Stone Pillar A|石の柱A +Stone Pillar B|石の柱B +Stone Pillar B (Moss)|石の柱B(苔) +Stone Pillar B (Ice)|石の柱B(氷) +Stone Pillar C|石の柱C +Stone Pillar D|石の柱D +Orb Pillar|オーブの柱 +Obelisk|オベリスク +Stone Pillar A|石の柱A +Stone Pillar B|石の柱B +Stone Pillar B (Moss)|石の柱B(苔) +Stone Pillar B (Ice)|石の柱B(氷) +Stone Pillar C|石の柱C +Stone Pillar D|石の柱D +Orb Pillar|オーブの柱 +Obelisk|オベリスク +Broken Stone Pillar A|折れた石の柱A +Broken Stone Pillar B|折れた石の柱B +Broken Stone Pillar B (Moss)|折れた石の柱B(苔) +Broken Stone Pillar B (Ice)|折れた石の柱B(氷) +Stone Pillar C|石の柱C +Broken Stone Pillar D|折れた石の柱D +Broken Orb Pillar|折れたオーブの柱 +Rubble|瓦礫A +Rubble (Moss)|瓦礫B(苔) +Rubble (Ice)|瓦礫C(氷) +Broken Stone Pillar C|折れた石の柱C +Rubble (Dirt)|瓦礫D(土) +Scrap Wood|端材 +Barricade A (H)|バリケードA(横) +Barricade B (V)|バリケードB(縦) +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing (Abandoned Mine)|壁の補強材(廃坑) +Wall Bracing (Abandoned Mine)|壁の補強材(廃坑) +Wall Bracing (Abandoned Mine)|壁の補強材(廃坑) +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing|壁の補強材 +Wall Bracing (Abandoned Mine)|壁の補強材(廃坑) +Wall Bracing (Abandoned Mine)|壁の補強材(廃坑) +Wall Bracing (Abandoned Mine)|壁の補強材(廃坑) +Log Bridge (V)|丸太の橋(縦) +Log Bridge (H)|丸太の橋(横) +Wood Bridge (V)|木の橋(縦) +Wood Bridge (H)|木の橋(横) +Stone Bridge (V)|石の橋(縦) +Stone Bridge (H)|石の橋(横) +Wood Bridge (V)|木の橋(縦) +Wood Bridge (H)|木の橋(横) +Bridge Spar (Wood, Center A)|橋げた(木・中央A) +Bridge Spar (Wood, Left)|橋げた(木・左) +Bridge Spar (Wood, Center B)|橋げた(木・中央B) +Bridge Spar (Wood, Right)|橋げた(木・右) +Bridge Spar (Stone, Center A)|橋げた(石・中央A) +Bridge Spar (Stone, Left)|橋げた(石・左) +Bridge Spar (Stone, Center B)||橋げた(石・中央B) +Bridge Spar (Stone, Right)|橋げた(石・右) +Exit A|外への出口A +Entrance A|入口A +Exit B|外への出口B +Entrance B|入口B +Exit C|外への出口C +Entrance C|入口C +Window A|窓A +Window B|窓B +Exit D|外への出口D +Entrance D|入口D +Exit E|外への出口E +Entrance E|入口E +Light From Exit A (Top)|出口からの光A(上) +Light From Exit B (Bottom)|出口からの光B(下) +Window A|窓A +Window B|窓B +Spider Web|蜘蛛の巣 +Stone Tablet|石版 +Stone Tablet (Ruins)|石版(廃墟) +Entrance A|入口A +Entrance A (Extend)|入口A(延長部分) +Entrance A (Top Half A)|入口A(上半分A) +Entrance B|入口B +Entrance A (Top Half B)|入口A(上半分B) +Wall Vines A|壁のツタA +Wall Vines B|壁のツタB +Wall Vines C|壁のツタC +Fissures B|亀裂B +Fissures C|亀裂C +Fissures D|亀裂D +Fissures E|亀裂E +Beanstalk A|豆の木A +Wall Vines A|壁のツタA +Wall Vines B|壁のツタB +Wall Vines C|壁のツタC +Fissures B|亀裂B +Fissures C|亀裂C +Fissures D|亀裂D +Beanstalk B (Snow)|豆の木B(雪) +Beanstalk C (Dead)|豆の木C(枯れ) +Large Gravel Mound A (Dirt)|大きな土砂A(土) +Large Gravel Mound A (Dirt)|大きな土砂A(土) +Large Gravel Mound B (Stone)|大きな土砂B(石) +Large Gravel Mound B (Stone)|大きな土砂B(石) +Large Gold Mound|大きな金の山 +Large Gold Mound|大きな金の山 +Large Silver Mound|大きな銀の山 +Large Silver Mound|大きな銀の山 +Large Gravel Mound A (Dirt)|大きな土砂A(土) +Large Gravel Mound A (Dirt)|大きな土砂A(土) +Large Gravel Mound B (Stone)|大きな土砂B(石) +Large Gravel Mound B (Stone)|大きな土砂B(石) +Large Gold Mound|大きな金の山 +Large Gold Mound|大きな金の山 +Large Silver Mound|大きな銀の山 +Large Silver Mound|大きな銀の山 +Gravel Mound (Dirt)|土砂A(土) +Gravel Mound (Stone)|土砂B(石) +Gold Bricks A|金の延べ棒A +Gold Bricks B|金の延べ棒B +Crate A (Dirt)|木箱A(土) +Crate B (Stone)|木箱B(石) +Crate C (Ruins)|木箱C(廃墟) +Pot A (Ruins)|壺A(廃墟) +Gold Mound|金の山 +Silver Mound|銀の山 +Silver Bricks A|銀の延べ棒A +Silver Bricks B|銀の延べ棒B +Crate D (Gold Dust)|木箱D(金) +Crate E (Silver Dust)|木箱E(銀) +Pot A|壺A +Pot B|壺B +Shovel|スコップ +Pickax|つるはし +Rope|ロープ +Mound of Gold Coins|金貨の山 +Crate F|木箱F +Crate G|木箱G +Barrel A|樽A +Barrel B (Ruins)|樽B(廃墟) +Large Bones|大きな骸骨 +Large Bones|大きな骸骨 +Bones A|骸骨A +Table (Ruins)|テーブル(廃墟) +Jail Bars|鉄格子 +Jail Bars|鉄格子 +Jail Bars|鉄格子 +Jail Bars|鉄格子 +Large Bones|大きな骸骨 +Large Bones|大きな骸骨 +Bones B|骸骨B +Stool (Ruins)|椅子(廃墟) +Jail Bars|鉄格子 +Jail Bars|鉄格子 +Jail Bars|鉄格子 +Jail Bars|鉄格子 diff --git a/img/tilesets/Dungeon_C.png b/img/tilesets/Dungeon_C.png new file mode 100644 index 0000000..6f11904 Binary files /dev/null and b/img/tilesets/Dungeon_C.png differ diff --git a/img/tilesets/Dungeon_C.txt b/img/tilesets/Dungeon_C.txt new file mode 100644 index 0000000..143e6ff --- /dev/null +++ b/img/tilesets/Dungeon_C.txt @@ -0,0 +1,256 @@ +Decorative Pillar A (Stone)|装飾柱A(石) +Decorative Pillar B (Stone)|装飾柱B(石) +Decorative Pillar C (Temple)|装飾柱C(遺跡) +Decorative Pillar D (Rock Cave)|装飾柱D(岩洞窟) +Decorative Pillar E (Demon Castle)|装飾柱E(魔王城) +Decorative Pillar F (Fort)|装飾柱F(砦) +Decorative Pillar G (Dirt Cave)|装飾柱G(土洞窟) +Decorative Pillar H (Factory)|装飾柱H(工場) +Decorative Pillar A (Stone)|装飾柱A(石) +Decorative Pillar B (Stone)|装飾柱B(石) +Decorative Pillar C (Temple)|装飾柱C(遺跡) +Decorative Pillar D (Rock Cave)|装飾柱D(岩洞窟) +Decorative Pillar E (Demon Castle)|装飾柱E(魔王城) +Decorative Pillar F (Fort)|装飾柱F(砦) +Decorative Pillar G (Dirt Cave)|装飾柱G(土洞窟) +Decorative Pillar H (Factory)|装飾柱H(工場) +Decorative Pillar A (Stone)|装飾柱A(石) +Decorative Pillar B (Stone)|装飾柱B(石) +Decorative Pillar C (Temple)|装飾柱C(遺跡) +Decorative Pillar D (Rock Cave)|装飾柱D(岩洞窟) +Decorative Pillar E (Demon Castle)|装飾柱E(魔王城) +Decorative Pillar F (Fort)|装飾柱F(砦) +Decorative Pillar G (Dirt Cave)|装飾柱G(土洞窟) +Decorative Pillar H (Factory)|装飾柱H(工場) +Decorative Pillar A (Stone, Ruins)|装飾柱A(石・廃墟) +Decorative Pillar B (Stone, Ruins)|装飾柱B(石・廃墟) +Decorative Pillar C (Temple, Ruins)|装飾柱C(遺跡・廃墟) +Decorative Pillar D (Rock Cave, Ruins)|装飾柱D(岩洞窟・廃墟) +Decorative Pillar E (Demon Castle, Ruins)|装飾柱E(魔王城・廃墟) +Decorative Pillar F (Fort, Ruins)|装飾柱F(砦・廃墟) +Decorative Pillar G (Dirt Cave, Ruins)|装飾柱G(土洞窟・廃墟) +Decorative Pillar A (Stone, Front, Ruins)|装飾柱A(石・手前・廃墟) +Decorative Pillar A (Stone, Ruins)|装飾柱A(石・廃墟) +Decorative Pillar B (Stone, Ruins)|装飾柱B(石・廃墟) +Decorative Pillar C (Temple, Ruins)|装飾柱C(遺跡・廃墟) +Decorative Pillar D (Rock Cave, Ruins)|装飾柱D(岩洞窟・廃墟) +Decorative Pillar E (Demon Castle, Ruins)|装飾柱E(魔王城・廃墟) +Decorative Pillar F (Fort, Ruins)|装飾柱F(砦・廃墟) +Decorative Pillar G (Dirt Cave, Ruins)|装飾柱G(土洞窟・廃墟) +Decorative Pillar D (Rock Cave, Front, Ruins)|装飾柱F(岩洞窟・手前・廃墟) +Decorative Pillar A (Stone, Ruins)|装飾柱A(石・廃墟) +Decorative Pillar B (Stone, Ruins)|装飾柱B(石・廃墟) +Decorative Pillar C (Temple, Ruins)|装飾柱C(遺跡・廃墟) +Decorative Pillar D (Rock Cave, Ruins)|装飾柱D(岩洞窟・廃墟) +Decorative Pillar E (Demon Castle, Ruins)|装飾柱E(魔王城・廃墟) +Decorative Pillar F (Fort, Ruins)|装飾柱F(砦・廃墟) +Decorative Pillar G (Dirt Cave, Ruins)|装飾柱G(土洞窟・廃墟) +Decorative Pillar F (Fort, Front, Ruins)|装飾柱F(砦・手前・廃墟) +Decorative Pillar A (Stone, Front)|装飾柱A(石・手前) +Decorative Pillar B (Stone, Front)|装飾柱B(石・手前) +Decorative Pillar C (Temple, Front)|装飾柱C(神殿・手前) +Decorative Pillar D (Rock Cave, Front)|装飾柱D(岩洞窟・手前) +Decorative Pillar E (Demon Castle, Front)|装飾柱E(魔王城・手前) +Decorative Pillar F (Fort, Front)|装飾柱F(砦・手前) +Decorative Pillar G (Dirt Cave, Front)|装飾柱G(土洞窟・手前) +Decorative Pillar H (Factory, Front)|装飾柱H(工場・手前) +Gate A|門A +Gate A|門A +Gate A|門A +Gate B|門B +Gate B|門B +Gate B|門B +Decorative Pillar I (Demonic)|装飾柱I(悪魔) +Decorative Pillar I (Demonic, Ruins)|装飾柱I(悪魔・廃墟) +Gate A|門A +Gate A|門A +Gate A|門A +Gate B|門B +Gate B|門B +Gate B|門B +Decorative Pillar I (Demonic)|装飾柱I(悪魔) +Decorative Pillar I (Demonic, Ruins)|装飾柱I(悪魔・廃墟) +Gate A|門A +Gate A|門A +Gate A|門A +Gate B|門B +Gate B|門B +Gate B|門B +Coffin A (Right)|棺A(右) +Coffin A (Right)|棺A(右) +Hexagram|魔法陣 +Hexagram|魔法陣 +Hexagram|魔法陣 +Hexagram (Lit)|魔法陣(光) +Hexagram (Lit)|魔法陣(光) +Hexagram (Lit)|魔法陣(光) +Coffin B (Top)|棺B(上) +Coffin C (Bottom)|棺C(下) +Hexagram|魔法陣 +Hexagram|魔法陣 +Hexagram|魔法陣 +Hexagram (Lit)|魔法陣(光) +Hexagram (Lit)|魔法陣(光) +Hexagram (Lit)|魔法陣(光) +Coffin B (Top)|棺B(上) +Coffin C (Bottom)|棺C(下) +Hexagram|魔法陣 +Hexagram|魔法陣 +Hexagram|魔法陣 +Hexagram (Lit)|魔法陣(光) +Hexagram (Lit)|魔法陣(光) +Hexagram (Lit)|魔法陣(光) +Coffin D (Left)|棺D(左) +Coffin D (Left)|棺D(左) +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Rails (Ruins)|線路(廃墟) +Rails (Ruins)|線路(廃墟) +Rails (Ruins)|線路(廃墟) +Rails (Ruins)|線路(廃墟) +Rails|線路 +Railroad Ties A|枕木A +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Railroad Ties B|枕木B +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Rails|線路 +Mural A|壁画A +Hieroglyph|ヒエログリフ +Hieroglyph|ヒエログリフ +Large Mural A|大きな壁画A +Large Mural A|大きな壁画A +Large Mural A|大きな壁画A +Bed|ベッド +Bed (Ruins)|ベッド(廃墟) +Mural B|壁画B +Hieroglyph|ヒエログリフ +Hieroglyph|ヒエログリフ +Large Mural B|大きな壁画B +Large Mural B|大きな壁画B +Large Mural B|大きな壁画B +Bed|ベッド +Bed (Ruins)|ベッド(廃墟) +Middle Window A|中型窓A +Middle Window B|中型窓B +Middle Window C|中型窓C +Middle Window D (Ruins)|中型窓窓D(廃墟) +Window (Demon Castle)|窓(魔王城) +Table|テーブル +Cheap Bed|粗末なベッド +Straw Bed|むしろの寝床 +Middle Window A|中型窓A +Middle Window B|中型窓B +Middle Window C|中型窓C +Middle Window D (Ruins)|中型窓窓D(廃墟) +Window (Demon Castle)|窓(魔王城) +Stool|椅子 +Cheap Bed|粗末なベッド +Straw Bed|むしろの寝床 +Large Window A|大型窓A +Large Window B|大型窓B +Large Window C|大型窓C +Stained Glass Window|ステンドグラス +Large Window D|大型窓D +Window A|窓A +Window B|窓B +Window C|窓C +Large Window A|大型窓A +Large Window B|大型窓B +Large Window C|大型窓C +Stained Glass Window|ステンドグラス +Large Window D|大型窓D +Window A|窓A +Window B|窓B +Window C|窓C +Chest A|チェストA +Cabinet|キャビネット +Closet|クローゼット +Chest of Drawers|タンス +Dish Cabinet|食器棚 +Wine Rack|ワインセラー +Bottle Shelf A|ボトル棚A +Bottle Shelf B|ボトル棚B +Chest B|チェストB +Chest C|チェストC +Closet|クローゼット +Chest of Drawers|タンス +Dish Cabinet|食器棚 +Wine Rack|ワインセラー +Bottle Shelf A|ボトル棚A +Bottle Shelf B|ボトル棚B +Tipped Shelf|倒れた棚 +Sundries Shelf A|雑貨棚A +Sundries Shelf A|雑貨棚A +Sundries Shelf B|雑貨棚B +Medicine Shelf|薬品棚 +Bookshelf A|本棚A +Bookshelf B|本棚B +Bookshelf B|本棚B +Tipped Shelf|倒れた棚 +Sundries Shelf A|雑貨棚A +Sundries Shelf A|雑貨棚A +Sundries Shelf B|雑貨棚B +Medicine Shelf|薬品棚 +Bookshelf A|本棚A +Bookshelf B|本棚B +Bookshelf B|本棚B +Curtains A|カーテンA +Curtains B|カーテンB +Curtains C|カーテンC +Curtains D|カーテンD +Curtains A (Ruins)|カーテンA(廃墟) +Curtains B (Ruins)|カーテンB(廃墟) +Curtains C (Ruins)|カーテンC(廃墟) +Curtains D (Ruins)|カーテンD(廃墟) +Curtains A|カーテンA +Curtains B|カーテンB +Curtains C|カーテンC +Curtains D|カーテンD +Curtains A (Ruins)|カーテンA(廃墟) +Curtains B (Ruins)|カーテンB(廃墟) +Curtains C (Ruins)|カーテンC(廃墟) +Curtains D (Ruins)|カーテンD(廃墟) +Clock|時計 +Mirror|鏡 +Clock (Ruins)|時計(廃墟) +Mirror (Ruins)|鏡(廃墟) +Stacked Crates|積まれた木箱 +Stacked Crates|積まれた木箱 +Tapestry A|タペストリーA +Tapestry A (Ruins)|タペストリーA(廃墟) +Clock|時計 +Mirror|鏡 +Clock (Ruins)|時計(廃墟) +Mirror (Ruins)|鏡(廃墟) +Stacked Crates|積まれた木箱 +Stacked Crates|積まれた木箱 +Tapestry A|タペストリーA +Tapestry A (Ruins)|タペストリーA(廃墟) +Chair A (Wood)|背もたれ椅子A(木製) +Chair B (Stone)|背もたれ椅子B(石) +Throne A|玉座A +Throne A|玉座A +Throne A|玉座A +Throne B (Demon Castle)|玉座B(魔王城) +Throne B (Demon Castle)|玉座B(魔王城) +Throne B (Demon Castle)|玉座B(魔王城) +Chair A (Wood)|背もたれ椅子A(木製) +Chair B (Stone)|背もたれ椅子B(石) +Throne A|玉座A +Throne A|玉座A +Throne A|玉座A +Throne B (Demon Castle)|玉座B(魔王城) +Throne B (Demon Castle)|玉座B(魔王城) +Throne B (Demon Castle)|玉座B(魔王城) diff --git a/img/tilesets/Inside_A1.png b/img/tilesets/Inside_A1.png new file mode 100644 index 0000000..1d96a60 Binary files /dev/null and b/img/tilesets/Inside_A1.png differ diff --git a/img/tilesets/Inside_A1.txt b/img/tilesets/Inside_A1.txt new file mode 100644 index 0000000..297a5a2 --- /dev/null +++ b/img/tilesets/Inside_A1.txt @@ -0,0 +1,16 @@ +Water A|水場A +Deep Water|深い水場 +Lotus Pads (Flowers)|蓮の葉(花) +Purple Water|紫の水 +Water B (Surround Stonewall)|水場B(囲み石壁) +Waterfall A (Shine Fall)|滝A(光る滝) +Pond A (Rock Pond)|池A(岩池) +Waterfall B (Grid Fall)|滝B(マス目滝) +Water C (Tile)|水場C(タイル) +Water D (Small Hole)|水場D(小穴) +Water E (Water Surface)|水場E(水面) +Water F (Water Footing)|水場F(足場) +Water G (Surround Waterwall)|水場G(囲み水壁) +Water H (Big Hole)|水場H(大穴) +Pond B (Purple Rock Pond)|池B(紫岩池) +Waterfall C (Purple Fall)|滝C(紫滝) \ No newline at end of file diff --git a/img/tilesets/Inside_A2.png b/img/tilesets/Inside_A2.png new file mode 100644 index 0000000..0077a4f Binary files /dev/null and b/img/tilesets/Inside_A2.png differ diff --git a/img/tilesets/Inside_A2.txt b/img/tilesets/Inside_A2.txt new file mode 100644 index 0000000..bffe0c8 --- /dev/null +++ b/img/tilesets/Inside_A2.txt @@ -0,0 +1,32 @@ +Ground A (Wood Floor Stripe)|床A(木目縦床) +Ground B (Stone Floor Tile)|床B(石タイル床) +Ground C (Dirt Floor)|床C(土床) +Tatami|畳 +Hole A (Orange Cave)|穴A(オレンジ) +Raised Stone A (Blue)|石段(青) +Ground D (Black Floor)|床D(黒床) +Table A (Wood)|テーブルA(木製) +Ground E (Wood Floor Border)|床E(木目横床) +Ground F (Stone Floor Brick)|床F(石レンガ床) +Rug A (Red Flower)|じゅうたんA(赤花じゅうたん) +Rug B (Oriental Green)|じゅうたんB(オリエント緑じゅうたん) +Hole B (Brown Cave)|穴B(茶色) +Raised Stone B (Purple)|石段(紫) +Ground G (Dark Enclave Floor)|床G(暗い飛び地) +Table B (Dark Wood)|テーブルB(濃い木製) +Ground H (Wood Floor Lattice)|床H(木格子) +Ground I (Stone Floor Color Tile)|床I(石カラータイル床) +Rug C (Oriental Blue)|じゅうたんC(オリエント青じゅうたん) +Rug D (Oriental Redpink)|じゅうたんD(オリエント赤ピンクじゅうたん) +Hole C (Black Cave)|穴C(黒色) +Raised Stone B (Yellow)|石段(黄) +Ground J (Enclave Floor)|床J(飛び地) +Table C (White Wood)|テーブルC(白木製) +Ground K (Oriental Floor)|床K(オリエント床) +Ground L (Stone Floor X Tile)|床L(石X字タイル床) +Rug E (Oriental Red)|じゅうたんE(オリエント赤じゅうたん) +Rug F (Oriental Purple)|じゅうたんF(オリエント紫じゅうたん) +Hole D (Square Black Cave)|穴D(四角黒色) +Raised Stone C (Gray)|石段(灰色) +Ground M (Stone Enclave Floor)|床M(石飛び地) +Table D (White Cloth)|テーブルD(白布) \ No newline at end of file diff --git a/img/tilesets/Inside_A4.png b/img/tilesets/Inside_A4.png new file mode 100644 index 0000000..067755f Binary files /dev/null and b/img/tilesets/Inside_A4.png differ diff --git a/img/tilesets/Inside_A4.txt b/img/tilesets/Inside_A4.txt new file mode 100644 index 0000000..91df6bd --- /dev/null +++ b/img/tilesets/Inside_A4.txt @@ -0,0 +1,48 @@ +Wall A (Stone)|壁A(石) +Wall B (Castle)|壁B(城) +Wall C (Fort)|壁C(砦) +Wall D (Stone)|壁D(石) +Wall E (Stone)|壁E(石) +Wall F (Brick)|壁F(レンガ) +Wall G (Stone)|壁G(石) +Interior Wall A (Stone)|内装壁A(石) +Wall A (Stone)|壁A(石) +Wall B (Castle)|壁B(城) +Wall C (Fort)|壁C(砦) +Wall D (Stone)|壁D(石) +Wall E (Stone)|壁E(石) +Wall F (Brick)|壁F(レンガ) +Wall G (Stone)|壁G(石) +Interior Wall A (Stone)|内装壁A(石) +Wall H (Wood)|壁H(木造) +Wall I (Log)|壁I(丸太) +Wall J (Wood)|壁J(木造) +Interior Wall B (Plaster)|内装壁B(石膏壁) +Interior Wall C (Plaster)|内装壁C(石膏壁) +Wall K (Stone)|壁K(石) +Wall L (Marble)|壁L(大理石) +Wall M (Marble)|壁M(大理石) +Wall H (Wood)|壁H(木造) +Wall I (Log)|壁I(丸太) +Wall J (Wood)|壁J(木造) +Interior Wall B (Plaster)|内装壁B(石膏壁) +Interior Wall C (Plaster)|内装壁C(石膏壁) +Wall K (Stone)|壁K(石) +Wall L (Marble)|壁L(大理石) +Wall M (Marble)|壁M(大理石) +Interior Wall D (Desert)|内装壁D(砂漠風) +Interior Wall E (Desert)|内装壁E(砂漠風) +Interior Wall F (Mansion)|内装壁F(豪邸) +Interior Wall G (Mansion)|内装壁G(豪邸) +Wall N (Tent)|壁N(テント) +Wall O (Demon Castle)|壁O(魔王城) +Wall P (Gold)|壁P(黄金) +Wall Q (Ice)|壁Q(氷) +Interior Wall D (Desert)|内装壁D(砂漠風) +Interior Wall E (Desert)|内装壁E(砂漠風) +Interior Wall F (Mansion)|内装壁F(豪邸) +Interior Wall G (Mansion)|内装壁G(豪邸) +Wall N (Tent)|壁N(テント) +Wall O (Demon Castle)|壁O(魔王城) +Wall P (Gold)|壁P(黄金) +Wall Q (Ice)|壁Q(氷) diff --git a/img/tilesets/Inside_A5.png b/img/tilesets/Inside_A5.png new file mode 100644 index 0000000..1356b75 Binary files /dev/null and b/img/tilesets/Inside_A5.png differ diff --git a/img/tilesets/Inside_A5.txt b/img/tilesets/Inside_A5.txt new file mode 100644 index 0000000..ce13f5b --- /dev/null +++ b/img/tilesets/Inside_A5.txt @@ -0,0 +1,128 @@ +Darkness|暗闇 +Dirt Floor|土の床 +Stone Bridge (V, Left)|石の橋(縦・左) +Stone Bridge (V Center)|石の橋(縦・中央) +Stone Bridge (V, Riight)|石の橋(縦・右) +Stone Bridge (H, Top)|石の橋(横・上) +Stone Bridge (H Center)|石の橋(横・中央) +Broken Bridge (H, Top)|壊れた橋(横・上) +Transparent|透明 +Dirt Ledge|土の段差 +Broken Bridge (V, Left)|壊れた橋(縦・左) +Broken Bridge (V Center)|壊れた橋(縦・中央) +Broken Bridge (V, Riight)|壊れた橋(縦・右) +Stone Bridge (H, Bottom)|石の橋(横・下) +Broken Bridge (H Center)|壊れた橋(横・中央) +Broken Bridge (H, Bottom)|壊れた橋(横・下) +Wood Floor A|木の床A +Wood Floor B|木の床B +Wood Floor C|木の床C +Wood Floor D|木の床D +Cobblestones A|石畳A +Cobblestones B|石畳B +Cobblestones C|石畳C +Cobblestones D|石畳D +Ledge A (Wood)|段差A(木製) +Ledge B (Wood)|段差B(木製) +Ledge C (Wood)|段差C(木製) +Ledge D (Wood)|段差D(木製) +Ledge E (Stone)|段差E(石) +Ledge F (Stone)|段差F(石) +Ledge G (Stone)|段差G(石) +Ledge H (Stone)|段差H(石) +Wood Floor A (Ruins)|木の床A(廃墟) +Wood Floor B (Ruins)|木の床B(廃墟) +Wood Floor C (Ruins)|木の床C(廃墟) +Wood Floor D (Ruins)|木の床D(廃墟) +Cobblestones A (Ruins)|石畳A(廃墟) +Cobblestones B (Ruins)|石畳B(廃墟) +Cobblestones C (Ruins)|石畳C(廃墟) +Cobblestones D (Ruins)|石畳D(廃墟) +Cobblestones E|石畳E +Interior Floor A (Tile)|内装床A(タイル) +Interior Floor B (Tile)|内装床B(タイル) +Interior Floor C (Tile)|内装床C(タイル) +Interior Floor D (Stone)|内装床D(石) +Interior Floor E (Tile)|内装床E(タイル) +Interior Floor F (Tile)|内装床F(タイル) +Interior Floor G (Tile)|内装床G(タイル) +Ledge I (Stone)|段差I(石) +Ledge J (Stone)|段差J(石) +Ledge K (Stone)|段差K(石) +Ledge L (Stone)|段差L(石) +Ledge M (Stone)|段差M(石) +Ledge N (Stone)|段差N(石) +Ledge O (Stone)|段差O(石) +Ledge P (Stone)|段差P(石) +Cobblestones E (Ruins)|石畳E(廃墟) +Interior Floor A (Tile, Ruins)|内装床A(タイル・廃墟) +Interior Floor B (Tile, Ruins)|内装床B(タイル・廃墟) +Interior Floor C (Tile, Ruins)|内装床C(タイル・廃墟) +Interior Floor D (Stone, Ruins)|内装床D(石・廃墟) +Interior Floor E (Tile, Ruins)|内装床E(タイル・廃墟) +Interior Floor F (Tile, Ruins)|内装床F(タイル・廃墟) +Interior Floor G (Tile, Ruins)|内装床G(タイル・廃墟) +Cobblestones F|石畳F +Interior Floor H (Dirt)|内装床H(土) +Interior Floor I (Marble)|内装床I(大理石) +Interior Floor J (Carpet)|内装床J(じゅうたん) +Interior Floor K (Demon Castle)|内装床K(魔王城) +Interior Floor L (Demon Castle)|内装床L(魔王城) +Gold Floor|黄金の床 +Ice Floor|氷の床 +Ledge Q (Stone)|段差Q(石) +Ledge R (Dirt)|段差R(土) +Ledge S (Marble)|段差S(大理石) +Ledge T (Carpet)|段差T(じゅうたん) +Ledge U (Demon Castle)|段差U(魔界城) +Ledge V (Demon Castle)|段差V(魔界城) +Ledge W (Gold)|段差W(黄金) +Ledge X (Ice)|段差X(氷) +Cobblestones F (Ruins)|石畳F(廃墟) +Interior Floor H (Dirt, Ruins)|内装床H(土・廃墟) +Interior Floor I (Marble, Ruins)|内装床I(大理石・廃墟) +Interior Floor J (Carpet, Ruins)|内装床J(じゅうたん・廃墟) +Interior Floor K (Demon Castle, Ruins)|内装床K(魔王城・廃墟) +Interior Floor L (Demon Castle, Ruins)|内装床L(魔王城・廃墟) +Gold Floor (Ruins)|黄金の床(廃墟) +Ice Floor (Ruins)|氷の床(廃墟) +Stairs A (Wood, Left)|階段A(木製・左) +Stairs A (Wood, Center)|階段A(木製・中央) +Stairs A (Wood)|階段A(木製・右) +Stairs A (Wood)|階段A(木製) +Stairs B (Stone, Left)|階段B(石・左) +Stairs B (Stone, Center)|階段B(石・中央) +Stairs B (Stone, Right)|階段B(石・右) +Stairs B (Stone)|階段B(石) +Stairs C (Stone, Left)|階段C(石・左) +Stairs C (Stone, Center)|階段C(石・中央) +Stairs C (Stone, Right)|階段C(石・右) +Stairs C (Stone)|階段C(石) +Stairs C (Stone, Ruins, Left)|階段C(石・廃墟・左) +Stairs C (Stone, Ruins, Center)|階段C(石・廃墟・中央) +Stairs C (Stone, Ruins, Right)|階段C(石・廃墟・右) +Stairs C (Stone, Ruins)|階段C(石・廃墟) +Stairs D (Carpet, Left)|階段D(じゅうたん・左) +Stairs D (Carpet, Center)|階段D(じゅうたん・中央) +Stairs D (Carpet, Right)|階段D(じゅうたん・右) +Stairs D (Carpet)|階段D(じゅうたん) +Stairs E (Carpet, Left)|階段E(じゅうたん・左) +Stairs E (Carpet, Center)|階段E(じゅうたん・中央) +Stairs E (Carpet, Right)|階段E(じゅうたん・右) +Stairs E (Carpet)|階段E(じゅうたん) +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Relief Floor Tile A (Silver)|レリーフ床A(銀) +Relief Floor Tile B (Silver)|レリーフ床B(銀) +Relief Floor Tile C (Gold)|レリーフ床C(金) +Relief Floor Tile D (Gold)|レリーフ床D(金) +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Relief Floor Tile E (Silver, Ruins)|レリーフ床E(銀・廃墟) +Relief Floor Tile F (Silver)|レリーフ床F(銀) +Relief Floor Tile G (Gold, Ruins)|レリーフ床G(金・廃墟) +Relief Floor Tile H (Gold)|レリーフ床H(金) diff --git a/img/tilesets/Inside_B.png b/img/tilesets/Inside_B.png new file mode 100644 index 0000000..e891a42 Binary files /dev/null and b/img/tilesets/Inside_B.png differ diff --git a/img/tilesets/Inside_B.txt b/img/tilesets/Inside_B.txt new file mode 100644 index 0000000..343671b --- /dev/null +++ b/img/tilesets/Inside_B.txt @@ -0,0 +1,256 @@ +Transparent|透明 +Stairs A (Up)|階段A(上り) +Stairs B (Up)|階段B(上り) +Stairs C (Up)|階段C(上り) +Stairs D (Up)|階段D(上り) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Hole|穴 +Stairs A (Down)|階段A(下り) +Stairs B (Down)|階段B(下り) +Stairs C (Down)|階段C(下り) +Stairs D (Down)|階段D(下り) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Entrance A|入口A +Entrance A (Extend)|入口A(延長部分) +Entrance A (Top Half A)|入口A(上半分A)S +Entrance B|入口B +Entrance A (Top Half B)|入口A(上半分B) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Stone Pillar A|石の柱A +Stone Pillar B|石の柱B +Fort Pillar|砦の柱 +Rubble|瓦礫 +Rubble|瓦礫 +Hole A (Metal Ladder)|穴A(鉄ばしご) +Hole B (Wood Ladder)|穴B(木製はしご) +Hole C (Rope)|穴C(ロープ) +Stone Pillar A|石の柱A +Stone Pillar B|石の柱B +Fort Pillar|砦の柱 +Stone Tablet|石版 +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Fissures D|亀裂D +Broken Stone Pillar A|折れた石の柱A +Broken Stone Pillar B|折れた石の柱B +Broken Fort Pillar|折れた砦の柱 +Stone Tablet (Ruins)|石版(廃墟) +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Fissures E|亀裂E +Curtains A|カーテンA +Curtains B|カーテンB +Curtains C|カーテンC +Curtains D|カーテンD +Curtains A (Ruins)|カーテンA(廃墟) +Curtains B (Ruins)|カーテンB(廃墟) +Curtains C (Ruins)|カーテンC(廃墟) +Curtains D (Ruins)|カーテンD(廃墟) +Curtains A|カーテンA +Curtains B|カーテンB +Curtains C|カーテンC +Curtains D|カーテンD +Curtains A (Ruins)|カーテンA(廃墟) +Curtains B (Ruins)|カーテンB(廃墟) +Curtains C (Ruins)|カーテンC(廃墟) +Curtains D (Ruins)|カーテンD(廃墟) +Middle Window A|中型窓A +Middle Window A|中型窓A +Middle Window B|中型窓B +Middle Window B|中型窓B +Large Window A|大型窓A +Large Window B|大型窓B +Large Window C|大型窓C +Stained Glass Window|ステンドグラス +Middle Window A|中型窓A +Middle Window A|中型窓A +Middle Window B|中型窓B +Middle Window B|中型窓B +Large Window A|大型窓A +Large Window B|大型窓B +Large Window C|大型窓C +Stained Glass Window|ステンドグラス +Tapestry A|タペストリーA +Tapestry A (Ruins)|タペストリーA(廃墟) +Swords A|剣A +Swords B|剣B +Large Window D|大型窓D +Window A|窓A +Window B|窓B +Window C|窓C +Tapestry A|タペストリーA +Tapestry A (Ruins)|タペストリーA(廃墟) +Shield|盾 +Posted Notice|貼り紙 +Large Window D|大型窓D +Window A|窓A +Window B|窓B +Window C|窓C +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Chair A (Wood)|背もたれ椅子A(木製) +Chair B (Stone)|背もたれ椅子B(石) +Throne (Demon Castle)|玉座(魔王城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Sofa (Castle)|ソファ(城) +Chair A (Wood)|背もたれ椅子A(木製) +Chair B (Stone)|背もたれ椅子B(石) +Throne (Demon Castle)|玉座(魔王城) +Table A|テーブルA +Table A|テーブルA +Table B|テーブルB +Table C|テーブルC +Table D|テーブルD +Clock|時計 +Mirror|鏡 +Window (Demon Castle)|窓(魔王城) +Stool A|椅子A +Stool B|椅子B +Stool C|椅子C +Table E|テーブルE +Table F|テーブルF +Clock|時計 +Mirror|鏡 +Window (Demon Castle)|窓(魔王城) +World Map|世界地図 +World Map|世界地図 +Painting|絵画 +Painting|絵画 +Portrait A|肖像画A +Portrait B|肖像画B +Painting A|絵画A +Painting B|絵画B +Chest A|チェストA +Cabinet|キャビネット +Closet|クローゼット +Chest of Drawers|タンス +Dish Cabinet|食器棚 +Wine Rack|ワインセラー +Bottle Shelf A|ボトル棚A +Bottle Shelf B|ボトル棚B +Chest B|チェストB +Chest C|チェストC +Closet|クローゼット +Chest of Drawers|タンス +Dish Cabinet|食器棚 +Wine Rack|ワインセラー +Bottle Shelf A|ボトル棚A +Bottle Shelf B|ボトル棚B +Bread Shelf|パン棚 +Sundries Shelf A|雑貨棚A +Sundries Shelf A|雑貨棚A +Sundries Shelf B|雑貨棚B +Medicine Shelf|薬品棚 +Bookshelf A|本棚A +Bookshelf B|本棚B +Bookshelf B|本棚B +Bread Shelf|パン棚 +Sundries Shelf A|雑貨棚A +Sundries Shelf A|雑貨棚A +Sundries Shelf B|雑貨棚B +Medicine Shelf|薬品棚 +Bookshelf A|本棚A +Bookshelf B|本棚B +Bookshelf B|本棚B +Bed|ベッド +Large Bed|ダブルベッド +Large Bed|ダブルベッド +Cheap Bed A|粗末なベッドA +Cheap Bed B|粗末なベッドB +Straw Bed|むしろの寝床 +Bed (Ruins)|ベッド(廃墟) +Tipped Shelf|倒れた棚 +Bed|ベッド +Large Bed|ダブルベッド +Large Bed|ダブルベッド +Cheap Bed A|粗末なベッドA +Cheap Bed B|粗末なベッドB +Straw Bed|むしろの寝床 +Bed (Ruins)|ベッド(廃墟) +Tipped Shelf|倒れた棚 +Simple Shelf A (Jars)|簡易棚A(瓶) +Simple Shelf B (Books)|簡易棚B(本) +Fireplace A (Stone)|暖炉A(石) +Fireplace B (Brick)|暖炉B(レンガ) +Fireplace C (Iron)|暖炉C(鉄) +Large Fireplace|大きな暖炉 +Large Fireplace|大きな暖炉 +Large Fireplace|大きな暖炉 +Simple Shelf C (Sacks)|簡易棚C(袋) +Simple Shelf D (Bottles)|簡易棚D(ボトル) +Fireplace A (Stone)|暖炉A(石) +Fireplace B (Brick)|暖炉B(レンガ) +Fireplace C (Iron)|暖炉C(鉄) +Large Fireplace|大きな暖炉 +Large Fireplace|大きな暖炉 +Large Fireplace|大きな暖炉 +Oven|かまど +Sink|流し +Kitchen Counter A|調理台A +Kitchen Counter B|調理台B +Dresser|ドレッサー +Piano|ピアノ +Piano|ピアノ +Piano|ピアノ +Simple Shelf E|簡易棚E +Pot A|壺A +Pot B|壺B +Basin|桶 +Barrel|樽 +Piano|ピアノ +Piano|ピアノ +Piano|ピアノ +Posted Notice (Ruins)|貼り紙(廃墟) +Basin|桶 +Tub A|たらいA +Tub B|たらいB +Scrap Wood|端材 +Pipe Organ|パイプオルガン +Pipe Organ|パイプオルガン +Pipe Organ|パイプオルガン +Crate A|木箱A +Crate B|木箱B +Stacked Crates|積まれた木箱 +Stacked Crates|積まれた木箱 +Crate C (Ruins)|木箱C(廃墟) +Pipe Organ|パイプオルガン +Pipe Organ|パイプオルガン +Pipe Organ|パイプオルガン +Crate D|木箱D +Crate E|木箱E +Stacked Crates|積まれた木箱 +Stacked Crates|積まれた木箱 +Pot C (Ruins)|壺C(廃墟) +Barrel (Ruins)|樽(廃墟) +Table A (Ruins)|テーブルA(廃墟) +Stool (Ruins)|椅子(廃墟) +Crate F|木箱F +Crate G|木箱G +Sacks C|麻袋C +Large Crate|大きな木箱 +Jail Bar|鉄格子 +Jail Bar|鉄格子 +Jail Bar|鉄格子 +Jail Bar|鉄格子 +Sack A|麻袋A +Sack B|麻袋B +Sacks C|麻袋C +Large Crate|大きな木箱 +Jail Bar|鉄格子 +Jail Bar|鉄格子 +Jail Bar|鉄格子 +Jail Bar|鉄格子 diff --git a/img/tilesets/Inside_C.png b/img/tilesets/Inside_C.png new file mode 100644 index 0000000..dfef9b4 Binary files /dev/null and b/img/tilesets/Inside_C.png differ diff --git a/img/tilesets/Inside_C.txt b/img/tilesets/Inside_C.txt new file mode 100644 index 0000000..231b0ae --- /dev/null +++ b/img/tilesets/Inside_C.txt @@ -0,0 +1,256 @@ +Teapot A|ティーポットA +Teapot B|ティーポットB +Cup (Lower Left)|カップ(左下) +Cup (Upper Right)|カップ(右上) +Pot A|ポットA +Pot B|ポットB +Glass A (Lower Left)|グラスA(左下) +Glass A (Upper Right)|グラスA(右上) +Bottle A|ボトルA +Bottle B|ボトルB +Glass B (Lower Left)|グラスB(左下) +Glass B (Upper Right)|グラスB(右上) +Glass C (Lower Left)|グラスC(左下) +Glass C (Upper Right)|グラスC(右上) +Glass D (Lower Left)|グラスD(左下) +Glass D (Upper Right)|グラスD(右上) +Pot C|ポットC +Pot D|ポットD +Pint Mug A (Lower Left)|ジョッキA(左下) +Pint Mug A (Upper Right)|ジョッキA(右上) +Pint Mug B (Lower Left)|ジョッキB(左下) +Pint Mug B (Upper Right)|ジョッキB(右上) +Glass E (Lower Left)|グラスE(左下) +Glass E (Upper Right)|グラスE(右上) +Bottle C|ボトルC +Broken Bottle|割れたボトル +Bottle D|ボトルD +Bottle E|ボトルE +Bottle F|ボトルF +Pint Mug C|ジョッキC +Pint Mug D|ジョッキD +Glass F|グラスF +Side Dishes|副菜 +Meal (Meat)|肉料理 +Assorted Vegetables|野菜盛り合わせ +Assorted Fruitsl|フルーツ盛り合わせ +Roast Chicken|丸焼き +Meal (Fish)|魚料理 +Pasta|パスタ +Assorted Cakes|ケーキ盛り合わせ +Dinner Set A (Bottom)|夕食セットA(下) +Dinner Set B (Top)|夕食セットB(上) +Dinner Set C (Left)|夕食セットC(左) +Dinner Set D (Right)|夕食セットD(右) +Gratin|グラタン +Fried Rice|チャーハン +Beef Stew|ビーフシチュー +Paella|パエリア +Breakfast Set A (Bottom)|朝食セットA(下) +Breakfast Set B (Top)|朝食セットB(上) +Breakfast Set C (Left)|朝食セットC(左) +Breakfast Set D (Right)|朝食セットD(右) +Assorted Cheeses|チーズ盛り合わせ +Stew|シチュー +Mushroom Dishes|きのこ料理 +Tart|タルト +Beer Barrel A|ビール樽A +Beer Barrel B|ビール樽B +Plate A|皿A +Plates B|皿B +Plates C|皿C +Chopping Board|まな板 +Soup Bowl|スープボウル +Paella Pan|パエリア鍋 +Closed Book A (V)|閉じた本A(縦) +Closed Book A (H)|閉じた本A(横) +Closed Book B (V)|閉じた本B(縦) +Closed Book B (H)|閉じた本B(横) +Open Book A (V)|開いた本A(縦) +Open Book A (H)|開いた本A(横) +Closed Books C|閉じた本C +Closed Book D|閉じた本D +Note A (V)|メモA(縦) +Note A (H)|メモA(横) +Notes B (V)|メモB(縦) +Pen A|ペン +Map A (V)|地図A(縦) +Map B (H)|地図B(横) +Note C (V)|メモC(縦) +Note C (H)|メモC(横) +Notes D|メモD +Envelope|封筒 +Scrolls A|巻物A +Scrolls B|巻物B +Planter A|プランターA +Planter B|プランターB +Potted Plant A|植木鉢A +Potted Plant B|植木鉢B +Case A|ケースA +Case B|ケースB +Case C|ケースC +Hourglass|砂時計 +Small Box A|小箱A +Small Box B|小箱B +Small Box C|小箱C +Small Box D|小箱D +Sack A|袋A +Sacks B|袋B +Medicine Bottle A|薬瓶A +Medicine Bottles B|薬瓶B +Potion A|液体入り瓶A +Potion B|液体入り瓶B +Potion C|液体入り瓶C +Potion D|液体入り瓶D +Basket A|バスケットA +Basket B|バスケットB +Basket C|バスケットC +Basket D|バスケットD +Rugs A|じゅうたんA +Rugs B|じゅうたんB +Rugs C|じゅうたんC +Balance|天秤 +Stuffed Doll A|ぬいぐるみA +Stuffed Doll B|ぬいぐるみB +Stuffed Doll C|ぬいぐるみC +Doll A|人形A +Doll B|人形B +Doll C|人形C +Gifts A|プレゼントA +Gifts B|プレゼントB +Globe|地球儀 +Bell|ベル +Cloth (Magic Circle)|布(魔法陣) +Crystal Ball|水晶玉 +Jewelry Case A|宝石ケースA +Necklace|ネックレス +Crown|王冠 +Jewelry Case B|宝石ケースB +Sword A|剣A +Swords B|剣B +Swords C|剣C +Axes|斧 +Spears A|槍A +Spears B|槍B +Whip|鞭 +Knives|短剣 +Cooking Utensils|調理器具 +Hanging Meat|吊るし肉 +Shield A|盾A +Shield B|盾B +Men's Clothing A (Hanging)|男物の服A(壁掛け) +Men's Clothing B (Hanging)|男物の服B(壁掛け) +Women's Clothing A (Hanging)|女物の服A(壁掛け) +Women's Clothing B (Hanging)|女物の服B(壁掛け) +Sword Rack A|剣掛台A +Sword Rack B|剣掛台B +Hammers|ハンマー +Bows & Arrows|弓矢 +Blacksmith's Table A|金床A +Blacksmith's Table B|金床B +Large Basin|水桶 +Scrap Metal|鉄くず +Helmet A|兜A +Helmet B|兜B +Helmet C|兜C +Hat A (Stand)|帽子A(スタンド) +Hat B (Stand)|帽子B(スタンド) +Hat C (Stand)|帽子C(スタンド) +Women's Clothing A (Stand)|女物の服A(スタンド) +Women's Clothing B (Stand)|女物の服B(スタンド) +Armor A (Stand)|鎧A(スタンド) +Armor B (Stand)|鎧B(スタンド) +Armor C (Stand)|鎧C(スタンド) +Armor D (Stand)|鎧D(スタンド) +Women's Clothing C (Stand)|女物の服C(スタンド) +Men's Clothing A (Stand)|男物の服A(スタンド) +Men's Clothing B (Stand)|男物の服B(スタンド) +Women's Clothing D (Stand)|女物の服D(スタンド) +Church Symbol|教会のシンボル +Goddess Statue|女神像 +God Statue|神像 +Statue A|石像A +Statue B|石像B +Dais|台座 +Repository of Swords|剣立て +Repository of Spears|槍立て +Church Symbol|教会のシンボル +Goddess Statue|女神像 +God Statue|神像 +Statue A|石像A +Statue B|石像B +Broken Statue|壊れた像 +Repository of Swords|剣立て +Repository of Spears|槍立て +Church Table|教会机 +Church Table|教会机 +Church Table|教会机 +Decorative Pillar A|装飾柱A +Decorative Pillar A|装飾柱A +Decorative Pillar B|装飾柱B +Decorative Pillar A (Ruins)|装飾柱A(廃墟) +Decorative Pillar B (Ruins)|装飾柱B(廃墟) +Church Table|教会机 +Church Table|教会机 +Church Table|教会机 +Decorative Pillar A (Ruins)|装飾柱A(廃墟) +Decorative Pillar A|装飾柱A +Decorative Pillar B|装飾柱B +Decorative Pillar A (Ruins)|装飾柱A(廃墟) +Decorative Pillar B (Ruins)|装飾柱B(廃墟) +Gold Bricks A|金の延べ棒A +Gold Bricks B|金の延べ棒B +Silver Bricks A|銀の延べ棒A +Silver Bricks B|銀の延べ棒B +Decorative Pillar A|装飾柱A +Decorative Pillar B|装飾柱B +Decorative Pillar A (Ruins)|装飾柱A(廃墟) +Decorative Pillar B (Ruins)|装飾柱B(廃墟) +Monument A|石碑A +Monument B|石碑B +Demon Statue|悪魔像 +Dragon Statue|竜像 +Dragon Statue|竜像 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Monument A|石碑A +Monument C|石碑C +Demon Statue|悪魔像 +Dragon Statue|竜像 +Dragon Statue|竜像 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Railings (Wood)|段差用手すり(木製) +Banister A (Wood)|階段用手すりA(木製) +Banister A (Wood)|階段用手すりA(木製) +Banister B (Stone)|階段用手すりB(石) +Banister B (Stone)|階段用手すりB(石) +Banister C (Temple)|階段用手すりC(神殿) +Banister C (Temple)|階段用手すりC(神殿) +Banister D (Castle)|階段用手すりD(城) +Banister D (Castle)|階段用手すりD(城) +Banister A (Wood)|階段用手すりA(木製) +Banister A (Wood)|階段用手すりA(木製) +Banister B (Stone)|階段用手すりB(石) +Banister B (Stone)|階段用手すりB(石) +Banister C (Temple)|階段用手すりC(神殿) +Banister C (Temple)|階段用手すりC(神殿) +Banister D (Castle)|階段用手すりD(城) +Banister D (Castle)|階段用手すりD(城) +Banister A (Wood)|階段用手すりA(木製) +Banister A (Wood)|階段用手すりA(木製) +Banister B (Stone)|階段用手すりB(石) +Banister B (Stone)|階段用手すりB(石) +Banister C (Temple)|階段用手すりC(神殿) +Banister C (Temple)|階段用手すりC(神殿) +Banister D (Castle)|階段用手すりD(城) +Banister D (Castle)|階段用手すりD(城) diff --git a/img/tilesets/Outside_A1.png b/img/tilesets/Outside_A1.png new file mode 100644 index 0000000..3579e18 Binary files /dev/null and b/img/tilesets/Outside_A1.png differ diff --git a/img/tilesets/Outside_A1.txt b/img/tilesets/Outside_A1.txt new file mode 100644 index 0000000..2ccfa58 --- /dev/null +++ b/img/tilesets/Outside_A1.txt @@ -0,0 +1,16 @@ +Water A (Meadow)|水場A(草地) +Pond|池 +Swamp Grass A|水草A +Swamp Grass B|水草B +Water B (Snow)|水場B(雪) +Waterfall A|滝A +Canal|水路 +Waterfall B (Stone Wall)|滝B(石壁) +Water C (Dirt)|水場C(土) +Waterfall C (Cliff)|滝C(崖) +Water D (Sand)|水場 D(砂) +Waterfall D (Boulder)|滝D(玉石) +Water E (Port)|水場E(港) +Water Bubbles|泡 +Poison Swamp|毒の沼 +Dead Tree|枯れ木 diff --git a/img/tilesets/Outside_A2.png b/img/tilesets/Outside_A2.png new file mode 100644 index 0000000..69128a8 Binary files /dev/null and b/img/tilesets/Outside_A2.png differ diff --git a/img/tilesets/Outside_A2.txt b/img/tilesets/Outside_A2.txt new file mode 100644 index 0000000..5d8fad0 --- /dev/null +++ b/img/tilesets/Outside_A2.txt @@ -0,0 +1,32 @@ +Meadow|草地 +Dirt (Meadow)|土(草地) +Road (Meadow)|道(草地) +Cobblestones A|石畳A +Bush|茂み +Road Edging|縁石 +Fencepost A (Wood)|柵A(木製) +Fissures|ひび割れ +Dirt|土 +Grass (Dirt)|草地(土) +Road (Dirt)|道(土) +Cobblestones A (Dirt)|石畳A(土) +Bush (Dead)|茂み(枯れ草) +Road Edging (Snow)|縁石(雪) +Fencepost B (Metal)|柵B(金属) +Soil|汚れ +Sand|砂地 +Grass (Sand)|草地(砂地) +Road (Sand)|道(砂地) +Cobblestones B|石畳B +Bush (Sand)|茂み(砂地) +Hole|穴 +Fencepost C (Stone)|柵C(石) +Moss|苔 +Snow|雪 +Dirt (Snow)|土(雪) +Road (Snow)|道(雪) +Carpet|カーペット +Bush (Snow)|茂み(雪) +Hole|穴 +Fencepost A (Wood, Snow)|柵A(木製・雪) +Ledge|段差 diff --git a/img/tilesets/Outside_A3.png b/img/tilesets/Outside_A3.png new file mode 100644 index 0000000..997d115 Binary files /dev/null and b/img/tilesets/Outside_A3.png differ diff --git a/img/tilesets/Outside_A3.txt b/img/tilesets/Outside_A3.txt new file mode 100644 index 0000000..c4efc86 --- /dev/null +++ b/img/tilesets/Outside_A3.txt @@ -0,0 +1,32 @@ +Roof A (Dressed Tile)|屋根A(化粧瓦) +Roof B (Pink Tile)|屋根B(ピンク瓦) +Roof C (Orange Tile)|屋根C(橙瓦) +Roof D (Yellow Tile)|屋根D(黄瓦) +Roof E (Wood)|屋根E(木造) +Roof F (Wood, Ruins)|屋根F(木造・廃墟) +Roof G (Log)|屋根G(丸太) +Roof H (Dark Blue Tile)|屋根H(紺瓦) +Outer Wall A (Rock Wall)|外壁A(石壁) +Outer Wall B (Plaster)|外壁B(石膏壁) +Outer Wall C (Brick)|外壁C(レンガ) +Outer Wall D (Plaster)|外壁D(石膏壁) +Outer Wall E (Wood)|外壁E(木造) +Outer Wall F (Wood)|外壁F(木造) +Outer Wall G (Log)|外壁G(丸太) +Outer Wall H (Demon Castle)外壁H(魔王城) +Roof I (Green Tile)|屋根I(緑瓦) +Roof J (Temple)|屋根J(神殿) +Roof K (Stone)|屋根K(石) +Roof L (Thatched)|屋根L(茅葺) +Roof M (Tent)|屋根M(テント) +Snow Roof A|雪の屋根A +Snow Roof B|雪の屋根B +Ice Roof|氷の屋根 +Outer Wall I (Rock Wall)|外壁I(石壁) +Outer Wall J (Temple)|外壁J(神殿) +Outer Wall K (Rock Wall)|外壁K(石壁) +Outer Wall L (Moss)|外壁L(苔) +Outer Wall M (Tent)|外壁M(テント) +Snow Outer Wall (Brick)|雪の外壁(レンガ) +Snow Outer Wall (Wood)|雪の外壁(木造) +Ice Outer Wall|氷の外壁 diff --git a/img/tilesets/Outside_A4.png b/img/tilesets/Outside_A4.png new file mode 100644 index 0000000..6845db9 Binary files /dev/null and b/img/tilesets/Outside_A4.png differ diff --git a/img/tilesets/Outside_A4.txt b/img/tilesets/Outside_A4.txt new file mode 100644 index 0000000..be2ff40 --- /dev/null +++ b/img/tilesets/Outside_A4.txt @@ -0,0 +1,48 @@ +Wall A (Stone)|壁A(石) +Wall B (Stone)|壁B(石) +Wall C (Stone)|壁C(石) +Building A (Castle)|建物A(城) +Building B (Castle, Snow)|建物B(城・雪) +Building C (Fort)|建物C(砦) +Building D (Fort, Snow)|建物D(砦・雪) +Demon Castle|魔王城 +Wall A (Stone)|壁A(石) +Wall B (Stone)|壁B(石) +Wall C (Stone)|壁C(石) +Building A (Castle)|建物A(城) +Building B (Castle, Snow)|建物B(城・雪) +Building C (Fort)|建物C(砦) +Building D (Fort, Snow)|建物D(砦・雪) +Demon Castle|魔王城 +Wall C (Brick)|壁C(レンガ) +Wall D (Stone)|壁D(石) +Wall E (Marble)|壁E(大理石) +Wall F (Marble)|壁F(大理石) +Building E (Dirt Wall)|建物E(土壁) +Building F (Desert)|建物F(砂漠風) +Wall G (Gold)|壁G(黄金) +Building G (Mecha)|建物G(メカ) +Wall C (Brick)|壁C(レンガ) +Wall D (Stone)|壁D(石) +Wall E (Marble)|壁E(大理石) +Wall F (Marble)|壁F(大理石) +Building E (Dirt Wall)|建物E(土壁) +Building F (Desert)|建物F(砂漠風) +Wall G (Gold)|壁G(黄金) +Building G (Mecha)|建物G(メカ) +Wall H (Moss)|壁H(苔) +Wall I (Hedge)|壁I(生け垣) +Forest A|森A +Forest B (Snow)|森B(雪) +Ledge A (Meadow)|段差A(草地) +Ledge B (Dirt)|段差B(土) +Ledge C (Desert)|段差C(砂地) +Ledge D (Snow)|段差D(雪) +Wall H (Moss)|壁H(苔) +Wall I (Hedge)|壁I(生け垣) +Forest A|森A +Forest B (Snow)|森B(雪) +Ledge A (Meadow)|段差A(草地) +Ledge B (Dirt)|段差B(土) +Ledge C (Desert)|段差C(砂地) +Ledge D (Snow)|段差D(雪) diff --git a/img/tilesets/Outside_A5.png b/img/tilesets/Outside_A5.png new file mode 100644 index 0000000..b4f81e6 Binary files /dev/null and b/img/tilesets/Outside_A5.png differ diff --git a/img/tilesets/Outside_A5.txt b/img/tilesets/Outside_A5.txt new file mode 100644 index 0000000..7c21fd9 --- /dev/null +++ b/img/tilesets/Outside_A5.txt @@ -0,0 +1,128 @@ +Darkness|暗闇 +Night Sky A|夜空A +Large Bridge (H, Top)|大きな橋(横・上) +Large Bridge (H, Center)|大きな橋(横・中央) +Large Bridge (Snow, H, Top)|大きな橋(雪・横・上) +Large Bridge (V, Left)|大きな橋(縦・左) +Large Bridge (V, Center)|大きな橋(縦・中央) +Large Bridge (V, Right)|大きな橋(縦・右) +Transparent|透明 +Night Sky B|夜空B +Large Bridge (H, Bottom)|大きな橋(横・下) +Large Bridge (Snow, H, Center)|大きな橋(雪・横・中央) +Large Bridge (Snow, H, Bottom)|大きな橋(雪・横・下) +Large Bridge (Snow, V, Left)|大きな橋(雪・縦・左) +Large Bridge (Snow, V, Center)|大きな橋(雪・縦・中央) +Large Bridge (Snow, V, Right)|大きな橋(雪・縦・右) +Meadow A|草地A +Dirt A|土A +Desert A|砂地A +Snow A|雪A +Meadow|草地B +Dirt B|土B +Desert B|砂地B +Snow B|雪B +Cobblestones A|石畳A +Cobblestones B|石畳B +Cobblestones C|石畳C +Cobblestones D|石畳D +Cobblestones A (Ruins)|石畳A(廃墟) +Cobblestones B (Ruins)|石畳B(廃墟) +Cobblestones C (Ruins)|石畳C(廃墟) +Cobblestones D (Ruins)|石畳D(廃墟) +Cobblestones E|石畳E +Cobblestones F|石畳F +Cobblestones G|石畳G +Demon Castle Floor|魔王城の床 +Cobblestones E (Ruins)|石畳E(廃墟) +Cobblestones F (Ruins)|石畳F(廃墟) +Cobblestones G (Ruins)|石畳G(廃墟) +Demon Castle Floor (Ruins)|魔王城の床(廃墟) +Ledge (Port, Left)|段差(港・左) +Ledge (Port, Center)|段差(港・中央) +Ledge (Port, Right)|段差(港・右) +Ledge (Port)|段差(港) +Tile Floor A|タイル床A +Tile Floor B|タイル床B +Tile Floor C (Gold)|タイル床C(金) +Tile Floor D (Ice)|タイル床D(氷) +Stairs (Meadow, Left)|階段(草地・左) +Stairs (Meadow, Center)|階段(草地・中央) +Stairs (Meadow, Right)|階段(草地・右) +Stairs (Meadow)|階段 +Stairs (Dirt, Left)|階段(土・左) +Stairs (Dirt, Center)|階段(土・中央) +Stairs (Dirt, Right)|階段(土・右) +Stairs (Dirt)|階段(土) +Stairs (Desert, Left)|階段(砂地・左) +Stairs (Desert, Center)|階段(砂地・中央) +Stairs (Desert, Right)|階段(砂地・右) +Stairs (Desert)|階段(砂地) +Stairs (Snow, Left)|階段(雪・左) +Stairs (Snow, Center)|階段(雪・中央) +Stairs (Snow, Right)|階段(雪・右) +Stairs (Snow)|階段(雪) +Stairs (Paved, Left)|階段(舗装・左) +Stairs (Paved, Center)|階段(舗装・中央) +Stairs (Paved, Right)|階段(舗装・右) +Stairs (Paved)|階段(舗装) +Stairs (Ruins, Left)|階段(廃墟・左) +Stairs (Ruins, Center)|階段(廃墟・中央) +Stairs (Ruins, Right)|階段(廃墟・右) +Stairs (Ruins)|階段(廃墟) +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Farm Field A (Top)|畑A(上) +Farm Field A (Center)|畑A(中央) +Farm Field B (Snow, Top)|畑B(雪・上) +Farm Field B (Snow, Center)|畑B(雪・中央) +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile|大きなレリーフ床 +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Large Relief Floor Tile (Ruins)|大きなレリーフ床(廃墟) +Farm Field A (Top)|畑A(上) +Farm Field A (Center)|畑A(中央) +Farm Field B (Snow, Top)|畑B(雪・上) +Farm Field B (Snow, Center)|畑B(雪・中央) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Garden A|花壇A +Garden B (Snow)|花壇B(雪) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Meadow)|段差(草地) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Cliff|崖 +Cliff|崖 +Cliff|崖 +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Cliff|崖 +Cliff|崖 +Cliff|崖 +Cliff (Meadow)|崖(草地) +Cliff (Meadow)|崖(草地) +Cliff (Meadow)|崖(草地) +Ledge (Dirt)|段差(土) +Ledge (Dirt)|段差(土) +Cliff (Dirt)|崖(土) +Cliff (Dirt)|崖(土) +Cliff (Dirt)|崖(土) diff --git a/img/tilesets/Outside_B.png b/img/tilesets/Outside_B.png new file mode 100644 index 0000000..14607f9 Binary files /dev/null and b/img/tilesets/Outside_B.png differ diff --git a/img/tilesets/Outside_B.txt b/img/tilesets/Outside_B.txt new file mode 100644 index 0000000..8d4fae1 --- /dev/null +++ b/img/tilesets/Outside_B.txt @@ -0,0 +1,256 @@ +Transparent|透明 +Stairs A (Up)|階段A(上り) +Stairs B (Up)|階段B(上り) +Stairs C (Up)|階段C(上り) +Stairs D (Up)|階段D(上り) +Tent A|テントA +Tent A|テントA +Tent A|テントA +Streetlight A|街灯A +Stairs A (Down)|階段A(下り) +Stairs B (Down)|階段B(下り) +Stairs C (Down)|階段C(下り) +Stairs D (Down)|階段D(下り) +Tent A|テントA +Tent A|テントA +Tent A|テントA +Streetlight A|街灯A +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Vines A|ツタ +Tent A|テントA +Tent A (Entrance)|テントA(入口) +Tent A|テントA +Streetlight A|街灯A +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Vines A|ツタA +Tent B|テントB +Tent B|テントB +Tent B|テントB +Streetlight B (Snow)|街灯B(雪) +Metal Ladder|鉄ばしご +Wood Ladder|木製はしご +Rope|ロープ +Vines B (Down)|ツタB(下り) +Tent B|テントB +Tent B|テントB +Tent B|テントB +Streetlight B (Snow)|街灯B(雪) +Hole A (Metal Ladder)|穴A(鉄ばしご) +Hole B (Wood Ladder)|穴B(木製はしご) +Hole C (Rope)|穴C(ロープ) +Hole D|穴D +Tent B|テントB +Tent B (Entrance, Snow)|テント(入口・雪) +Tent B|テントB +Streetlight B (Snow)|街灯B(雪) +Wall Vines A|壁のツタA +Wall Vines B|壁のツタB +Wall Vines C|壁のツタC +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Fissures D|亀裂D +Wall Moss|壁の苔 +Wall Vines A|壁のツタA +Wall Vines B|壁のツタB +Wall Vines C|壁のツタC +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Fissures E|亀裂E +Wall Fern|壁のシダ +Shop Sign (Sword)|看板(剣) +Shop Sign (Sword & Shield)|看板(剣と盾) +Shop Sign (Armor)|看板(鎧) +Shop Sign (Sack)|看板(袋) +Shop Sign (Teapot)|看板(ポット) +Shop Sign (Inn)|看板(宿) +Shop Sign (Pub)|看板(酒場) +Shop Sign (Eatery)|看板(食堂) +Shop Sign (Hexagram)|看板(魔法陣) +Shop Sign (Staves)|看板(杖) +Shop Sign (Coin)|看板(コイン) +Shop Sign (Necklace)|看板(ネックレス) +Shop Sign (Hammer)|看板(ハンマー) +Shop Sign (Crest)|看板(紋章) +Shop Sign (Blank)|看板(無地) +Log Bridge (V)|丸太の橋(縦) +Log Bridge (H)|丸太の橋(横) +Wood Bridge (V)|木の橋(縦) +Wood Bridge (H)|木の橋(横) +Stone Bridge (V)|石の橋(縦) +Stone Bridge (H)|石の橋(横) +Wood Bridge (V)|木の橋(縦) +Wood Bridge (H)|木の橋(横) +Bridge Spar (Wood, Center A)|橋げた(木・中央A) +Bridge Spar (Wood, Left)|橋げた(木・左) +Bridge Spar (Wood, Center B)|橋げた(木・中央B) +Bridge Spar (Wood, Right)|橋げた(木・右) +Bridge Spar (Stone, Center A)|橋げた(石・中央A) +Bridge Spar (Stone, Left)|橋げた(石・左) +Bridge Spar (Stone, Center B)||橋げた(石・中央B) +Bridge Spar (Stone, Right)|橋げた(石・右) +Window A|窓A +Window B|窓B +Window C|窓C +Window D|窓D +Middle Window A|中型窓A +Middle Window B|中型窓B +Middle Window C|中型窓C +Middle Window D|中型窓D +Window E|窓E +Window F|窓F +Window G|窓G +Window H|窓H +Middle Window A|中型窓A +Middle Window E|中型窓E +Middle Window C|中型窓C +Middle Window D|中型窓D +Large Window A|大型窓A +Large Window B|大型窓B +Large Window C|大型窓C +Stained Glass Window|ステンドグラス +Large Window D|大型窓D +Middle Window F|中型窓F +Middle Window G|中型窓G +Middle Window H|中型窓H +Large Window A|大型窓A +Large Window E|大型窓E +Large Window C|大型窓C +Stained Glass Window B|ステンドグラスB +Large Window D|大型窓D +Middle Window F|中型窓F +Middle Window G|中型窓G +Middle Window H|中型窓H +Chimney|煙突 +Mooring Bollard A|ビットA +Mooring Bollard B (Rope)|ビットB(ロープ) +Entrance A|入口A +Entrance A (Extend)|入口A(延長部分) +Entrance A (Top Half A)|入口A(上半分A)S +Entrance B|入口B +Entrance A (Top Half B)|入口A(上半分B) +Chimney|煙突 +Sign A|立て札A +Sign B|立て札B +Well|井戸 +Stepping Stones|踏み石 +Barrel|樽 +Grave A|墓A +Grave B|墓B +Pot|壺 +Basin A|桶A +Basin B|桶B +Rock Fire Pit A|石のかまどA +Rock Fire Pit B|石のかまどB +Barricade (H)|バリケード(横) +Barricade (V)|バリケード(縦) +Beanstalk|豆の木 +Grass A|草A +Grass B|草B +Grass C|草C +Grass D|草D +Stump|切り株 +Tree|木 +Tree|木 +Boulder A|岩A +Flowers A|花A +Flowers B|花B +Flowers C|花C +Flowers D|花D +Fallen Log|倒木 +Tree|木 +Bush|植え込み +Boulder B|岩B +Scarecrow|かかし +Hole|穴 +Firewood|薪 +Rocks|小石 +Crops A|農作物A +Crops B|農作物B +Crops C|農作物C +Crops D|農作物D +Large Tree|大木 +Large Tree|大木 +Large Tree|大木 +Large Tree|大木 +Large Crate|大きな木箱 +Crate A|木箱A +Crate B|木箱B +Crate C|木箱C +Large Tree|大木 +Large Tree|大木 +Large Tree|大木 +Large Tree|大木 +Large Crate|大きな木箱 +Crate D|木箱D +Crate E|木箱E +Crate F|木箱F +Conifer Tree (Snow)|針葉樹(雪) +Conifer Tree (Snow)|針葉樹(雪) +Conifer Tree (Snow)|針葉樹(雪) +Conifer Tree (Snow)|針葉樹(雪) +Scarecrow (Snow)|かかし(雪) +Pot (Snow)|壺(雪) +Bucket (Snow)|桶(雪) +Crate (Snow)|木箱(雪) +Large Conifer Tree (Snow)|大針葉樹(雪) +Large Conifer Tree (Snow)|大針葉樹(雪) +Large Conifer Tree (Snow)|大針葉樹(雪) +Large Conifer Tree (Snow)|大針葉樹(雪) +Mooring Bollard (Snow)|ビット(雪) +Barricade (H, Snow)|バリケード(横・雪) +Barricade (H, Snow)|バリケード(縦・雪) +Beanstalk (Snow)|豆の木(雪) +Stump (Snow)|切り株(雪) +Sign A (Snow)|立て札A(雪) +Sign B (Snow)|立て札B(雪) +Well (Snow)|井戸(雪) +Stepping Stones (Snow)|踏み石(雪) +Barrel (Snow)|樽(雪) +Grave A (Snow)|墓A(雪) +Grave B (Snow)|墓B(雪) +Snowman|雪だるま +Grass A (Snow)|草A(雪) +Grass B (Snow)|草B(雪) +Grass C (Snow)|草C(雪) +Grass D (Snow)|草D(雪) +Conifer Tree (Snow)|針葉樹(雪) +Conifer Tree (Snow)|針葉樹(雪) +Boulder A (Snow)|岩A(雪) +Dead Beanstalk|枯れた豆の木 +Hole (Snow)|穴(雪) +Firewood (Snow)|薪(雪) +Rocks (Snow)|小石(雪) +Fallen Log (Snow)|倒木(雪) +Conifer Tree (Snow)|針葉樹(雪) +Bush (Snow)|植え込み(雪) +Boulder B (Snow)|岩B(雪) +Dead Tree|枯れ木 +Dead Tree|枯れ木 +Mushrooms A|キノコA +Mushrooms B|キノコB +Palm Tree|ヤシの木 +Palm Tree|ヤシの木 +Cactus|サボテン +Dead Grass A|枯れ草A +Dead Tree|枯れ木 +Dead Tree (Shrub)|枯れ木(低木) +Rafflesia|ラフレシア +Stump (Moss)|切り株(苔) +Palm Tree|ヤシの木 +Bush (Flowers)|植え込み(花) +Fern|シダ +Dead Grass B|枯れ草B +Hay|干し草 +Hay (Snow)|干し草(雪) +Floral Patch|花畑 +Susuki Grass|ススキ +Fallen Leaves|落ち葉 +Lotus Pads A|蓮の葉A +Lotus Pads B (Flowers)|蓮の葉B(花) +Lotus Pads C|蓮の葉C diff --git a/img/tilesets/Outside_C.png b/img/tilesets/Outside_C.png new file mode 100644 index 0000000..6723537 Binary files /dev/null and b/img/tilesets/Outside_C.png differ diff --git a/img/tilesets/Outside_C.txt b/img/tilesets/Outside_C.txt new file mode 100644 index 0000000..4c98460 --- /dev/null +++ b/img/tilesets/Outside_C.txt @@ -0,0 +1,256 @@ +Obelisk|オベリスク +Stone Pillar A|石の柱A +Stone Pillar B|石の柱B +Stone Pillar B (Moss)|石の柱B(苔) +Stone Pillar B (Snow)|石の柱B(雪) +Stone Pillar C|石の柱C +Stone Pillar D|石の柱D +Demon Castle Pillar|魔王城の柱 +Obelisk|オベリスク +Stone Pillar A|石の柱A +Stone Pillar B|石の柱B +Stone Pillar B (Moss)|石の柱B(苔) +Stone Pillar B (Snow)|石の柱B(雪) +Stone Pillar C|石の柱C +Stone Pillar D|石の柱D +Demon Castle Pillar|魔王城の柱 +Obelisk|オベリスク +Broken Stone Pillar A|折れた石の柱A +Broken Stone Pillar B|折れた石の柱B +Broken Stone Pillar B (Moss)|折れた石の柱B(苔) +Broken Stone Pillar B (Snow)|折れた石の柱B(雪) +Broken Stone Pillar C|折れた石の柱C +Broken Stone Pillar D|折れた石の柱D +Broken Demon Castle Pillar|折れた魔王城の柱 +Bones A|骸骨A +Bones B|骸骨B +Rubble|瓦礫A +Rubble B (Moss)|瓦礫B(苔) +Rubble C (Snow)|瓦礫C(雪) +Rubble D|瓦礫D +Rubble E|瓦礫E +Rubble F (Demon Castle)|瓦礫F(魔王城) +Monument A|石碑A +Monument B|石碑B +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Monument A|石碑A +Monument C|石碑C +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Large Monument|大きな石碑 +Monument A (Snow)|石碑A(雪) +Monument B (Snow)|石碑B(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Monument A (Snow)|石碑A(雪) +Monument C (Snow)|石碑C(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Large Monument (Snow)|大きな石碑(雪) +Statue A|石像A +Statue B|石像B +Angel Statue|天使像 +Demon Statue|悪魔像 +Dais|台座 +Dragon Statue|竜像 +Dragon Statue|竜像 +God Statue|神像 +Statue A|石像A +Statue B|石像B +Angel Statue|天使像 +Demon Statue|悪魔像 +Broken Dais|壊れた台座 +Dragon Statue|竜像 +Dragon Statue|竜像 +God Statue|神像 +Statue A (Snow)|石像A(雪) +Statue B (Snow)|石像B(雪) +Angel Statue (Snow)|天使像(雪) +Demon Statue (Snow)|悪魔像(雪) +Dais (Snow)|台座(雪) +Dragon Statue (Snow)|竜像(雪) +Dragon Statue (Snow)|竜像(雪) +Ice Statue|氷像 +Statue A (Snow)|石像A(雪) +Statue B (Snow)|石像B(雪) +Angel Statue (Snow)|天使像(雪) +Demon Statue (Snow)|悪魔像(雪) +Broken Dais (Snow)|壊れた台座(雪) +Dragon Statue (Snow)|竜像(雪) +Dragon Statue (Snow)|竜像(雪) +Ice Statue|氷像 +Tapestry A|タペストリーA +Tapestry A (Ruins)|タペストリーA(廃墟) +Tapestry B|タペストリーB +Tapestry B (Ruins)|タペストリーB(廃墟) +Tapestry C|タペストリーC +Tapestry C (Ruins)|タペストリーC(廃墟) +Tapestry D|タペストリーD +Tapestry D (Ruins)|タペストリーD(廃墟) +Tapestry A|タペストリーA +Tapestry A (Ruins)|タペストリーA(廃墟) +Tapestry B|タペストリーB +Tapestry B (Ruins)|タペストリーB(廃墟) +Tapestry C|タペストリーC +Tapestry C (Ruins)|タペストリーC(廃墟) +Tapestry D|タペストリーD +Tapestry D (Ruins)|タペストリーD(廃墟) +Window A (Demon Castle)|窓A(魔王城) +Window B (Demon Castle)|窓B(魔王城) +Window C (Demon Castle)|窓C(魔王城) +Antenna|アンテナ +Chimney|煙突 +Chimney|煙突 +Cave Entrance|洞窟入口 +Mine Entrance|坑道入口 +Window A (Demon Castle)|窓A(魔王城) +Window B (Demon Castle)|窓B(魔王城) +Window D (Demon Castle)|窓D(魔王城) +Antenna|アンテナ +Chimney|煙突 +Chimney|煙突 +Cave Entrance|洞窟入口 +Mine Entrance|坑道入口 +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof A (Green Tile)|屋根A(緑瓦) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof B (Snow)|屋根B(雪) +Roof B (Snow)|屋根B(雪) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof C (Yellow Tile)|屋根C(黄瓦) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Round Tower A (Castle)|円塔A(城) +Round Tower A (Castle)|円塔A(城) +Round Tower B (Fort)|円塔B(砦) +Round Tower B (Fort)|円塔B(砦) +Roof Detail A (Green Tile)|屋根飾りA(緑瓦) +Roof Detail B (Snow)|屋根飾りB(雪) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Round Tower A (Castle)|円塔A(城) +Round Tower A (Castle)|円塔A(城) +Round Tower B (Fort)|円塔B(砦) +Round Tower B (Fort)|円塔B(砦) +Roof Detail C (Yellow Tile)|屋根飾りC(黄瓦) +Roof Detail D (Wood)|屋根飾りD(木造) +Roof D (Wood)|屋根D(木造) +Roof D (Wood)|屋根D(木造) +Round Tower A (Castle)|円塔A(城) +Round Tower A (Castle)|円塔A(城) +Round Tower B (Fort)|円塔B(砦) +Round Tower B (Fort)|円塔B(砦) +Round Tower A (Castle's Spire)|円塔A(城の尖塔) +Round Tower A (Castle's Spire)|円塔A(城の尖塔) +Round Tower B (Fort)|円塔B(砦) +Round Tower B (Fort)|円塔B(砦) +Round Tower A (Castle)|円塔A(城) +Round Tower A (Castle)|円塔A(城) +Round Tower B (Fort)|円塔B(砦) +Round Tower B (Fort)|円塔B(砦) +Round Tower A (Castle's Spire)|円塔A(城の尖塔) +Round Tower A (Castle's Spire)|円塔A(城の尖塔) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower A (Castle)|円塔A(城) +Round Tower A (Castle)|円塔A(城) +Round Tower B (Fort)|円塔B(砦) +Round Tower B (Fort)|円塔B(砦) +Round Tower A (Castle's Spire)|円塔A(城の尖塔) +Round Tower A (Castle's Spire)|円塔A(城の尖塔) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower A (Castle)|円塔A(城) +Round Tower A (Castle)|円塔A(城) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower A (Castle's Spire, Snow)|円塔A(城の尖塔・雪) +Round Tower A (Castle's Spire, Snow)|円塔A(城の尖塔・雪) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower A (Castle's Spire, Snow)|円塔A(城の尖塔・雪) +Round Tower A (Castle's Spire, Snow)|円塔A(城の尖塔・雪) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower A (Castle's Spire, Snow)|円塔A(城の尖塔・雪) +Round Tower A (Castle's Spire, Snow)|円塔A(城の尖塔・雪) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower B (Fort, Snow)|円塔B(砦・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower A (Castle, Snow)|円塔A(城・雪) +Round Tower C (Demon Castle)|円塔C(魔王城) +Round Tower C (Demon Castle)|円塔C(魔王城) diff --git a/img/tilesets/SF_Inside_A4.png b/img/tilesets/SF_Inside_A4.png new file mode 100644 index 0000000..aa572cd Binary files /dev/null and b/img/tilesets/SF_Inside_A4.png differ diff --git a/img/tilesets/SF_Inside_A4.txt b/img/tilesets/SF_Inside_A4.txt new file mode 100644 index 0000000..b2ccab5 --- /dev/null +++ b/img/tilesets/SF_Inside_A4.txt @@ -0,0 +1,48 @@ +Wall A (Concrete)|壁A(コンクリート) +Wall B (Concrete)|壁B(コンクリート) +Wall C (House)|壁C(現代住宅) +Wall D (Metal)|壁D(金属) +Wall E (Metal, Red Rust)|壁E(金属・赤錆) +Wall F (Metal, Patina)|壁F(金属・緑青錆) +Wall G (Barracks)|壁G(バラック) +Wall H (Chinese)|壁H(中華風) +Wall A (Concrete)|壁A(コンクリート) +Wall B (Concrete)|壁B(コンクリート) +Wall C (House)|壁C(現代住宅) +Wall D (Metal)|壁D(金属) +Wall E (Metal, Red Rust)|壁E(金属・赤錆) +Wall F (Tent, Camouflage)|壁F(テント・迷彩) +Wall G (Barracks)|壁G(バラック) +Wall H (Chinese)|壁H(中華風) +Wall I (Factory)|壁I(工場) +Wall J (Factory)|壁J(工場) +Interior Wall A (Pattern)|内装壁A(模様) +Interior Wall B (Pattern)|内装壁B(模様) +Interior Wall C (Pattern)|内装壁C(模様) +Interior Wall D (Pattern)|内装壁D(模様) +Interior Wall E (Pattern)|内装壁E(模様) +Wall K (Brick)|壁K(レンガ) +Wall I (Factory)|壁I(工場) +Wall J (Factory)|壁J(工場) +Interior Wall A (Pattern)|内装壁A(模様) +Interior Wall B (Pattern)|内装壁B(模様) +Interior Wall C (Pattern)|内装壁C(模様) +Interior Wall D (Pattern)|内装壁D(模様) +Interior Wall E (Pattern)|内装壁E(模様) +Wall K (Brick)|壁K(レンガ) +Wall L (Wood)|壁L(木造) +Wall M (House)|壁M(現代住宅) +Wall N (Building)|壁N(ビル) +Wall O (Other Dimension)|壁O(異空間) +Wall P (Neon)|壁P(ネオン) +Wall Q (Wire Mesh)|壁Q(金網) +Wall R (Wire Mesh, Red Rust)|壁R(金網・赤錆) +Wall S (Wire Mesh, Patina)|壁S(金網・緑青錆) +Wall L (Wood)|壁L(木造) +Wall M (House)|壁M(現代住宅) +Wall N (Building)|壁N(ビル) +Wall O (Other Dimension)|壁O(異空間) +Wall P (Neon)|壁P(ネオン) +Wall Q (Wire Mesh)|壁Q(金網) +Wall R (Wire Mesh, Red Rust)|壁R(金網・赤錆) +Wall S (Wire Mesh, Patina)|壁S(金網・緑青錆) diff --git a/img/tilesets/SF_Inside_B.png b/img/tilesets/SF_Inside_B.png new file mode 100644 index 0000000..037aee8 Binary files /dev/null and b/img/tilesets/SF_Inside_B.png differ diff --git a/img/tilesets/SF_Inside_B.txt b/img/tilesets/SF_Inside_B.txt new file mode 100644 index 0000000..9a952ab --- /dev/null +++ b/img/tilesets/SF_Inside_B.txt @@ -0,0 +1,256 @@ +Transparent|透明 +Stairs A (Up)|階段A(上り) +Stairs B (Up)|階段B(上り) +Stairs C (Up)|階段C(上り) +Stairs D (Up)|階段D(上り) +Wood Ladder|木製はしご +Metal Stairs|金属階段 +Crane Rope|クレーンロープ +Hole|穴 +Stairs A (Down)|階段A(下り) +Stairs B (Down)|階段B(下り) +Stairs C (Down)|階段C(下り) +Stairs D (Down)|階段D(下り) +Wood Ladder|木製はしご +Metal Stairs|金属階段 +Crane Rope|クレーンロープ +Midsize Window A|中型窓A +Midsize Window B|中型窓B +Large Window A|大型窓A +Midsize Window C|中型窓C +Large Window B|大型窓B +Wood Ladder|木製はしご +Metal Stairs|金属階段 +Crane Rope|クレーンロープ +Midsize Window A|中型窓A +Midsize Window B|中型窓B +Large Window A|大型窓A +Midsize Window C|中型窓C +Large Window B|大型窓B +Hole A (Wood Ladder)|穴A(木製はしご) +Hole B (Metal Stairs)|穴B(金属階段) +Hole C (Crane Rope)|穴C(クレーンロープ) +Asphalt Bridge (V)|アスファルトの橋(縦) +Asphalt Bridge (H)|アスファルトの橋(横) +Stone Bridge (V)|石の橋(縦) +Stone Bridge (H)|石の橋(横) +Metal Bridge A (V)|金属の橋A(縦) +Metal Bridge A (H)|金属の橋A(横) +Metal Bridge B (V)|金属の橋B(縦) +Metal Bridge B (H)|金属の橋B(横) +Bridge Spar A (Asphalt, Center A)|橋げたA(アスファルト・中央A) +Bridge Spar A (Asphalt, Left)|橋げたA(アスファルト・左) +Bridge Spar A (Asphalt, Center B)|橋げたA(アスファルト・中央B) +Bridge Spar A (Asphalt, Right)|橋げたA(アスファルト・右) +Bridge Spar B (Metal, Center A)|橋げたB(金属・中央A) +Bridge Spar B (Metal, Left)|橋げたB(金属・左) +Bridge Spar B (Metal, Center B)|橋げたB(金属・中央B) +Bridge Spar B (Metal, Right)|橋げたB(金属・右) +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Warning Plate A|警告プレートA +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal, Stairs)|連絡橋(金属・階段) +Metal Fence|金属フェンス +Warning Plate B|警告プレートB +Metal Fence|金属フェンス +Warning Plate C|警告プレートC +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal, Stairs)|連絡橋(金属・階段) +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Warning Plate (Biohazard Mark)|警告プレート(バイオハザードマーク) +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal)|連絡橋(金属) +Connecting Bridge (Metal)|連絡橋(金属) +Podium (H)|教壇机(横) +Pillar A (Asphalt)|柱A(アスファルト) +Pillar B (Metal)|柱B(金属) +Pillar C (Display)|柱C(ディスプレイ) +Pillar D (Decoration)|柱D(装飾) +Pillar E (Metal)|柱E(金属) +Pillar F (Brick)|柱F(レンガ) +Large Window C|大型窓C +Podium (H)|教壇机(横) +Pillar A (Asphalt)|柱A(アスファルト) +Pillar B (Metal)|柱B(金属) +Pillar C (Display)|柱C(ディスプレイ) +Pillar D (Decoration)|柱D(装飾) +Pillar E (Metal)|柱E(金属) +Pillar F (Brick)|柱F(レンガ) +Large Window C|大型窓C +Podium (V)|教壇机(縦) +Broken Pillar A (Asphalt)|折れた柱A(アスファルト) +Broken Pillar B (Metal)|折れた柱B(金属) +Broken Pillar C (Display)|折れた柱C(ディスプレイ) +Broken Pillar D (Decoration)|折れた柱D(装飾) +Broken Pillar E (Metal)|折れた柱E(金属) +Broken Pillar F (Brick)|折れた柱F(レンガ) +Barricade (No Entry)|バリケード(通行禁止) +Podium (V)|教壇机(縦) +Girder A (Asphalt, Left)|梁A(アスファルト・左) +Girder A (Asphalt, Center)|梁A(アスファルト・中央) +Girder A (Asphalt, Right)|梁A(アスファルト・右) +Girder C (Decoration, Left)|梁C(装飾・左) +Girder C (Decoration, Center)|梁C(装飾・中央) +Girder C (Decoration, Right)|梁C(装飾・右) +Bar (No Entry)|バー(通行禁止) +Bar (No Entry)|バー(通行禁止) +Girder B (Metal, Left)|梁B(金属・左) +Girder B (Metal, Center)|梁B(金属・中央) +Girder B (Metal, Right)|梁B(金属・右) +Rubble A (Asphalt)|瓦礫A(アスファルト) +Rubble B (Metal)|瓦礫B(金属) +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Jail Bars|鉄格子 +Laser Barrier|レーザーバリア +Wheelchair (Left)|車いす(左) +Wheelchair (Right)|車いす(右) +Pipe Frame Bed (Ruins)|パイプベッド(廃墟) +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Jail Bars|鉄格子 +Laser Barrier|レーザーバリア +Wheelchair (Bottom)|車いす(下) +Wheelchair (Fallen)|車いす(倒れ) +Pipe Frame Bed (Ruins)|パイプベッド(廃墟) +Lab Equipment|実験器具 +School Desk (V)|学校机(縦) +School Desk (H)|学校机(横) +TV|テレビ +Computer|PC +Laptop|ノートPC +Printer|プリンター +Telephone|電話 +Intercom (Hanging)|インターホン(壁掛け) +Tablet Device|タブレット端末 +Table Clock|置時計 +Gas Stove|ガスコンロ +Kitchen Counter|調理台 +Sink|流し +Exhaust Fan|換気扇 +Air Conditioner|エアコン +Wastebasket|ゴミ箱 +Book Stand|本立て +Document|書類 +School Chair (Bottom)|学校イス(下) +School Chair (Top)|学校イス(上) +School Chair (Right)|学校イス(右) +School Chair (Left)|学校イス(左) +Sofa (Right)|ソファ(右) +Sofa (Left)|ソファ(左) +Sofa (Down)|ソファ(下) +Sofa (Up)|ソファ(下) +Office Chair (Bottom)|オフィスチェア(下) +Office Chair (Top)|オフィスチェア(上) +Office Chair (Right)|オフィスチェア(右) +Office Chair (Left)|オフィスチェア(左) +Sofa (Right)|ソファ(右) +Sofa (Left)|ソファ(左) +Sofa (Top)|ソファ(上) +Sofa (Top)|ソファ(上) +Washing Machine|洗濯機 +Western Style Toilet|洋式便器 +Urinal|男性用便器 +Bathroom Sink|洗面台 +Bathtub (V)|バスタブ(縦) +Bathtub (H)|バスタブ(横) +Bathtub (H)|バスタブ(横) +Glass Table (V)|ガラステーブル(縦) +Washing Machine|洗濯機 +Western Style Toilet|洋式便器 +Urinal|男性用便器 +Wash Basin|洗面台 +Bathtub (V)|バスタブ(縦) +Glass Table (H)|ガラステーブル(横) +Glass Table (H)|ガラステーブル(横) +Glass Table (V)|ガラステーブル(縦) +Refrigerator|冷蔵庫 +Bookshelf A|本棚A +Chest of Drawers A|タンスA +Miscellaneous Item Shelf|雑貨棚 +Locker A|ロッカーA +Document Shelf|資料棚 +Medicine Shelf|薬品棚 +Locker B (School)|ロッカーB(学校) +Refrigerator|冷蔵庫 +Bookshelf A|本棚A +Chest of Drawers A|タンスA +Miscellaneous Item Shelf|雑貨棚 +Locker A|ロッカーA +Document Shelf|資料棚 +Medicine Shelf|薬品棚 +Locker B (School)|ロッカーB(学校) +Display Shelf A|商品陳列棚A +Display Shelf B|商品陳列棚B +Convenience Store Shelf A|コンビニ棚A +Convenience Store Shelf B|コンビニ棚B +Document Shelf (Ruins)|資料棚(廃墟) +Chest of Drawers B (Decoration)|タンスB(装飾) +Shelf A (Decoration)|棚A(装飾) +Bookshelf B (Decoration)|本棚B(装飾) +Display Shelf A|商品陳列棚A +Display Shelf B|商品陳列棚B +Convenience Store Shelf A|コンビニ棚A +Convenience Store Shelf B|コンビニ棚B +Document Shelf (Ruins)|資料棚(廃墟) +Chest of Drawers B (Decoration)|タンスB(装飾) +Shelf A (Decoration)|棚A(装飾) +Bookshelf B (Decoration)|本棚B(装飾) +Stacked Crates|積まれた木箱 +Shipping Container|コンテナ +Stacked Cardboard Boxes|積まれたダンボール +Vending Machine|自動販売機 +ATM|ATM +Steel Shelf|鉄骨棚 +Operating Table|手術台 +Hospital Bed|病院ベッド +Stacked Crates|積まれた木箱 +Shipping Container|コンテナ +Stacked Cardboard Boxes|積まれたダンボール +Vending Machine|自動販売機 +ATM|ATM +Steel Shelf|鉄骨棚 +Operating Table|手術台 +Hospital Bed|病院ベッド +Bed|ベッド +Mattress|敷布団 +Large Bed|ダブルベッド +Large Bed|ダブルベッド +Pipe Frame Bed|パイプベッド +Slot Machine|スロット +Poker Table|ポーカー台 +Poker Table|ポーカー台 +Bed|ベッド +Mattress|敷布団 +Large Bed|ダブルベッド +Large Bed|ダブルベッド +Pipe Frame Bed|パイプベッド +Slot Machine|スロット +Poker Table|ポーカー台 +Poker Table|ポーカー台 +Chest A (Wood)|チェストA(木製) +Chest B (Metal)|チェストB(金属) +Chest C (Decoration)|チェストC(装飾) +Large Desk A|大きいデスクA +Large Desk A|大きいデスクA +Roulette Table|ルーレット台 +Roulette Table|ルーレット台 +Roulette Table|ルーレット台 +Side Desk A (Wood)|サイドデスクA(木製) +Side Desk B (Metal)|サイドデスクB(金属) +Desk|デスク +Large Desk B|大きいデスクB +Large Desk B|大きいデスクB +Roulette Table|ルーレット台 +Roulette Table|ルーレット台 +Roulette Table|ルーレット台 \ No newline at end of file diff --git a/img/tilesets/SF_Inside_C.png b/img/tilesets/SF_Inside_C.png new file mode 100644 index 0000000..62a5cf6 Binary files /dev/null and b/img/tilesets/SF_Inside_C.png differ diff --git a/img/tilesets/SF_Inside_C.txt b/img/tilesets/SF_Inside_C.txt new file mode 100644 index 0000000..8a0ffdb --- /dev/null +++ b/img/tilesets/SF_Inside_C.txt @@ -0,0 +1,256 @@ +Black Board|黒板 +Black Board|黒板 +Black Board|黒板 +White Board|ホワイトボード +White Board|ホワイトボード +White Board|ホワイトボード +Partition A|衝立A +Partition B|衝立B +Black Board|黒板 +Black Board|黒板 +Black Board|黒板 +White Board|ホワイトボード +White Board|ホワイトボード +White Board|ホワイトボード +Partition A|衝立A +Partition B|衝立B +Stool|腰掛けイス +Skeleton Model|骨格模型 +Biological Specimen|生物標本 +Potted Plant|植木鉢 +Armchair|肘掛け椅子 +Insect Specimen|昆虫標本 +Restroom Mark (Men)|トイレマーク(男性) +Restroom Mark (Women)|トイレマーク(女性) +Wall Speaker|壁掛けスピーカー +Skeleton Model |骨格模型 +Biological Specimen|生物標本 +Fire Extinguisher|消火器 +Armchair|肘掛け椅子 +Room Plate|室名札 +EXIT Sign|EXIT +Vent|通気口 +Painting A|絵画A +Painting B|絵画B +Vision Test Chart|視力検査表 +Plaster Bust|石膏胸像 +Calendar|カレンダー +Plant A|植物A +Plant B|植物B +Plant C|植物C +Painting C|絵画C +Painting D|絵画D +Anatomical Chart|人体図 +Canvas|キャンバス +Bulletin Board|掲示板 +Plant A|植物A +Plant B|植物B +Plant C|植物C +Plumbing|配管 +Plumbing|配管 +Valve|バルブ +Machine A|機械A +Machine B|機械B +Machine C|機械C +Air Vent A|通風口A +Air Vent B|通風口B +Plumbing|配管 +Plumbing|配管 +Plumbing|配管 +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Fan|ファン +Fluorescent Light|蛍光灯 +Plumbing|配管 +Plumbing|配管 +Plumbing|配管 +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Outdoor Air Intake Unit|室外機 +Shutter|シャッター +Plumbing|配管 +Plumbing|配管 +Plumbing|配管 +Control Panel A|操作パネルA +Control Panel B|操作パネルB +Control Panel C|操作パネルC +Pipe (H)|パイプ(横) +Pipe (V)|パイプ(縦) +Line A|ラインA +Line B|ラインB +Road Closed|通行止め +Waste|廃棄物 +Scrap Metal|スクラップ +Mysterious Liquid|謎の液体 +Scattered Papers|散らばった紙 +Pipe (V)|パイプ(縦) +Belt Conveyor (V)|ベルトコンベアー(縦) +Belt Conveyor (H)|ベルトコンベアー(横) +Belt Conveyor (H)|ベルトコンベアー(横) +Belt Conveyor (H)|ベルトコンベアー(横) +Duct|ダクト +Mechanical Device|機械装置 +Pile of Rubble|瓦礫の山 +Pile of Rubble|瓦礫の山 +Belt Conveyor (V)|ベルトコンベアー(縦) +Robot Arm|ロボットアーム +Server Machine|サーバマシン +Meters|計器類 +Duct|ダクト +Mechanical Device|機械装置 +Pile of Rubble|瓦礫の山 +Pile of Rubble|瓦礫の山 +Belt Conveyor (V)|ベルトコンベアー(縦) +Robot Arm|ロボットアーム +Server Machine|サーバマシン +Meters|計器類 +Duct|ダクト +Drain|排水口 +Graffiti|落書き +Graffiti|落書き +Monitor A|モニターA +Monitor B|モニターB +Large Monitor|大型モニター +Large Monitor|大型モニター +IV Stand|点滴スタンド +ECG Monitor|心電図モニタ +Sewing Mannequin|トルソー +Rubble|瓦礫 +Operation Board A|操作盤A +Operation Board B|操作盤B +Operation Board C|操作盤C +Operation Board D|操作盤D +IV Stand|点滴スタンド +ECG Monitor|心電図モニタ +Sewing Mannequin|トルソー +Broken Machine|壊れた機械 +Stairs|階段 +Stairs|階段 +Stairs|階段 +Cage|檻 +Cage|檻 +Handrail|欄干 +Handrail|欄干 +Handrail|欄干 +Stairs|階段 +Stairs|階段 +Stairs|階段 +Curtains A|カーテンA +Curtains B|カーテンB +Curtains C|カーテンC +Curtains D|カーテンD +Handrail|欄干 +Stairs|階段 +Stairs|階段 +Stairs|階段 +Curtains A|カーテンA +Curtains B|カーテンB +Curtains C|カーテンC +Curtains D|カーテンD +Emergency Alarm|非常ベル +Spider Web|蜘蛛の巣 +Mirror|鏡 +Vase|花瓶 +Piano|ピアノ +Piano|ピアノ +Piano|ピアノ +Stained Glass|ステンドグラス +Decorative Pillar|装飾柱 +Dripping|液垂れ +Mirror|鏡 +Lamp|電気スタンド +Piano|ピアノ +Piano|ピアノ +Piano|ピアノ +Stained Glass|ステンドグラス +Decorative Pillar|装飾柱 +Picture Frame|写真立て +Side Table|サイドテーブル +Altar|祭壇 +Fireplace|暖炉 +Fireplace|暖炉 +Fireplace|暖炉 +Stuffed Doll A|ぬいぐるみA +Decorative Pillar|装飾柱 +Book A|本A +Book B|本B +Glass Pieces|ガラス片 +Fireplace|暖炉 +Fireplace|暖炉 +Fireplace|暖炉 +Doll|人形 +Stuffed Doll B|ぬいぐるみB +Beer Mug|ビールジョッキ +Wine & Glass|ワインとグラス +Noodle Dish|麺料理 +Bread|パン +Banister A (V)|手すりA(縦) +Banister A (V)|手すりA(縦) +Banister B (V)|手すりB(縦) +Banister B (V)|手すりB(縦) +Meat Dish|肉料理 +Roast Chicken|ローストチキン +Cake|ケーキ +Fruit Bowl|果物盛り合わせ +Banister A (V)|手すりA(縦) +Banister A (V)|手すりA(縦) +Banister B (V)|手すりB(縦) +Banister B (V)|手すりB(縦) +Plate A|皿A +Teapot & Cup|ティーポットとカップ +Ration|レーション +Plate B|皿B +Banister A (V)|手すりA(縦) +Banister A (V)|手すりA(縦) +Banister B (V)|手すりB(縦) +Banister B (V)|手すりB(縦) +Demon Statue|悪魔像 +Goddess Statue|女神像 +Soldier Statue|兵士像 +Wall Clock|柱時計 +Banister A (H)|手すりA(横) +Banister A (H)|手すりA(横) +Banister A (H)|手すりA(横) +Banister A (H)|手すりA(横) +Demon Statue|悪魔像 +Goddess Statue|女神像 +Soldier Statue|兵士像 +Wall Clock|柱時計 +Banister B (H)|手すりB(横) +Banister B (H)|手すりB(横) +Banister B (H)|手すりB(横) +Banister B (H)|手すりB(横) +Monument A|モニュメントA +Monument B|モニュメントB +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Display|巨大ディスプレイ +Huge Display|巨大ディスプレイ +Huge Display|巨大ディスプレイ +Monument A|モニュメントA +Monument B|モニュメントB +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Display|巨大ディスプレイ +Huge Display|巨大ディスプレイ +Huge Display|巨大ディスプレイ +Monument C|モニュメントC +Monument D|モニュメントD +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Large Machine|大型機械 +Large Machine|大型機械 +Large Machine|大型機械 +Monument C|モニュメントC +Control Panel|コントロールパネル +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Large Machine|大型機械 +Large Machine|大型機械 +Large Machine|大型機械 diff --git a/img/tilesets/SF_Outside_A3.png b/img/tilesets/SF_Outside_A3.png new file mode 100644 index 0000000..2b69441 Binary files /dev/null and b/img/tilesets/SF_Outside_A3.png differ diff --git a/img/tilesets/SF_Outside_A3.txt b/img/tilesets/SF_Outside_A3.txt new file mode 100644 index 0000000..a2a7417 --- /dev/null +++ b/img/tilesets/SF_Outside_A3.txt @@ -0,0 +1,32 @@ +Roof A (Brick)|屋根A(レンガ) +Roof B (Factory)|屋根B(工場) +Roof C (Metal, Red Rust)|屋根C(金属・赤錆) +Roof D (Barracks)|屋根D(バラック) +Roof E (Barracks)|屋根E(バラック) +Roof F (Barracks)|屋根F(バラック) +Roor G (Ivy)|屋根G(ツタ) +Roof H (House)|屋根H(現代住宅) +Outer Wall A (Stone)|外壁A(石) +Outer Wall B (Factory)|外壁B(工場) +Outer Wall C (Metal, Red Rust)|外壁C(金属・赤錆) +Outer Wall D (Barracks)|外壁D(バラック) +Outer Wall E (Barracks)|外壁E(バラック) +Outer Wall F (Factory)|外壁F(工場) +Outer Wall G (Ivy)|外壁G(ツタ) +Outer Wall H (House)|外壁H(現代住宅) +Roof I (Barracks)|屋根I(バラック) +Roof J (Brick)|屋根J(レンガ) +Roof K (Metal, Patina)|屋根K(金属・緑青錆) +Roof L (Chinese)|屋根L(中華風) +Roof M (Blue Sheet)|屋根M(ブルーシート) +Roof N (Wood)|屋根N(木造) +Roof O (Brick)|屋根O(レンガ) +Roof P (Wood)|屋根P(木造) +Outer Wall I (Tile)|外壁I(タイル) +Outer Wall J (Brick)|外壁J(レンガ) +Outer Wall K (Mortar)|外壁K(モルタル) +Outer Wall L (Chinese)|外壁L(中華風) +Outer Wall M (Blue Sheet)|外壁M(ブルーシート) +Outer Wall N (Wood)|外壁N(木造) +Outer Wall O (Brick)|外壁O(レンガ) +Outer Wall P (Wood)|外壁P(木造) diff --git a/img/tilesets/SF_Outside_A4.png b/img/tilesets/SF_Outside_A4.png new file mode 100644 index 0000000..18f3c9d Binary files /dev/null and b/img/tilesets/SF_Outside_A4.png differ diff --git a/img/tilesets/SF_Outside_A4.txt b/img/tilesets/SF_Outside_A4.txt new file mode 100644 index 0000000..7d4b9f9 --- /dev/null +++ b/img/tilesets/SF_Outside_A4.txt @@ -0,0 +1,48 @@ +Wall A (Concrete)|壁A(コンクリート) +Wall B (Concrete, Dirty)|壁B(コンクリート・汚れ) +Wall C (Block)|壁C(ブロック) +Wall D (Apartment)|壁D(マンション) +Wall E (Apartment)|壁E(マンション) +Wall F (Metal)|壁F(金属) +Wall G (Metal, Red Rust)|壁G(金属・赤錆) +Wall H (Metal, Patina)|壁H(金属・緑青錆) +Wall A (Concrete)|壁A(コンクリート) +Wall B (Concrete, Dirty)|壁B(コンクリート・汚れ) +Wall C (Block)|壁C(ブロック) +Wall D (Apartment)|壁D(マンション) +Wall E (Apartment)|壁E(マンション) +Wall F (Metal)|壁F(金属) +Wall G (Metal, Red Rust)|壁G(金属・赤錆) +Wall H (Metal, Patina)|壁H(金属・緑青錆) +Wall I (Barracks)|壁I(バラック) +Wall J (Barracks)|壁J(バラック) +Wall K (Factory)|壁K(工場) +Cliff A (Demonic Ground)|崖A(魔界の地面) +Wall L (Factory)|壁L(工場) +Wall M (Factory)|壁M(工場) +Wall N (Building)|壁N(ビル) +Wall O (Brick)|壁O(レンガ) +Wall I (Barracks)|壁I(バラック) +Wall J (Barracks)|壁J(バラック) +Wall K (Factory)|壁K(工場) +Cliff A (Demonic Ground)|崖A(魔界の地面) +Wall L (Factory)|壁L(工場) +Wall M (Factory)|壁M(工場) +Wall N (Building)|壁N(ビル) +Wall O (Brick)|壁O(レンガ) +Wall P (Chinese)|壁P(中華風) +Wall Q (Wire Mesh)|壁Q(金網) +Wall R (Wire Mesh, Red Rust)|壁R(金網・赤錆) +Wall S (Wire Mesh, Patina)|壁S(金網・緑青錆) +Wall T (Wood)|壁T(木造) +Wall U (Wood, Dirty)|壁U(木造・汚れ) +Wall V (Building)|壁V(ビル) +Wall W (Building)|壁W(ビル) +Wall P (Chinese)|壁P(中華風) +Wall Q (Wire Mesh)|壁Q(金網) +Wall R (Wire Mesh, Red Rust)|壁R(金網・赤錆) +Wall S (Wire Mesh, Patina)|壁S(金網・緑青錆) +Wall T (Wood)|壁T(木造) +Wall U (Wood, Dirty)|壁U(木造・汚れ) +Wall V (Building)|壁V(ビル) +Wall W (Building)|壁W(ビル) diff --git a/img/tilesets/SF_Outside_A5.png b/img/tilesets/SF_Outside_A5.png new file mode 100644 index 0000000..e84ea1b Binary files /dev/null and b/img/tilesets/SF_Outside_A5.png differ diff --git a/img/tilesets/SF_Outside_A5.txt b/img/tilesets/SF_Outside_A5.txt new file mode 100644 index 0000000..32f87cb --- /dev/null +++ b/img/tilesets/SF_Outside_A5.txt @@ -0,0 +1,128 @@ +Darkness|暗闇 +Grid floor|格子床 +Metal Bridge (V, Left)|金属橋(縦・左) +Metal Bridge (V, Center)|金属橋(縦・中央) +Metal Bridge (V, Right)|金属橋(縦・右) +Asphalt Bridge (H, Top)|アスファルト橋(横・上) +Metal Bridge (H, Center)|金属橋(横・中央) +Metal Bridge (H, Top)|金属橋(横・上) +Transparent|透明 +Grid floor|格子床 +Asphalt Bridge (V, Left)|アスファルト橋(縦・左) +Asphalt Bridge (V, Center)|アスファルト橋(縦・中央) +Asphalt Bridge (V, Right)|アスファルト橋(縦・右) +Asphalt Bridge (H, Bottom)|アスファルト橋(横・下) +Asphalt Bridge (H, Center)|アスファルト橋(横・中央) +Metal Bridge (H, Bottom)|金属橋(横・下) +Waste Land|荒地 +Metal Floor A (Factory)|金属床A(工場) +Concrete Floor|コンクリート床 +Concrete Floor (Ruins)|コンクリート床(廃墟) +Hole|穴 +Grid floor (Ruins)|格子床(廃墟) +Asphalt Floor (Ruins)|アスファルト床(廃墟) +Metal Floor A (Factory, Ruins)|金属床A(工場・廃墟) +Waste Land|荒地 +Metal Floor A (Factory)|金属床A(工場) +Concrete Floor|コンクリート床 +Mecha Floor|機械床 +Stairs A (Asphalt, Left)|階段A(アスファルト・左) +Stairs A (Asphalt, Center)|階段A(アスファルト・中央) +Stairs A (Asphalt, Right)|階段A(アスファルト・右) +Stairs A (Asphalt)|階段A(アスファルト) +Dirty Floor|汚れた床 +Dirty Floor (Ruins)|汚れた床(廃墟) +Mecha Floor (Ruins) A|機械床(廃墟)A +Mecha Floor (Ruins) B|機械床(廃墟)B +Asphalt Floor (Dirty)|アスファルト床(汚れ) +Asphalt Floor (Dirty, Ruins)|アスファルト床(汚れ・廃墟) +Wood Floor A|木の床A +Wood Floor A (Ruins)|木の床A(廃墟) +Bumpy Tile A|点字ブロックA +Bumpy Tile B|点字ブロックB +Bumpy Tile C|点字ブロックC +Bumpy Tile C (Ruins)|点字ブロックC(廃墟) +Stairs B (Metal, Left)|階段B(金属・左) +Stairs B (Metal, Center)|階段B(金属・中央) +Stairs B (Metal, Right)|階段B(金属・右) +Stairs B (Metal)|階段B(金属) +Interior Floor A (Green Resin)|内装床A(緑樹脂) +Interior Floor B (Tile)|内装床B(タイル) +Interior Floor B (Tile, Ruins)|内装床B(タイル・廃墟) +Interior Floor C (Decoration)|内装床C(装飾) +Interior Floor D (Decoration)|内装床D(装飾) +Interior Floor E (Decoration)|内装床E(装飾) +Wood Floor B|木の床B +Wood Floor B (Ruins)|木の床B(廃墟) +Stairs C (Meadow, Left)|階段C(草地・左) +Stairs C (Meadow, Center)|階段C(草地・中央) +Stairs C (Meadow, Right)|階段C(草地・右) +Stairs C (Meadow)|階段C(草地) +Stairs D (Wood, Left)|階段D(木製・左) +Stairs D (Wood, Center)|階段D(木製・中央) +Stairs D (Wood, Right)|階段D(木製・右) +Stairs D (Wood)|階段D(木製) +Cobblestones A|石畳A +Cobblestones B|石畳B +Cobblestones C|石畳C +Cobblestones D|石畳D +Metal Floor B|金属床B +Metal Floor B (Rust, Ruins)|金属床B(サビ・廃墟) +Metal Floor C|金属床C +Metal Floor C (Rust, Ruins)|金属床C(サビ・廃墟) +Stairs E (Carpet, Left)|階段E(じゅうたん・左) +Stairs E (Carpet, Center)|階段E(じゅうたん・中央) +Stairs E (Carpet, Right)|階段E(じゅうたん・右) +Stairs E (Carpet)|階段E(じゅうたん) +Stairs F (Desert, Left)|階段F(砂地・左) +Stairs F (Desert, Center)|階段F(砂地・中央) +Stairs F (Desert, Right)|階段F(砂地・右) +Stairs F (Desert)|階段F(砂地) +Mark Floor A|マーク床A +Mark Floor B|マーク床B +Mark Floor C|マーク床C +Mark Floor D|マーク床D +Mark Floor E|マーク床E +Mark Floor E (Ruins)|マーク床E(廃墟) +Mark Floor F (Off)|マーク床F(消) +Mark Floor F|マーク床F +Neon Floor|ネオン床 +Interior Floor F (Tile Carpet)|内装床F(タイルカーペット) +Interior Floor F (Tile Carpet, Ruins)|内装床F(タイルカーペット・廃墟) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Marble Floor|大理石床 +Interior Floor G (Linoleum)|内装床G(リノリウム) +Interior Floor G (Linoleum, Ruins)|内装床G(リノリウム・廃墟) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Stairs G (Tile Carpet, Left)|階段G(タイルカーペット・左) +Stairs G (Tile Carpet, Center)|階段G(タイルカーペット・中央) +Stairs G (Tile Carpet, Right)|階段G(タイルカーペット・右) +Stairs G (Tile Carpet)|階段G(タイルカーペット) +Cobblestones E|石畳E +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Ledge (Demonic Ground)|段差(魔界の地面) +Stairs H (Linoleum, Left)|階段H(リノリウム・左) +Stairs H (Linoleum, Center)|階段H(リノリウム・中央) +Stairs H (Linoleum, Right)|階段H(リノリウム・右) +Stairs H (Linoleum)|階段H(リノリウム) +Cobblestones F|石畳F +Cliff (Demonic Ground)|崖(魔界の地面) +Cliff (Demonic Ground)|崖(魔界の地面) +Cliff (Demonic Ground)|崖(魔界の地面) +Marble Floor (Ruins)|大理石床(廃墟) +Wood Floor C|木の床C +Wood Floor C (Ruins)|木の床C(廃墟) +Metal Floor D (Machine)|金属床D(機械) +Metal Floor D (Machine, Ruins)|金属床D(機械・廃墟) +Cliff (Demonic Ground)|崖(魔界の地面) +Cliff (Demonic Ground)|崖(魔界の地面) +Cliff (Demonic Ground)|崖(魔界の地面) diff --git a/img/tilesets/SF_Outside_B.png b/img/tilesets/SF_Outside_B.png new file mode 100644 index 0000000..5cc3745 Binary files /dev/null and b/img/tilesets/SF_Outside_B.png differ diff --git a/img/tilesets/SF_Outside_B.txt b/img/tilesets/SF_Outside_B.txt new file mode 100644 index 0000000..6bcb07b --- /dev/null +++ b/img/tilesets/SF_Outside_B.txt @@ -0,0 +1,256 @@ +Transparent|透明 +Neon Shop Sign (Weapon)|ネオン看板(武器屋) +Neon Shop Sign (Armor)|ネオン看板(防具屋) +Neon Shop Sign (Item)|ネオン看板(アイテム屋) +Neon Shop Sign (Pharmacy)|ネオン看板(薬屋) +Neon Shop Sign (Cafe)|ネオン看板(酒場) +Neon Shop Sign (Inn)|ネオン看板(宿屋) +Neon Shop Sign (Market)|ネオン看板(マーケット) +Metal Shop Sign (Weapon)|金属看板(武器屋) +Metal Shop Sign (Armor)|金属看板(防具屋) +Metal Shop Sign (Item)|金属看板(アイテム屋) +Metal Shop Sign (Pharmacy)|金属看板(薬屋) +Metal Shop Sign (Cafe)|金属看板(酒場) +Metal Shop Sign (Inn)|金属看板(宿屋) +Metal Shop Sign (Firearm)|金属看板(銃器屋) +Metal Shop Sign (Blank)|金属看板(無地) +Asphalt Bridge (V)|アスファルトの橋(縦) +Asphalt Bridge (H)|アスファルトの橋(横) +Stone Bridge (V)|石の橋(縦) +Stone Bridge (H)|石の橋(横) +Metal Bridge A (V)|金属の橋A(縦) +Metal Bridge A (H)|金属の橋A(横) +Metal Bridge B (V)|金属の橋B(縦) +Metal Bridge B (H)|金属の橋B(横) +Bridge Spar A (Asphalt, Center A)|橋げたA(アスファルト・中央A) +Bridge Spar A (Asphalt, Left)|橋げたA(アスファルト・左) +Bridge Spar A (Asphalt, Center B)|橋げたA(アスファルト・中央B) +Bridge Spar A (Asphalt, Right)|橋げたA(アスファルト・右) +Bridge Spar B (Metal, Center A)|橋げたB(金属・中央A) +Bridge Spar B (Metal, Left)|橋げたB(金属・左) +Bridge Spar B (Metal, Center B)|橋げたB(金属・中央B) +Bridge Spar B (Metal, Right)|橋げたB(金属・右) +White Line|白線 +White Line|白線 +White Line|白線 +White Line|白線 +White Line|白線 +Red & Black Line|赤黒線 +Red & Black Line|赤黒線 +Red & Black Line|赤黒線 +White Line|白線 +Traffic Lights (Car)|信号機(車) +Traffic Lights (Pedestrian)|信号機(歩行者) +Entrance A|入口A +White Line (Crosswalk)|白線(横断歩道) +Red & Black Line|赤黒線 +Traffic Cone|通行止めコーン +Red & Black Line|赤黒線 +White Line|白線 +Traffic Lights (Car)|信号機(車) +Traffic Lights (Pedestrian)|信号機(歩行者) +Entrance B|入口B +White Line|白線 +Red & Black Line|赤黒線 +Red & Black Line|赤黒線 +Red & Black Line|赤黒線 +Window A|窓A +Window B|窓B +Window C|窓C +Window D|窓D +Window E|窓E +Window F|窓F +Window G|窓G +Window H|窓H +Midsize Window A|中型窓A +Midsize Window B|中型窓B +Midsize Window C|中型窓C +Midsize Window D|中型窓D +Midsize Window E|中型窓E +Midsize Window F|中型窓F +Midsize Window G|中型窓G +Midsize Window H|中型窓H +Midsize Window A|中型窓A +Midsize Window B|中型窓B +Midsize Window C|中型窓C +Midsize Window D|中型窓D +Midsize Window E|中型窓E +Midsize Window F|中型窓F +Midsize Window G|中型窓G +Midsize Window H|中型窓H +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (H)|ネオン看板(横) +Neon Shop Sign (H)|ネオン看板(横) +Street Light A|街灯A +Street Light B|街灯B +Stained Glass Window|ステンドグラス +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (H)|ネオン看板(横) +Neon Shop Sign (H)|ネオン看板(横) +Street Light A|街灯A +Street Light B|街灯B +Stained Glass Window|ステンドグラス +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (V)|ネオン看板(縦) +Neon Shop Sign (H)|ネオン看板(横) +Neon Shop Sign (H)|ネオン看板(横) +Stacked Crates|積まれた木箱 +Shipping Container|コンテナ +Stacked Cardboard|積まれたダンボール +Chimney A|煙突A +Chimney B|煙突B +Chimney C|煙突C +Exhaust Port Wall|壁面用排気口 +Roof Window|屋根用出窓 +Stacked Crates|積まれた木箱 +Shipping Container|コンテナ +Stacked Cardboard|積まれたダンボール +Wall Poster|張り紙 +Signboard A|看板A +Signboard B|看板B +Digital Signage A|電子看板A +Digital Signage C|電子看板C +Neon Shop Sign (CASINO)|ネオン看板(カジノ) +Neon Shop Sign (CASINO)|ネオン看板(カジノ) +Small Crane|小型クレーン +Poster|ポスター +Signboard C|看板C +Digital Signage B|電子看板B +Digital Signage B|電子看板B +Digital Signage C|電子看板C +Iron Materials|鉄資材 +Helmet|ヘルメット +Small Crane|小型クレーン +Crate|木箱 +Shipping Container|コンテナ +Cardboard Box|ダンボール +Barrel|樽 +Oil Drum|ドラム缶 +Garbage Can|ゴミ箱 +Sorted Waste Bins|分別ゴミ箱 +Sorted Waste Bins|分別ゴミ箱 +Plant A|植物A +Plant B|植物B +Plant C|植物C +Vending Machine|自動販売機 +ATM|ATM +Tree|木 +Roadside Tree|街路樹 +Utility Pole|電柱 +Plant A|植物A +Plant B|植物B +Plant C|植物C +Vending Machine|自動販売機 +ATM|ATM +Tree|木 +Avenue Tree|街路樹 +Utility Pole|電柱 +Public Phone|公衆電話 +Machine Device|機械端末 +Planter (Plant)|プランター(植物) +Planter (Potted Plant)|プランター(盆栽) +Potted Plant|植木鉢 +Tree (Loop)|木(ループ) +Tombstone (Cross)|墓石(十字架) +Tombstone (Plaque)|墓石(プレート) +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Machine A|機械A +Machine B|機械B +Machine C|機械C +Barricade (No Entry)|バリケード(通行禁止) +Bar (No Entry)|バー(通行禁止) +Bar (No Entry)|バー(通行禁止) +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Outdoor Air Intake Unit|室外機 +Waste|廃棄物 +Scrap Metal|スクラップ +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Neon Tube|ネオン管 +Neon Tube|ネオン管 +Air Vent A|通風口A +Air Vent B|通風口B +Shutter|シャッター +Fissures A|亀裂A +Fissures B|亀裂B +Fissures C|亀裂C +Drain|排水口 +Guardrail|ガードレール +Timetable|時刻表 +Piled Up Tires|積まれたタイヤ +Small Fuel Tank|小型燃料タンク +Car (Red)|車(赤) +Car (Red)|車(赤) +Manhole|マンホール +Bus|バス +Bus|バス +Truck|トラック +Truck|トラック +Wrecked Car|壊れた車 +Car (Black)|車(黒) +Car (Black)|車(黒) +Vent|通気口 +Bus|バス +Bus|バス +Truck|トラック +Truck|トラック +Wrecked Car|壊れた車 +Car (Blue)|車(青) +Car (Blue)|車(青) +Oil Drum (Leak)|ドラム缶(液漏れ) +Food Stalls|露店(食べ物) +Food Stalls|露店(食べ物) +Food Stalls|露店(食べ物) +Stall Goods A|露店商品A +Stairs A (Up)|階段A(上り) +Stairs B (Up)|階段B(上り) +Stairs C (Down)|階段C(下り) +Stairs D (Down)|階段D(下り) +Food Stalls|露店(食べ物) +Food Stalls|露店(食べ物) +Food Stalls|露店(食べ物) +Stall Goods B|露店商品B +Stairs C (Up)|階段C(上り) +Stairs D (Up)|階段D(上り) +Stairs A (Down)|階段A(下り) +Stairs B (Down)|階段B(下り) +Food Stalls|露店(食べ物) +Food Stalls|露店(食べ物) +Food Stalls|露店(食べ物) +Stall Goods C|露店商品C +Metal Ladder|鉄ばしご +Metal Stairs|金属階段 +Rope|ロープ +Net|ネット +Junk Stalls|露店(ジャンク) +Junk Stalls|露店(ジャンク) +Junk Stalls|露店(ジャンク) +Stall Goods D|露店商品D +Metal Ladder|鉄ばしご +Metal Stairs|金属階段 +Rope|ロープ +Net|ネット +Junk Stalls|露店(ジャンク) +Junk Stalls|露店(ジャンク) +Junk Stalls|露店(ジャンク) +Stall Goods E|露店商品E +Metal Ladder|鉄ばしご +Metal Stairs|金属階段 +Rope|ロープ +Net|ネット +Junk Stalls|露店(ジャンク) +Junk Stalls|露店(ジャンク) +Junk Stalls|露店(ジャンク) +Stall Goods F|露店商品F +Hole A (Metal Ladder)|穴A(鉄ばしご) +Hole B (Metal Stairs)|穴B(金属階段) +Hole C (Rope)|穴C(ロープ) +Hole|穴 diff --git a/img/tilesets/SF_Outside_C.png b/img/tilesets/SF_Outside_C.png new file mode 100644 index 0000000..5220e01 Binary files /dev/null and b/img/tilesets/SF_Outside_C.png differ diff --git a/img/tilesets/SF_Outside_C.txt b/img/tilesets/SF_Outside_C.txt new file mode 100644 index 0000000..90a0cbe --- /dev/null +++ b/img/tilesets/SF_Outside_C.txt @@ -0,0 +1,256 @@ +Fountain A|噴水A +Fountain A|噴水A +Fountain B|噴水B +Fountain B|噴水B +Slide|滑り台 +Slide|滑り台 +Exercise Bar|鉄棒 +Drinking Fountain|水飲み場 +Fountain A|噴水A +Fountain A|噴水A +Fountain B|噴水B +Fountain B|噴水B +Slide|滑り台 +Slide|滑り台 +Water Well Pump|ポンプ井戸 +Garbage Dumpster|ごみ収集箱 +Fountain C|噴水C +Fountain C|噴水C +Fountain C|噴水C +Bench A|ベンチA +Bench A|ベンチA +Swing|ブランコ +Shop Canopy|店用天蓋 +Barbed Wire|有刺鉄線 +Fountain C|噴水C +Fountain C|噴水C +Fountain C|噴水C +Bench B|ベンチB +Bench B|ベンチB +Swing|ブランコ +Shop Canopy|店用天蓋 +Barbed Wire|有刺鉄線 +Grass A|草A +Grass B|草B +Hole|穴 +Small Stones|小石 +Flower Bed|花壇 +Flower Bed|花壇 +Flower Bed|花壇 +Barbed Wire|有刺鉄線 +Flower|花 +Cage|檻 +Cage|檻 +Graffiti|落書き +Graffiti|落書き +Barbed Wire|有刺鉄線 +Barbed Wire|有刺鉄線 +Barbed Wire|有刺鉄線 +Demon Statue|悪魔像 +Goddess Statue|女神像 +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Gutter|側溝 +Gutter|側溝 +Gutter|側溝 +Demon Statue|悪魔像 +Goddess Statue|女神像 +Metal Fence|金属フェンス +Warning Plate|警告プレート +Metal Fence|金属フェンス +Gutter|側溝 +Postal Box|ポスト +Gutter|側溝 +Soldier Statue|兵士像 +Warning Plate (Biohazard Mark)|警告プレート(バイオハザードマーク) +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Metal Fence|金属フェンス +Gutter|側溝 +Gutter|側溝 +Gutter|側溝 +Soldier Statue|兵士像 +Pillar A (Asphalt)|柱A(アスファルト) +Pillar B (Metal)|柱B(金属) +Pillar C (Machine)|柱C(機械) +Pillar D (Decoration)|柱D(装飾) +Pillar E (Metal)|柱E(金属) +Pillar F (Brick)|柱F(レンガ) +Food Waste|生ゴミ +Warning Plate|警告プレート +Pillar A (Asphalt)|柱A(アスファルト) +Pillar B (Metal)|柱B(金属) +Pillar C (Machine)|柱C(機械) +Pillar D (Decoration)|柱D(装飾) +Pillar E (Metal)|柱E(金属) +Pillar F (Brick)|柱F(レンガ) +Mysterious Liquid|謎の液体 +Warning Plate|警告プレート +Broken Pillar A (Asphalt)|折れた柱A(アスファルト) +Broken Pillar B (Metal)|折れた柱B(金属) +Broken Pillar C (Machine)|折れた柱C(機械) +Broken Pillar D (Decoration)|折れた柱D(装飾) +Broken Pillar E (Metal)|折れた柱E(金属) +Broken Pillar F (Brick)|折れた柱F(レンガ) +Fire Hydrant|消火栓 +Monument A|モニュメントA +Monument B|モニュメントB +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Iron Monument|巨大プレート +Huge Iron Monument|巨大プレート +Huge Iron Monument|巨大プレート +Monument A|モニュメントA +Monument B|モニュメントB +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Stele|巨大な石版 +Huge Iron Monument|巨大プレート +Huge Iron Monument|巨大プレート +Huge Iron Monument|巨大プレート +Monument C|モニュメントC +Monument D|モニュメントD +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Large Machine|大型機械 +Large Machine|大型機械 +Large Machine|大型機械 +Monument C|モニュメントC +Control Panel|コントロールパネル +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Sphere Machinery|球体機械 +Large Machine|大型機械 +Large Machine|大型機械 +Large Machine|大型機械 +Wall A|壁A +Wall A|壁A +Wall A|壁A +Decorative Pillar A|装飾柱A +Arch A|門A +Arch A|門A +Arch A|門A +Decorative Pillar B|装飾柱B +Wall A|壁A +Wall A|壁A +Wall A|壁A +Decorative Pillar A|装飾柱A +Arch A|門A +Arch A|門A +Arch A|門A +Decorative Pillar B|装飾柱B +Wall A|壁A +Wall A|壁A +Wall A|壁A +Decorative Pillar A|装飾柱A +Arch A|門A +Arch A|門A +Arch A|門A +Decorative Pillar B|装飾柱B +Wall B (Topside)|壁B(上面) +Wall B (Topside)|壁B(上面) +Wall B (Topside)|壁B(上面) +Spire|尖塔 +Clock Tower|時計塔 +Clock Tower|時計塔 +Clock Tower|時計塔 +Wall A Ceiling|壁A天井 +Wall B (Topside)|壁B(上面) +Wall B (Topside)|壁B(上面) +Wall B (Topside)|壁B(上面) +Spire|尖塔 +Clock Tower|時計塔 +Clock Tower|時計塔 +Clock Tower|時計塔 +Decorative Pillar A (Front)|装飾柱A(手前) +Wall B (Topside)|壁B(上面) +Wall B (Topside)|壁B(上面) +Wall B (Topside)|壁B(上面) +Spire|尖塔 +Clock Tower|時計塔 +Clock Tower|時計塔 +Clock Tower|時計塔 +Decorative Pillar B (Front)|装飾柱B(手前) +Wall B|壁B +Wall B|壁B +Wall B|壁B +Spire|尖塔 +Arch B|門B +Arch B|門B +Arch B|門B +Iron Fence B|鉄柵B +Wall B|壁B +Wall B|壁B +Wall B|壁B +Spire|尖塔 +Arch B|門B +Arch B|門B +Arch B|門B +Gate|門扉 +Wall B|壁B +Wall B|壁B +Wall B|壁B +Spire|尖塔 +Arch B|門B +Arch B|門B +Arch B|門B +Gate|門扉 +Rooftop Railing|屋上用手すり +Rooftop Railing|屋上用手すり +Rooftop Railing|屋上用手すり +Iron Fence A|鉄柵A +Tank|戦車 +Tank|戦車 +Helicopter|ヘリコプター +Helicopter|ヘリコプター +Rooftop Railing|屋上用手すり +Round Clock|丸時計 +Rooftop Railing|屋上用手すり +Iron Fence A|鉄柵A +Tank|戦車 +Tank|戦車 +Helicopter|ヘリコプター +Helicopter|ヘリコプター +Rooftop Railing|屋上用手すり +Rooftop Railing|屋上用手すり +Rooftop Railing|屋上用手すり +Iron Fence A|鉄柵A +Rooftop Billboard B|屋上看板B +Rooftop Billboard B|屋上看板B +Food Cart|屋台 +Food Cart|屋台 +Convenience Store|コンビニエンスストア +Convenience Store|コンビニエンスストア +Convenience Store|コンビニエンスストア +Steel Tower|鉄塔 +Rooftop Billboard A|屋上看板A +Roof|屋根 +Roof|屋根 +Roof|屋根 +Convenience Store|コンビニエンスストア +Convenience Store|コンビニエンスストア +Convenience Store|コンビニエンスストア +Steel Tower|鉄塔 +Water Storage Tank|貯水タンク +Roof|屋根 +Roof|屋根 +Roof|屋根 +Bus Waiting Area|待合所 +Bus Waiting Area|待合所 +Station Kiosk|駅の売店 +Steel Tower|鉄塔 +Water Storage Tank|貯水タンク +Roof|屋根 +Roof|屋根 +Roof|屋根 +Bus Waiting Area|待合所 +Bus Waiting Area|待合所 +Station Kiosk|駅の売店 +Roof Detail|屋根飾り +Roof|屋根 +Roof|屋根 +Roof|屋根 +Roof|屋根 diff --git a/img/tilesets/World_A1.png b/img/tilesets/World_A1.png new file mode 100644 index 0000000..f39b4d6 Binary files /dev/null and b/img/tilesets/World_A1.png differ diff --git a/img/tilesets/World_A1.txt b/img/tilesets/World_A1.txt new file mode 100644 index 0000000..9055912 --- /dev/null +++ b/img/tilesets/World_A1.txt @@ -0,0 +1,16 @@ +Sea|海 +Deep Sea|深い海 +Rock Shoal|岩礁 +Icebergs|氷山 +Poison Swamp|毒の沼 +Dead Trees|枯れ木 +Lava|溶岩 +Lava Bubbles|溶岩の泡 +Pond|池 +Boulder|岩 +Frozen Sea|凍った海 +Whirlpool|渦 +Land's End|大地の境界 +Endless Waterfall|下界に落ちる滝 +Cloud (Land's End)|雲(大地の境界) +Cloud|雲 diff --git a/img/tilesets/World_A2.png b/img/tilesets/World_A2.png new file mode 100644 index 0000000..4e9ff07 Binary files /dev/null and b/img/tilesets/World_A2.png differ diff --git a/img/tilesets/World_A2.txt b/img/tilesets/World_A2.txt new file mode 100644 index 0000000..fc9cbf5 --- /dev/null +++ b/img/tilesets/World_A2.txt @@ -0,0 +1,32 @@ +Grassland A|草原A +Grassland A (Dark)|草原A(濃) +Grassland B|草原B +Grassland B (Dark)|草原B(濃) +Forest|森 +Forest (Conifer)|森(針葉樹) +Mountain (Grass)|山(草) +Mountain (Dirt)|山(土) +Wasteland A|荒れ地A +Wasteland B|荒れ地B +Dirt Field A|土肌A +Dirt Field B|土肌B +Forest (Dead Trees)|森(枯れ木) +Road (Dirt)|道(土) +Hill (Dirt)|丘(土) +Mountain (Sandstone)|山(砂岩) +Desert A|砂漠A +Desert B|砂漠B +Rocky Land A|岩地A +Rocky Land B (Lava)|岩地B(溶岩) +Forest (Palm Trees)|森(ヤシの木) +Road (Paved)|道(舗装) +Mountain (Rock)|山(岩) +Mountain (Lava)|山(溶岩) +Snowfield|雪原 +Mountain (Snow)|山(雪) +Clouds|雲 +Large Clouds|大きな雲 +Forest (Snow)|森(雪) +Pit|穴 +Hill (Sandstone)|丘(砂岩) +Hill (Snow)|丘(雪) diff --git a/img/tilesets/World_B.png b/img/tilesets/World_B.png new file mode 100644 index 0000000..484e86e Binary files /dev/null and b/img/tilesets/World_B.png differ diff --git a/img/tilesets/World_B.txt b/img/tilesets/World_B.txt new file mode 100644 index 0000000..e7674b1 --- /dev/null +++ b/img/tilesets/World_B.txt @@ -0,0 +1,256 @@ +Transparent|透明 +Sign|立て札 +Pier (H)|桟橋(横) +Pier (V)|桟橋(縦) +Pond|池 +Oasis|オアシス +Pond (Ice)|池(氷) +Rainbow|虹 +Tent|テント +Igloo|氷の家 +Pyramid|ピラミッド +Giant Tree|大樹 +Giant Tree (Snow)|大樹(雪) +Dirt|土砂 +Avalanche|雪崩 +Rainbow|虹 +Cave A|洞窟A +Cave B|洞窟B +Cave (Collapsed)|洞窟(土砂崩れ) +Mine|坑道 +Tunnel|トンネル +Tunnel (Blocked)|トンネル(通行止め) +Shrine|ほこら +Shrine (Snow)|ほこら(雪) +Bridge (H)|橋(横) +Bridge (V)|橋(縦) +Collapsed Bridge (H)|崩れた橋(横) +Collapsed Bridge (V)|崩れた橋(縦) +Snow Bridge (H)|雪の橋(横) +Snow Bridge (V)|雪の橋(縦) +Collapsed Snow Bridge (H)|崩れた雪の橋(横) +Collapsed Snow Bridge (V)|崩れた雪の橋(縦) +Castle A|城A +Castle A|城A +Castle B|城B +Castle B|城B +Fort A|砦A +Fort A|砦A +Fort B|砦B +Fort B|砦B +Castle A|城A +Castle A|城A +Castle B|城B +Castle B|城B +Fort A|砦A +Fort A|砦A +Fort B|砦B +Fort B|砦B +Castle C|城C +Castle C|城C +Castle D|城D +Castle D|城D +Castle (Ruins)|城(廃墟) +Castle (Ruins)|城(廃墟) +Fort (Ruins)|砦(廃墟) +Fort (Ruins)|砦(廃墟) +Castle C|城C +Castle C|城C +Castle D|城D +Castle D|城D +Castle (Ruins)|城(廃墟) +Castle (Ruins)|城(廃墟) +Fort (Ruins)|砦(廃墟) +Fort (Ruins)|砦(廃墟) +Castle A, B (Snow)|城A・B(雪) +Castle A, B (Snow)|城A・B(雪) +Castle C, D (Snow)|城C・D(雪) +Castle C, D (Snow)|城C・D(雪) +Fort (Snow)|砦(雪) +Fort (Snow)|砦(雪) +Castle (Ruins, Snow)|城(廃墟・雪) +Castle (Ruins, Snow)|城(廃墟・雪) +Castle A, B (Snow)|城A・B(雪) +Castle A, B (Snow)|城A・B(雪) +Castle C, D (Snow)|城C・D(雪) +Castle C, D (Snow)|城C・D(雪) +Fort (Snow)|砦(雪) +Fort (Snow)|砦(雪) +Castle (Ruins, Snow)|城(廃墟・雪) +Castle (Ruins, Snow)|城(廃墟・雪) +Tower A|塔A +Tower A (Ruins)|塔A(廃墟) +Tower B|塔B +Tower C|塔C +Tower A (Snow)|塔A(雪) +Tower D|塔D +Temple A|神殿A +Temple A (Snow)|神殿A(雪) +Tower A|塔A +Tower A (Ruins)|塔A(廃墟) +Tower B|塔B +Tower C|塔C +Tower A (Snow)|塔A(雪) +Tower D (Ruins)|塔D(廃墟) +Temple B|神殿B +Temple C|神殿C +Fortress City |城塞都市 +Fortress City |城塞都市 +Fortress City (Snow)|城塞都市(雪) +Fortress City (Snow)|城塞都市(雪) +Large Mansion|大きな屋敷 +Large Mansion|大きな屋敷 +School of Magic|魔法学校 +School of Magic|魔法学校 +Fortress City |城塞都市 +Fortress City |城塞都市 +Fortress City (Snow)|城塞都市(雪) +Fortress City (Snow)|城塞都市(雪) +Large Mansion|大きな屋敷 +Large Mansion|大きな屋敷 +School of Magic|魔法学校 +School of Magic|魔法学校 +Town A|町A +Town A|町A +Town B|町B +Town B|町B +Village A|村A +Village A|村A +Village B|村B +Village B|村B +Town C|町C +House (Town)|家(町) +Village C|村C +House (Village)|家(村) +Town C (Snow)|町C(雪) +House (Town, Snow)|家(町・雪) +Village C (Snow)|村C(雪) +House (Village, Snow)|家(村・雪) +Town A (Snow)|町A(雪) +Town A (Snow)|町A(雪) +Town B (Snow)|町B(雪) +Town B (Snow)|町B(雪) +Village A (Snow)|村A(雪) +Village A (Snow)|村A(雪) +Village B (Snow)|村B(雪) +Village B (Snow)|村B(雪) +Town D (Desert)|町D(砂漠) +Town D (Desert)|町D(砂漠) +Town E (Desert)|町E(砂漠) +Town E (Desert)|町E(砂漠) +Town F (Desert)|町F(砂漠) +Large Tent|大きなテント +House (Desert)|家(砂漠) +Pit House|竪穴式住居 +Castle (Walled)|城(城壁) +Castle (Walled)|城(城壁) +Castle (Walled)|城(城壁) +Demon Castle|魔王城 +Demon Castle|魔王城 +Cursed Castle|呪われた城 +Cursed Castle|呪われた城 +Town C (Ruins)|町C(廃墟) +Castle (Walled)|城(城壁) +Castle (Walled)|城(城壁) +Castle (Walled)|城(城壁) +Demon Castle|魔王城 +Demon Castle|魔王城 +Cursed Castle|呪われた城 +Cursed Castle|呪われた城 +Town F (Ruins)|町F(廃墟) +Castle (Walled)|城(城壁) +Castle (Walled)|城(城壁) +Castle (Walled)|城(城壁) +Town A (Ruins)|町A(廃墟) +Town A (Ruins)|町A(廃墟) +Village A (Ruins)|村A(廃墟) +Village A (Ruins)|村A(廃墟) +House (Ruins)|家(廃墟) +Castle Wall (Ruins A)|城壁(廃墟A) +Castle Wall (Ruins B)|城壁(廃墟B) +Castle Wall (Ruins C)|城壁(廃墟C) +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall (Gate)|城壁(城門) +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Castle Wall|城壁 +Lookout Post|やぐら +Crater|クレーター +Trail|山道 +Rock Mountain|岩山 +Rock Mountain|岩山 +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Snow)|岩山(雪) +Rock Mountain (Snow)|岩山(雪) +Volcano Crater (Lava)|火口(溶岩) +Volcano Crater (Lava)|火口(溶岩) +Rock Mountain|岩山 +Rock Mountain|岩山 +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Snow)|岩山(雪) +Rock Mountain (Snow)|岩山(雪) +Volcano Crater|火口 +Volcano Crater|火口 +Rock Mountain|岩山 +Rock Mountain|岩山 +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Snow)|岩山(雪) +Rock Mountain (Snow)|岩山(雪) +Volcano|火山 +Volcano|火山 +Rock Mountain|岩山 +Rock Mountain|岩山 +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Sandstone)|岩山(砂岩) +Rock Mountain (Snow)|岩山(雪) +Rock Mountain (Snow)|岩山(雪) +Floating Continent (Giant Tree)|浮遊大陸(大樹) +Floating Continent (Giant Tree)|浮遊大陸(大樹) +Floating Continent|浮遊大陸 +Floating Continent|浮遊大陸 +Floating Continent (Cloud)|浮遊大陸(雲) +Floating Continent (Cloud)|浮遊大陸(雲) +Cloud Land|雲の大地 +Cloud Land|雲の大地 +Floating Continent (Castle)|浮遊大陸(城) +Floating Continent (Castle)|浮遊大陸(城) +Floating Continent|浮遊大陸 +Floating Continent|浮遊大陸 +Floating Continent (Cloud)|浮遊大陸(雲) +Floating Continent (Cloud)|浮遊大陸(雲) +Cloud Land|雲の大地 +Cloud Land|雲の大地 +Floating Continent (Temple)|浮遊大陸(神殿) +Floating Continent (Temple)|浮遊大陸(神殿) +Floating Continent (Shadow)|浮遊大陸(影) +Floating Continent (Shadow)|浮遊大陸(影) +Cloud Land (Temple)|雲の大地(神殿) +Cloud Land (Temple)|雲の大地(神殿) +Cloud Land (Castle)|雲の大地(城) +Cloud Land (Castle)|雲の大地(城) diff --git a/img/tilesets/World_C.png b/img/tilesets/World_C.png new file mode 100644 index 0000000..f0af34f Binary files /dev/null and b/img/tilesets/World_C.png differ diff --git a/img/tilesets/World_C.txt b/img/tilesets/World_C.txt new file mode 100644 index 0000000..8de6c75 --- /dev/null +++ b/img/tilesets/World_C.txt @@ -0,0 +1,256 @@ +Hole|穴 +Signboard A|看板A +Signboard B|看板B +Signboard C|看板C +Iron Bridge (H)|鉄橋(横) +Iron Bridge (V)|鉄橋(縦) +Reservoir A|貯水池A +Reservoir B|貯水池B +Hut|小屋 +Shanty|掘っ立て小屋 +Signboard D|看板D +Digital Signage A|電子看板A +Digital Signage B|電子看板B +Windmill|風車 +Parabolic Antenna|パラボラアンテナ +Heliport|ヘリポート +Entrance A (Open)|入口A(開) +Entrance A (Closed)|入口A(閉) +Entrance B (Open)|入口B(開) +Entrance B (Closed)|入口B(閉) +Entrance C (Open)|入口C(開) +Entrance C (Closed)|入口C(閉) +Entrance D (Closed)|入口D(閉) +Entrance E (Closed)|入口E(閉) +Road|道路 +Road|道路 +Road Closed|通行止め +Rocky Mountain A|岩山A +Rocky Mountain A|岩山A +Rocky Mountain B|岩山B +Rocky Mountain B|岩山B +Rocky Mountain C|岩山C +Road|道路 +Road|道路 +Road|道路 +Rocky Mountain A|岩山A +Rocky Mountain A|岩山A +Rocky Mountain B|岩山B +Rocky Mountain B|岩山B +Rocky Mountain C|岩山C +Road|道路 +Road|道路 +Road|道路 +Rocky Mountain A|岩山A +Rocky Mountain A|岩山A +Rocky Mountain B|岩山B +Rocky Mountain B|岩山B +Rocky Mountain D|岩山D +Road|道路 +Road|道路 +Road|道路 +Rocky Mountain A|岩山A +Rocky Mountain A|岩山A +Rocky Mountain B|岩山B +Rocky Mountain B|岩山B +Broken Buildings|壊れたビル街 +Town A|町A +Town B|町B +Slum A|スラム街A +Slum B|スラム街B +Mansion A|邸宅A +Mansion A|邸宅A +Gate A|ゲートA +Gate B|ゲートB +Shopping Area A|商店街A +Shopping Area B|商店街B +Buildings A|ビル街A +Buildings B|ビル街B +Mansion B|邸宅B +Mansion B|邸宅B +Gate C|ゲートC +Gate D|ゲートD +Residential Street|住宅街 +Residential Street|住宅街 +Slum|スラム街 +Slum|スラム街 +School|学校 +School|学校 +Hospital|病院 +Hospital|病院 +Residential Street|住宅街 +Residential Street|住宅街 +Slum|スラム街 +Slum|スラム街 +School|学校 +School|学校 +Hospital|病院 +Hospital|病院 +City A|街A +City A|街A +City B|街B +City B|街B +Residence A|屋敷A +Residence A|屋敷A +Residence B|屋敷B +Residence B|屋敷B +City A|街A +City A|街A +City B|街B +City B|街B +Residence A|屋敷A +Residence A|屋敷A +Residence B|屋敷B +Residence B|屋敷B +Bridge A (V)|橋A(縦) +Bridge A (H)|橋A(横) +Broken Bridge A (V)|壊れた橋A(縦) +Broken Bridge A (H)|壊れた橋A(横) +Bridge B (V)|橋B(縦) +Bridge B (H)|橋B(横) +Broken Bridge B (V)|壊れた橋(縦) +Broken Bridge B (H)|壊れた橋(横) +Building A|ビルA +Building B|ビルB +Building C|ビルC +Building D|ビルD +Apartment|マンション +Apartment Complex|マンション群 +Collapsed Building A|崩壊したビルA +Collapsed Building B|崩壊したビルB +Building A|ビルA +Building B|ビルB +Building C|ビルC +Building D|ビルD +Apartment|マンション +Apartment Complex|マンション群 +Collapsed Building A|崩壊したビルA +Collapsed Building B|崩壊したビルB +Large Town A|大きな町A +Large Town A|大きな町A +Entertainment District A|歓楽街A +Entertainment District A|歓楽街A +Police Station|警察署 +Police Station|警察署 +Island A|島A +Island A|島A +Large Town A|大きな町A +Large Town A|大きな町A +Entertainment District A|歓楽街A +Entertainment District A|歓楽街A +Police Station|警察署 +Police Station|警察署 +Island A|島A +Island A|島A +Large Town B|大きな町B +Large Town B|大きな町B +Entertainment District B|歓楽街B +Entertainment District B|歓楽街B +Museum|博物館 +Museum|博物館 +Island B|島B +Island B|島B +Large Town B|大きな町B +Large Town B|大きな町B +Entertainment District B|歓楽街B +Entertainment District B|歓楽街B +Museum|博物館 +Museum|博物館 +Island B|島B +Island B|島B +Warehouse A|倉庫A +Warehouse A|倉庫A +Factory|工場 +Factory|工場 +Warehouse B|倉庫B +Gantry Crane|ガントリークレーン +Park|公園 +Island C|島C +Warehouse A|倉庫A +Warehouse A|倉庫A +Factory|工場 +Factory|工場 +Warehouse B|倉庫B +Gantry Crane|ガントリークレーン +Statue A|像A +Statue B|像B +Laboratory|研究所 +Laboratory|研究所 +Construction Site|工事現場 +Construction Site|工事現場 +Watchtower|監視塔 +Steel Tower|鉄塔 +Tower A|タワーA +Tower B|タワーB +Laboratory|研究所 +Laboratory|研究所 +Construction Site|工事現場 +Construction Site|工事現場 +Watchtower|監視塔 +Steel Tower|鉄塔 +Tower A|タワーA +Tower B|タワーB +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall (Gate)|外壁(門) +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall (Gate)|外壁(門) +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Outer Wall|外壁 +Theme Park|テーマパーク +Theme Park|テーマパーク +Port|港湾 +Port|港湾 +Military Base|軍事基地 +Military Base|軍事基地 +Dome|ドーム +Dome|ドーム +Theme Park|テーマパーク +Theme Park|テーマパーク +Port|港湾 +Port|港湾 +Military Base|軍事基地 +Military Base|軍事基地 +Dome|ドーム +Dome|ドーム +Lighthouse|灯台 +Broken Lighthouse|壊れた灯台 +Temple|寺院 +Church|教会 +Cemetery A|墓地A +Cemetery B|墓地B +Prison|刑務所 +Prison|刑務所 diff --git a/img/titles1/Beach.png b/img/titles1/Beach.png new file mode 100644 index 0000000..8aca2b4 Binary files /dev/null and b/img/titles1/Beach.png differ diff --git a/img/titles1/Bigtree.png b/img/titles1/Bigtree.png new file mode 100644 index 0000000..a0bfb9c Binary files /dev/null and b/img/titles1/Bigtree.png differ diff --git a/img/titles1/Canyon.png b/img/titles1/Canyon.png new file mode 100644 index 0000000..21a1c4a Binary files /dev/null and b/img/titles1/Canyon.png differ diff --git a/img/titles1/FlyingIsland.png b/img/titles1/FlyingIsland.png new file mode 100644 index 0000000..43dee4d Binary files /dev/null and b/img/titles1/FlyingIsland.png differ diff --git a/img/titles1/Gate.png b/img/titles1/Gate.png new file mode 100644 index 0000000..43944f5 Binary files /dev/null and b/img/titles1/Gate.png differ diff --git a/img/titles1/Gold.png b/img/titles1/Gold.png new file mode 100644 index 0000000..dc2816a Binary files /dev/null and b/img/titles1/Gold.png differ diff --git a/img/titles1/Jungle.png b/img/titles1/Jungle.png new file mode 100644 index 0000000..bba2144 Binary files /dev/null and b/img/titles1/Jungle.png differ diff --git a/img/titles1/Mansion.png b/img/titles1/Mansion.png new file mode 100644 index 0000000..014226c Binary files /dev/null and b/img/titles1/Mansion.png differ diff --git a/img/titles1/Monument.png b/img/titles1/Monument.png new file mode 100644 index 0000000..4e633c7 Binary files /dev/null and b/img/titles1/Monument.png differ diff --git a/img/titles1/Mountain.png b/img/titles1/Mountain.png new file mode 100644 index 0000000..01341f9 Binary files /dev/null and b/img/titles1/Mountain.png differ diff --git a/img/titles1/Night.png b/img/titles1/Night.png new file mode 100644 index 0000000..b9d2f0d Binary files /dev/null and b/img/titles1/Night.png differ diff --git a/img/titles1/Oasis.png b/img/titles1/Oasis.png new file mode 100644 index 0000000..5abea53 Binary files /dev/null and b/img/titles1/Oasis.png differ diff --git a/img/titles1/Ruins.png b/img/titles1/Ruins.png new file mode 100644 index 0000000..93b3f84 Binary files /dev/null and b/img/titles1/Ruins.png differ diff --git a/img/titles1/Sky.png b/img/titles1/Sky.png new file mode 100644 index 0000000..6acbc8a Binary files /dev/null and b/img/titles1/Sky.png differ diff --git a/img/titles1/Snow.png b/img/titles1/Snow.png new file mode 100644 index 0000000..5aa4ba7 Binary files /dev/null and b/img/titles1/Snow.png differ diff --git a/img/titles1/Sword.png b/img/titles1/Sword.png new file mode 100644 index 0000000..9baf773 Binary files /dev/null and b/img/titles1/Sword.png differ diff --git a/img/titles1/Town1.png b/img/titles1/Town1.png new file mode 100644 index 0000000..22289fa Binary files /dev/null and b/img/titles1/Town1.png differ diff --git a/img/titles1/Town2.png b/img/titles1/Town2.png new file mode 100644 index 0000000..604cc8f Binary files /dev/null and b/img/titles1/Town2.png differ diff --git a/img/titles1/Universe.png b/img/titles1/Universe.png new file mode 100644 index 0000000..060ae95 Binary files /dev/null and b/img/titles1/Universe.png differ diff --git a/img/titles1/Wasteland.png b/img/titles1/Wasteland.png new file mode 100644 index 0000000..f25fdd4 Binary files /dev/null and b/img/titles1/Wasteland.png differ diff --git a/img/titles2/Floral.png b/img/titles2/Floral.png new file mode 100644 index 0000000..be10c58 Binary files /dev/null and b/img/titles2/Floral.png differ diff --git a/img/titles2/Medieval.png b/img/titles2/Medieval.png new file mode 100644 index 0000000..0f63d4c Binary files /dev/null and b/img/titles2/Medieval.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..a471280 --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + + + + + Life of a Naomi + + + + + diff --git a/js/libs/effekseer.min.js b/js/libs/effekseer.min.js new file mode 100644 index 0000000..9c7bf3b --- /dev/null +++ b/js/libs/effekseer.min.js @@ -0,0 +1,128 @@ +/*! + * Effekseer for WebGL v1.70b + * https://github.com/effekseer/EffekseerForWebGL + * + * This software is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +var effekseer_native = (function() { + var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; + if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; + return ( +function(effekseer_native) { + effekseer_native = effekseer_native || {}; + +var Module=typeof effekseer_native!=="undefined"?effekseer_native:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);return nodeFS["readFileSync"](filename,binary?null:"utf8")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);quit_=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){arguments_=scriptArgs}else if(typeof arguments!="undefined"){arguments_=arguments}if(typeof quit==="function"){quit_=function(status){quit(status)}}if(typeof print!=="undefined"){if(typeof console==="undefined")console={};console.log=print;console.warn=console.error=typeof printErr!=="undefined"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var STACK_ALIGN=16;function dynamicAlloc(size){var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=Number(type.substr(1));assert(bits%8===0,"getNativeTypeSize invalid bits "+bits+", type "+type);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}function convertJsFunctionToWasm(func,sig){if(typeof WebAssembly.Function==="function"){var typeNames={"i":"i32","j":"i64","f":"f32","d":"f64"};var type={parameters:[],results:sig[0]=="v"?[]:[typeNames[sig[0]]]};for(var i=1;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}var wasmMemory;var wasmTable=new WebAssembly.Table({"initial":1295,"maximum":1295+0,"element":"anyfunc"});var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];assert(func,"Cannot call unknown function "+ident+", make sure it is exported");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={"string":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},"array":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string")return UTF8ToString(ret);if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function UTF16ToString(ptr){var endPtr=ptr;var idx=endPtr>>1;while(HEAP16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder){return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr))}else{var i=0;var str="";while(1){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)return str;++i;str+=String.fromCharCode(codeUnit)}}}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var WASM_PAGE_SIZE=65536;function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var STACK_BASE=5615984,DYNAMIC_BASE=5615984,DYNAMICTOP_PTR=372944;var INITIAL_INITIAL_MEMORY=Module["INITIAL_MEMORY"]||33554432;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_INITIAL_MEMORY/WASM_PAGE_SIZE,"maximum":2147483648/WASM_PAGE_SIZE})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var Math_abs=Math.abs;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_min=Math.min;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;what="abort("+what+"). Build with -s ASSERTIONS=1 for more info.";throw new WebAssembly.RuntimeError(what)}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix="file://";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile="effekseer.core.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(){var info={"env":asmLibraryArg,"wasi_snapshot_preview1":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={343260:function($0,$1){return Module._loadBinary(UTF16ToString($0),$1)!=null},343325:function($0,$1,$2,$3){var buffer=Module._loadBinary(UTF16ToString($0),$3);var memptr=_malloc(buffer.byteLength);HEAP8.set(new Uint8Array(buffer),memptr);setValue($1,memptr,"i32");setValue($2,buffer.byteLength,"i32")},343768:function($0){return Module._loadImage(UTF16ToString($0))!=null},343827:function($0,$1){var binding=GLctx.getParameter(GLctx.TEXTURE_BINDING_2D);var img=Module._loadImage(UTF16ToString($0));GLctx.bindTexture(GLctx.TEXTURE_2D,GL.textures[$1]);var pa=gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);var oldFlipY=gl.getParameter(gl.UNPACK_FLIP_Y_WEBGL);GLctx.pixelStorei(GLctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false);GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL,false);GLctx.texImage2D(GLctx.TEXTURE_2D,0,GLctx.RGBA,GLctx.RGBA,GLctx.UNSIGNED_BYTE,img);if(Module._isPowerOfTwo(img)){GLctx.generateMipmap(GLctx.TEXTURE_2D)}GLctx.pixelStorei(GLctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL,pa);GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL,oldFlipY);GLctx.bindTexture(GLctx.TEXTURE_2D,binding)}};function _emscripten_asm_const_iii(code,sigPtr,argbuf){var args=readAsmConstArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}__ATINIT__.push({func:function(){___wasm_call_ctors()}});function demangle(func){return func}function demangleAll(text){var regex=/\b_Z[\w\d_]+/g;return text.replace(regex,function(x){var y=demangle(x);return x===y?x:y+" ["+x+"]"})}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function ___cxa_allocate_exception(size){return _malloc(size)}function _atexit(func,arg){__ATEXIT__.unshift({func:func,arg:arg})}function ___cxa_atexit(a0,a1){return _atexit(a0,a1)}var ___exception_infos={};var ___exception_last=0;function __ZSt18uncaught_exceptionv(){return __ZSt18uncaught_exceptionv.uncaught_exceptions>0}function ___cxa_throw(ptr,type,destructor){___exception_infos[ptr]={ptr:ptr,adjusted:[ptr],type:type,destructor:destructor,refcount:0,caught:false,rethrown:false};___exception_last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exceptions=1}else{__ZSt18uncaught_exceptionv.uncaught_exceptions++}throw ptr}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}function ___map_file(pathname,size){setErrNo(63);return-1}var PATH={splitPath:function(filename){var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:function(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path==="/")return"/";var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join("/"))},join2:function(l,r){return PATH.normalize(l+"/"+r)}};var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function ___sys_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;return 0}function ___sys_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;return 0}function syscallMunmap(addr,len){if((addr|0)===-1||len===0){return-28}var info=SYSCALLS.mappings[addr];if(!info)return 0;if(len===info.len){SYSCALLS.mappings[addr]=null;if(info.allocated){_free(info.malloc)}}return 0}function ___sys_munmap(addr,len){return syscallMunmap(addr,len)}function ___sys_open(path,flags,varargs){SYSCALLS.varargs=varargs}function _abort(){abort()}function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,Browser.mainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,timeUntilNextTick)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(typeof setImmediate==="undefined"){var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var Browser_setImmediate_messageHandler=function(event){if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",Browser_setImmediate_messageHandler,true);setImmediate=function Browser_emulated_setImmediate(func){setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){if(Module["setImmediates"]===undefined)Module["setImmediates"]=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){setImmediate(Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function(){var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!=="undefined"){_emscripten_get_now=dateNow}else _emscripten_get_now=function(){return performance.now()};function _emscripten_set_main_loop(func,fps,simulateInfiniteLoop,arg,noSetTiming){noExitRuntime=true;assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=func;Browser.mainLoop.arg=arg;var browserIterationFunc;if(typeof arg!=="undefined"){browserIterationFunc=function(){Module["dynCall_vi"](func,arg)}}else{browserIterationFunc=function(){Module["dynCall_v"](func)}}var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;Browser.mainLoop.runner=function Browser_mainLoop_runner(){if(ABORT)return;if(Browser.mainLoop.queue.length>0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}console.log('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();if(thisMainLoopId1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else if(Browser.mainLoop.timingMode==0){Browser.mainLoop.tickStartTime=_emscripten_get_now()}Browser.mainLoop.runIter(browserIterationFunc);if(thisMainLoopId0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;_emscripten_set_main_loop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;Browser.safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===Module["canvas"]||document["mozPointerLockElement"]===Module["canvas"]||document["webkitPointerLockElement"]===Module["canvas"]||document["msPointerLockElement"]===Module["canvas"]}var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||function(){};canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||function(){};canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",function(ev){if(!Browser.pointerLock&&Module["canvas"].requestPointerLock){Module["canvas"].requestPointerLock();ev.preventDefault()}},false)}}},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:1};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!=="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx==="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen:function(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer==="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas==="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullscreen);if(Module["onFullscreen"])Module["onFullscreen"](Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?function(){canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"])}:null)||(canvasContainer["webkitRequestFullScreen"]?function(){canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"])}:null);canvasContainer.requestFullscreen()},exitFullscreen:function(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||function(){};CFS.apply(document,[]);return true},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function(func){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(func);return}var RAF=Browser.fakeRequestAnimationFrame;RAF(func)},safeCallback:function(func){return function(){if(!ABORT)return func.apply(null,arguments)}},allowAsyncCallbacks:true,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=false},resumeAsyncCallbacks:function(){Browser.allowAsyncCallbacks=true;if(Browser.queuedAsyncCallbacks.length>0){var callbacks=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[];callbacks.forEach(function(func){func()})}},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}else{Browser.queuedAsyncCallbacks.push(func)}})},safeSetTimeout:function(func,timeout){noExitRuntime=true;return setTimeout(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}else{Browser.queuedAsyncCallbacks.push(func)}},timeout)},safeSetInterval:function(func,timeout){noExitRuntime=true;return setInterval(function(){if(ABORT)return;if(Browser.allowAsyncCallbacks){func()}},timeout)},getMimetype:function(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:throw"unrecognized mouse wheel delta mode: "+event.deltaMode}break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!=="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!=="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},asyncLoad:function(url,onload,onerror,noRunDep){var dep=!noRunDep?getUniqueRunDependency("al "+url):"";readAsync(url,function(arrayBuffer){assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},function(event){if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags|8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags&~8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h0?AL.freeIds.pop():AL._nextId++},freeIds:[],scheduleContextAudio:function(ctx){if(Browser.mainLoop.timingMode===1&&document["visibilityState"]!="visible"){return}for(var i in ctx.sources){AL.scheduleSourceAudio(ctx.sources[i])}},scheduleSourceAudio:function(src,lookahead){if(Browser.mainLoop.timingMode===1&&document["visibilityState"]!="visible"){return}if(src.state!==4114){return}var currentTime=AL.updateSourceTime(src);var startTime=src.bufStartTime;var startOffset=src.bufOffset;var bufCursor=src.bufsProcessed;for(var i=0;i=src.bufQueue.length){if(src.looping){bufCursor%=src.bufQueue.length}else{break}}var buf=src.bufQueue[bufCursor%src.bufQueue.length];if(buf.length===0){skipCount++;if(skipCount===src.bufQueue.length){break}}else{var audioSrc=src.context.audioCtx.createBufferSource();audioSrc.buffer=buf.audioBuf;audioSrc.playbackRate.value=src.playbackRate;if(buf.audioBuf._loopStart||buf.audioBuf._loopEnd){audioSrc.loopStart=buf.audioBuf._loopStart;audioSrc.loopEnd=buf.audioBuf._loopEnd}var duration=0;if(src.type===4136&&src.looping){duration=Number.POSITIVE_INFINITY;audioSrc.loop=true;if(buf.audioBuf._loopStart){audioSrc.loopStart=buf.audioBuf._loopStart}if(buf.audioBuf._loopEnd){audioSrc.loopEnd=buf.audioBuf._loopEnd}}else{duration=(buf.audioBuf.duration-startOffset)/src.playbackRate}audioSrc._startOffset=startOffset;audioSrc._duration=duration;audioSrc._skipCount=skipCount;skipCount=0;audioSrc.connect(src.gain);if(typeof audioSrc.start!=="undefined"){startTime=Math.max(startTime,src.context.audioCtx.currentTime);audioSrc.start(startTime,startOffset)}else if(typeof audioSrc.noteOn!=="undefined"){startTime=Math.max(startTime,src.context.audioCtx.currentTime);audioSrc.noteOn(startTime)}audioSrc._startTime=startTime;src.audioQueue.push(audioSrc);startTime+=duration}startOffset=0;bufCursor++}},updateSourceTime:function(src){var currentTime=src.context.audioCtx.currentTime;if(src.state!==4114){return currentTime}if(!isFinite(src.bufStartTime)){src.bufStartTime=currentTime-src.bufOffset/src.playbackRate;src.bufOffset=0}var nextStartTime=0;while(src.audioQueue.length){var audioSrc=src.audioQueue[0];src.bufsProcessed+=audioSrc._skipCount;nextStartTime=audioSrc._startTime+audioSrc._duration;if(currentTime=src.bufQueue.length&&!src.looping){AL.setSourceState(src,4116)}else if(src.type===4136&&src.looping){var buf=src.bufQueue[0];if(buf.length===0){src.bufOffset=0}else{var delta=(currentTime-src.bufStartTime)*src.playbackRate;var loopStart=buf.audioBuf._loopStart||0;var loopEnd=buf.audioBuf._loopEnd||buf.audioBuf.duration;if(loopEnd<=loopStart){loopEnd=buf.audioBuf.duration}if(delta0){src.bufStartTime+=Math.floor((currentTime-src.bufStartTime)/srcDuration)*srcDuration}}for(var i=0;i=src.bufQueue.length){if(src.looping){src.bufsProcessed%=src.bufQueue.length}else{AL.setSourceState(src,4116);break}}var buf=src.bufQueue[src.bufsProcessed];if(buf.length>0){nextStartTime=src.bufStartTime+buf.audioBuf.duration/src.playbackRate;if(currentTime1){src.audioQueue.length=1}},stopSourceAudio:function(src){for(var i=0;isrc.bufQueue[src.bufsProcessed].audioBuf.duration){offset-=src.bufQueue[src.bufsProcessed].audiobuf.duration;src.bufsProcessed++}src.bufOffset=offset}if(playing){AL.setSourceState(src,4114)}},getGlobalParam:function(funcname,param){if(!AL.currentCtx){return null}switch(param){case 49152:return AL.currentCtx.dopplerFactor;case 49155:return AL.currentCtx.speedOfSound;case 53248:return AL.currentCtx.distanceModel;default:AL.currentCtx.err=40962;return null}},setGlobalParam:function(funcname,param,value){if(!AL.currentCtx){return}switch(param){case 49152:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}AL.currentCtx.dopplerFactor=value;AL.updateListenerSpace(AL.currentCtx);break;case 49155:if(!Number.isFinite(value)||value<=0){AL.currentCtx.err=40963;return}AL.currentCtx.speedOfSound=value;AL.updateListenerSpace(AL.currentCtx);break;case 53248:switch(value){case 0:case 53249:case 53250:case 53251:case 53252:case 53253:case 53254:AL.currentCtx.distanceModel=value;AL.updateContextGlobal(AL.currentCtx);break;default:AL.currentCtx.err=40963;return}break;default:AL.currentCtx.err=40962;return}},getListenerParam:function(funcname,param){if(!AL.currentCtx){return null}switch(param){case 4100:return AL.currentCtx.listener.position;case 4102:return AL.currentCtx.listener.velocity;case 4111:return AL.currentCtx.listener.direction.concat(AL.currentCtx.listener.up);case 4106:return AL.currentCtx.gain.gain.value;default:AL.currentCtx.err=40962;return null}},setListenerParam:function(funcname,param,value){if(!AL.currentCtx){return}if(value===null){AL.currentCtx.err=40962;return}var listener=AL.currentCtx.listener;switch(param){case 4100:if(!Number.isFinite(value[0])||!Number.isFinite(value[1])||!Number.isFinite(value[2])){AL.currentCtx.err=40963;return}listener.position[0]=value[0];listener.position[1]=value[1];listener.position[2]=value[2];AL.updateListenerSpace(AL.currentCtx);break;case 4102:if(!Number.isFinite(value[0])||!Number.isFinite(value[1])||!Number.isFinite(value[2])){AL.currentCtx.err=40963;return}listener.velocity[0]=value[0];listener.velocity[1]=value[1];listener.velocity[2]=value[2];AL.updateListenerSpace(AL.currentCtx);break;case 4106:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}AL.currentCtx.gain.gain.value=value;break;case 4111:if(!Number.isFinite(value[0])||!Number.isFinite(value[1])||!Number.isFinite(value[2])||!Number.isFinite(value[3])||!Number.isFinite(value[4])||!Number.isFinite(value[5])){AL.currentCtx.err=40963;return}listener.direction[0]=value[0];listener.direction[1]=value[1];listener.direction[2]=value[2];listener.up[0]=value[3];listener.up[1]=value[4];listener.up[2]=value[5];AL.updateListenerSpace(AL.currentCtx);break;default:AL.currentCtx.err=40962;return}},getBufferParam:function(funcname,bufferId,param){if(!AL.currentCtx){return}var buf=AL.buffers[bufferId];if(!buf||bufferId===0){AL.currentCtx.err=40961;return}switch(param){case 8193:return buf.frequency;case 8194:return buf.bytesPerSample*8;case 8195:return buf.channels;case 8196:return buf.length*buf.bytesPerSample*buf.channels;case 8213:if(buf.length===0){return[0,0]}else{return[(buf.audioBuf._loopStart||0)*buf.frequency,(buf.audioBuf._loopEnd||buf.length)*buf.frequency]}default:AL.currentCtx.err=40962;return null}},setBufferParam:function(funcname,bufferId,param,value){if(!AL.currentCtx){return}var buf=AL.buffers[bufferId];if(!buf||bufferId===0){AL.currentCtx.err=40961;return}if(value===null){AL.currentCtx.err=40962;return}switch(param){case 8196:if(value!==0){AL.currentCtx.err=40963;return}break;case 8213:if(value[0]<0||value[0]>buf.length||value[1]<0||value[1]>buf.Length||value[0]>=value[1]){AL.currentCtx.err=40963;return}if(buf.refCount>0){AL.currentCtx.err=40964;return}if(buf.audioBuf){buf.audioBuf._loopStart=value[0]/buf.frequency;buf.audioBuf._loopEnd=value[1]/buf.frequency}break;default:AL.currentCtx.err=40962;return}},getSourceParam:function(funcname,sourceId,param){if(!AL.currentCtx){return null}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return null}switch(param){case 514:return src.relative;case 4097:return src.coneInnerAngle;case 4098:return src.coneOuterAngle;case 4099:return src.pitch;case 4100:return src.position;case 4101:return src.direction;case 4102:return src.velocity;case 4103:return src.looping;case 4105:if(src.type===4136){return src.bufQueue[0].id}else{return 0}case 4106:return src.gain.gain.value;case 4109:return src.minGain;case 4110:return src.maxGain;case 4112:return src.state;case 4117:if(src.bufQueue.length===1&&src.bufQueue[0].id===0){return 0}else{return src.bufQueue.length}case 4118:if(src.bufQueue.length===1&&src.bufQueue[0].id===0||src.looping){return 0}else{return src.bufsProcessed}case 4128:return src.refDistance;case 4129:return src.rolloffFactor;case 4130:return src.coneOuterGain;case 4131:return src.maxDistance;case 4132:return AL.sourceTell(src);case 4133:var offset=AL.sourceTell(src);if(offset>0){offset*=src.bufQueue[0].frequency}return offset;case 4134:var offset=AL.sourceTell(src);if(offset>0){offset*=src.bufQueue[0].frequency*src.bufQueue[0].bytesPerSample}return offset;case 4135:return src.type;case 4628:return src.spatialize;case 8201:var length=0;var bytesPerFrame=0;for(var i=0;i0){var audioSrc=src.audioQueue[0];audioSrc.loop=true;audioSrc._duration=Number.POSITIVE_INFINITY}}else if(value===0){src.looping=false;var currentTime=AL.updateSourceTime(src);if(src.type===4136&&src.audioQueue.length>0){var audioSrc=src.audioQueue[0];audioSrc.loop=false;audioSrc._duration=src.bufQueue[0].audioBuf.duration/src.playbackRate;audioSrc._startTime=currentTime-src.bufOffset/src.playbackRate}}else{AL.currentCtx.err=40963;return}break;case 4105:if(src.state===4114||src.state===4115){AL.currentCtx.err=40964;return}if(value===0){for(var i in src.bufQueue){src.bufQueue[i].refCount--}src.bufQueue.length=1;src.bufQueue[0]=AL.buffers[0];src.bufsProcessed=0;src.type=4144}else{var buf=AL.buffers[value];if(!buf){AL.currentCtx.err=40963;return}for(var i in src.bufQueue){src.bufQueue[i].refCount--}src.bufQueue.length=0;buf.refCount++;src.bufQueue=[buf];src.bufsProcessed=0;src.type=4136}AL.initSourcePanner(src);AL.scheduleSourceAudio(src);break;case 4106:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.gain.gain.value=value;break;case 4109:if(!Number.isFinite(value)||value<0||value>Math.min(src.maxGain,1)){AL.currentCtx.err=40963;return}src.minGain=value;break;case 4110:if(!Number.isFinite(value)||value1){AL.currentCtx.err=40963;return}src.maxGain=value;break;case 4128:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.refDistance=value;if(src.panner){src.panner.refDistance=value}break;case 4129:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.rolloffFactor=value;if(src.panner){src.panner.rolloffFactor=value}break;case 4130:if(!Number.isFinite(value)||value<0||value>1){AL.currentCtx.err=40963;return}src.coneOuterGain=value;if(src.panner){src.panner.coneOuterGain=value}break;case 4131:if(!Number.isFinite(value)||value<0){AL.currentCtx.err=40963;return}src.maxDistance=value;if(src.panner){src.panner.maxDistance=value}break;case 4132:if(value<0||value>AL.sourceDuration(src)){AL.currentCtx.err=40963;return}AL.sourceSeek(src,value);break;case 4133:var srcLen=AL.sourceDuration(src);if(srcLen>0){var frequency;for(var bufId in src.bufQueue){if(bufId){frequency=src.bufQueue[bufId].frequency;break}}value/=frequency}if(value<0||value>srcLen){AL.currentCtx.err=40963;return}AL.sourceSeek(src,value);break;case 4134:var srcLen=AL.sourceDuration(src);if(srcLen>0){var bytesPerSec;for(var bufId in src.bufQueue){if(bufId){var buf=src.bufQueue[bufId];bytesPerSec=buf.frequency*buf.bytesPerSample*buf.channels;break}}value/=bytesPerSec}if(value<0||value>srcLen){AL.currentCtx.err=40963;return}AL.sourceSeek(src,value);break;case 4628:if(value!==0&&value!==1&&value!==2){AL.currentCtx.err=40963;return}src.spatialize=value;AL.initSourcePanner(src);break;case 8201:case 8202:case 8203:AL.currentCtx.err=40964;break;case 53248:switch(value){case 0:case 53249:case 53250:case 53251:case 53252:case 53253:case 53254:src.distanceModel=value;if(AL.currentCtx.sourceDistanceModel){AL.updateContextGlobal(AL.currentCtx)}break;default:AL.currentCtx.err=40963;return}break;default:AL.currentCtx.err=40962;return}},captures:{},sharedCaptureAudioCtx:null,requireValidCaptureDevice:function(deviceId,funcname){if(deviceId===0){AL.alcErr=40961;return null}var c=AL.captures[deviceId];if(!c){AL.alcErr=40961;return null}var err=c.mediaStreamError;if(err){AL.alcErr=40961;return null}return c}};function _alBufferData(bufferId,format,pData,size,freq){if(!AL.currentCtx){return}var buf=AL.buffers[bufferId];if(!buf){AL.currentCtx.err=40963;return}if(freq<=0){AL.currentCtx.err=40963;return}var audioBuf=null;try{switch(format){case 4352:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(1,size,freq);var channel0=audioBuf.getChannelData(0);for(var i=0;i0){audioBuf=AL.currentCtx.audioCtx.createBuffer(1,size>>1,freq);var channel0=audioBuf.getChannelData(0);pData>>=1;for(var i=0;i>1;++i){channel0[i]=HEAP16[pData++]*30517578125e-15}}buf.bytesPerSample=2;buf.channels=1;buf.length=size>>1;break;case 4354:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(2,size>>1,freq);var channel0=audioBuf.getChannelData(0);var channel1=audioBuf.getChannelData(1);for(var i=0;i>1;++i){channel0[i]=HEAPU8[pData++]*.0078125-1;channel1[i]=HEAPU8[pData++]*.0078125-1}}buf.bytesPerSample=1;buf.channels=2;buf.length=size>>1;break;case 4355:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(2,size>>2,freq);var channel0=audioBuf.getChannelData(0);var channel1=audioBuf.getChannelData(1);pData>>=1;for(var i=0;i>2;++i){channel0[i]=HEAP16[pData++]*30517578125e-15;channel1[i]=HEAP16[pData++]*30517578125e-15}}buf.bytesPerSample=2;buf.channels=2;buf.length=size>>2;break;case 65552:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(1,size>>2,freq);var channel0=audioBuf.getChannelData(0);pData>>=2;for(var i=0;i>2;++i){channel0[i]=HEAPF32[pData++]}}buf.bytesPerSample=4;buf.channels=1;buf.length=size>>2;break;case 65553:if(size>0){audioBuf=AL.currentCtx.audioCtx.createBuffer(2,size>>3,freq);var channel0=audioBuf.getChannelData(0);var channel1=audioBuf.getChannelData(1);pData>>=2;for(var i=0;i>3;++i){channel0[i]=HEAPF32[pData++];channel1[i]=HEAPF32[pData++]}}buf.bytesPerSample=4;buf.channels=2;buf.length=size>>3;break;default:AL.currentCtx.err=40963;return}buf.frequency=freq;buf.audioBuf=audioBuf}catch(e){AL.currentCtx.err=40963;return}}function _alDeleteBuffers(count,pBufferIds){if(!AL.currentCtx){return}for(var i=0;i>2];if(bufId===0){continue}if(!AL.buffers[bufId]){AL.currentCtx.err=40961;return}if(AL.buffers[bufId].refCount){AL.currentCtx.err=40964;return}}for(var i=0;i>2];if(bufId===0){continue}AL.deviceRefCounts[AL.buffers[bufId].deviceId]--;delete AL.buffers[bufId];AL.freeIds.push(bufId)}}function _alSourcei(sourceId,param,value){switch(param){case 514:case 4097:case 4098:case 4103:case 4105:case 4128:case 4129:case 4131:case 4132:case 4133:case 4134:case 4628:case 8201:case 8202:case 53248:AL.setSourceParam("alSourcei",sourceId,param,value);break;default:AL.setSourceParam("alSourcei",sourceId,param,null);break}}function _alDeleteSources(count,pSourceIds){if(!AL.currentCtx){return}for(var i=0;i>2];if(!AL.currentCtx.sources[srcId]){AL.currentCtx.err=40961;return}}for(var i=0;i>2];AL.setSourceState(AL.currentCtx.sources[srcId],4116);_alSourcei(srcId,4105,0);delete AL.currentCtx.sources[srcId];AL.freeIds.push(srcId)}}function _alGenBuffers(count,pBufferIds){if(!AL.currentCtx){return}for(var i=0;i>2]=buf.id}}function _alGenSources(count,pSourceIds){if(!AL.currentCtx){return}for(var i=0;i>2]=src.id}}function _alGetSourcei(sourceId,param,pValue){var val=AL.getSourceParam("alGetSourcei",sourceId,param);if(val===null){return}if(!pValue){AL.currentCtx.err=40963;return}switch(param){case 514:case 4097:case 4098:case 4103:case 4105:case 4112:case 4117:case 4118:case 4128:case 4129:case 4131:case 4132:case 4133:case 4134:case 4135:case 4628:case 8201:case 8202:case 53248:HEAP32[pValue>>2]=val;break;default:AL.currentCtx.err=40962;return}}function _alListenerfv(param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4100:case 4102:AL.paramArray[0]=HEAPF32[pValues>>2];AL.paramArray[1]=HEAPF32[pValues+4>>2];AL.paramArray[2]=HEAPF32[pValues+8>>2];AL.setListenerParam("alListenerfv",param,AL.paramArray);break;case 4111:AL.paramArray[0]=HEAPF32[pValues>>2];AL.paramArray[1]=HEAPF32[pValues+4>>2];AL.paramArray[2]=HEAPF32[pValues+8>>2];AL.paramArray[3]=HEAPF32[pValues+12>>2];AL.paramArray[4]=HEAPF32[pValues+16>>2];AL.paramArray[5]=HEAPF32[pValues+20>>2];AL.setListenerParam("alListenerfv",param,AL.paramArray);break;default:AL.setListenerParam("alListenerfv",param,null);break}}function _alSourcePause(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4115)}function _alSourcePlay(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4114)}function _alSourceStop(sourceId){if(!AL.currentCtx){return}var src=AL.currentCtx.sources[sourceId];if(!src){AL.currentCtx.err=40961;return}AL.setSourceState(src,4116)}function _alSourcef(sourceId,param,value){switch(param){case 4097:case 4098:case 4099:case 4106:case 4109:case 4110:case 4128:case 4129:case 4130:case 4131:case 4132:case 4133:case 4134:case 8203:AL.setSourceParam("alSourcef",sourceId,param,value);break;default:AL.setSourceParam("alSourcef",sourceId,param,null);break}}function _alSourcefv(sourceId,param,pValues){if(!AL.currentCtx){return}if(!pValues){AL.currentCtx.err=40963;return}switch(param){case 4097:case 4098:case 4099:case 4106:case 4109:case 4110:case 4128:case 4129:case 4130:case 4131:case 4132:case 4133:case 4134:case 8203:var val=HEAPF32[pValues>>2];AL.setSourceParam("alSourcefv",sourceId,param,val);break;case 4100:case 4101:case 4102:AL.paramArray[0]=HEAPF32[pValues>>2];AL.paramArray[1]=HEAPF32[pValues+4>>2];AL.paramArray[2]=HEAPF32[pValues+8>>2];AL.setSourceParam("alSourcefv",sourceId,param,AL.paramArray);break;default:AL.setSourceParam("alSourcefv",sourceId,param,null);break}}function _alcCreateContext(deviceId,pAttrList){if(!(deviceId in AL.deviceRefCounts)){AL.alcErr=40961;return 0}var options=null;var attrs=[];var hrtf=null;pAttrList>>=2;if(pAttrList){var attr=0;var val=0;while(true){attr=HEAP32[pAttrList++];attrs.push(attr);if(attr===0){break}val=HEAP32[pAttrList++];attrs.push(val);switch(attr){case 4103:if(!options){options={}}options.sampleRate=val;break;case 4112:case 4113:break;case 6546:switch(val){case 0:hrtf=false;break;case 1:hrtf=true;break;case 2:break;default:AL.alcErr=40964;return 0}break;case 6550:if(val!==0){AL.alcErr=40964;return 0}break;default:AL.alcErr=40964;return 0}}}var AudioContext=window.AudioContext||window.webkitAudioContext;var ac=null;try{if(options){ac=new AudioContext(options)}else{ac=new AudioContext}}catch(e){if(e.name==="NotSupportedError"){AL.alcErr=40964}else{AL.alcErr=40961}return 0}if(typeof ac.createGain==="undefined"){ac.createGain=ac.createGainNode}var gain=ac.createGain();gain.connect(ac.destination);var ctx={deviceId:deviceId,id:AL.newId(),attrs:attrs,audioCtx:ac,listener:{position:[0,0,0],velocity:[0,0,0],direction:[0,0,0],up:[0,0,0]},sources:[],interval:setInterval(function(){AL.scheduleContextAudio(ctx)},AL.QUEUE_INTERVAL),gain:gain,distanceModel:53250,speedOfSound:343.3,dopplerFactor:1,sourceDistanceModel:false,hrtf:hrtf||false,_err:0,get err(){return this._err},set err(val){if(this._err===0||val===0){this._err=val}}};AL.deviceRefCounts[deviceId]++;AL.contexts[ctx.id]=ctx;if(hrtf!==null){for(var ctxId in AL.contexts){var c=AL.contexts[ctxId];if(c.deviceId===deviceId){c.hrtf=hrtf;AL.updateContextGlobal(c)}}}return ctx.id}function _alcMakeContextCurrent(contextId){if(contextId===0){AL.currentCtx=null;return 0}else{AL.currentCtx=AL.contexts[contextId];return 1}}function _alcOpenDevice(pDeviceName){if(pDeviceName){var name=UTF8ToString(pDeviceName);if(name!==AL.DEVICE_NAME){return 0}}if(typeof AudioContext!=="undefined"||typeof webkitAudioContext!=="undefined"){var deviceId=AL.newId();AL.deviceRefCounts[deviceId]=0;return deviceId}else{return 0}}var _emscripten_get_now_is_monotonic=true;function _clock_gettime(clk_id,tp){var now;if(clk_id===0){now=Date.now()}else if((clk_id===1||clk_id===4)&&_emscripten_get_now_is_monotonic){now=_emscripten_get_now()}else{setErrNo(28);return-1}HEAP32[tp>>2]=now/1e3|0;HEAP32[tp+4>>2]=now%1e3*1e3*1e3|0;return 0}var EGL={errorCode:12288,defaultDisplayInitialized:false,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:false,depth:false,stencil:false,antialias:false},stringCache:{},setErrorCode:function(code){EGL.errorCode=code},chooseConfig:function(display,attribList,config,config_size,numConfigs){if(display!=62e3){EGL.setErrorCode(12296);return 0}if(attribList){for(;;){var param=HEAP32[attribList>>2];if(param==12321){var alphaSize=HEAP32[attribList+4>>2];EGL.contextAttributes.alpha=alphaSize>0}else if(param==12325){var depthSize=HEAP32[attribList+4>>2];EGL.contextAttributes.depth=depthSize>0}else if(param==12326){var stencilSize=HEAP32[attribList+4>>2];EGL.contextAttributes.stencil=stencilSize>0}else if(param==12337){var samples=HEAP32[attribList+4>>2];EGL.contextAttributes.antialias=samples>0}else if(param==12338){var samples=HEAP32[attribList+4>>2];EGL.contextAttributes.antialias=samples==1}else if(param==12544){var requestedPriority=HEAP32[attribList+4>>2];EGL.contextAttributes.lowLatency=requestedPriority!=12547}else if(param==12344){break}attribList+=8}}if((!config||!config_size)&&!numConfigs){EGL.setErrorCode(12300);return 0}if(numConfigs){HEAP32[numConfigs>>2]=1}if(config&&config_size>0){HEAP32[config>>2]=62002}EGL.setErrorCode(12288);return 1}};function _eglGetProcAddress(name_){return _emscripten_GetProcAddress(name_)}function _emscripten_get_sbrk_ptr(){return 372944}function __webgl_acquireInstancedArraysExtension(ctx){var ext=ctx.getExtension("ANGLE_instanced_arrays");if(ext){ctx["vertexAttribDivisor"]=function(index,divisor){ext["vertexAttribDivisorANGLE"](index,divisor)};ctx["drawArraysInstanced"]=function(mode,first,count,primcount){ext["drawArraysInstancedANGLE"](mode,first,count,primcount)};ctx["drawElementsInstanced"]=function(mode,count,type,indices,primcount){ext["drawElementsInstancedANGLE"](mode,count,type,indices,primcount)}}}function __webgl_acquireVertexArrayObjectExtension(ctx){var ext=ctx.getExtension("OES_vertex_array_object");if(ext){ctx["createVertexArray"]=function(){return ext["createVertexArrayOES"]()};ctx["deleteVertexArray"]=function(vao){ext["deleteVertexArrayOES"](vao)};ctx["bindVertexArray"]=function(vao){ext["bindVertexArrayOES"](vao)};ctx["isVertexArray"]=function(vao){return ext["isVertexArrayOES"](vao)}}}function __webgl_acquireDrawBuffersExtension(ctx){var ext=ctx.getExtension("WEBGL_draw_buffers");if(ext){ctx["drawBuffers"]=function(n,bufs){ext["drawBuffersWEBGL"](n,bufs)}}}var GL={counter:1,lastError:0,buffers:[],mappedBuffers:{},programs:[],framebuffers:[],renderbuffers:[],textures:[],uniforms:[],shaders:[],vaos:[],contexts:[],currentContext:null,offscreenCanvases:{},timerQueriesEXT:[],programInfos:{},stringCache:{},unpackAlignment:4,init:function(){var miniTempFloatBuffer=new Float32Array(GL.MINI_TEMP_BUFFER_SIZE);for(var i=0;i>2]:-1;source+=UTF8ToString(HEAP32[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){var ctx=canvas.getContext("webgl",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=GL.getNewId(GL.contexts);var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault==="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents==="object")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;if(context.version<2){__webgl_acquireInstancedArraysExtension(GLctx);__webgl_acquireVertexArrayObjectExtension(GLctx);__webgl_acquireDrawBuffersExtension(GLctx)}GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query");var automaticallyEnabledExtensions=["OES_texture_float","OES_texture_half_float","OES_standard_derivatives","OES_vertex_array_object","WEBGL_compressed_texture_s3tc","WEBGL_depth_texture","OES_element_index_uint","EXT_texture_filter_anisotropic","EXT_frag_depth","WEBGL_draw_buffers","ANGLE_instanced_arrays","OES_texture_float_linear","OES_texture_half_float_linear","EXT_blend_minmax","EXT_shader_texture_lod","EXT_texture_norm16","WEBGL_compressed_texture_pvrtc","EXT_color_buffer_half_float","WEBGL_color_buffer_float","EXT_sRGB","WEBGL_compressed_texture_etc1","EXT_disjoint_timer_query","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_astc","EXT_color_buffer_float","WEBGL_compressed_texture_s3tc_srgb","EXT_disjoint_timer_query_webgl2","WEBKIT_WEBGL_compressed_texture_pvrtc"];var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(automaticallyEnabledExtensions.indexOf(ext)!=-1){GLctx.getExtension(ext)}})},populateUniformTable:function(program){var p=GL.programs[program];var ptable=GL.programInfos[program]={uniforms:{},maxUniformLength:0,maxAttributeLength:-1,maxUniformBlockNameLength:-1};var utable=ptable.uniforms;var numUniforms=GLctx.getProgramParameter(p,35718);for(var i=0;i>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null;if(id==GL.currArrayBuffer)GL.currArrayBuffer=0;if(id==GL.currElementArrayBuffer)GL.currElementArrayBuffer=0}}function _emscripten_glDeleteFramebuffers(n,framebuffers){for(var i=0;i>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}}function _emscripten_glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null;GL.programInfos[id]=null}function _emscripten_glDeleteQueriesEXT(n,ids){for(var i=0;i>2];var query=GL.timerQueriesEXT[id];if(!query)continue;GLctx.disjointTimerQueryExt["deleteQueryEXT"](query);GL.timerQueriesEXT[id]=null}}function _emscripten_glDeleteRenderbuffers(n,renderbuffers){for(var i=0;i>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}}function _emscripten_glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}function _emscripten_glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}function _emscripten_glDeleteVertexArraysOES(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}function _emscripten_glDepthFunc(x0){GLctx["depthFunc"](x0)}function _emscripten_glDepthMask(flag){GLctx.depthMask(!!flag)}function _emscripten_glDepthRangef(x0,x1){GLctx["depthRange"](x0,x1)}function _emscripten_glDetachShader(program,shader){GLctx.detachShader(GL.programs[program],GL.shaders[shader])}function _emscripten_glDisable(x0){GLctx["disable"](x0)}function _emscripten_glDisableVertexAttribArray(index){GLctx.disableVertexAttribArray(index)}function _emscripten_glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}function _emscripten_glDrawArraysInstancedANGLE(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}var __tempFixedLengthArray=[];function _emscripten_glDrawBuffersWEBGL(n,bufs){var bufArray=__tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}function _emscripten_glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}function _emscripten_glDrawElementsInstancedANGLE(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}function _emscripten_glEnable(x0){GLctx["enable"](x0)}function _emscripten_glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function _emscripten_glEndQueryEXT(target){GLctx.disjointTimerQueryExt["endQueryEXT"](target)}function _emscripten_glFinish(){GLctx["finish"]()}function _emscripten_glFlush(){GLctx["flush"]()}function _emscripten_glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer){GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])}function _emscripten_glFramebufferTexture2D(target,attachment,textarget,texture,level){GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)}function _emscripten_glFrontFace(x0){GLctx["frontFace"](x0)}function __glGenObject(n,buffers,createFunction,objectTable){for(var i=0;i>2]=id}}function _emscripten_glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _emscripten_glGenFramebuffers(n,ids){__glGenObject(n,ids,"createFramebuffer",GL.framebuffers)}function _emscripten_glGenQueriesEXT(n,ids){for(var i=0;i>2]=0;return}var id=GL.getNewId(GL.timerQueriesEXT);query.name=id;GL.timerQueriesEXT[id]=query;HEAP32[ids+i*4>>2]=id}}function _emscripten_glGenRenderbuffers(n,renderbuffers){__glGenObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)}function _emscripten_glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _emscripten_glGenVertexArraysOES(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}function _emscripten_glGenerateMipmap(x0){GLctx["generateMipmap"](x0)}function _emscripten_glGetActiveAttrib(program,index,bufSize,length,size,type,name){program=GL.programs[program];var info=GLctx.getActiveAttrib(program,index);if(!info)return;var numBytesWrittenExclNull=bufSize>0&&name?stringToUTF8(info.name,name,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull;if(size)HEAP32[size>>2]=info.size;if(type)HEAP32[type>>2]=info.type}function _emscripten_glGetActiveUniform(program,index,bufSize,length,size,type,name){program=GL.programs[program];var info=GLctx.getActiveUniform(program,index);if(!info)return;var numBytesWrittenExclNull=bufSize>0&&name?stringToUTF8(info.name,name,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull;if(size)HEAP32[size>>2]=info.size;if(type)HEAP32[type>>2]=info.type}function _emscripten_glGetAttachedShaders(program,maxCount,count,shaders){var result=GLctx.getAttachedShaders(GL.programs[program]);var len=result.length;if(len>maxCount){len=maxCount}HEAP32[count>>2]=len;for(var i=0;i>2]=id}}function _emscripten_glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}function writeI53ToI64(ptr,num){HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}function emscriptenWebGLGet(name_,p,type){if(!p){GL.recordError(1281);return}var ret=undefined;switch(name_){case 36346:ret=1;break;case 36344:if(type!=0&&type!=1){GL.recordError(1280)}return;case 36345:ret=0;break;case 34466:var formats=GLctx.getParameter(34467);ret=formats?formats.length:0;break}if(ret===undefined){var result=GLctx.getParameter(name_);switch(typeof result){case"number":ret=result;break;case"boolean":ret=result?1:0;break;case"string":GL.recordError(1280);return;case"object":if(result===null){switch(name_){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 34068:{ret=0;break}default:{GL.recordError(1280);return}}}else if(result instanceof Float32Array||result instanceof Uint32Array||result instanceof Int32Array||result instanceof Array){for(var i=0;i>2]=result[i];break;case 2:HEAPF32[p+i*4>>2]=result[i];break;case 4:HEAP8[p+i>>0]=result[i]?1:0;break}}return}else{try{ret=result.name|0}catch(e){GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Unknown object returned from WebGL getParameter("+name_+")! (error: "+e+")");return}}break;default:GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Native code calling glGet"+type+"v("+name_+") and it returns "+result+" of type "+typeof result+"!");return}}switch(type){case 1:writeI53ToI64(p,ret);break;case 0:HEAP32[p>>2]=ret;break;case 2:HEAPF32[p>>2]=ret;break;case 4:HEAP8[p>>0]=ret?1:0;break}}function _emscripten_glGetBooleanv(name_,p){emscriptenWebGLGet(name_,p,4)}function _emscripten_glGetBufferParameteriv(target,value,data){if(!data){GL.recordError(1281);return}HEAP32[data>>2]=GLctx.getBufferParameter(target,value)}function _emscripten_glGetError(){var error=GLctx.getError()||GL.lastError;GL.lastError=0;return error}function _emscripten_glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}function _emscripten_glGetFramebufferAttachmentParameteriv(target,attachment,pname,params){var result=GLctx.getFramebufferAttachmentParameter(target,attachment,pname);if(result instanceof WebGLRenderbuffer||result instanceof WebGLTexture){result=result.name|0}HEAP32[params>>2]=result}function _emscripten_glGetIntegerv(name_,p){emscriptenWebGLGet(name_,p,0)}function _emscripten_glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}var ptable=GL.programInfos[program];if(!ptable){GL.recordError(1282);return}if(pname==35716){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){HEAP32[p>>2]=ptable.maxUniformLength}else if(pname==35722){if(ptable.maxAttributeLength==-1){program=GL.programs[program];var numAttribs=GLctx.getProgramParameter(program,35721);ptable.maxAttributeLength=0;for(var i=0;i>2]=ptable.maxAttributeLength}else if(pname==35381){if(ptable.maxUniformBlockNameLength==-1){program=GL.programs[program];var numBlocks=GLctx.getProgramParameter(program,35382);ptable.maxUniformBlockNameLength=0;for(var i=0;i>2]=ptable.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(GL.programs[program],pname)}}function _emscripten_glGetQueryObjecti64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.timerQueriesEXT[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}function _emscripten_glGetQueryObjectivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.timerQueriesEXT[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}function _emscripten_glGetQueryObjectui64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.timerQueriesEXT[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}function _emscripten_glGetQueryObjectuivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.timerQueriesEXT[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}function _emscripten_glGetQueryivEXT(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.disjointTimerQueryExt["getQueryEXT"](target,pname)}function _emscripten_glGetRenderbufferParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getRenderbufferParameter(target,pname)}function _emscripten_glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetShaderPrecisionFormat(shaderType,precisionType,range,precision){var result=GLctx.getShaderPrecisionFormat(shaderType,precisionType);HEAP32[range>>2]=result.rangeMin;HEAP32[range+4>>2]=result.rangeMax;HEAP32[precision>>2]=result.precision}function _emscripten_glGetShaderSource(shader,bufSize,length,source){var result=GLctx.getShaderSource(GL.shaders[shader]);if(!result)return;var numBytesWrittenExclNull=bufSize>0&&source?stringToUTF8(result,source,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source===null||source.length==0?0:source.length+1;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}function stringToNewUTF8(jsString){var length=lengthBytesUTF8(jsString)+1;var cString=_malloc(length);stringToUTF8(jsString,cString,length);return cString}function _emscripten_glGetString(name_){if(GL.stringCache[name_])return GL.stringCache[name_];var ret;switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280);return 0}GL.stringCache[name_]=ret;return ret}function _emscripten_glGetTexParameterfv(target,pname,params){if(!params){GL.recordError(1281);return}HEAPF32[params>>2]=GLctx.getTexParameter(target,pname)}function _emscripten_glGetTexParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getTexParameter(target,pname)}function jstoi_q(str){return parseInt(str)}function _emscripten_glGetUniformLocation(program,name){name=UTF8ToString(name);var arrayIndex=0;if(name[name.length-1]=="]"){var leftBrace=name.lastIndexOf("[");arrayIndex=name[leftBrace+1]!="]"?jstoi_q(name.slice(leftBrace+1)):0;name=name.slice(0,leftBrace)}var uniformInfo=GL.programInfos[program]&&GL.programInfos[program].uniforms[name];if(uniformInfo&&arrayIndex>=0&&arrayIndex>2]=data;break;case 2:HEAPF32[params>>2]=data;break;default:throw"internal emscriptenWebGLGetUniform() error, bad type: "+type}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break;default:throw"internal emscriptenWebGLGetUniform() error, bad type: "+type}}}}function _emscripten_glGetUniformfv(program,location,params){emscriptenWebGLGetUniform(program,location,params,2)}function _emscripten_glGetUniformiv(program,location,params){emscriptenWebGLGetUniform(program,location,params,0)}function _emscripten_glGetVertexAttribPointerv(index,pname,pointer){if(!pointer){GL.recordError(1281);return}HEAP32[pointer>>2]=GLctx.getVertexAttribOffset(index,pname)}function emscriptenWebGLGetVertexAttrib(index,pname,params,type){if(!params){GL.recordError(1281);return}var data=GLctx.getVertexAttrib(index,pname);if(pname==34975){HEAP32[params>>2]=data&&data["name"]}else if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break;case 5:HEAP32[params>>2]=Math.fround(data);break;default:throw"internal emscriptenWebGLGetVertexAttrib() error, bad type: "+type}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break;case 5:HEAP32[params+i*4>>2]=Math.fround(data[i]);break;default:throw"internal emscriptenWebGLGetVertexAttrib() error, bad type: "+type}}}}function _emscripten_glGetVertexAttribfv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,2)}function _emscripten_glGetVertexAttribiv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,5)}function _emscripten_glHint(x0,x1){GLctx["hint"](x0,x1)}function _emscripten_glIsBuffer(buffer){var b=GL.buffers[buffer];if(!b)return 0;return GLctx.isBuffer(b)}function _emscripten_glIsEnabled(x0){return GLctx["isEnabled"](x0)}function _emscripten_glIsFramebuffer(framebuffer){var fb=GL.framebuffers[framebuffer];if(!fb)return 0;return GLctx.isFramebuffer(fb)}function _emscripten_glIsProgram(program){program=GL.programs[program];if(!program)return 0;return GLctx.isProgram(program)}function _emscripten_glIsQueryEXT(id){var query=GL.timerQueriesEXT[id];if(!query)return 0;return GLctx.disjointTimerQueryExt["isQueryEXT"](query)}function _emscripten_glIsRenderbuffer(renderbuffer){var rb=GL.renderbuffers[renderbuffer];if(!rb)return 0;return GLctx.isRenderbuffer(rb)}function _emscripten_glIsShader(shader){var s=GL.shaders[shader];if(!s)return 0;return GLctx.isShader(s)}function _emscripten_glIsTexture(id){var texture=GL.textures[id];if(!texture)return 0;return GLctx.isTexture(texture)}function _emscripten_glIsVertexArrayOES(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}function _emscripten_glLineWidth(x0){GLctx["lineWidth"](x0)}function _emscripten_glLinkProgram(program){GLctx.linkProgram(GL.programs[program]);GL.populateUniformTable(program)}function _emscripten_glPixelStorei(pname,param){if(pname==3317){GL.unpackAlignment=param}GLctx.pixelStorei(pname,param)}function _emscripten_glPolygonOffset(x0,x1){GLctx["polygonOffset"](x0,x1)}function _emscripten_glQueryCounterEXT(id,target){GLctx.disjointTimerQueryExt["queryCounterEXT"](GL.timerQueriesEXT[id],target)}function __computeUnpackAlignedImageSize(width,height,sizePerPixel,alignment){function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=width*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,alignment);return height*alignedRowSize}function __colorChannelsInGlTextureFormat(format){var colorChannels={5:3,6:4,8:2,29502:3,29504:4};return colorChannels[format-6402]||1}function __heapObjectForWebGLType(type){type-=5120;if(type==1)return HEAPU8;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922)return HEAPU32;return HEAPU16}function __heapAccessShiftForWebGLHeap(heap){return 31-Math.clz32(heap.BYTES_PER_ELEMENT)}function emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat){var heap=__heapObjectForWebGLType(type);var shift=__heapAccessShiftForWebGLHeap(heap);var byteSize=1<>shift,pixels+bytes>>shift)}function _emscripten_glReadPixels(x,y,width,height,format,type,pixels){var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}function _emscripten_glReleaseShaderCompiler(){}function _emscripten_glRenderbufferStorage(x0,x1,x2,x3){GLctx["renderbufferStorage"](x0,x1,x2,x3)}function _emscripten_glSampleCoverage(value,invert){GLctx.sampleCoverage(value,!!invert)}function _emscripten_glScissor(x0,x1,x2,x3){GLctx["scissor"](x0,x1,x2,x3)}function _emscripten_glShaderBinary(){GL.recordError(1280)}function _emscripten_glShaderSource(shader,count,string,length){var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}function _emscripten_glStencilFunc(x0,x1,x2){GLctx["stencilFunc"](x0,x1,x2)}function _emscripten_glStencilFuncSeparate(x0,x1,x2,x3){GLctx["stencilFuncSeparate"](x0,x1,x2,x3)}function _emscripten_glStencilMask(x0){GLctx["stencilMask"](x0)}function _emscripten_glStencilMaskSeparate(x0,x1){GLctx["stencilMaskSeparate"](x0,x1)}function _emscripten_glStencilOp(x0,x1,x2){GLctx["stencilOp"](x0,x1,x2)}function _emscripten_glStencilOpSeparate(x0,x1,x2,x3){GLctx["stencilOpSeparate"](x0,x1,x2,x3)}function _emscripten_glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}function _emscripten_glTexParameterf(x0,x1,x2){GLctx["texParameterf"](x0,x1,x2)}function _emscripten_glTexParameterfv(target,pname,params){var param=HEAPF32[params>>2];GLctx.texParameterf(target,pname,param)}function _emscripten_glTexParameteri(x0,x1,x2){GLctx["texParameteri"](x0,x1,x2)}function _emscripten_glTexParameteriv(target,pname,params){var param=HEAP32[params>>2];GLctx.texParameteri(target,pname,param)}function _emscripten_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels){var pixelData=null;if(pixels)pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,0);GLctx.texSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixelData)}function _emscripten_glUniform1f(location,v0){GLctx.uniform1f(GL.uniforms[location],v0)}function _emscripten_glUniform1fv(location,count,value){if(count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[count-1];for(var i=0;i>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1fv(GL.uniforms[location],view)}function _emscripten_glUniform1i(location,v0){GLctx.uniform1i(GL.uniforms[location],v0)}function _emscripten_glUniform1iv(location,count,value){if(count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferIntViews[count-1];for(var i=0;i>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(GL.uniforms[location],view)}function _emscripten_glUniform2f(location,v0,v1){GLctx.uniform2f(GL.uniforms[location],v0,v1)}function _emscripten_glUniform2fv(location,count,value){if(2*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(GL.uniforms[location],view)}function _emscripten_glUniform2i(location,v0,v1){GLctx.uniform2i(GL.uniforms[location],v0,v1)}function _emscripten_glUniform2iv(location,count,value){if(2*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferIntViews[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(GL.uniforms[location],view)}function _emscripten_glUniform3f(location,v0,v1,v2){GLctx.uniform3f(GL.uniforms[location],v0,v1,v2)}function _emscripten_glUniform3fv(location,count,value){if(3*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(GL.uniforms[location],view)}function _emscripten_glUniform3i(location,v0,v1,v2){GLctx.uniform3i(GL.uniforms[location],v0,v1,v2)}function _emscripten_glUniform3iv(location,count,value){if(3*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferIntViews[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3iv(GL.uniforms[location],view)}function _emscripten_glUniform4f(location,v0,v1,v2,v3){GLctx.uniform4f(GL.uniforms[location],v0,v1,v2,v3)}function _emscripten_glUniform4fv(location,count,value){if(4*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[4*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<4*count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(GL.uniforms[location],view)}function _emscripten_glUniform4i(location,v0,v1,v2,v3){GLctx.uniform4i(GL.uniforms[location],v0,v1,v2,v3)}function _emscripten_glUniform4iv(location,count,value){if(4*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferIntViews[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2];view[i+3]=HEAP32[value+(4*i+12)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4iv(GL.uniforms[location],view)}function _emscripten_glUniformMatrix2fv(location,count,transpose,value){if(4*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniformMatrix2fv(GL.uniforms[location],!!transpose,view)}function _emscripten_glUniformMatrix3fv(location,count,transpose,value){if(9*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[9*count-1];for(var i=0;i<9*count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(GL.uniforms[location],!!transpose,view)}function _emscripten_glUniformMatrix4fv(location,count,transpose,value){if(16*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[16*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(GL.uniforms[location],!!transpose,view)}function _emscripten_glUseProgram(program){GLctx.useProgram(GL.programs[program])}function _emscripten_glValidateProgram(program){GLctx.validateProgram(GL.programs[program])}function _emscripten_glVertexAttrib1f(x0,x1){GLctx["vertexAttrib1f"](x0,x1)}function _emscripten_glVertexAttrib1fv(index,v){GLctx.vertexAttrib1f(index,HEAPF32[v>>2])}function _emscripten_glVertexAttrib2f(x0,x1,x2){GLctx["vertexAttrib2f"](x0,x1,x2)}function _emscripten_glVertexAttrib2fv(index,v){GLctx.vertexAttrib2f(index,HEAPF32[v>>2],HEAPF32[v+4>>2])}function _emscripten_glVertexAttrib3f(x0,x1,x2,x3){GLctx["vertexAttrib3f"](x0,x1,x2,x3)}function _emscripten_glVertexAttrib3fv(index,v){GLctx.vertexAttrib3f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2])}function _emscripten_glVertexAttrib4f(x0,x1,x2,x3,x4){GLctx["vertexAttrib4f"](x0,x1,x2,x3,x4)}function _emscripten_glVertexAttrib4fv(index,v){GLctx.vertexAttrib4f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2],HEAPF32[v+12>>2])}function _emscripten_glVertexAttribDivisorANGLE(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}function _emscripten_glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _emscripten_glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function _emscripten_get_heap_size(){return HEAPU8.length}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){requestedSize=requestedSize>>>0;var oldSize=_emscripten_get_heap_size();var PAGE_MULTIPLE=65536;var maxHeapSize=2147483648;if(requestedSize>maxHeapSize){return false}var minHeapSize=16777216;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(minHeapSize,requestedSize,overGrownHeapSize),PAGE_MULTIPLE));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var ENV={};function __getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":(typeof navigator==="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8","_":__getExecutableName()};for(var x in ENV){env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){return 0}function _fd_read(fd,iov,iovcnt,pnum){var stream=SYSCALLS.getStreamFromFD(fd);var num=SYSCALLS.doReadv(stream,iov,iovcnt);HEAP32[pnum>>2]=num;return 0}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=num;return 0}function _glActiveTexture(x0){GLctx["activeTexture"](x0)}function _glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}function _glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}function _glBindFramebuffer(target,framebuffer){GLctx.bindFramebuffer(target,GL.framebuffers[framebuffer])}function _glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}function _glBlendEquation(x0){GLctx["blendEquation"](x0)}function _glBlendEquationSeparate(x0,x1){GLctx["blendEquationSeparate"](x0,x1)}function _glBlendFuncSeparate(x0,x1,x2,x3){GLctx["blendFuncSeparate"](x0,x1,x2,x3)}function _glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}function _glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}function _glClear(x0){GLctx["clear"](x0)}function _glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}function _glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}function _glCopyTexSubImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexSubImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}function _glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;GL.programs[id]=program;return id}function _glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}function _glCullFace(x0){GLctx["cullFace"](x0)}function _glDeleteBuffers(n,buffers){for(var i=0;i>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null;if(id==GL.currArrayBuffer)GL.currArrayBuffer=0;if(id==GL.currElementArrayBuffer)GL.currElementArrayBuffer=0}}function _glDeleteFramebuffers(n,framebuffers){for(var i=0;i>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}}function _glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null;GL.programInfos[id]=null}function _glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}function _glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}function _glDepthFunc(x0){GLctx["depthFunc"](x0)}function _glDepthMask(flag){GLctx.depthMask(!!flag)}function _glDisable(x0){GLctx["disable"](x0)}function _glDisableVertexAttribArray(index){GLctx.disableVertexAttribArray(index)}function _glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}function _glEnable(x0){GLctx["enable"](x0)}function _glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function _glFramebufferTexture2D(target,attachment,textarget,texture,level){GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)}function _glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _glGenFramebuffers(n,ids){__glGenObject(n,ids,"createFramebuffer",GL.framebuffers)}function _glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _glGenerateMipmap(x0){GLctx["generateMipmap"](x0)}function _glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}function _glGetBooleanv(name_,p){emscriptenWebGLGet(name_,p,4)}function _glGetIntegerv(name_,p){emscriptenWebGLGet(name_,p,0)}function _glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}var ptable=GL.programInfos[program];if(!ptable){GL.recordError(1282);return}if(pname==35716){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){HEAP32[p>>2]=ptable.maxUniformLength}else if(pname==35722){if(ptable.maxAttributeLength==-1){program=GL.programs[program];var numAttribs=GLctx.getProgramParameter(program,35721);ptable.maxAttributeLength=0;for(var i=0;i>2]=ptable.maxAttributeLength}else if(pname==35381){if(ptable.maxUniformBlockNameLength==-1){program=GL.programs[program];var numBlocks=GLctx.getProgramParameter(program,35382);ptable.maxUniformBlockNameLength=0;for(var i=0;i>2]=ptable.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(GL.programs[program],pname)}}function _glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source===null||source.length==0?0:source.length+1;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}function _glGetString(name_){if(GL.stringCache[name_])return GL.stringCache[name_];var ret;switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280);return 0}GL.stringCache[name_]=ret;return ret}function _glGetUniformLocation(program,name){name=UTF8ToString(name);var arrayIndex=0;if(name[name.length-1]=="]"){var leftBrace=name.lastIndexOf("[");arrayIndex=name[leftBrace+1]!="]"?jstoi_q(name.slice(leftBrace+1)):0;name=name.slice(0,leftBrace)}var uniformInfo=GL.programInfos[program]&&GL.programInfos[program].uniforms[name];if(uniformInfo&&arrayIndex>=0&&arrayIndex>=2;for(var i=0;i<4*count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(GL.uniforms[location],view)}function _glUniformMatrix4fv(location,count,transpose,value){if(16*count<=GL.MINI_TEMP_BUFFER_SIZE){var view=GL.miniTempBufferFloatViews[16*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(GL.uniforms[location],!!transpose,view)}function _glUseProgram(program){GLctx.useProgram(GL.programs[program])}function _glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function _pthread_create(){return 6}function _pthread_join(){}function _pthread_mutexattr_destroy(){}function _pthread_mutexattr_init(){}function _pthread_mutexattr_settype(){}function _roundf(d){d=+d;return d>=+0?+Math_floor(d+ +.5):+Math_ceil(d-+.5)}function _setTempRet0($i){setTempRet0($i|0)}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"},"%V":function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};for(var rule in EXPANSION_RULES_2){if(pattern.indexOf(rule)>=0){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}function readAsmConstArgs(sigPtr,buf){if(!readAsmConstArgs.array){readAsmConstArgs.array=[]}var args=readAsmConstArgs.array;args.length=0;var ch;while(ch=HEAPU8[sigPtr++]){if(ch===100||ch===102){buf=buf+7&~7;args.push(HEAPF64[buf>>3]);buf+=8}else{buf=buf+3&~3;args.push(HEAP32[buf>>2]);buf+=4}}return args}Module["requestFullscreen"]=function Module_requestFullscreen(lockPointer,resizeCanvas){Browser.requestFullscreen(lockPointer,resizeCanvas)};Module["requestAnimationFrame"]=function Module_requestAnimationFrame(func){Browser.requestAnimationFrame(func)};Module["setCanvasSize"]=function Module_setCanvasSize(width,height,noUpdates){Browser.setCanvasSize(width,height,noUpdates)};Module["pauseMainLoop"]=function Module_pauseMainLoop(){Browser.mainLoop.pause()};Module["resumeMainLoop"]=function Module_resumeMainLoop(){Browser.mainLoop.resume()};Module["getUserMedia"]=function Module_getUserMedia(){Browser.getUserMedia()};Module["createContext"]=function Module_createContext(canvas,useWebGL,setInModule,webGLContextAttributes){return Browser.createContext(canvas,useWebGL,setInModule,webGLContextAttributes)};var GLctx;GL.init();for(var i=0;i<32;i++)__tempFixedLengthArray.push(new Array(i));var ASSERTIONS=false;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var asmLibraryArg={"__cxa_allocate_exception":___cxa_allocate_exception,"__cxa_atexit":___cxa_atexit,"__cxa_throw":___cxa_throw,"__map_file":___map_file,"__sys_fcntl64":___sys_fcntl64,"__sys_ioctl":___sys_ioctl,"__sys_munmap":___sys_munmap,"__sys_open":___sys_open,"abort":_abort,"alBufferData":_alBufferData,"alDeleteBuffers":_alDeleteBuffers,"alDeleteSources":_alDeleteSources,"alGenBuffers":_alGenBuffers,"alGenSources":_alGenSources,"alGetSourcei":_alGetSourcei,"alListenerfv":_alListenerfv,"alSourcePause":_alSourcePause,"alSourcePlay":_alSourcePlay,"alSourceStop":_alSourceStop,"alSourcef":_alSourcef,"alSourcefv":_alSourcefv,"alSourcei":_alSourcei,"alcCreateContext":_alcCreateContext,"alcMakeContextCurrent":_alcMakeContextCurrent,"alcOpenDevice":_alcOpenDevice,"clock_gettime":_clock_gettime,"eglGetProcAddress":_eglGetProcAddress,"emscripten_asm_const_iii":_emscripten_asm_const_iii,"emscripten_get_sbrk_ptr":_emscripten_get_sbrk_ptr,"emscripten_glActiveTexture":_emscripten_glActiveTexture,"emscripten_glAttachShader":_emscripten_glAttachShader,"emscripten_glBeginQueryEXT":_emscripten_glBeginQueryEXT,"emscripten_glBindAttribLocation":_emscripten_glBindAttribLocation,"emscripten_glBindBuffer":_emscripten_glBindBuffer,"emscripten_glBindFramebuffer":_emscripten_glBindFramebuffer,"emscripten_glBindRenderbuffer":_emscripten_glBindRenderbuffer,"emscripten_glBindTexture":_emscripten_glBindTexture,"emscripten_glBindVertexArrayOES":_emscripten_glBindVertexArrayOES,"emscripten_glBlendColor":_emscripten_glBlendColor,"emscripten_glBlendEquation":_emscripten_glBlendEquation,"emscripten_glBlendEquationSeparate":_emscripten_glBlendEquationSeparate,"emscripten_glBlendFunc":_emscripten_glBlendFunc,"emscripten_glBlendFuncSeparate":_emscripten_glBlendFuncSeparate,"emscripten_glBufferData":_emscripten_glBufferData,"emscripten_glBufferSubData":_emscripten_glBufferSubData,"emscripten_glCheckFramebufferStatus":_emscripten_glCheckFramebufferStatus,"emscripten_glClear":_emscripten_glClear,"emscripten_glClearColor":_emscripten_glClearColor,"emscripten_glClearDepthf":_emscripten_glClearDepthf,"emscripten_glClearStencil":_emscripten_glClearStencil,"emscripten_glColorMask":_emscripten_glColorMask,"emscripten_glCompileShader":_emscripten_glCompileShader,"emscripten_glCompressedTexImage2D":_emscripten_glCompressedTexImage2D,"emscripten_glCompressedTexSubImage2D":_emscripten_glCompressedTexSubImage2D,"emscripten_glCopyTexImage2D":_emscripten_glCopyTexImage2D,"emscripten_glCopyTexSubImage2D":_emscripten_glCopyTexSubImage2D,"emscripten_glCreateProgram":_emscripten_glCreateProgram,"emscripten_glCreateShader":_emscripten_glCreateShader,"emscripten_glCullFace":_emscripten_glCullFace,"emscripten_glDeleteBuffers":_emscripten_glDeleteBuffers,"emscripten_glDeleteFramebuffers":_emscripten_glDeleteFramebuffers,"emscripten_glDeleteProgram":_emscripten_glDeleteProgram,"emscripten_glDeleteQueriesEXT":_emscripten_glDeleteQueriesEXT,"emscripten_glDeleteRenderbuffers":_emscripten_glDeleteRenderbuffers,"emscripten_glDeleteShader":_emscripten_glDeleteShader,"emscripten_glDeleteTextures":_emscripten_glDeleteTextures,"emscripten_glDeleteVertexArraysOES":_emscripten_glDeleteVertexArraysOES,"emscripten_glDepthFunc":_emscripten_glDepthFunc,"emscripten_glDepthMask":_emscripten_glDepthMask,"emscripten_glDepthRangef":_emscripten_glDepthRangef,"emscripten_glDetachShader":_emscripten_glDetachShader,"emscripten_glDisable":_emscripten_glDisable,"emscripten_glDisableVertexAttribArray":_emscripten_glDisableVertexAttribArray,"emscripten_glDrawArrays":_emscripten_glDrawArrays,"emscripten_glDrawArraysInstancedANGLE":_emscripten_glDrawArraysInstancedANGLE,"emscripten_glDrawBuffersWEBGL":_emscripten_glDrawBuffersWEBGL,"emscripten_glDrawElements":_emscripten_glDrawElements,"emscripten_glDrawElementsInstancedANGLE":_emscripten_glDrawElementsInstancedANGLE,"emscripten_glEnable":_emscripten_glEnable,"emscripten_glEnableVertexAttribArray":_emscripten_glEnableVertexAttribArray,"emscripten_glEndQueryEXT":_emscripten_glEndQueryEXT,"emscripten_glFinish":_emscripten_glFinish,"emscripten_glFlush":_emscripten_glFlush,"emscripten_glFramebufferRenderbuffer":_emscripten_glFramebufferRenderbuffer,"emscripten_glFramebufferTexture2D":_emscripten_glFramebufferTexture2D,"emscripten_glFrontFace":_emscripten_glFrontFace,"emscripten_glGenBuffers":_emscripten_glGenBuffers,"emscripten_glGenFramebuffers":_emscripten_glGenFramebuffers,"emscripten_glGenQueriesEXT":_emscripten_glGenQueriesEXT,"emscripten_glGenRenderbuffers":_emscripten_glGenRenderbuffers,"emscripten_glGenTextures":_emscripten_glGenTextures,"emscripten_glGenVertexArraysOES":_emscripten_glGenVertexArraysOES,"emscripten_glGenerateMipmap":_emscripten_glGenerateMipmap,"emscripten_glGetActiveAttrib":_emscripten_glGetActiveAttrib,"emscripten_glGetActiveUniform":_emscripten_glGetActiveUniform,"emscripten_glGetAttachedShaders":_emscripten_glGetAttachedShaders,"emscripten_glGetAttribLocation":_emscripten_glGetAttribLocation,"emscripten_glGetBooleanv":_emscripten_glGetBooleanv,"emscripten_glGetBufferParameteriv":_emscripten_glGetBufferParameteriv,"emscripten_glGetError":_emscripten_glGetError,"emscripten_glGetFloatv":_emscripten_glGetFloatv,"emscripten_glGetFramebufferAttachmentParameteriv":_emscripten_glGetFramebufferAttachmentParameteriv,"emscripten_glGetIntegerv":_emscripten_glGetIntegerv,"emscripten_glGetProgramInfoLog":_emscripten_glGetProgramInfoLog,"emscripten_glGetProgramiv":_emscripten_glGetProgramiv,"emscripten_glGetQueryObjecti64vEXT":_emscripten_glGetQueryObjecti64vEXT,"emscripten_glGetQueryObjectivEXT":_emscripten_glGetQueryObjectivEXT,"emscripten_glGetQueryObjectui64vEXT":_emscripten_glGetQueryObjectui64vEXT,"emscripten_glGetQueryObjectuivEXT":_emscripten_glGetQueryObjectuivEXT,"emscripten_glGetQueryivEXT":_emscripten_glGetQueryivEXT,"emscripten_glGetRenderbufferParameteriv":_emscripten_glGetRenderbufferParameteriv,"emscripten_glGetShaderInfoLog":_emscripten_glGetShaderInfoLog,"emscripten_glGetShaderPrecisionFormat":_emscripten_glGetShaderPrecisionFormat,"emscripten_glGetShaderSource":_emscripten_glGetShaderSource,"emscripten_glGetShaderiv":_emscripten_glGetShaderiv,"emscripten_glGetString":_emscripten_glGetString,"emscripten_glGetTexParameterfv":_emscripten_glGetTexParameterfv,"emscripten_glGetTexParameteriv":_emscripten_glGetTexParameteriv,"emscripten_glGetUniformLocation":_emscripten_glGetUniformLocation,"emscripten_glGetUniformfv":_emscripten_glGetUniformfv,"emscripten_glGetUniformiv":_emscripten_glGetUniformiv,"emscripten_glGetVertexAttribPointerv":_emscripten_glGetVertexAttribPointerv,"emscripten_glGetVertexAttribfv":_emscripten_glGetVertexAttribfv,"emscripten_glGetVertexAttribiv":_emscripten_glGetVertexAttribiv,"emscripten_glHint":_emscripten_glHint,"emscripten_glIsBuffer":_emscripten_glIsBuffer,"emscripten_glIsEnabled":_emscripten_glIsEnabled,"emscripten_glIsFramebuffer":_emscripten_glIsFramebuffer,"emscripten_glIsProgram":_emscripten_glIsProgram,"emscripten_glIsQueryEXT":_emscripten_glIsQueryEXT,"emscripten_glIsRenderbuffer":_emscripten_glIsRenderbuffer,"emscripten_glIsShader":_emscripten_glIsShader,"emscripten_glIsTexture":_emscripten_glIsTexture,"emscripten_glIsVertexArrayOES":_emscripten_glIsVertexArrayOES,"emscripten_glLineWidth":_emscripten_glLineWidth,"emscripten_glLinkProgram":_emscripten_glLinkProgram,"emscripten_glPixelStorei":_emscripten_glPixelStorei,"emscripten_glPolygonOffset":_emscripten_glPolygonOffset,"emscripten_glQueryCounterEXT":_emscripten_glQueryCounterEXT,"emscripten_glReadPixels":_emscripten_glReadPixels,"emscripten_glReleaseShaderCompiler":_emscripten_glReleaseShaderCompiler,"emscripten_glRenderbufferStorage":_emscripten_glRenderbufferStorage,"emscripten_glSampleCoverage":_emscripten_glSampleCoverage,"emscripten_glScissor":_emscripten_glScissor,"emscripten_glShaderBinary":_emscripten_glShaderBinary,"emscripten_glShaderSource":_emscripten_glShaderSource,"emscripten_glStencilFunc":_emscripten_glStencilFunc,"emscripten_glStencilFuncSeparate":_emscripten_glStencilFuncSeparate,"emscripten_glStencilMask":_emscripten_glStencilMask,"emscripten_glStencilMaskSeparate":_emscripten_glStencilMaskSeparate,"emscripten_glStencilOp":_emscripten_glStencilOp,"emscripten_glStencilOpSeparate":_emscripten_glStencilOpSeparate,"emscripten_glTexImage2D":_emscripten_glTexImage2D,"emscripten_glTexParameterf":_emscripten_glTexParameterf,"emscripten_glTexParameterfv":_emscripten_glTexParameterfv,"emscripten_glTexParameteri":_emscripten_glTexParameteri,"emscripten_glTexParameteriv":_emscripten_glTexParameteriv,"emscripten_glTexSubImage2D":_emscripten_glTexSubImage2D,"emscripten_glUniform1f":_emscripten_glUniform1f,"emscripten_glUniform1fv":_emscripten_glUniform1fv,"emscripten_glUniform1i":_emscripten_glUniform1i,"emscripten_glUniform1iv":_emscripten_glUniform1iv,"emscripten_glUniform2f":_emscripten_glUniform2f,"emscripten_glUniform2fv":_emscripten_glUniform2fv,"emscripten_glUniform2i":_emscripten_glUniform2i,"emscripten_glUniform2iv":_emscripten_glUniform2iv,"emscripten_glUniform3f":_emscripten_glUniform3f,"emscripten_glUniform3fv":_emscripten_glUniform3fv,"emscripten_glUniform3i":_emscripten_glUniform3i,"emscripten_glUniform3iv":_emscripten_glUniform3iv,"emscripten_glUniform4f":_emscripten_glUniform4f,"emscripten_glUniform4fv":_emscripten_glUniform4fv,"emscripten_glUniform4i":_emscripten_glUniform4i,"emscripten_glUniform4iv":_emscripten_glUniform4iv,"emscripten_glUniformMatrix2fv":_emscripten_glUniformMatrix2fv,"emscripten_glUniformMatrix3fv":_emscripten_glUniformMatrix3fv,"emscripten_glUniformMatrix4fv":_emscripten_glUniformMatrix4fv,"emscripten_glUseProgram":_emscripten_glUseProgram,"emscripten_glValidateProgram":_emscripten_glValidateProgram,"emscripten_glVertexAttrib1f":_emscripten_glVertexAttrib1f,"emscripten_glVertexAttrib1fv":_emscripten_glVertexAttrib1fv,"emscripten_glVertexAttrib2f":_emscripten_glVertexAttrib2f,"emscripten_glVertexAttrib2fv":_emscripten_glVertexAttrib2fv,"emscripten_glVertexAttrib3f":_emscripten_glVertexAttrib3f,"emscripten_glVertexAttrib3fv":_emscripten_glVertexAttrib3fv,"emscripten_glVertexAttrib4f":_emscripten_glVertexAttrib4f,"emscripten_glVertexAttrib4fv":_emscripten_glVertexAttrib4fv,"emscripten_glVertexAttribDivisorANGLE":_emscripten_glVertexAttribDivisorANGLE,"emscripten_glVertexAttribPointer":_emscripten_glVertexAttribPointer,"emscripten_glViewport":_emscripten_glViewport,"emscripten_memcpy_big":_emscripten_memcpy_big,"emscripten_resize_heap":_emscripten_resize_heap,"environ_get":_environ_get,"environ_sizes_get":_environ_sizes_get,"fd_close":_fd_close,"fd_read":_fd_read,"fd_seek":_fd_seek,"fd_write":_fd_write,"glActiveTexture":_glActiveTexture,"glAttachShader":_glAttachShader,"glBindBuffer":_glBindBuffer,"glBindFramebuffer":_glBindFramebuffer,"glBindTexture":_glBindTexture,"glBlendEquation":_glBlendEquation,"glBlendEquationSeparate":_glBlendEquationSeparate,"glBlendFuncSeparate":_glBlendFuncSeparate,"glBufferData":_glBufferData,"glBufferSubData":_glBufferSubData,"glClear":_glClear,"glClearColor":_glClearColor,"glCompileShader":_glCompileShader,"glCopyTexSubImage2D":_glCopyTexSubImage2D,"glCreateProgram":_glCreateProgram,"glCreateShader":_glCreateShader,"glCullFace":_glCullFace,"glDeleteBuffers":_glDeleteBuffers,"glDeleteFramebuffers":_glDeleteFramebuffers,"glDeleteProgram":_glDeleteProgram,"glDeleteShader":_glDeleteShader,"glDeleteTextures":_glDeleteTextures,"glDepthFunc":_glDepthFunc,"glDepthMask":_glDepthMask,"glDisable":_glDisable,"glDisableVertexAttribArray":_glDisableVertexAttribArray,"glDrawElements":_glDrawElements,"glEnable":_glEnable,"glEnableVertexAttribArray":_glEnableVertexAttribArray,"glFramebufferTexture2D":_glFramebufferTexture2D,"glGenBuffers":_glGenBuffers,"glGenFramebuffers":_glGenFramebuffers,"glGenTextures":_glGenTextures,"glGenerateMipmap":_glGenerateMipmap,"glGetAttribLocation":_glGetAttribLocation,"glGetBooleanv":_glGetBooleanv,"glGetIntegerv":_glGetIntegerv,"glGetProgramiv":_glGetProgramiv,"glGetShaderiv":_glGetShaderiv,"glGetString":_glGetString,"glGetUniformLocation":_glGetUniformLocation,"glIsEnabled":_glIsEnabled,"glLinkProgram":_glLinkProgram,"glShaderSource":_glShaderSource,"glTexImage2D":_glTexImage2D,"glTexParameteri":_glTexParameteri,"glUniform1i":_glUniform1i,"glUniform4fv":_glUniform4fv,"glUniformMatrix4fv":_glUniformMatrix4fv,"glUseProgram":_glUseProgram,"glVertexAttribPointer":_glVertexAttribPointer,"glViewport":_glViewport,"memory":wasmMemory,"pthread_create":_pthread_create,"pthread_join":_pthread_join,"pthread_mutexattr_destroy":_pthread_mutexattr_destroy,"pthread_mutexattr_init":_pthread_mutexattr_init,"pthread_mutexattr_settype":_pthread_mutexattr_settype,"roundf":_roundf,"setTempRet0":_setTempRet0,"strftime_l":_strftime_l,"table":wasmTable};var asm=createWasm();Module["asm"]=asm;var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["__wasm_call_ctors"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["free"]).apply(null,arguments)};var _strstr=Module["_strstr"]=function(){return(_strstr=Module["_strstr"]=Module["asm"]["strstr"]).apply(null,arguments)};var _EffekseerInit=Module["_EffekseerInit"]=function(){return(_EffekseerInit=Module["_EffekseerInit"]=Module["asm"]["EffekseerInit"]).apply(null,arguments)};var _EffekseerTerminate=Module["_EffekseerTerminate"]=function(){return(_EffekseerTerminate=Module["_EffekseerTerminate"]=Module["asm"]["EffekseerTerminate"]).apply(null,arguments)};var _EffekseerUpdate=Module["_EffekseerUpdate"]=function(){return(_EffekseerUpdate=Module["_EffekseerUpdate"]=Module["asm"]["EffekseerUpdate"]).apply(null,arguments)};var _EffekseerBeginUpdate=Module["_EffekseerBeginUpdate"]=function(){return(_EffekseerBeginUpdate=Module["_EffekseerBeginUpdate"]=Module["asm"]["EffekseerBeginUpdate"]).apply(null,arguments)};var _EffekseerEndUpdate=Module["_EffekseerEndUpdate"]=function(){return(_EffekseerEndUpdate=Module["_EffekseerEndUpdate"]=Module["asm"]["EffekseerEndUpdate"]).apply(null,arguments)};var _EffekseerUpdateHandle=Module["_EffekseerUpdateHandle"]=function(){return(_EffekseerUpdateHandle=Module["_EffekseerUpdateHandle"]=Module["asm"]["EffekseerUpdateHandle"]).apply(null,arguments)};var _EffekseerDraw=Module["_EffekseerDraw"]=function(){return(_EffekseerDraw=Module["_EffekseerDraw"]=Module["asm"]["EffekseerDraw"]).apply(null,arguments)};var _EffekseerBeginDraw=Module["_EffekseerBeginDraw"]=function(){return(_EffekseerBeginDraw=Module["_EffekseerBeginDraw"]=Module["asm"]["EffekseerBeginDraw"]).apply(null,arguments)};var _EffekseerEndDraw=Module["_EffekseerEndDraw"]=function(){return(_EffekseerEndDraw=Module["_EffekseerEndDraw"]=Module["asm"]["EffekseerEndDraw"]).apply(null,arguments)};var _EffekseerDrawHandle=Module["_EffekseerDrawHandle"]=function(){return(_EffekseerDrawHandle=Module["_EffekseerDrawHandle"]=Module["asm"]["EffekseerDrawHandle"]).apply(null,arguments)};var _EffekseerSetProjectionMatrix=Module["_EffekseerSetProjectionMatrix"]=function(){return(_EffekseerSetProjectionMatrix=Module["_EffekseerSetProjectionMatrix"]=Module["asm"]["EffekseerSetProjectionMatrix"]).apply(null,arguments)};var _EffekseerSetProjectionPerspective=Module["_EffekseerSetProjectionPerspective"]=function(){return(_EffekseerSetProjectionPerspective=Module["_EffekseerSetProjectionPerspective"]=Module["asm"]["EffekseerSetProjectionPerspective"]).apply(null,arguments)};var _EffekseerSetProjectionOrthographic=Module["_EffekseerSetProjectionOrthographic"]=function(){return(_EffekseerSetProjectionOrthographic=Module["_EffekseerSetProjectionOrthographic"]=Module["asm"]["EffekseerSetProjectionOrthographic"]).apply(null,arguments)};var _EffekseerSetCameraMatrix=Module["_EffekseerSetCameraMatrix"]=function(){return(_EffekseerSetCameraMatrix=Module["_EffekseerSetCameraMatrix"]=Module["asm"]["EffekseerSetCameraMatrix"]).apply(null,arguments)};var _EffekseerSetCameraLookAt=Module["_EffekseerSetCameraLookAt"]=function(){return(_EffekseerSetCameraLookAt=Module["_EffekseerSetCameraLookAt"]=Module["asm"]["EffekseerSetCameraLookAt"]).apply(null,arguments)};var _EffekseerLoadEffect=Module["_EffekseerLoadEffect"]=function(){return(_EffekseerLoadEffect=Module["_EffekseerLoadEffect"]=Module["asm"]["EffekseerLoadEffect"]).apply(null,arguments)};var _EffekseerReleaseEffect=Module["_EffekseerReleaseEffect"]=function(){return(_EffekseerReleaseEffect=Module["_EffekseerReleaseEffect"]=Module["asm"]["EffekseerReleaseEffect"]).apply(null,arguments)};var _EffekseerReloadResources=Module["_EffekseerReloadResources"]=function(){return(_EffekseerReloadResources=Module["_EffekseerReloadResources"]=Module["asm"]["EffekseerReloadResources"]).apply(null,arguments)};var _EffekseerStopAllEffects=Module["_EffekseerStopAllEffects"]=function(){return(_EffekseerStopAllEffects=Module["_EffekseerStopAllEffects"]=Module["asm"]["EffekseerStopAllEffects"]).apply(null,arguments)};var _EffekseerPlayEffect=Module["_EffekseerPlayEffect"]=function(){return(_EffekseerPlayEffect=Module["_EffekseerPlayEffect"]=Module["asm"]["EffekseerPlayEffect"]).apply(null,arguments)};var _EffekseerStopEffect=Module["_EffekseerStopEffect"]=function(){return(_EffekseerStopEffect=Module["_EffekseerStopEffect"]=Module["asm"]["EffekseerStopEffect"]).apply(null,arguments)};var _EffekseerStopRoot=Module["_EffekseerStopRoot"]=function(){return(_EffekseerStopRoot=Module["_EffekseerStopRoot"]=Module["asm"]["EffekseerStopRoot"]).apply(null,arguments)};var _EffekseerExists=Module["_EffekseerExists"]=function(){return(_EffekseerExists=Module["_EffekseerExists"]=Module["asm"]["EffekseerExists"]).apply(null,arguments)};var _EffekseerSetFrame=Module["_EffekseerSetFrame"]=function(){return(_EffekseerSetFrame=Module["_EffekseerSetFrame"]=Module["asm"]["EffekseerSetFrame"]).apply(null,arguments)};var _EffekseerSetLocation=Module["_EffekseerSetLocation"]=function(){return(_EffekseerSetLocation=Module["_EffekseerSetLocation"]=Module["asm"]["EffekseerSetLocation"]).apply(null,arguments)};var _EffekseerSetRotation=Module["_EffekseerSetRotation"]=function(){return(_EffekseerSetRotation=Module["_EffekseerSetRotation"]=Module["asm"]["EffekseerSetRotation"]).apply(null,arguments)};var _EffekseerSetScale=Module["_EffekseerSetScale"]=function(){return(_EffekseerSetScale=Module["_EffekseerSetScale"]=Module["asm"]["EffekseerSetScale"]).apply(null,arguments)};var _EffekseerSetMatrix=Module["_EffekseerSetMatrix"]=function(){return(_EffekseerSetMatrix=Module["_EffekseerSetMatrix"]=Module["asm"]["EffekseerSetMatrix"]).apply(null,arguments)};var _EffekseerGetDynamicInput=Module["_EffekseerGetDynamicInput"]=function(){return(_EffekseerGetDynamicInput=Module["_EffekseerGetDynamicInput"]=Module["asm"]["EffekseerGetDynamicInput"]).apply(null,arguments)};var _EffekseerSetDynamicInput=Module["_EffekseerSetDynamicInput"]=function(){return(_EffekseerSetDynamicInput=Module["_EffekseerSetDynamicInput"]=Module["asm"]["EffekseerSetDynamicInput"]).apply(null,arguments)};var _EffekseerSendTrigger=Module["_EffekseerSendTrigger"]=function(){return(_EffekseerSendTrigger=Module["_EffekseerSendTrigger"]=Module["asm"]["EffekseerSendTrigger"]).apply(null,arguments)};var _EffekseerSetAllColor=Module["_EffekseerSetAllColor"]=function(){return(_EffekseerSetAllColor=Module["_EffekseerSetAllColor"]=Module["asm"]["EffekseerSetAllColor"]).apply(null,arguments)};var _EffekseerSetTargetLocation=Module["_EffekseerSetTargetLocation"]=function(){return(_EffekseerSetTargetLocation=Module["_EffekseerSetTargetLocation"]=Module["asm"]["EffekseerSetTargetLocation"]).apply(null,arguments)};var _EffekseerSetPaused=Module["_EffekseerSetPaused"]=function(){return(_EffekseerSetPaused=Module["_EffekseerSetPaused"]=Module["asm"]["EffekseerSetPaused"]).apply(null,arguments)};var _EffekseerSetShown=Module["_EffekseerSetShown"]=function(){return(_EffekseerSetShown=Module["_EffekseerSetShown"]=Module["asm"]["EffekseerSetShown"]).apply(null,arguments)};var _EffekseerSetSpeed=Module["_EffekseerSetSpeed"]=function(){return(_EffekseerSetSpeed=Module["_EffekseerSetSpeed"]=Module["asm"]["EffekseerSetSpeed"]).apply(null,arguments)};var _EffekseerSetRandomSeed=Module["_EffekseerSetRandomSeed"]=function(){return(_EffekseerSetRandomSeed=Module["_EffekseerSetRandomSeed"]=Module["asm"]["EffekseerSetRandomSeed"]).apply(null,arguments)};var _EffekseerGetRestInstancesCount=Module["_EffekseerGetRestInstancesCount"]=function(){return(_EffekseerGetRestInstancesCount=Module["_EffekseerGetRestInstancesCount"]=Module["asm"]["EffekseerGetRestInstancesCount"]).apply(null,arguments)};var _EffekseerGetUpdateTime=Module["_EffekseerGetUpdateTime"]=function(){return(_EffekseerGetUpdateTime=Module["_EffekseerGetUpdateTime"]=Module["asm"]["EffekseerGetUpdateTime"]).apply(null,arguments)};var _EffekseerGetDrawTime=Module["_EffekseerGetDrawTime"]=function(){return(_EffekseerGetDrawTime=Module["_EffekseerGetDrawTime"]=Module["asm"]["EffekseerGetDrawTime"]).apply(null,arguments)};var _EffekseerIsVertexArrayObjectSupported=Module["_EffekseerIsVertexArrayObjectSupported"]=function(){return(_EffekseerIsVertexArrayObjectSupported=Module["_EffekseerIsVertexArrayObjectSupported"]=Module["asm"]["EffekseerIsVertexArrayObjectSupported"]).apply(null,arguments)};var _EffekseerSetRestorationOfStatesFlag=Module["_EffekseerSetRestorationOfStatesFlag"]=function(){return(_EffekseerSetRestorationOfStatesFlag=Module["_EffekseerSetRestorationOfStatesFlag"]=Module["asm"]["EffekseerSetRestorationOfStatesFlag"]).apply(null,arguments)};var _EffekseerCaptureBackground=Module["_EffekseerCaptureBackground"]=function(){return(_EffekseerCaptureBackground=Module["_EffekseerCaptureBackground"]=Module["asm"]["EffekseerCaptureBackground"]).apply(null,arguments)};var _EffekseerResetBackground=Module["_EffekseerResetBackground"]=function(){return(_EffekseerResetBackground=Module["_EffekseerResetBackground"]=Module["asm"]["EffekseerResetBackground"]).apply(null,arguments)};var _EffekseerSetLogEnabled=Module["_EffekseerSetLogEnabled"]=function(){return(_EffekseerSetLogEnabled=Module["_EffekseerSetLogEnabled"]=Module["asm"]["EffekseerSetLogEnabled"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["__errno_location"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["malloc"]).apply(null,arguments)};var _setThrew=Module["_setThrew"]=function(){return(_setThrew=Module["_setThrew"]=Module["asm"]["setThrew"]).apply(null,arguments)};var _emscripten_GetProcAddress=Module["_emscripten_GetProcAddress"]=function(){return(_emscripten_GetProcAddress=Module["_emscripten_GetProcAddress"]=Module["asm"]["emscripten_GetProcAddress"]).apply(null,arguments)};var _emscripten_main_thread_process_queued_calls=Module["_emscripten_main_thread_process_queued_calls"]=function(){return(_emscripten_main_thread_process_queued_calls=Module["_emscripten_main_thread_process_queued_calls"]=Module["asm"]["emscripten_main_thread_process_queued_calls"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["stackSave"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["stackAlloc"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["stackRestore"]).apply(null,arguments)};var __growWasmMemory=Module["__growWasmMemory"]=function(){return(__growWasmMemory=Module["__growWasmMemory"]=Module["asm"]["__growWasmMemory"]).apply(null,arguments)};var dynCall_ii=Module["dynCall_ii"]=function(){return(dynCall_ii=Module["dynCall_ii"]=Module["asm"]["dynCall_ii"]).apply(null,arguments)};var dynCall_vi=Module["dynCall_vi"]=function(){return(dynCall_vi=Module["dynCall_vi"]=Module["asm"]["dynCall_vi"]).apply(null,arguments)};var dynCall_viii=Module["dynCall_viii"]=function(){return(dynCall_viii=Module["dynCall_viii"]=Module["asm"]["dynCall_viii"]).apply(null,arguments)};var dynCall_viiii=Module["dynCall_viiii"]=function(){return(dynCall_viiii=Module["dynCall_viiii"]=Module["asm"]["dynCall_viiii"]).apply(null,arguments)};var dynCall_vii=Module["dynCall_vii"]=function(){return(dynCall_vii=Module["dynCall_vii"]=Module["asm"]["dynCall_vii"]).apply(null,arguments)};var dynCall_iiiii=Module["dynCall_iiiii"]=function(){return(dynCall_iiiii=Module["dynCall_iiiii"]=Module["asm"]["dynCall_iiiii"]).apply(null,arguments)};var dynCall_iiii=Module["dynCall_iiii"]=function(){return(dynCall_iiii=Module["dynCall_iiii"]=Module["asm"]["dynCall_iiii"]).apply(null,arguments)};var dynCall_iiiiifi=Module["dynCall_iiiiifi"]=function(){return(dynCall_iiiiifi=Module["dynCall_iiiiifi"]=Module["asm"]["dynCall_iiiiifi"]).apply(null,arguments)};var dynCall_viiiii=Module["dynCall_viiiii"]=function(){return(dynCall_viiiii=Module["dynCall_viiiii"]=Module["asm"]["dynCall_viiiii"]).apply(null,arguments)};var dynCall_fi=Module["dynCall_fi"]=function(){return(dynCall_fi=Module["dynCall_fi"]=Module["asm"]["dynCall_fi"]).apply(null,arguments)};var dynCall_iii=Module["dynCall_iii"]=function(){return(dynCall_iii=Module["dynCall_iii"]=Module["asm"]["dynCall_iii"]).apply(null,arguments)};var dynCall_iiiiiiii=Module["dynCall_iiiiiiii"]=function(){return(dynCall_iiiiiiii=Module["dynCall_iiiiiiii"]=Module["asm"]["dynCall_iiiiiiii"]).apply(null,arguments)};var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=function(){return(dynCall_iiiiiii=Module["dynCall_iiiiiii"]=Module["asm"]["dynCall_iiiiiii"]).apply(null,arguments)};var dynCall_viiiiii=Module["dynCall_viiiiii"]=function(){return(dynCall_viiiiii=Module["dynCall_viiiiii"]=Module["asm"]["dynCall_viiiiii"]).apply(null,arguments)};var dynCall_i=Module["dynCall_i"]=function(){return(dynCall_i=Module["dynCall_i"]=Module["asm"]["dynCall_i"]).apply(null,arguments)};var dynCall_fif=Module["dynCall_fif"]=function(){return(dynCall_fif=Module["dynCall_fif"]=Module["asm"]["dynCall_fif"]).apply(null,arguments)};var dynCall_viifff=Module["dynCall_viifff"]=function(){return(dynCall_viifff=Module["dynCall_viifff"]=Module["asm"]["dynCall_viifff"]).apply(null,arguments)};var dynCall_viiif=Module["dynCall_viiif"]=function(){return(dynCall_viiif=Module["dynCall_viiif"]=Module["asm"]["dynCall_viiif"]).apply(null,arguments)};var dynCall_fiii=Module["dynCall_fiii"]=function(){return(dynCall_fiii=Module["dynCall_fiii"]=Module["asm"]["dynCall_fiii"]).apply(null,arguments)};var dynCall_jii=Module["dynCall_jii"]=function(){return(dynCall_jii=Module["dynCall_jii"]=Module["asm"]["dynCall_jii"]).apply(null,arguments)};var dynCall_viij=Module["dynCall_viij"]=function(){return(dynCall_viij=Module["dynCall_viij"]=Module["asm"]["dynCall_viij"]).apply(null,arguments)};var dynCall_fii=Module["dynCall_fii"]=function(){return(dynCall_fii=Module["dynCall_fii"]=Module["asm"]["dynCall_fii"]).apply(null,arguments)};var dynCall_viif=Module["dynCall_viif"]=function(){return(dynCall_viif=Module["dynCall_viif"]=Module["asm"]["dynCall_viif"]).apply(null,arguments)};var dynCall_vijf=Module["dynCall_vijf"]=function(){return(dynCall_vijf=Module["dynCall_vijf"]=Module["asm"]["dynCall_vijf"]).apply(null,arguments)};var dynCall_vif=Module["dynCall_vif"]=function(){return(dynCall_vif=Module["dynCall_vif"]=Module["asm"]["dynCall_vif"]).apply(null,arguments)};var dynCall_iiifff=Module["dynCall_iiifff"]=function(){return(dynCall_iiifff=Module["dynCall_iiifff"]=Module["asm"]["dynCall_iiifff"]).apply(null,arguments)};var dynCall_fiff=Module["dynCall_fiff"]=function(){return(dynCall_fiff=Module["dynCall_fiff"]=Module["asm"]["dynCall_fiff"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["dynCall_ji"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["dynCall_vij"]).apply(null,arguments)};var dynCall_fiif=Module["dynCall_fiif"]=function(){return(dynCall_fiif=Module["dynCall_fiif"]=Module["asm"]["dynCall_fiif"]).apply(null,arguments)};var dynCall_viijii=Module["dynCall_viijii"]=function(){return(dynCall_viijii=Module["dynCall_viijii"]=Module["asm"]["dynCall_viijii"]).apply(null,arguments)};var dynCall_v=Module["dynCall_v"]=function(){return(dynCall_v=Module["dynCall_v"]=Module["asm"]["dynCall_v"]).apply(null,arguments)};var dynCall_iiiiii=Module["dynCall_iiiiii"]=function(){return(dynCall_iiiiii=Module["dynCall_iiiiii"]=Module["asm"]["dynCall_iiiiii"]).apply(null,arguments)};var dynCall_iiiiiiiii=Module["dynCall_iiiiiiiii"]=function(){return(dynCall_iiiiiiiii=Module["dynCall_iiiiiiiii"]=Module["asm"]["dynCall_iiiiiiiii"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["dynCall_jiji"]).apply(null,arguments)};var dynCall_iidiiii=Module["dynCall_iidiiii"]=function(){return(dynCall_iidiiii=Module["dynCall_iidiiii"]=Module["asm"]["dynCall_iidiiii"]).apply(null,arguments)};var dynCall_iiiiij=Module["dynCall_iiiiij"]=function(){return(dynCall_iiiiij=Module["dynCall_iiiiij"]=Module["asm"]["dynCall_iiiiij"]).apply(null,arguments)};var dynCall_iiiiid=Module["dynCall_iiiiid"]=function(){return(dynCall_iiiiid=Module["dynCall_iiiiid"]=Module["asm"]["dynCall_iiiiid"]).apply(null,arguments)};var dynCall_iiiiijj=Module["dynCall_iiiiijj"]=function(){return(dynCall_iiiiijj=Module["dynCall_iiiiijj"]=Module["asm"]["dynCall_iiiiijj"]).apply(null,arguments)};var dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=function(){return(dynCall_iiiiiijj=Module["dynCall_iiiiiijj"]=Module["asm"]["dynCall_iiiiiijj"]).apply(null,arguments)};var dynCall_vffff=Module["dynCall_vffff"]=function(){return(dynCall_vffff=Module["dynCall_vffff"]=Module["asm"]["dynCall_vffff"]).apply(null,arguments)};var dynCall_vf=Module["dynCall_vf"]=function(){return(dynCall_vf=Module["dynCall_vf"]=Module["asm"]["dynCall_vf"]).apply(null,arguments)};var dynCall_viiiiiiii=Module["dynCall_viiiiiiii"]=function(){return(dynCall_viiiiiiii=Module["dynCall_viiiiiiii"]=Module["asm"]["dynCall_viiiiiiii"]).apply(null,arguments)};var dynCall_viiiiiiiii=Module["dynCall_viiiiiiiii"]=function(){return(dynCall_viiiiiiiii=Module["dynCall_viiiiiiiii"]=Module["asm"]["dynCall_viiiiiiiii"]).apply(null,arguments)};var dynCall_vff=Module["dynCall_vff"]=function(){return(dynCall_vff=Module["dynCall_vff"]=Module["asm"]["dynCall_vff"]).apply(null,arguments)};var dynCall_viiiiiii=Module["dynCall_viiiiiii"]=function(){return(dynCall_viiiiiii=Module["dynCall_viiiiiii"]=Module["asm"]["dynCall_viiiiiii"]).apply(null,arguments)};var dynCall_vfi=Module["dynCall_vfi"]=function(){return(dynCall_vfi=Module["dynCall_vfi"]=Module["asm"]["dynCall_vfi"]).apply(null,arguments)};var dynCall_viff=Module["dynCall_viff"]=function(){return(dynCall_viff=Module["dynCall_viff"]=Module["asm"]["dynCall_viff"]).apply(null,arguments)};var dynCall_vifff=Module["dynCall_vifff"]=function(){return(dynCall_vifff=Module["dynCall_vifff"]=Module["asm"]["dynCall_vifff"]).apply(null,arguments)};var dynCall_viffff=Module["dynCall_viffff"]=function(){return(dynCall_viffff=Module["dynCall_viffff"]=Module["asm"]["dynCall_viffff"]).apply(null,arguments)};Module["asm"]=asm;Module["cwrap"]=cwrap;Module["UTF8ToString"]=UTF8ToString;var calledRun;Module["then"]=function(func){if(calledRun){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=function(){if(old)old();func(Module)}}return Module};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run();Module["GL"]=GL; + + + return effekseer_native +} +); +})(); +if (typeof exports === 'object' && typeof module === 'object') + module.exports = effekseer_native; + else if (typeof define === 'function' && define['amd']) + define([], function() { return effekseer_native; }); + else if (typeof exports === 'object') + exports["effekseer_native"] = effekseer_native; + "use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){for(var i=0;i>2);Core.SetMatrix(this.context.nativeptr,this.native,arrmem);Module.stackRestore(stack);} +},{key:"setAllColor",value:function setAllColor(r,g,b,a){Core.SetAllColor(this.context.nativeptr,this.native,r,g,b,a);} +},{key:"setTargetLocation",value:function setTargetLocation(x,y,z){Core.SetTargetLocation(this.context.nativeptr,this.native,x,y,z);} +},{key:"getDynamicInput",value:function getDynamicInput(index){return Core.GetDynamicInput(this.context.nativeptr,this.native,index);} +},{key:"setDynamicInput",value:function setDynamicInput(index,value){Core.SetDynamicInput(this.context.nativeptr,this.native,index,value);} +},{key:"sendTrigger",value:function sendTrigger(index){Core.SendTrigger(this.context.nativeptr,this.native,index);} +},{key:"setPaused",value:function setPaused(paused){Core.SetPaused(this.context.nativeptr,this.native,paused);} +},{key:"setShown",value:function setShown(shown){Core.SetShown(this.context.nativeptr,this.native,shown);} +},{key:"setSpeed",value:function setSpeed(speed){Core.SetSpeed(this.context.nativeptr,this.native,speed);} +},{key:"setRandomSeed",value:function setRandomSeed(seed){Core.SetRandomSeed(this.context.nativeptr,this.native,seed);}},{key:"exists",get:function get(){return!!Core.Exists(this.context.nativeptr,this.native);}}]);return EffekseerHandle;}();var _isImagePowerOfTwo=function _isImagePowerOfTwo(image){return!(image.width&image.width-1)&&!(image.height&image.height-1);};var calcNextPowerOfTwo=function calcNextPowerOfTwo(v){var sizes=[2,4,8,16,32,64,128,256,512,1024,2048];var foundInd=-1;for(var i=0;i=v){return sizes[i];}} +for(var i=sizes.length-1;i>=0;i--){if(sizes[i]<=v){return sizes[i];}} +return 1;};var _convertPowerOfTwoImage=function _convertPowerOfTwoImage(image){if(!_isImagePowerOfTwo(image)){var canvas=document.createElement("canvas");canvas.width=calcNextPowerOfTwo(image.width);canvas.height=calcNextPowerOfTwo(image.height);var context2d=canvas.getContext("2d");context2d.drawImage(image,0,0,image.width,image.height,0,0,canvas.width,canvas.height);image=canvas;} +return image;};var _loadBinFile=function _loadBinFile(url,onload,onerror){var xhr=new XMLHttpRequest();xhr.open('GET',url,true);xhr.responseType="arraybuffer";xhr.onload=function(){onload(xhr.response);};xhr.onerror=function(){if(!(typeof onerror==="undefined"))onerror('not found',url);};xhr.send(null);};var _loadResource=function _loadResource(path,onload,onerror){splitted_path=path.split('?');var ext_path=path;if(splitted_path.length>=2){ext_path=splitted_path[0];} +var extindex=ext_path.lastIndexOf(".");var ext=extindex>=0?ext_path.slice(extindex):"";if(ext==".png"||ext==".jpg"){var image=new Image();image.onload=function(){var converted_image=_convertPowerOfTwoImage(image);onload(converted_image);};image.onerror=function(){if(!(typeof onerror==="undefined"))onerror('not found',path);};image.crossOrigin=_imageCrossOrigin;image.src=path;}else if(ext==".tga"){if(!(typeof onerror==="undefined"))onerror('not supported',path);}else{_loadBinFile(path,function(buffer){onload(buffer);},onerror);}};var loadingEffect=null;var ContextStates=function(){function ContextStates(gl){_classCallCheck(this,ContextStates);this.restore_texture_slot_max=8;this._gl=gl;this.ext_vao=null;this.isWebGL2VAOEnabled=false;this.effekseer_vao=null;this.current_vao=null;this.current_vbo=null;this.current_ibo=null;this.current_textures=[];this.current_textures.length=this.restore_texture_slot_max;this.current_active_texture_id=null;this.ext_vao=this._gl.getExtension('OES_vertex_array_object');if(this.ext_vao!=null){this.effekseer_vao=this.ext_vao.createVertexArrayOES();}else if('createVertexArray'in this._gl){this.isWebGL2VAOEnabled=true;this.effekseer_vao=this._gl.createVertexArray();}} +_createClass(ContextStates,[{key:"release",value:function release(){if(this.effekseer_vao){if(this.ext_vao){this.ext_vao.deleteVertexArrayOES(this.effekseer_vao);}else if(this.isWebGL2VAOEnabled){this._gl.deleteVertexArray(this.effekseer_vao);} +this.effekseer_vao=null;} +this._gl=null;}},{key:"save",value:function save(){this.current_vbo=this._gl.getParameter(this._gl.ARRAY_BUFFER_BINDING);this.current_ibo=this._gl.getParameter(this._gl.ELEMENT_ARRAY_BUFFER_BINDING);if(this.ext_vao!=null){this.current_vao=this._gl.getParameter(this.ext_vao.VERTEX_ARRAY_BINDING_OES);this.ext_vao.bindVertexArrayOES(this.effekseer_vao);}else if(this.isWebGL2VAOEnabled){this.current_vao=this._gl.getParameter(this._gl.VERTEX_ARRAY_BINDING);this._gl.bindVertexArray(this.effekseer_vao);} +this.current_active_texture_id=this._gl.getParameter(this._gl.ACTIVE_TEXTURE);for(var i=0;i>2);Core.SetProjectionMatrix(this.nativeptr,arrmem);Module.stackRestore(stack);} +},{key:"setProjectionPerspective",value:function setProjectionPerspective(fov,aspect,near,far){Core.SetProjectionPerspective(this.nativeptr,fov,aspect,near,far);} +},{key:"setProjectionOrthographic",value:function setProjectionOrthographic(width,height,near,far){Core.SetProjectionOrthographic(this.nativeptr,width,height,near,far);} +},{key:"setCameraMatrix",value:function setCameraMatrix(matrixArray){var stack=Module.stackSave();var arrmem=Module.stackAlloc(4*16);Module.HEAPF32.set(matrixArray,arrmem>>2);Core.SetCameraMatrix(this.nativeptr,arrmem);Module.stackRestore(stack);} +},{key:"setCameraLookAt",value:function setCameraLookAt(positionX,positionY,positionZ,targetX,targetY,targetZ,upvecX,upvecY,upvecZ){Core.SetCameraLookAt(this.nativeptr,positionX,positionY,positionZ,targetX,targetY,targetZ,upvecX,upvecY,upvecZ);} +},{key:"setCameraLookAtFromVector",value:function setCameraLookAtFromVector(position,target,upvec){upvecVector=(typeof upvecVector==="undefined"?"undefined":_typeof(upvecVector))==="object"?upvecVector:{x:0,y:1,z:0};Core.SetCameraLookAt(this.nativeptr,position.x,position.y,position.z,target.x,target.y,target.z,upvec.x,upvec.y,upvec.z);} +},{key:"loadEffect",value:function loadEffect(data){var scale=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1.0;var onload=arguments[2];var onerror=arguments[3];var redirect=arguments[4];this._makeContextCurrent();var effect=new EffekseerEffect(this);if(typeof scale==="function"){console.log("Error : second arguments is number from version 1.5");effect.scale=1.0;effect.onload=scale;effect.onerror=onload;effect.redirect=redirect;}else{effect.scale=scale;effect.onload=onload;effect.onerror=onerror;effect.redirect=redirect;} +if(typeof data==="string"){var dirIndex=data.lastIndexOf("/");effect.baseDir=dirIndex>=0?data.slice(0,dirIndex+1):"";_loadBinFile(data,function(buffer){effect._load(buffer);},effect.onerror);}else if(data instanceof ArrayBuffer){var buffer=data;effect._load(buffer);} +return effect;} +},{key:"loadEffectPackage",value:function loadEffectPackage(path,Unzip){var scale=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1.0;var onload=arguments[3];var onerror=arguments[4];if(Unzip==null)this._makeContextCurrent();var effect=new EffekseerEffect(this);effect.scale=scale;effect.onload=onload;effect.onerror=onerror;if(typeof path==="string"){var dirIndex=path.lastIndexOf("/");effect.baseDir=dirIndex>=0?path.slice(0,dirIndex+1):"";_loadBinFile(path,function(buffer){effect._loadFromPackage(buffer,Unzip);},effect.onerror);}else if(path instanceof ArrayBuffer){var buffer=path;effect._loadFromPackage(buffer,Unzip);} +return effect;} +},{key:"releaseEffect",value:function releaseEffect(effect){this._makeContextCurrent();if(effect==null){console.warn("the effect is null.");return;} +if(!effect.isLoaded){console.warn("the effect has not be loaded yet.");return;} +if(effect.nativeptr==null){console.warn("the effect has been released.");return;} +Core.ReleaseEffect(this.nativeptr,effect.nativeptr);effect.nativeptr=null;} +},{key:"play",value:function play(effect,x,y,z){if(!effect||!effect.isLoaded){return null;} +if(x===undefined)x=0;if(y===undefined)y=0;if(z===undefined)z=0;var handle=Core.PlayEffect(this.nativeptr,effect.nativeptr,x,y,z);return handle>=0?new EffekseerHandle(this,handle):null;} +},{key:"stopAll",value:function stopAll(){Core.StopAllEffects(this.nativeptr);} +},{key:"setResourceLoader",value:function setResourceLoader(loader){_loadResource=loader;} +},{key:"getRestInstancesCount",value:function getRestInstancesCount(){return Core.GetRestInstancesCount(this.nativeptr);} +},{key:"getUpdateTime",value:function getUpdateTime(){return Core.GetUpdateTime(this.nativeptr);} +},{key:"getDrawTime",value:function getDrawTime(){return Core.GetDrawTime(this.nativeptr);} +},{key:"isVertexArrayObjectSupported",value:function isVertexArrayObjectSupported(){return Core.IsVertexArrayObjectSupported(this.nativeptr);} +},{key:"setRestorationOfStatesFlag",value:function setRestorationOfStatesFlag(flag){this._restorationOfStatesFlag=flag;Core.SetRestorationOfStatesFlag(this.nativeptr,flag);} +},{key:"captureBackground",value:function captureBackground(x,y,width,height){return Core.CaptureBackground(this.nativeptr,x,y,width,height);} +},{key:"resetBackground",value:function resetBackground(){return Core.ResetBackground(this.nativeptr);}}]);return EffekseerContext;}();var Effekseer=function(){function Effekseer(){_classCallCheck(this,Effekseer);} +_createClass(Effekseer,[{key:"initRuntime",value:function initRuntime(path,onload,onerror){if(typeof effekseer_native==="undefined"){onload();return;} +_onloadAssembly=onload;_onerrorAssembly=onerror;_initalize_wasm(path);} +},{key:"createContext",value:function createContext(){if(!_is_runtime_initialized){return null;} +return new EffekseerContext();} +},{key:"releaseContext",value:function releaseContext(context){if(context.contextStates){context.contextStates.release();} +if(context._gl){context._gl=null;} +if(context.nativeptr==null){return;} +Core.Terminate(context.nativeptr);context.nativeptr=null;} +},{key:"setLogEnabled",value:function setLogEnabled(flag){Core.SetLogEnabled(flag);} +},{key:"setImageCrossOrigin",value:function setImageCrossOrigin(crossOrigin){_imageCrossOrigin=crossOrigin;} +},{key:"init",value:function init(webglContext,settings){console.warn('deprecated : please use through createContext.');this.defaultContext=new EffekseerContext();this.defaultContext.init(webglContext,settings);} +},{key:"update",value:function update(deltaFrames){console.warn('deprecated : please use through createContext.');this.defaultContext.update(deltaFrames);}},{key:"beginUpdate",value:function beginUpdate(){console.warn('deprecated : please use through createContext.');this.defaultContext.beginUpdate();}},{key:"endUpdate",value:function endUpdate(){console.warn('deprecated : please use through createContext.');this.defaultContext.endUpdate();}},{key:"updateHandle",value:function updateHandle(handle,deltaFrames){console.warn('deprecated : please use through createContext.');this.defaultContext.updateHandle(handle,deltaFrames);} +},{key:"draw",value:function draw(){console.warn('deprecated : please use through createContext.');this.defaultContext.draw();}},{key:"beginDraw",value:function beginDraw(){console.warn('deprecated : please use through createContext.');this.defaultContext.beginDraw();}},{key:"endDraw",value:function endDraw(){console.warn('deprecated : please use through createContext.');this.defaultContext.endDraw();}},{key:"drawHandle",value:function drawHandle(handle){console.warn('deprecated : please use through createContext.');this.defaultContext.drawHandle(handle);} +},{key:"setProjectionMatrix",value:function setProjectionMatrix(matrixArray){console.warn('deprecated : please use through createContext.');this.defaultContext.setProjectionMatrix(matrixArray);} +},{key:"setProjectionPerspective",value:function setProjectionPerspective(fov,aspect,near,far){console.warn('deprecated : please use through createContext.');this.defaultContext.SetProjectionPerspective(fov,aspect,near,far);} +},{key:"setProjectionOrthographic",value:function setProjectionOrthographic(width,height,near,far){console.warn('deprecated : please use through createContext.');this.defaultContext.setProjectionOrthographic(width,height,near,far);} +},{key:"setCameraMatrix",value:function setCameraMatrix(matrixArray){console.warn('deprecated : please use through createContext.');this.defaultContext.setCameraMatrix(matrixArray);} +},{key:"setCameraLookAt",value:function setCameraLookAt(positionX,positionY,positionZ,targetX,targetY,targetZ,upvecX,upvecY,upvecZ){console.warn('deprecated : please use through createContext.');this.defaultContext.setCameraLookAt(positionX,positionY,positionZ,targetX,targetY,targetZ,upvecX,upvecY,upvecZ);} +},{key:"setCameraLookAtFromVector",value:function setCameraLookAtFromVector(position,target,upvec){console.warn('deprecated : please use through createContext.');this.defaultContext.setCameraLookAtFromVector(position,target,upvec);} +},{key:"loadEffect",value:function loadEffect(path){var scale=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1.0;var onload=arguments[2];var onerror=arguments[3];console.warn('deprecated : please use through createContext.');return this.defaultContext.loadEffect(path,scale,onload,onerror);} +},{key:"releaseEffect",value:function releaseEffect(effect){console.warn('deprecated : please use through createContext.');this.defaultContext.releaseEffect(effect);} +},{key:"play",value:function play(effect,x,y,z){console.warn('deprecated : please use through createContext.');return this.defaultContext.play(effect,x,y,z);} +},{key:"stopAll",value:function stopAll(){console.warn('deprecated : please use through createContext.');this.defaultContext.stopAll();} +},{key:"setResourceLoader",value:function setResourceLoader(loader){console.warn('deprecated : please use through createContext.');this.defaultContext.setResourceLoader(loader);} +},{key:"isVertexArrayObjectSupported",value:function isVertexArrayObjectSupported(){console.warn('deprecated : please use through createContext.');return this.defaultContext.isVertexArrayObjectSupported();}}]);return Effekseer;}();return new Effekseer();}();if(typeof exports!=='undefined'){exports=effekseer;} \ No newline at end of file diff --git a/js/libs/effekseer.wasm b/js/libs/effekseer.wasm new file mode 100644 index 0000000..e91daf4 Binary files /dev/null and b/js/libs/effekseer.wasm differ diff --git a/js/libs/localforage.min.js b/js/libs/localforage.min.js new file mode 100644 index 0000000..eb87534 --- /dev/null +++ b/js/libs/localforage.min.js @@ -0,0 +1,7 @@ +/*! + localForage -- Offline Storage, Improved + Version 1.7.3 + https://localforage.github.io/localForage + (c) 2013-2017 Mozilla, Apache License 2.0 +*/ +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.localforage=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g=43)}}).catch(function(){return!1})}function n(a){return"boolean"==typeof xa?va.resolve(xa):m(a).then(function(a){return xa=a})}function o(a){var b=ya[a.name],c={};c.promise=new va(function(a,b){c.resolve=a,c.reject=b}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function p(a){var b=ya[a.name],c=b.deferredOperations.pop();if(c)return c.resolve(),c.promise}function q(a,b){var c=ya[a.name],d=c.deferredOperations.pop();if(d)return d.reject(b),d.promise}function r(a,b){return new va(function(c,d){if(ya[a.name]=ya[a.name]||B(),a.db){if(!b)return c(a.db);o(a),a.db.close()}var e=[a.name];b&&e.push(a.version);var f=ua.open.apply(ua,e);b&&(f.onupgradeneeded=function(b){var c=f.result;try{c.createObjectStore(a.storeName),b.oldVersion<=1&&c.createObjectStore(wa)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.')}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){c(f.result),p(a)}})}function s(a){return r(a,!1)}function t(a){return r(a,!0)}function u(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function v(a){return new va(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function w(a){return g([l(atob(a.data))],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function y(a){var b=this,c=b._initReady().then(function(){var a=ya[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return i(c,a,a),c}function z(a){o(a);for(var b=ya[a.name],c=b.forages,d=0;d0&&(!a.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return va.resolve().then(function(){if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),t(a)}).then(function(){return z(a).then(function(){A(a,b,c,d-1)})}).catch(c);c(e)}}function B(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(a){function b(){return va.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=ya[d.name];f||(f=B(),ya[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=y);for(var g=[],h=0;h>4,k[i++]=(15&d)<<4|e>>2,k[i++]=(3&e)<<6|63&f;return j}function O(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=Da[(3&c[b])<<4|c[b+1]>>4],d+=Da[(15&c[b+1])<<2|c[b+2]>>6],d+=Da[63&c[b+2]];return c.length%3==2?d=d.substring(0,d.length-1)+"=":c.length%3==1&&(d=d.substring(0,d.length-2)+"=="),d}function P(a,b){var c="";if(a&&(c=Ua.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Ua.call(a.buffer))){var d,e=Ga;a instanceof ArrayBuffer?(d=a,e+=Ia):(d=a.buffer,"[object Int8Array]"===c?e+=Ka:"[object Uint8Array]"===c?e+=La:"[object Uint8ClampedArray]"===c?e+=Ma:"[object Int16Array]"===c?e+=Na:"[object Uint16Array]"===c?e+=Pa:"[object Int32Array]"===c?e+=Oa:"[object Uint32Array]"===c?e+=Qa:"[object Float32Array]"===c?e+=Ra:"[object Float64Array]"===c?e+=Sa:b(new Error("Failed to get type for BinaryArray"))),b(e+O(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=Ea+a.type+"~"+O(this.result);b(Ga+Ja+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function Q(a){if(a.substring(0,Ha)!==Ga)return JSON.parse(a);var b,c=a.substring(Ta),d=a.substring(Ha,Ta);if(d===Ja&&Fa.test(c)){var e=c.match(Fa);b=e[1],c=c.substring(e[0].length)}var f=N(c);switch(d){case Ia:return f;case Ja:return g([f],{type:b});case Ka:return new Int8Array(f);case La:return new Uint8Array(f);case Ma:return new Uint8ClampedArray(f);case Na:return new Int16Array(f);case Pa:return new Uint16Array(f);case Oa:return new Int32Array(f);case Qa:return new Uint32Array(f);case Ra:return new Float32Array(f);case Sa:return new Float64Array(f);default:throw new Error("Unkown type: "+d)}}function R(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function S(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];var e=new va(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){R(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Va,e}function T(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):R(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function U(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function V(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;h0)return void f(W.apply(e,[a,h,c,d-1]));g(b)}})})}).catch(g)});return h(f,c),f}function X(a,b,c){return W.apply(this,[a,b,c,1])}function Y(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function Z(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function $(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function _(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function aa(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f0}function ha(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=ea(a,b._defaultConfig),ga()?(b._dbInfo=c,c.serializer=Va,va.resolve()):va.reject()}function ia(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;c>=0;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return h(c,a),c}function ja(a,b){var c=this;a=j(a);var d=c.ready().then(function(){var b=c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return h(d,b),d}function ka(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=localStorage.length,g=1,h=0;h=0;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):va.reject("Invalid arguments"),h(d,b),d}function ra(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function sa(){for(var a=1;a>>6:(a<65536?e[r++]=224|a>>>12:(e[r++]=240|a>>>18,e[r++]=128|a>>>12&63),e[r++]=128|a>>>6&63),e[r++]=128|63&a);return e},a.buf2binstring=function(t){return d(t,t.length)},a.binstring2buf=function(t){for(var e=new l.Buf8(t.length),a=0,i=e.length;a>10&1023,o[i++]=56320|1023&n)}return d(o,i)},a.utf8border=function(t,e){var a;for((e=e||t.length)>t.length&&(e=t.length),a=e-1;0<=a&&128==(192&t[a]);)a--;return a<0?e:0===a?e:a+h[t[a]]>e?a:e}},{"./common":3}],5:[function(t,e,a){"use strict";e.exports=function(t,e,a,i){for(var n=65535&t|0,r=t>>>16&65535|0,s=0;0!==a;){for(a-=s=2e3>>1:t>>>1;e[a]=t}return e}();e.exports=function(t,e,a,i){var n=o,r=i+a;t^=-1;for(var s=i;s>>8^n[255&(t^e[s])];return-1^t}},{}],8:[function(t,e,a){"use strict";var l,_=t("../utils/common"),h=t("./trees"),u=t("./adler32"),c=t("./crc32"),i=t("./messages"),d=0,f=4,b=0,g=-2,m=-1,w=4,n=2,p=8,v=9,r=286,s=30,o=19,k=2*r+1,y=15,x=3,z=258,B=z+x+1,S=42,E=113,A=1,Z=2,R=3,C=4;function N(t,e){return t.msg=i[e],e}function O(t){return(t<<1)-(4t.avail_out&&(a=t.avail_out),0!==a&&(_.arraySet(t.output,e.pending_buf,e.pending_out,a,t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))}function U(t,e){h._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,I(t.strm)}function T(t,e){t.pending_buf[t.pending++]=e}function F(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function L(t,e){var a,i,n=t.max_chain_length,r=t.strstart,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-B?t.strstart-(t.w_size-B):0,h=t.window,d=t.w_mask,f=t.prev,_=t.strstart+z,u=h[r+s-1],c=h[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(h[(a=e)+s]===c&&h[a+s-1]===u&&h[a]===h[r]&&h[++a]===h[r+1]){r+=2,a++;do{}while(h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&r<_);if(i=z-(_-r),r=_-z,sl&&0!=--n);return s<=t.lookahead?s:t.lookahead}function H(t){var e,a,i,n,r,s,o,l,h,d,f=t.w_size;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=f+(f-B)){for(_.arraySet(t.window,t.window,f,f,0),t.match_start-=f,t.strstart-=f,t.block_start-=f,e=a=t.hash_size;i=t.head[--e],t.head[e]=f<=i?i-f:0,--a;);for(e=a=f;i=t.prev[--e],t.prev[e]=f<=i?i-f:0,--a;);n+=f}if(0===t.strm.avail_in)break;if(s=t.strm,o=t.window,l=t.strstart+t.lookahead,h=n,d=void 0,d=s.avail_in,h=x)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<=x&&(t.ins_h=(t.ins_h<=x)if(i=h._tr_tally(t,t.strstart-t.match_start,t.match_length-x),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=x){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=x&&(t.ins_h=(t.ins_h<=x&&t.match_length<=t.prev_length){for(n=t.strstart+t.lookahead-x,i=h._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-x),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=n&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(H(t),0===t.lookahead&&e===d)return A;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+a;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,U(t,!1),0===t.strm.avail_out))return A;if(t.strstart-t.block_start>=t.w_size-B&&(U(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(U(t,!0),0===t.strm.avail_out?R:C):(t.strstart>t.block_start&&(U(t,!1),t.strm.avail_out),A)}),new M(4,4,8,4,j),new M(4,5,16,8,j),new M(4,6,32,32,j),new M(4,4,16,16,K),new M(8,16,32,32,K),new M(8,16,128,128,K),new M(8,32,128,256,K),new M(32,128,258,1024,K),new M(32,258,258,4096,K)],a.deflateInit=function(t,e){return G(t,e,p,15,8,0)},a.deflateInit2=G,a.deflateReset=q,a.deflateResetKeep=Y,a.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=e,b):g},a.deflate=function(t,e){var a,i,n,r;if(!t||!t.state||5>8&255),T(i,i.gzhead.time>>16&255),T(i,i.gzhead.time>>24&255),T(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),T(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(T(i,255&i.gzhead.extra.length),T(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=c(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(T(i,0),T(i,0),T(i,0),T(i,0),T(i,0),T(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),T(i,3),i.status=E);else{var s=p+(i.w_bits-8<<4)<<8;s|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(s|=32),s+=31-s%31,i.status=E,F(i,s),0!==i.strstart&&(F(i,t.adler>>>16),F(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(t.adler=c(t.adler,i.pending_buf,i.pending-n,n)),I(t),n=i.pending,i.pending!==i.pending_buf_size));)T(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=c(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=c(t.adler,i.pending_buf,i.pending-n,n)),I(t),n=i.pending,i.pending===i.pending_buf_size)){r=1;break}T(i,r=i.gzindexn&&(t.adler=c(t.adler,i.pending_buf,i.pending-n,n)),0===r&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=c(t.adler,i.pending_buf,i.pending-n,n)),I(t),n=i.pending,i.pending===i.pending_buf_size)){r=1;break}T(i,r=i.gzindexn&&(t.adler=c(t.adler,i.pending_buf,i.pending-n,n)),0===r&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&I(t),i.pending+2<=i.pending_buf_size&&(T(i,255&t.adler),T(i,t.adler>>8&255),t.adler=0,i.status=E)):i.status=E),0!==i.pending){if(I(t),0===t.avail_out)return i.last_flush=-1,b}else if(0===t.avail_in&&O(e)<=O(a)&&e!==f)return N(t,-5);if(666===i.status&&0!==t.avail_in)return N(t,-5);if(0!==t.avail_in||0!==i.lookahead||e!==d&&666!==i.status){var o=2===i.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(H(t),0===t.lookahead)){if(e===d)return A;break}if(t.match_length=0,a=h._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(U(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(U(t,!0),0===t.strm.avail_out?R:C):t.last_lit&&(U(t,!1),0===t.strm.avail_out)?A:Z}(i,e):3===i.strategy?function(t,e){for(var a,i,n,r,s=t.window;;){if(t.lookahead<=z){if(H(t),t.lookahead<=z&&e===d)return A;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=x&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=x?(a=h._tr_tally(t,1,t.match_length-x),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=h._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(U(t,!1),0===t.strm.avail_out))return A}return t.insert=0,e===f?(U(t,!0),0===t.strm.avail_out?R:C):t.last_lit&&(U(t,!1),0===t.strm.avail_out)?A:Z}(i,e):l[i.level].func(i,e);if(o!==R&&o!==C||(i.status=666),o===A||o===R)return 0===t.avail_out&&(i.last_flush=-1),b;if(o===Z&&(1===e?h._tr_align(i):5!==e&&(h._tr_stored_block(i,0,0,!1),3===e&&(D(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),I(t),0===t.avail_out))return i.last_flush=-1,b}return e!==f?b:i.wrap<=0?1:(2===i.wrap?(T(i,255&t.adler),T(i,t.adler>>8&255),T(i,t.adler>>16&255),T(i,t.adler>>24&255),T(i,255&t.total_in),T(i,t.total_in>>8&255),T(i,t.total_in>>16&255),T(i,t.total_in>>24&255)):(F(i,t.adler>>>16),F(i,65535&t.adler)),I(t),0=a.w_size&&(0===r&&(D(a.head),a.strstart=0,a.block_start=0,a.insert=0),h=new _.Buf8(a.w_size),_.arraySet(h,e,d-a.w_size,a.w_size,0),e=h,d=a.w_size),s=t.avail_in,o=t.next_in,l=t.input,t.avail_in=d,t.next_in=0,t.input=e,H(a);a.lookahead>=x;){for(i=a.strstart,n=a.lookahead-(x-1);a.ins_h=(a.ins_h<>>=v=p>>>24,c-=v,0===(v=p>>>16&255))S[r++]=65535&p;else{if(!(16&v)){if(0==(64&v)){p=b[(65535&p)+(u&(1<>>=v,c-=v),c<15&&(u+=B[i++]<>>=v=p>>>24,c-=v,!(16&(v=p>>>16&255))){if(0==(64&v)){p=g[(65535&p)+(u&(1<>>=v,c-=v,(v=r-s)>3,u&=(1<<(c-=k<<3))-1,t.next_in=i,t.next_out=r,t.avail_in=i>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function r(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Z.Buf16(320),this.work=new Z.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=F,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Z.Buf32(i),e.distcode=e.distdyn=new Z.Buf32(n),e.sane=1,e.back=-1,U):T}function o(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,s(t)):T}function l(t,e){var a,i;return t&&t.state?(i=t.state,e<0?(a=0,e=-e):(a=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=r.wsize?(Z.arraySet(r.window,e,a-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(i<(n=r.wsize-r.wnext)&&(n=i),Z.arraySet(r.window,e,a-i,n,r.wnext),(i-=n)?(Z.arraySet(r.window,e,a-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,a.check=C(a.check,E,2,0),d=h=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=30;break}if(8!=(15&h)){t.msg="unknown compression method",a.mode=30;break}if(d-=4,y=8+(15&(h>>>=4)),0===a.wbits)a.wbits=y;else if(y>a.wbits){t.msg="invalid window size",a.mode=30;break}a.dmax=1<>8&1),512&a.flags&&(E[0]=255&h,E[1]=h>>>8&255,a.check=C(a.check,E,2,0)),d=h=0,a.mode=3;case 3:for(;d<32;){if(0===o)break t;o--,h+=i[r++]<>>8&255,E[2]=h>>>16&255,E[3]=h>>>24&255,a.check=C(a.check,E,4,0)),d=h=0,a.mode=4;case 4:for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>8),512&a.flags&&(E[0]=255&h,E[1]=h>>>8&255,a.check=C(a.check,E,2,0)),d=h=0,a.mode=5;case 5:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>>8&255,a.check=C(a.check,E,2,0)),d=h=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(o<(u=a.length)&&(u=o),u&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Array(a.head.extra_len)),Z.arraySet(a.head.extra,i,r,u,y)),512&a.flags&&(a.check=C(a.check,i,u,r)),o-=u,r+=u,a.length-=u),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===o)break t;for(u=0;y=i[r+u++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y)),y&&u>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=12;break;case 10:for(;d<32;){if(0===o)break t;o--,h+=i[r++]<>>=7&d,d-=7&d,a.mode=27;break}for(;d<3;){if(0===o)break t;o--,h+=i[r++]<>>=1)){case 0:a.mode=14;break;case 1:if(H(a),a.mode=20,6!==e)break;h>>>=2,d-=2;break t;case 2:a.mode=17;break;case 3:t.msg="invalid block type",a.mode=30}h>>>=2,d-=2;break;case 14:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&h,d=h=0,a.mode=15,6===e)break t;case 15:a.mode=16;case 16:if(u=a.length){if(o>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,286>>=3,d-=3}for(;a.have<19;)a.lens[A[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,z={bits:a.lenbits},x=O(0,a.lens,0,19,a.lencode,0,a.work,z),a.lenbits=z.bits,x){t.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have>>16&255,w=65535&S,!((g=S>>>24)<=d);){if(0===o)break t;o--,h+=i[r++]<>>=g,d-=g,a.lens[a.have++]=w;else{if(16===w){for(B=g+2;d>>=g,d-=g,0===a.have){t.msg="invalid bit length repeat",a.mode=30;break}y=a.lens[a.have-1],u=3+(3&h),h>>>=2,d-=2}else if(17===w){for(B=g+3;d>>=g)),h>>>=3,d-=3}else{for(B=g+7;d>>=g)),h>>>=7,d-=7}if(a.have+u>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=30;break}for(;u--;)a.lens[a.have++]=y}}if(30===a.mode)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,z={bits:a.lenbits},x=O(D,a.lens,0,a.nlen,a.lencode,0,a.work,z),a.lenbits=z.bits,x){t.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,z={bits:a.distbits},x=O(I,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,z),a.distbits=z.bits,x){t.msg="invalid distances set",a.mode=30;break}if(a.mode=20,6===e)break t;case 20:a.mode=21;case 21:if(6<=o&&258<=l){t.next_out=s,t.avail_out=l,t.next_in=r,t.avail_in=o,a.hold=h,a.bits=d,N(t,_),s=t.next_out,n=t.output,l=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,12===a.mode&&(a.back=-1);break}for(a.back=0;m=(S=a.lencode[h&(1<>>16&255,w=65535&S,!((g=S>>>24)<=d);){if(0===o)break t;o--,h+=i[r++]<>p)])>>>16&255,w=65535&S,!(p+(g=S>>>24)<=d);){if(0===o)break t;o--,h+=i[r++]<>>=p,d-=p,a.back+=p}if(h>>>=g,d-=g,a.back+=g,a.length=w,0===m){a.mode=26;break}if(32&m){a.back=-1,a.mode=12;break}if(64&m){t.msg="invalid literal/length code",a.mode=30;break}a.extra=15&m,a.mode=22;case 22:if(a.extra){for(B=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;m=(S=a.distcode[h&(1<>>16&255,w=65535&S,!((g=S>>>24)<=d);){if(0===o)break t;o--,h+=i[r++]<>p)])>>>16&255,w=65535&S,!(p+(g=S>>>24)<=d);){if(0===o)break t;o--,h+=i[r++]<>>=p,d-=p,a.back+=p}if(h>>>=g,d-=g,a.back+=g,64&m){t.msg="invalid distance code",a.mode=30;break}a.offset=w,a.extra=15&m,a.mode=24;case 24:if(a.extra){for(B=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(0===l)break t;if(u=_-l,a.offset>u){if((u=a.offset-u)>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=30;break}u>a.wnext?(u-=a.wnext,c=a.wsize-u):c=a.wnext-u,u>a.length&&(u=a.length),b=a.window}else b=n,c=s-a.offset,u=a.length;for(lu?(b=N[O+s[p]],g=A[Z+s[p]]):(b=96,g=0),l=1<>z)+(h-=l)]=c<<24|b<<16|g|0,0!==h;);for(l=1<>=1;if(0!==l?(E&=l-1,E+=l):E=0,p++,0==--R[w]){if(w===k)break;w=e[a+s[p]]}if(y>>7)]}function T(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function F(t,e,a){t.bi_valid>n-a?(t.bi_buf|=e<>n-t.bi_valid,t.bi_valid+=a-n):(t.bi_buf|=e<>>=1,a<<=1,0<--e;);return a>>>1}function j(t,e,a){var i,n,r=new Array(m+1),s=0;for(i=1;i<=m;i++)r[i]=s=s+a[i-1]<<1;for(n=0;n<=e;n++){var o=t[2*n+1];0!==o&&(t[2*n]=H(r[o]++,o))}}function K(t){var e;for(e=0;e<_;e++)t.dyn_ltree[2*e]=0;for(e=0;e>1;1<=a;a--)Y(t,r,a);for(n=l;a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Y(t,r,1),i=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=i,r[2*n]=r[2*a]+r[2*i],t.depth[n]=(t.depth[a]>=t.depth[i]?t.depth[a]:t.depth[i])+1,r[2*a+1]=r[2*i+1]=n,t.heap[1]=n++,Y(t,r,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,i,n,r,s,o,l=e.dyn_tree,h=e.max_code,d=e.stat_desc.static_tree,f=e.stat_desc.has_stree,_=e.stat_desc.extra_bits,u=e.stat_desc.extra_base,c=e.stat_desc.max_length,b=0;for(r=0;r<=m;r++)t.bl_count[r]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a>=7;i>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return o;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return h;for(e=32;e>>3,(r=t.static_len+3+7>>>3)<=n&&(n=r)):n=r=a+5,a+4<=n&&-1!==e?Q(t,e,a,i):4===t.strategy||r===n?(F(t,2+(i?1:0),3),q(t,S,E)):(F(t,4+(i?1:0),3),function(t,e,a,i){var n;for(F(t,e-257,5),F(t,a-1,5),F(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(Z[a]+f+1)]++,t.dyn_dtree[2*U(e)]++),t.last_lit===t.lit_bufsize-1},a._tr_align=function(t){var e;F(t,2,3),L(t,w,S),16===(e=t).bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":3}],15:[function(t,e,a){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/":[function(t,e,a){"use strict";var i={};(0,t("./lib/utils/common").assign)(i,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=i},{"./lib/deflate":1,"./lib/inflate":2,"./lib/utils/common":3,"./lib/zlib/constants":6}]},{},[])("/")}); diff --git a/js/libs/pixi.js b/js/libs/pixi.js new file mode 100644 index 0000000..e9d11bc --- /dev/null +++ b/js/libs/pixi.js @@ -0,0 +1,41996 @@ +/*! + * pixi.js - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * pixi.js is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ +var PIXI = (function (exports) { + 'use strict'; + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); + } + + function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + function getCjsExportFromNamespace (n) { + return n && n['default'] || n; + } + + var promise = createCommonjsModule(function (module, exports) { + (function(global){ + + // + // Check for native Promise and it has correct interface + // + + var NativePromise = global['Promise']; + var nativePromiseSupported = + NativePromise && + // Some of these methods are missing from + // Firefox/Chrome experimental implementations + 'resolve' in NativePromise && + 'reject' in NativePromise && + 'all' in NativePromise && + 'race' in NativePromise && + // Older version of the spec had a resolver object + // as the arg rather than a function + (function(){ + var resolve; + new NativePromise(function(r){ resolve = r; }); + return typeof resolve === 'function'; + })(); + + + // + // export if necessary + // + + if ('object' !== 'undefined' && exports) + { + // node.js + exports.Promise = nativePromiseSupported ? NativePromise : Promise; + exports.Polyfill = Promise; + } + else + { + // AMD + if (typeof undefined == 'function' && undefined.amd) + { + undefined(function(){ + return nativePromiseSupported ? NativePromise : Promise; + }); + } + else + { + // in browser add to global + if (!nativePromiseSupported) + { global['Promise'] = Promise; } + } + } + + + // + // Polyfill + // + + var PENDING = 'pending'; + var SEALED = 'sealed'; + var FULFILLED = 'fulfilled'; + var REJECTED = 'rejected'; + var NOOP = function(){}; + + function isArray(value) { + return Object.prototype.toString.call(value) === '[object Array]'; + } + + // async calls + var asyncSetTimer = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout; + var asyncQueue = []; + var asyncTimer; + + function asyncFlush(){ + // run promise callbacks + for (var i = 0; i < asyncQueue.length; i++) + { asyncQueue[i][0](asyncQueue[i][1]); } + + // reset async asyncQueue + asyncQueue = []; + asyncTimer = false; + } + + function asyncCall(callback, arg){ + asyncQueue.push([callback, arg]); + + if (!asyncTimer) + { + asyncTimer = true; + asyncSetTimer(asyncFlush, 0); + } + } + + + function invokeResolver(resolver, promise) { + function resolvePromise(value) { + resolve(promise, value); + } + + function rejectPromise(reason) { + reject(promise, reason); + } + + try { + resolver(resolvePromise, rejectPromise); + } catch(e) { + rejectPromise(e); + } + } + + function invokeCallback(subscriber){ + var owner = subscriber.owner; + var settled = owner.state_; + var value = owner.data_; + var callback = subscriber[settled]; + var promise = subscriber.then; + + if (typeof callback === 'function') + { + settled = FULFILLED; + try { + value = callback(value); + } catch(e) { + reject(promise, e); + } + } + + if (!handleThenable(promise, value)) + { + if (settled === FULFILLED) + { resolve(promise, value); } + + if (settled === REJECTED) + { reject(promise, value); } + } + } + + function handleThenable(promise, value) { + var resolved; + + try { + if (promise === value) + { throw new TypeError('A promises callback cannot return that same promise.'); } + + if (value && (typeof value === 'function' || typeof value === 'object')) + { + var then = value.then; // then should be retrived only once + + if (typeof then === 'function') + { + then.call(value, function(val){ + if (!resolved) + { + resolved = true; + + if (value !== val) + { resolve(promise, val); } + else + { fulfill(promise, val); } + } + }, function(reason){ + if (!resolved) + { + resolved = true; + + reject(promise, reason); + } + }); + + return true; + } + } + } catch (e) { + if (!resolved) + { reject(promise, e); } + + return true; + } + + return false; + } + + function resolve(promise, value){ + if (promise === value || !handleThenable(promise, value)) + { fulfill(promise, value); } + } + + function fulfill(promise, value){ + if (promise.state_ === PENDING) + { + promise.state_ = SEALED; + promise.data_ = value; + + asyncCall(publishFulfillment, promise); + } + } + + function reject(promise, reason){ + if (promise.state_ === PENDING) + { + promise.state_ = SEALED; + promise.data_ = reason; + + asyncCall(publishRejection, promise); + } + } + + function publish(promise) { + var callbacks = promise.then_; + promise.then_ = undefined; + + for (var i = 0; i < callbacks.length; i++) { + invokeCallback(callbacks[i]); + } + } + + function publishFulfillment(promise){ + promise.state_ = FULFILLED; + publish(promise); + } + + function publishRejection(promise){ + promise.state_ = REJECTED; + publish(promise); + } + + /** + * @class + */ + function Promise(resolver){ + if (typeof resolver !== 'function') + { throw new TypeError('Promise constructor takes a function argument'); } + + if (this instanceof Promise === false) + { throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.'); } + + this.then_ = []; + + invokeResolver(resolver, this); + } + + Promise.prototype = { + constructor: Promise, + + state_: PENDING, + then_: null, + data_: undefined, + + then: function(onFulfillment, onRejection){ + var subscriber = { + owner: this, + then: new this.constructor(NOOP), + fulfilled: onFulfillment, + rejected: onRejection + }; + + if (this.state_ === FULFILLED || this.state_ === REJECTED) + { + // already resolved, call callback async + asyncCall(invokeCallback, subscriber); + } + else + { + // subscribe + this.then_.push(subscriber); + } + + return subscriber.then; + }, + + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + + Promise.all = function(promises){ + var Class = this; + + if (!isArray(promises)) + { throw new TypeError('You must pass an array to Promise.all().'); } + + return new Class(function(resolve, reject){ + var results = []; + var remaining = 0; + + function resolver(index){ + remaining++; + return function(value){ + results[index] = value; + if (!--remaining) + { resolve(results); } + }; + } + + for (var i = 0, promise; i < promises.length; i++) + { + promise = promises[i]; + + if (promise && typeof promise.then === 'function') + { promise.then(resolver(i), reject); } + else + { results[i] = promise; } + } + + if (!remaining) + { resolve(results); } + }); + }; + + Promise.race = function(promises){ + var Class = this; + + if (!isArray(promises)) + { throw new TypeError('You must pass an array to Promise.race().'); } + + return new Class(function(resolve, reject) { + for (var i = 0, promise; i < promises.length; i++) + { + promise = promises[i]; + + if (promise && typeof promise.then === 'function') + { promise.then(resolve, reject); } + else + { resolve(promise); } + } + }); + }; + + Promise.resolve = function(value){ + var Class = this; + + if (value && typeof value === 'object' && value.constructor === Class) + { return value; } + + return new Class(function(resolve){ + resolve(value); + }); + }; + + Promise.reject = function(reason){ + var Class = this; + + return new Class(function(resolve, reject){ + reject(reason); + }); + }; + + })(typeof window != 'undefined' ? window : typeof commonjsGlobal != 'undefined' ? commonjsGlobal : typeof self != 'undefined' ? self : commonjsGlobal); + }); + var promise_1 = promise.Promise; + var promise_2 = promise.Polyfill; + + /* + object-assign + (c) Sindre Sorhus + @license MIT + */ + + 'use strict'; + /* eslint-disable no-unused-vars */ + var getOwnPropertySymbols = Object.getOwnPropertySymbols; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; + + function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); + } + + function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } + } + + var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { + var arguments$1 = arguments; + + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments$1[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; + }; + + /*! + * @pixi/polyfill - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/polyfill is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + // Support for IE 9 - 11 which does not include Promises + if (!window.Promise) { + window.Promise = promise_2; + } + + // References: + if (!Object.assign) { + Object.assign = objectAssign; + } + + // References: + // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + // https://gist.github.com/1579671 + // http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision + // https://gist.github.com/timhall/4078614 + // https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame + // Expected to be used with Browserfiy + // Browserify automatically detects the use of `global` and passes the + // correct reference of `global`, `self`, and finally `window` + var ONE_FRAME_TIME = 16; + // Date.now + if (!(Date.now && Date.prototype.getTime)) { + Date.now = function now() { + return new Date().getTime(); + }; + } + // performance.now + if (!(window.performance && window.performance.now)) { + var startTime_1 = Date.now(); + if (!window.performance) { + window.performance = {}; + } + window.performance.now = function () { return Date.now() - startTime_1; }; + } + // requestAnimationFrame + var lastTime = Date.now(); + var vendors = ['ms', 'moz', 'webkit', 'o']; + for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { + var p = vendors[x]; + window.requestAnimationFrame = window[p + "RequestAnimationFrame"]; + window.cancelAnimationFrame = window[p + "CancelAnimationFrame"] + || window[p + "CancelRequestAnimationFrame"]; + } + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = function (callback) { + if (typeof callback !== 'function') { + throw new TypeError(callback + "is not a function"); + } + var currentTime = Date.now(); + var delay = ONE_FRAME_TIME + lastTime - currentTime; + if (delay < 0) { + delay = 0; + } + lastTime = currentTime; + return window.setTimeout(function () { + lastTime = Date.now(); + callback(performance.now()); + }, delay); + }; + } + if (!window.cancelAnimationFrame) { + window.cancelAnimationFrame = function (id) { return clearTimeout(id); }; + } + + // References: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign + if (!Math.sign) { + Math.sign = function mathSign(x) { + x = Number(x); + if (x === 0 || isNaN(x)) { + return x; + } + return x > 0 ? 1 : -1; + }; + } + + // References: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger + if (!Number.isInteger) { + Number.isInteger = function numberIsInteger(value) { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; + }; + } + + if (!window.ArrayBuffer) { + window.ArrayBuffer = Array; + } + if (!window.Float32Array) { + window.Float32Array = Array; + } + if (!window.Uint32Array) { + window.Uint32Array = Array; + } + if (!window.Uint16Array) { + window.Uint16Array = Array; + } + if (!window.Uint8Array) { + window.Uint8Array = Array; + } + if (!window.Int32Array) { + window.Int32Array = Array; + } + + var appleIphone = /iPhone/i; + var appleIpod = /iPod/i; + var appleTablet = /iPad/i; + var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; + var androidPhone = /\bAndroid(?:.+)Mobile\b/i; + var androidTablet = /Android/i; + var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; + var amazonTablet = /Silk/i; + var windowsPhone = /Windows Phone/i; + var windowsTablet = /\bWindows(?:.+)ARM\b/i; + var otherBlackBerry = /BlackBerry/i; + var otherBlackBerry10 = /BB10/i; + var otherOpera = /Opera Mini/i; + var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; + var otherFirefox = /Mobile(?:.+)Firefox\b/i; + var isAppleTabletOnIos13 = function (navigator) { + return (typeof navigator !== 'undefined' && + navigator.platform === 'MacIntel' && + typeof navigator.maxTouchPoints === 'number' && + navigator.maxTouchPoints > 1 && + typeof MSStream === 'undefined'); + }; + function createMatch(userAgent) { + return function (regex) { return regex.test(userAgent); }; + } + function isMobile(param) { + var nav = { + userAgent: '', + platform: '', + maxTouchPoints: 0 + }; + if (!param && typeof navigator !== 'undefined') { + nav = { + userAgent: navigator.userAgent, + platform: navigator.platform, + maxTouchPoints: navigator.maxTouchPoints || 0 + }; + } + else if (typeof param === 'string') { + nav.userAgent = param; + } + else if (param && param.userAgent) { + nav = { + userAgent: param.userAgent, + platform: param.platform, + maxTouchPoints: param.maxTouchPoints || 0 + }; + } + var userAgent = nav.userAgent; + var tmp = userAgent.split('[FBAN'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + tmp = userAgent.split('Twitter'); + if (typeof tmp[1] !== 'undefined') { + userAgent = tmp[0]; + } + var match = createMatch(userAgent); + var result = { + apple: { + phone: match(appleIphone) && !match(windowsPhone), + ipod: match(appleIpod), + tablet: !match(appleIphone) && + (match(appleTablet) || isAppleTabletOnIos13(nav)) && + !match(windowsPhone), + universal: match(appleUniversal), + device: (match(appleIphone) || + match(appleIpod) || + match(appleTablet) || + match(appleUniversal) || + isAppleTabletOnIos13(nav)) && + !match(windowsPhone) + }, + amazon: { + phone: match(amazonPhone), + tablet: !match(amazonPhone) && match(amazonTablet), + device: match(amazonPhone) || match(amazonTablet) + }, + android: { + phone: (!match(windowsPhone) && match(amazonPhone)) || + (!match(windowsPhone) && match(androidPhone)), + tablet: !match(windowsPhone) && + !match(amazonPhone) && + !match(androidPhone) && + (match(amazonTablet) || match(androidTablet)), + device: (!match(windowsPhone) && + (match(amazonPhone) || + match(amazonTablet) || + match(androidPhone) || + match(androidTablet))) || + match(/\bokhttp\b/i) + }, + windows: { + phone: match(windowsPhone), + tablet: match(windowsTablet), + device: match(windowsPhone) || match(windowsTablet) + }, + other: { + blackberry: match(otherBlackBerry), + blackberry10: match(otherBlackBerry10), + opera: match(otherOpera), + firefox: match(otherFirefox), + chrome: match(otherChrome), + device: match(otherBlackBerry) || + match(otherBlackBerry10) || + match(otherOpera) || + match(otherFirefox) || + match(otherChrome) + }, + any: false, + phone: false, + tablet: false + }; + result.any = + result.apple.device || + result.android.device || + result.windows.device || + result.other.device; + result.phone = + result.apple.phone || result.android.phone || result.windows.phone; + result.tablet = + result.apple.tablet || result.android.tablet || result.windows.tablet; + return result; + } + + /*! + * @pixi/settings - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + // The ESM/CJS versions of ismobilejs only + var isMobile$1 = isMobile(window.navigator); + + /** + * The maximum recommended texture units to use. + * In theory the bigger the better, and for desktop we'll use as many as we can. + * But some mobile devices slow down if there is to many branches in the shader. + * So in practice there seems to be a sweet spot size that varies depending on the device. + * + * In v4, all mobile devices were limited to 4 texture units because for this. + * In v5, we allow all texture units to be used on modern Apple or Android devices. + * + * @private + * @param {number} max + * @returns {number} + */ + function maxRecommendedTextures(max) { + var allowMax = true; + if (isMobile$1.tablet || isMobile$1.phone) { + if (isMobile$1.apple.device) { + var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below iOS 11, which will be older hardware + if (majorVersion < 11) { + allowMax = false; + } + } + } + if (isMobile$1.android.device) { + var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below Android 7 (Nougat), which will be older hardware + if (majorVersion < 7) { + allowMax = false; + } + } + } + } + return allowMax ? max : 4; + } + + /** + * Uploading the same buffer multiple times in a single frame can cause performance issues. + * Apparent on iOS so only check for that at the moment + * This check may become more complex if this issue pops up elsewhere. + * + * @private + * @returns {boolean} + */ + function canUploadSameBuffer() { + return !isMobile$1.apple.device; + } + + /** + * User's customizable globals for overriding the default PIXI settings, such + * as a renderer's default resolution, framerate, float precision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio; + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; + * @namespace PIXI.settings + */ + var settings = { + /** + * If set to true WebGL will attempt make textures mimpaped by default. + * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. + * + * @static + * @name MIPMAP_TEXTURES + * @memberof PIXI.settings + * @type {PIXI.MIPMAP_MODES} + * @default PIXI.MIPMAP_MODES.POW2 + */ + MIPMAP_TEXTURES: 1, + /** + * Default anisotropic filtering level of textures. + * Usually from 0 to 16 + * + * @static + * @name ANISOTROPIC_LEVEL + * @memberof PIXI.settings + * @type {number} + * @default 0 + */ + ANISOTROPIC_LEVEL: 0, + /** + * Default resolution / device pixel ratio of the renderer. + * + * @static + * @name RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + RESOLUTION: 1, + /** + * Default filter resolution. + * + * @static + * @name FILTER_RESOLUTION + * @memberof PIXI.settings + * @type {number} + * @default 1 + */ + FILTER_RESOLUTION: 1, + /** + * The maximum textures that this device supports. + * + * @static + * @name SPRITE_MAX_TEXTURES + * @memberof PIXI.settings + * @type {number} + * @default 32 + */ + SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), + // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 + // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 + /** + * The default sprite batch size. + * + * The default aims to balance desktop and mobile devices. + * + * @static + * @name SPRITE_BATCH_SIZE + * @memberof PIXI.settings + * @type {number} + * @default 4096 + */ + SPRITE_BATCH_SIZE: 4096, + /** + * The default render options if none are supplied to {@link PIXI.Renderer} + * or {@link PIXI.CanvasRenderer}. + * + * @static + * @name RENDER_OPTIONS + * @memberof PIXI.settings + * @type {object} + * @property {HTMLCanvasElement} view=null + * @property {number} resolution=1 + * @property {boolean} antialias=false + * @property {boolean} autoDensity=false + * @property {boolean} transparent=false + * @property {number} backgroundColor=0x000000 + * @property {boolean} clearBeforeRender=true + * @property {boolean} preserveDrawingBuffer=false + * @property {number} width=800 + * @property {number} height=600 + * @property {boolean} legacy=false + */ + RENDER_OPTIONS: { + view: null, + antialias: false, + autoDensity: false, + transparent: false, + backgroundColor: 0x000000, + clearBeforeRender: true, + preserveDrawingBuffer: false, + width: 800, + height: 600, + legacy: false, + }, + /** + * Default Garbage Collection mode. + * + * @static + * @name GC_MODE + * @memberof PIXI.settings + * @type {PIXI.GC_MODES} + * @default PIXI.GC_MODES.AUTO + */ + GC_MODE: 0, + /** + * Default Garbage Collection max idle. + * + * @static + * @name GC_MAX_IDLE + * @memberof PIXI.settings + * @type {number} + * @default 3600 + */ + GC_MAX_IDLE: 60 * 60, + /** + * Default Garbage Collection maximum check count. + * + * @static + * @name GC_MAX_CHECK_COUNT + * @memberof PIXI.settings + * @type {number} + * @default 600 + */ + GC_MAX_CHECK_COUNT: 60 * 10, + /** + * Default wrap modes that are supported by pixi. + * + * @static + * @name WRAP_MODE + * @memberof PIXI.settings + * @type {PIXI.WRAP_MODES} + * @default PIXI.WRAP_MODES.CLAMP + */ + WRAP_MODE: 33071, + /** + * Default scale mode for textures. + * + * @static + * @name SCALE_MODE + * @memberof PIXI.settings + * @type {PIXI.SCALE_MODES} + * @default PIXI.SCALE_MODES.LINEAR + */ + SCALE_MODE: 1, + /** + * Default specify float precision in vertex shader. + * + * @static + * @name PRECISION_VERTEX + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.HIGH + */ + PRECISION_VERTEX: 'highp', + /** + * Default specify float precision in fragment shader. + * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 + * + * @static + * @name PRECISION_FRAGMENT + * @memberof PIXI.settings + * @type {PIXI.PRECISION} + * @default PIXI.PRECISION.MEDIUM + */ + PRECISION_FRAGMENT: isMobile$1.apple.device ? 'highp' : 'mediump', + /** + * Can we upload the same buffer in a single frame? + * + * @static + * @name CAN_UPLOAD_SAME_BUFFER + * @memberof PIXI.settings + * @type {boolean} + */ + CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), + /** + * Enables bitmap creation before image load. This feature is experimental. + * + * @static + * @name CREATE_IMAGE_BITMAP + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + CREATE_IMAGE_BITMAP: false, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * + * @static + * @constant + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + ROUND_PIXELS: false, + }; + + var eventemitter3 = createCommonjsModule(function (module) { + 'use strict'; + + var has = Object.prototype.hasOwnProperty + , prefix = '~'; + + /** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ + function Events() {} + + // + // We try to not inherit from `Object.prototype`. In some engines creating an + // instance in this way is faster than calling `Object.create(null)` directly. + // If `Object.create(null)` is not supported we prefix the event names with a + // character to make sure that the built-in object properties are not + // overridden or used as an attack vector. + // + if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) { prefix = false; } + } + + /** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ + function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; + } + + /** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ + function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); + } + + var listener = new EE(fn, context || emitter, once) + , evt = prefix ? prefix + event : event; + + if (!emitter._events[evt]) { emitter._events[evt] = listener, emitter._eventsCount++; } + else if (!emitter._events[evt].fn) { emitter._events[evt].push(listener); } + else { emitter._events[evt] = [emitter._events[evt], listener]; } + + return emitter; + } + + /** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ + function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) { emitter._events = new Events(); } + else { delete emitter._events[evt]; } + } + + /** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ + function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; + } + + /** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ + EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) { return names; } + + for (name in (events = this._events)) { + if (has.call(events, name)) { names.push(prefix ? name.slice(1) : name); } + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; + }; + + /** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ + EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event + , handlers = this._events[evt]; + + if (!handlers) { return []; } + if (handlers.fn) { return [handlers.fn]; } + + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } + + return ee; + }; + + /** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ + EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event + , listeners = this._events[evt]; + + if (!listeners) { return 0; } + if (listeners.fn) { return 1; } + return listeners.length; + }; + + /** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ + EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var arguments$1 = arguments; + + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) { return false; } + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) { this.removeListener(event, listeners.fn, undefined, true); } + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments$1[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) { this.removeListener(event, listeners[i].fn, undefined, true); } + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) { for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments$1[j]; + } } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; + }; + + /** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); + }; + + /** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); + }; + + /** + * Remove the listeners of a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) { return this; } + if (!fn) { + clearEvent(this, evt); + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn && + (!once || listeners.once) && + (!context || listeners.context === context) + ) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn || + (once && !listeners[i].once) || + (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) { this._events[evt] = events.length === 1 ? events[0] : events; } + else { clearEvent(this, evt); } + } + + return this; + }; + + /** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ + EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) { clearEvent(this, evt); } + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; + }; + + // + // Alias methods names because people roll like that. + // + EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + // + // Expose the prefix. + // + EventEmitter.prefixed = prefix; + + // + // Allow `EventEmitter` to be imported as module namespace. + // + EventEmitter.EventEmitter = EventEmitter; + + // + // Expose the module. + // + if ('undefined' !== 'object') { + module.exports = EventEmitter; + } + }); + + 'use strict'; + + var earcut_1 = earcut; + var default_1 = earcut; + + function earcut(data, holeIndices, dim) { + + dim = dim || 2; + + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; + + if (!outerNode || outerNode.next === outerNode.prev) { return triangles; } + + var minX, minY, maxX, maxY, x, y, invSize; + + if (hasHoles) { outerNode = eliminateHoles(data, holeIndices, outerNode, dim); } + + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; + + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) { minX = x; } + if (y < minY) { minY = y; } + if (x > maxX) { maxX = x; } + if (y > maxY) { maxY = y; } + } + + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 1 / invSize : 0; + } + + earcutLinked(outerNode, triangles, dim, minX, minY, invSize); + + return triangles; + } + + // create a circular doubly linked list from polygon points in the specified winding order + function linkedList(data, start, end, dim, clockwise) { + var i, last; + + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) { last = insertNode(i, data[i], data[i + 1], last); } + } else { + for (i = end - dim; i >= start; i -= dim) { last = insertNode(i, data[i], data[i + 1], last); } + } + + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } + + return last; + } + + // eliminate colinear or duplicate points + function filterPoints(start, end) { + if (!start) { return start; } + if (!end) { end = start; } + + var p = start, + again; + do { + again = false; + + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) { break; } + again = true; + + } else { + p = p.next; + } + } while (again || p !== end); + + return end; + } + + // main ear slicing loop which triangulates a polygon (given as a linked list) + function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (!ear) { return; } + + // interlink polygon nodes in z-order + if (!pass && invSize) { indexCurve(ear, minX, minY, invSize); } + + var stop = ear, + prev, next; + + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; + + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim); + triangles.push(ear.i / dim); + triangles.push(next.i / dim); + + removeNode(ear); + + // skipping the next vertex leads to less sliver triangles + ear = next.next; + stop = next.next; + + continue; + } + + ear = next; + + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(filterPoints(ear), triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, invSize); + } + + break; + } + } + } + + // check whether a polygon node forms a valid ear with adjacent nodes + function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear + + // now make sure we don't have other points inside the potential ear + var p = ear.next.next; + + while (p !== ear.prev) { + if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) { return false; } + p = p.next; + } + + return true; + } + + function isEarHashed(ear, minX, minY, invSize) { + var a = ear.prev, + b = ear, + c = ear.next; + + if (area(a, b, c) >= 0) { return false; } // reflex, can't be an ear + + // triangle bbox; min & max are calculated like this for speed + var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), + minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), + maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), + maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + + // z-order range for the current triangle bbox; + var minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + + var p = ear.prevZ, + n = ear.nextZ; + + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.z <= maxZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) { return false; } + p = p.prevZ; + + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) { return false; } + n = n.nextZ; + } + + // look for remaining points in decreasing z-order + while (p && p.z >= minZ) { + if (p !== ear.prev && p !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && + area(p.prev, p, p.next) >= 0) { return false; } + p = p.prevZ; + } + + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n !== ear.prev && n !== ear.next && + pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && + area(n.prev, n, n.next) >= 0) { return false; } + n = n.nextZ; + } + + return true; + } + + // go through all polygon nodes and cure small local self-intersections + function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; + + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + + triangles.push(a.i / dim); + triangles.push(p.i / dim); + triangles.push(b.i / dim); + + // remove two nodes involved + removeNode(p); + removeNode(p.next); + + p = start = b; + } + p = p.next; + } while (p !== start); + + return filterPoints(p); + } + + // try splitting polygon into two and triangulate them independently + function splitEarcut(start, triangles, dim, minX, minY, invSize) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); + + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); + + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, invSize); + earcutLinked(c, triangles, dim, minX, minY, invSize); + return; + } + b = b.next; + } + a = a.next; + } while (a !== start); + } + + // link every hole into the outer loop, producing a single-ring polygon without holes + function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; + + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) { list.steiner = true; } + queue.push(getLeftmost(list)); + } + + queue.sort(compareX); + + // process holes from left to right + for (i = 0; i < queue.length; i++) { + outerNode = eliminateHole(queue[i], outerNode); + outerNode = filterPoints(outerNode, outerNode.next); + } + + return outerNode; + } + + function compareX(a, b) { + return a.x - b.x; + } + + // find a bridge between vertices that connects hole with an outer ring and and link it + function eliminateHole(hole, outerNode) { + var bridge = findHoleBridge(hole, outerNode); + if (!bridge) { + return outerNode; + } + + var bridgeReverse = splitPolygon(bridge, hole); + + // filter collinear points around the cuts + var filteredBridge = filterPoints(bridge, bridge.next); + filterPoints(bridgeReverse, bridgeReverse.next); + + // Check if input node was removed by the filtering + return outerNode === bridge ? filteredBridge : outerNode; + } + + // David Eberly's algorithm for finding a bridge between hole and outer polygon + function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; + + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + if (x === hx) { + if (hy === p.y) { return p; } + if (hy === p.next.y) { return p.next; } + } + m = p.x < p.next.x ? p : p.next; + } + } + p = p.next; + } while (p !== outerNode); + + if (!m) { return null; } + + if (hx === qx) { return m; } // hole touches outer segment; pick leftmost endpoint + + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point + + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; + + p = m; + + do { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { + + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential + + if (locallyInside(p, hole) && + (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { + m = p; + tanMin = tan; + } + } + + p = p.next; + } while (p !== stop); + + return m; + } + + // whether sector in vertex m contains sector in vertex p in the same coordinates + function sectorContainsSector(m, p) { + return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; + } + + // interlink polygon nodes in z-order + function indexCurve(start, minX, minY, invSize) { + var p = start; + do { + if (p.z === null) { p.z = zOrder(p.x, p.y, minX, minY, invSize); } + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); + } + + // Simon Tatham's linked list merge sort algorithm + // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html + function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) { break; } + } + qSize = inSize; + + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) { tail.nextZ = e; } + else { list = e; } + + e.prevZ = tail; + tail = e; + } + + p = q; + } + + tail.nextZ = null; + inSize *= 2; + + } while (numMerges > 1); + + return list; + } + + // z-order of a point given coords and inverse of the longer side of data bbox + function zOrder(x, y, minX, minY, invSize) { + // coords are transformed into non-negative 15-bit integer range + x = 32767 * (x - minX) * invSize; + y = 32767 * (y - minY) * invSize; + + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; + + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; + + return x | (y << 1); + } + + // find the leftmost node of a polygon ring + function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) { leftmost = p; } + p = p.next; + } while (p !== start); + + return leftmost; + } + + // check if a point lies within a convex triangle + function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && + (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && + (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; + } + + // check if a diagonal between two polygon nodes is valid (lies in polygon interior) + function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges + (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible + (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case + } + + // signed area of a triangle + function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); + } + + // check if two points are equal + function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; + } + + // check if two segments intersect + function intersects(p1, q1, p2, q2) { + var o1 = sign(area(p1, q1, p2)); + var o2 = sign(area(p1, q1, q2)); + var o3 = sign(area(p2, q2, p1)); + var o4 = sign(area(p2, q2, q1)); + + if (o1 !== o2 && o3 !== o4) { return true; } // general case + + if (o1 === 0 && onSegment(p1, p2, q1)) { return true; } // p1, q1 and p2 are collinear and p2 lies on p1q1 + if (o2 === 0 && onSegment(p1, q2, q1)) { return true; } // p1, q1 and q2 are collinear and q2 lies on p1q1 + if (o3 === 0 && onSegment(p2, p1, q2)) { return true; } // p2, q2 and p1 are collinear and p1 lies on p2q2 + if (o4 === 0 && onSegment(p2, q1, q2)) { return true; } // p2, q2 and q1 are collinear and q1 lies on p2q2 + + return false; + } + + // for collinear points p, q, r, check if point q lies on segment pr + function onSegment(p, q, r) { + return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); + } + + function sign(num) { + return num > 0 ? 1 : num < 0 ? -1 : 0; + } + + // check if a polygon diagonal intersects any polygon segments + function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) { return true; } + p = p.next; + } while (p !== a); + + return false; + } + + // check if a polygon diagonal is locally inside the polygon + function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; + } + + // check if the middle point of a polygon diagonal is inside the polygon + function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + { inside = !inside; } + p = p.next; + } while (p !== a); + + return inside; + } + + // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; + // if one belongs to the outer ring and another to a hole, it merges it into a single ring + function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; + + a.next = b; + b.prev = a; + + a2.next = an; + an.prev = a2; + + b2.next = a2; + a2.prev = b2; + + bp.next = b2; + b2.prev = bp; + + return b2; + } + + // create a node and optionally link it with previous one (in a circular doubly linked list) + function insertNode(i, x, y, last) { + var p = new Node(i, x, y); + + if (!last) { + p.prev = p; + p.next = p; + + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; + } + + function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) { p.prevZ.nextZ = p.nextZ; } + if (p.nextZ) { p.nextZ.prevZ = p.prevZ; } + } + + function Node(i, x, y) { + // vertex index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertex nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = null; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; + } + + // return a percentage difference between the polygon area and its triangulation area; + // used to verify correctness of triangulation + earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); + } + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); + }; + + function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; + } + + // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts + earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) { result.vertices.push(data[i][j][d]); } + } + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); + } + } + return result; + }; + earcut_1.default = default_1; + + var punycode = createCommonjsModule(function (module, exports) { + /*! https://mths.be/punycode v1.3.2 by @mathias */ + ;(function(root) { + + /** Detect free variables */ + var freeExports = 'object' == 'object' && exports && + !exports.nodeType && exports; + var freeModule = 'object' == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * http://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.3.2', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof undefined == 'function' && + typeof undefined.amd == 'object' && + undefined.amd + ) { + undefined('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { // in Rhino or a web browser + root.punycode = punycode; + } + + }(commonjsGlobal)); + }); + + 'use strict'; + + var util = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } + }; + var util_1 = util.isString; + var util_2 = util.isObject; + var util_3 = util.isNull; + var util_4 = util.isNullOrUndefined; + + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + 'use strict'; + + // If obj.hasOwnProperty has been overridden, then calling + // obj.hasOwnProperty(prop) will break. + // See: https://github.com/joyent/node/issues/1707 + function hasOwnProperty$1(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + var decode = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty$1(obj, k)) { + obj[k] = v; + } else if (Array.isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; + }; + + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + 'use strict'; + + var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } + }; + + var encode = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return Object.keys(obj).map(function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (Array.isArray(obj[k])) { + return obj[k].map(function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) { return ''; } + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); + }; + + var querystring = createCommonjsModule(function (module, exports) { + 'use strict'; + + exports.decode = exports.parse = decode; + exports.encode = exports.stringify = encode; + }); + var querystring_1 = querystring.decode; + var querystring_2 = querystring.parse; + var querystring_3 = querystring.encode; + var querystring_4 = querystring.stringify; + + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + 'use strict'; + + + + + var parse = urlParse; + var resolve = urlResolve; + var resolveObject = urlResolveObject; + var format = urlFormat; + + var Url_1 = Url; + + function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; + } + + // Reference: RFC 3986, RFC 1808, RFC 2396 + + // define these here so at least they only have to be + // compiled once on the first module load. + var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], + + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), + + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }; + + function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) { return url; } + + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; + } + + Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } + + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); + + var rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + { hostEnd = hec; } + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + { hostEnd = hec; } + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + { hostEnd = rest.length; } + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) { continue; } + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + { continue; } + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) { this.pathname = rest; } + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; + }; + + // format a parsed object into a url string + function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) { obj = urlParse(obj); } + if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); } + return obj.format(); + } + + Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; } + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; } + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; } + if (search && search.charAt(0) !== '?') { search = '?' + search; } + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; + }; + + function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); + } + + Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); + }; + + function urlResolveObject(source, relative) { + if (!source) { return relative; } + return urlParse(source, false, true).resolveObject(relative); + } + + Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + { result[rkey] = relative[rkey]; } + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())){ ; } + if (!relative.host) { relative.host = ''; } + if (!relative.hostname) { relative.hostname = ''; } + if (relPath[0] !== '') { relPath.unshift(''); } + if (relPath.length < 2) { relPath.unshift(''); } + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') { srcPath[0] = result.host; } + else { srcPath.unshift(result.host); } + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') { relPath[0] = relative.host; } + else { relPath.unshift(relative.host); } + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) { srcPath = []; } + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + }; + + Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) { this.hostname = host; } + }; + + var url = { + parse: parse, + resolve: resolve, + resolveObject: resolveObject, + format: format, + Url: Url_1 + }; + + /*! + * @pixi/constants - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + /** + * Different types of environments for WebGL. + * + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ + + (function (ENV) { + ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; + ENV[ENV["WEBGL"] = 1] = "WEBGL"; + ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; + })(exports.ENV || (exports.ENV = {})); + /** + * Constant to identify the Renderer Type. + * + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ + + (function (RENDERER_TYPE) { + RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; + RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; + RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; + })(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {})); + /** + * Bitwise OR of masks that indicate the buffers to be cleared. + * + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ + + (function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; + })(exports.BUFFER_BITS || (exports.BUFFER_BITS = {})); + /** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL + * @property {number} ADD + * @property {number} MULTIPLY + * @property {number} SCREEN + * @property {number} OVERLAY + * @property {number} DARKEN + * @property {number} LIGHTEN + * @property {number} COLOR_DODGE + * @property {number} COLOR_BURN + * @property {number} HARD_LIGHT + * @property {number} SOFT_LIGHT + * @property {number} DIFFERENCE + * @property {number} EXCLUSION + * @property {number} HUE + * @property {number} SATURATION + * @property {number} COLOR + * @property {number} LUMINOSITY + * @property {number} NORMAL_NPM + * @property {number} ADD_NPM + * @property {number} SCREEN_NPM + * @property {number} NONE + * @property {number} SRC_IN + * @property {number} SRC_OUT + * @property {number} SRC_ATOP + * @property {number} DST_OVER + * @property {number} DST_IN + * @property {number} DST_OUT + * @property {number} DST_ATOP + * @property {number} SUBTRACT + * @property {number} SRC_OVER + * @property {number} ERASE + * @property {number} XOR + */ + + (function (BLEND_MODES) { + BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; + BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; + BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; + BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; + BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; + BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; + BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; + BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; + BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; + BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; + BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; + BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; + BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; + BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; + BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; + BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; + BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; + BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; + BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; + BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; + BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; + BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; + BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; + BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; + BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; + BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; + BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; + BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; + BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; + BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; + BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; + BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; + })(exports.BLEND_MODES || (exports.BLEND_MODES = {})); + /** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS + * @property {number} LINES + * @property {number} LINE_LOOP + * @property {number} LINE_STRIP + * @property {number} TRIANGLES + * @property {number} TRIANGLE_STRIP + * @property {number} TRIANGLE_FAN + */ + + (function (DRAW_MODES) { + DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; + DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; + DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; + DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; + DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; + })(exports.DRAW_MODES || (exports.DRAW_MODES = {})); + /** + * Various GL texture/resources formats. + * + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} RGBA=6408 + * @property {number} RGB=6407 + * @property {number} ALPHA=6406 + * @property {number} LUMINANCE=6409 + * @property {number} LUMINANCE_ALPHA=6410 + * @property {number} DEPTH_COMPONENT=6402 + * @property {number} DEPTH_STENCIL=34041 + */ + + (function (FORMATS) { + FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; + FORMATS[FORMATS["RGB"] = 6407] = "RGB"; + FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; + FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; + FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; + FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; + FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; + })(exports.FORMATS || (exports.FORMATS = {})); + /** + * Various GL target types. + * + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} TEXTURE_2D=3553 + * @property {number} TEXTURE_CUBE_MAP=34067 + * @property {number} TEXTURE_2D_ARRAY=35866 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 + */ + + (function (TARGETS) { + TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; + TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; + })(exports.TARGETS || (exports.TARGETS = {})); + /** + * Various GL data format types. + * + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} UNSIGNED_BYTE=5121 + * @property {number} UNSIGNED_SHORT=5123 + * @property {number} UNSIGNED_SHORT_5_6_5=33635 + * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 + * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 + * @property {number} FLOAT=5126 + * @property {number} HALF_FLOAT=36193 + */ + + (function (TYPES) { + TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; + TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; + TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; + TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; + TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; + TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; + TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; + })(exports.TYPES || (exports.TYPES = {})); + /** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ + + (function (SCALE_MODES) { + SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; + SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; + })(exports.SCALE_MODES || (exports.SCALE_MODES = {})); + /** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ + + (function (WRAP_MODES) { + WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; + WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; + WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; + })(exports.WRAP_MODES || (exports.WRAP_MODES = {})); + /** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + */ + + (function (MIPMAP_MODES) { + MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; + MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; + MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; + })(exports.MIPMAP_MODES || (exports.MIPMAP_MODES = {})); + /** + * How to treat textures with premultiplied alpha + * + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ + + (function (ALPHA_MODES) { + ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; + ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; + ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; + ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; + })(exports.ALPHA_MODES || (exports.ALPHA_MODES = {})); + /** + * How to clear renderTextures in filter + * + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Preserve the information in the texture, blend above + * @property {number} CLEAR - Must use `gl.clear` operation + * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ + + (function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; + })(exports.CLEAR_MODES || (exports.CLEAR_MODES = {})); + /** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ + + (function (GC_MODES) { + GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; + GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; + })(exports.GC_MODES || (exports.GC_MODES = {})); + /** + * Constants that specify float precision in shaders. + * + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} LOW='lowp' + * @property {string} MEDIUM='mediump' + * @property {string} HIGH='highp' + */ + + (function (PRECISION) { + PRECISION["LOW"] = "lowp"; + PRECISION["MEDIUM"] = "mediump"; + PRECISION["HIGH"] = "highp"; + })(exports.PRECISION || (exports.PRECISION = {})); + /** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + */ + + (function (MASK_TYPES) { + MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; + MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; + MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; + MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; + })(exports.MASK_TYPES || (exports.MASK_TYPES = {})); + /** + * Constants for multi-sampling antialiasing. + * + * @see PIXI.Framebuffer#multisample + * + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ + + (function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; + })(exports.MSAA_QUALITY || (exports.MSAA_QUALITY = {})); + + /*! + * @pixi/utils - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * The prefix that denotes a URL is for a retina asset. + * + * @static + * @name RETINA_PREFIX + * @memberof PIXI.settings + * @type {RegExp} + * @default /@([0-9\.]+)x/ + * @example `@2x` + */ + settings.RETINA_PREFIX = /@([0-9\.]+)x/; + /** + * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function. + * For most scenarios this should be left as true, as otherwise the user may have a poor experience. + * However, it can be useful to disable under certain scenarios, such as headless unit tests. + * + * @static + * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT + * @memberof PIXI.settings + * @type {boolean} + * @default true + */ + settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true; + + var saidHello = false; + var VERSION = '5.3.12'; + /** + * Skips the hello message of renderers that are created after this is run. + * + * @function skipHello + * @memberof PIXI.utils + */ + function skipHello() { + saidHello = true; + } + /** + * Logs out the version and renderer information for this running instance of PIXI. + * If you don't want to see this message you can run `PIXI.utils.skipHello()` before + * creating your renderer. Keep in mind that doing that will forever make you a jerk face. + * + * @static + * @function sayHello + * @memberof PIXI.utils + * @param {string} type - The string renderer type to log. + */ + function sayHello(type) { + var _a; + if (saidHello) { + return; + } + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { + var args = [ + "\n %c %c %c PixiJS " + VERSION + " - \u2730 " + type + " \u2730 %c %c http://www.pixijs.com/ %c %c \u2665%c\u2665%c\u2665 \n\n", + 'background: #ff66a5; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff66a5; background: #030307; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'background: #ffc3dc; padding:5px 0;', + 'background: #ff66a5; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;', + 'color: #ff2424; background: #fff; padding:5px 0;' ]; + (_a = window.console).log.apply(_a, args); + } + else if (window.console) { + window.console.log("PixiJS " + VERSION + " - " + type + " - http://www.pixijs.com/"); + } + saidHello = true; + } + + var supported; + /** + * Helper for checking for WebGL support. + * + * @memberof PIXI.utils + * @function isWebGLSupported + * @return {boolean} Is WebGL supported. + */ + function isWebGLSupported() { + if (typeof supported === 'undefined') { + supported = (function supported() { + var contextOptions = { + stencil: true, + failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT, + }; + try { + if (!window.WebGLRenderingContext) { + return false; + } + var canvas = document.createElement('canvas'); + var gl = (canvas.getContext('webgl', contextOptions) + || canvas.getContext('experimental-webgl', contextOptions)); + var success = !!(gl && gl.getContextAttributes().stencil); + if (gl) { + var loseContext = gl.getExtension('WEBGL_lose_context'); + if (loseContext) { + loseContext.loseContext(); + } + } + gl = null; + return success; + } + catch (e) { + return false; + } + })(); + } + return supported; + } + + /** + * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0). + * + * @example + * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1] + * @memberof PIXI.utils + * @function hex2rgb + * @param {number} hex - The hexadecimal number to convert + * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one + * @return {number[]} An array representing the [R, G, B] of the color where all values are floats. + */ + function hex2rgb(hex, out) { + if (out === void 0) { out = []; } + out[0] = ((hex >> 16) & 0xFF) / 255; + out[1] = ((hex >> 8) & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + return out; + } + /** + * Converts a hexadecimal color number to a string. + * + * @example + * PIXI.utils.hex2string(0xffffff); // returns "#ffffff" + * @memberof PIXI.utils + * @function hex2string + * @param {number} hex - Number in hex (e.g., `0xffffff`) + * @return {string} The string color (e.g., `"#ffffff"`). + */ + function hex2string(hex) { + var hexString = hex.toString(16); + hexString = '000000'.substr(0, 6 - hexString.length) + hexString; + return "#" + hexString; + } + /** + * Converts a hexadecimal string to a hexadecimal color number. + * + * @example + * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff + * @memberof PIXI.utils + * @function string2hex + * @param {string} string - The string color (e.g., `"#ffffff"`) + * @return {number} Number in hexadecimal. + */ + function string2hex(string) { + if (typeof string === 'string' && string[0] === '#') { + string = string.substr(1); + } + return parseInt(string, 16); + } + /** + * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number. + * + * @example + * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff + * @memberof PIXI.utils + * @function rgb2hex + * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0. + * @return {number} Number in hexadecimal. + */ + function rgb2hex(rgb) { + return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); + } + + /** + * Corrects PixiJS blend, takes premultiplied alpha into account + * + * @memberof PIXI.utils + * @function mapPremultipliedBlendModes + * @private + * @return {Array} Mapped modes. + */ + function mapPremultipliedBlendModes() { + var pm = []; + var npm = []; + for (var i = 0; i < 32; i++) { + pm[i] = i; + npm[i] = i; + } + pm[exports.BLEND_MODES.NORMAL_NPM] = exports.BLEND_MODES.NORMAL; + pm[exports.BLEND_MODES.ADD_NPM] = exports.BLEND_MODES.ADD; + pm[exports.BLEND_MODES.SCREEN_NPM] = exports.BLEND_MODES.SCREEN; + npm[exports.BLEND_MODES.NORMAL] = exports.BLEND_MODES.NORMAL_NPM; + npm[exports.BLEND_MODES.ADD] = exports.BLEND_MODES.ADD_NPM; + npm[exports.BLEND_MODES.SCREEN] = exports.BLEND_MODES.SCREEN_NPM; + var array = []; + array.push(npm); + array.push(pm); + return array; + } + /** + * maps premultiply flag and blendMode to adjusted blendMode + * @memberof PIXI.utils + * @const premultiplyBlendMode + * @type {Array} + */ + var premultiplyBlendMode = mapPremultipliedBlendModes(); + /** + * changes blendMode according to texture format + * + * @memberof PIXI.utils + * @function correctBlendMode + * @param {number} blendMode - supposed blend mode + * @param {boolean} premultiplied - whether source is premultiplied + * @returns {number} true blend mode for this texture + */ + function correctBlendMode(blendMode, premultiplied) { + return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode]; + } + /** + * combines rgb and alpha to out array + * + * @memberof PIXI.utils + * @function premultiplyRgba + * @param {Float32Array|number[]} rgb - input rgb + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ + function premultiplyRgba(rgb, alpha, out, premultiply) { + out = out || new Float32Array(4); + if (premultiply || premultiply === undefined) { + out[0] = rgb[0] * alpha; + out[1] = rgb[1] * alpha; + out[2] = rgb[2] * alpha; + } + else { + out[0] = rgb[0]; + out[1] = rgb[1]; + out[2] = rgb[2]; + } + out[3] = alpha; + return out; + } + /** + * premultiplies tint + * + * @memberof PIXI.utils + * @function premultiplyTint + * @param {number} tint - integer RGB + * @param {number} alpha - floating point alpha (0.0-1.0) + * @returns {number} tint multiplied by alpha + */ + function premultiplyTint(tint, alpha) { + if (alpha === 1.0) { + return (alpha * 255 << 24) + tint; + } + if (alpha === 0.0) { + return 0; + } + var R = ((tint >> 16) & 0xFF); + var G = ((tint >> 8) & 0xFF); + var B = (tint & 0xFF); + R = ((R * alpha) + 0.5) | 0; + G = ((G * alpha) + 0.5) | 0; + B = ((B * alpha) + 0.5) | 0; + return (alpha * 255 << 24) + (R << 16) + (G << 8) + B; + } + /** + * converts integer tint and float alpha to vec4 form, premultiplies by default + * + * @memberof PIXI.utils + * @function premultiplyTintToRgba + * @param {number} tint - input tint + * @param {number} alpha - alpha param + * @param {Float32Array} [out] output + * @param {boolean} [premultiply=true] - do premultiply it + * @returns {Float32Array} vec4 rgba + */ + function premultiplyTintToRgba(tint, alpha, out, premultiply) { + out = out || new Float32Array(4); + out[0] = ((tint >> 16) & 0xFF) / 255.0; + out[1] = ((tint >> 8) & 0xFF) / 255.0; + out[2] = (tint & 0xFF) / 255.0; + if (premultiply || premultiply === undefined) { + out[0] *= alpha; + out[1] *= alpha; + out[2] *= alpha; + } + out[3] = alpha; + return out; + } + + /** + * Generic Mask Stack data structure + * + * @memberof PIXI.utils + * @function createIndicesForQuads + * @param {number} size - Number of quads + * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size` + * @return {Uint16Array|Uint32Array} - Resulting index buffer + */ + function createIndicesForQuads(size, outBuffer) { + if (outBuffer === void 0) { outBuffer = null; } + // the total number of indices in our array, there are 6 points per quad. + var totalIndices = size * 6; + outBuffer = outBuffer || new Uint16Array(totalIndices); + if (outBuffer.length !== totalIndices) { + throw new Error("Out buffer length is incorrect, got " + outBuffer.length + " and expected " + totalIndices); + } + // fill the indices with the quads to draw + for (var i = 0, j = 0; i < totalIndices; i += 6, j += 4) { + outBuffer[i + 0] = j + 0; + outBuffer[i + 1] = j + 1; + outBuffer[i + 2] = j + 2; + outBuffer[i + 3] = j + 0; + outBuffer[i + 4] = j + 2; + outBuffer[i + 5] = j + 3; + } + return outBuffer; + } + + function getBufferType(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { + return 'Float32Array'; + } + else if (array instanceof Uint32Array) { + return 'Uint32Array'; + } + return 'Int32Array'; + } + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { + return 'Uint16Array'; + } + } + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { + return 'Uint8Array'; + } + } + // TODO map out the rest of the array elements! + return null; + } + + /* eslint-disable object-shorthand */ + var map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; + function interleaveTypedArrays(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + /* + @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way + or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed? + */ + var type = getBufferType(array); + if (!views[type]) { + views[type] = new map[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); + } + + // Taken from the bit-twiddle package + /** + * Rounds to next power of two. + * + * @function nextPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @return {number} + */ + function nextPow2(v) { + v += v === 0 ? 1 : 0; + --v; + v |= v >>> 1; + v |= v >>> 2; + v |= v >>> 4; + v |= v >>> 8; + v |= v >>> 16; + return v + 1; + } + /** + * Checks if a number is a power of two. + * + * @function isPow2 + * @memberof PIXI.utils + * @param {number} v - input value + * @return {boolean} `true` if value is power of two + */ + function isPow2(v) { + return !(v & (v - 1)) && (!!v); + } + /** + * Computes ceil of log base 2 + * + * @function log2 + * @memberof PIXI.utils + * @param {number} v - input value + * @return {number} logarithm base 2 + */ + function log2(v) { + var r = (v > 0xFFFF ? 1 : 0) << 4; + v >>>= r; + var shift = (v > 0xFF ? 1 : 0) << 3; + v >>>= shift; + r |= shift; + shift = (v > 0xF ? 1 : 0) << 2; + v >>>= shift; + r |= shift; + shift = (v > 0x3 ? 1 : 0) << 1; + v >>>= shift; + r |= shift; + return r | (v >> 1); + } + + /** + * Remove items from a javascript array without generating garbage + * + * @function removeItems + * @memberof PIXI.utils + * @param {Array} arr - Array to remove elements from + * @param {number} startIdx - starting index + * @param {number} removeCount - how many to remove + */ + function removeItems(arr, startIdx, removeCount) { + var length = arr.length; + var i; + if (startIdx >= length || removeCount === 0) { + return; + } + removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount); + var len = length - removeCount; + for (i = startIdx; i < len; ++i) { + arr[i] = arr[i + removeCount]; + } + arr.length = len; + } + + /** + * Returns sign of number + * + * @memberof PIXI.utils + * @function sign + * @param {number} n - the number to check the sign of + * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive + */ + function sign$1(n) { + if (n === 0) + { return 0; } + return n < 0 ? -1 : 1; + } + + var nextUid = 0; + /** + * Gets the next unique identifier + * + * @memberof PIXI.utils + * @function uid + * @return {number} The next unique identifier to use. + */ + function uid() { + return ++nextUid; + } + + // A map of warning messages already fired + var warnings = {}; + /** + * Helper for warning developers about deprecated features & settings. + * A stack track for warnings is given; useful for tracking-down where + * deprecated methods/properties/classes are being used within the code. + * + * @memberof PIXI.utils + * @function deprecation + * @param {string} version - The version where the feature became deprecated + * @param {string} message - Message should include what is deprecated, where, and the new solution + * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack + * this is mostly to ignore internal deprecation calls. + */ + function deprecation(version, message, ignoreDepth) { + if (ignoreDepth === void 0) { ignoreDepth = 3; } + // Ignore duplicat + if (warnings[message]) { + return; + } + /* eslint-disable no-console */ + var stack = new Error().stack; + // Handle IE < 10 and Safari < 6 + if (typeof stack === 'undefined') { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + } + else { + // chop off the stack trace which includes PixiJS internal calls + stack = stack.split('\n').splice(ignoreDepth).join('\n'); + if (console.groupCollapsed) { + console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + "\nDeprecated since v" + version); + console.warn(stack); + console.groupEnd(); + } + else { + console.warn('PixiJS Deprecation Warning: ', message + "\nDeprecated since v" + version); + console.warn(stack); + } + } + /* eslint-enable no-console */ + warnings[message] = true; + } + + /** + * @todo Describe property usage + * + * @static + * @name ProgramCache + * @memberof PIXI.utils + * @type {Object} + */ + var ProgramCache = {}; + /** + * @todo Describe property usage + * + * @static + * @name TextureCache + * @memberof PIXI.utils + * @type {Object} + */ + var TextureCache = Object.create(null); + /** + * @todo Describe property usage + * + * @static + * @name BaseTextureCache + * @memberof PIXI.utils + * @type {Object} + */ + var BaseTextureCache = Object.create(null); + /** + * Destroys all texture in the cache + * + * @memberof PIXI.utils + * @function destroyTextureCache + */ + function destroyTextureCache() { + var key; + for (key in TextureCache) { + TextureCache[key].destroy(); + } + for (key in BaseTextureCache) { + BaseTextureCache[key].destroy(); + } + } + /** + * Removes all textures from cache, but does not destroy them + * + * @memberof PIXI.utils + * @function clearTextureCache + */ + function clearTextureCache() { + var key; + for (key in TextureCache) { + delete TextureCache[key]; + } + for (key in BaseTextureCache) { + delete BaseTextureCache[key]; + } + } + + /** + * Creates a Canvas element of the given size to be used as a target for rendering to. + * + * @class + * @memberof PIXI.utils + */ + var CanvasRenderTarget = /** @class */ (function () { + /** + * @param {number} width - the width for the newly created canvas + * @param {number} height - the height for the newly created canvas + * @param {number} [resolution=1] - The resolution / device pixel ratio of the canvas + */ + function CanvasRenderTarget(width, height, resolution) { + /** + * The Canvas object that belongs to this CanvasRenderTarget. + * + * @member {HTMLCanvasElement} + */ + this.canvas = document.createElement('canvas'); + /** + * A CanvasRenderingContext2D object representing a two-dimensional rendering context. + * + * @member {CanvasRenderingContext2D} + */ + this.context = this.canvas.getContext('2d'); + this.resolution = resolution || settings.RESOLUTION; + this.resize(width, height); + } + /** + * Clears the canvas that was created by the CanvasRenderTarget class. + * + * @private + */ + CanvasRenderTarget.prototype.clear = function () { + this.context.setTransform(1, 0, 0, 1, 0, 0); + this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + }; + /** + * Resizes the canvas to the specified width and height. + * + * @param {number} width - the new width of the canvas + * @param {number} height - the new height of the canvas + */ + CanvasRenderTarget.prototype.resize = function (width, height) { + this.canvas.width = width * this.resolution; + this.canvas.height = height * this.resolution; + }; + /** + * Destroys this canvas. + * + */ + CanvasRenderTarget.prototype.destroy = function () { + this.context = null; + this.canvas = null; + }; + Object.defineProperty(CanvasRenderTarget.prototype, "width", { + /** + * The width of the canvas buffer in pixels. + * + * @member {number} + */ + get: function () { + return this.canvas.width; + }, + set: function (val) { + this.canvas.width = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(CanvasRenderTarget.prototype, "height", { + /** + * The height of the canvas buffer in pixels. + * + * @member {number} + */ + get: function () { + return this.canvas.height; + }, + set: function (val) { + this.canvas.height = val; + }, + enumerable: false, + configurable: true + }); + return CanvasRenderTarget; + }()); + + /** + * Trim transparent borders from a canvas + * + * @memberof PIXI.utils + * @function trimCanvas + * @param {HTMLCanvasElement} canvas - the canvas to trim + * @returns {object} Trim data + */ + function trimCanvas(canvas) { + // https://gist.github.com/remy/784508 + var width = canvas.width; + var height = canvas.height; + var context = canvas.getContext('2d'); + var imageData = context.getImageData(0, 0, width, height); + var pixels = imageData.data; + var len = pixels.length; + var bound = { + top: null, + left: null, + right: null, + bottom: null, + }; + var data = null; + var i; + var x; + var y; + for (i = 0; i < len; i += 4) { + if (pixels[i + 3] !== 0) { + x = (i / 4) % width; + y = ~~((i / 4) / width); + if (bound.top === null) { + bound.top = y; + } + if (bound.left === null) { + bound.left = x; + } + else if (x < bound.left) { + bound.left = x; + } + if (bound.right === null) { + bound.right = x + 1; + } + else if (bound.right < x) { + bound.right = x + 1; + } + if (bound.bottom === null) { + bound.bottom = y; + } + else if (bound.bottom < y) { + bound.bottom = y; + } + } + } + if (bound.top !== null) { + width = bound.right - bound.left; + height = bound.bottom - bound.top + 1; + data = context.getImageData(bound.left, bound.top, width, height); + } + return { + height: height, + width: width, + data: data, + }; + } + + /** + * Regexp for data URI. + * Based on: {@link https://github.com/ragingwind/data-uri-regex} + * + * @static + * @constant {RegExp|string} DATA_URI + * @memberof PIXI + * @example data:image/png;base64 + */ + var DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; + + /** + * @memberof PIXI.utils + * @interface DecomposedDataUri + */ + /** + * type, eg. `image` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} mediaType + */ + /** + * Sub type, eg. `png` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} subType + */ + /** + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} charset + */ + /** + * Data encoding, eg. `base64` + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} encoding + */ + /** + * The actual data + * @memberof PIXI.utils.DecomposedDataUri# + * @member {string} data + */ + /** + * Split a data URI into components. Returns undefined if + * parameter `dataUri` is not a valid data URI. + * + * @memberof PIXI.utils + * @function decomposeDataUri + * @param {string} dataUri - the data URI to check + * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined + */ + function decomposeDataUri(dataUri) { + var dataUriMatch = DATA_URI.exec(dataUri); + if (dataUriMatch) { + return { + mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined, + subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined, + charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined, + encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined, + data: dataUriMatch[5], + }; + } + return undefined; + } + + var tempAnchor; + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * Nipped from the resource loader! + * + * @ignore + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @return {string} The crossOrigin value to use (or empty string for none). + */ + function determineCrossOrigin(url, loc) { + if (loc === void 0) { loc = window.location; } + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } + // default is window.location + loc = loc || window.location; + if (!tempAnchor) { + tempAnchor = document.createElement('a'); + } + // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + tempAnchor.href = url; + var parsedUrl = parse(tempAnchor.href); + var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port); + // if cross origin + if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) { + return 'anonymous'; + } + return ''; + } + + /** + * get the resolution / device pixel ratio of an asset by looking for the prefix + * used by spritesheets and image urls + * + * @memberof PIXI.utils + * @function getResolutionOfUrl + * @param {string} url - the image path + * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set. + * @return {number} resolution / device pixel ratio of an asset + */ + function getResolutionOfUrl(url, defaultValue) { + var resolution = settings.RETINA_PREFIX.exec(url); + if (resolution) { + return parseFloat(resolution[1]); + } + return defaultValue !== undefined ? defaultValue : 1; + } + + var utils_es = ({ + BaseTextureCache: BaseTextureCache, + CanvasRenderTarget: CanvasRenderTarget, + DATA_URI: DATA_URI, + ProgramCache: ProgramCache, + TextureCache: TextureCache, + clearTextureCache: clearTextureCache, + correctBlendMode: correctBlendMode, + createIndicesForQuads: createIndicesForQuads, + decomposeDataUri: decomposeDataUri, + deprecation: deprecation, + destroyTextureCache: destroyTextureCache, + determineCrossOrigin: determineCrossOrigin, + getBufferType: getBufferType, + getResolutionOfUrl: getResolutionOfUrl, + hex2rgb: hex2rgb, + hex2string: hex2string, + interleaveTypedArrays: interleaveTypedArrays, + isPow2: isPow2, + isWebGLSupported: isWebGLSupported, + log2: log2, + nextPow2: nextPow2, + premultiplyBlendMode: premultiplyBlendMode, + premultiplyRgba: premultiplyRgba, + premultiplyTint: premultiplyTint, + premultiplyTintToRgba: premultiplyTintToRgba, + removeItems: removeItems, + rgb2hex: rgb2hex, + sayHello: sayHello, + sign: sign$1, + skipHello: skipHello, + string2hex: string2hex, + trimCanvas: trimCanvas, + uid: uid, + isMobile: isMobile$1, + EventEmitter: eventemitter3, + earcut: earcut_1, + url: url + }); + + /*! + * @pixi/math - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/math is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + /** + * Two Pi. + * + * @static + * @constant {number} PI_2 + * @memberof PIXI + */ + var PI_2 = Math.PI * 2; + /** + * Conversion factor for converting radians to degrees. + * + * @static + * @constant {number} RAD_TO_DEG + * @memberof PIXI + */ + var RAD_TO_DEG = 180 / Math.PI; + /** + * Conversion factor for converting degrees to radians. + * + * @static + * @constant {number} DEG_TO_RAD + * @memberof PIXI + */ + var DEG_TO_RAD = Math.PI / 180; + + (function (SHAPES) { + SHAPES[SHAPES["POLY"] = 0] = "POLY"; + SHAPES[SHAPES["RECT"] = 1] = "RECT"; + SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; + SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; + SHAPES[SHAPES["RREC"] = 4] = "RREC"; + })(exports.SHAPES || (exports.SHAPES = {})); + /** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * + * @static + * @constant + * @name SHAPES + * @memberof PIXI + * @type {enum} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + * @enum {number} + */ + + /** + * Size object, contains width and height + * + * @memberof PIXI + * @typedef {object} ISize + * @property {number} width - Width component + * @property {number} height - Height component + */ + /** + * Rectangle object is an area defined by its position, as indicated by its top-left corner + * point (x, y) and by its width and its height. + * + * @class + * @memberof PIXI + */ + var Rectangle = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle + * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle + * @param {number} [width=0] - The overall width of this rectangle + * @param {number} [height=0] - The overall height of this rectangle + */ + function Rectangle(x, y, width, height) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = Number(x); + /** + * @member {number} + * @default 0 + */ + this.y = Number(y); + /** + * @member {number} + * @default 0 + */ + this.width = Number(width); + /** + * @member {number} + * @default 0 + */ + this.height = Number(height); + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.RECT + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.RECT; + } + Object.defineProperty(Rectangle.prototype, "left", { + /** + * returns the left edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.x; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "right", { + /** + * returns the right edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.x + this.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "top", { + /** + * returns the top edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.y; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "bottom", { + /** + * returns the bottom edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.y + this.height; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle, "EMPTY", { + /** + * A constant empty rectangle. + * + * @static + * @constant + * @member {PIXI.Rectangle} + * @return {PIXI.Rectangle} An empty rectangle + */ + get: function () { + return new Rectangle(0, 0, 0, 0); + }, + enumerable: false, + configurable: true + }); + /** + * Creates a clone of this Rectangle + * + * @return {PIXI.Rectangle} a copy of the rectangle + */ + Rectangle.prototype.clone = function () { + return new Rectangle(this.x, this.y, this.width, this.height); + }; + /** + * Copies another rectangle to this one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to copy from. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.copyFrom = function (rectangle) { + this.x = rectangle.x; + this.y = rectangle.y; + this.width = rectangle.width; + this.height = rectangle.height; + return this; + }; + /** + * Copies this rectangle to another one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to copy to. + * @return {PIXI.Rectangle} Returns given parameter. + */ + Rectangle.prototype.copyTo = function (rectangle) { + rectangle.x = this.x; + rectangle.y = this.y; + rectangle.width = this.width; + rectangle.height = this.height; + return rectangle; + }; + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Rectangle + */ + Rectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x < this.x + this.width) { + if (y >= this.y && y < this.y + this.height) { + return true; + } + } + return false; + }; + /** + * Pads the rectangle making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * + * @param {number} [paddingX=0] - The horizontal padding amount. + * @param {number} [paddingY=0] - The vertical padding amount. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + this.x -= paddingX; + this.y -= paddingY; + this.width += paddingX * 2; + this.height += paddingY * 2; + return this; + }; + /** + * Fits this rectangle around the passed one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to fit. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.fit = function (rectangle) { + var x1 = Math.max(this.x, rectangle.x); + var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.max(this.y, rectangle.y); + var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = Math.max(x2 - x1, 0); + this.y = y1; + this.height = Math.max(y2 - y1, 0); + return this; + }; + /** + * Enlarges rectangle that way its corners lie on grid + * + * @param {number} [resolution=1] resolution + * @param {number} [eps=0.001] precision + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.ceil = function (resolution, eps) { + if (resolution === void 0) { resolution = 1; } + if (eps === void 0) { eps = 0.001; } + var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; + var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; + this.x = Math.floor((this.x + eps) * resolution) / resolution; + this.y = Math.floor((this.y + eps) * resolution) / resolution; + this.width = x2 - this.x; + this.height = y2 - this.y; + return this; + }; + /** + * Enlarges this rectangle to include the passed rectangle. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to include. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.enlarge = function (rectangle) { + var x1 = Math.min(this.x, rectangle.x); + var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.min(this.y, rectangle.y); + var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; + return this; + }; + return Rectangle; + }()); + + /** + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * + * @class + * @memberof PIXI + */ + var Circle = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the center of this circle + * @param {number} [y=0] - The Y coordinate of the center of this circle + * @param {number} [radius=0] - The radius of the circle + */ + function Circle(x, y, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (radius === void 0) { radius = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + /** + * @member {number} + * @default 0 + */ + this.radius = radius; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.CIRC + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.CIRC; + } + /** + * Creates a clone of this Circle instance + * + * @return {PIXI.Circle} a copy of the Circle + */ + Circle.prototype.clone = function () { + return new Circle(this.x, this.y, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this circle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Circle + */ + Circle.prototype.contains = function (x, y) { + if (this.radius <= 0) { + return false; + } + var r2 = this.radius * this.radius; + var dx = (this.x - x); + var dy = (this.y - y); + dx *= dx; + dy *= dy; + return (dx + dy <= r2); + }; + /** + * Returns the framing rectangle of the circle as a Rectangle object + * + * @return {PIXI.Rectangle} the framing rectangle + */ + Circle.prototype.getBounds = function () { + return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); + }; + return Circle; + }()); + + /** + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * + * @class + * @memberof PIXI + */ + var Ellipse = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the center of this ellipse + * @param {number} [y=0] - The Y coordinate of the center of this ellipse + * @param {number} [halfWidth=0] - The half width of this ellipse + * @param {number} [halfHeight=0] - The half height of this ellipse + */ + function Ellipse(x, y, halfWidth, halfHeight) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (halfWidth === void 0) { halfWidth = 0; } + if (halfHeight === void 0) { halfHeight = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + /** + * @member {number} + * @default 0 + */ + this.width = halfWidth; + /** + * @member {number} + * @default 0 + */ + this.height = halfHeight; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.ELIP + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.ELIP; + } + /** + * Creates a clone of this Ellipse instance + * + * @return {PIXI.Ellipse} a copy of the ellipse + */ + Ellipse.prototype.clone = function () { + return new Ellipse(this.x, this.y, this.width, this.height); + }; + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coords are within this ellipse + */ + Ellipse.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + // normalize the coords to an ellipse with center 0,0 + var normx = ((x - this.x) / this.width); + var normy = ((y - this.y) / this.height); + normx *= normx; + normy *= normy; + return (normx + normy <= 1); + }; + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * + * @return {PIXI.Rectangle} the framing rectangle + */ + Ellipse.prototype.getBounds = function () { + return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); + }; + return Ellipse; + }()); + + /** + * A class to define a shape via user defined co-orinates. + * + * @class + * @memberof PIXI + */ + var Polygon = /** @class */ (function () { + /** + * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points + * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or + * the arguments passed can be all the points of the polygon e.g. + * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat + * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. + */ + function Polygon() { + var arguments$1 = arguments; + + var points = []; + for (var _i = 0; _i < arguments.length; _i++) { + points[_i] = arguments$1[_i]; + } + var flat = Array.isArray(points[0]) ? points[0] : points; + // if this is an array of points, convert it to a flat array of numbers + if (typeof flat[0] !== 'number') { + var p = []; + for (var i = 0, il = flat.length; i < il; i++) { + p.push(flat[i].x, flat[i].y); + } + flat = p; + } + /** + * An array of the points of this polygon + * + * @member {number[]} + */ + this.points = flat; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.POLY + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.POLY; + /** + * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. + * @member {boolean} + * @default true + */ + this.closeStroke = true; + } + /** + * Creates a clone of this polygon + * + * @return {PIXI.Polygon} a copy of the polygon + */ + Polygon.prototype.clone = function () { + var points = this.points.slice(); + var polygon = new Polygon(points); + polygon.closeStroke = this.closeStroke; + return polygon; + }; + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this polygon + */ + Polygon.prototype.contains = function (x, y) { + var inside = false; + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + var length = this.points.length / 2; + for (var i = 0, j = length - 1; i < length; j = i++) { + var xi = this.points[i * 2]; + var yi = this.points[(i * 2) + 1]; + var xj = this.points[j * 2]; + var yj = this.points[(j * 2) + 1]; + var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); + if (intersect) { + inside = !inside; + } + } + return inside; + }; + return Polygon; + }()); + + /** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * + * @class + * @memberof PIXI + */ + var RoundedRectangle = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle + * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle + * @param {number} [width=0] - The overall width of this rounded rectangle + * @param {number} [height=0] - The overall height of this rounded rectangle + * @param {number} [radius=20] - Controls the radius of the rounded corners + */ + function RoundedRectangle(x, y, width, height, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + if (radius === void 0) { radius = 20; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + /** + * @member {number} + * @default 0 + */ + this.width = width; + /** + * @member {number} + * @default 0 + */ + this.height = height; + /** + * @member {number} + * @default 20 + */ + this.radius = radius; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readonly + * @default PIXI.SHAPES.RREC + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.RREC; + } + /** + * Creates a clone of this Rounded Rectangle + * + * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle + */ + RoundedRectangle.prototype.clone = function () { + return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle + */ + RoundedRectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x <= this.x + this.width) { + if (y >= this.y && y <= this.y + this.height) { + if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius) + || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) { + return true; + } + var dx = x - (this.x + this.radius); + var dy = y - (this.y + this.radius); + var radius2 = this.radius * this.radius; + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.width - this.radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dy = y - (this.y + this.height - this.radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + } + } + return false; + }; + return RoundedRectangle; + }()); + + /** + * Common interface for points. Both Point and ObservablePoint implement it + * @memberof PIXI + * @interface IPointData + */ + /** + * X coord + * @memberof PIXI.IPointData# + * @member {number} x + */ + /** + * Y coord + * @memberof PIXI.IPointData# + * @member {number} y + */ + + /** + * Common interface for points. Both Point and ObservablePoint implement it + * @memberof PIXI + * @interface IPoint + * @extends PIXI.IPointData + */ + /** + * Sets the point to a new x and y position. + * If y is omitted, both x and y will be set to x. + * + * @method set + * @memberof PIXI.IPoint# + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + */ + /** + * Copies x and y from the given point + * @method copyFrom + * @memberof PIXI.IPoint# + * @param {PIXI.IPointData} p - The point to copy from + * @returns {this} Returns itself. + */ + /** + * Copies x and y into the given point + * @method copyTo + * @memberof PIXI.IPoint# + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated + */ + /** + * Returns true if the given point is equal to this point + * + * @method equals + * @memberof PIXI.IPoint# + * @param {PIXI.IPointData} p - The point to check + * @returns {boolean} Whether the given point equal to this point + */ + + /** + * The Point object represents a location in a two-dimensional coordinate system, where x represents + * the horizontal axis and y represents the vertical axis. + * + * @class + * @memberof PIXI + * @implements IPoint + */ + var Point = /** @class */ (function () { + /** + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function Point(x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + } + /** + * Creates a clone of this point + * + * @return {PIXI.Point} a copy of the point + */ + Point.prototype.clone = function () { + return new Point(this.x, this.y); + }; + /** + * Copies x and y from the given point + * + * @param {PIXI.IPointData} p - The point to copy from + * @returns {this} Returns itself. + */ + Point.prototype.copyFrom = function (p) { + this.set(p.x, p.y); + return this; + }; + /** + * Copies x and y into the given point + * + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated + */ + Point.prototype.copyTo = function (p) { + p.set(this.x, this.y); + return p; + }; + /** + * Returns true if the given point is equal to this point + * + * @param {PIXI.IPointData} p - The point to check + * @returns {boolean} Whether the given point equal to this point + */ + Point.prototype.equals = function (p) { + return (p.x === this.x) && (p.y === this.y); + }; + /** + * Sets the point to a new x and y position. + * If y is omitted, both x and y will be set to x. + * + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + * @returns {this} Returns itself. + */ + Point.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + this.x = x; + this.y = y; + return this; + }; + return Point; + }()); + + /** + * The Point object represents a location in a two-dimensional coordinate system, where x represents + * the horizontal axis and y represents the vertical axis. + * + * An ObservablePoint is a point that triggers a callback when the point's position is changed. + * + * @class + * @memberof PIXI + * @implements IPoint + */ + var ObservablePoint = /** @class */ (function () { + /** + * @param {Function} cb - callback when changed + * @param {object} scope - owner of callback + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=0] - position of the point on the y axis + */ + function ObservablePoint(cb, scope, x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + this._x = x; + this._y = y; + this.cb = cb; + this.scope = scope; + } + /** + * Creates a clone of this point. + * The callback and scope params can be overidden otherwise they will default + * to the clone object's values. + * + * @override + * @param {Function} [cb=null] - callback when changed + * @param {object} [scope=null] - owner of callback + * @return {PIXI.ObservablePoint} a copy of the point + */ + ObservablePoint.prototype.clone = function (cb, scope) { + if (cb === void 0) { cb = this.cb; } + if (scope === void 0) { scope = this.scope; } + return new ObservablePoint(cb, scope, this._x, this._y); + }; + /** + * Sets the point to a new x and y position. + * If y is omitted, both x and y will be set to x. + * + * @param {number} [x=0] - position of the point on the x axis + * @param {number} [y=x] - position of the point on the y axis + * @returns {this} Returns itself. + */ + ObservablePoint.prototype.set = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = x; } + if (this._x !== x || this._y !== y) { + this._x = x; + this._y = y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies x and y from the given point + * + * @param {PIXI.IPointData} p - The point to copy from. + * @returns {this} Returns itself. + */ + ObservablePoint.prototype.copyFrom = function (p) { + if (this._x !== p.x || this._y !== p.y) { + this._x = p.x; + this._y = p.y; + this.cb.call(this.scope); + } + return this; + }; + /** + * Copies x and y into the given point + * + * @param {PIXI.IPoint} p - The point to copy. + * @returns {PIXI.IPoint} Given point with values updated + */ + ObservablePoint.prototype.copyTo = function (p) { + p.set(this._x, this._y); + return p; + }; + /** + * Returns true if the given point is equal to this point + * + * @param {PIXI.IPointData} p - The point to check + * @returns {boolean} Whether the given point equal to this point + */ + ObservablePoint.prototype.equals = function (p) { + return (p.x === this._x) && (p.y === this._y); + }; + Object.defineProperty(ObservablePoint.prototype, "x", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * + * @member {number} + */ + get: function () { + return this._x; + }, + set: function (value) { + if (this._x !== value) { + this._x = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ObservablePoint.prototype, "y", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * + * @member {number} + */ + get: function () { + return this._y; + }, + set: function (value) { + if (this._y !== value) { + this._y = value; + this.cb.call(this.scope); + } + }, + enumerable: false, + configurable: true + }); + return ObservablePoint; + }()); + + /** + * The PixiJS Matrix as a class makes it a lot faster. + * + * Here is a representation of it: + * ```js + * | a | c | tx| + * | b | d | ty| + * | 0 | 0 | 1 | + * ``` + * @class + * @memberof PIXI + */ + var Matrix = /** @class */ (function () { + /** + * @param {number} [a=1] - x scale + * @param {number} [b=0] - x skew + * @param {number} [c=0] - y skew + * @param {number} [d=1] - y scale + * @param {number} [tx=0] - x translation + * @param {number} [ty=0] - y translation + */ + function Matrix(a, b, c, d, tx, ty) { + if (a === void 0) { a = 1; } + if (b === void 0) { b = 0; } + if (c === void 0) { c = 0; } + if (d === void 0) { d = 1; } + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + this.array = null; + /** + * @member {number} + * @default 1 + */ + this.a = a; + /** + * @member {number} + * @default 0 + */ + this.b = b; + /** + * @member {number} + * @default 0 + */ + this.c = c; + /** + * @member {number} + * @default 1 + */ + this.d = d; + /** + * @member {number} + * @default 0 + */ + this.tx = tx; + /** + * @member {number} + * @default 0 + */ + this.ty = ty; + } + /** + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] + * + * @param {number[]} array - The array that the matrix will be populated from. + */ + Matrix.prototype.fromArray = function (array) { + this.a = array[0]; + this.b = array[1]; + this.c = array[3]; + this.d = array[4]; + this.tx = array[2]; + this.ty = array[5]; + }; + /** + * sets the matrix properties + * + * @param {number} a - Matrix component + * @param {number} b - Matrix component + * @param {number} c - Matrix component + * @param {number} d - Matrix component + * @param {number} tx - Matrix component + * @param {number} ty - Matrix component + * + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.set = function (a, b, c, d, tx, ty) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + this.tx = tx; + this.ty = ty; + return this; + }; + /** + * Creates an array from the current Matrix object. + * + * @param {boolean} transpose - Whether we need to transpose the matrix or not + * @param {Float32Array} [out=new Float32Array(9)] - If provided the array will be assigned to out + * @return {number[]} the newly created array which contains the matrix + */ + Matrix.prototype.toArray = function (transpose, out) { + if (!this.array) { + this.array = new Float32Array(9); + } + var array = out || this.array; + if (transpose) { + array[0] = this.a; + array[1] = this.b; + array[2] = 0; + array[3] = this.c; + array[4] = this.d; + array[5] = 0; + array[6] = this.tx; + array[7] = this.ty; + array[8] = 1; + } + else { + array[0] = this.a; + array[1] = this.c; + array[2] = this.tx; + array[3] = this.b; + array[4] = this.d; + array[5] = this.ty; + array[6] = 0; + array[7] = 0; + array[8] = 1; + } + return array; + }; + /** + * Get a new position with the current transformation applied. + * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) + * + * @param {PIXI.IPointData} pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @return {PIXI.Point} The new point, transformed through this matrix + */ + Matrix.prototype.apply = function (pos, newPos) { + newPos = (newPos || new Point()); + var x = pos.x; + var y = pos.y; + newPos.x = (this.a * x) + (this.c * y) + this.tx; + newPos.y = (this.b * x) + (this.d * y) + this.ty; + return newPos; + }; + /** + * Get a new position with the inverse of the current transformation applied. + * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) + * + * @param {PIXI.IPointData} pos - The origin + * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) + * @return {PIXI.Point} The new point, inverse-transformed through this matrix + */ + Matrix.prototype.applyInverse = function (pos, newPos) { + newPos = (newPos || new Point()); + var id = 1 / ((this.a * this.d) + (this.c * -this.b)); + var x = pos.x; + var y = pos.y; + newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id); + newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id); + return newPos; + }; + /** + * Translates the matrix on the x and y. + * + * @param {number} x - How much to translate x by + * @param {number} y - How much to translate y by + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.translate = function (x, y) { + this.tx += x; + this.ty += y; + return this; + }; + /** + * Applies a scale transformation to the matrix. + * + * @param {number} x - The amount to scale horizontally + * @param {number} y - The amount to scale vertically + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.scale = function (x, y) { + this.a *= x; + this.d *= y; + this.c *= x; + this.b *= y; + this.tx *= x; + this.ty *= y; + return this; + }; + /** + * Applies a rotation transformation to the matrix. + * + * @param {number} angle - The angle in radians. + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.rotate = function (angle) { + var cos = Math.cos(angle); + var sin = Math.sin(angle); + var a1 = this.a; + var c1 = this.c; + var tx1 = this.tx; + this.a = (a1 * cos) - (this.b * sin); + this.b = (a1 * sin) + (this.b * cos); + this.c = (c1 * cos) - (this.d * sin); + this.d = (c1 * sin) + (this.d * cos); + this.tx = (tx1 * cos) - (this.ty * sin); + this.ty = (tx1 * sin) + (this.ty * cos); + return this; + }; + /** + * Appends the given Matrix to this Matrix. + * + * @param {PIXI.Matrix} matrix - The matrix to append. + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.append = function (matrix) { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + this.a = (matrix.a * a1) + (matrix.b * c1); + this.b = (matrix.a * b1) + (matrix.b * d1); + this.c = (matrix.c * a1) + (matrix.d * c1); + this.d = (matrix.c * b1) + (matrix.d * d1); + this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx; + this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty; + return this; + }; + /** + * Sets the matrix based on all the available properties + * + * @param {number} x - Position on the x axis + * @param {number} y - Position on the y axis + * @param {number} pivotX - Pivot on the x axis + * @param {number} pivotY - Pivot on the y axis + * @param {number} scaleX - Scale on the x axis + * @param {number} scaleY - Scale on the y axis + * @param {number} rotation - Rotation in radians + * @param {number} skewX - Skew on the x axis + * @param {number} skewY - Skew on the y axis + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { + this.a = Math.cos(rotation + skewY) * scaleX; + this.b = Math.sin(rotation + skewY) * scaleX; + this.c = -Math.sin(rotation - skewX) * scaleY; + this.d = Math.cos(rotation - skewX) * scaleY; + this.tx = x - ((pivotX * this.a) + (pivotY * this.c)); + this.ty = y - ((pivotX * this.b) + (pivotY * this.d)); + return this; + }; + /** + * Prepends the given Matrix to this Matrix. + * + * @param {PIXI.Matrix} matrix - The matrix to prepend + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.prepend = function (matrix) { + var tx1 = this.tx; + if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) { + var a1 = this.a; + var c1 = this.c; + this.a = (a1 * matrix.a) + (this.b * matrix.c); + this.b = (a1 * matrix.b) + (this.b * matrix.d); + this.c = (c1 * matrix.a) + (this.d * matrix.c); + this.d = (c1 * matrix.b) + (this.d * matrix.d); + } + this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx; + this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty; + return this; + }; + /** + * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform. + * + * @param {PIXI.Transform} transform - The transform to apply the properties to. + * @return {PIXI.Transform} The transform with the newly applied properties + */ + Matrix.prototype.decompose = function (transform) { + // sort out rotation / skew.. + var a = this.a; + var b = this.b; + var c = this.c; + var d = this.d; + var skewX = -Math.atan2(-c, d); + var skewY = Math.atan2(b, a); + var delta = Math.abs(skewX + skewY); + if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) { + transform.rotation = skewY; + transform.skew.x = transform.skew.y = 0; + } + else { + transform.rotation = 0; + transform.skew.x = skewX; + transform.skew.y = skewY; + } + // next set scale + transform.scale.x = Math.sqrt((a * a) + (b * b)); + transform.scale.y = Math.sqrt((c * c) + (d * d)); + // next set position + transform.position.x = this.tx; + transform.position.y = this.ty; + return transform; + }; + /** + * Inverts this matrix + * + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.invert = function () { + var a1 = this.a; + var b1 = this.b; + var c1 = this.c; + var d1 = this.d; + var tx1 = this.tx; + var n = (a1 * d1) - (b1 * c1); + this.a = d1 / n; + this.b = -b1 / n; + this.c = -c1 / n; + this.d = a1 / n; + this.tx = ((c1 * this.ty) - (d1 * tx1)) / n; + this.ty = -((a1 * this.ty) - (b1 * tx1)) / n; + return this; + }; + /** + * Resets this Matrix to an identity (default) matrix. + * + * @return {PIXI.Matrix} This matrix. Good for chaining method calls. + */ + Matrix.prototype.identity = function () { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.tx = 0; + this.ty = 0; + return this; + }; + /** + * Creates a new Matrix object with the same values as this one. + * + * @return {PIXI.Matrix} A copy of this matrix. Good for chaining method calls. + */ + Matrix.prototype.clone = function () { + var matrix = new Matrix(); + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the given matrix to be the same as the ones in this matrix + * + * @param {PIXI.Matrix} matrix - The matrix to copy to. + * @return {PIXI.Matrix} The matrix given in parameter with its values updated. + */ + Matrix.prototype.copyTo = function (matrix) { + matrix.a = this.a; + matrix.b = this.b; + matrix.c = this.c; + matrix.d = this.d; + matrix.tx = this.tx; + matrix.ty = this.ty; + return matrix; + }; + /** + * Changes the values of the matrix to be the same as the ones in given matrix + * + * @param {PIXI.Matrix} matrix - The matrix to copy from. + * @return {PIXI.Matrix} this + */ + Matrix.prototype.copyFrom = function (matrix) { + this.a = matrix.a; + this.b = matrix.b; + this.c = matrix.c; + this.d = matrix.d; + this.tx = matrix.tx; + this.ty = matrix.ty; + return this; + }; + Object.defineProperty(Matrix, "IDENTITY", { + /** + * A default (identity) matrix + * + * @static + * @const + * @member {PIXI.Matrix} + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Matrix, "TEMP_MATRIX", { + /** + * A temp matrix + * + * @static + * @const + * @member {PIXI.Matrix} + */ + get: function () { + return new Matrix(); + }, + enumerable: false, + configurable: true + }); + return Matrix; + }()); + + // Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group + /* + * Transform matrix for operation n is: + * | ux | vx | + * | uy | vy | + */ + var ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1]; + var uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1]; + var vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1]; + var vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1]; + /** + * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * for the composition of each rotation in the dihederal group D8. + * + * @type number[][] + * @private + */ + var rotationCayley = []; + /** + * Matrices for each `GD8Symmetry` rotation. + * + * @type Matrix[] + * @private + */ + var rotationMatrices = []; + /* + * Alias for {@code Math.sign}. + */ + var signum = Math.sign; + /* + * Initializes `rotationCayley` and `rotationMatrices`. It is called + * only once below. + */ + function init() { + for (var i = 0; i < 16; i++) { + var row = []; + rotationCayley.push(row); + for (var j = 0; j < 16; j++) { + /* Multiplies rotation matrices i and j. */ + var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j])); + var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j])); + var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j])); + var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j])); + /* Finds rotation matrix matching the product and pushes it. */ + for (var k = 0; k < 16; k++) { + if (ux[k] === _ux && uy[k] === _uy + && vx[k] === _vx && vy[k] === _vy) { + row.push(k); + break; + } + } + } + } + for (var i = 0; i < 16; i++) { + var mat = new Matrix(); + mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0); + rotationMatrices.push(mat); + } + } + init(); + /** + * @memberof PIXI + * @typedef {number} GD8Symmetry + * @see PIXI.groupD8 + */ + /** + * Implements the dihedral group D8, which is similar to + * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html}; + * D8 is the same but with diagonals, and it is used for texture + * rotations. + * + * The directions the U- and V- axes after rotation + * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))` + * and `(vX(a), vY(a))`. These aren't necessarily unit vectors. + * + * **Origin:**
+ * This is the small part of gameofbombs.com portal system. It works. + * + * @see PIXI.groupD8.E + * @see PIXI.groupD8.SE + * @see PIXI.groupD8.S + * @see PIXI.groupD8.SW + * @see PIXI.groupD8.W + * @see PIXI.groupD8.NW + * @see PIXI.groupD8.N + * @see PIXI.groupD8.NE + * @author Ivan @ivanpopelyshev + * @namespace PIXI.groupD8 + * @memberof PIXI + */ + var groupD8 = { + /** + * | Rotation | Direction | + * |----------|-----------| + * | 0° | East | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + E: 0, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 45°↻ | Southeast | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SE: 1, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 90°↻ | South | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + S: 2, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 135°↻ | Southwest | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + SW: 3, + /** + * | Rotation | Direction | + * |----------|-----------| + * | 180° | West | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + W: 4, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -135°/225°↻ | Northwest | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NW: 5, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -90°/270°↻ | North | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + N: 6, + /** + * | Rotation | Direction | + * |-------------|--------------| + * | -45°/315°↻ | Northeast | + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + NE: 7, + /** + * Reflection about Y-axis. + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_VERTICAL: 8, + /** + * Reflection about the main diagonal. + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MAIN_DIAGONAL: 10, + /** + * Reflection about X-axis. + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + MIRROR_HORIZONTAL: 12, + /** + * Reflection about reverse diagonal. + * + * @memberof PIXI.groupD8 + * @constant {PIXI.GD8Symmetry} + */ + REVERSE_DIAGONAL: 14, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @return {PIXI.GD8Symmetry} The X-component of the U-axis + * after rotating the axes. + */ + uX: function (ind) { return ux[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @return {PIXI.GD8Symmetry} The Y-component of the U-axis + * after rotating the axes. + */ + uY: function (ind) { return uy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @return {PIXI.GD8Symmetry} The X-component of the V-axis + * after rotating the axes. + */ + vX: function (ind) { return vx[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} ind - sprite rotation angle. + * @return {PIXI.GD8Symmetry} The Y-component of the V-axis + * after rotating the axes. + */ + vY: function (ind) { return vy[ind]; }, + /** + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite + * is needed. Only rotations have opposite symmetries while + * reflections don't. + * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation` + */ + inv: function (rotation) { + if (rotation & 8) // true only if between 8 & 15 (reflections) + { + return rotation & 15; // or rotation % 16 + } + return (-rotation) & 7; // or (8 - rotation) % 8 + }, + /** + * Composes the two D8 operations. + * + * Taking `^` as reflection: + * + * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 | + * |-------|-----|-----|-----|-----|------|-------|-------|-------| + * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ | + * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ | + * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ | + * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ | + * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S | + * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W | + * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N | + * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E | + * + * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table} + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which + * is the row in the above cayley table. + * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which + * is the column in the above cayley table. + * @return {PIXI.GD8Symmetry} Composed operation + */ + add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); }, + /** + * Reverse of `add`. + * + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotationSecond - Second operation + * @param {PIXI.GD8Symmetry} rotationFirst - First operation + * @return {PIXI.GD8Symmetry} Result + */ + sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); }, + /** + * Adds 180 degrees to rotation, which is a commutative + * operation. + * + * @memberof PIXI.groupD8 + * @param {number} rotation - The number to rotate. + * @returns {number} Rotated number + */ + rotate180: function (rotation) { return rotation ^ 4; }, + /** + * Checks if the rotation angle is vertical, i.e. south + * or north. It doesn't work for reflections. + * + * @memberof PIXI.groupD8 + * @param {PIXI.GD8Symmetry} rotation - The number to check. + * @returns {boolean} Whether or not the direction is vertical + */ + isVertical: function (rotation) { return (rotation & 3) === 2; }, + /** + * Approximates the vector `V(dx,dy)` into one of the + * eight directions provided by `groupD8`. + * + * @memberof PIXI.groupD8 + * @param {number} dx - X-component of the vector + * @param {number} dy - Y-component of the vector + * @return {PIXI.GD8Symmetry} Approximation of the vector into + * one of the eight symmetries. + */ + byDirection: function (dx, dy) { + if (Math.abs(dx) * 2 <= Math.abs(dy)) { + if (dy >= 0) { + return groupD8.S; + } + return groupD8.N; + } + else if (Math.abs(dy) * 2 <= Math.abs(dx)) { + if (dx > 0) { + return groupD8.E; + } + return groupD8.W; + } + else if (dy > 0) { + if (dx > 0) { + return groupD8.SE; + } + return groupD8.SW; + } + else if (dx > 0) { + return groupD8.NE; + } + return groupD8.NW; + }, + /** + * Helps sprite to compensate texture packer rotation. + * + * @memberof PIXI.groupD8 + * @param {PIXI.Matrix} matrix - sprite world matrix + * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use. + * @param {number} tx - sprite anchoring + * @param {number} ty - sprite anchoring + */ + matrixAppendRotationInv: function (matrix, rotation, tx, ty) { + if (tx === void 0) { tx = 0; } + if (ty === void 0) { ty = 0; } + // Packer used "rotation", we use "inv(rotation)" + var mat = rotationMatrices[groupD8.inv(rotation)]; + mat.tx = tx; + mat.ty = ty; + matrix.append(mat); + }, + }; + + /** + * Transform that takes care about its versions + * + * @class + * @memberof PIXI + */ + var Transform = /** @class */ (function () { + function Transform() { + /** + * The world transformation matrix. + * + * @member {PIXI.Matrix} + */ + this.worldTransform = new Matrix(); + /** + * The local transformation matrix. + * + * @member {PIXI.Matrix} + */ + this.localTransform = new Matrix(); + /** + * The coordinate of the object relative to the local coordinates of the parent. + * + * @member {PIXI.ObservablePoint} + */ + this.position = new ObservablePoint(this.onChange, this, 0, 0); + /** + * The scale factor of the object. + * + * @member {PIXI.ObservablePoint} + */ + this.scale = new ObservablePoint(this.onChange, this, 1, 1); + /** + * The pivot point of the displayObject that it rotates around. + * + * @member {PIXI.ObservablePoint} + */ + this.pivot = new ObservablePoint(this.onChange, this, 0, 0); + /** + * The skew amount, on the x and y axis. + * + * @member {PIXI.ObservablePoint} + */ + this.skew = new ObservablePoint(this.updateSkew, this, 0, 0); + /** + * The rotation amount. + * + * @protected + * @member {number} + */ + this._rotation = 0; + /** + * The X-coordinate value of the normalized local X axis, + * the first column of the local transformation matrix without a scale. + * + * @protected + * @member {number} + */ + this._cx = 1; + /** + * The Y-coordinate value of the normalized local X axis, + * the first column of the local transformation matrix without a scale. + * + * @protected + * @member {number} + */ + this._sx = 0; + /** + * The X-coordinate value of the normalized local Y axis, + * the second column of the local transformation matrix without a scale. + * + * @protected + * @member {number} + */ + this._cy = 0; + /** + * The Y-coordinate value of the normalized local Y axis, + * the second column of the local transformation matrix without a scale. + * + * @protected + * @member {number} + */ + this._sy = 1; + /** + * The locally unique ID of the local transform. + * + * @protected + * @member {number} + */ + this._localID = 0; + /** + * The locally unique ID of the local transform + * used to calculate the current local transformation matrix. + * + * @protected + * @member {number} + */ + this._currentLocalID = 0; + /** + * The locally unique ID of the world transform. + * + * @protected + * @member {number} + */ + this._worldID = 0; + /** + * The locally unique ID of the parent's world transform + * used to calculate the current world transformation matrix. + * + * @protected + * @member {number} + */ + this._parentID = 0; + } + /** + * Called when a value changes. + * + * @protected + */ + Transform.prototype.onChange = function () { + this._localID++; + }; + /** + * Called when the skew or the rotation changes. + * + * @protected + */ + Transform.prototype.updateSkew = function () { + this._cx = Math.cos(this._rotation + this.skew.y); + this._sx = Math.sin(this._rotation + this.skew.y); + this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2 + this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2 + this._localID++; + }; + /** + * Updates the local transformation matrix. + */ + Transform.prototype.updateLocalTransform = function () { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + }; + /** + * Updates the local and the world transformation matrices. + * + * @param {PIXI.Transform} parentTransform - The parent transform + */ + Transform.prototype.updateTransform = function (parentTransform) { + var lt = this.localTransform; + if (this._localID !== this._currentLocalID) { + // get the matrix values of the displayobject based on its transform properties.. + lt.a = this._cx * this.scale.x; + lt.b = this._sx * this.scale.x; + lt.c = this._cy * this.scale.y; + lt.d = this._sy * this.scale.y; + lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c)); + lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d)); + this._currentLocalID = this._localID; + // force an update.. + this._parentID = -1; + } + if (this._parentID !== parentTransform._worldID) { + // concat the parent matrix with the objects transform. + var pt = parentTransform.worldTransform; + var wt = this.worldTransform; + wt.a = (lt.a * pt.a) + (lt.b * pt.c); + wt.b = (lt.a * pt.b) + (lt.b * pt.d); + wt.c = (lt.c * pt.a) + (lt.d * pt.c); + wt.d = (lt.c * pt.b) + (lt.d * pt.d); + wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx; + wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty; + this._parentID = parentTransform._worldID; + // update the id of the transform.. + this._worldID++; + } + }; + /** + * Decomposes a matrix and sets the transforms properties based on it. + * + * @param {PIXI.Matrix} matrix - The matrix to decompose + */ + Transform.prototype.setFromMatrix = function (matrix) { + matrix.decompose(this); + this._localID++; + }; + Object.defineProperty(Transform.prototype, "rotation", { + /** + * The rotation of the object in radians. + * + * @member {number} + */ + get: function () { + return this._rotation; + }, + set: function (value) { + if (this._rotation !== value) { + this._rotation = value; + this.updateSkew(); + } + }, + enumerable: false, + configurable: true + }); + /** + * A default (identity) transform + * + * @static + * @constant + * @member {PIXI.Transform} + */ + Transform.IDENTITY = new Transform(); + return Transform; + }()); + + /*! + * @pixi/display - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/display is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Sets the default value for the container property 'sortableChildren'. + * If set to true, the container will sort its children by zIndex value + * when updateTransform() is called, or manually if sortChildren() is called. + * + * This actually changes the order of elements in the array, so should be treated + * as a basic solution that is not performant compared to other solutions, + * such as @link https://github.com/pixijs/pixi-display + * + * Also be aware of that this may not work nicely with the addChildAt() function, + * as the zIndex sorting may cause the child to automatically sorted to another position. + * + * @static + * @constant + * @name SORTABLE_CHILDREN + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + settings.SORTABLE_CHILDREN = false; + + /** + * 'Builder' pattern for bounds rectangles. + * + * This could be called an Axis-Aligned Bounding Box. + * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems. + * + * @class + * @memberof PIXI + */ + var Bounds = /** @class */ (function () { + function Bounds() { + /** + * @member {number} + * @default 0 + */ + this.minX = Infinity; + /** + * @member {number} + * @default 0 + */ + this.minY = Infinity; + /** + * @member {number} + * @default 0 + */ + this.maxX = -Infinity; + /** + * @member {number} + * @default 0 + */ + this.maxY = -Infinity; + this.rect = null; + /** + * It is updated to _boundsID of corresponding object to keep bounds in sync with content. + * Updated from outside, thus public modifier. + * + * @member {number} + * @public + */ + this.updateID = -1; + } + /** + * Checks if bounds are empty. + * + * @return {boolean} True if empty. + */ + Bounds.prototype.isEmpty = function () { + return this.minX > this.maxX || this.minY > this.maxY; + }; + /** + * Clears the bounds and resets. + * + */ + Bounds.prototype.clear = function () { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + }; + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * + * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty + * @returns {PIXI.Rectangle} A rectangle of the bounds + */ + Bounds.prototype.getRectangle = function (rect) { + if (this.minX > this.maxX || this.minY > this.maxY) { + return Rectangle.EMPTY; + } + rect = rect || new Rectangle(0, 0, 1, 1); + rect.x = this.minX; + rect.y = this.minY; + rect.width = this.maxX - this.minX; + rect.height = this.maxY - this.minY; + return rect; + }; + /** + * This function should be inlined when its possible. + * + * @param {PIXI.IPointData} point - The point to add. + */ + Bounds.prototype.addPoint = function (point) { + this.minX = Math.min(this.minX, point.x); + this.maxX = Math.max(this.maxX, point.x); + this.minY = Math.min(this.minY, point.y); + this.maxY = Math.max(this.maxY, point.y); + }; + /** + * Adds a quad, not transformed + * + * @param {Float32Array} vertices - The verts to add. + */ + Bounds.prototype.addQuad = function (vertices) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = vertices[0]; + var y = vertices[1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[2]; + y = vertices[3]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[4]; + y = vertices[5]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[6]; + y = vertices[7]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds sprite frame, transformed. + * + * @param {PIXI.Transform} transform - transform to apply + * @param {number} x0 - left X of frame + * @param {number} y0 - top Y of frame + * @param {number} x1 - right X of frame + * @param {number} y1 - bottom Y of frame + */ + Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { + this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); + }; + /** + * Adds sprite frame, multiplied by matrix + * + * @param {PIXI.Matrix} matrix - matrix to apply + * @param {number} x0 - left X of frame + * @param {number} y0 - top Y of frame + * @param {number} x1 - right X of frame + * @param {number} y1 - bottom Y of frame + */ + Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = (a * x0) + (c * y0) + tx; + var y = (b * x0) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y0) + tx; + y = (b * x1) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x0) + (c * y1) + tx; + y = (b * x0) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y1) + tx; + y = (b * x1) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds screen vertices from array + * + * @param {Float32Array} vertexData - calculated vertices + * @param {number} beginOffset - begin offset + * @param {number} endOffset - end offset, excluded + */ + Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var x = vertexData[i]; + var y = vertexData[i + 1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Add an array of mesh vertices + * + * @param {PIXI.Transform} transform - mesh transform + * @param {Float32Array} vertices - mesh coordinates in array + * @param {number} beginOffset - begin offset + * @param {number} endOffset - end offset, excluded + */ + Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { + this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); + }; + /** + * Add an array of mesh vertices. + * + * @param {PIXI.Matrix} matrix - mesh matrix + * @param {Float32Array} vertices - mesh coordinates in array + * @param {number} beginOffset - begin offset + * @param {number} endOffset - end offset, excluded + * @param {number} [padX=0] - x padding + * @param {number} [padY=0] - y padding + */ + Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { + if (padX === void 0) { padX = 0; } + if (padY === void 0) { padY = padX; } + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var rawX = vertices[i]; + var rawY = vertices[i + 1]; + var x = (a * rawX) + (c * rawY) + tx; + var y = (d * rawY) + (b * rawX) + ty; + minX = Math.min(minX, x - padX); + maxX = Math.max(maxX, x + padX); + minY = Math.min(minY, y - padY); + maxY = Math.max(maxY, y + padY); + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds other Bounds. + * + * @param {PIXI.Bounds} bounds - The Bounds to be added + */ + Bounds.prototype.addBounds = function (bounds) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = bounds.minX < minX ? bounds.minX : minX; + this.minY = bounds.minY < minY ? bounds.minY : minY; + this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; + this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; + }; + /** + * Adds other Bounds, masked with Bounds. + * + * @param {PIXI.Bounds} bounds - The Bounds to be added. + * @param {PIXI.Bounds} mask - TODO + */ + Bounds.prototype.addBoundsMask = function (bounds, mask) { + var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; + var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; + var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; + var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. + * + * @param {PIXI.Bounds} bounds - other bounds + * @param {PIXI.Matrix} matrix - multiplicator + */ + Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { + this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); + }; + /** + * Adds other Bounds, masked with Rectangle. + * + * @param {PIXI.Bounds} bounds - TODO + * @param {PIXI.Rectangle} area - TODO + */ + Bounds.prototype.addBoundsArea = function (bounds, area) { + var _minX = bounds.minX > area.x ? bounds.minX : area.x; + var _minY = bounds.minY > area.y ? bounds.minY : area.y; + var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); + var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Pads bounds object, making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * + * @param {number} [paddingX=0] - The horizontal padding amount. + * @param {number} [paddingY=0] - The vertical padding amount. + */ + Bounds.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + if (!this.isEmpty()) { + this.minX -= paddingX; + this.maxX += paddingX; + this.minY -= paddingY; + this.maxY += paddingY; + } + }; + /** + * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) + * + * @param {number} x0 - left X of frame + * @param {number} y0 - top Y of frame + * @param {number} x1 - right X of frame + * @param {number} y1 - bottom Y of frame + * @param {number} padX - padding X + * @param {number} padY - padding Y + */ + Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { + x0 -= padX; + y0 -= padY; + x1 += padX; + y1 += padY; + this.minX = this.minX < x0 ? this.minX : x0; + this.maxX = this.maxX > x1 ? this.maxX : x1; + this.minY = this.minY < y0 ? this.minY : y0; + this.maxY = this.maxY > y1 ? this.maxY : y1; + }; + return Bounds; + }()); + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * The base class for all objects that are rendered on the screen. + * + * This is an abstract class and should not be used on its own; rather it should b e extended. + * + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ + var DisplayObject = /** @class */ (function (_super) { + __extends(DisplayObject, _super); + function DisplayObject() { + var _this = _super.call(this) || this; + _this.tempDisplayObjectParent = null; + // TODO: need to create Transform from factory + /** + * World transform and local transform of this object. + * This will become read-only later, please do not assign anything there unless you know what are you doing. + * + * @member {PIXI.Transform} + */ + _this.transform = new Transform(); + /** + * The opacity of the object. + * + * @member {number} + */ + _this.alpha = 1; + /** + * The visibility of the object. If false the object will not be drawn, and + * the updateTransform function will not be called. + * + * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually. + * + * @member {boolean} + */ + _this.visible = true; + /** + * Can this object be rendered, if false the object will not be drawn but the updateTransform + * methods will still be called. + * + * Only affects recursive calls from parent. You can ask for bounds manually. + * + * @member {boolean} + */ + _this.renderable = true; + /** + * The display object container that contains this display object. + * + * @member {PIXI.Container} + */ + _this.parent = null; + /** + * The multiplied alpha of the displayObject. + * + * @member {number} + * @readonly + */ + _this.worldAlpha = 1; + /** + * Which index in the children array the display component was before the previous zIndex sort. + * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. + * + * @member {number} + * @protected + */ + _this._lastSortedIndex = 0; + /** + * The zIndex of the displayObject. + * A higher value will mean it will be rendered on top of other displayObjects within the same container. + * + * @member {number} + * @protected + */ + _this._zIndex = 0; + /** + * The area the filter is applied to. This is used as more of an optimization + * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle. + * + * Also works as an interaction mask. + * + * @member {?PIXI.Rectangle} + */ + _this.filterArea = null; + /** + * Sets the filters for the displayObject. + * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. + * To remove filters simply set this property to `'null'`. + * + * @member {?PIXI.Filter[]} + */ + _this.filters = null; + /** + * Currently enabled filters + * @member {PIXI.Filter[]} + * @protected + */ + _this._enabledFilters = null; + /** + * The bounds object, this is used to calculate and store the bounds of the displayObject. + * + * @member {PIXI.Bounds} + */ + _this._bounds = new Bounds(); + /** + * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. + * + * @member {PIXI.Bounds} + */ + _this._localBounds = null; + /** + * Flags the cached bounds as dirty. + * + * @member {number} + * @protected + */ + _this._boundsID = 0; + /** + * Cache of this display-object's bounds-rectangle. + * + * @member {PIXI.Bounds} + * @protected + */ + _this._boundsRect = null; + /** + * Cache of this display-object's local-bounds rectangle. + * + * @member {PIXI.Bounds} + * @protected + */ + _this._localBoundsRect = null; + /** + * The original, cached mask of the object. + * + * @member {PIXI.Container|PIXI.MaskData|null} + * @protected + */ + _this._mask = null; + /** + * Fired when this DisplayObject is added to a Container. + * + * @event PIXI.DisplayObject#added + * @param {PIXI.Container} container - The container added to. + */ + /** + * Fired when this DisplayObject is removed from a Container. + * + * @event PIXI.DisplayObject#removed + * @param {PIXI.Container} container - The container removed from. + */ + /** + * If the object has been destroyed via destroy(). If true, it should not be used. + * + * @member {boolean} + * @protected + */ + _this._destroyed = false; + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + _this.isSprite = false; + /** + * Does any other displayObject use this object as a mask? + * @member {boolean} + */ + _this.isMask = false; + return _this; + } + /** + * Mixes all enumerable properties and methods from a source object to DisplayObject. + * + * @param {object} source - The source of properties and methods to mix in. + */ + DisplayObject.mixin = function (source) { + // in ES8/ES2017, this would be really easy: + // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); + // get all the enumerable property keys + var keys = Object.keys(source); + // loop through properties + for (var i = 0; i < keys.length; ++i) { + var propertyName = keys[i]; + // Set the property using the property descriptor - this works for accessors and normal value properties + Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); + } + }; + /** + * Recursively updates transform of all objects from the root to this one + * internal function for toLocal() + */ + DisplayObject.prototype._recursivePostUpdateTransform = function () { + if (this.parent) { + this.parent._recursivePostUpdateTransform(); + this.transform.updateTransform(this.parent.transform); + } + else { + this.transform.updateTransform(this._tempDisplayObjectParent.transform); + } + }; + /** + * Updates the object transform for rendering. + * + * TODO - Optimization pass! + */ + DisplayObject.prototype.updateTransform = function () { + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // multiply the alphas.. + this.worldAlpha = this.alpha * this.parent.worldAlpha; + }; + /** + * Retrieves the bounds of the displayObject as a rectangle object. + * + * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost. + * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. + * @return {PIXI.Rectangle} The rectangular bounding area. + */ + DisplayObject.prototype.getBounds = function (skipUpdate, rect) { + if (!skipUpdate) { + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } + else { + this._recursivePostUpdateTransform(); + this.updateTransform(); + } + } + if (this._bounds.updateID !== this._boundsID) { + this.calculateBounds(); + this._bounds.updateID = this._boundsID; + } + if (!rect) { + if (!this._boundsRect) { + this._boundsRect = new Rectangle(); + } + rect = this._boundsRect; + } + return this._bounds.getRectangle(rect); + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. + * @return {PIXI.Rectangle} The rectangular bounding area. + */ + DisplayObject.prototype.getLocalBounds = function (rect) { + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new Rectangle(); + } + rect = this._localBoundsRect; + } + if (!this._localBounds) { + this._localBounds = new Bounds(); + } + var transformRef = this.transform; + var parentRef = this.parent; + this.parent = null; + this.transform = this._tempDisplayObjectParent.transform; + var worldBounds = this._bounds; + var worldBoundsID = this._boundsID; + this._bounds = this._localBounds; + var bounds = this.getBounds(false, rect); + this.parent = parentRef; + this.transform = transformRef; + this._bounds = worldBounds; + this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects + return bounds; + }; + /** + * Calculates the global position of the display object. + * + * @param {PIXI.IPointData} position - The world origin to calculate from. + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param {boolean} [skipUpdate=false] - Should we skip the update transform. + * @return {PIXI.Point} A point object representing the position of this object. + */ + DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { + if (skipUpdate === void 0) { skipUpdate = false; } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // don't need to update the lot + return this.worldTransform.apply(position, point); + }; + /** + * Calculates the local position of the display object relative to another point. + * + * @param {PIXI.IPointData} position - The world origin to calculate from. + * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional + * (otherwise will create a new Point). + * @param {boolean} [skipUpdate=false] - Should we skip the update transform + * @return {PIXI.Point} A point object representing the position of this object + */ + DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { + if (from) { + position = from.toGlobal(position, point, skipUpdate); + } + if (!skipUpdate) { + this._recursivePostUpdateTransform(); + // this parent check is for just in case the item is a root object. + // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly + // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) + if (!this.parent) { + this.parent = this._tempDisplayObjectParent; + this.displayObjectUpdateTransform(); + this.parent = null; + } + else { + this.displayObjectUpdateTransform(); + } + } + // simply apply the matrix.. + return this.worldTransform.applyInverse(position, point); + }; + /** + * Set the parent Container of this DisplayObject. + * + * @param {PIXI.Container} container - The Container to add this DisplayObject to. + * @return {PIXI.Container} The Container that this DisplayObject was added to. + */ + DisplayObject.prototype.setParent = function (container) { + if (!container || !container.addChild) { + throw new Error('setParent: Argument must be a Container'); + } + container.addChild(this); + return container; + }; + /** + * Convenience function to set the position, scale, skew and pivot at once. + * + * @param {number} [x=0] - The X position + * @param {number} [y=0] - The Y position + * @param {number} [scaleX=1] - The X scale value + * @param {number} [scaleY=1] - The Y scale value + * @param {number} [rotation=0] - The rotation + * @param {number} [skewX=0] - The X skew value + * @param {number} [skewY=0] - The Y skew value + * @param {number} [pivotX=0] - The X pivot value + * @param {number} [pivotY=0] - The Y pivot value + * @return {PIXI.DisplayObject} The DisplayObject instance + */ + DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (scaleX === void 0) { scaleX = 1; } + if (scaleY === void 0) { scaleY = 1; } + if (rotation === void 0) { rotation = 0; } + if (skewX === void 0) { skewX = 0; } + if (skewY === void 0) { skewY = 0; } + if (pivotX === void 0) { pivotX = 0; } + if (pivotY === void 0) { pivotY = 0; } + this.position.x = x; + this.position.y = y; + this.scale.x = !scaleX ? 1 : scaleX; + this.scale.y = !scaleY ? 1 : scaleY; + this.rotation = rotation; + this.skew.x = skewX; + this.skew.y = skewY; + this.pivot.x = pivotX; + this.pivot.y = pivotY; + return this; + }; + /** + * Base destroy method for generic display objects. This will automatically + * remove the display object from its parent Container as well as remove + * all current event listeners and internal references. Do not use a DisplayObject + * after calling `destroy()`. + * + */ + DisplayObject.prototype.destroy = function (_options) { + if (this.parent) { + this.parent.removeChild(this); + } + this.removeAllListeners(); + this.transform = null; + this.parent = null; + this._bounds = null; + this._mask = null; + this.filters = null; + this.filterArea = null; + this.hitArea = null; + this.interactive = false; + this.interactiveChildren = false; + this._destroyed = true; + }; + Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { + /** + * @protected + * @member {PIXI.Container} + */ + get: function () { + if (this.tempDisplayObjectParent === null) { + // eslint-disable-next-line no-use-before-define + this.tempDisplayObjectParent = new TemporaryDisplayObject(); + } + return this.tempDisplayObjectParent; + }, + enumerable: false, + configurable: true + }); + /** + * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root + * + * ``` + * const cacheParent = elem.enableTempParent(); + * elem.updateTransform(); + * elem.disableTempParent(cacheParent); + * ``` + * + * @returns {PIXI.DisplayObject} current parent + */ + DisplayObject.prototype.enableTempParent = function () { + var myParent = this.parent; + this.parent = this._tempDisplayObjectParent; + return myParent; + }; + /** + * Pair method for `enableTempParent` + * @param {PIXI.DisplayObject} cacheParent actual parent of element + */ + DisplayObject.prototype.disableTempParent = function (cacheParent) { + this.parent = cacheParent; + }; + Object.defineProperty(DisplayObject.prototype, "x", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + * + * @member {number} + */ + get: function () { + return this.position.x; + }, + set: function (value) { + this.transform.position.x = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "y", { + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + * + * @member {number} + */ + get: function () { + return this.position.y; + }, + set: function (value) { + this.transform.position.y = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldTransform", { + /** + * Current transform of the object based on world (parent) factors. + * + * @member {PIXI.Matrix} + * @readonly + */ + get: function () { + return this.transform.worldTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "localTransform", { + /** + * Current transform of the object based on local factors: position, scale, other stuff. + * + * @member {PIXI.Matrix} + * @readonly + */ + get: function () { + return this.transform.localTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "position", { + /** + * The coordinate of the object relative to the local coordinates of the parent. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.position; + }, + set: function (value) { + this.transform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "scale", { + /** + * The scale factor of the object. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.scale; + }, + set: function (value) { + this.transform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "pivot", { + /** + * The pivot point of the displayObject that it rotates around. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.pivot; + }, + set: function (value) { + this.transform.pivot.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "skew", { + /** + * The skew factor for the object in radians. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.skew; + }, + set: function (value) { + this.transform.skew.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "rotation", { + /** + * The rotation of the object in radians. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + * + * @member {number} + */ + get: function () { + return this.transform.rotation; + }, + set: function (value) { + this.transform.rotation = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "angle", { + /** + * The angle of the object in degrees. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + * + * @member {number} + */ + get: function () { + return this.transform.rotation * RAD_TO_DEG; + }, + set: function (value) { + this.transform.rotation = value * DEG_TO_RAD; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "zIndex", { + /** + * The zIndex of the displayObject. + * If a container has the sortableChildren property set to true, children will be automatically + * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, + * and thus rendered on top of other displayObjects within the same container. + * + * @member {number} + */ + get: function () { + return this._zIndex; + }, + set: function (value) { + this._zIndex = value; + if (this.parent) { + this.parent.sortDirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldVisible", { + /** + * Indicates if the object is globally visible. + * + * @member {boolean} + * @readonly + */ + get: function () { + var item = this; + do { + if (!item.visible) { + return false; + } + item = item.parent; + } while (item); + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "mask", { + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a + * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it + * utilities shape clipping. To remove a mask, set this property to `null`. + * + * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. + * @example + * const graphics = new PIXI.Graphics(); + * graphics.beginFill(0xFF3300); + * graphics.drawRect(50, 250, 100, 100); + * graphics.endFill(); + * + * const sprite = new PIXI.Sprite(texture); + * sprite.mask = graphics; + * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + * + * @member {PIXI.Container|PIXI.MaskData|null} + */ + get: function () { + return this._mask; + }, + set: function (value) { + if (this._mask) { + var maskObject = (this._mask.maskObject || this._mask); + maskObject.renderable = true; + maskObject.isMask = false; + } + this._mask = value; + if (this._mask) { + var maskObject = (this._mask.maskObject || this._mask); + maskObject.renderable = false; + maskObject.isMask = true; + } + }, + enumerable: false, + configurable: true + }); + return DisplayObject; + }(eventemitter3)); + var TemporaryDisplayObject = /** @class */ (function (_super) { + __extends(TemporaryDisplayObject, _super); + function TemporaryDisplayObject() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.sortDirty = null; + return _this; + } + return TemporaryDisplayObject; + }(DisplayObject)); + /** + * DisplayObject default updateTransform, does not update children of container. + * Will crash if there's no parent element. + * + * @memberof PIXI.DisplayObject# + * @function displayObjectUpdateTransform + */ + DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; + + function sortChildren(a, b) { + if (a.zIndex === b.zIndex) { + return a._lastSortedIndex - b._lastSortedIndex; + } + return a.zIndex - b.zIndex; + } + /** + * A Container represents a collection of display objects. + * + * It is the base class of all display objects that act as a container for other objects (like Sprites). + * + *```js + * let container = new PIXI.Container(); + * container.addChild(sprite); + * ``` + * + * @class + * @extends PIXI.DisplayObject + * @memberof PIXI + */ + var Container = /** @class */ (function (_super) { + __extends(Container, _super); + function Container() { + var _this = _super.call(this) || this; + /** + * The array of children of this container. + * + * @member {PIXI.DisplayObject[]} + * @readonly + */ + _this.children = []; + /** + * If set to true, the container will sort its children by zIndex value + * when updateTransform() is called, or manually if sortChildren() is called. + * + * This actually changes the order of elements in the array, so should be treated + * as a basic solution that is not performant compared to other solutions, + * such as @link https://github.com/pixijs/pixi-display + * + * Also be aware of that this may not work nicely with the addChildAt() function, + * as the zIndex sorting may cause the child to automatically sorted to another position. + * + * @see PIXI.settings.SORTABLE_CHILDREN + * + * @member {boolean} + */ + _this.sortableChildren = settings.SORTABLE_CHILDREN; + /** + * Should children be sorted by zIndex at the next updateTransform call. + * Will get automatically set to true if a new child is added, or if a child's zIndex changes. + * + * @member {boolean} + */ + _this.sortDirty = false; + return _this; + /** + * Fired when a DisplayObject is added to this Container. + * + * @event PIXI.Container#childAdded + * @param {PIXI.DisplayObject} child - The child added to the Container. + * @param {PIXI.Container} container - The container that added the child. + * @param {number} index - The children's index of the added child. + */ + /** + * Fired when a DisplayObject is removed from this Container. + * + * @event PIXI.DisplayObject#removedFrom + * @param {PIXI.DisplayObject} child - The child removed from the Container. + * @param {PIXI.Container} container - The container that removed removed the child. + * @param {number} index - The former children's index of the removed child + */ + } + /** + * Overridable method that can be used by Container subclasses whenever the children array is modified + * + * @protected + */ + Container.prototype.onChildrenChange = function (_length) { + /* empty */ + }; + /** + * Adds one or more children to the container. + * + * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` + * + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container + * @return {PIXI.DisplayObject} The first child that was added. + */ + Container.prototype.addChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the array and add all children + for (var i = 0; i < children.length; i++) { + // eslint-disable-next-line prefer-rest-params + this.addChild(children[i]); + } + } + else { + var child = children[0]; + // if the child has a parent then lets remove it as PixiJS objects can only exist in one place + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.push(child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(this.children.length - 1); + this.emit('childAdded', child, this, this.children.length - 1); + child.emit('added', this); + } + return children[0]; + }; + /** + * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown + * + * @param {PIXI.DisplayObject} child - The child to add + * @param {number} index - The index to place the child in + * @return {PIXI.DisplayObject} The child that was added. + */ + Container.prototype.addChildAt = function (child, index) { + if (index < 0 || index > this.children.length) { + throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); + } + if (child.parent) { + child.parent.removeChild(child); + } + child.parent = this; + this.sortDirty = true; + // ensure child transform will be recalculated + child.transform._parentID = -1; + this.children.splice(index, 0, child); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('added', this); + this.emit('childAdded', child, this, index); + return child; + }; + /** + * Swaps the position of 2 Display Objects within this container. + * + * @param {PIXI.DisplayObject} child - First display object to swap + * @param {PIXI.DisplayObject} child2 - Second display object to swap + */ + Container.prototype.swapChildren = function (child, child2) { + if (child === child2) { + return; + } + var index1 = this.getChildIndex(child); + var index2 = this.getChildIndex(child2); + this.children[index1] = child2; + this.children[index2] = child; + this.onChildrenChange(index1 < index2 ? index1 : index2); + }; + /** + * Returns the index position of a child DisplayObject instance + * + * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify + * @return {number} The index position of the child display object to identify + */ + Container.prototype.getChildIndex = function (child) { + var index = this.children.indexOf(child); + if (index === -1) { + throw new Error('The supplied DisplayObject must be a child of the caller'); + } + return index; + }; + /** + * Changes the position of an existing child in the display object container + * + * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number + * @param {number} index - The resulting index number for the child display object + */ + Container.prototype.setChildIndex = function (child, index) { + if (index < 0 || index >= this.children.length) { + throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); + } + var currentIndex = this.getChildIndex(child); + removeItems(this.children, currentIndex, 1); // remove from old position + this.children.splice(index, 0, child); // add at new position + this.onChildrenChange(index); + }; + /** + * Returns the child at the specified index + * + * @param {number} index - The index to get the child at + * @return {PIXI.DisplayObject} The child at the given index, if any. + */ + Container.prototype.getChildAt = function (index) { + if (index < 0 || index >= this.children.length) { + throw new Error("getChildAt: Index (" + index + ") does not exist."); + } + return this.children[index]; + }; + /** + * Removes one or more children from the container. + * + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove + * @return {PIXI.DisplayObject} The first child that was removed. + */ + Container.prototype.removeChild = function () { + var arguments$1 = arguments; + + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } + // if there is only one argument we can bypass looping through the them + if (children.length > 1) { + // loop through the arguments property and remove all children + for (var i = 0; i < children.length; i++) { + this.removeChild(children[i]); + } + } + else { + var child = children[0]; + var index = this.children.indexOf(child); + if (index === -1) + { return null; } + child.parent = null; + // ensure child transform will be recalculated + child.transform._parentID = -1; + removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + } + return children[0]; + }; + /** + * Removes a child from the specified index position. + * + * @param {number} index - The index to get the child from + * @return {PIXI.DisplayObject} The child that was removed. + */ + Container.prototype.removeChildAt = function (index) { + var child = this.getChildAt(index); + // ensure child transform will be recalculated.. + child.parent = null; + child.transform._parentID = -1; + removeItems(this.children, index, 1); + // ensure bounds will be recalculated + this._boundsID++; + // TODO - lets either do all callbacks or all events.. not both! + this.onChildrenChange(index); + child.emit('removed', this); + this.emit('childRemoved', child, this, index); + return child; + }; + /** + * Removes all children from this container that are within the begin and end indexes. + * + * @param {number} [beginIndex=0] - The beginning position. + * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container. + * @returns {PIXI.DisplayObject[]} List of removed children + */ + Container.prototype.removeChildren = function (beginIndex, endIndex) { + if (beginIndex === void 0) { beginIndex = 0; } + if (endIndex === void 0) { endIndex = this.children.length; } + var begin = beginIndex; + var end = endIndex; + var range = end - begin; + var removed; + if (range > 0 && range <= end) { + removed = this.children.splice(begin, range); + for (var i = 0; i < removed.length; ++i) { + removed[i].parent = null; + if (removed[i].transform) { + removed[i].transform._parentID = -1; + } + } + this._boundsID++; + this.onChildrenChange(beginIndex); + for (var i = 0; i < removed.length; ++i) { + removed[i].emit('removed', this); + this.emit('childRemoved', removed[i], this, i); + } + return removed; + } + else if (range === 0 && this.children.length === 0) { + return []; + } + throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); + }; + /** + * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex. + */ + Container.prototype.sortChildren = function () { + var sortRequired = false; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + child._lastSortedIndex = i; + if (!sortRequired && child.zIndex !== 0) { + sortRequired = true; + } + } + if (sortRequired && this.children.length > 1) { + this.children.sort(sortChildren); + } + this.sortDirty = false; + }; + /** + * Updates the transform on all children of this container for rendering + */ + Container.prototype.updateTransform = function () { + if (this.sortableChildren && this.sortDirty) { + this.sortChildren(); + } + this._boundsID++; + this.transform.updateTransform(this.parent.transform); + // TODO: check render flags, how to process stuff here + this.worldAlpha = this.alpha * this.parent.worldAlpha; + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + }; + /** + * Recalculates the bounds of the container. + * + */ + Container.prototype.calculateBounds = function () { + this._bounds.clear(); + this._calculateBounds(); + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (!child.visible || !child.renderable) { + continue; + } + child.calculateBounds(); + // TODO: filter+mask, need to mask both somehow + if (child._mask) { + var maskObject = (child._mask.maskObject || child._mask); + maskObject.calculateBounds(); + this._bounds.addBoundsMask(child._bounds, maskObject._bounds); + } + else if (child.filterArea) { + this._bounds.addBoundsArea(child._bounds, child.filterArea); + } + else { + this._bounds.addBounds(child._bounds); + } + } + this._bounds.updateID = this._boundsID; + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. + * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms, + * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. + * @return {PIXI.Rectangle} The rectangular bounding area. + */ + Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { + if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } + var result = _super.prototype.getLocalBounds.call(this, rect); + if (!skipChildrenUpdate) { + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + } + return result; + }; + /** + * Recalculates the bounds of the object. Override this to + * calculate the bounds of the specific object (not including children). + * + * @protected + */ + Container.prototype._calculateBounds = function () { + // FILL IN// + }; + /** + * Renders the object using the WebGL renderer + * + * @param {PIXI.Renderer} renderer - The renderer + */ + Container.prototype.render = function (renderer) { + // if the object is not visible or the alpha is 0 then no need to render this element + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + // do a quick check to see if this element has a mask or a filter. + if (this._mask || (this.filters && this.filters.length)) { + this.renderAdvanced(renderer); + } + else { + this._render(renderer); + // simple render children! + for (var i = 0, j = this.children.length; i < j; ++i) { + this.children[i].render(renderer); + } + } + }; + /** + * Render the object using the WebGL renderer and advanced features. + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Container.prototype.renderAdvanced = function (renderer) { + renderer.batch.flush(); + var filters = this.filters; + var mask = this._mask; + // push filter first as we need to ensure the stencil buffer is correct for any masking + if (filters) { + if (!this._enabledFilters) { + this._enabledFilters = []; + } + this._enabledFilters.length = 0; + for (var i = 0; i < filters.length; i++) { + if (filters[i].enabled) { + this._enabledFilters.push(filters[i]); + } + } + if (this._enabledFilters.length) { + renderer.filter.push(this, this._enabledFilters); + } + } + if (mask) { + renderer.mask.push(this, this._mask); + } + // add this object to the batch, only rendered if it has a texture. + this._render(renderer); + // now loop through the children and make sure they get rendered + for (var i = 0, j = this.children.length; i < j; i++) { + this.children[i].render(renderer); + } + renderer.batch.flush(); + if (mask) { + renderer.mask.pop(this); + } + if (filters && this._enabledFilters && this._enabledFilters.length) { + renderer.filter.pop(); + } + }; + /** + * To be overridden by the subclasses. + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Container.prototype._render = function (_renderer) { + // this is where content itself gets rendered... + }; + /** + * Removes all internal references and listeners as well as removes children from the display list. + * Do not use a Container after calling `destroy`. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + Container.prototype.destroy = function (options) { + _super.prototype.destroy.call(this); + this.sortDirty = false; + var destroyChildren = typeof options === 'boolean' ? options : options && options.children; + var oldChildren = this.removeChildren(0, this.children.length); + if (destroyChildren) { + for (var i = 0; i < oldChildren.length; ++i) { + oldChildren[i].destroy(options); + } + } + }; + Object.defineProperty(Container.prototype, "width", { + /** + * The width of the Container, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this.scale.x * this.getLocalBounds().width; + }, + set: function (value) { + var width = this.getLocalBounds().width; + if (width !== 0) { + this.scale.x = value / width; + } + else { + this.scale.x = 1; + } + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Container.prototype, "height", { + /** + * The height of the Container, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this.scale.y * this.getLocalBounds().height; + }, + set: function (value) { + var height = this.getLocalBounds().height; + if (height !== 0) { + this.scale.y = value / height; + } + else { + this.scale.y = 1; + } + this._height = value; + }, + enumerable: false, + configurable: true + }); + return Container; + }(DisplayObject)); + /** + * Container default updateTransform, does update children of container. + * Will crash if there's no parent element. + * + * @memberof PIXI.Container# + * @function containerUpdateTransform + */ + Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; + + /*! + * @pixi/accessibility - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/accessibility is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Default property values of accessible objects + * used by {@link PIXI.AccessibilityManager}. + * + * @private + * @function accessibleTarget + * @memberof PIXI + * @type {Object} + * @example + * function MyObject() {} + * + * Object.assign( + * MyObject.prototype, + * PIXI.accessibleTarget + * ); + */ + var accessibleTarget = { + /** + * Flag for if the object is accessible. If true AccessibilityManager will overlay a + * shadow div with attributes set + * + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + accessible: false, + /** + * Sets the title attribute of the shadow div + * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' + * + * @member {?string} + * @memberof PIXI.DisplayObject# + */ + accessibleTitle: null, + /** + * Sets the aria-label attribute of the shadow div + * + * @member {string} + * @memberof PIXI.DisplayObject# + */ + accessibleHint: null, + /** + * @member {number} + * @memberof PIXI.DisplayObject# + * @private + * @todo Needs docs. + */ + tabIndex: 0, + /** + * @member {boolean} + * @memberof PIXI.DisplayObject# + * @todo Needs docs. + */ + _accessibleActive: false, + /** + * @member {boolean} + * @memberof PIXI.DisplayObject# + * @todo Needs docs. + */ + _accessibleDiv: null, + /** + * Specify the type of div the accessible layer is. Screen readers treat the element differently + * depending on this type. Defaults to button. + * + * @member {string} + * @memberof PIXI.DisplayObject# + * @default 'button' + */ + accessibleType: 'button', + /** + * Specify the pointer-events the accessible div will use + * Defaults to auto. + * + * @member {string} + * @memberof PIXI.DisplayObject# + * @default 'auto' + */ + accessiblePointerEvents: 'auto', + /** + * Setting to false will prevent any children inside this container to + * be accessible. Defaults to true. + * + * @member {boolean} + * @memberof PIXI.DisplayObject# + * @default true + */ + accessibleChildren: true, + renderId: -1, + }; + + // add some extra variables to the container.. + DisplayObject.mixin(accessibleTarget); + var KEY_CODE_TAB = 9; + var DIV_TOUCH_SIZE = 100; + var DIV_TOUCH_POS_X = 0; + var DIV_TOUCH_POS_Y = 0; + var DIV_TOUCH_ZINDEX = 2; + var DIV_HOOK_SIZE = 1; + var DIV_HOOK_POS_X = -1000; + var DIV_HOOK_POS_Y = -1000; + var DIV_HOOK_ZINDEX = 2; + /** + * The Accessibility manager recreates the ability to tab and have content read by screen readers. + * This is very important as it can possibly help people with disabilities access PixiJS content. + * + * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the + * events as if the mouse was being used, minimizing the effort required to implement. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` + * + * @class + * @memberof PIXI + */ + var AccessibilityManager = /** @class */ (function () { + /** + * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer + */ + function AccessibilityManager(renderer) { + /** + * @type {?HTMLElement} + * @private + */ + this._hookDiv = null; + if (isMobile$1.tablet || isMobile$1.phone) { + this.createTouchHook(); + } + // first we create a div that will sit over the PixiJS element. This is where the div overlays will go. + var div = document.createElement('div'); + div.style.width = DIV_TOUCH_SIZE + "px"; + div.style.height = DIV_TOUCH_SIZE + "px"; + div.style.position = 'absolute'; + div.style.top = DIV_TOUCH_POS_X + "px"; + div.style.left = DIV_TOUCH_POS_Y + "px"; + div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); + /** + * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. + * + * @type {HTMLElement} + * @private + */ + this.div = div; + /** + * A simple pool for storing divs. + * + * @type {*} + * @private + */ + this.pool = []; + /** + * This is a tick used to check if an object is no longer being rendered. + * + * @type {Number} + * @private + */ + this.renderId = 0; + /** + * Setting this to true will visually show the divs. + * + * @type {boolean} + */ + this.debug = false; + /** + * The renderer this accessibility manager works for. + * + * @member {PIXI.AbstractRenderer} + */ + this.renderer = renderer; + /** + * The array of currently active accessible items. + * + * @member {Array<*>} + * @private + */ + this.children = []; + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ + this._onKeyDown = this._onKeyDown.bind(this); + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ + this._onMouseMove = this._onMouseMove.bind(this); + this._isActive = false; + this._isMobileAccessibility = false; + /** + * count to throttle div updates on android devices + * @type number + * @private + */ + this.androidUpdateCount = 0; + /** + * the frequency to update the div elements () + * @private + */ + this.androidUpdateFrequency = 500; // 2fps + // let listen for tab.. once pressed we can fire up and show the accessibility layer + window.addEventListener('keydown', this._onKeyDown, false); + } + Object.defineProperty(AccessibilityManager.prototype, "isActive", { + /** + * A flag + * @member {boolean} + * @readonly + */ + get: function () { + return this._isActive; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AccessibilityManager.prototype, "isMobileAccessibility", { + /** + * A flag + * @member {boolean} + * @readonly + */ + get: function () { + return this._isMobileAccessibility; + }, + enumerable: false, + configurable: true + }); + /** + * Creates the touch hooks. + * + * @private + */ + AccessibilityManager.prototype.createTouchHook = function () { + var _this = this; + var hookDiv = document.createElement('button'); + hookDiv.style.width = DIV_HOOK_SIZE + "px"; + hookDiv.style.height = DIV_HOOK_SIZE + "px"; + hookDiv.style.position = 'absolute'; + hookDiv.style.top = DIV_HOOK_POS_X + "px"; + hookDiv.style.left = DIV_HOOK_POS_Y + "px"; + hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString(); + hookDiv.style.backgroundColor = '#FF0000'; + hookDiv.title = 'select to enable accessability for this content'; + hookDiv.addEventListener('focus', function () { + _this._isMobileAccessibility = true; + _this.activate(); + _this.destroyTouchHook(); + }); + document.body.appendChild(hookDiv); + this._hookDiv = hookDiv; + }; + /** + * Destroys the touch hooks. + * + * @private + */ + AccessibilityManager.prototype.destroyTouchHook = function () { + if (!this._hookDiv) { + return; + } + document.body.removeChild(this._hookDiv); + this._hookDiv = null; + }; + /** + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. + * + * @private + */ + AccessibilityManager.prototype.activate = function () { + if (this._isActive) { + return; + } + this._isActive = true; + window.document.addEventListener('mousemove', this._onMouseMove, true); + window.removeEventListener('keydown', this._onKeyDown, false); + // TODO: Remove casting when CanvasRenderer is converted + this.renderer.on('postrender', this.update, this); + if (this.renderer.view.parentNode) { + this.renderer.view.parentNode.appendChild(this.div); + } + }; + /** + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. + * + * @private + */ + AccessibilityManager.prototype.deactivate = function () { + if (!this._isActive || this._isMobileAccessibility) { + return; + } + this._isActive = false; + window.document.removeEventListener('mousemove', this._onMouseMove, true); + window.addEventListener('keydown', this._onKeyDown, false); + // TODO: Remove casting when CanvasRenderer is converted + this.renderer.off('postrender', this.update); + if (this.div.parentNode) { + this.div.parentNode.removeChild(this.div); + } + }; + /** + * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer. + * + * @private + * @param {PIXI.Container} displayObject - The DisplayObject to check. + */ + AccessibilityManager.prototype.updateAccessibleObjects = function (displayObject) { + if (!displayObject.visible || !displayObject.accessibleChildren) { + return; + } + if (displayObject.accessible && displayObject.interactive) { + if (!displayObject._accessibleActive) { + this.addChild(displayObject); + } + displayObject.renderId = this.renderId; + } + var children = displayObject.children; + for (var i = 0; i < children.length; i++) { + this.updateAccessibleObjects(children[i]); + } + }; + /** + * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects. + * + * @private + */ + AccessibilityManager.prototype.update = function () { + /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex, + * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate, + * so I am just running update every half a second, seems to fix it. + */ + var now = performance.now(); + if (isMobile$1.android.device && now < this.androidUpdateCount) { + return; + } + this.androidUpdateCount = now + this.androidUpdateFrequency; + if (!this.renderer.renderingToScreen) { + return; + } + // update children... + if (this.renderer._lastObjectRendered) { + this.updateAccessibleObjects(this.renderer._lastObjectRendered); + } + // TODO: Remove casting when CanvasRenderer is converted + var rect = this.renderer.view.getBoundingClientRect(); + var resolution = this.renderer.resolution; + var sx = (rect.width / this.renderer.width) * resolution; + var sy = (rect.height / this.renderer.height) * resolution; + var div = this.div; + div.style.left = rect.left + "px"; + div.style.top = rect.top + "px"; + div.style.width = this.renderer.width + "px"; + div.style.height = this.renderer.height + "px"; + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (child.renderId !== this.renderId) { + child._accessibleActive = false; + removeItems(this.children, i, 1); + this.div.removeChild(child._accessibleDiv); + this.pool.push(child._accessibleDiv); + child._accessibleDiv = null; + i--; + } + else { + // map div to display.. + div = child._accessibleDiv; + var hitArea = child.hitArea; + var wt = child.worldTransform; + if (child.hitArea) { + div.style.left = (wt.tx + (hitArea.x * wt.a)) * sx + "px"; + div.style.top = (wt.ty + (hitArea.y * wt.d)) * sy + "px"; + div.style.width = hitArea.width * wt.a * sx + "px"; + div.style.height = hitArea.height * wt.d * sy + "px"; + } + else { + hitArea = child.getBounds(); + this.capHitArea(hitArea); + div.style.left = hitArea.x * sx + "px"; + div.style.top = hitArea.y * sy + "px"; + div.style.width = hitArea.width * sx + "px"; + div.style.height = hitArea.height * sy + "px"; + // update button titles and hints if they exist and they've changed + if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) { + div.title = child.accessibleTitle; + } + if (div.getAttribute('aria-label') !== child.accessibleHint + && child.accessibleHint !== null) { + div.setAttribute('aria-label', child.accessibleHint); + } + } + // the title or index may have changed, if so lets update it! + if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) { + div.title = child.accessibleTitle; + div.tabIndex = child.tabIndex; + if (this.debug) + { this.updateDebugHTML(div); } + } + } + } + // increment the render id.. + this.renderId++; + }; + /** + * private function that will visually add the information to the + * accessability div + * + * @param {HTMLElement} div + */ + AccessibilityManager.prototype.updateDebugHTML = function (div) { + div.innerHTML = "type: " + div.type + "
title : " + div.title + "
tabIndex: " + div.tabIndex; + }; + /** + * Adjust the hit area based on the bounds of a display object + * + * @param {PIXI.Rectangle} hitArea - Bounds of the child + */ + AccessibilityManager.prototype.capHitArea = function (hitArea) { + if (hitArea.x < 0) { + hitArea.width += hitArea.x; + hitArea.x = 0; + } + if (hitArea.y < 0) { + hitArea.height += hitArea.y; + hitArea.y = 0; + } + // TODO: Remove casting when CanvasRenderer is converted + if (hitArea.x + hitArea.width > this.renderer.width) { + hitArea.width = this.renderer.width - hitArea.x; + } + if (hitArea.y + hitArea.height > this.renderer.height) { + hitArea.height = this.renderer.height - hitArea.y; + } + }; + /** + * Adds a DisplayObject to the accessibility manager + * + * @private + * @param {PIXI.DisplayObject} displayObject - The child to make accessible. + */ + AccessibilityManager.prototype.addChild = function (displayObject) { + // this.activate(); + var div = this.pool.pop(); + if (!div) { + div = document.createElement('button'); + div.style.width = DIV_TOUCH_SIZE + "px"; + div.style.height = DIV_TOUCH_SIZE + "px"; + div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent'; + div.style.position = 'absolute'; + div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); + div.style.borderStyle = 'none'; + // ARIA attributes ensure that button title and hint updates are announced properly + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { + // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused. + div.setAttribute('aria-live', 'off'); + } + else { + div.setAttribute('aria-live', 'polite'); + } + if (navigator.userAgent.match(/rv:.*Gecko\//)) { + // FireFox needs this to announce only the new button name + div.setAttribute('aria-relevant', 'additions'); + } + else { + // required by IE, other browsers don't much care + div.setAttribute('aria-relevant', 'text'); + } + div.addEventListener('click', this._onClick.bind(this)); + div.addEventListener('focus', this._onFocus.bind(this)); + div.addEventListener('focusout', this._onFocusOut.bind(this)); + } + // set pointer events + div.style.pointerEvents = displayObject.accessiblePointerEvents; + // set the type, this defaults to button! + div.type = displayObject.accessibleType; + if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) { + div.title = displayObject.accessibleTitle; + } + else if (!displayObject.accessibleHint + || displayObject.accessibleHint === null) { + div.title = "displayObject " + displayObject.tabIndex; + } + if (displayObject.accessibleHint + && displayObject.accessibleHint !== null) { + div.setAttribute('aria-label', displayObject.accessibleHint); + } + if (this.debug) + { this.updateDebugHTML(div); } + displayObject._accessibleActive = true; + displayObject._accessibleDiv = div; + div.displayObject = displayObject; + this.children.push(displayObject); + this.div.appendChild(displayObject._accessibleDiv); + displayObject._accessibleDiv.tabIndex = displayObject.tabIndex; + }; + /** + * Maps the div button press to pixi's InteractionManager (click) + * + * @private + * @param {MouseEvent} e - The click event. + */ + AccessibilityManager.prototype._onClick = function (e) { + // TODO: Remove casting when CanvasRenderer is converted + var interactionManager = this.renderer.plugins.interaction; + interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData); + interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData); + interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData); + }; + /** + * Maps the div focus events to pixi's InteractionManager (mouseover) + * + * @private + * @param {FocusEvent} e - The focus event. + */ + AccessibilityManager.prototype._onFocus = function (e) { + if (!e.target.getAttribute('aria-live')) { + e.target.setAttribute('aria-live', 'assertive'); + } + // TODO: Remove casting when CanvasRenderer is converted + var interactionManager = this.renderer.plugins.interaction; + interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData); + }; + /** + * Maps the div focus events to pixi's InteractionManager (mouseout) + * + * @private + * @param {FocusEvent} e - The focusout event. + */ + AccessibilityManager.prototype._onFocusOut = function (e) { + if (!e.target.getAttribute('aria-live')) { + e.target.setAttribute('aria-live', 'polite'); + } + // TODO: Remove casting when CanvasRenderer is converted + var interactionManager = this.renderer.plugins.interaction; + interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData); + }; + /** + * Is called when a key is pressed + * + * @private + * @param {KeyboardEvent} e - The keydown event. + */ + AccessibilityManager.prototype._onKeyDown = function (e) { + if (e.keyCode !== KEY_CODE_TAB) { + return; + } + this.activate(); + }; + /** + * Is called when the mouse moves across the renderer element + * + * @private + * @param {MouseEvent} e - The mouse event. + */ + AccessibilityManager.prototype._onMouseMove = function (e) { + if (e.movementX === 0 && e.movementY === 0) { + return; + } + this.deactivate(); + }; + /** + * Destroys the accessibility manager + * + */ + AccessibilityManager.prototype.destroy = function () { + this.destroyTouchHook(); + this.div = null; + window.document.removeEventListener('mousemove', this._onMouseMove, true); + window.removeEventListener('keydown', this._onKeyDown); + this.pool = null; + this.children = null; + this.renderer = null; + }; + return AccessibilityManager; + }()); + + /*! + * @pixi/ticker - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Target frames per millisecond. + * + * @static + * @name TARGET_FPMS + * @memberof PIXI.settings + * @type {number} + * @default 0.06 + */ + settings.TARGET_FPMS = 0.06; + + /** + * Represents the update priorities used by internal PIXI classes when registered with + * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower + * priority items, such as render, should go later. + * + * @static + * @constant + * @name UPDATE_PRIORITY + * @memberof PIXI + * @enum {number} + * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager} + * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} + * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}. + * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering. + * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility. + */ + + (function (UPDATE_PRIORITY) { + UPDATE_PRIORITY[UPDATE_PRIORITY["INTERACTION"] = 50] = "INTERACTION"; + UPDATE_PRIORITY[UPDATE_PRIORITY["HIGH"] = 25] = "HIGH"; + UPDATE_PRIORITY[UPDATE_PRIORITY["NORMAL"] = 0] = "NORMAL"; + UPDATE_PRIORITY[UPDATE_PRIORITY["LOW"] = -25] = "LOW"; + UPDATE_PRIORITY[UPDATE_PRIORITY["UTILITY"] = -50] = "UTILITY"; + })(exports.UPDATE_PRIORITY || (exports.UPDATE_PRIORITY = {})); + + /** + * Internal class for handling the priority sorting of ticker handlers. + * + * @private + * @class + * @memberof PIXI + */ + var TickerListener = /** @class */ (function () { + /** + * Constructor + * @private + * @param {Function} fn - The listener function to be added for one update + * @param {*} [context=null] - The listener context + * @param {number} [priority=0] - The priority for emitting + * @param {boolean} [once=false] - If the handler should fire once + */ + function TickerListener(fn, context, priority, once) { + if (context === void 0) { context = null; } + if (priority === void 0) { priority = 0; } + if (once === void 0) { once = false; } + /** + * The handler function to execute. + * @private + * @member {Function} + */ + this.fn = fn; + /** + * The calling to execute. + * @private + * @member {*} + */ + this.context = context; + /** + * The current priority. + * @private + * @member {number} + */ + this.priority = priority; + /** + * If this should only execute once. + * @private + * @member {boolean} + */ + this.once = once; + /** + * The next item in chain. + * @private + * @member {TickerListener} + */ + this.next = null; + /** + * The previous item in chain. + * @private + * @member {TickerListener} + */ + this.previous = null; + /** + * `true` if this listener has been destroyed already. + * @member {boolean} + * @private + */ + this._destroyed = false; + } + /** + * Simple compare function to figure out if a function and context match. + * @private + * @param {Function} fn - The listener function to be added for one update + * @param {any} [context] - The listener context + * @return {boolean} `true` if the listener match the arguments + */ + TickerListener.prototype.match = function (fn, context) { + if (context === void 0) { context = null; } + return this.fn === fn && this.context === context; + }; + /** + * Emit by calling the current function. + * @private + * @param {number} deltaTime - time since the last emit. + * @return {TickerListener} Next ticker + */ + TickerListener.prototype.emit = function (deltaTime) { + if (this.fn) { + if (this.context) { + this.fn.call(this.context, deltaTime); + } + else { + this.fn(deltaTime); + } + } + var redirect = this.next; + if (this.once) { + this.destroy(true); + } + // Soft-destroying should remove + // the next reference + if (this._destroyed) { + this.next = null; + } + return redirect; + }; + /** + * Connect to the list. + * @private + * @param {TickerListener} previous - Input node, previous listener + */ + TickerListener.prototype.connect = function (previous) { + this.previous = previous; + if (previous.next) { + previous.next.previous = this; + } + this.next = previous.next; + previous.next = this; + }; + /** + * Destroy and don't use after this. + * @private + * @param {boolean} [hard = false] `true` to remove the `next` reference, this + * is considered a hard destroy. Soft destroy maintains the next reference. + * @return {TickerListener} The listener to redirect while emitting or removing. + */ + TickerListener.prototype.destroy = function (hard) { + if (hard === void 0) { hard = false; } + this._destroyed = true; + this.fn = null; + this.context = null; + // Disconnect, hook up next and previous + if (this.previous) { + this.previous.next = this.next; + } + if (this.next) { + this.next.previous = this.previous; + } + // Redirect to the next item + var redirect = this.next; + // Remove references + this.next = hard ? null : redirect; + this.previous = null; + return redirect; + }; + return TickerListener; + }()); + + /** + * A Ticker class that runs an update loop that other objects listen to. + * + * This class is composed around listeners meant for execution on the next requested animation frame. + * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners. + * + * @class + * @memberof PIXI + */ + var Ticker = /** @class */ (function () { + function Ticker() { + var _this = this; + /** + * The first listener. All new listeners added are chained on this. + * @private + * @type {TickerListener} + */ + this._head = new TickerListener(null, null, Infinity); + /** + * Internal current frame request ID + * @type {?number} + * @private + */ + this._requestId = null; + /** + * Internal value managed by minFPS property setter and getter. + * This is the maximum allowed milliseconds between updates. + * @type {number} + * @private + */ + this._maxElapsedMS = 100; + /** + * Internal value managed by maxFPS property setter and getter. + * This is the minimum allowed milliseconds between updates. + * @type {number} + * @private + */ + this._minElapsedMS = 0; + /** + * Whether or not this ticker should invoke the method + * {@link PIXI.Ticker#start} automatically + * when a listener is added. + * + * @member {boolean} + * @default false + */ + this.autoStart = false; + /** + * Scalar time value from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + * + * @member {number} + * @default 1 + */ + this.deltaTime = 1; + /** + * Scaler time elapsed in milliseconds from last frame to this frame. + * This value is capped by setting {@link PIXI.Ticker#minFPS} + * and is scaled with {@link PIXI.Ticker#speed}. + * **Note:** The cap may be exceeded by scaling. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * Defaults to target frame time + * + * @member {number} + * @default 16.66 + */ + this.deltaMS = 1 / settings.TARGET_FPMS; + /** + * Time elapsed in milliseconds from last frame to this frame. + * Opposed to what the scalar {@link PIXI.Ticker#deltaTime} + * is based, this value is neither capped nor scaled. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * Defaults to target frame time + * + * @member {number} + * @default 16.66 + */ + this.elapsedMS = 1 / settings.TARGET_FPMS; + /** + * The last time {@link PIXI.Ticker#update} was invoked. + * This value is also reset internally outside of invoking + * update, but only when a new animation frame is requested. + * If the platform supports DOMHighResTimeStamp, + * this value will have a precision of 1 µs. + * + * @member {number} + * @default -1 + */ + this.lastTime = -1; + /** + * Factor of current {@link PIXI.Ticker#deltaTime}. + * @example + * // Scales ticker.deltaTime to what would be + * // the equivalent of approximately 120 FPS + * ticker.speed = 2; + * + * @member {number} + * @default 1 + */ + this.speed = 1; + /** + * Whether or not this ticker has been started. + * `true` if {@link PIXI.Ticker#start} has been called. + * `false` if {@link PIXI.Ticker#stop} has been called. + * While `false`, this value may change to `true` in the + * event of {@link PIXI.Ticker#autoStart} being `true` + * and a listener is added. + * + * @member {boolean} + * @default false + */ + this.started = false; + /** + * If enabled, deleting is disabled. + * @member {boolean} + * @default false + * @private + */ + this._protected = false; + /** + * The last time keyframe was executed. + * Maintains a relatively fixed interval with the previous value. + * @member {number} + * @default -1 + * @private + */ + this._lastFrame = -1; + /** + * Internal tick method bound to ticker instance. + * This is because in early 2015, Function.bind + * is still 60% slower in high performance scenarios. + * Also separating frame requests from update method + * so listeners may be called at any time and with + * any animation API, just invoke ticker.update(time). + * + * @private + * @param {number} time - Time since last tick. + */ + this._tick = function (time) { + _this._requestId = null; + if (_this.started) { + // Invoke listeners now + _this.update(time); + // Listener side effects may have modified ticker state. + if (_this.started && _this._requestId === null && _this._head.next) { + _this._requestId = requestAnimationFrame(_this._tick); + } + } + }; + } + /** + * Conditionally requests a new animation frame. + * If a frame has not already been requested, and if the internal + * emitter has listeners, a new frame is requested. + * + * @private + */ + Ticker.prototype._requestIfNeeded = function () { + if (this._requestId === null && this._head.next) { + // ensure callbacks get correct delta + this.lastTime = performance.now(); + this._lastFrame = this.lastTime; + this._requestId = requestAnimationFrame(this._tick); + } + }; + /** + * Conditionally cancels a pending animation frame. + * + * @private + */ + Ticker.prototype._cancelIfNeeded = function () { + if (this._requestId !== null) { + cancelAnimationFrame(this._requestId); + this._requestId = null; + } + }; + /** + * Conditionally requests a new animation frame. + * If the ticker has been started it checks if a frame has not already + * been requested, and if the internal emitter has listeners. If these + * conditions are met, a new frame is requested. If the ticker has not + * been started, but autoStart is `true`, then the ticker starts now, + * and continues with the previous conditions to request a new frame. + * + * @private + */ + Ticker.prototype._startIfPossible = function () { + if (this.started) { + this._requestIfNeeded(); + } + else if (this.autoStart) { + this.start(); + } + }; + /** + * Register a handler for tick events. Calls continuously unless + * it is removed or the ticker is stopped. + * + * @param {Function} fn - The listener function to be added for updates + * @param {*} [context] - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns {PIXI.Ticker} This instance of a ticker + */ + Ticker.prototype.add = function (fn, context, priority) { + if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority)); + }; + /** + * Add a handler for the tick event which is only execute once. + * + * @param {Function} fn - The listener function to be added for one update + * @param {*} [context] - The listener context + * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting + * @returns {PIXI.Ticker} This instance of a ticker + */ + Ticker.prototype.addOnce = function (fn, context, priority) { + if (priority === void 0) { priority = exports.UPDATE_PRIORITY.NORMAL; } + return this._addListener(new TickerListener(fn, context, priority, true)); + }; + /** + * Internally adds the event handler so that it can be sorted by priority. + * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run + * before the rendering. + * + * @private + * @param {TickerListener} listener - Current listener being added. + * @returns {PIXI.Ticker} This instance of a ticker + */ + Ticker.prototype._addListener = function (listener) { + // For attaching to head + var current = this._head.next; + var previous = this._head; + // Add the first item + if (!current) { + listener.connect(previous); + } + else { + // Go from highest to lowest priority + while (current) { + if (listener.priority > current.priority) { + listener.connect(previous); + break; + } + previous = current; + current = current.next; + } + // Not yet connected + if (!listener.previous) { + listener.connect(previous); + } + } + this._startIfPossible(); + return this; + }; + /** + * Removes any handlers matching the function and context parameters. + * If no handlers are left after removing, then it cancels the animation frame. + * + * @param {Function} fn - The listener function to be removed + * @param {*} [context] - The listener context to be removed + * @returns {PIXI.Ticker} This instance of a ticker + */ + Ticker.prototype.remove = function (fn, context) { + var listener = this._head.next; + while (listener) { + // We found a match, lets remove it + // no break to delete all possible matches + // incase a listener was added 2+ times + if (listener.match(fn, context)) { + listener = listener.destroy(); + } + else { + listener = listener.next; + } + } + if (!this._head.next) { + this._cancelIfNeeded(); + } + return this; + }; + Object.defineProperty(Ticker.prototype, "count", { + /** + * The number of listeners on this ticker, calculated by walking through linked list + * + * @readonly + * @member {number} + */ + get: function () { + if (!this._head) { + return 0; + } + var count = 0; + var current = this._head; + while ((current = current.next)) { + count++; + } + return count; + }, + enumerable: false, + configurable: true + }); + /** + * Starts the ticker. If the ticker has listeners + * a new animation frame is requested at this point. + */ + Ticker.prototype.start = function () { + if (!this.started) { + this.started = true; + this._requestIfNeeded(); + } + }; + /** + * Stops the ticker. If the ticker has requested + * an animation frame it is canceled at this point. + */ + Ticker.prototype.stop = function () { + if (this.started) { + this.started = false; + this._cancelIfNeeded(); + } + }; + /** + * Destroy the ticker and don't use after this. Calling + * this method removes all references to internal events. + */ + Ticker.prototype.destroy = function () { + if (!this._protected) { + this.stop(); + var listener = this._head.next; + while (listener) { + listener = listener.destroy(true); + } + this._head.destroy(); + this._head = null; + } + }; + /** + * Triggers an update. An update entails setting the + * current {@link PIXI.Ticker#elapsedMS}, + * the current {@link PIXI.Ticker#deltaTime}, + * invoking all listeners with current deltaTime, + * and then finally setting {@link PIXI.Ticker#lastTime} + * with the value of currentTime that was provided. + * This method will be called automatically by animation + * frame callbacks if the ticker instance has been started + * and listeners are added. + * + * @param {number} [currentTime=performance.now()] - the current time of execution + */ + Ticker.prototype.update = function (currentTime) { + if (currentTime === void 0) { currentTime = performance.now(); } + var elapsedMS; + // If the difference in time is zero or negative, we ignore most of the work done here. + // If there is no valid difference, then should be no reason to let anyone know about it. + // A zero delta, is exactly that, nothing should update. + // + // The difference in time can be negative, and no this does not mean time traveling. + // This can be the result of a race condition between when an animation frame is requested + // on the current JavaScript engine event loop, and when the ticker's start method is invoked + // (which invokes the internal _requestIfNeeded method). If a frame is requested before + // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests, + // can receive a time argument that can be less than the lastTime value that was set within + // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems. + // + // This check covers this browser engine timing issue, as well as if consumers pass an invalid + // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves. + if (currentTime > this.lastTime) { + // Save uncapped elapsedMS for measurement + elapsedMS = this.elapsedMS = currentTime - this.lastTime; + // cap the milliseconds elapsed used for deltaTime + if (elapsedMS > this._maxElapsedMS) { + elapsedMS = this._maxElapsedMS; + } + elapsedMS *= this.speed; + // If not enough time has passed, exit the function. + // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS + // adjustment to ensure a relatively stable interval. + if (this._minElapsedMS) { + var delta = currentTime - this._lastFrame | 0; + if (delta < this._minElapsedMS) { + return; + } + this._lastFrame = currentTime - (delta % this._minElapsedMS); + } + this.deltaMS = elapsedMS; + this.deltaTime = this.deltaMS * settings.TARGET_FPMS; + // Cache a local reference, in-case ticker is destroyed + // during the emit, we can still check for head.next + var head = this._head; + // Invoke listeners added to internal emitter + var listener = head.next; + while (listener) { + listener = listener.emit(this.deltaTime); + } + if (!head.next) { + this._cancelIfNeeded(); + } + } + else { + this.deltaTime = this.deltaMS = this.elapsedMS = 0; + } + this.lastTime = currentTime; + }; + Object.defineProperty(Ticker.prototype, "FPS", { + /** + * The frames per second at which this ticker is running. + * The default is approximately 60 in most modern browsers. + * **Note:** This does not factor in the value of + * {@link PIXI.Ticker#speed}, which is specific + * to scaling {@link PIXI.Ticker#deltaTime}. + * + * @member {number} + * @readonly + */ + get: function () { + return 1000 / this.elapsedMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "minFPS", { + /** + * Manages the maximum amount of milliseconds allowed to + * elapse between invoking {@link PIXI.Ticker#update}. + * This value is used to cap {@link PIXI.Ticker#deltaTime}, + * but does not effect the measured value of {@link PIXI.Ticker#FPS}. + * When setting this property it is clamped to a value between + * `0` and `PIXI.settings.TARGET_FPMS * 1000`. + * + * @member {number} + * @default 10 + */ + get: function () { + return 1000 / this._maxElapsedMS; + }, + set: function (fps) { + // Minimum must be below the maxFPS + var minFPS = Math.min(this.maxFPS, fps); + // Must be at least 0, but below 1 / settings.TARGET_FPMS + var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS); + this._maxElapsedMS = 1 / minFPMS; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker.prototype, "maxFPS", { + /** + * Manages the minimum amount of milliseconds required to + * elapse between invoking {@link PIXI.Ticker#update}. + * This will effect the measured value of {@link PIXI.Ticker#FPS}. + * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can. + * Otherwise it will be at least `minFPS` + * + * @member {number} + * @default 0 + */ + get: function () { + if (this._minElapsedMS) { + return Math.round(1000 / this._minElapsedMS); + } + return 0; + }, + set: function (fps) { + if (fps === 0) { + this._minElapsedMS = 0; + } + else { + // Max must be at least the minFPS + var maxFPS = Math.max(this.minFPS, fps); + this._minElapsedMS = 1 / (maxFPS / 1000); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "shared", { + /** + * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by + * {@link PIXI.VideoResource} to update animation frames / video textures. + * + * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker. + * + * @example + * let ticker = PIXI.Ticker.shared; + * // Set this to prevent starting this ticker when listeners are added. + * // By default this is true only for the PIXI.Ticker.shared instance. + * ticker.autoStart = false; + * // FYI, call this to ensure the ticker is stopped. It should be stopped + * // if you have not attempted to render anything yet. + * ticker.stop(); + * // Call this when you are ready for a running shared ticker. + * ticker.start(); + * + * @example + * // You may use the shared ticker to render... + * let renderer = PIXI.autoDetectRenderer(); + * let stage = new PIXI.Container(); + * document.body.appendChild(renderer.view); + * ticker.add(function (time) { + * renderer.render(stage); + * }); + * + * @example + * // Or you can just update it manually. + * ticker.autoStart = false; + * ticker.stop(); + * function animate(time) { + * ticker.update(time); + * renderer.render(stage); + * requestAnimationFrame(animate); + * } + * animate(performance.now()); + * + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._shared) { + var shared = Ticker._shared = new Ticker(); + shared.autoStart = true; + shared._protected = true; + } + return Ticker._shared; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Ticker, "system", { + /** + * The system ticker instance used by {@link PIXI.InteractionManager} and by + * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, + * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. + * + * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance. + * + * @member {PIXI.Ticker} + * @static + */ + get: function () { + if (!Ticker._system) { + var system = Ticker._system = new Ticker(); + system.autoStart = true; + system._protected = true; + } + return Ticker._system; + }, + enumerable: false, + configurable: true + }); + return Ticker; + }()); + + /** + * Middleware for for Application Ticker. + * + * @example + * import {TickerPlugin} from '@pixi/ticker'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(TickerPlugin); + * + * @class + * @memberof PIXI + */ + var TickerPlugin = /** @class */ (function () { + function TickerPlugin() { + } + /** + * Initialize the plugin with scope of application instance + * + * @static + * @private + * @param {object} [options] - See application options + */ + TickerPlugin.init = function (options) { + var _this = this; + // Set default + options = Object.assign({ + autoStart: true, + sharedTicker: false, + }, options); + // Create ticker setter + Object.defineProperty(this, 'ticker', { + set: function (ticker) { + if (this._ticker) { + this._ticker.remove(this.render, this); + } + this._ticker = ticker; + if (ticker) { + ticker.add(this.render, this, exports.UPDATE_PRIORITY.LOW); + } + }, + get: function () { + return this._ticker; + }, + }); + /** + * Convenience method for stopping the render. + * + * @method PIXI.Application#stop + */ + this.stop = function () { + _this._ticker.stop(); + }; + /** + * Convenience method for starting the render. + * + * @method PIXI.Application#start + */ + this.start = function () { + _this._ticker.start(); + }; + /** + * Internal reference to the ticker. + * + * @type {PIXI.Ticker} + * @name _ticker + * @memberof PIXI.Application# + * @private + */ + this._ticker = null; + /** + * Ticker for doing render updates. + * + * @type {PIXI.Ticker} + * @name ticker + * @memberof PIXI.Application# + * @default PIXI.Ticker.shared + */ + this.ticker = options.sharedTicker ? Ticker.shared : new Ticker(); + // Start the rendering + if (options.autoStart) { + this.start(); + } + }; + /** + * Clean up the ticker, scoped to application. + * + * @static + * @private + */ + TickerPlugin.destroy = function () { + if (this._ticker) { + var oldTicker = this._ticker; + this.ticker = null; + oldTicker.destroy(); + } + }; + return TickerPlugin; + }()); + + /*! + * @pixi/interaction - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/interaction is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Holds all information related to an Interaction event + * + * @class + * @memberof PIXI + */ + var InteractionData = /** @class */ (function () { + function InteractionData() { + this.pressure = 0; + this.rotationAngle = 0; + this.twist = 0; + this.tangentialPressure = 0; + /** + * This point stores the global coords of where the touch/mouse event happened + * + * @member {PIXI.Point} + */ + this.global = new Point(); + /** + * The target Sprite that was interacted with + * + * @member {PIXI.Sprite} + */ + this.target = null; + /** + * When passed to an event handler, this will be the original DOM Event that was captured + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent + * @member {MouseEvent|TouchEvent|PointerEvent} + */ + this.originalEvent = null; + /** + * Unique identifier for this interaction + * + * @member {number} + */ + this.identifier = null; + /** + * Indicates whether or not the pointer device that created the event is the primary pointer. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary + * @type {Boolean} + */ + this.isPrimary = false; + /** + * Indicates which button was pressed on the mouse or pointer device to trigger the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + * @type {number} + */ + this.button = 0; + /** + * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons + * @type {number} + */ + this.buttons = 0; + /** + * The width of the pointer's contact along the x-axis, measured in CSS pixels. + * radiusX of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width + * @type {number} + */ + this.width = 0; + /** + * The height of the pointer's contact along the y-axis, measured in CSS pixels. + * radiusY of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height + * @type {number} + */ + this.height = 0; + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX + * @type {number} + */ + this.tiltX = 0; + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY + * @type {number} + */ + this.tiltY = 0; + /** + * The type of pointer that triggered the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType + * @type {string} + */ + this.pointerType = null; + /** + * Pressure applied by the pointing device during the event. A Touch's force property + * will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure + * @type {number} + */ + this.pressure = 0; + /** + * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle + * @type {number} + */ + this.rotationAngle = 0; + /** + * Twist of a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.twist = 0; + /** + * Barrel pressure on a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.tangentialPressure = 0; + } + Object.defineProperty(InteractionData.prototype, "pointerId", { + /** + * The unique identifier of the pointer. It will be the same as `identifier`. + * @readonly + * @member {number} + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId + */ + get: function () { + return this.identifier; + }, + enumerable: false, + configurable: true + }); + /** + * This will return the local coordinates of the specified displayObject for this InteractionData + * + * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local + * coords off + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise + * will create a new point) + * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional + * (otherwise will use the current global coords) + * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative + * to the DisplayObject + */ + InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) { + return displayObject.worldTransform.applyInverse(globalPos || this.global, point); + }; + /** + * Copies properties from normalized event data. + * + * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data + */ + InteractionData.prototype.copyEvent = function (event) { + // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite + // it with "false" on later events when our shim for it on touch events might not be + // accurate + if ('isPrimary' in event && event.isPrimary) { + this.isPrimary = true; + } + this.button = 'button' in event && event.button; + // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard + // event.which property instead, which conveys the same information. + var buttons = 'buttons' in event && event.buttons; + this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which; + this.width = 'width' in event && event.width; + this.height = 'height' in event && event.height; + this.tiltX = 'tiltX' in event && event.tiltX; + this.tiltY = 'tiltY' in event && event.tiltY; + this.pointerType = 'pointerType' in event && event.pointerType; + this.pressure = 'pressure' in event && event.pressure; + this.rotationAngle = 'rotationAngle' in event && event.rotationAngle; + this.twist = ('twist' in event && event.twist) || 0; + this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0; + }; + /** + * Resets the data for pooling. + */ + InteractionData.prototype.reset = function () { + // isPrimary is the only property that we really need to reset - everything else is + // guaranteed to be overwritten + this.isPrimary = false; + }; + return InteractionData; + }()); + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$1 = function(d, b) { + extendStatics$1 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$1(d, b); + }; + + function __extends$1(d, b) { + extendStatics$1(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Event class that mimics native DOM events. + * + * @class + * @memberof PIXI + */ + var InteractionEvent = /** @class */ (function () { + function InteractionEvent() { + /** + * Whether this event will continue propagating in the tree. + * + * Remaining events for the {@link stopsPropagatingAt} object + * will still be dispatched. + * + * @member {boolean} + */ + this.stopped = false; + /** + * At which object this event stops propagating. + * + * @private + * @member {PIXI.DisplayObject} + */ + this.stopsPropagatingAt = null; + /** + * Whether we already reached the element we want to + * stop propagating at. This is important for delayed events, + * where we start over deeper in the tree again. + * + * @private + * @member {boolean} + */ + this.stopPropagationHint = false; + /** + * The object which caused this event to be dispatched. + * For listener callback see {@link PIXI.InteractionEvent.currentTarget}. + * + * @member {PIXI.DisplayObject} + */ + this.target = null; + /** + * The object whose event listener’s callback is currently being invoked. + * + * @member {PIXI.DisplayObject} + */ + this.currentTarget = null; + /** + * Type of the event + * + * @member {string} + */ + this.type = null; + /** + * InteractionData related to this event + * + * @member {PIXI.InteractionData} + */ + this.data = null; + } + /** + * Prevents event from reaching any objects other than the current object. + * + */ + InteractionEvent.prototype.stopPropagation = function () { + this.stopped = true; + this.stopPropagationHint = true; + this.stopsPropagatingAt = this.currentTarget; + }; + /** + * Resets the event. + */ + InteractionEvent.prototype.reset = function () { + this.stopped = false; + this.stopsPropagatingAt = null; + this.stopPropagationHint = false; + this.currentTarget = null; + this.target = null; + }; + return InteractionEvent; + }()); + + /** + * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions + * + * @class + * @private + * @memberof PIXI + */ + var InteractionTrackingData = /** @class */ (function () { + /** + * @param {number} pointerId - Unique pointer id of the event + * @private + */ + function InteractionTrackingData(pointerId) { + this._pointerId = pointerId; + this._flags = InteractionTrackingData.FLAGS.NONE; + } + /** + * + * @private + * @param {number} flag - The interaction flag to set + * @param {boolean} yn - Should the flag be set or unset + */ + InteractionTrackingData.prototype._doSet = function (flag, yn) { + if (yn) { + this._flags = this._flags | flag; + } + else { + this._flags = this._flags & (~flag); + } + }; + Object.defineProperty(InteractionTrackingData.prototype, "pointerId", { + /** + * Unique pointer id of the event + * + * @readonly + * @private + * @member {number} + */ + get: function () { + return this._pointerId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "flags", { + /** + * State of the tracking data, expressed as bit flags + * + * @private + * @member {number} + */ + get: function () { + return this._flags; + }, + set: function (flags) { + this._flags = flags; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "none", { + /** + * Is the tracked event inactive (not over or down)? + * + * @private + * @member {number} + */ + get: function () { + return this._flags === InteractionTrackingData.FLAGS.NONE; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "over", { + /** + * Is the tracked event over the DisplayObject? + * + * @private + * @member {boolean} + */ + get: function () { + return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0; + }, + set: function (yn) { + this._doSet(InteractionTrackingData.FLAGS.OVER, yn); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "rightDown", { + /** + * Did the right mouse button come down in the DisplayObject? + * + * @private + * @member {boolean} + */ + get: function () { + return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0; + }, + set: function (yn) { + this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "leftDown", { + /** + * Did the left mouse button come down in the DisplayObject? + * + * @private + * @member {boolean} + */ + get: function () { + return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0; + }, + set: function (yn) { + this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn); + }, + enumerable: false, + configurable: true + }); + InteractionTrackingData.FLAGS = Object.freeze({ + NONE: 0, + OVER: 1 << 0, + LEFT_DOWN: 1 << 1, + RIGHT_DOWN: 1 << 2, + }); + return InteractionTrackingData; + }()); + + /** + * Strategy how to search through stage tree for interactive objects + * + * @private + * @class + * @memberof PIXI + */ + var TreeSearch = /** @class */ (function () { + function TreeSearch() { + this._tempPoint = new Point(); + } + /** + * Recursive implementation for findHit + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @param {boolean} [interactive] - Whether the displayObject is interactive + * @return {boolean} returns true if the displayObject hit the point + */ + TreeSearch.prototype.recursiveFindHit = function (interactionEvent, displayObject, func, hitTest, interactive) { + if (!displayObject || !displayObject.visible) { + return false; + } + var point = interactionEvent.data.global; + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ + // + // This function will now loop through all objects and then only hit test the objects it HAS + // to, not all of them. MUCH faster.. + // An object will be hit test if the following is true: + // + // 1: It is interactive. + // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. + // + // As another little optimization once an interactive object has been hit we can carry on + // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests + // A final optimization is that an object is not hit test directly if a child has already been hit. + interactive = displayObject.interactive || interactive; + var hit = false; + var interactiveParent = interactive; + // Flag here can set to false if the event is outside the parents hitArea or mask + var hitTestChildren = true; + // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea + // There is also no longer a need to hitTest children. + if (displayObject.hitArea) { + if (hitTest) { + displayObject.worldTransform.applyInverse(point, this._tempPoint); + if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) { + hitTest = false; + hitTestChildren = false; + } + else { + hit = true; + } + } + interactiveParent = false; + } + // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. + // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. + // https://github.com/pixijs/pixi.js/issues/5135 + else if (displayObject._mask) { + if (hitTest) { + if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) { + hitTest = false; + } + } + } + // ** FREE TIP **! If an object is not interactive or has no buttons in it + // (such as a game scene!) set interactiveChildren to false for that displayObject. + // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. + if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) { + var children = displayObject.children; + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + // time to get recursive.. if this function will return if something is hit.. + var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); + if (childHit) { + // its a good idea to check if a child has lost its parent. + // this means it has been removed whilst looping so its best + if (!child.parent) { + continue; + } + // we no longer need to hit test any more objects in this container as we we + // now know the parent has been hit + interactiveParent = false; + // If the child is interactive , that means that the object hit was actually + // interactive and not just the child of an interactive object. + // This means we no longer need to hit test anything else. We still need to run + // through all objects, but we don't need to perform any hit tests. + if (childHit) { + if (interactionEvent.target) { + hitTest = false; + } + hit = true; + } + } + } + } + // no point running this if the item is not interactive or does not have an interactive parent. + if (interactive) { + // if we are hit testing (as in we have no hit any objects yet) + // We also don't need to worry about hit testing if once of the displayObjects children + // has already been hit - but only if it was interactive, otherwise we need to keep + // looking for an interactive child, just in case we hit one + if (hitTest && !interactionEvent.target) { + // already tested against hitArea if it is defined + if (!displayObject.hitArea && displayObject.containsPoint) { + if (displayObject.containsPoint(point)) { + hit = true; + } + } + } + if (displayObject.interactive) { + if (hit && !interactionEvent.target) { + interactionEvent.target = displayObject; + } + if (func) { + func(interactionEvent, displayObject, !!hit); + } + } + } + return hit; + }; + /** + * This function is provides a neat way of crawling through the scene graph and running a + * specified function on all interactive objects it finds. It will also take care of hit + * testing the interactive objects and passes the hit across in the function. + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @return {boolean} returns true if the displayObject hit the point + */ + TreeSearch.prototype.findHit = function (interactionEvent, displayObject, func, hitTest) { + this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); + }; + return TreeSearch; + }()); + + /** + * Interface for classes that represent a hit area. + * + * It is implemented by the following classes: + * - {@link PIXI.Circle} + * - {@link PIXI.Ellipse} + * - {@link PIXI.Polygon} + * - {@link PIXI.RoundedRectangle} + * + * @interface IHitArea + * @memberof PIXI + */ + /** + * Checks whether the x and y coordinates given are contained within this area + * + * @method + * @name contains + * @memberof PIXI.IHitArea# + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this area + */ + /** + * Default property values of interactive objects + * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties + * + * @private + * @name interactiveTarget + * @type {Object} + * @memberof PIXI + * @example + * function MyObject() {} + * + * Object.assign( + * DisplayObject.prototype, + * PIXI.interactiveTarget + * ); + */ + var interactiveTarget = { + /** + * Enable interaction events for the DisplayObject. Touch, pointer and mouse + * events will not be emitted unless `interactive` is set to `true`. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.on('tap', (event) => { + * //handle event + * }); + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + interactive: false, + /** + * Determines if the children to the displayObject can be clicked/touched + * Setting this to false allows PixiJS to bypass a recursive `hitTest` function + * + * @member {boolean} + * @memberof PIXI.Container# + */ + interactiveChildren: true, + /** + * Interaction shape. Children will be hit first, then this shape will be checked. + * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100); + * @member {PIXI.IHitArea} + * @memberof PIXI.DisplayObject# + */ + hitArea: null, + /** + * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive + * Setting this changes the 'cursor' property to `'pointer'`. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.buttonMode = true; + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + get buttonMode() { + return this.cursor === 'pointer'; + }, + set buttonMode(value) { + if (value) { + this.cursor = 'pointer'; + } + else if (this.cursor === 'pointer') { + this.cursor = null; + } + }, + /** + * This defines what cursor mode is used when the mouse cursor + * is hovered over the displayObject. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.interactive = true; + * sprite.cursor = 'wait'; + * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor + * + * @member {string} + * @memberof PIXI.DisplayObject# + */ + cursor: null, + /** + * Internal set of all active pointers, by identifier + * + * @member {Map} + * @memberof PIXI.DisplayObject# + * @private + */ + get trackedPointers() { + if (this._trackedPointers === undefined) + { this._trackedPointers = {}; } + return this._trackedPointers; + }, + /** + * Map of all tracked pointers, by identifier. Use trackedPointers to access. + * + * @private + * @type {Map} + */ + _trackedPointers: undefined, + }; + + // Mix interactiveTarget into DisplayObject.prototype, + // after deprecation has been handled + DisplayObject.mixin(interactiveTarget); + var MOUSE_POINTER_ID = 1; + // helpers for hitTest() - only used inside hitTest() + var hitTestEvent = { + target: null, + data: { + global: null, + }, + }; + /** + * The interaction manager deals with mouse, touch and pointer events. + * + * Any DisplayObject can be interactive if its `interactive` property is set to true. + * + * This manager also supports multitouch. + * + * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction` + * + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ + var InteractionManager = /** @class */ (function (_super) { + __extends$1(InteractionManager, _super); + /** + * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer + * @param {object} [options] - The options for the manager. + * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions. + * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked. + * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}. + */ + function InteractionManager(renderer, options) { + var _this = _super.call(this) || this; + options = options || {}; + /** + * The renderer this interaction manager works for. + * + * @member {PIXI.AbstractRenderer} + */ + _this.renderer = renderer; + /** + * Should default browser actions automatically be prevented. + * Does not apply to pointer events for backwards compatibility + * preventDefault on pointer events stops mouse events from firing + * Thus, for every pointer event, there will always be either a mouse of touch event alongside it. + * + * @member {boolean} + * @default true + */ + _this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; + /** + * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}. + * + * @member {number} + * @default 10 + */ + _this.interactionFrequency = options.interactionFrequency || 10; + /** + * The mouse data + * + * @member {PIXI.InteractionData} + */ + _this.mouse = new InteractionData(); + _this.mouse.identifier = MOUSE_POINTER_ID; + // setting the mouse to start off far off screen will mean that mouse over does + // not get called before we even move the mouse. + _this.mouse.global.set(-999999); + /** + * Actively tracked InteractionData + * + * @private + * @member {Object.} + */ + _this.activeInteractionData = {}; + _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse; + /** + * Pool of unused InteractionData + * + * @private + * @member {PIXI.InteractionData[]} + */ + _this.interactionDataPool = []; + /** + * An event data object to handle all the event tracking/dispatching + * + * @member {object} + */ + _this.eventData = new InteractionEvent(); + /** + * The DOM element to bind to. + * + * @protected + * @member {HTMLElement} + */ + _this.interactionDOMElement = null; + /** + * This property determines if mousemove and touchmove events are fired only when the cursor + * is over the object. + * Setting to true will make things work more in line with how the DOM version works. + * Setting to false can make things easier for things like dragging + * It is currently set to false as this is how PixiJS used to work. This will be set to true in + * future versions of pixi. + * + * @member {boolean} + * @default false + */ + _this.moveWhenInside = false; + /** + * Have events been attached to the dom element? + * + * @protected + * @member {boolean} + */ + _this.eventsAdded = false; + /** + * Has the system ticker been added? + * + * @protected + * @member {boolean} + */ + _this.tickerAdded = false; + /** + * Is the mouse hovering over the renderer? + * + * @protected + * @member {boolean} + */ + _this.mouseOverRenderer = false; + /** + * Does the device support touch events + * https://www.w3.org/TR/touch-events/ + * + * @readonly + * @member {boolean} + */ + _this.supportsTouchEvents = 'ontouchstart' in window; + /** + * Does the device support pointer events + * https://www.w3.org/Submission/pointer-events/ + * + * @readonly + * @member {boolean} + */ + _this.supportsPointerEvents = !!window.PointerEvent; + // this will make it so that you don't have to call bind all the time + /** + * @private + * @member {Function} + */ + _this.onPointerUp = _this.onPointerUp.bind(_this); + _this.processPointerUp = _this.processPointerUp.bind(_this); + /** + * @private + * @member {Function} + */ + _this.onPointerCancel = _this.onPointerCancel.bind(_this); + _this.processPointerCancel = _this.processPointerCancel.bind(_this); + /** + * @private + * @member {Function} + */ + _this.onPointerDown = _this.onPointerDown.bind(_this); + _this.processPointerDown = _this.processPointerDown.bind(_this); + /** + * @private + * @member {Function} + */ + _this.onPointerMove = _this.onPointerMove.bind(_this); + _this.processPointerMove = _this.processPointerMove.bind(_this); + /** + * @private + * @member {Function} + */ + _this.onPointerOut = _this.onPointerOut.bind(_this); + _this.processPointerOverOut = _this.processPointerOverOut.bind(_this); + /** + * @private + * @member {Function} + */ + _this.onPointerOver = _this.onPointerOver.bind(_this); + /** + * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor + * values, objects are handled as dictionaries of CSS values for interactionDOMElement, + * and functions are called instead of changing the CSS. + * Default CSS cursor values are provided for 'default' and 'pointer' modes. + * @member {Object.} + */ + _this.cursorStyles = { + default: 'inherit', + pointer: 'pointer', + }; + /** + * The mode of the cursor that is being used. + * The value of this is a key from the cursorStyles dictionary. + * + * @member {string} + */ + _this.currentCursorMode = null; + /** + * Internal cached let. + * + * @private + * @member {string} + */ + _this.cursor = null; + /** + * The current resolution / device pixel ratio. + * + * @member {number} + * @default 1 + */ + _this.resolution = 1; + /** + * Delayed pointer events. Used to guarantee correct ordering of over/out events. + * + * @private + * @member {Array} + */ + _this.delayedEvents = []; + /** + * TreeSearch component that is used to hitTest stage tree + * + * @private + * @member {PIXI.TreeSearch} + */ + _this.search = new TreeSearch(); + /** + * Used as a last rendered object in case renderer doesnt have _lastObjectRendered + * @member {DisplayObject} + * @private + */ + _this._tempDisplayObject = new TemporaryDisplayObject(); + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed on the display + * object. + * + * @event PIXI.InteractionManager#mousedown + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * on the display object. + * + * @event PIXI.InteractionManager#rightdown + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is released over the display + * object. + * + * @event PIXI.InteractionManager#mouseup + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * over the display object. + * + * @event PIXI.InteractionManager#rightup + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed and released on + * the display object. + * + * @event PIXI.InteractionManager#click + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * and released on the display object. + * + * @event PIXI.InteractionManager#rightclick + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is released outside the + * display object that initially registered a + * [mousedown]{@link PIXI.InteractionManager#event:mousedown}. + * + * @event PIXI.InteractionManager#mouseupoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * outside the display object that initially registered a + * [rightdown]{@link PIXI.InteractionManager#event:rightdown}. + * + * @event PIXI.InteractionManager#rightupoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device (usually a mouse) is moved while over the display object + * + * @event PIXI.InteractionManager#mousemove + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device (usually a mouse) is moved onto the display object + * + * @event PIXI.InteractionManager#mouseover + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device (usually a mouse) is moved off the display object + * + * @event PIXI.InteractionManager#mouseout + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is pressed on the display object. + * + * @event PIXI.InteractionManager#pointerdown + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is released over the display object. + * Not always fired when some buttons are held down while others are released. In those cases, + * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and + * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead. + * + * @event PIXI.InteractionManager#pointerup + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when the operating system cancels a pointer event + * + * @event PIXI.InteractionManager#pointercancel + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is pressed and released on the display object. + * + * @event PIXI.InteractionManager#pointertap + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is released outside the display object that initially + * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}. + * + * @event PIXI.InteractionManager#pointerupoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device is moved while over the display object + * + * @event PIXI.InteractionManager#pointermove + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device is moved onto the display object + * + * @event PIXI.InteractionManager#pointerover + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device is moved off the display object + * + * @event PIXI.InteractionManager#pointerout + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is placed on the display object. + * + * @event PIXI.InteractionManager#touchstart + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is removed from the display object. + * + * @event PIXI.InteractionManager#touchend + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when the operating system cancels a touch + * + * @event PIXI.InteractionManager#touchcancel + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is placed and removed from the display object. + * + * @event PIXI.InteractionManager#tap + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is removed outside of the display object that initially + * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}. + * + * @event PIXI.InteractionManager#touchendoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is moved along the display object. + * + * @event PIXI.InteractionManager#touchmove + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. + * object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mousedown + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightdown + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is released over the display + * object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseup + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightup + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is pressed and released on + * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#click + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is pressed + * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightclick + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button (usually a mouse left-button) is released outside the + * display object that initially registered a + * [mousedown]{@link PIXI.DisplayObject#event:mousedown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseupoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device secondary button (usually a mouse right-button) is released + * outside the display object that initially registered a + * [rightdown]{@link PIXI.DisplayObject#event:rightdown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#rightupoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device (usually a mouse) is moved while over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mousemove + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device (usually a mouse) is moved onto the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseover + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device (usually a mouse) is moved off the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#mouseout + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is pressed on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerdown + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is released over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerup + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when the operating system cancels a pointer event. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointercancel + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is pressed and released on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointertap + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device button is released outside the display object that initially + * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerupoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device is moved while over the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointermove + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device is moved onto the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerover + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a pointer device is moved off the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#pointerout + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is placed on the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchstart + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is removed from the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchend + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when the operating system cancels a touch. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchcancel + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is placed and removed from the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#tap + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is removed outside of the display object that initially + * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchendoutside + * @param {PIXI.InteractionEvent} event - Interaction event + */ + /** + * Fired when a touch point is moved along the display object. + * DisplayObject's `interactive` property must be set to `true` to fire event. + * + * @event PIXI.DisplayObject#touchmove + * @param {PIXI.InteractionEvent} event - Interaction event + */ + _this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true; + _this.setTargetElement(_this.renderer.view, _this.renderer.resolution); + return _this; + } + Object.defineProperty(InteractionManager.prototype, "useSystemTicker", { + /** + * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}. + * + * @member {boolean} + * @default true + */ + get: function () { + return this._useSystemTicker; + }, + set: function (useSystemTicker) { + this._useSystemTicker = useSystemTicker; + if (useSystemTicker) { + this.addTickerListener(); + } + else { + this.removeTickerListener(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionManager.prototype, "lastObjectRendered", { + /** + * Last rendered object or temp object + * @readonly + * @protected + * @member {PIXI.DisplayObject} + */ + get: function () { + return this.renderer._lastObjectRendered || this._tempDisplayObject; + }, + enumerable: false, + configurable: true + }); + /** + * Hit tests a point against the display tree, returning the first interactive object that is hit. + * + * @param {PIXI.Point} globalPoint - A point to hit test with, in global space. + * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults + * to the last rendered root of the associated renderer. + * @return {PIXI.DisplayObject} The hit display object, if any. + */ + InteractionManager.prototype.hitTest = function (globalPoint, root) { + // clear the target for our hit test + hitTestEvent.target = null; + // assign the global point + hitTestEvent.data.global = globalPoint; + // ensure safety of the root + if (!root) { + root = this.lastObjectRendered; + } + // run the hit test + this.processInteractive(hitTestEvent, root, null, true); + // return our found object - it'll be null if we didn't hit anything + return hitTestEvent.target; + }; + /** + * Sets the DOM element which will receive mouse/touch events. This is useful for when you have + * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate + * another DOM element to receive those events. + * + * @param {HTMLElement} element - the DOM element which will receive mouse and touch events. + * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). + */ + InteractionManager.prototype.setTargetElement = function (element, resolution) { + if (resolution === void 0) { resolution = 1; } + this.removeTickerListener(); + this.removeEvents(); + this.interactionDOMElement = element; + this.resolution = resolution; + this.addEvents(); + this.addTickerListener(); + }; + /** + * Add the ticker listener + * + * @private + */ + InteractionManager.prototype.addTickerListener = function () { + if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) { + return; + } + Ticker.system.add(this.tickerUpdate, this, exports.UPDATE_PRIORITY.INTERACTION); + this.tickerAdded = true; + }; + /** + * Remove the ticker listener + * + * @private + */ + InteractionManager.prototype.removeTickerListener = function () { + if (!this.tickerAdded) { + return; + } + Ticker.system.remove(this.tickerUpdate, this); + this.tickerAdded = false; + }; + /** + * Registers all the DOM events + * + * @private + */ + InteractionManager.prototype.addEvents = function () { + if (this.eventsAdded || !this.interactionDOMElement) { + return; + } + var style = this.interactionDOMElement.style; + if (window.navigator.msPointerEnabled) { + style.msContentZooming = 'none'; + style.msTouchAction = 'none'; + } + else if (this.supportsPointerEvents) { + style.touchAction = 'none'; + } + /** + * These events are added first, so that if pointer events are normalized, they are fired + * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd + */ + if (this.supportsPointerEvents) { + window.document.addEventListener('pointermove', this.onPointerMove, true); + this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); + // pointerout is fired in addition to pointerup (for touch events) and pointercancel + // we already handle those, so for the purposes of what we do in onPointerOut, we only + // care about the pointerleave event + this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, true); + this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, true); + window.addEventListener('pointercancel', this.onPointerCancel, true); + window.addEventListener('pointerup', this.onPointerUp, true); + } + else { + window.document.addEventListener('mousemove', this.onPointerMove, true); + this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); + this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); + this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); + window.addEventListener('mouseup', this.onPointerUp, true); + } + // always look directly for touch events so that we can provide original data + // In a future version we should change this to being just a fallback and rely solely on + // PointerEvents whenever available + if (this.supportsTouchEvents) { + this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); + this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); + this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); + this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); + } + this.eventsAdded = true; + }; + /** + * Removes all the DOM events that were previously registered + * + * @private + */ + InteractionManager.prototype.removeEvents = function () { + if (!this.eventsAdded || !this.interactionDOMElement) { + return; + } + var style = this.interactionDOMElement.style; + if (window.navigator.msPointerEnabled) { + style.msContentZooming = ''; + style.msTouchAction = ''; + } + else if (this.supportsPointerEvents) { + style.touchAction = ''; + } + if (this.supportsPointerEvents) { + window.document.removeEventListener('pointermove', this.onPointerMove, true); + this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); + this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, true); + window.removeEventListener('pointercancel', this.onPointerCancel, true); + window.removeEventListener('pointerup', this.onPointerUp, true); + } + else { + window.document.removeEventListener('mousemove', this.onPointerMove, true); + this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); + this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); + window.removeEventListener('mouseup', this.onPointerUp, true); + } + if (this.supportsTouchEvents) { + this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); + this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); + this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); + this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); + } + this.interactionDOMElement = null; + this.eventsAdded = false; + }; + /** + * Updates the state of interactive objects if at least {@link interactionFrequency} + * milliseconds have passed since the last invocation. + * + * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}. + * + * @param {number} deltaTime - time delta since the last call + */ + InteractionManager.prototype.tickerUpdate = function (deltaTime) { + this._deltaTime += deltaTime; + if (this._deltaTime < this.interactionFrequency) { + return; + } + this._deltaTime = 0; + this.update(); + }; + /** + * Updates the state of interactive objects. + */ + InteractionManager.prototype.update = function () { + if (!this.interactionDOMElement) { + return; + } + // if the user move the mouse this check has already been done using the mouse move! + if (this._didMove) { + this._didMove = false; + return; + } + this.cursor = null; + // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, + // but there was a scenario of a display object moving under a static mouse cursor. + // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function + for (var k in this.activeInteractionData) { + // eslint-disable-next-line no-prototype-builtins + if (this.activeInteractionData.hasOwnProperty(k)) { + var interactionData = this.activeInteractionData[k]; + if (interactionData.originalEvent && interactionData.pointerType !== 'touch') { + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData); + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, true); + } + } + } + this.setCursorMode(this.cursor); + }; + /** + * Sets the current cursor mode, handling any callbacks or CSS style changes. + * + * @param {string} mode - cursor mode, a key from the cursorStyles dictionary + */ + InteractionManager.prototype.setCursorMode = function (mode) { + mode = mode || 'default'; + // if the mode didn't actually change, bail early + if (this.currentCursorMode === mode) { + return; + } + this.currentCursorMode = mode; + var style = this.cursorStyles[mode]; + // only do things if there is a cursor style for it + if (style) { + switch (typeof style) { + case 'string': + // string styles are handled as cursor CSS + this.interactionDOMElement.style.cursor = style; + break; + case 'function': + // functions are just called, and passed the cursor mode + style(mode); + break; + case 'object': + // if it is an object, assume that it is a dictionary of CSS styles, + // apply it to the interactionDOMElement + Object.assign(this.interactionDOMElement.style, style); + break; + } + } + else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) { + // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry + // for the mode, then assume that the dev wants it to be CSS for the cursor. + this.interactionDOMElement.style.cursor = mode; + } + }; + /** + * Dispatches an event on the display object that was interacted with + * + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question + * @param {string} eventString - the name of the event (e.g, mousedown) + * @param {PIXI.InteractionEvent} eventData - the event data object + * @private + */ + InteractionManager.prototype.dispatchEvent = function (displayObject, eventString, eventData) { + // Even if the event was stopped, at least dispatch any remaining events + // for the same display object. + if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) { + eventData.currentTarget = displayObject; + eventData.type = eventString; + displayObject.emit(eventString, eventData); + if (displayObject[eventString]) { + displayObject[eventString](eventData); + } + } + }; + /** + * Puts a event on a queue to be dispatched later. This is used to guarantee correct + * ordering of over/out events. + * + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question + * @param {string} eventString - the name of the event (e.g, mousedown) + * @param {object} eventData - the event data object + * @private + */ + InteractionManager.prototype.delayDispatchEvent = function (displayObject, eventString, eventData) { + this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData }); + }; + /** + * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The + * resulting value is stored in the point. This takes into account the fact that the DOM + * element could be scaled and positioned anywhere on the screen. + * + * @param {PIXI.IPointData} point - the point that the result will be stored in + * @param {number} x - the x coord of the position to map + * @param {number} y - the y coord of the position to map + */ + InteractionManager.prototype.mapPositionToPoint = function (point, x, y) { + var rect; + // IE 11 fix + if (!this.interactionDOMElement.parentElement) { + rect = { x: 0, y: 0, width: 0, height: 0 }; + } + else { + rect = this.interactionDOMElement.getBoundingClientRect(); + } + var resolutionMultiplier = 1.0 / this.resolution; + point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier; + point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier; + }; + /** + * This function is provides a neat way of crawling through the scene graph and running a + * specified function on all interactive objects it finds. It will also take care of hit + * testing the interactive objects and passes the hit across in the function. + * + * @protected + * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - indicates whether we want to calculate hits + * or just iterate through all interactive objects + */ + InteractionManager.prototype.processInteractive = function (interactionEvent, displayObject, func, hitTest) { + var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest); + var delayedEvents = this.delayedEvents; + if (!delayedEvents.length) { + return hit; + } + // Reset the propagation hint, because we start deeper in the tree again. + interactionEvent.stopPropagationHint = false; + var delayedLen = delayedEvents.length; + this.delayedEvents = []; + for (var i = 0; i < delayedLen; i++) { + var _a = delayedEvents[i], displayObject_1 = _a.displayObject, eventString = _a.eventString, eventData = _a.eventData; + // When we reach the object we wanted to stop propagating at, + // set the propagation hint. + if (eventData.stopsPropagatingAt === displayObject_1) { + eventData.stopPropagationHint = true; + } + this.dispatchEvent(displayObject_1, eventString, eventData); + } + return hit; + }; + /** + * Is called when the pointer button is pressed down on the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down + */ + InteractionManager.prototype.onPointerDown = function (originalEvent) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') + { return; } + var events = this.normalizeToPointerData(originalEvent); + /** + * No need to prevent default on natural pointer events, as there are no side effects + * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, + * so still need to be prevented. + */ + // Guaranteed that there will be at least one event in events, and all events must have the same pointer type + if (this.autoPreventDefault && events[0].isNormalized) { + var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent); + if (cancelable) { + originalEvent.preventDefault(); + } + } + var eventLen = events.length; + for (var i = 0; i < eventLen; i++) { + var event = events[i]; + var interactionData = this.getInteractionDataForPointerId(event); + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + interactionEvent.data.originalEvent = originalEvent; + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true); + this.emit('pointerdown', interactionEvent); + if (event.pointerType === 'touch') { + this.emit('touchstart', interactionEvent); + } + // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event + else if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + var isRightButton = event.button === 2; + this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); + } + } + }; + /** + * Processes the result of the pointer down check and dispatches the event if need be + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerDown = function (interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + var id = interactionEvent.data.identifier; + if (hit) { + if (!displayObject.trackedPointers[id]) { + displayObject.trackedPointers[id] = new InteractionTrackingData(id); + } + this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); + if (data.pointerType === 'touch') { + this.dispatchEvent(displayObject, 'touchstart', interactionEvent); + } + else if (data.pointerType === 'mouse' || data.pointerType === 'pen') { + var isRightButton = data.button === 2; + if (isRightButton) { + displayObject.trackedPointers[id].rightDown = true; + } + else { + displayObject.trackedPointers[id].leftDown = true; + } + this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); + } + } + }; + /** + * Is called when the pointer button is released on the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released + * @param {boolean} cancelled - true if the pointer is cancelled + * @param {Function} func - Function passed to {@link processInteractive} + */ + InteractionManager.prototype.onPointerComplete = function (originalEvent, cancelled, func) { + var events = this.normalizeToPointerData(originalEvent); + var eventLen = events.length; + // if the event wasn't targeting our canvas, then consider it to be pointerupoutside + // in all cases (unless it was a pointercancel) + var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; + for (var i = 0; i < eventLen; i++) { + var event = events[i]; + var interactionData = this.getInteractionDataForPointerId(event); + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + interactionEvent.data.originalEvent = originalEvent; + // perform hit testing for events targeting our canvas or cancel events + this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend); + this.emit(cancelled ? 'pointercancel' : "pointerup" + eventAppend, interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + var isRightButton = event.button === 2; + this.emit(isRightButton ? "rightup" + eventAppend : "mouseup" + eventAppend, interactionEvent); + } + else if (event.pointerType === 'touch') { + this.emit(cancelled ? 'touchcancel' : "touchend" + eventAppend, interactionEvent); + this.releaseInteractionDataForPointerId(event.pointerId); + } + } + }; + /** + * Is called when the pointer button is cancelled + * + * @private + * @param {PointerEvent} event - The DOM event of a pointer button being released + */ + InteractionManager.prototype.onPointerCancel = function (event) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && event.pointerType === 'touch') + { return; } + this.onPointerComplete(event, true, this.processPointerCancel); + }; + /** + * Processes the result of the pointer cancel check and dispatches the event if need be + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + */ + InteractionManager.prototype.processPointerCancel = function (interactionEvent, displayObject) { + var data = interactionEvent.data; + var id = interactionEvent.data.identifier; + if (displayObject.trackedPointers[id] !== undefined) { + delete displayObject.trackedPointers[id]; + this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); + if (data.pointerType === 'touch') { + this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); + } + } + }; + /** + * Is called when the pointer button is released on the renderer element + * + * @private + * @param {PointerEvent} event - The DOM event of a pointer button being released + */ + InteractionManager.prototype.onPointerUp = function (event) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && event.pointerType === 'touch') + { return; } + this.onPointerComplete(event, false, this.processPointerUp); + }; + /** + * Processes the result of the pointer up check and dispatches the event if need be + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerUp = function (interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + var id = interactionEvent.data.identifier; + var trackingData = displayObject.trackedPointers[id]; + var isTouch = data.pointerType === 'touch'; + var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + // need to track mouse down status in the mouse block so that we can emit + // event in a later block + var isMouseTap = false; + // Mouse only + if (isMouse) { + var isRightButton = data.button === 2; + var flags = InteractionTrackingData.FLAGS; + var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; + var isDown = trackingData !== undefined && (trackingData.flags & test); + if (hit) { + this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); + if (isDown) { + this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); + // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap + isMouseTap = true; + } + } + else if (isDown) { + this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); + } + // update the down state of the tracking data + if (trackingData) { + if (isRightButton) { + trackingData.rightDown = false; + } + else { + trackingData.leftDown = false; + } + } + } + // Pointers and Touches, and Mouse + if (hit) { + this.dispatchEvent(displayObject, 'pointerup', interactionEvent); + if (isTouch) + { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } + if (trackingData) { + // emit pointertap if not a mouse, or if the mouse block decided it was a tap + if (!isMouse || isMouseTap) { + this.dispatchEvent(displayObject, 'pointertap', interactionEvent); + } + if (isTouch) { + this.dispatchEvent(displayObject, 'tap', interactionEvent); + // touches are no longer over (if they ever were) when we get the touchend + // so we should ensure that we don't keep pretending that they are + trackingData.over = false; + } + } + } + else if (trackingData) { + this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); + if (isTouch) + { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } + } + // Only remove the tracking data if there is no over/down state still associated with it + if (trackingData && trackingData.none) { + delete displayObject.trackedPointers[id]; + } + }; + /** + * Is called when the pointer moves across the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer moving + */ + InteractionManager.prototype.onPointerMove = function (originalEvent) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') + { return; } + var events = this.normalizeToPointerData(originalEvent); + if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') { + this._didMove = true; + this.cursor = null; + } + var eventLen = events.length; + for (var i = 0; i < eventLen; i++) { + var event = events[i]; + var interactionData = this.getInteractionDataForPointerId(event); + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + interactionEvent.data.originalEvent = originalEvent; + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true); + this.emit('pointermove', interactionEvent); + if (event.pointerType === 'touch') + { this.emit('touchmove', interactionEvent); } + if (event.pointerType === 'mouse' || event.pointerType === 'pen') + { this.emit('mousemove', interactionEvent); } + } + if (events[0].pointerType === 'mouse') { + this.setCursorMode(this.cursor); + // TODO BUG for parents interactive object (border order issue) + } + }; + /** + * Processes the result of the pointer move check and dispatches the event if need be + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerMove = function (interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + var isTouch = data.pointerType === 'touch'; + var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + if (isMouse) { + this.processPointerOverOut(interactionEvent, displayObject, hit); + } + if (!this.moveWhenInside || hit) { + this.dispatchEvent(displayObject, 'pointermove', interactionEvent); + if (isTouch) + { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } + if (isMouse) + { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } + } + }; + /** + * Is called when the pointer is moved out of the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out + */ + InteractionManager.prototype.onPointerOut = function (originalEvent) { + // if we support touch events, then only use those for touch events, not pointer events + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') + { return; } + var events = this.normalizeToPointerData(originalEvent); + // Only mouse and pointer can call onPointerOut, so events will always be length 1 + var event = events[0]; + if (event.pointerType === 'mouse') { + this.mouseOverRenderer = false; + this.setCursorMode(null); + } + var interactionData = this.getInteractionDataForPointerId(event); + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + interactionEvent.data.originalEvent = event; + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false); + this.emit('pointerout', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + this.emit('mouseout', interactionEvent); + } + else { + // we can get touchleave events after touchend, so we want to make sure we don't + // introduce memory leaks + this.releaseInteractionDataForPointerId(interactionData.identifier); + } + }; + /** + * Processes the result of the pointer over/out check and dispatches the event if need be + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested + * @param {boolean} hit - the result of the hit test on the display object + */ + InteractionManager.prototype.processPointerOverOut = function (interactionEvent, displayObject, hit) { + var data = interactionEvent.data; + var id = interactionEvent.data.identifier; + var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); + var trackingData = displayObject.trackedPointers[id]; + // if we just moused over the display object, then we need to track that state + if (hit && !trackingData) { + trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id); + } + if (trackingData === undefined) + { return; } + if (hit && this.mouseOverRenderer) { + if (!trackingData.over) { + trackingData.over = true; + this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent); + if (isMouse) { + this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent); + } + } + // only change the cursor if it has not already been changed (by something deeper in the + // display tree) + if (isMouse && this.cursor === null) { + this.cursor = displayObject.cursor; + } + } + else if (trackingData.over) { + trackingData.over = false; + this.dispatchEvent(displayObject, 'pointerout', this.eventData); + if (isMouse) { + this.dispatchEvent(displayObject, 'mouseout', interactionEvent); + } + // if there is no mouse down information for the pointer, then it is safe to delete + if (trackingData.none) { + delete displayObject.trackedPointers[id]; + } + } + }; + /** + * Is called when the pointer is moved into the renderer element + * + * @private + * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view + */ + InteractionManager.prototype.onPointerOver = function (originalEvent) { + var events = this.normalizeToPointerData(originalEvent); + // Only mouse and pointer can call onPointerOver, so events will always be length 1 + var event = events[0]; + var interactionData = this.getInteractionDataForPointerId(event); + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); + interactionEvent.data.originalEvent = event; + if (event.pointerType === 'mouse') { + this.mouseOverRenderer = true; + } + this.emit('pointerover', interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { + this.emit('mouseover', interactionEvent); + } + }; + /** + * Get InteractionData for a given pointerId. Store that data as well + * + * @private + * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData + * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier + */ + InteractionManager.prototype.getInteractionDataForPointerId = function (event) { + var pointerId = event.pointerId; + var interactionData; + if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') { + interactionData = this.mouse; + } + else if (this.activeInteractionData[pointerId]) { + interactionData = this.activeInteractionData[pointerId]; + } + else { + interactionData = this.interactionDataPool.pop() || new InteractionData(); + interactionData.identifier = pointerId; + this.activeInteractionData[pointerId] = interactionData; + } + // copy properties from the event, so that we can make sure that touch/pointer specific + // data is available + interactionData.copyEvent(event); + return interactionData; + }; + /** + * Return unused InteractionData to the pool, for a given pointerId + * + * @private + * @param {number} pointerId - Identifier from a pointer event + */ + InteractionManager.prototype.releaseInteractionDataForPointerId = function (pointerId) { + var interactionData = this.activeInteractionData[pointerId]; + if (interactionData) { + delete this.activeInteractionData[pointerId]; + interactionData.reset(); + this.interactionDataPool.push(interactionData); + } + }; + /** + * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured + * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent + * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired + * with the InteractionEvent + * @return {PIXI.InteractionEvent} the interaction event that was passed in + */ + InteractionManager.prototype.configureInteractionEventForDOMEvent = function (interactionEvent, pointerEvent, interactionData) { + interactionEvent.data = interactionData; + this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); + // Not really sure why this is happening, but it's how a previous version handled things + if (pointerEvent.pointerType === 'touch') { + pointerEvent.globalX = interactionData.global.x; + pointerEvent.globalY = interactionData.global.y; + } + interactionData.originalEvent = pointerEvent; + interactionEvent.reset(); + return interactionEvent; + }; + /** + * Ensures that the original event object contains all data that a regular pointer event would have + * + * @private + * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event + * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer + * or mouse event, or a multiple normalized pointer events if there are multiple changed touches + */ + InteractionManager.prototype.normalizeToPointerData = function (event) { + var normalizedEvents = []; + if (this.supportsTouchEvents && event instanceof TouchEvent) { + for (var i = 0, li = event.changedTouches.length; i < li; i++) { + var touch = event.changedTouches[i]; + if (typeof touch.button === 'undefined') + { touch.button = event.touches.length ? 1 : 0; } + if (typeof touch.buttons === 'undefined') + { touch.buttons = event.touches.length ? 1 : 0; } + if (typeof touch.isPrimary === 'undefined') { + touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; + } + if (typeof touch.width === 'undefined') + { touch.width = touch.radiusX || 1; } + if (typeof touch.height === 'undefined') + { touch.height = touch.radiusY || 1; } + if (typeof touch.tiltX === 'undefined') + { touch.tiltX = 0; } + if (typeof touch.tiltY === 'undefined') + { touch.tiltY = 0; } + if (typeof touch.pointerType === 'undefined') + { touch.pointerType = 'touch'; } + if (typeof touch.pointerId === 'undefined') + { touch.pointerId = touch.identifier || 0; } + if (typeof touch.pressure === 'undefined') + { touch.pressure = touch.force || 0.5; } + if (typeof touch.twist === 'undefined') + { touch.twist = 0; } + if (typeof touch.tangentialPressure === 'undefined') + { touch.tangentialPressure = 0; } + // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven + // support, and the fill ins are not quite the same + // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top + // left is not 0,0 on the page + if (typeof touch.layerX === 'undefined') + { touch.layerX = touch.offsetX = touch.clientX; } + if (typeof touch.layerY === 'undefined') + { touch.layerY = touch.offsetY = touch.clientY; } + // mark the touch as normalized, just so that we know we did it + touch.isNormalized = true; + normalizedEvents.push(touch); + } + } + // apparently PointerEvent subclasses MouseEvent, so yay + else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) { + var tempEvent = event; + if (typeof tempEvent.isPrimary === 'undefined') + { tempEvent.isPrimary = true; } + if (typeof tempEvent.width === 'undefined') + { tempEvent.width = 1; } + if (typeof tempEvent.height === 'undefined') + { tempEvent.height = 1; } + if (typeof tempEvent.tiltX === 'undefined') + { tempEvent.tiltX = 0; } + if (typeof tempEvent.tiltY === 'undefined') + { tempEvent.tiltY = 0; } + if (typeof tempEvent.pointerType === 'undefined') + { tempEvent.pointerType = 'mouse'; } + if (typeof tempEvent.pointerId === 'undefined') + { tempEvent.pointerId = MOUSE_POINTER_ID; } + if (typeof tempEvent.pressure === 'undefined') + { tempEvent.pressure = 0.5; } + if (typeof tempEvent.twist === 'undefined') + { tempEvent.twist = 0; } + if (typeof tempEvent.tangentialPressure === 'undefined') + { tempEvent.tangentialPressure = 0; } + // mark the mouse event as normalized, just so that we know we did it + tempEvent.isNormalized = true; + normalizedEvents.push(tempEvent); + } + else { + normalizedEvents.push(event); + } + return normalizedEvents; + }; + /** + * Destroys the interaction manager + * + */ + InteractionManager.prototype.destroy = function () { + this.removeEvents(); + this.removeTickerListener(); + this.removeAllListeners(); + this.renderer = null; + this.mouse = null; + this.eventData = null; + this.interactionDOMElement = null; + this.onPointerDown = null; + this.processPointerDown = null; + this.onPointerUp = null; + this.processPointerUp = null; + this.onPointerCancel = null; + this.processPointerCancel = null; + this.onPointerMove = null; + this.processPointerMove = null; + this.onPointerOut = null; + this.processPointerOverOut = null; + this.onPointerOver = null; + this.search = null; + }; + return InteractionManager; + }(eventemitter3)); + + /*! + * @pixi/runner - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/runner is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + /** + * A Runner is a highly performant and simple alternative to signals. Best used in situations + * where events are dispatched to many objects at high frequency (say every frame!) + * + * + * like a signal.. + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myObject = { + * loaded: new Runner('loaded') + * } + * + * const listener = { + * loaded: function(){ + * // thin + * } + * } + * + * myObject.update.add(listener); + * + * myObject.loaded.emit(); + * ``` + * + * Or for handling calling the same function on many items + * ``` + * import { Runner } from '@pixi/runner'; + * + * const myGame = { + * update: new Runner('update') + * } + * + * const gameObject = { + * update: function(time){ + * // update my gamey state + * } + * } + * + * myGame.update.add(gameObject1); + * + * myGame.update.emit(time); + * ``` + * @class + * @memberof PIXI + */ + var Runner = /** @class */ (function () { + /** + * @param {string} name - the function name that will be executed on the listeners added to this Runner. + */ + function Runner(name) { + this.items = []; + this._name = name; + this._aliasCount = 0; + } + /** + * Dispatch/Broadcast Runner to all listeners added to the queue. + * @param {...any} params - optional parameters to pass to each listener + * @return {PIXI.Runner} + */ + Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) { + if (arguments.length > 8) { + throw new Error('max arguments reached'); + } + var _a = this, name = _a.name, items = _a.items; + this._aliasCount++; + for (var i = 0, len = items.length; i < len; i++) { + items[i][name](a0, a1, a2, a3, a4, a5, a6, a7); + } + if (items === this.items) { + this._aliasCount--; + } + return this; + }; + Runner.prototype.ensureNonAliasedItems = function () { + if (this._aliasCount > 0 && this.items.length > 1) { + this._aliasCount = 0; + this.items = this.items.slice(0); + } + }; + /** + * Add a listener to the Runner + * + * Runners do not need to have scope or functions passed to them. + * All that is required is to pass the listening object and ensure that it has contains a function that has the same name + * as the name provided to the Runner when it was created. + * + * Eg A listener passed to this Runner will require a 'complete' function. + * + * ``` + * import { Runner } from '@pixi/runner'; + * + * const complete = new Runner('complete'); + * ``` + * + * The scope used will be the object itself. + * + * @param {any} item - The object that will be listening. + * @return {PIXI.Runner} + */ + Runner.prototype.add = function (item) { + if (item[this._name]) { + this.ensureNonAliasedItems(); + this.remove(item); + this.items.push(item); + } + return this; + }; + /** + * Remove a single listener from the dispatch queue. + * @param {any} item - The listenr that you would like to remove. + * @return {PIXI.Runner} + */ + Runner.prototype.remove = function (item) { + var index = this.items.indexOf(item); + if (index !== -1) { + this.ensureNonAliasedItems(); + this.items.splice(index, 1); + } + return this; + }; + /** + * Check to see if the listener is already in the Runner + * @param {any} item - The listener that you would like to check. + */ + Runner.prototype.contains = function (item) { + return this.items.indexOf(item) !== -1; + }; + /** + * Remove all listeners from the Runner + * @return {PIXI.Runner} + */ + Runner.prototype.removeAll = function () { + this.ensureNonAliasedItems(); + this.items.length = 0; + return this; + }; + /** + * Remove all references, don't use after this. + */ + Runner.prototype.destroy = function () { + this.removeAll(); + this.items = null; + this._name = null; + }; + Object.defineProperty(Runner.prototype, "empty", { + /** + * `true` if there are no this Runner contains no listeners + * + * @member {boolean} + * @readonly + */ + get: function () { + return this.items.length === 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Runner.prototype, "name", { + /** + * The name of the runner. + * + * @member {string} + * @readonly + */ + get: function () { + return this._name; + }, + enumerable: false, + configurable: true + }); + return Runner; + }()); + Object.defineProperties(Runner.prototype, { + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method dispatch + * @see PIXI.Runner#emit + */ + dispatch: { value: Runner.prototype.emit }, + /** + * Alias for `emit` + * @memberof PIXI.Runner# + * @method run + * @see PIXI.Runner#emit + */ + run: { value: Runner.prototype.emit }, + }); + + /*! + * @pixi/core - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * The maximum support for using WebGL. If a device does not + * support WebGL version, for instance WebGL 2, it will still + * attempt to fallback support to WebGL 1. If you want to + * explicitly remove feature support to target a more stable + * baseline, prefer a lower environment. + * + * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} + * we disable webgl2 by default for all non-apple mobile devices. + * + * @static + * @name PREFER_ENV + * @memberof PIXI.settings + * @type {number} + * @default PIXI.ENV.WEBGL2 + */ + settings.PREFER_ENV = isMobile$1.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; + /** + * If set to `true`, *only* Textures and BaseTexture objects stored + * in the caches ({@link PIXI.utils.TextureCache TextureCache} and + * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be + * used when calling {@link PIXI.Texture.from Texture.from} or + * {@link PIXI.BaseTexture.from BaseTexture.from}. + * Otherwise, these `from` calls throw an exception. Using this property + * can be useful if you want to enforce preloading all assets with + * {@link PIXI.Loader Loader}. + * + * @static + * @name STRICT_TEXTURE_CACHE + * @memberof PIXI.settings + * @type {boolean} + * @default false + */ + settings.STRICT_TEXTURE_CACHE = false; + + /** + * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}. + * @example + * class CustomResource extends PIXI.resources.Resource { + * // MUST have source, options constructor signature + * // for auto-detected resources to be created. + * constructor(source, options) { + * super(); + * } + * upload(renderer, baseTexture, glTexture) { + * // upload with GL + * return true; + * } + * // used to auto-detect resource + * static test(source, extension) { + * return extension === 'xyz'|| source instanceof SomeClass; + * } + * } + * // Install the new resource type + * PIXI.resources.INSTALLED.push(CustomResource); + * + * @name PIXI.resources.INSTALLED + * @type {Array<*>} + * @static + * @readonly + */ + var INSTALLED = []; + /** + * Create a resource element from a single source element. This + * auto-detects which type of resource to create. All resources that + * are auto-detectable must have a static `test` method and a constructor + * with the arguments `(source, options?)`. Currently, the supported + * resources for auto-detection include: + * - {@link PIXI.resources.ImageResource} + * - {@link PIXI.resources.CanvasResource} + * - {@link PIXI.resources.VideoResource} + * - {@link PIXI.resources.SVGResource} + * - {@link PIXI.resources.BufferResource} + * @static + * @function PIXI.resources.autoDetectResource + * @param {string|*} source - Resource source, this can be the URL to the resource, + * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri + * or any other resource that can be auto-detected. If not resource is + * detected, it's assumed to be an ImageResource. + * @param {object} [options] - Pass-through options to use for Resource + * @param {number} [options.width] - Width of BufferResource or SVG rasterization + * @param {number} [options.height] - Height of BufferResource or SVG rasterization + * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading + * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object + * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin + * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately + * @param {number} [options.updateFPS=0] - Video option to update how many times a second the + * texture should be updated from the video. Leave at 0 to update at every render + * @return {PIXI.resources.Resource} The created resource. + */ + function autoDetectResource(source, options) { + if (!source) { + return null; + } + var extension = ''; + if (typeof source === 'string') { + // search for file extension: period, 3-4 chars, then ?, # or EOL + var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); + if (result) { + extension = result[1].toLowerCase(); + } + } + for (var i = INSTALLED.length - 1; i >= 0; --i) { + var ResourcePlugin = INSTALLED[i]; + if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { + return new ResourcePlugin(source, options); + } + } + throw new Error('Unrecognized source type to auto-detect Resource'); + } + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$2 = function(d, b) { + extendStatics$2 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$2(d, b); + }; + + function __extends$2(d, b) { + extendStatics$2(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * + * @class + * @memberof PIXI.resources + */ + var Resource = /** @class */ (function () { + /** + * @param {number} [width=0] - Width of the resource + * @param {number} [height=0] - Height of the resource + */ + function Resource(width, height) { + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + /** + * Internal width of the resource + * @member {number} + * @protected + */ + this._width = width; + /** + * Internal height of the resource + * @member {number} + * @protected + */ + this._height = height; + /** + * If resource has been destroyed + * @member {boolean} + * @readonly + * @default false + */ + this.destroyed = false; + /** + * `true` if resource is created by BaseTexture + * useful for doing cleanup with BaseTexture destroy + * and not cleaning up resources that were created + * externally. + * @member {boolean} + * @protected + */ + this.internal = false; + /** + * Mini-runner for handling resize events + * accepts 2 parameters: width, height + * + * @member {Runner} + * @private + */ + this.onResize = new Runner('setRealSize'); + /** + * Mini-runner for handling update events + * + * @member {Runner} + * @private + */ + this.onUpdate = new Runner('update'); + /** + * Handle internal errors, such as loading errors + * accepts 1 param: error + * + * @member {Runner} + * @private + */ + this.onError = new Runner('onError'); + } + /** + * Bind to a parent BaseTexture + * + * @param {PIXI.BaseTexture} baseTexture - Parent texture + */ + Resource.prototype.bind = function (baseTexture) { + this.onResize.add(baseTexture); + this.onUpdate.add(baseTexture); + this.onError.add(baseTexture); + // Call a resize immediate if we already + // have the width and height of the resource + if (this._width || this._height) { + this.onResize.emit(this._width, this._height); + } + }; + /** + * Unbind to a parent BaseTexture + * + * @param {PIXI.BaseTexture} baseTexture - Parent texture + */ + Resource.prototype.unbind = function (baseTexture) { + this.onResize.remove(baseTexture); + this.onUpdate.remove(baseTexture); + this.onError.remove(baseTexture); + }; + /** + * Trigger a resize event + * @param {number} width - X dimension + * @param {number} height - Y dimension + */ + Resource.prototype.resize = function (width, height) { + if (width !== this._width || height !== this._height) { + this._width = width; + this._height = height; + this.onResize.emit(width, height); + } + }; + Object.defineProperty(Resource.prototype, "valid", { + /** + * Has been validated + * @readonly + * @member {boolean} + */ + get: function () { + return !!this._width && !!this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Has been updated trigger event + */ + Resource.prototype.update = function () { + if (!this.destroyed) { + this.onUpdate.emit(); + } + }; + /** + * This can be overridden to start preloading a resource + * or do any other prepare step. + * @protected + * @return {Promise} Handle the validate event + */ + Resource.prototype.load = function () { + return Promise.resolve(this); + }; + Object.defineProperty(Resource.prototype, "width", { + /** + * The width of the resource. + * + * @member {number} + * @readonly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resource.prototype, "height", { + /** + * The height of the resource. + * + * @member {number} + * @readonly + */ + get: function () { + return this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Set the style, optional to override + * + * @param {PIXI.Renderer} renderer - yeah, renderer! + * @param {PIXI.BaseTexture} baseTexture - the texture + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context + * @returns {boolean} `true` is success + */ + Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { + return false; + }; + /** + * Clean up anything, this happens when destroying is ready. + * + * @protected + */ + Resource.prototype.dispose = function () { + // override + }; + /** + * Call when destroying resource, unbind any BaseTexture object + * before calling this method, as reference counts are maintained + * internally. + */ + Resource.prototype.destroy = function () { + if (!this.destroyed) { + this.destroyed = true; + this.dispose(); + this.onError.removeAll(); + this.onError = null; + this.onResize.removeAll(); + this.onResize = null; + this.onUpdate.removeAll(); + this.onUpdate = null; + } + }; + /** + * Abstract, used to auto-detect resource type + * + * @static + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + */ + Resource.test = function (_source, _extension) { + return false; + }; + return Resource; + }()); + + /** + * @interface SharedArrayBuffer + */ + /** + * Buffer resource with data of typed array. + * @class + * @extends PIXI.resources.Resource + * @memberof PIXI.resources + */ + var BufferResource = /** @class */ (function (_super) { + __extends$2(BufferResource, _super); + /** + * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer + * @param {object} options - Options + * @param {number} options.width - Width of the texture + * @param {number} options.height - Height of the texture + */ + function BufferResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + if (!width || !height) { + throw new Error('BufferResource width or height invalid'); + } + _this = _super.call(this, width, height) || this; + /** + * Source array + * Cannot be ClampedUint8Array because it cant be uploaded to WebGL + * + * @member {Float32Array|Uint8Array|Uint32Array} + */ + _this.data = source; + return _this; + } + /** + * Upload the texture to the GPU. + * @param {PIXI.Renderer} renderer - Upload to the renderer + * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture + * @param {PIXI.GLTexture} glTexture - glTexture + * @returns {boolean} true is success + */ + BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); + if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); + } + else { + glTexture.width = baseTexture.width; + glTexture.height = baseTexture.height; + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.width, baseTexture.height, 0, baseTexture.format, glTexture.type, this.data); + } + return true; + }; + /** + * Destroy and don't use after this + * @override + */ + BufferResource.prototype.dispose = function () { + this.data = null; + }; + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {*} source - The source object + * @return {boolean} `true` if + */ + BufferResource.test = function (source) { + return source instanceof Float32Array + || source instanceof Uint8Array + || source instanceof Uint32Array; + }; + return BufferResource; + }(Resource)); + + var defaultBufferOptions = { + scaleMode: exports.SCALE_MODES.NEAREST, + format: exports.FORMATS.RGBA, + alphaMode: exports.ALPHA_MODES.NPM, + }; + /** + * A Texture stores the information that represents an image. + * All textures have a base texture, which contains information about the source. + * Therefore you can have many textures all using a single BaseTexture + * + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + * @param {PIXI.resources.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] + * The current resource to use, for things that aren't Resource objects, will be converted + * into a Resource. + * @param {Object} [options] - Collection of options + * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture + * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture + * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures + * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest + * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type + * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type + * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha + * @param {number} [options.width=0] - Width of the texture + * @param {number} [options.height=0] - Height of the texture + * @param {number} [options.resolution] - Resolution of the base texture + * @param {object} [options.resourceOptions] - Optional resource options, + * see {@link PIXI.resources.autoDetectResource autoDetectResource} + */ + var BaseTexture = /** @class */ (function (_super) { + __extends$2(BaseTexture, _super); + function BaseTexture(resource, options) { + if (resource === void 0) { resource = null; } + if (options === void 0) { options = null; } + var _this = _super.call(this) || this; + options = options || {}; + var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; + // Convert the resource to a Resource object + if (resource && !(resource instanceof Resource)) { + resource = autoDetectResource(resource, resourceOptions); + resource.internal = true; + } + /** + * The width of the base texture set when the image has loaded + * + * @readonly + * @member {number} + */ + _this.width = width || 0; + /** + * The height of the base texture set when the image has loaded + * + * @readonly + * @member {number} + */ + _this.height = height || 0; + /** + * The resolution / device pixel ratio of the texture + * + * @member {number} + * @default PIXI.settings.RESOLUTION + */ + _this.resolution = resolution || settings.RESOLUTION; + /** + * Mipmap mode of the texture, affects downscaled images + * + * @member {PIXI.MIPMAP_MODES} + * @default PIXI.settings.MIPMAP_TEXTURES + */ + _this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES; + /** + * Anisotropic filtering level of texture + * + * @member {number} + * @default PIXI.settings.ANISOTROPIC_LEVEL + */ + _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL; + /** + * How the texture wraps + * @member {number} + */ + _this.wrapMode = wrapMode || settings.WRAP_MODE; + /** + * The scale mode to apply when scaling this texture + * + * @member {PIXI.SCALE_MODES} + * @default PIXI.settings.SCALE_MODE + */ + _this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE; + /** + * The pixel format of the texture + * + * @member {PIXI.FORMATS} + * @default PIXI.FORMATS.RGBA + */ + _this.format = format || exports.FORMATS.RGBA; + /** + * The type of resource data + * + * @member {PIXI.TYPES} + * @default PIXI.TYPES.UNSIGNED_BYTE + */ + _this.type = type || exports.TYPES.UNSIGNED_BYTE; + /** + * The target type + * + * @member {PIXI.TARGETS} + * @default PIXI.TARGETS.TEXTURE_2D + */ + _this.target = target || exports.TARGETS.TEXTURE_2D; + /** + * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}. + * + * @member {PIXI.ALPHA_MODES} + * @default PIXI.ALPHA_MODES.UNPACK + */ + _this.alphaMode = alphaMode !== undefined ? alphaMode : exports.ALPHA_MODES.UNPACK; + if (options.premultiplyAlpha !== undefined) { + // triggers deprecation + _this.premultiplyAlpha = options.premultiplyAlpha; + } + /** + * Global unique identifier for this BaseTexture + * + * @member {number} + * @protected + */ + _this.uid = uid(); + /** + * Used by automatic texture Garbage Collection, stores last GC tick when it was bound + * + * @member {number} + * @protected + */ + _this.touched = 0; + /** + * Whether or not the texture is a power of two, try to use power of two textures as much + * as you can + * + * @readonly + * @member {boolean} + * @default false + */ + _this.isPowerOfTwo = false; + _this._refreshPOT(); + /** + * The map of render context textures where this is bound + * + * @member {Object} + * @private + */ + _this._glTextures = {}; + /** + * Used by TextureSystem to only update texture to the GPU when needed. + * Please call `update()` to increment it. + * + * @readonly + * @member {number} + */ + _this.dirtyId = 0; + /** + * Used by TextureSystem to only update texture style when needed. + * + * @protected + * @member {number} + */ + _this.dirtyStyleId = 0; + /** + * Currently default cache ID. + * + * @member {string} + */ + _this.cacheId = null; + /** + * Generally speaking means when resource is loaded. + * @readonly + * @member {boolean} + */ + _this.valid = width > 0 && height > 0; + /** + * The collection of alternative cache ids, since some BaseTextures + * can have more than one ID, short name and longer full URL + * + * @member {Array} + * @readonly + */ + _this.textureCacheIds = []; + /** + * Flag if BaseTexture has been destroyed. + * + * @member {boolean} + * @readonly + */ + _this.destroyed = false; + /** + * The resource used by this BaseTexture, there can only + * be one resource per BaseTexture, but textures can share + * resources. + * + * @member {PIXI.resources.Resource} + * @readonly + */ + _this.resource = null; + /** + * Number of the texture batch, used by multi-texture renderers + * + * @member {number} + */ + _this._batchEnabled = 0; + /** + * Location inside texture batch, used by multi-texture renderers + * + * @member {number} + */ + _this._batchLocation = 0; + /** + * Whether its a part of another texture, handled by ArrayResource or CubeResource + * + * @member {PIXI.BaseTexture} + */ + _this.parentTextureArray = null; + /** + * Fired when a not-immediately-available source finishes loading. + * + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when a not-immediately-available source fails to load. + * + * @protected + * @event PIXI.BaseTexture#error + * @param {PIXI.BaseTexture} baseTexture - Resource errored. + * @param {ErrorEvent} event - Load error event. + */ + /** + * Fired when BaseTexture is updated. + * + * @protected + * @event PIXI.BaseTexture#loaded + * @param {PIXI.BaseTexture} baseTexture - Resource loaded. + */ + /** + * Fired when BaseTexture is updated. + * + * @protected + * @event PIXI.BaseTexture#update + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. + */ + /** + * Fired when BaseTexture is destroyed. + * + * @protected + * @event PIXI.BaseTexture#dispose + * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. + */ + // Set the resource + _this.setResource(resource); + return _this; + } + Object.defineProperty(BaseTexture.prototype, "realWidth", { + /** + * Pixel width of the source of this texture + * + * @readonly + * @member {number} + */ + get: function () { + return Math.ceil((this.width * this.resolution) - 1e-4); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "realHeight", { + /** + * Pixel height of the source of this texture + * + * @readonly + * @member {number} + */ + get: function () { + return Math.ceil((this.height * this.resolution) - 1e-4); + }, + enumerable: false, + configurable: true + }); + /** + * Changes style options of BaseTexture + * + * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode + * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps + * @returns {PIXI.BaseTexture} this + */ + BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { + var dirty; + if (scaleMode !== undefined && scaleMode !== this.scaleMode) { + this.scaleMode = scaleMode; + dirty = true; + } + if (mipmap !== undefined && mipmap !== this.mipmap) { + this.mipmap = mipmap; + dirty = true; + } + if (dirty) { + this.dirtyStyleId++; + } + return this; + }; + /** + * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. + * + * @param {number} width - Visual width + * @param {number} height - Visual height + * @param {number} [resolution] - Optionally set resolution + * @returns {PIXI.BaseTexture} this + */ + BaseTexture.prototype.setSize = function (width, height, resolution) { + this.resolution = resolution || this.resolution; + this.width = width; + this.height = height; + this._refreshPOT(); + this.update(); + return this; + }; + /** + * Sets real size of baseTexture, preserves current resolution. + * + * @param {number} realWidth - Full rendered width + * @param {number} realHeight - Full rendered height + * @param {number} [resolution] - Optionally set resolution + * @returns {PIXI.BaseTexture} this + */ + BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { + this.resolution = resolution || this.resolution; + this.width = realWidth / this.resolution; + this.height = realHeight / this.resolution; + this._refreshPOT(); + this.update(); + return this; + }; + /** + * Refresh check for isPowerOfTwo texture based on size + * + * @private + */ + BaseTexture.prototype._refreshPOT = function () { + this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight); + }; + /** + * Changes resolution + * + * @param {number} resolution - res + * @returns {PIXI.BaseTexture} this + */ + BaseTexture.prototype.setResolution = function (resolution) { + var oldResolution = this.resolution; + if (oldResolution === resolution) { + return this; + } + this.resolution = resolution; + if (this.valid) { + this.width = this.width * oldResolution / resolution; + this.height = this.height * oldResolution / resolution; + this.emit('update', this); + } + this._refreshPOT(); + return this; + }; + /** + * Sets the resource if it wasn't set. Throws error if resource already present + * + * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture + * @returns {PIXI.BaseTexture} this + */ + BaseTexture.prototype.setResource = function (resource) { + if (this.resource === resource) { + return this; + } + if (this.resource) { + throw new Error('Resource can be set only once'); + } + resource.bind(this); + this.resource = resource; + return this; + }; + /** + * Invalidates the object. Texture becomes valid if width and height are greater than zero. + */ + BaseTexture.prototype.update = function () { + if (!this.valid) { + if (this.width > 0 && this.height > 0) { + this.valid = true; + this.emit('loaded', this); + this.emit('update', this); + } + } + else { + this.dirtyId++; + this.dirtyStyleId++; + this.emit('update', this); + } + }; + /** + * Handle errors with resources. + * @private + * @param {ErrorEvent} event - Error event emitted. + */ + BaseTexture.prototype.onError = function (event) { + this.emit('error', this, event); + }; + /** + * Destroys this base texture. + * The method stops if resource doesn't want this texture to be destroyed. + * Removes texture from all caches. + */ + BaseTexture.prototype.destroy = function () { + // remove and destroy the resource + if (this.resource) { + this.resource.unbind(this); + // only destroy resourced created internally + if (this.resource.internal) { + this.resource.destroy(); + } + this.resource = null; + } + if (this.cacheId) { + delete BaseTextureCache[this.cacheId]; + delete TextureCache[this.cacheId]; + this.cacheId = null; + } + // finally let the WebGL renderer know.. + this.dispose(); + BaseTexture.removeFromCache(this); + this.textureCacheIds = null; + this.destroyed = true; + }; + /** + * Frees the texture from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * + * @fires PIXI.BaseTexture#dispose + */ + BaseTexture.prototype.dispose = function () { + this.emit('dispose', this); + }; + /** + * Utility function for BaseTexture|Texture cast + */ + BaseTexture.prototype.castToBaseTexture = function () { + return this; + }; + /** + * Helper function that creates a base texture based on the source you provide. + * The source can be - image url, image element, canvas element. If the + * source is an image url or an image element and not in the base texture + * cache, it will be created and loaded. + * + * @static + * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The + * source to create base texture from. + * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @returns {PIXI.BaseTexture} The new base texture. + */ + BaseTexture.from = function (source, options, strict) { + if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else { + if (!source._pixiId) { + source._pixiId = "pixiid_" + uid(); + } + cacheId = source._pixiId; + } + var baseTexture = BaseTextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !baseTexture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); + } + if (!baseTexture) { + baseTexture = new BaseTexture(source, options); + baseTexture.cacheId = cacheId; + BaseTexture.addToCache(baseTexture, cacheId); + } + return baseTexture; + }; + /** + * Create a new BaseTexture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @static + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param {number} width - Width of the resource + * @param {number} height - Height of the resource + * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. + * @return {PIXI.BaseTexture} The resulting new BaseTexture + */ + BaseTexture.fromBuffer = function (buffer, width, height, options) { + buffer = buffer || new Float32Array(width * height * 4); + var resource = new BufferResource(buffer, { width: width, height: height }); + var type = buffer instanceof Float32Array ? exports.TYPES.FLOAT : exports.TYPES.UNSIGNED_BYTE; + return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type })); + }; + /** + * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. + * + * @static + * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. + * @param {string} id - The id that the BaseTexture will be stored against. + */ + BaseTexture.addToCache = function (baseTexture, id) { + if (id) { + if (baseTexture.textureCacheIds.indexOf(id) === -1) { + baseTexture.textureCacheIds.push(id); + } + if (BaseTextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); + } + BaseTextureCache[id] = baseTexture; + } + }; + /** + * Remove a BaseTexture from the global BaseTextureCache. + * + * @static + * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. + * @return {PIXI.BaseTexture|null} The BaseTexture that was removed. + */ + BaseTexture.removeFromCache = function (baseTexture) { + if (typeof baseTexture === 'string') { + var baseTextureFromCache = BaseTextureCache[baseTexture]; + if (baseTextureFromCache) { + var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); + if (index > -1) { + baseTextureFromCache.textureCacheIds.splice(index, 1); + } + delete BaseTextureCache[baseTexture]; + return baseTextureFromCache; + } + } + else if (baseTexture && baseTexture.textureCacheIds) { + for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { + delete BaseTextureCache[baseTexture.textureCacheIds[i]]; + } + baseTexture.textureCacheIds.length = 0; + return baseTexture; + } + return null; + }; + /** + * Global number of the texture batch, used by multi-texture renderers + * + * @static + * @member {number} + */ + BaseTexture._globalBatch = 0; + return BaseTexture; + }(eventemitter3)); + + /** + * Resource that can manage several resource (items) inside. + * All resources need to have the same pixel size. + * Parent class for CubeResource and ArrayResource + * + * @class + * @extends PIXI.resources.Resource + * @memberof PIXI.resources + * @param {object} [options] Options to for Resource constructor + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + var AbstractMultiResource = /** @class */ (function (_super) { + __extends$2(AbstractMultiResource, _super); + function AbstractMultiResource(length, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + _this = _super.call(this, width, height) || this; + /** + * Collection of partial baseTextures that correspond to resources + * @member {Array} + * @readonly + */ + _this.items = []; + /** + * Dirty IDs for each part + * @member {Array} + * @readonly + */ + _this.itemDirtyIds = []; + for (var i = 0; i < length; i++) { + var partTexture = new BaseTexture(); + _this.items.push(partTexture); + // -2 - first run of texture array upload + // -1 - texture item was allocated + // >=0 - texture item uploaded , in sync with items[i].dirtyId + _this.itemDirtyIds.push(-2); + } + /** + * Number of elements in array + * + * @member {number} + * @readonly + */ + _this.length = length; + /** + * Promise when loading + * @member {Promise} + * @private + * @default null + */ + _this._load = null; + /** + * Bound baseTexture, there can only be one + * @member {PIXI.BaseTexture} + */ + _this.baseTexture = null; + return _this; + } + /** + * used from ArrayResource and CubeResource constructors + * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. , + * length should be same as constructor length + * @param {object} [options] - detect options for resources + * @protected + */ + AbstractMultiResource.prototype.initFromArray = function (resources, options) { + for (var i = 0; i < this.length; i++) { + if (!resources[i]) { + continue; + } + if (resources[i].castToBaseTexture) { + this.addBaseTextureAt(resources[i].castToBaseTexture(), i); + } + else if (resources[i] instanceof Resource) { + this.addResourceAt(resources[i], i); + } + else { + this.addResourceAt(autoDetectResource(resources[i], options), i); + } + } + }; + /** + * Destroy this BaseImageResource + * @override + */ + AbstractMultiResource.prototype.dispose = function () { + for (var i = 0, len = this.length; i < len; i++) { + this.items[i].destroy(); + } + this.items = null; + this.itemDirtyIds = null; + this._load = null; + }; + /** + * Set a resource by ID + * + * @param {PIXI.resources.Resource} resource + * @param {number} index - Zero-based index of resource to set + * @return {PIXI.resources.ArrayResource} Instance for chaining + */ + AbstractMultiResource.prototype.addResourceAt = function (resource, index) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + // Inherit the first resource dimensions + if (resource.valid && !this.valid) { + this.resize(resource.width, resource.height); + } + this.items[index].setResource(resource); + return this; + }; + /** + * Set the parent base texture + * @member {PIXI.BaseTexture} + * @override + */ + AbstractMultiResource.prototype.bind = function (baseTexture) { + if (this.baseTexture !== null) { + throw new Error('Only one base texture per TextureArray is allowed'); + } + _super.prototype.bind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = baseTexture; + this.items[i].on('update', baseTexture.update, baseTexture); + } + }; + /** + * Unset the parent base texture + * @member {PIXI.BaseTexture} + * @override + */ + AbstractMultiResource.prototype.unbind = function (baseTexture) { + _super.prototype.unbind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = null; + this.items[i].off('update', baseTexture.update, baseTexture); + } + }; + /** + * Load all the resources simultaneously + * @override + * @return {Promise} When load is resolved + */ + AbstractMultiResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); + // TODO: also implement load part-by-part strategy + var promises = resources.map(function (item) { return item.load(); }); + this._load = Promise.all(promises) + .then(function () { + var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; + _this.resize(realWidth, realHeight); + return Promise.resolve(_this); + }); + return this._load; + }; + return AbstractMultiResource; + }(Resource)); + + /** + * A resource that contains a number of sources. + * + * @class + * @extends PIXI.resources.Resource + * @memberof PIXI.resources + * @param {number|Array<*>} source - Number of items in array or the collection + * of image URLs to use. Can also be resources, image elements, canvas, etc. + * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource} + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource + */ + var ArrayResource = /** @class */ (function (_super) { + __extends$2(ArrayResource, _super); + function ArrayResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + var urls; + var length; + if (Array.isArray(source)) { + urls = source; + length = source.length; + } + else { + length = source; + } + _this = _super.call(this, length, { width: width, height: height }) || this; + if (urls) { + _this.initFromArray(urls, options); + } + return _this; + } + /** + * Set a baseTexture by ID, + * ArrayResource just takes resource from it, nothing more + * + * @param {PIXI.BaseTexture} baseTexture + * @param {number} index - Zero-based index of resource to set + * @return {PIXI.resources.ArrayResource} Instance for chaining + */ + ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error('ArrayResource does not support RenderTexture'); + } + return this; + }; + /** + * Add binding + * @member {PIXI.BaseTexture} + * @override + */ + ArrayResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = exports.TARGETS.TEXTURE_2D_ARRAY; + }; + /** + * Upload the resources to the GPU. + * @param {PIXI.Renderer} renderer + * @param {PIXI.BaseTexture} texture + * @param {PIXI.GLTexture} glTexture + * @returns {boolean} whether texture was uploaded + */ + ArrayResource.prototype.upload = function (renderer, texture, glTexture) { + var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; + var gl = renderer.gl; + if (glTexture.dirtyId < 0) { + gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, texture.format, this._width, this._height, length, 0, texture.format, texture.type, null); + } + for (var i = 0; i < length; i++) { + var item = items[i]; + if (itemDirtyIds[i] < item.dirtyId) { + itemDirtyIds[i] = item.dirtyId; + if (item.valid) { + gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset + 0, // yoffset + i, // zoffset + item.resource.width, item.resource.height, 1, texture.format, texture.type, item.resource.source); + } + } + } + return true; + }; + return ArrayResource; + }(AbstractMultiResource)); + + /** + * Base for all the image/canvas resources + * @class + * @extends PIXI.resources.Resource + * @memberof PIXI.resources + */ + var BaseImageResource = /** @class */ (function (_super) { + __extends$2(BaseImageResource, _super); + /** + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source + */ + function BaseImageResource(source) { + var _this = this; + var sourceAny = source; + var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; + var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; + _this = _super.call(this, width, height) || this; + /** + * The source element + * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} + * @readonly + */ + _this.source = source; + /** + * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading. + * Certain types of media (e.g. video) using `texImage2D` is more performant. + * @member {boolean} + * @default false + * @private + */ + _this.noSubImage = false; + return _this; + } + /** + * Set cross origin based detecting the url and the crossorigin + * @protected + * @param {HTMLElement} element - Element to apply crossOrigin + * @param {string} url - URL to check + * @param {boolean|string} [crossorigin=true] - Cross origin value to use + */ + BaseImageResource.crossOrigin = function (element, url, crossorigin) { + if (crossorigin === undefined && url.indexOf('data:') !== 0) { + element.crossOrigin = determineCrossOrigin(url); + } + else if (crossorigin !== false) { + element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + }; + /** + * Upload the texture to the GPU. + * @param {PIXI.Renderer} renderer - Upload to the renderer + * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success + */ + BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { + var gl = renderer.gl; + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + source = source || this.source; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); + if (!this.noSubImage + && baseTexture.target === gl.TEXTURE_2D + && glTexture.width === width + && glTexture.height === height) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source); + } + return true; + }; + /** + * Checks if source width/height was changed, resize can cause extra baseTexture update. + * Triggers one update in any case. + */ + BaseImageResource.prototype.update = function () { + if (this.destroyed) { + return; + } + var source = this.source; + var width = source.naturalWidth || source.videoWidth || source.width; + var height = source.naturalHeight || source.videoHeight || source.height; + this.resize(width, height); + _super.prototype.update.call(this); + }; + /** + * Destroy this BaseImageResource + * @override + */ + BaseImageResource.prototype.dispose = function () { + this.source = null; + }; + return BaseImageResource; + }(Resource)); + + /** + * @interface OffscreenCanvas + */ + /** + * Resource type for HTMLCanvasElement. + * @class + * @extends PIXI.resources.BaseImageResource + * @memberof PIXI.resources + * @param {HTMLCanvasElement} source - Canvas element to use + */ + var CanvasResource = /** @class */ (function (_super) { + __extends$2(CanvasResource, _super); + function CanvasResource() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object + * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas + */ + CanvasResource.test = function (source) { + var OffscreenCanvas = window.OffscreenCanvas; + // Check for browsers that don't yet support OffscreenCanvas + if (OffscreenCanvas && source instanceof OffscreenCanvas) { + return true; + } + return source instanceof HTMLCanvasElement; + }; + return CanvasResource; + }(BaseImageResource)); + + /** + * Resource for a CubeTexture which contains six resources. + * + * @class + * @extends PIXI.resources.ArrayResource + * @memberof PIXI.resources + * @param {Array} [source] - Collection of URLs or resources + * to use as the sides of the cube. + * @param {object} [options] - ImageResource options + * @param {number} [options.width] - Width of resource + * @param {number} [options.height] - Height of resource + * @param {number} [options.autoLoad=true] - Whether to auto-load resources + * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, + * whether to copy them or use + */ + var CubeResource = /** @class */ (function (_super) { + __extends$2(CubeResource, _super); + function CubeResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; + if (source && source.length !== CubeResource.SIDES) { + throw new Error("Invalid length. Got " + source.length + ", expected 6"); + } + _this = _super.call(this, 6, { width: width, height: height }) || this; + for (var i = 0; i < CubeResource.SIDES; i++) { + _this.items[i].target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; + } + /** + * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself + * @member {boolean} + * @protected + */ + _this.linkBaseTexture = linkBaseTexture !== false; + if (source) { + _this.initFromArray(source, options); + } + if (autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Add binding + * + * @override + * @param {PIXI.BaseTexture} baseTexture - parent base texture + */ + CubeResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); + baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP; + }; + CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { + if (linkBaseTexture === undefined) { + linkBaseTexture = this.linkBaseTexture; + } + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + if (!this.linkBaseTexture + || baseTexture.parentTextureArray + || Object.keys(baseTexture._glTextures).length > 0) { + // copy mode + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error("CubeResource does not support copying of renderTexture."); + } + } + else { + // link mode, the difficult one! + baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; + baseTexture.parentTextureArray = this.baseTexture; + this.items[index] = baseTexture; + } + if (baseTexture.valid && !this.valid) { + this.resize(baseTexture.realWidth, baseTexture.realHeight); + } + this.items[index] = baseTexture; + return this; + }; + /** + * Upload the resource + * + * @returns {boolean} true is success + */ + CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { + var dirty = this.itemDirtyIds; + for (var i = 0; i < CubeResource.SIDES; i++) { + var side = this.items[i]; + if (dirty[i] < side.dirtyId) { + if (side.valid && side.resource) { + side.resource.upload(renderer, side, glTexture); + dirty[i] = side.dirtyId; + } + else if (dirty[i] < -1) { + // either item is not valid yet, either its a renderTexture + // allocate the memory + renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); + dirty[i] = -1; + } + } + } + return true; + }; + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {object} source - The source object + * @return {boolean} `true` if source is an array of 6 elements + */ + CubeResource.test = function (source) { + return Array.isArray(source) && source.length === CubeResource.SIDES; + }; + /** + * Number of texture sides to store for CubeResources + * + * @name PIXI.resources.CubeResource.SIDES + * @static + * @member {number} + * @default 6 + */ + CubeResource.SIDES = 6; + return CubeResource; + }(AbstractMultiResource)); + + /** + * Resource type for HTMLImageElement. + * @class + * @extends PIXI.resources.BaseImageResource + * @memberof PIXI.resources + */ + var ImageResource = /** @class */ (function (_super) { + __extends$2(ImageResource, _super); + /** + * @param {HTMLImageElement|string} source - image source or URL + * @param {object} [options] + * @param {boolean} [options.autoLoad=true] - start loading process + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create + * a bitmap before upload + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap + */ + function ImageResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLImageElement)) { + var imageElement = new Image(); + BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); + imageElement.src = source; + source = imageElement; + } + _this = _super.call(this, source) || this; + // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height + // to non-zero values before its loading completes if images are in a cache. + // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. + // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). + if (!source.complete && !!_this._width && !!_this._height) { + _this._width = 0; + _this._height = 0; + } + /** + * URL of the image source + * @member {string} + */ + _this.url = source.src; + /** + * When process is completed + * @member {Promise} + * @private + */ + _this._process = null; + /** + * If the image should be disposed after upload + * @member {boolean} + * @default false + */ + _this.preserveBitmap = false; + /** + * If capable, convert the image using createImageBitmap API + * @member {boolean} + * @default PIXI.settings.CREATE_IMAGE_BITMAP + */ + _this.createBitmap = (options.createBitmap !== undefined + ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap; + /** + * Controls texture alphaMode field + * Copies from options + * Default is `null`, copies option from baseTexture + * + * @member {PIXI.ALPHA_MODES|null} + * @readonly + */ + _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; + if (options.premultiplyAlpha !== undefined) { + // triggers deprecation + _this.premultiplyAlpha = options.premultiplyAlpha; + } + /** + * The ImageBitmap element created for HTMLImageElement + * @member {ImageBitmap} + * @default null + */ + _this.bitmap = null; + /** + * Promise when loading + * @member {Promise} + * @private + * @default null + */ + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * returns a promise when image will be loaded and processed + * + * @param {boolean} [createBitmap] - whether process image into bitmap + * @returns {Promise} + */ + ImageResource.prototype.load = function (createBitmap) { + var _this = this; + if (this._load) { + return this._load; + } + if (createBitmap !== undefined) { + this.createBitmap = createBitmap; + } + this._load = new Promise(function (resolve, reject) { + var source = _this.source; + _this.url = source.src; + var completed = function () { + if (_this.destroyed) { + return; + } + source.onload = null; + source.onerror = null; + _this.resize(source.width, source.height); + _this._load = null; + if (_this.createBitmap) { + resolve(_this.process()); + } + else { + resolve(_this); + } + }; + if (source.complete && source.src) { + completed(); + } + else { + source.onload = completed; + source.onerror = function (event) { + // Avoids Promise freezing when resource broken + reject(event); + _this.onError.emit(event); + }; + } + }); + return this._load; + }; + /** + * Called when we need to convert image into BitmapImage. + * Can be called multiple times, real promise is cached inside. + * + * @returns {Promise} cached promise to fill that bitmap + */ + ImageResource.prototype.process = function () { + var _this = this; + var source = this.source; + if (this._process !== null) { + return this._process; + } + if (this.bitmap !== null || !window.createImageBitmap) { + return Promise.resolve(this); + } + this._process = window.createImageBitmap(source, 0, 0, source.width, source.height, { + premultiplyAlpha: this.alphaMode === exports.ALPHA_MODES.UNPACK ? 'premultiply' : 'none', + }) + .then(function (bitmap) { + if (_this.destroyed) { + return Promise.reject(); + } + _this.bitmap = bitmap; + _this.update(); + _this._process = null; + return Promise.resolve(_this); + }); + return this._process; + }; + /** + * Upload the image resource to GPU. + * + * @param {PIXI.Renderer} renderer - Renderer to upload to + * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success + */ + ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { + if (typeof this.alphaMode === 'number') { + // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it + baseTexture.alphaMode = this.alphaMode; + } + if (!this.createBitmap) { + return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); + } + if (!this.bitmap) { + // yeah, ignore the output + this.process(); + if (!this.bitmap) { + return false; + } + } + _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); + if (!this.preserveBitmap) { + // checks if there are other renderers that possibly need this bitmap + var flag = true; + var glTextures = baseTexture._glTextures; + for (var key in glTextures) { + var otherTex = glTextures[key]; + if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { + flag = false; + break; + } + } + if (flag) { + if (this.bitmap.close) { + this.bitmap.close(); + } + this.bitmap = null; + } + } + return true; + }; + /** + * Destroys this texture + * @override + */ + ImageResource.prototype.dispose = function () { + this.source.onload = null; + this.source.onerror = null; + _super.prototype.dispose.call(this); + if (this.bitmap) { + this.bitmap.close(); + this.bitmap = null; + } + this._process = null; + this._load = null; + }; + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {string|HTMLImageElement} source - The source object + * @return {boolean} `true` if source is string or HTMLImageElement + */ + ImageResource.test = function (source) { + return typeof source === 'string' || source instanceof HTMLImageElement; + }; + return ImageResource; + }(BaseImageResource)); + + /** + * Resource type for SVG elements and graphics. + * @class + * @extends PIXI.resources.BaseImageResource + * @memberof PIXI.resources + * @param {string} source - Base64 encoded SVG element or URL for SVG file. + * @param {object} [options] - Options to use + * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... + * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. + * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. + * @param {boolean} [options.autoLoad=true] - Start loading right away. + */ + var SVGResource = /** @class */ (function (_super) { + __extends$2(SVGResource, _super); + function SVGResource(sourceBase64, options) { + var _this = this; + options = options || {}; + _this = _super.call(this, document.createElement('canvas')) || this; + _this._width = 0; + _this._height = 0; + /** + * Base64 encoded SVG element or URL for SVG file + * @readonly + * @member {string} + */ + _this.svg = sourceBase64; + /** + * The source scale to apply when rasterizing on load + * @readonly + * @member {number} + */ + _this.scale = options.scale || 1; + /** + * A width override for rasterization on load + * @readonly + * @member {number} + */ + _this._overrideWidth = options.width; + /** + * A height override for rasterization on load + * @readonly + * @member {number} + */ + _this._overrideHeight = options.height; + /** + * Call when completely loaded + * @private + * @member {function} + */ + _this._resolve = null; + /** + * Cross origin value to use + * @private + * @member {boolean|string} + */ + _this._crossorigin = options.crossorigin; + /** + * Promise when loading + * @member {Promise} + * @private + * @default null + */ + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + SVGResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + this._load = new Promise(function (resolve) { + // Save this until after load is finished + _this._resolve = function () { + _this.resize(_this.source.width, _this.source.height); + resolve(_this); + }; + // Convert SVG inline string to data-uri + if ((/^\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len + return SVGResource; + }(BaseImageResource)); + + /** + * Resource type for HTMLVideoElement. + * @class + * @extends PIXI.resources.BaseImageResource + * @memberof PIXI.resources + * @param {HTMLVideoElement|object|string|Array} source - Video element to use. + * @param {object} [options] - Options to use + * @param {boolean} [options.autoLoad=true] - Start loading the video immediately + * @param {boolean} [options.autoPlay=true] - Start playing video immediately + * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video. + * Leave at 0 to update at every render. + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + */ + var VideoResource = /** @class */ (function (_super) { + __extends$2(VideoResource, _super); + function VideoResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLVideoElement)) { + var videoElement = document.createElement('video'); + // workaround for https://github.com/pixijs/pixi.js/issues/5996 + videoElement.setAttribute('preload', 'auto'); + videoElement.setAttribute('webkit-playsinline', ''); + videoElement.setAttribute('playsinline', ''); + if (typeof source === 'string') { + source = [source]; + } + var firstSrc = source[0].src || source[0]; + BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); + // array of objects or strings + for (var i = 0; i < source.length; ++i) { + var sourceElement = document.createElement('source'); + var _a = source[i], src = _a.src, mime = _a.mime; + src = src || source[i]; + var baseSrc = src.split('?').shift().toLowerCase(); + var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1); + mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; + sourceElement.src = src; + sourceElement.type = mime; + videoElement.appendChild(sourceElement); + } + // Override the source + source = videoElement; + } + _this = _super.call(this, source) || this; + _this.noSubImage = true; + /** + * `true` to use PIXI.Ticker.shared to auto update the base texture. + * + * @type {boolean} + * @default true + * @private + */ + _this._autoUpdate = true; + /** + * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture. + * + * @type {boolean} + * @default false + * @private + */ + _this._isConnectedToTicker = false; + _this._updateFPS = options.updateFPS || 0; + _this._msToNextUpdate = 0; + /** + * When set to true will automatically play videos used by this texture once + * they are loaded. If false, it will not modify the playing state. + * + * @member {boolean} + * @default true + */ + _this.autoPlay = options.autoPlay !== false; + /** + * Promise when loading + * @member {Promise} + * @private + * @default null + */ + _this._load = null; + /** + * Callback when completed with load. + * @member {function} + * @private + */ + _this._resolve = null; + // Bind for listeners + _this._onCanPlay = _this._onCanPlay.bind(_this); + _this._onError = _this._onError.bind(_this); + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * Trigger updating of the texture + * + * @param {number} [deltaTime=0] - time delta since last tick + */ + VideoResource.prototype.update = function (_deltaTime) { + if (_deltaTime === void 0) { _deltaTime = 0; } + if (!this.destroyed) { + // account for if video has had its playbackRate changed + var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate; + this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); + if (!this._updateFPS || this._msToNextUpdate <= 0) { + _super.prototype.update.call(this); + this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; + } + } + }; + /** + * Start preloading the video resource. + * + * @protected + * @return {Promise} Handle the validate event + */ + VideoResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var source = this.source; + if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) + && source.width && source.height) { + source.complete = true; + } + source.addEventListener('play', this._onPlayStart.bind(this)); + source.addEventListener('pause', this._onPlayStop.bind(this)); + if (!this._isSourceReady()) { + source.addEventListener('canplay', this._onCanPlay); + source.addEventListener('canplaythrough', this._onCanPlay); + source.addEventListener('error', this._onError, true); + } + else { + this._onCanPlay(); + } + this._load = new Promise(function (resolve) { + if (_this.valid) { + resolve(_this); + } + else { + _this._resolve = resolve; + source.load(); + } + }); + return this._load; + }; + /** + * Handle video error events. + * + * @private + */ + VideoResource.prototype._onError = function (event) { + this.source.removeEventListener('error', this._onError, true); + this.onError.emit(event); + }; + /** + * Returns true if the underlying source is playing. + * + * @private + * @return {boolean} True if playing. + */ + VideoResource.prototype._isSourcePlaying = function () { + var source = this.source; + return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2); + }; + /** + * Returns true if the underlying source is ready for playing. + * + * @private + * @return {boolean} True if ready. + */ + VideoResource.prototype._isSourceReady = function () { + var source = this.source; + return source.readyState === 3 || source.readyState === 4; + }; + /** + * Runs the update loop when the video is ready to play + * + * @private + */ + VideoResource.prototype._onPlayStart = function () { + // Just in case the video has not received its can play even yet.. + if (!this.valid) { + this._onCanPlay(); + } + if (this.autoUpdate && !this._isConnectedToTicker) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + }; + /** + * Fired when a pause event is triggered, stops the update loop + * + * @private + */ + VideoResource.prototype._onPlayStop = function () { + if (this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + }; + /** + * Fired when the video is loaded and ready to play + * + * @private + */ + VideoResource.prototype._onCanPlay = function () { + var source = this.source; + source.removeEventListener('canplay', this._onCanPlay); + source.removeEventListener('canplaythrough', this._onCanPlay); + var valid = this.valid; + this.resize(source.videoWidth, source.videoHeight); + // prevent multiple loaded dispatches.. + if (!valid && this._resolve) { + this._resolve(this); + this._resolve = null; + } + if (this._isSourcePlaying()) { + this._onPlayStart(); + } + else if (this.autoPlay) { + source.play(); + } + }; + /** + * Destroys this texture + * @override + */ + VideoResource.prototype.dispose = function () { + if (this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + } + var source = this.source; + if (source) { + source.removeEventListener('error', this._onError, true); + source.pause(); + source.src = ''; + source.load(); + } + _super.prototype.dispose.call(this); + }; + Object.defineProperty(VideoResource.prototype, "autoUpdate", { + /** + * Should the base texture automatically update itself, set to true by default + * + * @member {boolean} + */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VideoResource.prototype, "updateFPS", { + /** + * How many times a second to update the texture from the video. Leave at 0 to update at every render. + * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. + * + * @member {number} + */ + get: function () { + return this._updateFPS; + }, + set: function (value) { + if (value !== this._updateFPS) { + this._updateFPS = value; + } + }, + enumerable: false, + configurable: true + }); + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + * @return {boolean} `true` if video source + */ + VideoResource.test = function (source, extension) { + return (source instanceof HTMLVideoElement) + || VideoResource.TYPES.indexOf(extension) > -1; + }; + /** + * List of common video file extensions supported by VideoResource. + * @constant + * @member {Array} + * @static + * @readonly + */ + VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; + /** + * Map of video MIME types that can't be directly derived from file extensions. + * @constant + * @member {object} + * @static + * @readonly + */ + VideoResource.MIME_TYPES = { + ogv: 'video/ogg', + mov: 'video/quicktime', + m4v: 'video/mp4', + }; + return VideoResource; + }(BaseImageResource)); + + /** + * Resource type for ImageBitmap. + * @class + * @extends PIXI.resources.BaseImageResource + * @memberof PIXI.resources + * @param {ImageBitmap} source - Image element to use + */ + var ImageBitmapResource = /** @class */ (function (_super) { + __extends$2(ImageBitmapResource, _super); + function ImageBitmapResource() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {ImageBitmap} source - The source object + * @return {boolean} `true` if source is an ImageBitmap + */ + ImageBitmapResource.test = function (source) { + return !!window.createImageBitmap && source instanceof ImageBitmap; + }; + return ImageBitmapResource; + }(BaseImageResource)); + + INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); + + var index = ({ + Resource: Resource, + BaseImageResource: BaseImageResource, + INSTALLED: INSTALLED, + autoDetectResource: autoDetectResource, + AbstractMultiResource: AbstractMultiResource, + ArrayResource: ArrayResource, + BufferResource: BufferResource, + CanvasResource: CanvasResource, + CubeResource: CubeResource, + ImageResource: ImageResource, + SVGResource: SVGResource, + VideoResource: VideoResource, + ImageBitmapResource: ImageBitmapResource + }); + + /** + * System is a base class used for extending systems used by the {@link PIXI.Renderer} + * + * @see PIXI.Renderer#addSystem + * @class + * @memberof PIXI + */ + var System = /** @class */ (function () { + /** + * @param {PIXI.Renderer} renderer - The renderer this manager works for. + */ + function System(renderer) { + /** + * The renderer this manager works for. + * + * @member {PIXI.Renderer} + */ + this.renderer = renderer; + } + /** + * Generic destroy methods to be overridden by the subclass + */ + System.prototype.destroy = function () { + this.renderer = null; + }; + return System; + }()); + + /** + * Resource type for DepthTexture. + * @class + * @extends PIXI.resources.BufferResource + * @memberof PIXI.resources + */ + var DepthResource = /** @class */ (function (_super) { + __extends$2(DepthResource, _super); + function DepthResource() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Upload the texture to the GPU. + * @param {PIXI.Renderer} renderer - Upload to the renderer + * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture + * @param {PIXI.GLTexture} glTexture - glTexture + * @returns {boolean} true is success + */ + DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { + var gl = renderer.gl; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); + if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); + } + else { + glTexture.width = baseTexture.width; + glTexture.height = baseTexture.height; + gl.texImage2D(baseTexture.target, 0, + // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0 + renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, baseTexture.width, baseTexture.height, 0, baseTexture.format, baseTexture.type, this.data); + } + return true; + }; + return DepthResource; + }(BufferResource)); + + /** + * Frame buffer used by the BaseRenderTexture + * + * @class + * @memberof PIXI + */ + var Framebuffer = /** @class */ (function () { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ + function Framebuffer(width, height) { + /** + * Width of framebuffer in pixels + * @member {number} + */ + this.width = Math.ceil(width || 100); + /** + * Height of framebuffer in pixels + * @member {number} + */ + this.height = Math.ceil(height || 100); + this.stencil = false; + this.depth = false; + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + this.depthTexture = null; + this.colorTextures = []; + this.glFramebuffers = {}; + this.disposeRunner = new Runner('disposeFramebuffer'); + /** + * Desired number of samples for antialiasing. 0 means AA should not be used. + * + * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures. + * Antialiasing is the same as for main buffer with renderer `antialias:true` options. + * Seriously affects GPU memory consumption and GPU performance. + * + *```js + * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH; + * //... + * renderer.render(renderTexture, myContainer); + * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture + * ``` + * + * @member {PIXI.MSAA_QUALITY} + * @default PIXI.MSAA_QUALITY.NONE + */ + this.multisample = exports.MSAA_QUALITY.NONE; + } + Object.defineProperty(Framebuffer.prototype, "colorTexture", { + /** + * Reference to the colorTexture. + * + * @member {PIXI.BaseTexture[]} + * @readonly + */ + get: function () { + return this.colorTextures[0]; + }, + enumerable: false, + configurable: true + }); + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.BaseTexture} [texture] - Texture to add to the array + */ + Framebuffer.prototype.addColorTexture = function (index, texture) { + if (index === void 0) { index = 0; } + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index] = texture || new BaseTexture(null, { + scaleMode: exports.SCALE_MODES.NEAREST, + resolution: 1, + mipmap: exports.MIPMAP_MODES.OFF, + width: this.width, + height: this.height, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.BaseTexture} [texture] - Texture to add + */ + Framebuffer.prototype.addDepthTexture = function (texture) { + /* eslint-disable max-len */ + this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { + scaleMode: exports.SCALE_MODES.NEAREST, + resolution: 1, + width: this.width, + height: this.height, + mipmap: exports.MIPMAP_MODES.OFF, + format: exports.FORMATS.DEPTH_COMPONENT, + type: exports.TYPES.UNSIGNED_SHORT, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Enable depth on the frame buffer + */ + Framebuffer.prototype.enableDepth = function () { + this.depth = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Enable stencil on the frame buffer + */ + Framebuffer.prototype.enableStencil = function () { + this.stencil = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ + Framebuffer.prototype.resize = function (width, height) { + width = Math.ceil(width); + height = Math.ceil(height); + if (width === this.width && height === this.height) + { return; } + this.width = width; + this.height = height; + this.dirtyId++; + this.dirtySize++; + for (var i = 0; i < this.colorTextures.length; i++) { + var texture = this.colorTextures[i]; + var resolution = texture.resolution; + // take into acount the fact the texture may have a different resolution.. + texture.setSize(width / resolution, height / resolution); + } + if (this.depthTexture) { + var resolution = this.depthTexture.resolution; + this.depthTexture.setSize(width / resolution, height / resolution); + } + }; + /** + * Disposes WebGL resources that are connected to this geometry + */ + Framebuffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** + * Destroys and removes the depth texture added to this framebuffer. + */ + Framebuffer.prototype.destroyDepthTexture = function () { + if (this.depthTexture) { + this.depthTexture.destroy(); + this.depthTexture = null; + ++this.dirtyId; + ++this.dirtyFormat; + } + }; + return Framebuffer; + }()); + + /** + * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position + * and rotation of the given Display Objects is ignored. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, renderTexture); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 }); + * let renderTexture = new PIXI.RenderTexture(baseRenderTexture); + * + * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture + * ``` + * + * @class + * @extends PIXI.BaseTexture + * @memberof PIXI + */ + var BaseRenderTexture = /** @class */ (function (_super) { + __extends$2(BaseRenderTexture, _super); + /** + * @param {object} [options] + * @param {number} [options.width=100] - The width of the base render texture. + * @param {number} [options.height=100] - The height of the base render texture. + * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated. + */ + function BaseRenderTexture(options) { + var _this = this; + if (typeof options === 'number') { + /* eslint-disable prefer-rest-params */ + // Backward compatibility of signature + var width_1 = arguments[0]; + var height_1 = arguments[1]; + var scaleMode = arguments[2]; + var resolution = arguments[3]; + options = { width: width_1, height: height_1, scaleMode: scaleMode, resolution: resolution }; + /* eslint-enable prefer-rest-params */ + } + _this = _super.call(this, null, options) || this; + var _a = options || {}, width = _a.width, height = _a.height; + // Set defaults + _this.mipmap = 0; + _this.width = Math.ceil(width) || 100; + _this.height = Math.ceil(height) || 100; + _this.valid = true; + _this.clearColor = [0, 0, 0, 0]; + _this.framebuffer = new Framebuffer(_this.width * _this.resolution, _this.height * _this.resolution) + .addColorTexture(0, _this); + // TODO - could this be added the systems? + /** + * The data structure for the stencil masks. + * + * @member {PIXI.MaskData[]} + */ + _this.maskStack = []; + /** + * The data structure for the filters. + * + * @member {Object[]} + */ + _this.filterStack = [{}]; + return _this; + } + /** + * Resizes the BaseRenderTexture. + * + * @param {number} width - The width to resize to. + * @param {number} height - The height to resize to. + */ + BaseRenderTexture.prototype.resize = function (width, height) { + width = Math.ceil(width); + height = Math.ceil(height); + this.framebuffer.resize(width * this.resolution, height * this.resolution); + }; + /** + * Frees the texture and framebuffer from WebGL memory without destroying this texture object. + * This means you can still use the texture later which will upload it to GPU + * memory again. + * + * @fires PIXI.BaseTexture#dispose + */ + BaseRenderTexture.prototype.dispose = function () { + this.framebuffer.dispose(); + _super.prototype.dispose.call(this); + }; + /** + * Destroys this texture. + */ + BaseRenderTexture.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.framebuffer.destroyDepthTexture(); + this.framebuffer = null; + }; + return BaseRenderTexture; + }(BaseTexture)); + + /** + * Stores a texture's frame in UV coordinates, in + * which everything lies in the rectangle `[(0,0), (1,0), + * (1,1), (0,1)]`. + * + * | Corner | Coordinates | + * |--------------|-------------| + * | Top-Left | `(x0,y0)` | + * | Top-Right | `(x1,y1)` | + * | Bottom-Right | `(x2,y2)` | + * | Bottom-Left | `(x3,y3)` | + * + * @class + * @protected + * @memberof PIXI + */ + var TextureUvs = /** @class */ (function () { + function TextureUvs() { + /** + * X-component of top-left corner `(x0,y0)`. + * + * @member {number} + */ + this.x0 = 0; + /** + * Y-component of top-left corner `(x0,y0)`. + * + * @member {number} + */ + this.y0 = 0; + /** + * X-component of top-right corner `(x1,y1)`. + * + * @member {number} + */ + this.x1 = 1; + /** + * Y-component of top-right corner `(x1,y1)`. + * + * @member {number} + */ + this.y1 = 0; + /** + * X-component of bottom-right corner `(x2,y2)`. + * + * @member {number} + */ + this.x2 = 1; + /** + * Y-component of bottom-right corner `(x2,y2)`. + * + * @member {number} + */ + this.y2 = 1; + /** + * X-component of bottom-left corner `(x3,y3)`. + * + * @member {number} + */ + this.x3 = 0; + /** + * Y-component of bottom-right corner `(x3,y3)`. + * + * @member {number} + */ + this.y3 = 1; + this.uvsFloat32 = new Float32Array(8); + } + /** + * Sets the texture Uvs based on the given frame information. + * + * @protected + * @param {PIXI.Rectangle} frame - The frame of the texture + * @param {PIXI.Rectangle} baseFrame - The base frame of the texture + * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8} + */ + TextureUvs.prototype.set = function (frame, baseFrame, rotate) { + var tw = baseFrame.width; + var th = baseFrame.height; + if (rotate) { + // width and height div 2 div baseFrame size + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; + // coordinates of center + var cX = (frame.x / tw) + w2; + var cY = (frame.y / th) + h2; + rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner + this.x0 = cX + (w2 * groupD8.uX(rotate)); + this.y0 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise + this.x1 = cX + (w2 * groupD8.uX(rotate)); + this.y1 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + this.x2 = cX + (w2 * groupD8.uX(rotate)); + this.y2 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + this.x3 = cX + (w2 * groupD8.uX(rotate)); + this.y3 = cY + (h2 * groupD8.uY(rotate)); + } + else { + this.x0 = frame.x / tw; + this.y0 = frame.y / th; + this.x1 = (frame.x + frame.width) / tw; + this.y1 = frame.y / th; + this.x2 = (frame.x + frame.width) / tw; + this.y2 = (frame.y + frame.height) / th; + this.x3 = frame.x / tw; + this.y3 = (frame.y + frame.height) / th; + } + this.uvsFloat32[0] = this.x0; + this.uvsFloat32[1] = this.y0; + this.uvsFloat32[2] = this.x1; + this.uvsFloat32[3] = this.y1; + this.uvsFloat32[4] = this.x2; + this.uvsFloat32[5] = this.y2; + this.uvsFloat32[6] = this.x3; + this.uvsFloat32[7] = this.y3; + }; + return TextureUvs; + }()); + + var DEFAULT_UVS = new TextureUvs(); + /** + * A texture stores the information that represents an image or part of an image. + * + * It cannot be added to the display list directly; instead use it as the texture for a Sprite. + * If no frame is provided for a texture, then the whole image is used. + * + * You can directly create a texture from an image and then reuse it multiple times like this : + * + * ```js + * let texture = PIXI.Texture.from('assets/image.png'); + * let sprite1 = new PIXI.Sprite(texture); + * let sprite2 = new PIXI.Sprite(texture); + * ``` + * + * If you didnt pass the texture frame to constructor, it enables `noFrame` mode: + * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture. + * + * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. + * You can check for this by checking the sprite's _textureID property. + * ```js + * var texture = PIXI.Texture.from('assets/image.svg'); + * var sprite1 = new PIXI.Sprite(texture); + * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file + * ``` + * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068. + * + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ + var Texture = /** @class */ (function (_super) { + __extends$2(Texture, _super); + /** + * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from + * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show + * @param {PIXI.Rectangle} [orig] - The area of original texture + * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture + * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} + * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation + */ + function Texture(baseTexture, frame, orig, trim, rotate, anchor) { + var _this = _super.call(this) || this; + /** + * Does this Texture have any frame data assigned to it? + * + * This mode is enabled automatically if no frame was passed inside constructor. + * + * In this mode texture is subscribed to baseTexture events, and fires `update` on any change. + * + * Beware, after loading or resize of baseTexture event can fired two times! + * If you want more control, subscribe on baseTexture itself. + * + * ```js + * texture.on('update', () => {}); + * ``` + * + * Any assignment of `frame` switches off `noFrame` mode. + * + * @member {boolean} + */ + _this.noFrame = false; + if (!frame) { + _this.noFrame = true; + frame = new Rectangle(0, 0, 1, 1); + } + if (baseTexture instanceof Texture) { + baseTexture = baseTexture.baseTexture; + } + /** + * The base texture that this texture uses. + * + * @member {PIXI.BaseTexture} + */ + _this.baseTexture = baseTexture; + /** + * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, + * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases) + * + * @member {PIXI.Rectangle} + */ + _this._frame = frame; + /** + * This is the trimmed area of original texture, before it was put in atlas + * Please call `updateUvs()` after you change coordinates of `trim` manually. + * + * @member {PIXI.Rectangle} + */ + _this.trim = trim; + /** + * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. + * + * @member {boolean} + */ + _this.valid = false; + /** + * The WebGL UV data cache. Can be used as quad UV + * + * @member {PIXI.TextureUvs} + * @protected + */ + _this._uvs = DEFAULT_UVS; + /** + * Default TextureMatrix instance for this texture + * By default that object is not created because its heavy + * + * @member {PIXI.TextureMatrix} + */ + _this.uvMatrix = null; + /** + * This is the area of original texture, before it was put in atlas + * + * @member {PIXI.Rectangle} + */ + _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); + _this._rotate = Number(rotate || 0); + if (rotate === true) { + // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures + _this._rotate = 2; + } + else if (_this._rotate % 2 !== 0) { + throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); + } + /** + * Anchor point that is used as default if sprite is created with this texture. + * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point. + * @member {PIXI.Point} + * @default {0,0} + */ + _this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0); + /** + * Update ID is observed by sprites and TextureMatrix instances. + * Call updateUvs() to increment it. + * + * @member {number} + * @protected + */ + _this._updateID = 0; + /** + * The ids under which this Texture has been added to the texture cache. This is + * automatically set as long as Texture.addToCache is used, but may not be set if a + * Texture is added directly to the TextureCache array. + * + * @member {string[]} + */ + _this.textureCacheIds = []; + if (!baseTexture.valid) { + baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); + } + else if (_this.noFrame) { + // if there is no frame we should monitor for any base texture changes.. + if (baseTexture.valid) { + _this.onBaseTextureUpdated(baseTexture); + } + } + else { + _this.frame = frame; + } + if (_this.noFrame) { + baseTexture.on('update', _this.onBaseTextureUpdated, _this); + } + return _this; + } + /** + * Updates this texture on the gpu. + * + * Calls the TextureResource update. + * + * If you adjusted `frame` manually, please call `updateUvs()` instead. + * + */ + Texture.prototype.update = function () { + if (this.baseTexture.resource) { + this.baseTexture.resource.update(); + } + }; + /** + * Called when the base texture is updated + * + * @protected + * @param {PIXI.BaseTexture} baseTexture - The base texture. + */ + Texture.prototype.onBaseTextureUpdated = function (baseTexture) { + if (this.noFrame) { + if (!this.baseTexture.valid) { + return; + } + this._frame.width = baseTexture.width; + this._frame.height = baseTexture.height; + this.valid = true; + this.updateUvs(); + } + else { + // TODO this code looks confusing.. boo to abusing getters and setters! + // if user gave us frame that has bigger size than resized texture it can be a problem + this.frame = this._frame; + } + this.emit('update', this); + }; + /** + * Destroys this texture + * + * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well + */ + Texture.prototype.destroy = function (destroyBase) { + if (this.baseTexture) { + if (destroyBase) { + var resource = this.baseTexture; + // delete the texture if it exists in the texture cache.. + // this only needs to be removed if the base texture is actually destroyed too.. + if (resource && resource.url && TextureCache[resource.url]) { + Texture.removeFromCache(resource.url); + } + this.baseTexture.destroy(); + } + this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); + this.baseTexture.off('update', this.onBaseTextureUpdated, this); + this.baseTexture = null; + } + this._frame = null; + this._uvs = null; + this.trim = null; + this.orig = null; + this.valid = false; + Texture.removeFromCache(this); + this.textureCacheIds = null; + }; + /** + * Creates a new texture object that acts the same as this one. + * + * @return {PIXI.Texture} The new texture + */ + Texture.prototype.clone = function () { + return new Texture(this.baseTexture, this.frame.clone(), this.orig.clone(), this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); + }; + /** + * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. + * Call it after changing the frame + */ + Texture.prototype.updateUvs = function () { + if (this._uvs === DEFAULT_UVS) { + this._uvs = new TextureUvs(); + } + this._uvs.set(this._frame, this.baseTexture, this.rotate); + this._updateID++; + }; + /** + * Helper function that creates a new Texture based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * + * @static + * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source + * Source to create texture from + * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @return {PIXI.Texture} The newly created texture + */ + Texture.from = function (source, options, strict) { + if (options === void 0) { options = {}; } + if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } + var isFrame = typeof source === 'string'; + var cacheId = null; + if (isFrame) { + cacheId = source; + } + else { + if (!source._pixiId) { + source._pixiId = "pixiid_" + uid(); + } + cacheId = source._pixiId; + } + var texture = TextureCache[cacheId]; + // Strict-mode rejects invalid cacheIds + if (isFrame && strict && !texture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); + } + if (!texture) { + if (!options.resolution) { + options.resolution = getResolutionOfUrl(source); + } + texture = new Texture(new BaseTexture(source, options)); + texture.baseTexture.cacheId = cacheId; + BaseTexture.addToCache(texture.baseTexture, cacheId); + Texture.addToCache(texture, cacheId); + } + // lets assume its a base texture! + return texture; + }; + /** + * Useful for loading textures via URLs. Use instead of `Texture.from` because + * it does a better job of handling failed URLs more effectively. This also ignores + * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. + * @param {string} url The remote URL to load. + * @param {object} [options] Optional options to include + * @return {Promise} A Promise that resolves to a Texture. + */ + Texture.fromURL = function (url, options) { + var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); + var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); + var resource = texture.baseTexture.resource; + // The texture was already loaded + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // Manually load the texture, this should allow users to handle load errors + return resource.load().then(function () { return Promise.resolve(texture); }); + }; + /** + * Create a new Texture with a BufferResource from a Float32Array. + * RGBA values are floats from 0 to 1. + * @static + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data + * is provided, a new Float32Array is created. + * @param {number} width - Width of the resource + * @param {number} height - Height of the resource + * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. + * @return {PIXI.Texture} The resulting new BaseTexture + */ + Texture.fromBuffer = function (buffer, width, height, options) { + return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); + }; + /** + * Create a texture from a source and add to the cache. + * + * @static + * @param {HTMLImageElement|HTMLCanvasElement} source - The input source. + * @param {String} imageUrl - File name of texture, for cache and resolving resolution. + * @param {String} [name] - Human readable name for the texture cache. If no name is + * specified, only `imageUrl` will be used as the cache ID. + * @return {PIXI.Texture} Output texture + */ + Texture.fromLoader = function (source, imageUrl, name) { + var resource = new ImageResource(source); + resource.url = imageUrl; + var baseTexture = new BaseTexture(resource, { + scaleMode: settings.SCALE_MODE, + resolution: getResolutionOfUrl(imageUrl), + }); + var texture = new Texture(baseTexture); + // No name, use imageUrl instead + if (!name) { + name = imageUrl; + } + // lets also add the frame to pixi's global cache for 'fromLoader' function + BaseTexture.addToCache(texture.baseTexture, name); + Texture.addToCache(texture, name); + // also add references by url if they are different. + if (name !== imageUrl) { + BaseTexture.addToCache(texture.baseTexture, imageUrl); + Texture.addToCache(texture, imageUrl); + } + return texture; + }; + /** + * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. + * + * @static + * @param {PIXI.Texture} texture - The Texture to add to the cache. + * @param {string} id - The id that the Texture will be stored against. + */ + Texture.addToCache = function (texture, id) { + if (id) { + if (texture.textureCacheIds.indexOf(id) === -1) { + texture.textureCacheIds.push(id); + } + if (TextureCache[id]) { + // eslint-disable-next-line no-console + console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); + } + TextureCache[id] = texture; + } + }; + /** + * Remove a Texture from the global TextureCache. + * + * @static + * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself + * @return {PIXI.Texture|null} The Texture that was removed + */ + Texture.removeFromCache = function (texture) { + if (typeof texture === 'string') { + var textureFromCache = TextureCache[texture]; + if (textureFromCache) { + var index = textureFromCache.textureCacheIds.indexOf(texture); + if (index > -1) { + textureFromCache.textureCacheIds.splice(index, 1); + } + delete TextureCache[texture]; + return textureFromCache; + } + } + else if (texture && texture.textureCacheIds) { + for (var i = 0; i < texture.textureCacheIds.length; ++i) { + // Check that texture matches the one being passed in before deleting it from the cache. + if (TextureCache[texture.textureCacheIds[i]] === texture) { + delete TextureCache[texture.textureCacheIds[i]]; + } + } + texture.textureCacheIds.length = 0; + return texture; + } + return null; + }; + Object.defineProperty(Texture.prototype, "resolution", { + /** + * Returns resolution of baseTexture + * + * @member {number} + * @readonly + */ + get: function () { + return this.baseTexture.resolution; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "frame", { + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `updateUvs()` after you change coordinates of `frame` manually. + * + * @member {PIXI.Rectangle} + */ + get: function () { + return this._frame; + }, + set: function (frame) { + this._frame = frame; + this.noFrame = false; + var x = frame.x, y = frame.y, width = frame.width, height = frame.height; + var xNotFit = x + width > this.baseTexture.width; + var yNotFit = y + height > this.baseTexture.height; + if (xNotFit || yNotFit) { + var relationship = xNotFit && yNotFit ? 'and' : 'or'; + var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; + var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; + throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' + + (errorX + " " + relationship + " " + errorY)); + } + this.valid = width && height && this.baseTexture.valid; + if (!this.trim && !this.rotate) { + this.orig = frame; + } + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "rotate", { + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.groupD8} for explanation + * + * @member {number} + */ + get: function () { + return this._rotate; + }, + set: function (rotate) { + this._rotate = rotate; + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "width", { + /** + * The width of the Texture in pixels. + * + * @member {number} + */ + get: function () { + return this.orig.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "height", { + /** + * The height of the Texture in pixels. + * + * @member {number} + */ + get: function () { + return this.orig.height; + }, + enumerable: false, + configurable: true + }); + /** + * Utility function for BaseTexture|Texture cast + */ + Texture.prototype.castToBaseTexture = function () { + return this.baseTexture; + }; + return Texture; + }(eventemitter3)); + function createWhiteTexture() { + var canvas = document.createElement('canvas'); + canvas.width = 16; + canvas.height = 16; + var context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 0, 16, 16); + return new Texture(new BaseTexture(new CanvasResource(canvas))); + } + function removeAllHandlers(tex) { + tex.destroy = function _emptyDestroy() { }; + tex.on = function _emptyOn() { }; + tex.once = function _emptyOnce() { }; + tex.emit = function _emptyEmit() { }; + } + /** + * An empty texture, used often to not have to create multiple empty textures. + * Can not be destroyed. + * + * @static + * @constant + * @member {PIXI.Texture} + */ + Texture.EMPTY = new Texture(new BaseTexture()); + removeAllHandlers(Texture.EMPTY); + removeAllHandlers(Texture.EMPTY.baseTexture); + /** + * A white texture of 16x16 size, used for graphics and other things + * Can not be destroyed. + * + * @static + * @constant + * @member {PIXI.Texture} + */ + Texture.WHITE = createWhiteTexture(); + removeAllHandlers(Texture.WHITE); + removeAllHandlers(Texture.WHITE.baseTexture); + + /** + * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it. + * + * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded + * otherwise black rectangles will be drawn instead. + * + * __Hint-2__: The actual memory allocation will happen on first render. + * You shouldn't create renderTextures each frame just to delete them after, try to reuse them. + * + * A RenderTexture takes a snapshot of any Display Object given to its render method. For example: + * + * ```js + * let renderer = PIXI.autoDetectRenderer(); + * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); + * let sprite = PIXI.Sprite.from("spinObj_01.png"); + * + * sprite.position.x = 800/2; + * sprite.position.y = 600/2; + * sprite.anchor.x = 0.5; + * sprite.anchor.y = 0.5; + * + * renderer.render(sprite, renderTexture); + * ``` + * + * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0 + * you can clear the transform + * + * ```js + * + * sprite.setTransform() + * + * let renderTexture = new PIXI.RenderTexture.create(100, 100); + * + * renderer.render(sprite, renderTexture); // Renders to center of RenderTexture + * ``` + * + * @class + * @extends PIXI.Texture + * @memberof PIXI + */ + var RenderTexture = /** @class */ (function (_super) { + __extends$2(RenderTexture, _super); + /** + * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses + * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show + */ + function RenderTexture(baseRenderTexture, frame) { + var _this = this; + // support for legacy.. + var _legacyRenderer = null; + if (!(baseRenderTexture instanceof BaseRenderTexture)) { + /* eslint-disable prefer-rest-params, no-console */ + var width = arguments[1]; + var height = arguments[2]; + var scaleMode = arguments[3]; + var resolution = arguments[4]; + // we have an old render texture.. + console.warn("Please use RenderTexture.create(" + width + ", " + height + ") instead of the ctor directly."); + _legacyRenderer = arguments[0]; + /* eslint-enable prefer-rest-params, no-console */ + frame = null; + baseRenderTexture = new BaseRenderTexture({ + width: width, + height: height, + scaleMode: scaleMode, + resolution: resolution, + }); + } + /** + * The base texture object that this texture uses + * + * @member {PIXI.BaseTexture} + */ + _this = _super.call(this, baseRenderTexture, frame) || this; + _this.legacyRenderer = _legacyRenderer; + /** + * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. + * + * @member {boolean} + */ + _this.valid = true; + /** + * Stores `sourceFrame` when this texture is inside current filter stack. + * You can read it inside filters. + * + * @readonly + * @member {PIXI.Rectangle} + */ + _this.filterFrame = null; + /** + * The key for pooled texture of FilterSystem + * @protected + * @member {string} + */ + _this.filterPoolKey = null; + _this.updateUvs(); + return _this; + } + Object.defineProperty(RenderTexture.prototype, "framebuffer", { + /** + * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. + * @member {PIXI.Framebuffer} + * @readonly + */ + get: function () { + return this.baseTexture.framebuffer; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the RenderTexture. + * + * @param {number} width - The width to resize to. + * @param {number} height - The height to resize to. + * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well? + */ + RenderTexture.prototype.resize = function (width, height, resizeBaseTexture) { + if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } + width = Math.ceil(width); + height = Math.ceil(height); + // TODO - could be not required.. + this.valid = (width > 0 && height > 0); + this._frame.width = this.orig.width = width; + this._frame.height = this.orig.height = height; + if (resizeBaseTexture) { + this.baseTexture.resize(width, height); + } + this.updateUvs(); + }; + /** + * Changes the resolution of baseTexture, but does not change framebuffer size. + * + * @param {number} resolution - The new resolution to apply to RenderTexture + */ + RenderTexture.prototype.setResolution = function (resolution) { + var baseTexture = this.baseTexture; + if (baseTexture.resolution === resolution) { + return; + } + baseTexture.setResolution(resolution); + this.resize(baseTexture.width, baseTexture.height, false); + }; + /** + * A short hand way of creating a render texture. + * + * @param {object} [options] - Options + * @param {number} [options.width=100] - The width of the render texture + * @param {number} [options.height=100] - The height of the render texture + * @param {number} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES} for possible values + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated + * @return {PIXI.RenderTexture} The new render texture + */ + RenderTexture.create = function (options) { + // fallback, old-style: create(width, height, scaleMode, resolution) + if (typeof options === 'number') { + /* eslint-disable prefer-rest-params */ + options = { + width: options, + height: arguments[1], + scaleMode: arguments[2], + resolution: arguments[3], + }; + /* eslint-enable prefer-rest-params */ + } + return new RenderTexture(new BaseRenderTexture(options)); + }; + return RenderTexture; + }(Texture)); + + /** + * Experimental! + * + * Texture pool, used by FilterSystem and plugins + * Stores collection of temporary pow2 or screen-sized renderTextures + * + * If you use custom RenderTexturePool for your filters, you can use methods + * `getFilterTexture` and `returnFilterTexture` same as in + * + * @class + * @memberof PIXI + */ + var RenderTexturePool = /** @class */ (function () { + /** + * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor + * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + */ + function RenderTexturePool(textureOptions) { + this.texturePool = {}; + this.textureOptions = textureOptions || {}; + /** + * Allow renderTextures of the same size as screen, not just pow2 + * + * Automatically sets to true after `setScreenSize` + * + * @member {boolean} + * @default false + */ + this.enableFullScreen = false; + this._pixelsWidth = 0; + this._pixelsHeight = 0; + } + /** + * creates of texture with params that were specified in pool constructor + * + * @param {number} realWidth - width of texture in pixels + * @param {number} realHeight - height of texture in pixels + * @returns {RenderTexture} + */ + RenderTexturePool.prototype.createTexture = function (realWidth, realHeight) { + var baseRenderTexture = new BaseRenderTexture(Object.assign({ + width: realWidth, + height: realHeight, + resolution: 1, + }, this.textureOptions)); + return new RenderTexture(baseRenderTexture); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * + * @protected + * @param {number} minWidth - The minimum width of the render texture in real pixels. + * @param {number} minHeight - The minimum height of the render texture in real pixels. + * @param {number} [resolution=1] - The resolution of the render texture. + * @return {PIXI.RenderTexture} The new render texture. + */ + RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution) { + if (resolution === void 0) { resolution = 1; } + var key = RenderTexturePool.SCREEN_KEY; + minWidth *= resolution; + minHeight *= resolution; + if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { + minWidth = nextPow2(minWidth); + minHeight = nextPow2(minHeight); + key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF); + } + if (!this.texturePool[key]) { + this.texturePool[key] = []; + } + var renderTexture = this.texturePool[key].pop(); + if (!renderTexture) { + renderTexture = this.createTexture(minWidth, minHeight); + } + renderTexture.filterPoolKey = key; + renderTexture.setResolution(resolution); + return renderTexture; + }; + /** + * Gets extra texture of the same size as input renderTexture + * + * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` + * + * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied + * @param {number} [resolution] - override resolution of the renderTexture + * It overrides, it does not multiply + * @returns {PIXI.RenderTexture} + */ + RenderTexturePool.prototype.getFilterTexture = function (input, resolution) { + var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Place a render texture back into the pool. + * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnTexture = function (renderTexture) { + var key = renderTexture.filterPoolKey; + renderTexture.filterFrame = null; + this.texturePool[key].push(renderTexture); + }; + /** + * Alias for returnTexture, to be compliant with FilterSystem interface + * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { + this.returnTexture(renderTexture); + }; + /** + * Clears the pool + * + * @param {boolean} [destroyTextures=true] - destroy all stored textures + */ + RenderTexturePool.prototype.clear = function (destroyTextures) { + destroyTextures = destroyTextures !== false; + if (destroyTextures) { + for (var i in this.texturePool) { + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + } + } + this.texturePool = {}; + }; + /** + * If screen size was changed, drops all screen-sized textures, + * sets new screen size, sets `enableFullScreen` to true + * + * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` + * + * @param {PIXI.ISize} size - Initial size of screen + */ + RenderTexturePool.prototype.setScreenSize = function (size) { + if (size.width === this._pixelsWidth + && size.height === this._pixelsHeight) { + return; + } + var screenKey = RenderTexturePool.SCREEN_KEY; + var textures = this.texturePool[screenKey]; + this.enableFullScreen = size.width > 0 && size.height > 0; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + this.texturePool[screenKey] = []; + this._pixelsWidth = size.width; + this._pixelsHeight = size.height; + }; + /** + * Key that is used to store fullscreen renderTextures in a pool + * + * @static + * @const {string} + */ + RenderTexturePool.SCREEN_KEY = 'screen'; + return RenderTexturePool; + }()); + + /* eslint-disable max-len */ + /** + * Holds the information for a single attribute structure required to render geometry. + * + * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer} + * This can include anything from positions, uvs, normals, colors etc. + * + * @class + * @memberof PIXI + */ + var Attribute = /** @class */ (function () { + /** + * @param {string} buffer - the id of the buffer that this attribute will look for + * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] - should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data) + */ + function Attribute(buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (type === void 0) { type = 5126; } + this.buffer = buffer; + this.size = size; + this.normalized = normalized; + this.type = type; + this.stride = stride; + this.start = start; + this.instance = instance; + } + /** + * Destroys the Attribute. + */ + Attribute.prototype.destroy = function () { + this.buffer = null; + }; + /** + * Helper function that creates an Attribute based on the information provided + * + * @static + * @param {string} buffer - the id of the buffer that this attribute will look for + * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] - should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) + * + * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided + */ + Attribute.from = function (buffer, size, normalized, type, stride) { + return new Attribute(buffer, size, normalized, type, stride); + }; + return Attribute; + }()); + + var UID = 0; + /** + * A wrapper for data so that it can be used and uploaded by WebGL + * + * @class + * @memberof PIXI + */ + var Buffer = /** @class */ (function () { + /** + * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer. + * @param {boolean} [_static=true] - `true` for static buffer + * @param {boolean} [index=false] - `true` for index buffer + */ + function Buffer(data, _static, index) { + if (_static === void 0) { _static = true; } + if (index === void 0) { index = false; } + /** + * The data in the buffer, as a typed array + * + * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView} + */ + this.data = (data || new Float32Array(1)); + /** + * A map of renderer IDs to webgl buffer + * + * @private + * @member {object} + */ + this._glBuffers = {}; + this._updateID = 0; + this.index = index; + this.static = _static; + this.id = UID++; + this.disposeRunner = new Runner('disposeBuffer'); + } + // TODO could explore flagging only a partial upload? + /** + * flags this buffer as requiring an upload to the GPU + * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer. + */ + Buffer.prototype.update = function (data) { + this.data = data || this.data; + this._updateID++; + }; + /** + * disposes WebGL resources that are connected to this geometry + */ + Buffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** + * Destroys the buffer + */ + Buffer.prototype.destroy = function () { + this.dispose(); + this.data = null; + }; + /** + * Helper function that creates a buffer based on an array or TypedArray + * + * @static + * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @return {PIXI.Buffer} A new Buffer based on the data provided. + */ + Buffer.from = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + return new Buffer(data); + }; + return Buffer; + }()); + + function getBufferType$1(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { + return 'Float32Array'; + } + else if (array instanceof Uint32Array) { + return 'Uint32Array'; + } + return 'Int32Array'; + } + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { + return 'Uint16Array'; + } + } + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { + return 'Uint8Array'; + } + } + // TODO map out the rest of the array elements! + return null; + } + + /* eslint-disable object-shorthand */ + var map$1 = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + }; + function interleaveTypedArrays$1(arrays, sizes) { + var outSize = 0; + var stride = 0; + var views = {}; + for (var i = 0; i < arrays.length; i++) { + stride += sizes[i]; + outSize += arrays[i].length; + } + var buffer = new ArrayBuffer(outSize * 4); + var out = null; + var littleOffset = 0; + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; + var type = getBufferType$1(array); + if (!views[type]) { + views[type] = new map$1[type](buffer); + } + out = views[type]; + for (var j = 0; j < array.length; j++) { + var indexStart = ((j / size | 0) * stride) + littleOffset; + var index = j % size; + out[indexStart + index] = array[j]; + } + littleOffset += size; + } + return new Float32Array(buffer); + } + + var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; + var UID$1 = 0; + /* eslint-disable object-shorthand */ + var map$1$1 = { + Float32Array: Float32Array, + Uint32Array: Uint32Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + Uint16Array: Uint16Array, + }; + /* eslint-disable max-len */ + /** + * The Geometry represents a model. It consists of two components: + * - GeometryStyle - The structure of the model such as the attributes layout + * - GeometryData - the data of the model - this consists of buffers. + * This can include anything from positions, uvs, normals, colors etc. + * + * Geometry can be defined without passing in a style or data if required (thats how I prefer!) + * + * ```js + * let geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2) + * geometry.addIndex([0,1,2,1,3,2]) + * + * ``` + * @class + * @memberof PIXI + */ + var Geometry = /** @class */ (function () { + /** + * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional. + * @param {object} [attributes] - of the geometry, optional structure of the attributes layout + */ + function Geometry(buffers, attributes) { + if (buffers === void 0) { buffers = []; } + if (attributes === void 0) { attributes = {}; } + this.buffers = buffers; + this.indexBuffer = null; + this.attributes = attributes; + /** + * A map of renderer IDs to webgl VAOs + * + * @protected + * @type {object} + */ + this.glVertexArrayObjects = {}; + this.id = UID$1++; + this.instanced = false; + /** + * Number of instances in this geometry, pass it to `GeometrySystem.draw()` + * @member {number} + * @default 1 + */ + this.instanceCount = 1; + this.disposeRunner = new Runner('disposeGeometry'); + /** + * Count of existing (not destroyed) meshes that reference this geometry + * @member {number} + */ + this.refCount = 0; + } + /** + * + * Adds an attribute to the geometry + * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! + * + * @param {String} id - the name of the attribute (matching up to a shader) + * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. + * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] - should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start] - How far into the array to start reading values (used for interleaving data) + * @param {boolean} [instance=false] - Instancing flag + * + * @return {PIXI.Geometry} returns self, useful for chaining. + */ + Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (instance === void 0) { instance = false; } + if (!buffer) { + throw new Error('You must pass a buffer when creating an attribute'); + } + // check if this is a buffer! + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Float32Array(buffer); + } + buffer = new Buffer(buffer); + } + var ids = id.split('|'); + if (ids.length > 1) { + for (var i = 0; i < ids.length; i++) { + this.addAttribute(ids[i], buffer, size, normalized, type); + } + return this; + } + var bufferIndex = this.buffers.indexOf(buffer); + if (bufferIndex === -1) { + this.buffers.push(buffer); + bufferIndex = this.buffers.length - 1; + } + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); + // assuming that if there is instanced data then this will be drawn with instancing! + this.instanced = this.instanced || instance; + return this; + }; + /** + * returns the requested attribute + * + * @param {String} id - the name of the attribute required + * @return {PIXI.Attribute} the attribute requested. + */ + Geometry.prototype.getAttribute = function (id) { + return this.attributes[id]; + }; + /** + * returns the requested buffer + * + * @param {String} id - the name of the buffer required + * @return {PIXI.Buffer} the buffer requested. + */ + Geometry.prototype.getBuffer = function (id) { + return this.buffers[this.getAttribute(id).buffer]; + }; + /** + * + * Adds an index buffer to the geometry + * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. + * + * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. + * @return {PIXI.Geometry} returns self, useful for chaining. + */ + Geometry.prototype.addIndex = function (buffer) { + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Uint16Array(buffer); + } + buffer = new Buffer(buffer); + } + buffer.index = true; + this.indexBuffer = buffer; + if (this.buffers.indexOf(buffer) === -1) { + this.buffers.push(buffer); + } + return this; + }; + /** + * returns the index buffer + * + * @return {PIXI.Buffer} the index buffer. + */ + Geometry.prototype.getIndex = function () { + return this.indexBuffer; + }; + /** + * this function modifies the structure so that all current attributes become interleaved into a single buffer + * This can be useful if your model remains static as it offers a little performance boost + * + * @return {PIXI.Geometry} returns self, useful for chaining. + */ + Geometry.prototype.interleave = function () { + // a simple check to see if buffers are already interleaved.. + if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) + { return this; } + // assume already that no buffers are interleaved + var arrays = []; + var sizes = []; + var interleavedBuffer = new Buffer(); + var i; + for (i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + arrays.push(buffer.data); + sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4); + attribute.buffer = 0; + } + interleavedBuffer.data = interleaveTypedArrays$1(arrays, sizes); + for (i = 0; i < this.buffers.length; i++) { + if (this.buffers[i] !== this.indexBuffer) { + this.buffers[i].destroy(); + } + } + this.buffers = [interleavedBuffer]; + if (this.indexBuffer) { + this.buffers.push(this.indexBuffer); + } + return this; + }; + Geometry.prototype.getSize = function () { + for (var i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + return buffer.data.length / ((attribute.stride / 4) || attribute.size); + } + return 0; + }; + /** + * disposes WebGL resources that are connected to this geometry + */ + Geometry.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** + * Destroys the geometry. + */ + Geometry.prototype.destroy = function () { + this.dispose(); + this.buffers = null; + this.indexBuffer = null; + this.attributes = null; + }; + /** + * returns a clone of the geometry + * + * @returns {PIXI.Geometry} a new clone of this geometry + */ + Geometry.prototype.clone = function () { + var geometry = new Geometry(); + for (var i = 0; i < this.buffers.length; i++) { + geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); + } + for (var i in this.attributes) { + var attrib = this.attributes[i]; + geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); + } + if (this.indexBuffer) { + geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; + geometry.indexBuffer.index = true; + } + return geometry; + }; + /** + * merges an array of geometries into a new single one + * geometry attribute styles must match for this operation to work + * + * @param {PIXI.Geometry[]} geometries - array of geometries to merge + * @returns {PIXI.Geometry} shiny new geometry! + */ + Geometry.merge = function (geometries) { + // todo add a geometry check! + // also a size check.. cant be too big!] + var geometryOut = new Geometry(); + var arrays = []; + var sizes = []; + var offsets = []; + var geometry; + // pass one.. get sizes.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + sizes[j] = sizes[j] || 0; + sizes[j] += geometry.buffers[j].data.length; + offsets[j] = 0; + } + } + // build the correct size arrays.. + for (var i = 0; i < geometry.buffers.length; i++) { + // TODO types! + arrays[i] = new map$1$1[getBufferType$1(geometry.buffers[i].data)](sizes[i]); + geometryOut.buffers[i] = new Buffer(arrays[i]); + } + // pass to set data.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + arrays[j].set(geometry.buffers[j].data, offsets[j]); + offsets[j] += geometry.buffers[j].data.length; + } + } + geometryOut.attributes = geometry.attributes; + if (geometry.indexBuffer) { + geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; + geometryOut.indexBuffer.index = true; + var offset = 0; + var stride = 0; + var offset2 = 0; + var bufferIndexToCount = 0; + // get a buffer + for (var i = 0; i < geometry.buffers.length; i++) { + if (geometry.buffers[i] !== geometry.indexBuffer) { + bufferIndexToCount = i; + break; + } + } + // figure out the stride of one buffer.. + for (var i in geometry.attributes) { + var attribute = geometry.attributes[i]; + if ((attribute.buffer | 0) === bufferIndexToCount) { + stride += ((attribute.size * byteSizeMap[attribute.type]) / 4); + } + } + // time to off set all indexes.. + for (var i = 0; i < geometries.length; i++) { + var indexBufferData = geometries[i].indexBuffer.data; + for (var j = 0; j < indexBufferData.length; j++) { + geometryOut.indexBuffer.data[j + offset2] += offset; + } + offset += geometry.buffers[bufferIndexToCount].data.length / (stride); + offset2 += indexBufferData.length; + } + } + return geometryOut; + }; + return Geometry; + }()); + + /** + * Helper class to create a quad + * + * @class + * @memberof PIXI + */ + var Quad = /** @class */ (function (_super) { + __extends$2(Quad, _super); + function Quad() { + var _this = _super.call(this) || this; + _this.addAttribute('aVertexPosition', new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ])) + .addIndex([0, 1, 3, 2]); + return _this; + } + return Quad; + }(Geometry)); + + /** + * Helper class to create a quad with uvs like in v4 + * + * @class + * @memberof PIXI + * @extends PIXI.Geometry + */ + var QuadUv = /** @class */ (function (_super) { + __extends$2(QuadUv, _super); + function QuadUv() { + var _this = _super.call(this) || this; + /** + * An array of vertices + * + * @member {Float32Array} + */ + _this.vertices = new Float32Array([ + -1, -1, + 1, -1, + 1, 1, + -1, 1 ]); + /** + * The Uvs of the quad + * + * @member {Float32Array} + */ + _this.uvs = new Float32Array([ + 0, 0, + 1, 0, + 1, 1, + 0, 1 ]); + _this.vertexBuffer = new Buffer(_this.vertices); + _this.uvBuffer = new Buffer(_this.uvs); + _this.addAttribute('aVertexPosition', _this.vertexBuffer) + .addAttribute('aTextureCoord', _this.uvBuffer) + .addIndex([0, 1, 2, 0, 2, 3]); + return _this; + } + /** + * Maps two Rectangle to the quad. + * + * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle + * @param {PIXI.Rectangle} destinationFrame - the second rectangle + * @return {PIXI.Quad} Returns itself. + */ + QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { + var x = 0; // destinationFrame.x / targetTextureFrame.width; + var y = 0; // destinationFrame.y / targetTextureFrame.height; + this.uvs[0] = x; + this.uvs[1] = y; + this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[3] = y; + this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); + this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); + this.uvs[6] = x; + this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); + x = destinationFrame.x; + y = destinationFrame.y; + this.vertices[0] = x; + this.vertices[1] = y; + this.vertices[2] = x + destinationFrame.width; + this.vertices[3] = y; + this.vertices[4] = x + destinationFrame.width; + this.vertices[5] = y + destinationFrame.height; + this.vertices[6] = x; + this.vertices[7] = y + destinationFrame.height; + this.invalidate(); + return this; + }; + /** + * legacy upload method, just marks buffers dirty + * @returns {PIXI.QuadUv} Returns itself. + */ + QuadUv.prototype.invalidate = function () { + this.vertexBuffer._updateID++; + this.uvBuffer._updateID++; + return this; + }; + return QuadUv; + }(Geometry)); + + var UID$2 = 0; + /** + * Uniform group holds uniform map and some ID's for work + * + * @class + * @memberof PIXI + */ + var UniformGroup = /** @class */ (function () { + /** + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation + */ + function UniformGroup(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ + this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ + this.group = true; + // lets generate this when the shader ? + this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ + this.dirtyId = 0; + /** + * unique id + * @protected + * @member {number} + */ + this.id = UID$2++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ + this.static = !!_static; + } + UniformGroup.prototype.update = function () { + this.dirtyId++; + }; + UniformGroup.prototype.add = function (name, uniforms, _static) { + this.uniforms[name] = new UniformGroup(uniforms, _static); + }; + UniformGroup.from = function (uniforms, _static) { + return new UniformGroup(uniforms, _static); + }; + return UniformGroup; + }()); + + /** + * System plugin to the renderer to manage filter states. + * + * @class + * @private + */ + var FilterState = /** @class */ (function () { + function FilterState() { + this.renderTexture = null; + /** + * Target of the filters + * We store for case when custom filter wants to know the element it was applied on + * @member {PIXI.DisplayObject} + * @private + */ + this.target = null; + /** + * Compatibility with PixiJS v4 filters + * @member {boolean} + * @default false + * @private + */ + this.legacy = false; + /** + * Resolution of filters + * @member {number} + * @default 1 + * @private + */ + this.resolution = 1; + // next three fields are created only for root + // re-assigned for everything else + /** + * Source frame + * @member {PIXI.Rectangle} + * @private + */ + this.sourceFrame = new Rectangle(); + /** + * Destination frame + * @member {PIXI.Rectangle} + * @private + */ + this.destinationFrame = new Rectangle(); + /** + * Collection of filters + * @member {PIXI.Filter[]} + * @private + */ + this.filters = []; + } + /** + * clears the state + * @private + */ + FilterState.prototype.clear = function () { + this.target = null; + this.filters = null; + this.renderTexture = null; + }; + return FilterState; + }()); + + /** + * System plugin to the renderer to manage the filters. + * + * @class + * @memberof PIXI.systems + * @extends PIXI.System + */ + var FilterSystem = /** @class */ (function (_super) { + __extends$2(FilterSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function FilterSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * List of filters for the FilterSystem + * @member {Object[]} + * @readonly + */ + _this.defaultFilterStack = [{}]; + /** + * stores a bunch of PO2 textures used for filtering + * @member {Object} + */ + _this.texturePool = new RenderTexturePool(); + _this.texturePool.setScreenSize(renderer.view); + /** + * a pool for storing filter states, save us creating new ones each tick + * @member {Object[]} + */ + _this.statePool = []; + /** + * A very simple geometry used when drawing a filter effect to the screen + * @member {PIXI.Quad} + */ + _this.quad = new Quad(); + /** + * Quad UVs + * @member {PIXI.QuadUv} + */ + _this.quadUv = new QuadUv(); + /** + * Temporary rect for maths + * @type {PIXI.Rectangle} + */ + _this.tempRect = new Rectangle(); + /** + * Active state + * @member {object} + */ + _this.activeState = {}; + /** + * This uniform group is attached to filter uniforms when used + * @member {PIXI.UniformGroup} + * @property {PIXI.Rectangle} outputFrame + * @property {Float32Array} inputSize + * @property {Float32Array} inputPixel + * @property {Float32Array} inputClamp + * @property {Number} resolution + * @property {Float32Array} filterArea + * @property {Fload32Array} filterClamp + */ + _this.globalUniforms = new UniformGroup({ + outputFrame: _this.tempRect, + inputSize: new Float32Array(4), + inputPixel: new Float32Array(4), + inputClamp: new Float32Array(4), + resolution: 1, + // legacy variables + filterArea: new Float32Array(4), + filterClamp: new Float32Array(4), + }, true); + /** + * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES} + * @member {boolean} + */ + _this.forceClear = false; + /** + * Old padding behavior is to use the max amount instead of sum padding. + * Use this flag if you need the old behavior. + * @member {boolean} + * @default false + */ + _this.useMaxPadding = false; + return _this; + } + /** + * Adds a new filter to the System. + * + * @param {PIXI.DisplayObject} target - The target of the filter to render. + * @param {PIXI.Filter[]} filters - The filters to apply. + */ + FilterSystem.prototype.push = function (target, filters) { + var renderer = this.renderer; + var filterStack = this.defaultFilterStack; + var state = this.statePool.pop() || new FilterState(); + var resolution = filters[0].resolution; + var padding = filters[0].padding; + var autoFit = filters[0].autoFit; + var legacy = filters[0].legacy; + for (var i = 1; i < filters.length; i++) { + var filter = filters[i]; + // lets use the lowest resolution.. + resolution = Math.min(resolution, filter.resolution); + // figure out the padding required for filters + padding = this.useMaxPadding + // old behavior: use largest amount of padding! + ? Math.max(padding, filter.padding) + // new behavior: sum the padding + : padding + filter.padding; + // only auto fit if all filters are autofit + autoFit = autoFit && filter.autoFit; + legacy = legacy || filter.legacy; + } + if (filterStack.length === 1) { + this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current; + } + filterStack.push(state); + state.resolution = resolution; + state.legacy = legacy; + state.target = target; + state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); + state.sourceFrame.pad(padding); + if (autoFit) { + state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame); + } + // round to whole number based on resolution + state.sourceFrame.ceil(resolution); + state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution); + state.filters = filters; + state.destinationFrame.width = state.renderTexture.width; + state.destinationFrame.height = state.renderTexture.height; + var destinationFrame = this.tempRect; + destinationFrame.width = state.sourceFrame.width; + destinationFrame.height = state.sourceFrame.height; + state.renderTexture.filterFrame = state.sourceFrame; + renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame); + renderer.renderTexture.clear(); + }; + /** + * Pops off the filter and applies it. + * + */ + FilterSystem.prototype.pop = function () { + var filterStack = this.defaultFilterStack; + var state = filterStack.pop(); + var filters = state.filters; + this.activeState = state; + var globalUniforms = this.globalUniforms.uniforms; + globalUniforms.outputFrame = state.sourceFrame; + globalUniforms.resolution = state.resolution; + var inputSize = globalUniforms.inputSize; + var inputPixel = globalUniforms.inputPixel; + var inputClamp = globalUniforms.inputClamp; + inputSize[0] = state.destinationFrame.width; + inputSize[1] = state.destinationFrame.height; + inputSize[2] = 1.0 / inputSize[0]; + inputSize[3] = 1.0 / inputSize[1]; + inputPixel[0] = inputSize[0] * state.resolution; + inputPixel[1] = inputSize[1] * state.resolution; + inputPixel[2] = 1.0 / inputPixel[0]; + inputPixel[3] = 1.0 / inputPixel[1]; + inputClamp[0] = 0.5 * inputPixel[2]; + inputClamp[1] = 0.5 * inputPixel[3]; + inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); + inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); + // only update the rect if its legacy.. + if (state.legacy) { + var filterArea = globalUniforms.filterArea; + filterArea[0] = state.destinationFrame.width; + filterArea[1] = state.destinationFrame.height; + filterArea[2] = state.sourceFrame.x; + filterArea[3] = state.sourceFrame.y; + globalUniforms.filterClamp = globalUniforms.inputClamp; + } + this.globalUniforms.update(); + var lastState = filterStack[filterStack.length - 1]; + if (state.renderTexture.framebuffer.multisample > 1) { + this.renderer.framebuffer.blit(); + } + if (filters.length === 1) { + filters[0].apply(this, state.renderTexture, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); + this.returnFilterTexture(state.renderTexture); + } + else { + var flip = state.renderTexture; + var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); + flop.filterFrame = flip.filterFrame; + var i = 0; + for (i = 0; i < filters.length - 1; ++i) { + filters[i].apply(this, flip, flop, exports.CLEAR_MODES.CLEAR, state); + var t = flip; + flip = flop; + flop = t; + } + filters[i].apply(this, flip, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); + this.returnFilterTexture(flip); + this.returnFilterTexture(flop); + } + state.clear(); + this.statePool.push(state); + }; + /** + * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. + * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack + * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} + */ + FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { + if (clearMode === void 0) { clearMode = exports.CLEAR_MODES.CLEAR; } + if (filterTexture && filterTexture.filterFrame) { + var destinationFrame = this.tempRect; + destinationFrame.width = filterTexture.filterFrame.width; + destinationFrame.height = filterTexture.filterFrame.height; + this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame); + } + else { + this.renderer.renderTexture.bind(filterTexture); + } + // TODO: remove in next major version + if (typeof clearMode === 'boolean') { + clearMode = clearMode ? exports.CLEAR_MODES.CLEAR : exports.CLEAR_MODES.BLEND; + // get deprecation function from utils + deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option'); + } + if (clearMode === exports.CLEAR_MODES.CLEAR + || (clearMode === exports.CLEAR_MODES.BLIT && this.forceClear)) { + this.renderer.renderTexture.clear(); + } + }; + /** + * Draws a filter. + * + * @param {PIXI.Filter} filter - The filter to draw. + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it + */ + FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { + var renderer = this.renderer; + this.bindAndClear(output, clearMode); + // set the uniforms.. + filter.uniforms.uSampler = input; + filter.uniforms.filterGlobals = this.globalUniforms; + // TODO make it so that the order of this does not matter.. + // because it does at the moment cos of global uniforms. + // they need to get resynced + renderer.state.set(filter.state); + renderer.shader.bind(filter); + if (filter.legacy) { + this.quadUv.map(input._frame, input.filterFrame); + renderer.geometry.bind(this.quadUv); + renderer.geometry.draw(exports.DRAW_MODES.TRIANGLES); + } + else { + renderer.geometry.bind(this.quad); + renderer.geometry.draw(exports.DRAW_MODES.TRIANGLE_STRIP); + } + }; + /** + * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. + * + * Use `outputMatrix * vTextureCoord` in the shader. + * + * @param {PIXI.Matrix} outputMatrix - The matrix to output to. + * @param {PIXI.Sprite} sprite - The sprite to map to. + * @return {PIXI.Matrix} The mapped matrix. + */ + FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var orig = sprite._texture.orig; + var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); + var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX); + worldTransform.invert(); + mappedMatrix.prepend(worldTransform); + mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); + mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); + return mappedMatrix; + }; + /** + * Destroys this Filter System. + */ + FilterSystem.prototype.destroy = function () { + // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem + this.texturePool.clear(false); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * + * @protected + * @param {number} minWidth - The minimum width of the render texture in real pixels. + * @param {number} minHeight - The minimum height of the render texture in real pixels. + * @param {number} [resolution=1] - The resolution of the render texture. + * @return {PIXI.RenderTexture} The new render texture. + */ + FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution) { + if (resolution === void 0) { resolution = 1; } + return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution); + }; + /** + * Gets extra render texture to use inside current filter + * To be compliant with older filters, you can use params in any order + * + * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied + * @param {number} [resolution] - override resolution of the renderTexture + * @returns {PIXI.RenderTexture} + */ + FilterSystem.prototype.getFilterTexture = function (input, resolution) { + if (typeof input === 'number') { + var swap = input; + input = resolution; + resolution = swap; + } + input = input || this.activeState.renderTexture; + var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Frees a render texture back into the pool. + * + * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free + */ + FilterSystem.prototype.returnFilterTexture = function (renderTexture) { + this.texturePool.returnTexture(renderTexture); + }; + /** + * Empties the texture pool. + */ + FilterSystem.prototype.emptyPool = function () { + this.texturePool.clear(true); + }; + /** + * calls `texturePool.resize()`, affects fullScreen renderTextures + */ + FilterSystem.prototype.resize = function () { + this.texturePool.setScreenSize(this.renderer.view); + }; + return FilterSystem; + }(System)); + + /** + * Base for a common object renderer that can be used as a + * system renderer plugin. + * + * @class + * @extends PIXI.System + * @memberof PIXI + */ + var ObjectRenderer = /** @class */ (function () { + /** + * @param {PIXI.Renderer} renderer - The renderer this manager works for. + */ + function ObjectRenderer(renderer) { + /** + * The renderer this manager works for. + * + * @member {PIXI.Renderer} + */ + this.renderer = renderer; + } + /** + * Stub method that should be used to empty the current + * batch by rendering objects now. + */ + ObjectRenderer.prototype.flush = function () { + // flush! + }; + /** + * Generic destruction method that frees all resources. This + * should be called by subclasses. + */ + ObjectRenderer.prototype.destroy = function () { + this.renderer = null; + }; + /** + * Stub method that initializes any state required before + * rendering starts. It is different from the `prerender` + * signal, which occurs every frame, in that it is called + * whenever an object requests _this_ renderer specifically. + */ + ObjectRenderer.prototype.start = function () { + // set the shader.. + }; + /** + * Stops the renderer. It should free up any state and + * become dormant. + */ + ObjectRenderer.prototype.stop = function () { + this.flush(); + }; + /** + * Keeps the object to render. It doesn't have to be + * rendered immediately. + * + * @param {PIXI.DisplayObject} object - The object to render. + */ + ObjectRenderer.prototype.render = function (_object) { + // render the object + }; + return ObjectRenderer; + }()); + + /** + * System plugin to the renderer to manage batching. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var BatchSystem = /** @class */ (function (_super) { + __extends$2(BatchSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function BatchSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * An empty renderer. + * + * @member {PIXI.ObjectRenderer} + */ + _this.emptyRenderer = new ObjectRenderer(renderer); + /** + * The currently active ObjectRenderer. + * + * @member {PIXI.ObjectRenderer} + */ + _this.currentRenderer = _this.emptyRenderer; + return _this; + } + /** + * Changes the current renderer to the one given in parameter + * + * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use. + */ + BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { + if (this.currentRenderer === objectRenderer) { + return; + } + this.currentRenderer.stop(); + this.currentRenderer = objectRenderer; + this.currentRenderer.start(); + }; + /** + * This should be called if you wish to do some custom rendering + * It will basically render anything that may be batched up such as sprites + */ + BatchSystem.prototype.flush = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** + * Reset the system to an empty renderer + */ + BatchSystem.prototype.reset = function () { + this.setObjectRenderer(this.emptyRenderer); + }; + /** + * Handy function for batch renderers: copies bound textures in first maxTextures locations to array + * sets actual _batchLocation for them + * + * @param {PIXI.BaseTexture[]} - arr copy destination + * @param {number} maxTextures - number of copied elements + */ + BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { + var boundTextures = this.renderer.texture.boundTextures; + for (var i = maxTextures - 1; i >= 0; --i) { + arr[i] = boundTextures[i] || null; + if (arr[i]) { + arr[i]._batchLocation = i; + } + } + }; + /** + * Assigns batch locations to textures in array based on boundTextures state. + * All textures in texArray should have `_batchEnabled = _batchId`, + * and their count should be less than `maxTextures`. + * + * @param {PIXI.BatchTextureArray} texArray - textures to bound + * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures + * @param {number} batchId - marker for _batchEnabled param of textures in texArray + * @param {number} maxTextures - number of texture locations to manipulate + */ + BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { + var elements = texArray.elements, ids = texArray.ids, count = texArray.count; + var j = 0; + for (var i = 0; i < count; i++) { + var tex = elements[i]; + var loc = tex._batchLocation; + if (loc >= 0 && loc < maxTextures + && boundTextures[loc] === tex) { + ids[i] = loc; + continue; + } + while (j < maxTextures) { + var bound = boundTextures[j]; + if (bound && bound._batchEnabled === batchId + && bound._batchLocation === j) { + j++; + continue; + } + ids[i] = j; + tex._batchLocation = j; + boundTextures[j] = tex; + break; + } + } + }; + return BatchSystem; + }(System)); + + var CONTEXT_UID_COUNTER = 0; + /** + * System plugin to the renderer to manage the context. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var ContextSystem = /** @class */ (function (_super) { + __extends$2(ContextSystem, _super); + /* eslint-enable camelcase */ + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ContextSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * Either 1 or 2 to reflect the WebGL version being used + * @member {number} + * @readonly + */ + _this.webGLVersion = 1; + /** + * Extensions being used + * @member {object} + * @readonly + * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension + * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension + * @property {OES_texture_float} floatTexture - WebGL v1 extension + * @property {WEBGL_lose_context} loseContext - WebGL v1 extension + * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension + * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension + */ + _this.extensions = {}; + /** + * Features supported by current context + * @member {object} + * @private + * @readonly + * @property {boolean} uint32Indices - Supports of 32-bit indices buffer + */ + _this.supports = { + uint32Indices: false, + }; + // Bind functions + _this.handleContextLost = _this.handleContextLost.bind(_this); + _this.handleContextRestored = _this.handleContextRestored.bind(_this); + renderer.view.addEventListener('webglcontextlost', _this.handleContextLost, false); + renderer.view.addEventListener('webglcontextrestored', _this.handleContextRestored, false); + return _this; + } + Object.defineProperty(ContextSystem.prototype, "isLost", { + /** + * `true` if the context is lost + * @member {boolean} + * @readonly + */ + get: function () { + return (!this.gl || this.gl.isContextLost()); + }, + enumerable: false, + configurable: true + }); + /** + * Handle the context change event + * @param {WebGLRenderingContext} gl - new webgl context + */ + ContextSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + // restore a context if it was previously lost + if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) { + gl.getExtension('WEBGL_lose_context').restoreContext(); + } + }; + /** + * Initialize the context + * + * @protected + * @param {WebGLRenderingContext} gl - WebGL context + */ + ContextSystem.prototype.initFromContext = function (gl) { + this.gl = gl; + this.validateContext(gl); + this.renderer.gl = gl; + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + this.renderer.runners.contextChange.emit(gl); + }; + /** + * Initialize from context options + * + * @protected + * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext + * @param {object} options - context attributes + */ + ContextSystem.prototype.initFromOptions = function (options) { + var gl = this.createContext(this.renderer.view, options); + this.initFromContext(gl); + }; + /** + * Helper class to create a WebGL Context + * + * @param canvas {HTMLCanvasElement} the canvas element that we will get the context from + * @param options {object} An options object that gets passed in to the canvas element containing the context attributes + * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext + * @return {WebGLRenderingContext} the WebGL context + */ + ContextSystem.prototype.createContext = function (canvas, options) { + var gl; + if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { + gl = canvas.getContext('webgl2', options); + } + if (gl) { + this.webGLVersion = 2; + } + else { + this.webGLVersion = 1; + gl = canvas.getContext('webgl', options) + || canvas.getContext('experimental-webgl', options); + if (!gl) { + // fail, not able to get a context + throw new Error('This browser does not support WebGL. Try using the canvas renderer'); + } + } + this.gl = gl; + this.getExtensions(); + return this.gl; + }; + /** + * Auto-populate the extensions + * + * @protected + */ + ContextSystem.prototype.getExtensions = function () { + // time to set up default extensions that Pixi uses. + var gl = this.gl; + if (this.webGLVersion === 1) { + Object.assign(this.extensions, { + drawBuffers: gl.getExtension('WEBGL_draw_buffers'), + depthTexture: gl.getExtension('WEBGL_depth_texture'), + loseContext: gl.getExtension('WEBGL_lose_context'), + vertexArrayObject: gl.getExtension('OES_vertex_array_object') + || gl.getExtension('MOZ_OES_vertex_array_object') + || gl.getExtension('WEBKIT_OES_vertex_array_object'), + anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), + uint32ElementIndex: gl.getExtension('OES_element_index_uint'), + // Floats and half-floats + floatTexture: gl.getExtension('OES_texture_float'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + textureHalfFloat: gl.getExtension('OES_texture_half_float'), + textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), + }); + } + else if (this.webGLVersion === 2) { + Object.assign(this.extensions, { + anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), + // Floats and half-floats + colorBufferFloat: gl.getExtension('EXT_color_buffer_float'), + floatTextureLinear: gl.getExtension('OES_texture_float_linear'), + }); + } + }; + /** + * Handles a lost webgl context + * + * @protected + * @param {WebGLContextEvent} event - The context lost event. + */ + ContextSystem.prototype.handleContextLost = function (event) { + event.preventDefault(); + }; + /** + * Handles a restored webgl context + * + * @protected + */ + ContextSystem.prototype.handleContextRestored = function () { + this.renderer.runners.contextChange.emit(this.gl); + }; + ContextSystem.prototype.destroy = function () { + var view = this.renderer.view; + // remove listeners + view.removeEventListener('webglcontextlost', this.handleContextLost); + view.removeEventListener('webglcontextrestored', this.handleContextRestored); + this.gl.useProgram(null); + if (this.extensions.loseContext) { + this.extensions.loseContext.loseContext(); + } + }; + /** + * Handle the post-render runner event + * + * @protected + */ + ContextSystem.prototype.postrender = function () { + if (this.renderer.renderingToScreen) { + this.gl.flush(); + } + }; + /** + * Validate context + * + * @protected + * @param {WebGLRenderingContext} gl - Render context + */ + ContextSystem.prototype.validateContext = function (gl) { + var attributes = gl.getContextAttributes(); + var isWebGl2 = 'WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext; + if (isWebGl2) { + this.webGLVersion = 2; + } + // this is going to be fairly simple for now.. but at least we have room to grow! + if (!attributes.stencil) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); + /* eslint-enable max-len, no-console */ + } + var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint'); + this.supports.uint32Indices = hasuint32; + if (!hasuint32) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); + /* eslint-enable max-len, no-console */ + } + }; + return ContextSystem; + }(System)); + + /** + * Internal framebuffer for WebGL context + * @class + * @memberof PIXI + */ + var GLFramebuffer = /** @class */ (function () { + function GLFramebuffer(framebuffer) { + /** + * The WebGL framebuffer + * @member {WebGLFramebuffer} + */ + this.framebuffer = framebuffer; + /** + * stencil+depth , usually costs 32bits per pixel + * @member {WebGLRenderbuffer} + */ + this.stencil = null; + /** + * latest known version of framebuffer + * @member {number} + * @protected + */ + this.dirtyId = 0; + /** + * latest known version of framebuffer format + * @member {number} + * @protected + */ + this.dirtyFormat = 0; + /** + * latest known version of framebuffer size + * @member {number} + * @protected + */ + this.dirtySize = 0; + /** + * Detected AA samples number + * @member {PIXI.MSAA_QUALITY} + */ + this.multisample = exports.MSAA_QUALITY.NONE; + /** + * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info + * @member {WebGLRenderbuffer} + */ + this.msaaBuffer = null; + /** + * In case we use MSAA, this is actual framebuffer that has colorTextures[0] + * The contents of that framebuffer are read when we use that renderTexture in sprites + * @member {PIXI.Framebuffer} + */ + this.blitFramebuffer = null; + } + return GLFramebuffer; + }()); + + var tempRectangle = new Rectangle(); + /** + * System plugin to the renderer to manage framebuffers. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var FramebufferSystem = /** @class */ (function (_super) { + __extends$2(FramebufferSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function FramebufferSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * A list of managed framebuffers + * @member {PIXI.Framebuffer[]} + * @readonly + */ + _this.managedFramebuffers = []; + /** + * Framebuffer value that shows that we don't know what is bound + * @member {Framebuffer} + * @readonly + */ + _this.unknownFramebuffer = new Framebuffer(10, 10); + _this.msaaSamples = null; + return _this; + } + /** + * Sets up the renderer context and necessary buffers. + */ + FramebufferSystem.prototype.contextChange = function () { + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.current = this.unknownFramebuffer; + this.viewport = new Rectangle(); + this.hasMRT = true; + this.writeDepthTexture = true; + this.disposeAll(true); + // webgl2 + if (this.renderer.context.webGLVersion === 1) { + // webgl 1! + var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; + var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; + if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { + nativeDrawBuffersExtension_1 = null; + nativeDepthTextureExtension = null; + } + if (nativeDrawBuffersExtension_1) { + gl.drawBuffers = function (activeTextures) { + return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); + }; + } + else { + this.hasMRT = false; + gl.drawBuffers = function () { + // empty + }; + } + if (!nativeDepthTextureExtension) { + this.writeDepthTexture = false; + } + } + else { + // WebGL2 + // cache possible MSAA samples + this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); + } + }; + /** + * Bind a framebuffer + * + * @param {PIXI.Framebuffer} framebuffer + * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size + */ + FramebufferSystem.prototype.bind = function (framebuffer, frame) { + var gl = this.gl; + if (framebuffer) { + // TODO caching layer! + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); + if (this.current !== framebuffer) { + this.current = framebuffer; + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); + } + // make sure all textures are unbound.. + // now check for updates... + if (fbo.dirtyId !== framebuffer.dirtyId) { + fbo.dirtyId = framebuffer.dirtyId; + if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { + fbo.dirtyFormat = framebuffer.dirtyFormat; + this.updateFramebuffer(framebuffer); + } + else if (fbo.dirtySize !== framebuffer.dirtySize) { + fbo.dirtySize = framebuffer.dirtySize; + this.resizeFramebuffer(framebuffer); + } + } + for (var i = 0; i < framebuffer.colorTextures.length; i++) { + var tex = framebuffer.colorTextures[i]; + this.renderer.texture.unbind(tex.parentTextureArray || tex); + } + if (framebuffer.depthTexture) { + this.renderer.texture.unbind(framebuffer.depthTexture); + } + if (frame) { + this.setViewport(frame.x, frame.y, frame.width, frame.height); + } + else { + this.setViewport(0, 0, framebuffer.width, framebuffer.height); + } + } + else { + if (this.current) { + this.current = null; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + if (frame) { + this.setViewport(frame.x, frame.y, frame.width, frame.height); + } + else { + this.setViewport(0, 0, this.renderer.width, this.renderer.height); + } + } + }; + /** + * Set the WebGLRenderingContext's viewport. + * + * @param {Number} x - X position of viewport + * @param {Number} y - Y position of viewport + * @param {Number} width - Width of viewport + * @param {Number} height - Height of viewport + */ + FramebufferSystem.prototype.setViewport = function (x, y, width, height) { + var v = this.viewport; + if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { + v.x = x; + v.y = y; + v.width = width; + v.height = height; + this.gl.viewport(x, y, width, height); + } + }; + Object.defineProperty(FramebufferSystem.prototype, "size", { + /** + * Get the size of the current width and height. Returns object with `width` and `height` values. + * + * @member {object} + * @readonly + */ + get: function () { + if (this.current) { + // TODO store temp + return { x: 0, y: 0, width: this.current.width, height: this.current.height }; + } + return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; + }, + enumerable: false, + configurable: true + }); + /** + * Clear the color of the context + * + * @param {Number} r - Red value from 0 to 1 + * @param {Number} g - Green value from 0 to 1 + * @param {Number} b - Blue value from 0 to 1 + * @param {Number} a - Alpha value from 0 to 1 + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + */ + FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { + if (mask === void 0) { mask = exports.BUFFER_BITS.COLOR | exports.BUFFER_BITS.DEPTH; } + var gl = this.gl; + // TODO clear color can be set only one right? + gl.clearColor(r, g, b, a); + gl.clear(mask); + }; + /** + * Initialize framebuffer for this context + * + * @protected + * @param {PIXI.Framebuffer} framebuffer + * @returns {PIXI.GLFramebuffer} created GLFramebuffer + */ + FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = new GLFramebuffer(gl.createFramebuffer()); + fbo.multisample = this.detectSamples(framebuffer.multisample); + framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; + this.managedFramebuffers.push(framebuffer); + framebuffer.disposeRunner.add(this); + return fbo; + }; + /** + * Resize the framebuffer + * + * @protected + * @param {PIXI.Framebuffer} framebuffer + */ + FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (fbo.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + } + var colorTextures = framebuffer.colorTextures; + for (var i = 0; i < colorTextures.length; i++) { + this.renderer.texture.bind(colorTextures[i], 0); + } + if (framebuffer.depthTexture) { + this.renderer.texture.bind(framebuffer.depthTexture, 0); + } + }; + /** + * Update the framebuffer + * + * @protected + * @param {PIXI.Framebuffer} framebuffer + */ + FramebufferSystem.prototype.updateFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + // bind the color texture + var colorTextures = framebuffer.colorTextures; + var count = colorTextures.length; + if (!gl.drawBuffers) { + count = Math.min(count, 1); + } + if (fbo.multisample > 1) { + fbo.msaaBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); + } + var activeTextures = []; + for (var i = 0; i < count; i++) { + if (i === 0 && fbo.multisample > 1) { + continue; + } + var texture = framebuffer.colorTextures[i]; + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, 0); + activeTextures.push(gl.COLOR_ATTACHMENT0 + i); + } + if (activeTextures.length > 1) { + gl.drawBuffers(activeTextures); + } + if (framebuffer.depthTexture) { + var writeDepthTexture = this.writeDepthTexture; + if (writeDepthTexture) { + var depthTexture = framebuffer.depthTexture; + this.renderer.texture.bind(depthTexture, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, 0); + } + } + if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth)) { + fbo.stencil = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); + // TODO.. this is depth AND stencil? + if (!framebuffer.depthTexture) { // you can't have both, so one should take priority if enabled + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); + } + } + }; + /** + * Detects number of samples that is not more than a param but as close to it as possible + * + * @param {PIXI.MSAA_QUALITY} samples - number of samples + * @returns {PIXI.MSAA_QUALITY} - recommended number of samples + */ + FramebufferSystem.prototype.detectSamples = function (samples) { + var msaaSamples = this.msaaSamples; + var res = exports.MSAA_QUALITY.NONE; + if (samples <= 1 || msaaSamples === null) { + return res; + } + for (var i = 0; i < msaaSamples.length; i++) { + if (msaaSamples[i] <= samples) { + res = msaaSamples[i]; + break; + } + } + if (res === 1) { + res = exports.MSAA_QUALITY.NONE; + } + return res; + }; + /** + * Only works with WebGL2 + * + * blits framebuffer to another of the same or bigger size + * after that target framebuffer is bound + * + * Fails with WebGL warning if blits multisample framebuffer to different size + * + * @param {PIXI.Framebuffer} [framebuffer] - by default it blits "into itself", from renderBuffer to texture. + * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels + * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels + */ + FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { + var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (renderer.context.webGLVersion !== 2) { + return; + } + if (!current) { + return; + } + var fbo = current.glFramebuffers[CONTEXT_UID]; + if (!fbo) { + return; + } + if (!framebuffer) { + if (fbo.multisample <= 1) { + return; + } + if (!fbo.blitFramebuffer) { + fbo.blitFramebuffer = new Framebuffer(current.width, current.height); + fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]); + } + framebuffer = fbo.blitFramebuffer; + framebuffer.width = current.width; + framebuffer.height = current.height; + } + if (!sourcePixels) { + sourcePixels = tempRectangle; + sourcePixels.width = current.width; + sourcePixels.height = current.height; + } + if (!destPixels) { + destPixels = sourcePixels; + } + var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; + this.bind(framebuffer); + gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); + gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height, destPixels.x, destPixels.y, destPixels.width, destPixels.height, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); + }; + /** + * Disposes framebuffer + * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of + * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + var gl = this.gl; + if (!fbo) { + return; + } + delete framebuffer.glFramebuffers[this.CONTEXT_UID]; + var index = this.managedFramebuffers.indexOf(framebuffer); + if (index >= 0) { + this.managedFramebuffers.splice(index, 1); + } + framebuffer.disposeRunner.remove(this); + if (!contextLost) { + gl.deleteFramebuffer(fbo.framebuffer); + if (fbo.stencil) { + gl.deleteRenderbuffer(fbo.stencil); + } + } + }; + /** + * Disposes all framebuffers, but not textures bound to them + * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeAll = function (contextLost) { + var list = this.managedFramebuffers; + this.managedFramebuffers = []; + for (var i = 0; i < list.length; i++) { + this.disposeFramebuffer(list[i], contextLost); + } + }; + /** + * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. + * Used by MaskSystem, when its time to use stencil mask for Graphics element. + * + * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind. + * + * @private + */ + FramebufferSystem.prototype.forceStencil = function () { + var framebuffer = this.current; + if (!framebuffer) { + return; + } + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + if (!fbo || fbo.stencil) { + return; + } + framebuffer.enableStencil(); + var w = framebuffer.width; + var h = framebuffer.height; + var gl = this.gl; + var stencil = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); + fbo.stencil = stencil; + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); + }; + /** + * resets framebuffer stored state, binds screen framebuffer + * + * should be called before renderTexture reset() + */ + FramebufferSystem.prototype.reset = function () { + this.current = this.unknownFramebuffer; + this.viewport = new Rectangle(); + }; + return FramebufferSystem; + }(System)); + + var GLBuffer = /** @class */ (function () { + function GLBuffer(buffer) { + this.buffer = buffer || null; + this.updateID = -1; + this.byteLength = -1; + this.refCount = 0; + } + return GLBuffer; + }()); + + var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; + /** + * System plugin to the renderer to manage geometry. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var GeometrySystem = /** @class */ (function (_super) { + __extends$2(GeometrySystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function GeometrySystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this._activeGeometry = null; + _this._activeVao = null; + /** + * `true` if we has `*_vertex_array_object` extension + * @member {boolean} + * @readonly + */ + _this.hasVao = true; + /** + * `true` if has `ANGLE_instanced_arrays` extension + * @member {boolean} + * @readonly + */ + _this.hasInstance = true; + /** + * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced` + * @member {boolean} + * @readonly + */ + _this.canUseUInt32ElementIndex = false; + /** + * Cache for all geometries by id, used in case renderer gets destroyed or for profiling + * @member {object} + * @readonly + */ + _this.managedGeometries = {}; + /** + * Cache for all buffers by id, used in case renderer gets destroyed or for profiling + * @member {object} + * @readonly + */ + _this.managedBuffers = {}; + return _this; + } + /** + * Sets up the renderer context and necessary buffers. + */ + GeometrySystem.prototype.contextChange = function () { + this.disposeAll(true); + var gl = this.gl = this.renderer.gl; + var context = this.renderer.context; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + // webgl2 + if (context.webGLVersion !== 2) { + // webgl 1! + var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; + if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { + nativeVaoExtension_1 = null; + } + if (nativeVaoExtension_1) { + gl.createVertexArray = function () { + return nativeVaoExtension_1.createVertexArrayOES(); + }; + gl.bindVertexArray = function (vao) { + return nativeVaoExtension_1.bindVertexArrayOES(vao); + }; + gl.deleteVertexArray = function (vao) { + return nativeVaoExtension_1.deleteVertexArrayOES(vao); + }; + } + else { + this.hasVao = false; + gl.createVertexArray = function () { + return null; + }; + gl.bindVertexArray = function () { + return null; + }; + gl.deleteVertexArray = function () { + return null; + }; + } + } + if (context.webGLVersion !== 2) { + var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); + if (instanceExt_1) { + gl.vertexAttribDivisor = function (a, b) { + return instanceExt_1.vertexAttribDivisorANGLE(a, b); + }; + gl.drawElementsInstanced = function (a, b, c, d, e) { + return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); + }; + gl.drawArraysInstanced = function (a, b, c, d) { + return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); + }; + } + else { + this.hasInstance = false; + } + } + this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; + }; + /** + * Binds geometry so that is can be drawn. Creating a Vao if required + * + * @param {PIXI.Geometry} geometry - instance of geometry to bind + * @param {PIXI.Shader} [shader] - instance of shader to use vao for + */ + GeometrySystem.prototype.bind = function (geometry, shader) { + shader = shader || this.renderer.shader.shader; + var gl = this.gl; + // not sure the best way to address this.. + // currently different shaders require different VAOs for the same geometry + // Still mulling over the best way to solve this one.. + // will likely need to modify the shader attribute locations at run time! + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var incRefCount = false; + if (!vaos) { + this.managedGeometries[geometry.id] = geometry; + geometry.disposeRunner.add(this); + geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; + incRefCount = true; + } + var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program, incRefCount); + this._activeGeometry = geometry; + if (this._activeVao !== vao) { + this._activeVao = vao; + if (this.hasVao) { + gl.bindVertexArray(vao); + } + else { + this.activateVao(geometry, shader.program); + } + } + // TODO - optimise later! + // don't need to loop through if nothing changed! + // maybe look to add an 'autoupdate' to geometry? + this.updateBuffers(); + }; + /** + * Reset and unbind any active VAO and geometry + */ + GeometrySystem.prototype.reset = function () { + this.unbind(); + }; + /** + * Update buffers + * @protected + */ + GeometrySystem.prototype.updateBuffers = function () { + var geometry = this._activeGeometry; + var gl = this.gl; + for (var i = 0; i < geometry.buffers.length; i++) { + var buffer = geometry.buffers[i]; + var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; + if (buffer._updateID !== glBuffer.updateID) { + glBuffer.updateID = buffer._updateID; + // TODO can cache this on buffer! maybe added a getter / setter? + var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER; + // TODO this could change if the VAO changes... + // need to come up with a better way to cache.. + // if (this.boundBuffers[type] !== glBuffer) + // { + // this.boundBuffers[type] = glBuffer; + gl.bindBuffer(type, glBuffer.buffer); + // } + this._boundBuffer = glBuffer; + if (glBuffer.byteLength >= buffer.data.byteLength) { + // offset is always zero for now! + gl.bufferSubData(type, 0, buffer.data); + } + else { + var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; + glBuffer.byteLength = buffer.data.byteLength; + gl.bufferData(type, buffer.data, drawType); + } + } + } + }; + /** + * Check compability between a geometry and a program + * @protected + * @param {PIXI.Geometry} geometry - Geometry instance + * @param {PIXI.Program} program - Program instance + */ + GeometrySystem.prototype.checkCompatibility = function (geometry, program) { + // geometry must have at least all the attributes that the shader requires. + var geometryAttributes = geometry.attributes; + var shaderAttributes = program.attributeData; + for (var j in shaderAttributes) { + if (!geometryAttributes[j]) { + throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); + } + } + }; + /** + * Takes a geometry and program and generates a unique signature for them. + * + * @param {PIXI.Geometry} geometry - to get signature from + * @param {PIXI.Program} program - to test geometry against + * @returns {String} Unique signature of the geometry and program + * @protected + */ + GeometrySystem.prototype.getSignature = function (geometry, program) { + var attribs = geometry.attributes; + var shaderAttributes = program.attributeData; + var strings = ['g', geometry.id]; + for (var i in attribs) { + if (shaderAttributes[i]) { + strings.push(i); + } + } + return strings.join('-'); + }; + /** + * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. + * If vao is created, it is bound automatically. + * + * @protected + * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for + * @param {PIXI.Program} program - Instance of program + * @param {boolean} [incRefCount=false] - Increment refCount of all geometry buffers + */ + GeometrySystem.prototype.initGeometryVao = function (geometry, program, incRefCount) { + if (incRefCount === void 0) { incRefCount = true; } + this.checkCompatibility(geometry, program); + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var signature = this.getSignature(geometry, program); + var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var vao = vaoObjectHash[signature]; + if (vao) { + // this will give us easy access to the vao + vaoObjectHash[program.id] = vao; + return vao; + } + var buffers = geometry.buffers; + var attributes = geometry.attributes; + var tempStride = {}; + var tempStart = {}; + for (var j in buffers) { + tempStride[j] = 0; + tempStart[j] = 0; + } + for (var j in attributes) { + if (!attributes[j].size && program.attributeData[j]) { + attributes[j].size = program.attributeData[j].size; + } + else if (!attributes[j].size) { + console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line + } + tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap$1[attributes[j].type]; + } + for (var j in attributes) { + var attribute = attributes[j]; + var attribSize = attribute.size; + if (attribute.stride === undefined) { + if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) { + attribute.stride = 0; + } + else { + attribute.stride = tempStride[attribute.buffer]; + } + } + if (attribute.start === undefined) { + attribute.start = tempStart[attribute.buffer]; + tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type]; + } + } + vao = gl.createVertexArray(); + gl.bindVertexArray(vao); + // first update - and create the buffers! + // only create a gl buffer if it actually gets + for (var i = 0; i < buffers.length; i++) { + var buffer = buffers[i]; + if (!buffer._glBuffers[CONTEXT_UID]) { + buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); + this.managedBuffers[buffer.id] = buffer; + buffer.disposeRunner.add(this); + } + if (incRefCount) { + buffer._glBuffers[CONTEXT_UID].refCount++; + } + } + // TODO - maybe make this a data object? + // lets wait to see if we need to first! + this.activateVao(geometry, program); + this._activeVao = vao; + // add it to the cache! + vaoObjectHash[program.id] = vao; + vaoObjectHash[signature] = vao; + return vao; + }; + /** + * Disposes buffer + * @param {PIXI.Buffer} buffer - buffer with data + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + GeometrySystem.prototype.disposeBuffer = function (buffer, contextLost) { + if (!this.managedBuffers[buffer.id]) { + return; + } + delete this.managedBuffers[buffer.id]; + var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; + var gl = this.gl; + buffer.disposeRunner.remove(this); + if (!glBuffer) { + return; + } + if (!contextLost) { + gl.deleteBuffer(glBuffer.buffer); + } + delete buffer._glBuffers[this.CONTEXT_UID]; + }; + /** + * Disposes geometry + * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray + */ + GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { + if (!this.managedGeometries[geometry.id]) { + return; + } + delete this.managedGeometries[geometry.id]; + var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; + var gl = this.gl; + var buffers = geometry.buffers; + geometry.disposeRunner.remove(this); + if (!vaos) { + return; + } + for (var i = 0; i < buffers.length; i++) { + var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; + buf.refCount--; + if (buf.refCount === 0 && !contextLost) { + this.disposeBuffer(buffers[i], contextLost); + } + } + if (!contextLost) { + for (var vaoId in vaos) { + // delete only signatures, everything else are copies + if (vaoId[0] === 'g') { + var vao = vaos[vaoId]; + if (this._activeVao === vao) { + this.unbind(); + } + gl.deleteVertexArray(vao); + } + } + } + delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; + }; + /** + * dispose all WebGL resources of all managed geometries and buffers + * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls + */ + GeometrySystem.prototype.disposeAll = function (contextLost) { + var all = Object.keys(this.managedGeometries); + for (var i = 0; i < all.length; i++) { + this.disposeGeometry(this.managedGeometries[all[i]], contextLost); + } + all = Object.keys(this.managedBuffers); + for (var i = 0; i < all.length; i++) { + this.disposeBuffer(this.managedBuffers[all[i]], contextLost); + } + }; + /** + * Activate vertex array object + * + * @protected + * @param {PIXI.Geometry} geometry - Geometry instance + * @param {PIXI.Program} program - Shader program instance + */ + GeometrySystem.prototype.activateVao = function (geometry, program) { + var gl = this.gl; + var CONTEXT_UID = this.CONTEXT_UID; + var buffers = geometry.buffers; + var attributes = geometry.attributes; + if (geometry.indexBuffer) { + // first update the index buffer if we have one.. + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer); + } + var lastBuffer = null; + // add a new one! + for (var j in attributes) { + var attribute = attributes[j]; + var buffer = buffers[attribute.buffer]; + var glBuffer = buffer._glBuffers[CONTEXT_UID]; + if (program.attributeData[j]) { + if (lastBuffer !== glBuffer) { + gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer); + lastBuffer = glBuffer; + } + var location = program.attributeData[j].location; + // TODO introduce state again + // we can optimise this for older devices that have no VAOs + gl.enableVertexAttribArray(location); + gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); + if (attribute.instance) { + // TODO calculate instance count based of this... + if (this.hasInstance) { + gl.vertexAttribDivisor(location, 1); + } + else { + throw new Error('geometry error, GPU Instancing is not supported on this device'); + } + } + } + } + }; + /** + * Draw the geometry + * + * @param {Number} type - the type primitive to render + * @param {Number} [size] - the number of elements to be rendered + * @param {Number} [start] - Starting index + * @param {Number} [instanceCount] - the number of instances of the set of elements to execute + */ + GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { + var gl = this.gl; + var geometry = this._activeGeometry; + // TODO.. this should not change so maybe cache the function? + if (geometry.indexBuffer) { + var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; + var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; + if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { + if (geometry.instanced) { + /* eslint-disable max-len */ + gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); + /* eslint-enable max-len */ + } + else { + /* eslint-disable max-len */ + gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); + /* eslint-enable max-len */ + } + } + else { + console.warn('unsupported index buffer type: uint32'); + } + } + else if (geometry.instanced) { + // TODO need a better way to calculate size.. + gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); + } + else { + gl.drawArrays(type, start, size || geometry.getSize()); + } + return this; + }; + /** + * Unbind/reset everything + * @protected + */ + GeometrySystem.prototype.unbind = function () { + this.gl.bindVertexArray(null); + this._activeVao = null; + this._activeGeometry = null; + }; + return GeometrySystem; + }(System)); + + /** + * Component for masked elements + * + * Holds mask mode and temporary data about current mask + * + * @class + * @memberof PIXI + */ + var MaskData = /** @class */ (function () { + /** + * Create MaskData + * + * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask + */ + function MaskData(maskObject) { + if (maskObject === void 0) { maskObject = null; } + /** + * Mask type + * @member {PIXI.MASK_TYPES} + */ + this.type = exports.MASK_TYPES.NONE; + /** + * Whether we know the mask type beforehand + * @member {boolean} + * @default true + */ + this.autoDetect = true; + /** + * Which element we use to mask + * @member {PIXI.DisplayObject} + */ + this.maskObject = maskObject || null; + /** + * Whether it belongs to MaskSystem pool + * @member {boolean} + */ + this.pooled = false; + /** + * Indicator of the type + * @member {boolean} + */ + this.isMaskData = true; + /** + * Stencil counter above the mask in stack + * @member {number} + * @private + */ + this._stencilCounter = 0; + /** + * Scissor counter above the mask in stack + * @member {number} + * @private + */ + this._scissorCounter = 0; + /** + * Scissor operation above the mask in stack. + * Null if _scissorCounter is zero, rectangle instance if positive. + * @member {PIXI.Rectangle} + */ + this._scissorRect = null; + /** + * Targeted element. Temporary variable set by MaskSystem + * @member {PIXI.DisplayObject} + * @private + */ + this._target = null; + } + /** + * resets the mask data after popMask() + */ + MaskData.prototype.reset = function () { + if (this.pooled) { + this.maskObject = null; + this.type = exports.MASK_TYPES.NONE; + this.autoDetect = true; + } + this._target = null; + }; + /** + * copies counters from maskData above, called from pushMask() + * @param {PIXI.MaskData|null} maskAbove + */ + MaskData.prototype.copyCountersOrReset = function (maskAbove) { + if (maskAbove) { + this._stencilCounter = maskAbove._stencilCounter; + this._scissorCounter = maskAbove._scissorCounter; + this._scissorRect = maskAbove._scissorRect; + } + else { + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + } + }; + return MaskData; + }()); + + /** + * @private + * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} + * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER + * @param src {string} The vertex shader source as an array of strings. + * @return {WebGLShader} the shader + */ + function compileShader(gl, type, src) { + var shader = gl.createShader(type); + gl.shaderSource(shader, src); + gl.compileShader(shader); + return shader; + } + /** + * @method compileProgram + * @private + * @memberof PIXI.glCore.shader + * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} + * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. + * @param fragmentSrc {string|string[]} The fragment shader source as an array of strings. + * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations + * @return {WebGLProgram} the shader program + */ + function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) { + var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc); + var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc); + var program = gl.createProgram(); + gl.attachShader(program, glVertShader); + gl.attachShader(program, glFragShader); + // optionally, set the attributes manually for the program rather than letting WebGL decide.. + if (attributeLocations) { + for (var i in attributeLocations) { + gl.bindAttribLocation(program, attributeLocations[i], i); + } + } + gl.linkProgram(program); + // if linking fails, then log and cleanup + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) { + console.warn(vertexSrc); + console.error(gl.getShaderInfoLog(glVertShader)); + } + if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) { + console.warn(fragmentSrc); + console.error(gl.getShaderInfoLog(glFragShader)); + } + console.error('Pixi.js Error: Could not initialize shader.'); + console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS)); + console.error('gl.getError()', gl.getError()); + // if there is a program info log, log it + if (gl.getProgramInfoLog(program) !== '') { + console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); + } + gl.deleteProgram(program); + program = null; + } + // clean up some shaders + gl.deleteShader(glVertShader); + gl.deleteShader(glFragShader); + return program; + } + + function booleanArray(size) { + var array = new Array(size); + for (var i = 0; i < array.length; i++) { + array[i] = false; + } + return array; + } + /** + * @method defaultValue + * @memberof PIXI.glCore.shader + * @param type {String} Type of value + * @param size {Number} + * @private + */ + function defaultValue(type, size) { + switch (type) { + case 'float': + return 0; + case 'vec2': + return new Float32Array(2 * size); + case 'vec3': + return new Float32Array(3 * size); + case 'vec4': + return new Float32Array(4 * size); + case 'int': + case 'sampler2D': + case 'sampler2DArray': + return 0; + case 'ivec2': + return new Int32Array(2 * size); + case 'ivec3': + return new Int32Array(3 * size); + case 'ivec4': + return new Int32Array(4 * size); + case 'bool': + return false; + case 'bvec2': + return booleanArray(2 * size); + case 'bvec3': + return booleanArray(3 * size); + case 'bvec4': + return booleanArray(4 * size); + case 'mat2': + return new Float32Array([1, 0, + 0, 1]); + case 'mat3': + return new Float32Array([1, 0, 0, + 0, 1, 0, + 0, 0, 1]); + case 'mat4': + return new Float32Array([1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]); + } + return null; + } + + var unknownContext = {}; + var context = unknownContext; + /** + * returns a little WebGL context to use for program inspection. + * + * @static + * @private + * @returns {WebGLRenderingContext} a gl context to test with + */ + function getTestContext() { + if (context === unknownContext || (context && context.isContextLost())) { + var canvas = document.createElement('canvas'); + var gl = void 0; + if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { + gl = canvas.getContext('webgl2', {}); + } + if (!gl) { + gl = canvas.getContext('webgl', {}) + || canvas.getContext('experimental-webgl', {}); + if (!gl) { + // fail, not able to get a context + gl = null; + } + else { + // for shader testing.. + gl.getExtension('WEBGL_draw_buffers'); + } + } + context = gl; + } + return context; + } + + var maxFragmentPrecision; + function getMaxFragmentPrecision() { + if (!maxFragmentPrecision) { + maxFragmentPrecision = exports.PRECISION.MEDIUM; + var gl = getTestContext(); + if (gl) { + if (gl.getShaderPrecisionFormat) { + var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); + maxFragmentPrecision = shaderFragment.precision ? exports.PRECISION.HIGH : exports.PRECISION.MEDIUM; + } + } + } + return maxFragmentPrecision; + } + + /** + * Sets the float precision on the shader, ensuring the device supports the request precision. + * If the precision is already present, it just ensures that the device is able to handle it. + * + * @private + * @param {string} src - The shader source + * @param {string} requestedPrecision - The request float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. + * @param {string} maxSupportedPrecision - The maximum precision the shader supports. + * + * @return {string} modified shader source + */ + function setPrecision(src, requestedPrecision, maxSupportedPrecision) { + if (src.substring(0, 9) !== 'precision') { + // no precision supplied, so PixiJS will add the requested level. + var precision = requestedPrecision; + // If highp is requested but not supported, downgrade precision to a level all devices support. + if (requestedPrecision === exports.PRECISION.HIGH && maxSupportedPrecision !== exports.PRECISION.HIGH) { + precision = exports.PRECISION.MEDIUM; + } + return "precision " + precision + " float;\n" + src; + } + else if (maxSupportedPrecision !== exports.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { + // precision was supplied, but at a level this device does not support, so downgrading to mediump. + return src.replace('precision highp', 'precision mediump'); + } + return src; + } + + var GLSL_TO_SIZE = { + float: 1, + vec2: 2, + vec3: 3, + vec4: 4, + int: 1, + ivec2: 2, + ivec3: 3, + ivec4: 4, + bool: 1, + bvec2: 2, + bvec3: 3, + bvec4: 4, + mat2: 4, + mat3: 9, + mat4: 16, + sampler2D: 1, + }; + /** + * @private + * @method mapSize + * @memberof PIXI.glCore.shader + * @param type {String} + * @return {Number} + */ + function mapSize(type) { + return GLSL_TO_SIZE[type]; + } + + var GL_TABLE = null; + var GL_TO_GLSL_TYPES = { + FLOAT: 'float', + FLOAT_VEC2: 'vec2', + FLOAT_VEC3: 'vec3', + FLOAT_VEC4: 'vec4', + INT: 'int', + INT_VEC2: 'ivec2', + INT_VEC3: 'ivec3', + INT_VEC4: 'ivec4', + BOOL: 'bool', + BOOL_VEC2: 'bvec2', + BOOL_VEC3: 'bvec3', + BOOL_VEC4: 'bvec4', + FLOAT_MAT2: 'mat2', + FLOAT_MAT3: 'mat3', + FLOAT_MAT4: 'mat4', + SAMPLER_2D: 'sampler2D', + INT_SAMPLER_2D: 'sampler2D', + UNSIGNED_INT_SAMPLER_2D: 'sampler2D', + SAMPLER_CUBE: 'samplerCube', + INT_SAMPLER_CUBE: 'samplerCube', + UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', + SAMPLER_2D_ARRAY: 'sampler2DArray', + INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + }; + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function mapType(gl, type) { + if (!GL_TABLE) { + var typeNames = Object.keys(GL_TO_GLSL_TYPES); + GL_TABLE = {}; + for (var i = 0; i < typeNames.length; ++i) { + var tn = typeNames[i]; + GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; + } + } + return GL_TABLE[type]; + } + + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + // Parsers, each one of these will take a look at the type of shader property and uniform. + // if they pass the test function then the code function is called that returns a the shader upload code for that uniform. + // Shader upload code is automagically generated with these parsers. + // If no parser is valid then the default upload functions are used. + // exposing Parsers means that custom upload logic can be added to pixi's shaders. + // A good example would be a pixi rectangle can be directly set on a uniform. + // If the shader sees it it knows how to upload the rectangle structure as a vec4 + // format is as follows: + // + // { + // test: (data, uniform) => {} <--- test is this code should be used for this uniform + // code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform + // } + var uniformParsers = [ + // a float cache layer + { + test: function (data) { + return data.type === 'float' && data.size === 1; + }, + code: function (name) { + return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; + }, + }, + // handling samplers + { + test: function (data) { + // eslint-disable-next-line max-len + return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray; + }, + code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, + }, + // uploading pixi matrix object to mat3 + { + test: function (data, uniform) { + return data.type === 'mat3' && data.size === 1 && uniform.a !== undefined; + }, + code: function (name) { + // TODO and some smart caching dirty ids here! + return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; + }, + }, + // uploading a pixi point as a vec2 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec2' && data.size === 1 && uniform.x !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; + }, + }, + // caching layer for a vec2 + { + test: function (data) { + return data.type === 'vec2' && data.size === 1; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; + }, + }, + // upload a pixi rectangle as a vec4 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec4' && data.size === 1 && uniform.width !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; + }, + }, + // a caching layer for vec4 uploading + { + test: function (data) { + return data.type === 'vec4' && data.size === 1; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; + }, + } ]; + + // cv = CachedValue + // v = value + // ud = uniformData + // uv = uniformValue + // l = location + var GLSL_TO_SINGLE_SETTERS_CACHED = { + float: "\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }", + vec2: "\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }", + vec3: "\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", + vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])', + int: 'gl.uniform1i(location, v)', + ivec2: 'gl.uniform2i(location, v[0], v[1])', + ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])', + ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', + bool: 'gl.uniform1i(location, v)', + bvec2: 'gl.uniform2i(location, v[0], v[1])', + bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])', + bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + sampler2D: 'gl.uniform1i(location, v)', + samplerCube: 'gl.uniform1i(location, v)', + sampler2DArray: 'gl.uniform1i(location, v)', + }; + var GLSL_TO_ARRAY_SETTERS = { + float: "gl.uniform1fv(location, v)", + vec2: "gl.uniform2fv(location, v)", + vec3: "gl.uniform3fv(location, v)", + vec4: 'gl.uniform4fv(location, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + int: 'gl.uniform1iv(location, v)', + ivec2: 'gl.uniform2iv(location, v)', + ivec3: 'gl.uniform3iv(location, v)', + ivec4: 'gl.uniform4iv(location, v)', + bool: 'gl.uniform1iv(location, v)', + bvec2: 'gl.uniform2iv(location, v)', + bvec3: 'gl.uniform3iv(location, v)', + bvec4: 'gl.uniform4iv(location, v)', + sampler2D: 'gl.uniform1iv(location, v)', + samplerCube: 'gl.uniform1iv(location, v)', + sampler2DArray: 'gl.uniform1iv(location, v)', + }; + function generateUniformsSync(group, uniformData) { + var funcFragments = ["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "]; + for (var i in group.uniforms) { + var data = uniformData[i]; + if (!data) { + if (group.uniforms[i].group) { + funcFragments.push("\n renderer.shader.syncUniformGroup(uv[\"" + i + "\"], syncData);\n "); + } + continue; + } + var uniform = group.uniforms[i]; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + if (uniformParsers[j].test(data, uniform)) { + funcFragments.push(uniformParsers[j].code(i, uniform)); + parsed = true; + break; + } + } + if (!parsed) { + var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; + var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); + funcFragments.push("\n cv = ud[\"" + i + "\"].value;\n v = uv[\"" + i + "\"];\n " + template + ";"); + } + } + /** + * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly + * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used + * no matter which group is being used + * + */ + // eslint-disable-next-line no-new-func + return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); + } + + var fragTemplate = [ + 'precision mediump float;', + 'void main(void){', + 'float test = 0.1;', + '%forloop%', + 'gl_FragColor = vec4(0.0);', + '}' ].join('\n'); + function generateIfTestSrc(maxIfs) { + var src = ''; + for (var i = 0; i < maxIfs; ++i) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxIfs - 1) { + src += "if(test == " + i + ".0){}"; + } + } + return src; + } + function checkMaxIfStatementsInShader(maxIfs, gl) { + if (maxIfs === 0) { + throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); + } + var shader = gl.createShader(gl.FRAGMENT_SHADER); + while (true) // eslint-disable-line no-constant-condition + { + var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); + gl.shaderSource(shader, fragmentSrc); + gl.compileShader(shader); + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + maxIfs = (maxIfs / 2) | 0; + } + else { + // valid! + break; + } + } + return maxIfs; + } + + // Cache the result to prevent running this over and over + var unsafeEval; + /** + * Not all platforms allow to generate function code (e.g., `new Function`). + * this provides the platform-level detection. + * + * @private + * @returns {boolean} + */ + function unsafeEvalSupported() { + if (typeof unsafeEval === 'boolean') { + return unsafeEval; + } + try { + /* eslint-disable no-new-func */ + var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); + /* eslint-enable no-new-func */ + unsafeEval = func({ a: 'b' }, 'a', 'b') === true; + } + catch (e) { + unsafeEval = false; + } + return unsafeEval; + } + + var defaultFragment = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"; + + var defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; + + var UID$3 = 0; + var nameCache = {}; + /** + * Helper class to create a shader program. + * + * @class + * @memberof PIXI + */ + var Program = /** @class */ (function () { + /** + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader + */ + function Program(vertexSrc, fragmentSrc, name) { + if (name === void 0) { name = 'pixi-shader'; } + this.id = UID$3++; + /** + * The vertex shader. + * + * @member {string} + */ + this.vertexSrc = vertexSrc || Program.defaultVertexSrc; + /** + * The fragment shader. + * + * @member {string} + */ + this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; + this.vertexSrc = this.vertexSrc.trim(); + this.fragmentSrc = this.fragmentSrc.trim(); + if (this.vertexSrc.substring(0, 8) !== '#version') { + name = name.replace(/\s+/g, '-'); + if (nameCache[name]) { + nameCache[name]++; + name += "-" + nameCache[name]; + } + else { + nameCache[name] = 1; + } + this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; + this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; + this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, exports.PRECISION.HIGH); + this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); + } + // currently this does not extract structs only default types + this.extractData(this.vertexSrc, this.fragmentSrc); + // this is where we store shader references.. + this.glPrograms = {}; + this.syncUniforms = null; + } + /** + * Extracts the data for a buy creating a small test program + * or reading the src directly. + * @protected + * + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + */ + Program.prototype.extractData = function (vertexSrc, fragmentSrc) { + var gl = getTestContext(); + if (gl) { + var program = compileProgram(gl, vertexSrc, fragmentSrc); + this.attributeData = this.getAttributeData(program, gl); + this.uniformData = this.getUniformData(program, gl); + gl.deleteProgram(program); + } + else { + this.uniformData = {}; + this.attributeData = {}; + } + }; + /** + * returns the attribute data from the program + * @private + * + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context + * + * @returns {object} the attribute data for this program + */ + Program.prototype.getAttributeData = function (program, gl) { + var attributes = {}; + var attributesArray = []; + var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); + for (var i = 0; i < totalAttributes; i++) { + var attribData = gl.getActiveAttrib(program, i); + var type = mapType(gl, attribData.type); + /*eslint-disable */ + var data = { + type: type, + name: attribData.name, + size: mapSize(type), + location: 0, + }; + /* eslint-enable */ + attributes[attribData.name] = data; + attributesArray.push(data); + } + attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow + for (var i = 0; i < attributesArray.length; i++) { + attributesArray[i].location = i; + } + return attributes; + }; + /** + * returns the uniform data from the program + * @private + * + * @param {webGL-program} [program] - the webgl program + * @param {context} [gl] - the WebGL context + * + * @returns {object} the uniform data for this program + */ + Program.prototype.getUniformData = function (program, gl) { + var uniforms = {}; + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + // TODO expose this as a prop? + // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); + // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); + for (var i = 0; i < totalUniforms; i++) { + var uniformData = gl.getActiveUniform(program, i); + var name = uniformData.name.replace(/\[.*?\]$/, ''); + var isArray = uniformData.name.match(/\[.*?\]$/); + var type = mapType(gl, uniformData.type); + /*eslint-disable */ + uniforms[name] = { + type: type, + size: uniformData.size, + isArray: isArray, + value: defaultValue(type, uniformData.size), + }; + /* eslint-enable */ + } + return uniforms; + }; + Object.defineProperty(Program, "defaultVertexSrc", { + /** + * The default vertex shader source + * + * @static + * @constant + * @member {string} + */ + get: function () { + return defaultVertex; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Program, "defaultFragmentSrc", { + /** + * The default fragment shader source + * + * @static + * @constant + * @member {string} + */ + get: function () { + return defaultFragment; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a program based of a vertex and fragment shader + * this method will also check to see if there is a cached program. + * + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name=pixi-shader] - Name for shader + * + * @returns {PIXI.Program} an shiny new Pixi shader! + */ + Program.from = function (vertexSrc, fragmentSrc, name) { + var key = vertexSrc + fragmentSrc; + var program = ProgramCache[key]; + if (!program) { + ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); + } + return program; + }; + return Program; + }()); + + /** + * A helper class for shaders + * + * @class + * @memberof PIXI + */ + var Shader = /** @class */ (function () { + /** + * @param {PIXI.Program} [program] - The program the shader will use. + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + */ + function Shader(program, uniforms) { + /** + * Program that the shader uses + * + * @member {PIXI.Program} + */ + this.program = program; + // lets see whats been passed in + // uniforms should be converted to a uniform group + if (uniforms) { + if (uniforms instanceof UniformGroup) { + this.uniformGroup = uniforms; + } + else { + this.uniformGroup = new UniformGroup(uniforms); + } + } + else { + this.uniformGroup = new UniformGroup({}); + } + // time to build some getters and setters! + // I guess down the line this could sort of generate an instruction list rather than use dirty ids? + // does the trick for now though! + for (var i in program.uniformData) { + if (this.uniformGroup.uniforms[i] instanceof Array) { + this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]); + } + } + } + // TODO move to shader system.. + Shader.prototype.checkUniformExists = function (name, group) { + if (group.uniforms[name]) { + return true; + } + for (var i in group.uniforms) { + var uniform = group.uniforms[i]; + if (uniform.group) { + if (this.checkUniformExists(name, uniform)) { + return true; + } + } + } + return false; + }; + Shader.prototype.destroy = function () { + // usage count on programs? + // remove if not used! + this.uniformGroup = null; + }; + Object.defineProperty(Shader.prototype, "uniforms", { + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ + get: function () { + return this.uniformGroup.uniforms; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a shader based of a vertex and fragment shader + * + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * + * @returns {PIXI.Shader} an shiny new Pixi shader! + */ + Shader.from = function (vertexSrc, fragmentSrc, uniforms) { + var program = Program.from(vertexSrc, fragmentSrc); + return new Shader(program, uniforms); + }; + return Shader; + }()); + + /* eslint-disable max-len */ + var BLEND = 0; + var OFFSET = 1; + var CULLING = 2; + var DEPTH_TEST = 3; + var WINDING = 4; + /** + * This is a WebGL state, and is is passed The WebGL StateManager. + * + * Each mesh rendered may require WebGL to be in a different state. + * For example you may want different blend mode or to enable polygon offsets + * + * @class + * @memberof PIXI + */ + var State = /** @class */ (function () { + function State() { + this.data = 0; + this.blendMode = exports.BLEND_MODES.NORMAL; + this.polygonOffset = 0; + this.blend = true; + // this.depthTest = true; + } + Object.defineProperty(State.prototype, "blend", { + /** + * Activates blending of the computed fragment color values + * + * @member {boolean} + */ + get: function () { + return !!(this.data & (1 << BLEND)); + }, + set: function (value) { + if (!!(this.data & (1 << BLEND)) !== value) { + this.data ^= (1 << BLEND); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "offsets", { + /** + * Activates adding an offset to depth values of polygon's fragments + * + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << OFFSET)); + }, + set: function (value) { + if (!!(this.data & (1 << OFFSET)) !== value) { + this.data ^= (1 << OFFSET); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "culling", { + /** + * Activates culling of polygons. + * + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << CULLING)); + }, + set: function (value) { + if (!!(this.data & (1 << CULLING)) !== value) { + this.data ^= (1 << CULLING); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthTest", { + /** + * Activates depth comparisons and updates to the depth buffer. + * + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << DEPTH_TEST)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_TEST)) !== value) { + this.data ^= (1 << DEPTH_TEST); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "clockwiseFrontFace", { + /** + * Specifies whether or not front or back-facing polygons can be culled. + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << WINDING)); + }, + set: function (value) { + if (!!(this.data & (1 << WINDING)) !== value) { + this.data ^= (1 << WINDING); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "blendMode", { + /** + * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * Setting this mode to anything other than NO_BLEND will automatically switch blending on. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + get: function () { + return this._blendMode; + }, + set: function (value) { + this.blend = (value !== exports.BLEND_MODES.NONE); + this._blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "polygonOffset", { + /** + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. + * + * @member {number} + * @default 0 + */ + get: function () { + return this._polygonOffset; + }, + set: function (value) { + this.offsets = !!value; + this._polygonOffset = value; + }, + enumerable: false, + configurable: true + }); + State.for2d = function () { + var state = new State(); + state.depthTest = false; + state.blend = true; + return state; + }; + return State; + }()); + + var defaultVertex$1 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + + var defaultFragment$1 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"; + + /** + * Filter is a special type of WebGL shader that is applied to the screen. + * + * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the + * {@link PIXI.filters.BlurFilter BlurFilter}. + * + * ### Usage + * Filters can be applied to any DisplayObject or Container. + * PixiJS' `FilterSystem` renders the container into temporary Framebuffer, + * then filter renders it to the screen. + * Multiple filters can be added to the `filters` array property and stacked on each other. + * + * ``` + * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 }); + * const container = new PIXI.Container(); + * container.filters = [filter]; + * ``` + * + * ### Previous Version Differences + * + * In PixiJS **v3**, a filter was always applied to _whole screen_. + * + * In PixiJS **v4**, a filter can be applied _only part of the screen_. + * Developers had to create a set of uniforms to deal with coordinates. + * + * In PixiJS **v5** combines _both approaches_. + * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers, + * bringing those extra uniforms into account. + * + * Also be aware that we have changed default vertex shader, please consult + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * ### Built-in Uniforms + * + * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`, + * and `projectionMatrix` uniform maps it to the gl viewport. + * + * **uSampler** + * + * The most important uniform is the input texture that container was rendered into. + * _Important note: as with all Framebuffers in PixiJS, both input and output are + * premultiplied by alpha._ + * + * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`. + * Use it to sample the input. + * + * ``` + * const fragment = ` + * varying vec2 vTextureCoord; + * uniform sampler2D uSampler; + * void main(void) + * { + * gl_FragColor = texture2D(uSampler, vTextureCoord); + * } + * `; + * + * const myFilter = new PIXI.Filter(null, fragment); + * ``` + * + * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}. + * + * **outputFrame** + * + * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates. + * It's the same as `renderer.screen` for a fullscreen filter. + * Only a part of `outputFrame.zw` size of temporary Framebuffer is used, + * `(0, 0, outputFrame.width, outputFrame.height)`, + * + * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute. + * To calculate vertex position in screen space using normalized (0-1) space: + * + * ``` + * vec4 filterVertexPosition( void ) + * { + * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + * } + * ``` + * + * **inputSize** + * + * Temporary framebuffer is different, it can be either the size of screen, either power-of-two. + * The `inputSize.xy` are size of temporary framebuffer that holds input. + * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader. + * + * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter. + * + * To calculate input normalized coordinate, you have to map it to filter normalized space. + * Multiply by `outputFrame.zw` to get input coordinate. + * Divide by `inputSize.xy` to get input normalized coordinate. + * + * ``` + * vec2 filterTextureCoord( void ) + * { + * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy + * } + * ``` + * **resolution** + * + * The `resolution` is the ratio of screen (CSS) pixels to real pixels. + * + * **inputPixel** + * + * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution` + * `inputPixel.zw` is inverted `inputPixel.xy`. + * + * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}. + * + * **inputClamp** + * + * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour. + * For displacements, coordinates has to be clamped. + * + * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer + * `inputClamp.zw` is bottom-right pixel center. + * + * ``` + * vec4 color = texture2D(uSampler, clamp(modifigedTextureCoord, inputClamp.xy, inputClamp.zw)) + * ``` + * OR + * ``` + * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw)) + * ``` + * + * ### Additional Information + * + * Complete documentation on Filter usage is located in the + * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}. + * + * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded + * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository. + * + * @class + * @memberof PIXI + * @extends PIXI.Shader + */ + var Filter = /** @class */ (function (_super) { + __extends$2(Filter, _super); + /** + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + */ + function Filter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); + _this = _super.call(this, program, uniforms) || this; + /** + * The padding of the filter. Some filters require extra space to breath such as a blur. + * Increasing this will add extra width and height to the bounds of the object that the + * filter is applied to. + * + * @member {number} + */ + _this.padding = 0; + /** + * The resolution of the filter. Setting this to be lower will lower the quality but + * increase the performance of the filter. + * + * @member {number} + */ + _this.resolution = settings.FILTER_RESOLUTION; + /** + * If enabled is true the filter is applied, if false it will not. + * + * @member {boolean} + */ + _this.enabled = true; + /** + * If enabled, PixiJS will fit the filter area into boundaries for better performance. + * Switch it off if it does not work for specific shader. + * + * @member {boolean} + */ + _this.autoFit = true; + /** + * Legacy filters use position and uvs from attributes + * @member {boolean} + * @readonly + */ + _this.legacy = !!_this.program.attributeData.aTextureCoord; + /** + * The WebGL state the filter requires to render + * @member {PIXI.State} + */ + _this.state = new State(); + return _this; + } + /** + * Applies the filter + * + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. + * @param {object} [currentState] - It's current state of filter. + * There are some useful properties in the currentState : + * target, filters, sourceFrame, destinationFrame, renderTarget, resolution + */ + Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { + // do as you please! + filterManager.applyFilter(this, input, output, clearMode); + // or just do a regular render.. + }; + Object.defineProperty(Filter.prototype, "blendMode", { + /** + * Sets the blendmode of the filter + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.state.blendMode; + }, + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultVertexSrc", { + /** + * The default vertex shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultVertex$1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultFragmentSrc", { + /** + * The default fragment shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultFragment$1; + }, + enumerable: false, + configurable: true + }); + return Filter; + }(Shader)); + + var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; + + var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; + + var tempMat = new Matrix(); + /** + * Class controls uv mapping from Texture normal space to BaseTexture normal space. + * + * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite. + * + * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture. + * If you want to add support for texture region of certain feature or filter, that's what you're looking for. + * + * Takes track of Texture changes through `_lastTextureID` private field. + * Use `update()` method call to track it from outside. + * + * @see PIXI.Texture + * @see PIXI.Mesh + * @see PIXI.TilingSprite + * @class + * @memberof PIXI + */ + var TextureMatrix = /** @class */ (function () { + /** + * + * @param {PIXI.Texture} texture - observed texture + * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + * @constructor + */ + function TextureMatrix(texture, clampMargin) { + this._texture = texture; + /** + * Matrix operation that converts texture region coords to texture coords + * @member {PIXI.Matrix} + * @readonly + */ + this.mapCoord = new Matrix(); + /** + * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. + * Calculated based on clampOffset. + * @member {Float32Array} + * @readonly + */ + this.uClampFrame = new Float32Array(4); + /** + * Normalized clamp offset. + * Calculated based on clampOffset. + * @member {Float32Array} + * @readonly + */ + this.uClampOffset = new Float32Array(2); + /** + * Tracks Texture frame changes + * @member {number} + * @protected + */ + this._textureID = -1; + /** + * Tracks Texture frame changes + * @member {number} + * @protected + */ + this._updateID = 0; + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders + * + * @default 0 + * @member {number} + */ + this.clampOffset = 0; + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * + * @default 0.5 + * @member {number} + */ + this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; + /** + * If texture size is the same as baseTexture + * @member {boolean} + * @default false + * @readonly + */ + this.isSimple = false; + } + Object.defineProperty(TextureMatrix.prototype, "texture", { + /** + * texture property + * @member {PIXI.Texture} + */ + get: function () { + return this._texture; + }, + set: function (value) { + this._texture = value; + this._textureID = -1; + }, + enumerable: false, + configurable: true + }); + /** + * Multiplies uvs array to transform + * @param {Float32Array} uvs - mesh uvs + * @param {Float32Array} [out=uvs] output + * @returns {Float32Array} output + */ + TextureMatrix.prototype.multiplyUvs = function (uvs, out) { + if (out === undefined) { + out = uvs; + } + var mat = this.mapCoord; + for (var i = 0; i < uvs.length; i += 2) { + var x = uvs[i]; + var y = uvs[i + 1]; + out[i] = (x * mat.a) + (y * mat.c) + mat.tx; + out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; + } + return out; + }; + /** + * updates matrices if texture was changed + * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case + * @returns {boolean} whether or not it was updated + */ + TextureMatrix.prototype.update = function (forceUpdate) { + var tex = this._texture; + if (!tex || !tex.valid) { + return false; + } + if (!forceUpdate + && this._textureID === tex._updateID) { + return false; + } + this._textureID = tex._updateID; + this._updateID++; + var uvs = tex._uvs; + this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); + var orig = tex.orig; + var trim = tex.trim; + if (trim) { + tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); + this.mapCoord.append(tempMat); + } + var texBase = tex.baseTexture; + var frame = this.uClampFrame; + var margin = this.clampMargin / texBase.resolution; + var offset = this.clampOffset; + frame[0] = (tex._frame.x + margin + offset) / texBase.width; + frame[1] = (tex._frame.y + margin + offset) / texBase.height; + frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; + frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; + this.uClampOffset[0] = offset / texBase.realWidth; + this.uClampOffset[1] = offset / texBase.realHeight; + this.isSimple = tex._frame.width === texBase.width + && tex._frame.height === texBase.height + && tex.rotate === 0; + return true; + }; + return TextureMatrix; + }()); + + /** + * This handles a Sprite acting as a mask, as opposed to a Graphic. + * + * WebGL only. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI + */ + var SpriteMaskFilter = /** @class */ (function (_super) { + __extends$2(SpriteMaskFilter, _super); + /** + * @param {PIXI.Sprite} sprite - the target sprite + */ + function SpriteMaskFilter(sprite) { + var _this = this; + var maskMatrix = new Matrix(); + _this = _super.call(this, vertex, fragment) || this; + sprite.renderable = false; + /** + * Sprite mask + * @member {PIXI.Sprite} + */ + _this.maskSprite = sprite; + /** + * Mask matrix + * @member {PIXI.Matrix} + */ + _this.maskMatrix = maskMatrix; + return _this; + } + /** + * Applies the filter + * + * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from + * @param {PIXI.RenderTexture} input - The input render target. + * @param {PIXI.RenderTexture} output - The target to output to. + * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. + */ + SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { + var maskSprite = this.maskSprite; + var tex = maskSprite._texture; + if (!tex.valid) { + return; + } + if (!tex.uvMatrix) { + // margin = 0.0, let it bleed a bit, shader code becomes easier + // assuming that atlas textures were made with 1-pixel padding + tex.uvMatrix = new TextureMatrix(tex, 0.0); + } + tex.uvMatrix.update(); + this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; + this.uniforms.mask = tex; + // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` + this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) + .prepend(tex.uvMatrix.mapCoord); + this.uniforms.alpha = maskSprite.worldAlpha; + this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; + filterManager.applyFilter(this, input, output, clearMode); + }; + return SpriteMaskFilter; + }(Filter)); + + /** + * System plugin to the renderer to manage masks. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var MaskSystem = /** @class */ (function (_super) { + __extends$2(MaskSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function MaskSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * Enable scissor + * @member {boolean} + * @readonly + */ + _this.enableScissor = false; + /** + * Pool of used sprite mask filters + * @member {PIXI.SpriteMaskFilter[]} + * @readonly + */ + _this.alphaMaskPool = []; + /** + * Pool of mask data + * @member {PIXI.MaskData[]} + * @readonly + */ + _this.maskDataPool = []; + _this.maskStack = []; + /** + * Current index of alpha mask pool + * @member {number} + * @default 0 + * @readonly + */ + _this.alphaMaskIndex = 0; + return _this; + } + /** + * Changes the mask stack that is used by this System. + * + * @param {PIXI.MaskData[]} maskStack - The mask stack + */ + MaskSystem.prototype.setMaskStack = function (maskStack) { + this.maskStack = maskStack; + this.renderer.scissor.setMaskStack(maskStack); + this.renderer.stencil.setMaskStack(maskStack); + }; + /** + * Applies the Mask and adds it to the current filter stack. + * Renderer batch must be flushed beforehand. + * + * @param {PIXI.DisplayObject} target - Display Object to push the mask to + * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data. + */ + MaskSystem.prototype.push = function (target, maskDataOrTarget) { + var maskData = maskDataOrTarget; + if (!maskData.isMaskData) { + var d = this.maskDataPool.pop() || new MaskData(); + d.pooled = true; + d.maskObject = maskDataOrTarget; + maskData = d; + } + if (maskData.autoDetect) { + this.detect(maskData); + } + maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]); + maskData._target = target; + switch (maskData.type) { + case exports.MASK_TYPES.SCISSOR: + this.maskStack.push(maskData); + this.renderer.scissor.push(maskData); + break; + case exports.MASK_TYPES.STENCIL: + this.maskStack.push(maskData); + this.renderer.stencil.push(maskData); + break; + case exports.MASK_TYPES.SPRITE: + maskData.copyCountersOrReset(null); + this.pushSpriteMask(maskData); + this.maskStack.push(maskData); + break; + default: + break; + } + }; + /** + * Removes the last mask from the mask stack and doesn't return it. + * Renderer batch must be flushed beforehand. + * + * @param {PIXI.DisplayObject} target - Display Object to pop the mask from + */ + MaskSystem.prototype.pop = function (target) { + var maskData = this.maskStack.pop(); + if (!maskData || maskData._target !== target) { + // TODO: add an assert when we have it + return; + } + switch (maskData.type) { + case exports.MASK_TYPES.SCISSOR: + this.renderer.scissor.pop(); + break; + case exports.MASK_TYPES.STENCIL: + this.renderer.stencil.pop(maskData.maskObject); + break; + case exports.MASK_TYPES.SPRITE: + this.popSpriteMask(); + break; + default: + break; + } + maskData.reset(); + if (maskData.pooled) { + this.maskDataPool.push(maskData); + } + }; + /** + * Sets type of MaskData based on its maskObject + * @param {PIXI.MaskData} maskData + */ + MaskSystem.prototype.detect = function (maskData) { + var maskObject = maskData.maskObject; + if (maskObject.isSprite) { + maskData.type = exports.MASK_TYPES.SPRITE; + return; + } + maskData.type = exports.MASK_TYPES.STENCIL; + // detect scissor in graphics + if (this.enableScissor + && maskObject.isFastRect + && maskObject.isFastRect()) { + var matrix = maskObject.worldTransform; + // TODO: move the check to the matrix itself + // we are checking that its orthogonal and x rotation is 0 90 180 or 270 + var rotX = Math.atan2(matrix.b, matrix.a); + var rotXY = Math.atan2(matrix.d, matrix.c); + // use the nearest degree to 0.01 + rotX = Math.round(rotX * (180 / Math.PI) * 100); + rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX; + rotX = ((rotX % 9000) + 9000) % 9000; + rotXY = ((rotXY % 18000) + 18000) % 18000; + if (rotX === 0 && rotXY === 9000) { + maskData.type = exports.MASK_TYPES.SCISSOR; + } + } + }; + /** + * Applies the Mask and adds it to the current filter stack. + * + * @param {PIXI.MaskData} maskData - Sprite to be used as the mask + */ + MaskSystem.prototype.pushSpriteMask = function (maskData) { + var maskObject = maskData.maskObject; + var target = maskData._target; + var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; + if (!alphaMaskFilter) { + alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)]; + } + alphaMaskFilter[0].resolution = this.renderer.resolution; + alphaMaskFilter[0].maskSprite = maskObject; + var stashFilterArea = target.filterArea; + target.filterArea = maskObject.getBounds(true); + this.renderer.filter.push(target, alphaMaskFilter); + target.filterArea = stashFilterArea; + this.alphaMaskIndex++; + }; + /** + * Removes the last filter from the filter stack and doesn't return it. + */ + MaskSystem.prototype.popSpriteMask = function () { + this.renderer.filter.pop(); + this.alphaMaskIndex--; + }; + return MaskSystem; + }(System)); + + /** + * System plugin to the renderer to manage masks of certain type + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var AbstractMaskSystem = /** @class */ (function (_super) { + __extends$2(AbstractMaskSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function AbstractMaskSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * The mask stack + * @member {PIXI.MaskData[]} + */ + _this.maskStack = []; + /** + * Constant for gl.enable + * @member {number} + * @private + */ + _this.glConst = 0; + return _this; + } + /** + * gets count of masks of certain type + * @returns {number} + */ + AbstractMaskSystem.prototype.getStackLength = function () { + return this.maskStack.length; + }; + /** + * Changes the mask stack that is used by this System. + * + * @param {PIXI.MaskData[]} maskStack - The mask stack + */ + AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { + var gl = this.renderer.gl; + var curStackLen = this.getStackLength(); + this.maskStack = maskStack; + var newStackLen = this.getStackLength(); + if (newStackLen !== curStackLen) { + if (newStackLen === 0) { + gl.disable(this.glConst); + } + else { + gl.enable(this.glConst); + this._useCurrent(); + } + } + }; + /** + * Setup renderer to use the current mask data. + * @private + */ + AbstractMaskSystem.prototype._useCurrent = function () { + // OVERWRITE; + }; + /** + * Destroys the mask stack. + * + */ + AbstractMaskSystem.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.maskStack = null; + }; + return AbstractMaskSystem; + }(System)); + + /** + * System plugin to the renderer to manage scissor rects (used for masks). + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var ScissorSystem = /** @class */ (function (_super) { + __extends$2(ScissorSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ScissorSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = WebGLRenderingContext.SCISSOR_TEST; + return _this; + } + ScissorSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._scissorCounter; + } + return 0; + }; + /** + * Applies the Mask and adds it to the current stencil stack. @alvin + * + * @param {PIXI.MaskData} maskData - The mask data + */ + ScissorSystem.prototype.push = function (maskData) { + var maskObject = maskData.maskObject; + maskObject.renderable = true; + var prevData = maskData._scissorRect; + var bounds = maskObject.getBounds(true); + var gl = this.renderer.gl; + maskObject.renderable = false; + if (prevData) { + bounds.fit(prevData); + } + else { + gl.enable(gl.SCISSOR_TEST); + } + maskData._scissorCounter++; + maskData._scissorRect = bounds; + this._useCurrent(); + }; + /** + * Pops scissor mask. MaskData is already removed from stack + */ + ScissorSystem.prototype.pop = function () { + var gl = this.renderer.gl; + if (this.getStackLength() > 0) { + this._useCurrent(); + } + else { + gl.disable(gl.SCISSOR_TEST); + } + }; + /** + * Setup renderer to use the current scissor data. + * @private + */ + ScissorSystem.prototype._useCurrent = function () { + var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; + var rt = this.renderer.renderTexture.current; + var _a = this.renderer.projection, transform = _a.transform, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var resolution = rt ? rt.resolution : this.renderer.resolution; + var x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x; + var y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y; + var width = rect.width * resolution; + var height = rect.height * resolution; + if (transform) { + x += transform.tx * resolution; + y += transform.ty * resolution; + } + if (!rt) { + // flipY. In future we'll have it over renderTextures as an option + y = this.renderer.height - height - y; + } + this.renderer.gl.scissor(x, y, width, height); + }; + return ScissorSystem; + }(AbstractMaskSystem)); + + /** + * System plugin to the renderer to manage stencils (used for masks). + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var StencilSystem = /** @class */ (function (_super) { + __extends$2(StencilSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function StencilSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = WebGLRenderingContext.STENCIL_TEST; + return _this; + } + StencilSystem.prototype.getStackLength = function () { + var maskData = this.maskStack[this.maskStack.length - 1]; + if (maskData) { + return maskData._stencilCounter; + } + return 0; + }; + /** + * Applies the Mask and adds it to the current stencil stack. + * + * @param {PIXI.MaskData} maskData - The mask data + */ + StencilSystem.prototype.push = function (maskData) { + var maskObject = maskData.maskObject; + var gl = this.renderer.gl; + var prevMaskCount = maskData._stencilCounter; + if (prevMaskCount === 0) { + // force use stencil texture in current framebuffer + this.renderer.framebuffer.forceStencil(); + gl.enable(gl.STENCIL_TEST); + } + maskData._stencilCounter++; + // Increment the reference stencil value where the new mask overlaps with the old ones. + gl.colorMask(false, false, false, false); + gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask()); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + this._useCurrent(); + }; + /** + * Pops stencil mask. MaskData is already removed from stack + * + * @param {PIXI.DisplayObject} maskObject - object of popped mask data + */ + StencilSystem.prototype.pop = function (maskObject) { + var gl = this.renderer.gl; + if (this.getStackLength() === 0) { + // the stack is empty! + gl.disable(gl.STENCIL_TEST); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.clearStencil(0); + } + else { + // Decrement the reference stencil value where the popped mask overlaps with the other ones + gl.colorMask(false, false, false, false); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); + maskObject.renderable = true; + maskObject.render(this.renderer); + this.renderer.batch.flush(); + maskObject.renderable = false; + this._useCurrent(); + } + }; + /** + * Setup renderer to use the current stencil data. + * @private + */ + StencilSystem.prototype._useCurrent = function () { + var gl = this.renderer.gl; + gl.colorMask(true, true, true, true); + gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask()); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + }; + /** + * Fill 1s equal to the number of acitve stencil masks. + * @private + * @return {number} The bitwise mask. + */ + StencilSystem.prototype._getBitwiseMask = function () { + return (1 << this.getStackLength()) - 1; + }; + return StencilSystem; + }(AbstractMaskSystem)); + + /** + * System plugin to the renderer to manage the projection matrix. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var ProjectionSystem = /** @class */ (function (_super) { + __extends$2(ProjectionSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ProjectionSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * Destination frame + * @member {PIXI.Rectangle} + * @readonly + */ + _this.destinationFrame = null; + /** + * Source frame + * @member {PIXI.Rectangle} + * @readonly + */ + _this.sourceFrame = null; + /** + * Default destination frame + * @member {PIXI.Rectangle} + * @readonly + */ + _this.defaultFrame = null; + /** + * Project matrix + * @member {PIXI.Matrix} + * @readonly + */ + _this.projectionMatrix = new Matrix(); + /** + * A transform that will be appended to the projection matrix + * if null, nothing will be applied + * @member {PIXI.Matrix} + */ + _this.transform = null; + return _this; + } + /** + * Updates the projection matrix based on a projection frame (which is a rectangle). + * + * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this. + * + * @param {PIXI.Rectangle} destinationFrame - The destination frame. + * @param {PIXI.Rectangle} sourceFrame - The source frame. + * @param {Number} resolution - Resolution + * @param {boolean} root - If is root + */ + ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { + this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; + this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; + // Calculate object-space to clip-space projection + this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); + if (this.transform) { + this.projectionMatrix.append(this.transform); + } + var renderer = this.renderer; + renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; + renderer.globalUniforms.update(); + // this will work for now + // but would be sweet to stick and even on the global uniforms.. + if (renderer.shader.shader) { + renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); + } + }; + /** + * Updates the projection matrix based on a projection frame (which is a rectangle) + * + * @param {PIXI.Rectangle} destinationFrame - The destination frame. + * @param {PIXI.Rectangle} sourceFrame - The source frame. + * @param {Number} resolution - Resolution + * @param {boolean} root - If is root + */ + ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { + var pm = this.projectionMatrix; + var sign = !root ? 1 : -1; + pm.identity(); + pm.a = (1 / sourceFrame.width * 2); + pm.d = sign * (1 / sourceFrame.height * 2); + pm.tx = -1 - (sourceFrame.x * pm.a); + pm.ty = -sign - (sourceFrame.y * pm.d); + }; + /** + * Sets the transform of the active render target to the given matrix + * + * @param {PIXI.Matrix} matrix - The transformation matrix + */ + ProjectionSystem.prototype.setTransform = function (_matrix) { + // this._activeRenderTarget.transform = matrix; + }; + return ProjectionSystem; + }(System)); + + // Temporary rectangle for assigned sourceFrame or destinationFrame + var tempRect = new Rectangle(); + // Temporary rectangle for renderTexture destinationFrame + var tempRect2 = new Rectangle(); + // Temporary rectangle for passing the framebuffer viewport + var viewportFrame = new Rectangle(); + /** + * System plugin to the renderer to manage render textures. + * + * Should be added after FramebufferSystem + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var RenderTextureSystem = /** @class */ (function (_super) { + __extends$2(RenderTextureSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function RenderTextureSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * The clear background color as rgba + * @member {number[]} + */ + _this.clearColor = renderer._backgroundColorRgba; + // TODO move this property somewhere else! + /** + * List of masks for the StencilSystem + * @member {PIXI.Graphics[]} + * @readonly + */ + _this.defaultMaskStack = []; + // empty render texture? + /** + * Render texture + * @member {PIXI.RenderTexture} + * @readonly + */ + _this.current = null; + /** + * Source frame + * @member {PIXI.Rectangle} + * @readonly + */ + _this.sourceFrame = new Rectangle(); + /** + * Destination frame + * @member {PIXI.Rectangle} + * @readonly + */ + _this.destinationFrame = new Rectangle(); + return _this; + } + /** + * Bind the current render texture + * + * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen + * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture + * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame + */ + RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { + if (renderTexture === void 0) { renderTexture = null; } + var renderer = this.renderer; + this.current = renderTexture; + var baseTexture; + var framebuffer; + var resolution; + if (renderTexture) { + baseTexture = renderTexture.baseTexture; + resolution = baseTexture.resolution; + if (!sourceFrame) { + tempRect.width = renderTexture.frame.width; + tempRect.height = renderTexture.frame.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + tempRect2.x = renderTexture.frame.x; + tempRect2.y = renderTexture.frame.y; + tempRect2.width = sourceFrame.width; + tempRect2.height = sourceFrame.height; + destinationFrame = tempRect2; + } + framebuffer = baseTexture.framebuffer; + } + else { + resolution = renderer.resolution; + if (!sourceFrame) { + tempRect.width = renderer.screen.width; + tempRect.height = renderer.screen.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + destinationFrame = tempRect; + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; + } + } + viewportFrame.x = destinationFrame.x * resolution; + viewportFrame.y = destinationFrame.y * resolution; + viewportFrame.width = destinationFrame.width * resolution; + viewportFrame.height = destinationFrame.height * resolution; + this.renderer.framebuffer.bind(framebuffer, viewportFrame); + this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); + if (renderTexture) { + this.renderer.mask.setMaskStack(baseTexture.maskStack); + } + else { + this.renderer.mask.setMaskStack(this.defaultMaskStack); + } + this.sourceFrame.copyFrom(sourceFrame); + this.destinationFrame.copyFrom(destinationFrame); + }; + /** + * Erases the render texture and fills the drawing area with a colour + * + * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. + * @return {PIXI.Renderer} Returns itself. + */ + RenderTextureSystem.prototype.clear = function (clearColor, mask) { + if (this.current) { + clearColor = clearColor || this.current.baseTexture.clearColor; + } + else { + clearColor = clearColor || this.clearColor; + } + this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); + }; + RenderTextureSystem.prototype.resize = function () { + // resize the root only! + this.bind(null); + }; + /** + * Resets renderTexture state + */ + RenderTextureSystem.prototype.reset = function () { + this.bind(null); + }; + return RenderTextureSystem; + }(System)); + + var IGLUniformData = /** @class */ (function () { + function IGLUniformData() { + } + return IGLUniformData; + }()); + /** + * Helper class to create a WebGL Program + * + * @class + * @memberof PIXI + */ + var GLProgram = /** @class */ (function () { + /** + * Makes a new Pixi program + * + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms + */ + function GLProgram(program, uniformData) { + /** + * The shader program + * + * @member {WebGLProgram} + */ + this.program = program; + /** + * holds the uniform data which contains uniform locations + * and current uniform values used for caching and preventing unneeded GPU commands + * @member {Object} + */ + this.uniformData = uniformData; + /** + * uniformGroups holds the various upload functions for the shader. Each uniform group + * and program have a unique upload function generated. + * @member {Object} + */ + this.uniformGroups = {}; + } + /** + * Destroys this program + */ + GLProgram.prototype.destroy = function () { + this.uniformData = null; + this.uniformGroups = null; + this.program = null; + }; + return GLProgram; + }()); + + var UID$4 = 0; + // defualt sync data so we don't create a new one each time! + var defaultSyncData = { textureCount: 0 }; + /** + * System plugin to the renderer to manage shaders. + * + * @class + * @memberof PIXI.systems + * @extends PIXI.System + */ + var ShaderSystem = /** @class */ (function (_super) { + __extends$2(ShaderSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ShaderSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.destroyed = false; + // Validation check that this environment support `new Function` + _this.systemCheck(); + /** + * The current WebGL rendering context + * + * @member {WebGLRenderingContext} + */ + _this.gl = null; + _this.shader = null; + _this.program = null; + /** + * Cache to holds the generated functions. Stored against UniformObjects unique signature + * @type {Object} + * @private + */ + _this.cache = {}; + _this.id = UID$4++; + return _this; + } + /** + * Overrideable function by `@pixi/unsafe-eval` to silence + * throwing an error if platform doesn't support unsafe-evals. + * + * @private + */ + ShaderSystem.prototype.systemCheck = function () { + if (!unsafeEvalSupported()) { + throw new Error('Current environment does not allow unsafe-eval, ' + + 'please use @pixi/unsafe-eval module to enable support.'); + } + }; + ShaderSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.reset(); + }; + /** + * Changes the current shader to the one given in parameter + * + * @param {PIXI.Shader} shader - the new shader + * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms. + * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. + */ + ShaderSystem.prototype.bind = function (shader, dontSync) { + shader.uniforms.globals = this.renderer.globalUniforms; + var program = shader.program; + var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader); + this.shader = shader; + // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. + if (this.program !== program) { + this.program = program; + this.gl.useProgram(glProgram.program); + } + if (!dontSync) { + defaultSyncData.textureCount = 0; + this.syncUniformGroup(shader.uniformGroup, defaultSyncData); + } + return glProgram; + }; + /** + * Uploads the uniforms values to the currently bound shader. + * + * @param {object} uniforms - the uniforms values that be applied to the current shader + */ + ShaderSystem.prototype.setUniforms = function (uniforms) { + var shader = this.shader.program; + var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; + shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); + }; + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + /** + * + * syncs uniforms on the group + * @param {*} group - the uniform group to sync + * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions + */ + ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { + var glProgram = this.getglProgram(); + if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id]) { + glProgram.uniformGroups[group.id] = group.dirtyId; + this.syncUniforms(group, glProgram, syncData); + } + }; + /** + * Overrideable by the @pixi/unsafe-eval package to use static + * syncUnforms instead. + * + * @private + */ + ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { + var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); + syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); + }; + /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ + ShaderSystem.prototype.createSyncGroups = function (group) { + var id = this.getSignature(group, this.shader.program.uniformData); + if (!this.cache[id]) { + this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); + } + group.syncUniforms[this.shader.program.id] = this.cache[id]; + return group.syncUniforms[this.shader.program.id]; + }; + /** + * Takes a uniform group and data and generates a unique signature for them. + * + * @param {PIXI.UniformGroup} group - the uniform group to get signature of + * @param {Object} uniformData - uniform information generated by the shader + * @returns {String} Unique signature of the uniform group + * @private + */ + ShaderSystem.prototype.getSignature = function (group, uniformData) { + var uniforms = group.uniforms; + var strings = []; + for (var i in uniforms) { + strings.push(i); + if (uniformData[i]) { + strings.push(uniformData[i].type); + } + } + return strings.join('-'); + }; + /** + * Returns the underlying GLShade rof the currently bound shader. + * This can be handy for when you to have a little more control over the setting of your uniforms. + * + * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context + */ + ShaderSystem.prototype.getglProgram = function () { + if (this.shader) { + return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; + } + return null; + }; + /** + * Generates a glProgram version of the Shader provided. + * + * @private + * @param {PIXI.Shader} shader - the shader that the glProgram will be based on. + * @return {PIXI.GLProgram} A shiny new glProgram! + */ + ShaderSystem.prototype.generateShader = function (shader) { + var gl = this.gl; + var program = shader.program; + var attribMap = {}; + for (var i in program.attributeData) { + attribMap[i] = program.attributeData[i].location; + } + var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap); + var uniformData = {}; + for (var i in program.uniformData) { + var data = program.uniformData[i]; + uniformData[i] = { + location: gl.getUniformLocation(shaderProgram, i), + value: defaultValue(data.type, data.size), + }; + } + var glProgram = new GLProgram(shaderProgram, uniformData); + program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; + return glProgram; + }; + /** + * Resets ShaderSystem state, does not affect WebGL state + */ + ShaderSystem.prototype.reset = function () { + this.program = null; + this.shader = null; + }; + /** + * Destroys this System and removes all its textures + */ + ShaderSystem.prototype.destroy = function () { + // TODO implement destroy method for ShaderSystem + this.destroyed = true; + }; + return ShaderSystem; + }(System)); + + /** + * Maps gl blend combinations to WebGL. + * + * @memberof PIXI + * @function mapWebGLBlendModesToPixi + * @private + * @param {WebGLRenderingContext} gl - The rendering context. + * @param {number[][]} [array=[]] - The array to output into. + * @return {number[][]} Mapped modes. + */ + function mapWebGLBlendModesToPixi(gl, array) { + if (array === void 0) { array = []; } + // TODO - premultiply alpha would be different. + // add a boolean for that! + array[exports.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.ADD] = [gl.ONE, gl.ONE]; + array[exports.BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.NONE] = [0, 0]; + // not-premultiplied blend modes + array[exports.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; + array[exports.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; + // composite operations + array[exports.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; + array[exports.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; + array[exports.BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE]; + array[exports.BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA]; + array[exports.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; + array[exports.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; + array[exports.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; + // SUBTRACT from flash + array[exports.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; + return array; + } + + var BLEND$1 = 0; + var OFFSET$1 = 1; + var CULLING$1 = 2; + var DEPTH_TEST$1 = 3; + var WINDING$1 = 4; + /** + * System plugin to the renderer to manage WebGL state machines. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var StateSystem = /** @class */ (function (_super) { + __extends$2(StateSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function StateSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * GL context + * @member {WebGLRenderingContext} + * @readonly + */ + _this.gl = null; + /** + * State ID + * @member {number} + * @readonly + */ + _this.stateId = 0; + /** + * Polygon offset + * @member {number} + * @readonly + */ + _this.polygonOffset = 0; + /** + * Blend mode + * @member {number} + * @default PIXI.BLEND_MODES.NONE + * @readonly + */ + _this.blendMode = exports.BLEND_MODES.NONE; + /** + * Whether current blend equation is different + * @member {boolean} + * @protected + */ + _this._blendEq = false; + /** + * Collection of calls + * @member {function[]} + * @readonly + */ + _this.map = []; + // map functions for when we set state.. + _this.map[BLEND$1] = _this.setBlend; + _this.map[OFFSET$1] = _this.setOffset; + _this.map[CULLING$1] = _this.setCullFace; + _this.map[DEPTH_TEST$1] = _this.setDepthTest; + _this.map[WINDING$1] = _this.setFrontFace; + /** + * Collection of check calls + * @member {function[]} + * @readonly + */ + _this.checks = []; + /** + * Default WebGL State + * @member {PIXI.State} + * @readonly + */ + _this.defaultState = new State(); + _this.defaultState.blend = true; + return _this; + } + StateSystem.prototype.contextChange = function (gl) { + this.gl = gl; + this.blendModes = mapWebGLBlendModesToPixi(gl); + this.set(this.defaultState); + this.reset(); + }; + /** + * Sets the current state + * + * @param {*} state - The state to set. + */ + StateSystem.prototype.set = function (state) { + state = state || this.defaultState; + // TODO maybe to an object check? ( this.state === state )? + if (this.stateId !== state.data) { + var diff = this.stateId ^ state.data; + var i = 0; + // order from least to most common + while (diff) { + if (diff & 1) { + // state change! + this.map[i].call(this, !!(state.data & (1 << i))); + } + diff = diff >> 1; + i++; + } + this.stateId = state.data; + } + // based on the above settings we check for specific modes.. + // for example if blend is active we check and set the blend modes + // or of polygon offset is active we check the poly depth. + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + }; + /** + * Sets the state, when previous state is unknown + * + * @param {*} state - The state to set + */ + StateSystem.prototype.forceState = function (state) { + state = state || this.defaultState; + for (var i = 0; i < this.map.length; i++) { + this.map[i].call(this, !!(state.data & (1 << i))); + } + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); + } + this.stateId = state.data; + }; + /** + * Enables or disabled blending. + * + * @param {boolean} value - Turn on or off webgl blending. + */ + StateSystem.prototype.setBlend = function (value) { + this.updateCheck(StateSystem.checkBlendMode, value); + this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); + }; + /** + * Enables or disable polygon offset fill + * + * @param {boolean} value - Turn on or off webgl polygon offset testing. + */ + StateSystem.prototype.setOffset = function (value) { + this.updateCheck(StateSystem.checkPolygonOffset, value); + this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); + }; + /** + * Sets whether to enable or disable depth test. + * + * @param {boolean} value - Turn on or off webgl depth testing. + */ + StateSystem.prototype.setDepthTest = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); + }; + /** + * Sets whether to enable or disable cull face. + * + * @param {boolean} value - Turn on or off webgl cull face. + */ + StateSystem.prototype.setCullFace = function (value) { + this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); + }; + /** + * Sets the gl front face. + * + * @param {boolean} value - true is clockwise and false is counter-clockwise + */ + StateSystem.prototype.setFrontFace = function (value) { + this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); + }; + /** + * Sets the blend mode. + * + * @param {number} value - The blend mode to set to. + */ + StateSystem.prototype.setBlendMode = function (value) { + if (value === this.blendMode) { + return; + } + this.blendMode = value; + var mode = this.blendModes[value]; + var gl = this.gl; + if (mode.length === 2) { + gl.blendFunc(mode[0], mode[1]); + } + else { + gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); + } + if (mode.length === 6) { + this._blendEq = true; + gl.blendEquationSeparate(mode[4], mode[5]); + } + else if (this._blendEq) { + this._blendEq = false; + gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); + } + }; + /** + * Sets the polygon offset. + * + * @param {number} value - the polygon offset + * @param {number} scale - the polygon offset scale + */ + StateSystem.prototype.setPolygonOffset = function (value, scale) { + this.gl.polygonOffset(value, scale); + }; + // used + /** + * Resets all the logic and disables the vaos + */ + StateSystem.prototype.reset = function () { + this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); + this.forceState(this.defaultState); + this._blendEq = true; + this.blendMode = -1; + this.setBlendMode(0); + }; + /** + * checks to see which updates should be checked based on which settings have been activated. + * For example, if blend is enabled then we should check the blend modes each time the state is changed + * or if polygon fill is activated then we need to check if the polygon offset changes. + * The idea is that we only check what we have too. + * + * @param {Function} func - the checking function to add or remove + * @param {boolean} value - should the check function be added or removed. + */ + StateSystem.prototype.updateCheck = function (func, value) { + var index = this.checks.indexOf(func); + if (value && index === -1) { + this.checks.push(func); + } + else if (!value && index !== -1) { + this.checks.splice(index, 1); + } + }; + /** + * A private little wrapper function that we call to check the blend mode. + * + * @static + * @private + * @param {PIXI.StateSystem} System - the System to perform the state check on + * @param {PIXI.State} state - the state that the blendMode will pulled from + */ + StateSystem.checkBlendMode = function (system, state) { + system.setBlendMode(state.blendMode); + }; + /** + * A private little wrapper function that we call to check the polygon offset. + * + * @static + * @private + * @param {PIXI.StateSystem} System - the System to perform the state check on + * @param {PIXI.State} state - the state that the blendMode will pulled from + */ + StateSystem.checkPolygonOffset = function (system, state) { + system.setPolygonOffset(1, state.polygonOffset); + }; + return StateSystem; + }(System)); + + /** + * System plugin to the renderer to manage texture garbage collection on the GPU, + * ensuring that it does not get clogged up with textures that are no longer being used. + * + * @class + * @memberof PIXI.systems + * @extends PIXI.System + */ + var TextureGCSystem = /** @class */ (function (_super) { + __extends$2(TextureGCSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function TextureGCSystem(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * Count + * @member {number} + * @readonly + */ + _this.count = 0; + /** + * Check count + * @member {number} + * @readonly + */ + _this.checkCount = 0; + /** + * Maximum idle time, in seconds + * @member {number} + * @see PIXI.settings.GC_MAX_IDLE + */ + _this.maxIdle = settings.GC_MAX_IDLE; + /** + * Maximum number of item to check + * @member {number} + * @see PIXI.settings.GC_MAX_CHECK_COUNT + */ + _this.checkCountMax = settings.GC_MAX_CHECK_COUNT; + /** + * Current garabage collection mode + * @member {PIXI.GC_MODES} + * @see PIXI.settings.GC_MODE + */ + _this.mode = settings.GC_MODE; + return _this; + } + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.postrender = function () { + if (!this.renderer.renderingToScreen) { + return; + } + this.count++; + if (this.mode === exports.GC_MODES.MANUAL) { + return; + } + this.checkCount++; + if (this.checkCount > this.checkCountMax) { + this.checkCount = 0; + this.run(); + } + }; + /** + * Checks to see when the last time a texture was used + * if the texture has not been used for a specified amount of time it will be removed from the GPU + */ + TextureGCSystem.prototype.run = function () { + var tm = this.renderer.texture; + var managedTextures = tm.managedTextures; + var wasRemoved = false; + for (var i = 0; i < managedTextures.length; i++) { + var texture = managedTextures[i]; + // only supports non generated textures at the moment! + if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { + tm.destroyTexture(texture, true); + managedTextures[i] = null; + wasRemoved = true; + } + } + if (wasRemoved) { + var j = 0; + for (var i = 0; i < managedTextures.length; i++) { + if (managedTextures[i] !== null) { + managedTextures[j++] = managedTextures[i]; + } + } + managedTextures.length = j; + } + }; + /** + * Removes all the textures within the specified displayObject and its children from the GPU + * + * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. + */ + TextureGCSystem.prototype.unload = function (displayObject) { + var tm = this.renderer.texture; + var texture = displayObject._texture; + // only destroy non generated textures + if (texture && !texture.framebuffer) { + tm.destroyTexture(texture); + } + for (var i = displayObject.children.length - 1; i >= 0; i--) { + this.unload(displayObject.children[i]); + } + }; + return TextureGCSystem; + }(System)); + + /** + * Internal texture for WebGL context + * @class + * @memberof PIXI + */ + var GLTexture = /** @class */ (function () { + function GLTexture(texture) { + /** + * The WebGL texture + * @member {WebGLTexture} + */ + this.texture = texture; + /** + * Width of texture that was used in texImage2D + * @member {number} + */ + this.width = -1; + /** + * Height of texture that was used in texImage2D + * @member {number} + */ + this.height = -1; + /** + * Texture contents dirty flag + * @member {number} + */ + this.dirtyId = -1; + /** + * Texture style dirty flag + * @member {number} + */ + this.dirtyStyleId = -1; + /** + * Whether mip levels has to be generated + * @member {boolean} + */ + this.mipmap = false; + /** + * WrapMode copied from baseTexture + * @member {number} + */ + this.wrapMode = 33071; + /** + * Type copied from baseTexture + * @member {number} + */ + this.type = 6408; + /** + * Type copied from baseTexture + * @member {number} + */ + this.internalFormat = 5121; + } + return GLTexture; + }()); + + /** + * System plugin to the renderer to manage textures. + * + * @class + * @extends PIXI.System + * @memberof PIXI.systems + */ + var TextureSystem = /** @class */ (function (_super) { + __extends$2(TextureSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function TextureSystem(renderer) { + var _this = _super.call(this, renderer) || this; + // TODO set to max textures... + /** + * Bound textures + * @member {PIXI.BaseTexture[]} + * @readonly + */ + _this.boundTextures = []; + /** + * Current location + * @member {number} + * @readonly + */ + _this.currentLocation = -1; + /** + * List of managed textures + * @member {PIXI.BaseTexture[]} + * @readonly + */ + _this.managedTextures = []; + /** + * Did someone temper with textures state? We'll overwrite them when we need to unbind something. + * @member {boolean} + * @private + */ + _this._unknownBoundTextures = false; + /** + * BaseTexture value that shows that we don't know what is bound + * @member {PIXI.BaseTexture} + * @readonly + */ + _this.unknownTexture = new BaseTexture(); + return _this; + } + /** + * Sets up the renderer context and necessary buffers. + */ + TextureSystem.prototype.contextChange = function () { + var gl = this.gl = this.renderer.gl; + this.CONTEXT_UID = this.renderer.CONTEXT_UID; + this.webGLVersion = this.renderer.context.webGLVersion; + var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + this.boundTextures.length = maxTextures; + for (var i = 0; i < maxTextures; i++) { + this.boundTextures[i] = null; + } + // TODO move this.. to a nice make empty textures class.. + this.emptyTextures = {}; + var emptyTexture2D = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); + this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; + this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); + for (var i = 0; i < 6; i++) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + } + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + for (var i = 0; i < this.boundTextures.length; i++) { + this.bind(null, i); + } + }; + /** + * Bind a texture to a specific location + * + * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` + * + * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind + * @param {number} [location=0] - Location to bind at + */ + TextureSystem.prototype.bind = function (texture, location) { + if (location === void 0) { location = 0; } + var gl = this.gl; + if (texture) { + texture = texture.castToBaseTexture(); + if (texture.parentTextureArray) { + // cannot bind partial texture + // TODO: report a warning + return; + } + if (texture.valid) { + texture.touched = this.renderer.textureGC.count; + var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); + if (this.boundTextures[location] !== texture) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(texture.target, glTexture.texture); + } + if (glTexture.dirtyId !== texture.dirtyId) { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + this.updateTexture(texture); + } + this.boundTextures[location] = texture; + } + } + else { + if (this.currentLocation !== location) { + this.currentLocation = location; + gl.activeTexture(gl.TEXTURE0 + location); + } + gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); + this.boundTextures[location] = null; + } + }; + /** + * Resets texture location and bound textures + * + * Actual `bind(null, i)` calls will be performed at next `unbind()` call + */ + TextureSystem.prototype.reset = function () { + this._unknownBoundTextures = true; + this.currentLocation = -1; + for (var i = 0; i < this.boundTextures.length; i++) { + this.boundTextures[i] = this.unknownTexture; + } + }; + /** + * Unbind a texture + * @param {PIXI.BaseTexture} texture - Texture to bind + */ + TextureSystem.prototype.unbind = function (texture) { + var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; + if (this._unknownBoundTextures) { + this._unknownBoundTextures = false; + // someone changed webGL state, + // we have to be sure that our texture does not appear in multi-texture renderer samplers + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === this.unknownTexture) { + this.bind(null, i); + } + } + } + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === texture) { + if (this.currentLocation !== i) { + gl.activeTexture(gl.TEXTURE0 + i); + this.currentLocation = i; + } + gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture); + boundTextures[i] = null; + } + } + }; + /** + * Initialize a texture + * + * @private + * @param {PIXI.BaseTexture} texture - Texture to initialize + */ + TextureSystem.prototype.initTexture = function (texture) { + var glTexture = new GLTexture(this.gl.createTexture()); + // guarantee an update.. + glTexture.dirtyId = -1; + texture._glTextures[this.CONTEXT_UID] = glTexture; + this.managedTextures.push(texture); + texture.on('dispose', this.destroyTexture, this); + return glTexture; + }; + TextureSystem.prototype.initTextureType = function (texture, glTexture) { + glTexture.internalFormat = texture.format; + glTexture.type = texture.type; + if (this.webGLVersion !== 2) { + return; + } + var gl = this.renderer.gl; + if (texture.type === gl.FLOAT + && texture.format === gl.RGBA) { + glTexture.internalFormat = gl.RGBA32F; + } + // that's WebGL1 HALF_FLOAT_OES + // we have to convert it to WebGL HALF_FLOAT + if (texture.type === exports.TYPES.HALF_FLOAT) { + glTexture.type = gl.HALF_FLOAT; + } + if (glTexture.type === gl.HALF_FLOAT + && texture.format === gl.RGBA) { + glTexture.internalFormat = gl.RGBA16F; + } + }; + /** + * Update a texture + * + * @private + * @param {PIXI.BaseTexture} texture - Texture to initialize + */ + TextureSystem.prototype.updateTexture = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + var renderer = this.renderer; + this.initTextureType(texture, glTexture); + if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { ; } + else { + // default, renderTexture-like logic + var width = texture.realWidth; + var height = texture.realHeight; + var gl = renderer.gl; + if (glTexture.width !== width + || glTexture.height !== height + || glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); + } + } + // lets only update what changes.. + if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { + this.updateTextureStyle(texture); + } + glTexture.dirtyId = texture.dirtyId; + }; + /** + * Deletes the texture from WebGL + * + * @private + * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy + * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager. + */ + TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { + var gl = this.gl; + texture = texture.castToBaseTexture(); + if (texture._glTextures[this.CONTEXT_UID]) { + this.unbind(texture); + gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); + texture.off('dispose', this.destroyTexture, this); + delete texture._glTextures[this.CONTEXT_UID]; + if (!skipRemove) { + var i = this.managedTextures.indexOf(texture); + if (i !== -1) { + removeItems(this.managedTextures, i, 1); + } + } + } + }; + /** + * Update texture style such as mipmap flag + * + * @private + * @param {PIXI.BaseTexture} texture - Texture to update + */ + TextureSystem.prototype.updateTextureStyle = function (texture) { + var glTexture = texture._glTextures[this.CONTEXT_UID]; + if (!glTexture) { + return; + } + if ((texture.mipmap === exports.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { + glTexture.mipmap = false; + } + else { + glTexture.mipmap = texture.mipmap >= 1; + } + if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { + glTexture.wrapMode = exports.WRAP_MODES.CLAMP; + } + else { + glTexture.wrapMode = texture.wrapMode; + } + if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) { ; } + else { + this.setStyle(texture, glTexture); + } + glTexture.dirtyStyleId = texture.dirtyStyleId; + }; + /** + * Set style for texture + * + * @private + * @param {PIXI.BaseTexture} texture - Texture to update + * @param {PIXI.GLTexture} glTexture + */ + TextureSystem.prototype.setStyle = function (texture, glTexture) { + var gl = this.gl; + if (glTexture.mipmap) { + gl.generateMipmap(texture.target); + } + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); + gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); + if (glTexture.mipmap) { + /* eslint-disable max-len */ + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); + /* eslint-disable max-len */ + var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; + if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === exports.SCALE_MODES.LINEAR) { + var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); + gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); + } + } + else { + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + } + gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); + }; + return TextureSystem; + }(System)); + + /** + * Systems are individual components to the Renderer pipeline. + * @namespace PIXI.systems + */ + + var systems = ({ + FilterSystem: FilterSystem, + BatchSystem: BatchSystem, + ContextSystem: ContextSystem, + FramebufferSystem: FramebufferSystem, + GeometrySystem: GeometrySystem, + MaskSystem: MaskSystem, + ScissorSystem: ScissorSystem, + StencilSystem: StencilSystem, + ProjectionSystem: ProjectionSystem, + RenderTextureSystem: RenderTextureSystem, + ShaderSystem: ShaderSystem, + StateSystem: StateSystem, + TextureGCSystem: TextureGCSystem, + TextureSystem: TextureSystem + }); + + var tempMatrix = new Matrix(); + /** + * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} + * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. + * + * @abstract + * @class + * @extends PIXI.utils.EventEmitter + * @memberof PIXI + */ + var AbstractRenderer = /** @class */ (function (_super) { + __extends$2(AbstractRenderer, _super); + /** + * @param {string} system - The name of the system this renderer is for. + * @param {object} [options] - The optional renderer parameters. + * @param {number} [options.width=800] - The width of the screen. + * @param {number} [options.height=600] - The height of the screen. + * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. + * @param {boolean} [options.transparent=false] - If the render view is transparent. + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1. + * @param {boolean} [options.antialias=false] - Sets antialias + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The + * resolution of the renderer retina would be 2. + * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the WebGL context. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + */ + function AbstractRenderer(type, options) { + if (type === void 0) { type = exports.RENDERER_TYPE.UNKNOWN; } + var _this = _super.call(this) || this; + // Add the default render options + options = Object.assign({}, settings.RENDER_OPTIONS, options); + // Deprecation notice for renderer roundPixels option + if (options.roundPixels) { + settings.ROUND_PIXELS = options.roundPixels; + deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2); + } + /** + * The supplied constructor options. + * + * @member {Object} + * @readOnly + */ + _this.options = options; + /** + * The type of the renderer. + * + * @member {number} + * @default PIXI.RENDERER_TYPE.UNKNOWN + * @see PIXI.RENDERER_TYPE + */ + _this.type = type; + /** + * Measurements of the screen. (0, 0, screenWidth, screenHeight). + * + * Its safe to use as filterArea or hitArea for the whole stage. + * + * @member {PIXI.Rectangle} + */ + _this.screen = new Rectangle(0, 0, options.width, options.height); + /** + * The canvas element that everything is drawn to. + * + * @member {HTMLCanvasElement} + */ + _this.view = options.view || document.createElement('canvas'); + /** + * The resolution / device pixel ratio of the renderer. + * + * @member {number} + * @default 1 + */ + _this.resolution = options.resolution || settings.RESOLUTION; + /** + * Whether the render view is transparent. + * + * @member {boolean} + */ + _this.transparent = options.transparent; + /** + * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. + * + * @member {boolean} + */ + _this.autoDensity = options.autoDensity || options.autoResize || false; + // autoResize is deprecated, provides fallback support + /** + * The value of the preserveDrawingBuffer flag affects whether or not the contents of + * the stencil buffer is retained after rendering. + * + * @member {boolean} + */ + _this.preserveDrawingBuffer = options.preserveDrawingBuffer; + /** + * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. + * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every + * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect + * to clear the canvas every frame. Disable this by setting this to false. For example, if + * your game has a canvas filling background image you often don't need this set. + * + * @member {boolean} + * @default + */ + _this.clearBeforeRender = options.clearBeforeRender; + /** + * The background color as a number. + * + * @member {number} + * @protected + */ + _this._backgroundColor = 0x000000; + /** + * The background color as an [R, G, B] array. + * + * @member {number[]} + * @protected + */ + _this._backgroundColorRgba = [0, 0, 0, 0]; + /** + * The background color as a string. + * + * @member {string} + * @protected + */ + _this._backgroundColorString = '#000000'; + _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter + /** + * The last root object that the renderer tried to render. + * + * @member {PIXI.DisplayObject} + * @protected + */ + _this._lastObjectRendered = null; + /** + * Collection of plugins. + * @readonly + * @member {object} + */ + _this.plugins = {}; + return _this; + } + /** + * Initialize the plugins. + * + * @protected + * @param {object} staticMap - The dictionary of statically saved plugins. + */ + AbstractRenderer.prototype.initPlugins = function (staticMap) { + for (var o in staticMap) { + this.plugins[o] = new (staticMap[o])(this); + } + }; + Object.defineProperty(AbstractRenderer.prototype, "width", { + /** + * Same as view.width, actual number of pixels in the canvas by horizontal. + * + * @member {number} + * @readonly + * @default 800 + */ + get: function () { + return this.view.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "height", { + /** + * Same as view.height, actual number of pixels in the canvas by vertical. + * + * @member {number} + * @readonly + * @default 600 + */ + get: function () { + return this.view.height; + }, + enumerable: false, + configurable: true + }); + /** + * Resizes the screen and canvas to the specified width and height. + * Canvas dimensions are multiplied by resolution. + * + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + AbstractRenderer.prototype.resize = function (screenWidth, screenHeight) { + this.screen.width = screenWidth; + this.screen.height = screenHeight; + this.view.width = screenWidth * this.resolution; + this.view.height = screenHeight * this.resolution; + if (this.autoDensity) { + this.view.style.width = screenWidth + "px"; + this.view.style.height = screenHeight + "px"; + } + /** + * Fired after view has been resized. + * + * @event PIXI.Renderer#resize + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + this.emit('resize', screenWidth, screenHeight); + }; + /** + * Useful function that returns a texture of the display object that can then be used to create sprites + * This can be quite useful if your displayObject is complicated and needs to be reused multiple times. + * + * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from. + * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture. + * @param {number} resolution - The resolution / device pixel ratio of the texture being generated. + * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered, + * if no region is specified, defaults to the local bounds of the displayObject. + * @return {PIXI.RenderTexture} A texture of the graphics object. + */ + AbstractRenderer.prototype.generateTexture = function (displayObject, scaleMode, resolution, region) { + region = region || displayObject.getLocalBounds(null, true); + // minimum texture size is 1x1, 0x0 will throw an error + if (region.width === 0) + { region.width = 1; } + if (region.height === 0) + { region.height = 1; } + var renderTexture = RenderTexture.create({ + width: region.width | 0, + height: region.height | 0, + scaleMode: scaleMode, + resolution: resolution, + }); + tempMatrix.tx = -region.x; + tempMatrix.ty = -region.y; + this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent); + return renderTexture; + }; + /** + * Removes everything from the renderer and optionally removes the Canvas DOM element. + * + * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. + */ + AbstractRenderer.prototype.destroy = function (removeView) { + for (var o in this.plugins) { + this.plugins[o].destroy(); + this.plugins[o] = null; + } + if (removeView && this.view.parentNode) { + this.view.parentNode.removeChild(this.view); + } + var thisAny = this; + // null-ing all objects, that's a tradition! + thisAny.plugins = null; + thisAny.type = exports.RENDERER_TYPE.UNKNOWN; + thisAny.view = null; + thisAny.screen = null; + thisAny._tempDisplayObjectParent = null; + thisAny.options = null; + this._backgroundColorRgba = null; + this._backgroundColorString = null; + this._lastObjectRendered = null; + }; + Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { + /** + * The background color to fill if not transparent + * + * @member {number} + */ + get: function () { + return this._backgroundColor; + }, + set: function (value) { + this._backgroundColor = value; + this._backgroundColorString = hex2string(value); + hex2rgb(value, this._backgroundColorRgba); + }, + enumerable: false, + configurable: true + }); + return AbstractRenderer; + }(eventemitter3)); + + /** + * The Renderer draws the scene and all its content onto a WebGL enabled canvas. + * + * This renderer should be used for browsers that support WebGL. + * + * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds. + * Don't forget to add the view to your DOM or you will not see anything! + * + * @class + * @memberof PIXI + * @extends PIXI.AbstractRenderer + */ + var Renderer = /** @class */ (function (_super) { + __extends$2(Renderer, _super); + /** + * @param {object} [options] - The optional renderer parameters. + * @param {number} [options.width=800] - The width of the screen. + * @param {number} [options.height=600] - The height of the screen. + * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. + * @param {boolean} [options.transparent=false] - If the render view is transparent. + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1. + * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA + * antialiasing is used. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. + * The resolution of the renderer retina would be 2. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear + * the canvas or not before the new render pass. If you wish to set this to false, you *must* set + * preserveDrawingBuffer to `true`. + * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the WebGL context. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" + * for devices with dual graphics card. + * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it. + * @public + */ + function Renderer(options) { + var _this = _super.call(this, exports.RENDERER_TYPE.WEBGL, options) || this; + // the options will have been modified here in the super constructor with pixi's default settings.. + options = _this.options; + /** + * WebGL context, set by the contextSystem (this.context) + * + * @readonly + * @member {WebGLRenderingContext} + */ + _this.gl = null; + _this.CONTEXT_UID = 0; + // TODO legacy! + /** + * Internal signal instances of **runner**, these + * are assigned to each system created. + * @see PIXI.Runner + * @name PIXI.Renderer#runners + * @private + * @type {object} + * @readonly + * @property {PIXI.Runner} destroy - Destroy runner + * @property {PIXI.Runner} contextChange - Context change runner + * @property {PIXI.Runner} reset - Reset runner + * @property {PIXI.Runner} update - Update runner + * @property {PIXI.Runner} postrender - Post-render runner + * @property {PIXI.Runner} prerender - Pre-render runner + * @property {PIXI.Runner} resize - Resize runner + */ + _this.runners = { + destroy: new Runner('destroy'), + contextChange: new Runner('contextChange'), + reset: new Runner('reset'), + update: new Runner('update'), + postrender: new Runner('postrender'), + prerender: new Runner('prerender'), + resize: new Runner('resize'), + }; + /** + * Global uniforms + * @member {PIXI.UniformGroup} + */ + _this.globalUniforms = new UniformGroup({ + projectionMatrix: new Matrix(), + }, true); + /** + * Mask system instance + * @member {PIXI.systems.MaskSystem} mask + * @memberof PIXI.Renderer# + * @readonly + */ + _this.addSystem(MaskSystem, 'mask') + /** + * Context system instance + * @member {PIXI.systems.ContextSystem} context + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(ContextSystem, 'context') + /** + * State system instance + * @member {PIXI.systems.StateSystem} state + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(StateSystem, 'state') + /** + * Shader system instance + * @member {PIXI.systems.ShaderSystem} shader + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(ShaderSystem, 'shader') + /** + * Texture system instance + * @member {PIXI.systems.TextureSystem} texture + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(TextureSystem, 'texture') + /** + * Geometry system instance + * @member {PIXI.systems.GeometrySystem} geometry + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(GeometrySystem, 'geometry') + /** + * Framebuffer system instance + * @member {PIXI.systems.FramebufferSystem} framebuffer + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(FramebufferSystem, 'framebuffer') + /** + * Scissor system instance + * @member {PIXI.systems.ScissorSystem} scissor + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(ScissorSystem, 'scissor') + /** + * Stencil system instance + * @member {PIXI.systems.StencilSystem} stencil + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(StencilSystem, 'stencil') + /** + * Projection system instance + * @member {PIXI.systems.ProjectionSystem} projection + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(ProjectionSystem, 'projection') + /** + * Texture garbage collector system instance + * @member {PIXI.systems.TextureGCSystem} textureGC + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(TextureGCSystem, 'textureGC') + /** + * Filter system instance + * @member {PIXI.systems.FilterSystem} filter + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(FilterSystem, 'filter') + /** + * RenderTexture system instance + * @member {PIXI.systems.RenderTextureSystem} renderTexture + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(RenderTextureSystem, 'renderTexture') + /** + * Batch system instance + * @member {PIXI.systems.BatchSystem} batch + * @memberof PIXI.Renderer# + * @readonly + */ + .addSystem(BatchSystem, 'batch'); + _this.initPlugins(Renderer.__plugins); + /** + * The options passed in to create a new WebGL context. + */ + if (options.context) { + _this.context.initFromContext(options.context); + } + else { + _this.context.initFromOptions({ + alpha: !!_this.transparent, + antialias: options.antialias, + premultipliedAlpha: _this.transparent && _this.transparent !== 'notMultiplied', + stencil: true, + preserveDrawingBuffer: options.preserveDrawingBuffer, + powerPreference: _this.options.powerPreference, + }); + } + /** + * Flag if we are rendering to the screen vs renderTexture + * @member {boolean} + * @readonly + * @default true + */ + _this.renderingToScreen = true; + sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); + _this.resize(_this.options.width, _this.options.height); + return _this; + } + /** + * Create renderer if WebGL is available. Overrideable + * by the **@pixi/canvas-renderer** package to allow fallback. + * throws error if WebGL is not available. + * @static + * @private + */ + Renderer.create = function (options) { + if (isWebGLSupported()) { + return new Renderer(options); + } + throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); + }; + /** + * Add a new system to the renderer. + * @param {Function} ClassRef - Class reference + * @param {string} [name] - Property name for system, if not specified + * will use a static `name` property on the class itself. This + * name will be assigned as s property on the Renderer so make + * sure it doesn't collide with properties on Renderer. + * @return {PIXI.Renderer} Return instance of renderer + */ + Renderer.prototype.addSystem = function (ClassRef, name) { + if (!name) { + name = ClassRef.name; + } + var system = new ClassRef(this); + if (this[name]) { + throw new Error("Whoops! The name \"" + name + "\" is already in use"); + } + this[name] = system; + for (var i in this.runners) { + this.runners[i].add(system); + } + /** + * Fired after rendering finishes. + * + * @event PIXI.Renderer#postrender + */ + /** + * Fired before rendering starts. + * + * @event PIXI.Renderer#prerender + */ + /** + * Fired when the WebGL context is set. + * + * @event PIXI.Renderer#context + * @param {WebGLRenderingContext} gl - WebGL context. + */ + return this; + }; + /** + * Renders the object to its WebGL view + * + * @param {PIXI.DisplayObject} displayObject - The object to be rendered. + * @param {PIXI.RenderTexture} [renderTexture] - The render texture to render to. + * @param {boolean} [clear=true] - Should the canvas be cleared before the new render. + * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering. + * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass? + */ + Renderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { + // can be handy to know! + this.renderingToScreen = !renderTexture; + this.runners.prerender.emit(); + this.emit('prerender'); + // apply a transform at a GPU level + this.projection.transform = transform; + // no point rendering if our context has been blown up! + if (this.context.isLost) { + return; + } + if (!renderTexture) { + this._lastObjectRendered = displayObject; + } + if (!skipUpdateTransform) { + // update the scene graph + var cacheParent = displayObject.enableTempParent(); + displayObject.updateTransform(); + displayObject.disableTempParent(cacheParent); + // displayObject.hitArea = //TODO add a temp hit area + } + this.renderTexture.bind(renderTexture); + this.batch.currentRenderer.start(); + if (clear !== undefined ? clear : this.clearBeforeRender) { + this.renderTexture.clear(); + } + displayObject.render(this); + // apply transform.. + this.batch.currentRenderer.flush(); + if (renderTexture) { + renderTexture.baseTexture.update(); + } + this.runners.postrender.emit(); + // reset transform after render + this.projection.transform = null; + this.emit('postrender'); + }; + /** + * Resizes the WebGL view to the specified width and height. + * + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + Renderer.prototype.resize = function (screenWidth, screenHeight) { + _super.prototype.resize.call(this, screenWidth, screenHeight); + this.runners.resize.emit(screenWidth, screenHeight); + }; + /** + * Resets the WebGL state so you can render things however you fancy! + * + * @return {PIXI.Renderer} Returns itself. + */ + Renderer.prototype.reset = function () { + this.runners.reset.emit(); + return this; + }; + /** + * Clear the frame buffer + */ + Renderer.prototype.clear = function () { + this.renderTexture.bind(); + this.renderTexture.clear(); + }; + /** + * Removes everything from the renderer (event listeners, spritebatch, etc...) + * + * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. + * See: https://github.com/pixijs/pixi.js/issues/2233 + */ + Renderer.prototype.destroy = function (removeView) { + this.runners.destroy.emit(); + for (var r in this.runners) { + this.runners[r].destroy(); + } + // call base destroy + _super.prototype.destroy.call(this, removeView); + // TODO nullify all the managers.. + this.gl = null; + }; + /** + * Adds a plugin to the renderer. + * + * @method + * @param {string} pluginName - The name of the plugin. + * @param {Function} ctor - The constructor function or class for the plugin. + */ + Renderer.registerPlugin = function (pluginName, ctor) { + Renderer.__plugins = Renderer.__plugins || {}; + Renderer.__plugins[pluginName] = ctor; + }; + return Renderer; + }(AbstractRenderer)); + + /** + * This helper function will automatically detect which renderer you should be using. + * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by + * the browser then this function will return a canvas renderer + * + * @memberof PIXI + * @function autoDetectRenderer + * @param {object} [options] - The optional renderer parameters + * @param {number} [options.width=800] - the width of the renderers view + * @param {number} [options.height=600] - the height of the renderers view + * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional + * @param {boolean} [options.transparent=false] - If the render view is transparent, default false + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1 + * @param {boolean} [options.antialias=false] - sets antialias + * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation, enable this if you + * need to call toDataUrl on the webgl context + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2 + * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this + * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise + * it is ignored. + * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" + * for devices with dual graphics card **webgl only** + * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer + */ + function autoDetectRenderer(options) { + return Renderer.create(options); + } + + var _default = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}"; + + var defaultFilter = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"; + + /** + * Used by the batcher to draw batches. + * Each one of these contains all information required to draw a bound geometry. + * + * @class + * @memberof PIXI + */ + var BatchDrawCall = /** @class */ (function () { + function BatchDrawCall() { + this.texArray = null; + this.blend = 0; + this.type = exports.DRAW_MODES.TRIANGLES; + this.start = 0; + this.size = 0; + /** + * data for uniforms or custom webgl state + * @member {object} + */ + this.data = null; + } + return BatchDrawCall; + }()); + + /** + * Used by the batcher to build texture batches. + * Holds list of textures and their respective locations. + * + * @class + * @memberof PIXI + */ + var BatchTextureArray = /** @class */ (function () { + function BatchTextureArray() { + /** + * inside textures array + * @member {PIXI.BaseTexture[]} + */ + this.elements = []; + /** + * Respective locations for textures + * @member {number[]} + */ + this.ids = []; + /** + * number of filled elements + * @member {number} + */ + this.count = 0; + } + BatchTextureArray.prototype.clear = function () { + for (var i = 0; i < this.count; i++) { + this.elements[i] = null; + } + this.count = 0; + }; + return BatchTextureArray; + }()); + + /** + * Flexible wrapper around `ArrayBuffer` that also provides + * typed array views on demand. + * + * @class + * @memberof PIXI + */ + var ViewableBuffer = /** @class */ (function () { + /** + * @param {number} size - The size of the buffer in bytes. + */ + function ViewableBuffer(size) { + /** + * Underlying `ArrayBuffer` that holds all the data + * and is of capacity `size`. + * + * @member {ArrayBuffer} + */ + this.rawBinaryData = new ArrayBuffer(size); + /** + * View on the raw binary data as a `Uint32Array`. + * + * @member {Uint32Array} + */ + this.uint32View = new Uint32Array(this.rawBinaryData); + /** + * View on the raw binary data as a `Float32Array`. + * + * @member {Float32Array} + */ + this.float32View = new Float32Array(this.rawBinaryData); + } + Object.defineProperty(ViewableBuffer.prototype, "int8View", { + /** + * View on the raw binary data as a `Int8Array`. + * + * @member {Int8Array} + */ + get: function () { + if (!this._int8View) { + this._int8View = new Int8Array(this.rawBinaryData); + } + return this._int8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint8View", { + /** + * View on the raw binary data as a `Uint8Array`. + * + * @member {Uint8Array} + */ + get: function () { + if (!this._uint8View) { + this._uint8View = new Uint8Array(this.rawBinaryData); + } + return this._uint8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int16View", { + /** + * View on the raw binary data as a `Int16Array`. + * + * @member {Int16Array} + */ + get: function () { + if (!this._int16View) { + this._int16View = new Int16Array(this.rawBinaryData); + } + return this._int16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint16View", { + /** + * View on the raw binary data as a `Uint16Array`. + * + * @member {Uint16Array} + */ + get: function () { + if (!this._uint16View) { + this._uint16View = new Uint16Array(this.rawBinaryData); + } + return this._uint16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int32View", { + /** + * View on the raw binary data as a `Int32Array`. + * + * @member {Int32Array} + */ + get: function () { + if (!this._int32View) { + this._int32View = new Int32Array(this.rawBinaryData); + } + return this._int32View; + }, + enumerable: false, + configurable: true + }); + /** + * Returns the view of the given type. + * + * @param {string} type - One of `int8`, `uint8`, `int16`, + * `uint16`, `int32`, `uint32`, and `float32`. + * @return {object} typed array of given type + */ + ViewableBuffer.prototype.view = function (type) { + return this[type + "View"]; + }; + /** + * Destroys all buffer references. Do not use after calling + * this. + */ + ViewableBuffer.prototype.destroy = function () { + this.rawBinaryData = null; + this._int8View = null; + this._uint8View = null; + this._int16View = null; + this._uint16View = null; + this._int32View = null; + this.uint32View = null; + this.float32View = null; + }; + ViewableBuffer.sizeOf = function (type) { + switch (type) { + case 'int8': + case 'uint8': + return 1; + case 'int16': + case 'uint16': + return 2; + case 'int32': + case 'uint32': + case 'float32': + return 4; + default: + throw new Error(type + " isn't a valid view type"); + } + }; + return ViewableBuffer; + }()); + + /** + * Renderer dedicated to drawing and batching sprites. + * + * This is the default batch renderer. It buffers objects + * with texture-based geometries and renders them in + * batches. It uploads multiple textures to the GPU to + * reduce to the number of draw calls. + * + * @class + * @protected + * @memberof PIXI + * @extends PIXI.ObjectRenderer + */ + var AbstractBatchRenderer = /** @class */ (function (_super) { + __extends$2(AbstractBatchRenderer, _super); + /** + * This will hook onto the renderer's `contextChange` + * and `prerender` signals. + * + * @param {PIXI.Renderer} renderer - The renderer this works for. + */ + function AbstractBatchRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + /** + * This is used to generate a shader that can + * color each vertex based on a `aTextureId` + * attribute that points to an texture in `uSampler`. + * + * This enables the objects with different textures + * to be drawn in the same draw call. + * + * You can customize your shader by creating your + * custom shader generator. + * + * @member {PIXI.BatchShaderGenerator} + * @protected + */ + _this.shaderGenerator = null; + /** + * The class that represents the geometry of objects + * that are going to be batched with this. + * + * @member {object} + * @default PIXI.BatchGeometry + * @protected + */ + _this.geometryClass = null; + /** + * Size of data being buffered per vertex in the + * attribute buffers (in floats). By default, the + * batch-renderer plugin uses 6: + * + * | aVertexPosition | 2 | + * |-----------------|---| + * | aTextureCoords | 2 | + * | aColor | 1 | + * | aTextureId | 1 | + * + * @member {number} + * @readonly + */ + _this.vertexSize = null; + /** + * The WebGL state in which this renderer will work. + * + * @member {PIXI.State} + * @readonly + */ + _this.state = State.for2d(); + /** + * The number of bufferable objects before a flush + * occurs automatically. + * + * @member {number} + * @default settings.SPRITE_BATCH_SIZE * 4 + */ + _this.size = settings.SPRITE_BATCH_SIZE * 4; + /** + * Total count of all vertices used by the currently + * buffered objects. + * + * @member {number} + * @private + */ + _this._vertexCount = 0; + /** + * Total count of all indices used by the currently + * buffered objects. + * + * @member {number} + * @private + */ + _this._indexCount = 0; + /** + * Buffer of objects that are yet to be rendered. + * + * @member {PIXI.DisplayObject[]} + * @private + */ + _this._bufferedElements = []; + /** + * Data for texture batch builder, helps to save a bit of CPU on a pass. + * @type {PIXI.BaseTexture[]} + * @private + */ + _this._bufferedTextures = []; + /** + * Number of elements that are buffered and are + * waiting to be flushed. + * + * @member {number} + * @private + */ + _this._bufferSize = 0; + /** + * This shader is generated by `this.shaderGenerator`. + * + * It is generated specifically to handle the required + * number of textures being batched together. + * + * @member {PIXI.Shader} + * @protected + */ + _this._shader = null; + /** + * Pool of `this.geometryClass` geometry objects + * that store buffers. They are used to pass data + * to the shader on each draw call. + * + * These are never re-allocated again, unless a + * context change occurs; however, the pool may + * be expanded if required. + * + * @member {PIXI.Geometry[]} + * @private + * @see PIXI.AbstractBatchRenderer.contextChange + */ + _this._packedGeometries = []; + /** + * Size of `this._packedGeometries`. It can be expanded + * if more than `this._packedGeometryPoolSize` flushes + * occur in a single frame. + * + * @member {number} + * @private + */ + _this._packedGeometryPoolSize = 2; + /** + * A flush may occur multiple times in a single + * frame. On iOS devices or when + * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the + * batch renderer does not upload data to the same + * `WebGLBuffer` for performance reasons. + * + * This is the index into `packedGeometries` that points to + * geometry holding the most recent buffers. + * + * @member {number} + * @private + */ + _this._flushId = 0; + /** + * Pool of `ViewableBuffer` objects that are sorted in + * order of increasing size. The flush method uses + * the buffer with the least size above the amount + * it requires. These are used for passing attributes. + * + * The first buffer has a size of 8; each subsequent + * buffer has double capacity of its previous. + * + * @member {PIXI.ViewableBuffer[]} + * @private + * @see PIXI.AbstractBatchRenderer#getAttributeBuffer + */ + _this._aBuffers = {}; + /** + * Pool of `Uint16Array` objects that are sorted in + * order of increasing size. The flush method uses + * the buffer with the least size above the amount + * it requires. These are used for passing indices. + * + * The first buffer has a size of 12; each subsequent + * buffer has double capacity of its previous. + * + * @member {Uint16Array[]} + * @private + * @see PIXI.AbstractBatchRenderer#getIndexBuffer + */ + _this._iBuffers = {}; + /** + * Maximum number of textures that can be uploaded to + * the GPU under the current context. It is initialized + * properly in `this.contextChange`. + * + * @member {number} + * @see PIXI.AbstractBatchRenderer#contextChange + * @readonly + */ + _this.MAX_TEXTURES = 1; + _this.renderer.on('prerender', _this.onPrerender, _this); + renderer.runners.contextChange.add(_this); + _this._dcIndex = 0; + _this._aIndex = 0; + _this._iIndex = 0; + _this._attributeBuffer = null; + _this._indexBuffer = null; + _this._tempBoundTextures = []; + return _this; + } + /** + * Handles the `contextChange` signal. + * + * It calculates `this.MAX_TEXTURES` and allocating the + * packed-geometry object pool. + */ + AbstractBatchRenderer.prototype.contextChange = function () { + var gl = this.renderer.gl; + if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { + this.MAX_TEXTURES = 1; + } + else { + // step 1: first check max textures the GPU can handle. + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); + // step 2: check the maximum number of if statements the shader can have too.. + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); + } + this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); + // we use the second shader as the first one depending on your browser + // may omit aTextureId as it is not used by the shader so is optimized out. + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + /* eslint-disable max-len */ + this._packedGeometries[i] = new (this.geometryClass)(); + } + this.initFlushBuffers(); + }; + /** + * Makes sure that static and dynamic flush pooled objects have correct dimensions + */ + AbstractBatchRenderer.prototype.initFlushBuffers = function () { + var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; + // max draw calls + var MAX_SPRITES = this.size / 4; + // max texture arrays + var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; + while (_drawCallPool.length < MAX_SPRITES) { + _drawCallPool.push(new BatchDrawCall()); + } + while (_textureArrayPool.length < MAX_TA) { + _textureArrayPool.push(new BatchTextureArray()); + } + for (var i = 0; i < this.MAX_TEXTURES; i++) { + this._tempBoundTextures[i] = null; + } + }; + /** + * Handles the `prerender` signal. + * + * It ensures that flushes start from the first geometry + * object again. + */ + AbstractBatchRenderer.prototype.onPrerender = function () { + this._flushId = 0; + }; + /** + * Buffers the "batchable" object. It need not be rendered + * immediately. + * + * @param {PIXI.DisplayObject} element - the element to render when + * using this renderer + */ + AbstractBatchRenderer.prototype.render = function (element) { + if (!element._texture.valid) { + return; + } + if (this._vertexCount + (element.vertexData.length / 2) > this.size) { + this.flush(); + } + this._vertexCount += element.vertexData.length / 2; + this._indexCount += element.indices.length; + this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; + this._bufferedElements[this._bufferSize++] = element; + }; + AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { + var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; + var textureArrays = AbstractBatchRenderer._textureArrayPool; + var batch = this.renderer.batch; + var boundTextures = this._tempBoundTextures; + var touch = this.renderer.textureGC.count; + var TICK = ++BaseTexture._globalBatch; + var countTexArrays = 0; + var texArray = textureArrays[0]; + var start = 0; + batch.copyBoundTextures(boundTextures, MAX_TEXTURES); + for (var i = 0; i < this._bufferSize; ++i) { + var tex = textures[i]; + textures[i] = null; + if (tex._batchEnabled === TICK) { + continue; + } + if (texArray.count >= MAX_TEXTURES) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, i); + start = i; + texArray = textureArrays[++countTexArrays]; + ++TICK; + } + tex._batchEnabled = TICK; + tex.touched = touch; + texArray.elements[texArray.count++] = tex; + } + if (texArray.count > 0) { + batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); + this.buildDrawCalls(texArray, start, this._bufferSize); + ++countTexArrays; + ++TICK; + } + // Clean-up + for (var i = 0; i < boundTextures.length; i++) { + boundTextures[i] = null; + } + BaseTexture._globalBatch = TICK; + }; + /** + * Populating drawcalls for rendering + * + * @param {PIXI.BatchTextureArray} texArray + * @param {number} start + * @param {number} finish + */ + AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { + var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var dcIndex = this._dcIndex; + var aIndex = this._aIndex; + var iIndex = this._iIndex; + var drawCall = drawCalls[dcIndex]; + drawCall.start = this._iIndex; + drawCall.texArray = texArray; + for (var i = start; i < finish; ++i) { + var sprite = elements[i]; + var tex = sprite._texture.baseTexture; + var spriteBlendMode = premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; + elements[i] = null; + if (start < i && drawCall.blend !== spriteBlendMode) { + drawCall.size = iIndex - drawCall.start; + start = i; + drawCall = drawCalls[++dcIndex]; + drawCall.texArray = texArray; + drawCall.start = iIndex; + } + this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); + aIndex += sprite.vertexData.length / 2 * vertexSize; + iIndex += sprite.indices.length; + drawCall.blend = spriteBlendMode; + } + if (start < finish) { + drawCall.size = iIndex - drawCall.start; + ++dcIndex; + } + this._dcIndex = dcIndex; + this._aIndex = aIndex; + this._iIndex = iIndex; + }; + /** + * Bind textures for current rendering + * + * @param {PIXI.BatchTextureArray} texArray + */ + AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { + var textureSystem = this.renderer.texture; + for (var j = 0; j < texArray.count; j++) { + textureSystem.bind(texArray.elements[j], texArray.ids[j]); + texArray.elements[j] = null; + } + texArray.count = 0; + }; + AbstractBatchRenderer.prototype.updateGeometry = function () { + var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; + if (!settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't + like uploads to the same buffer in a single frame. */ + if (this._packedGeometryPoolSize <= this._flushId) { + this._packedGeometryPoolSize++; + packedGeometries[this._flushId] = new (this.geometryClass)(); + } + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.bind(packedGeometries[this._flushId]); + this.renderer.geometry.updateBuffers(); + this._flushId++; + } + else { + // lets use the faster option, always use buffer number 0 + packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); + packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); + this.renderer.geometry.updateBuffers(); + } + }; + AbstractBatchRenderer.prototype.drawBatches = function () { + var dcCount = this._dcIndex; + var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; + var drawCalls = AbstractBatchRenderer._drawCallPool; + var curTexArray = null; + // Upload textures and do the draw calls + for (var i = 0; i < dcCount; i++) { + var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; + if (curTexArray !== texArray) { + curTexArray = texArray; + this.bindAndClearTexArray(texArray); + } + this.state.blendMode = blend; + stateSystem.set(this.state); + gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); + } + }; + /** + * Renders the content _now_ and empties the current batch. + */ + AbstractBatchRenderer.prototype.flush = function () { + if (this._vertexCount === 0) { + return; + } + this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); + this._indexBuffer = this.getIndexBuffer(this._indexCount); + this._aIndex = 0; + this._iIndex = 0; + this._dcIndex = 0; + this.buildTexturesAndDrawCalls(); + this.updateGeometry(); + this.drawBatches(); + // reset elements buffer for the next flush + this._bufferSize = 0; + this._vertexCount = 0; + this._indexCount = 0; + }; + /** + * Starts a new sprite batch. + */ + AbstractBatchRenderer.prototype.start = function () { + this.renderer.state.set(this.state); + this.renderer.shader.bind(this._shader); + if (settings.CAN_UPLOAD_SAME_BUFFER) { + // bind buffer #0, we don't need others + this.renderer.geometry.bind(this._packedGeometries[this._flushId]); + } + }; + /** + * Stops and flushes the current batch. + */ + AbstractBatchRenderer.prototype.stop = function () { + this.flush(); + }; + /** + * Destroys this `AbstractBatchRenderer`. It cannot be used again. + */ + AbstractBatchRenderer.prototype.destroy = function () { + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + if (this._packedGeometries[i]) { + this._packedGeometries[i].destroy(); + } + } + this.renderer.off('prerender', this.onPrerender, this); + this._aBuffers = null; + this._iBuffers = null; + this._packedGeometries = null; + this._attributeBuffer = null; + this._indexBuffer = null; + if (this._shader) { + this._shader.destroy(); + this._shader = null; + } + _super.prototype.destroy.call(this); + }; + /** + * Fetches an attribute buffer from `this._aBuffers` that + * can hold atleast `size` floats. + * + * @param {number} size - minimum capacity required + * @return {ViewableBuffer} - buffer than can hold atleast `size` floats + * @private + */ + AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { + // 8 vertices is enough for 2 quads + var roundedP2 = nextPow2(Math.ceil(size / 8)); + var roundedSizeIndex = log2(roundedP2); + var roundedSize = roundedP2 * 8; + if (this._aBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._aBuffers[roundedSize]; + if (!buffer) { + this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); + } + return buffer; + }; + /** + * Fetches an index buffer from `this._iBuffers` that can + * have at least `size` capacity. + * + * @param {number} size - minimum required capacity + * @return {Uint16Array} - buffer that can fit `size` + * indices. + * @private + */ + AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { + // 12 indices is enough for 2 quads + var roundedP2 = nextPow2(Math.ceil(size / 12)); + var roundedSizeIndex = log2(roundedP2); + var roundedSize = roundedP2 * 12; + if (this._iBuffers.length <= roundedSizeIndex) { + this._iBuffers.length = roundedSizeIndex + 1; + } + var buffer = this._iBuffers[roundedSizeIndex]; + if (!buffer) { + this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); + } + return buffer; + }; + /** + * Takes the four batching parameters of `element`, interleaves + * and pushes them into the batching attribute/index buffers given. + * + * It uses these properties: `vertexData` `uvs`, `textureId` and + * `indicies`. It also uses the "tint" of the base-texture, if + * present. + * + * @param {PIXI.Sprite} element - element being rendered + * @param {PIXI.ViewableBuffer} attributeBuffer - attribute buffer. + * @param {Uint16Array} indexBuffer - index buffer + * @param {number} aIndex - number of floats already in the attribute buffer + * @param {number} iIndex - number of indices already in `indexBuffer` + */ + AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { + var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; + var packedVertices = aIndex / this.vertexSize; + var uvs = element.uvs; + var indicies = element.indices; + var vertexData = element.vertexData; + var textureId = element._texture.baseTexture._batchLocation; + var alpha = Math.min(element.worldAlpha, 1.0); + var argb = (alpha < 1.0 + && element._texture.baseTexture.alphaMode) + ? premultiplyTint(element._tintRGB, alpha) + : element._tintRGB + (alpha * 255 << 24); + // lets not worry about tint! for now.. + for (var i = 0; i < vertexData.length; i += 2) { + float32View[aIndex++] = vertexData[i]; + float32View[aIndex++] = vertexData[i + 1]; + float32View[aIndex++] = uvs[i]; + float32View[aIndex++] = uvs[i + 1]; + uint32View[aIndex++] = argb; + float32View[aIndex++] = textureId; + } + for (var i = 0; i < indicies.length; i++) { + indexBuffer[iIndex++] = packedVertices + indicies[i]; + } + }; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * + * @static + * @member {PIXI.BatchDrawCall[]} + */ + AbstractBatchRenderer._drawCallPool = []; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * + * @static + * @member {PIXI.BatchTextureArray[]} + */ + AbstractBatchRenderer._textureArrayPool = []; + return AbstractBatchRenderer; + }(ObjectRenderer)); + + /** + * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer + * + * @class + * @memberof PIXI + */ + var BatchShaderGenerator = /** @class */ (function () { + /** + * @param {string} vertexSrc - Vertex shader + * @param {string} fragTemplate - Fragment shader template + */ + function BatchShaderGenerator(vertexSrc, fragTemplate) { + /** + * Reference to the vertex shader source. + * + * @member {string} + */ + this.vertexSrc = vertexSrc; + /** + * Reference to the fragement shader template. Must contain "%count%" and "%forloop%". + * + * @member {string} + */ + this.fragTemplate = fragTemplate; + this.programCache = {}; + this.defaultGroupCache = {}; + if (fragTemplate.indexOf('%count%') < 0) { + throw new Error('Fragment template must contain "%count%".'); + } + if (fragTemplate.indexOf('%forloop%') < 0) { + throw new Error('Fragment template must contain "%forloop%".'); + } + } + BatchShaderGenerator.prototype.generateShader = function (maxTextures) { + if (!this.programCache[maxTextures]) { + var sampleValues = new Int32Array(maxTextures); + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); + var fragmentSrc = this.fragTemplate; + fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); + fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); + } + var uniforms = { + tint: new Float32Array([1, 1, 1, 1]), + translationMatrix: new Matrix(), + default: this.defaultGroupCache[maxTextures], + }; + return new Shader(this.programCache[maxTextures], uniforms); + }; + BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + for (var i = 0; i < maxTextures; i++) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxTextures - 1) { + src += "if(vTextureId < " + i + ".5)"; + } + src += '\n{'; + src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; + }; + return BatchShaderGenerator; + }()); + + /** + * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). + * + * @class + * @memberof PIXI + */ + var BatchGeometry = /** @class */ (function (_super) { + __extends$2(BatchGeometry, _super); + /** + * @param {boolean} [_static=false] - Optimization flag, where `false` + * is updated every frame, `true` doesn't change frame-to-frame. + */ + function BatchGeometry(_static) { + if (_static === void 0) { _static = false; } + var _this = _super.call(this) || this; + /** + * Buffer used for position, color, texture IDs + * + * @member {PIXI.Buffer} + * @protected + */ + _this._buffer = new Buffer(null, _static, false); + /** + * Index buffer data + * + * @member {PIXI.Buffer} + * @protected + */ + _this._indexBuffer = new Buffer(null, _static, true); + _this.addAttribute('aVertexPosition', _this._buffer, 2, false, exports.TYPES.FLOAT) + .addAttribute('aTextureCoord', _this._buffer, 2, false, exports.TYPES.FLOAT) + .addAttribute('aColor', _this._buffer, 4, true, exports.TYPES.UNSIGNED_BYTE) + .addAttribute('aTextureId', _this._buffer, 1, true, exports.TYPES.FLOAT) + .addIndex(_this._indexBuffer); + return _this; + } + return BatchGeometry; + }(Geometry)); + + var defaultVertex$2 = "precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n"; + + var defaultFragment$2 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n"; + + /** + * @class + * @memberof PIXI + * @hideconstructor + */ + var BatchPluginFactory = /** @class */ (function () { + function BatchPluginFactory() { + } + /** + * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way + * to extend BatchRenderer with all the necessary pieces. + * @example + * const fragment = ` + * varying vec2 vTextureCoord; + * varying vec4 vColor; + * varying float vTextureId; + * uniform sampler2D uSamplers[%count%]; + * + * void main(void){ + * vec4 color; + * %forloop% + * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); + * } + * `; + * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); + * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer); + * const sprite = new PIXI.Sprite(); + * sprite.pluginName = 'invert'; + * + * @static + * @param {object} [options] + * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source + * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template + * @param {number} [options.vertexSize=6] - Vertex size + * @param {object} [options.geometryClass=PIXI.BatchGeometry] + * @return {*} New batch renderer plugin + */ + BatchPluginFactory.create = function (options) { + var _a = Object.assign({ + vertex: defaultVertex$2, + fragment: defaultFragment$2, + geometryClass: BatchGeometry, + vertexSize: 6, + }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; + return /** @class */ (function (_super) { + __extends$2(BatchPlugin, _super); + function BatchPlugin(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); + _this.geometryClass = geometryClass; + _this.vertexSize = vertexSize; + return _this; + } + return BatchPlugin; + }(AbstractBatchRenderer)); + }; + Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { + /** + * The default vertex shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultVertex$2; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { + /** + * The default fragment shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultFragment$2; + }, + enumerable: false, + configurable: true + }); + return BatchPluginFactory; + }()); + // Setup the default BatchRenderer plugin, this is what + // we'll actually export at the root level + var BatchRenderer = BatchPluginFactory.create(); + + /*! + * @pixi/app - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/app is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Convenience class to create a new PIXI application. + * + * This class automatically creates the renderer, ticker and root container. + * + * @example + * // Create the application + * const app = new PIXI.Application(); + * + * // Add the view to the DOM + * document.body.appendChild(app.view); + * + * // ex, add display objects + * app.stage.addChild(PIXI.Sprite.from('something.png')); + * + * @class + * @memberof PIXI + */ + var Application = /** @class */ (function () { + /** + * @param {object} [options] - The optional renderer parameters. + * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. + * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set + * options.sharedTicker to true in case that it is already started. Stop it by your own. + * @param {number} [options.width=800] - The width of the renderers view. + * @param {number} [options.height=600] - The height of the renderers view. + * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. + * @param {boolean} [options.transparent=false] - If the render view is transparent. + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1. + * @param {boolean} [options.antialias=false] - Sets antialias + * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you + * need to call toDataUrl on the WebGL context. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2. + * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this + * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise + * it is ignored. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" + * for devices with dual graphics card. **(WebGL only)**. + * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker. + * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker. + * The system ticker will always run before both the shared ticker and the app ticker. + * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader. + * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to. + */ + function Application(options) { + var _this = this; + // The default options + options = Object.assign({ + forceCanvas: false, + }, options); + /** + * WebGL renderer if available, otherwise CanvasRenderer. + * @member {PIXI.Renderer|PIXI.CanvasRenderer} + */ + this.renderer = autoDetectRenderer(options); + /** + * The root display container that's rendered. + * @member {PIXI.Container} + */ + this.stage = new Container(); + // install plugins here + Application._plugins.forEach(function (plugin) { + plugin.init.call(_this, options); + }); + } + /** + * Register a middleware plugin for the application + * @static + * @param {PIXI.Application.Plugin} plugin - Plugin being installed + */ + Application.registerPlugin = function (plugin) { + Application._plugins.push(plugin); + }; + /** + * Render the current stage. + */ + Application.prototype.render = function () { + // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject + // This can be fixed when CanvasRenderer is converted. + this.renderer.render(this.stage); + }; + Object.defineProperty(Application.prototype, "view", { + /** + * Reference to the renderer's canvas element. + * @member {HTMLCanvasElement} + * @readonly + */ + get: function () { + return this.renderer.view; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Application.prototype, "screen", { + /** + * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. + * @member {PIXI.Rectangle} + * @readonly + */ + get: function () { + return this.renderer.screen; + }, + enumerable: false, + configurable: true + }); + /** + * Destroy and don't use after this. + * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM. + * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy + * method called as well. 'stageOptions' will be passed on to those calls. + * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the texture of the child sprite + * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the base texture of the child sprite + */ + Application.prototype.destroy = function (removeView, stageOptions) { + var _this = this; + // Destroy plugins in the opposite order + // which they were constructed + var plugins = Application._plugins.slice(0); + plugins.reverse(); + plugins.forEach(function (plugin) { + plugin.destroy.call(_this); + }); + this.stage.destroy(stageOptions); + this.stage = null; + this.renderer.destroy(removeView); + this.renderer = null; + }; + return Application; + }()); + /** + * @memberof PIXI.Application + * @typedef {object} Plugin + * @property {function} init - Called when Application is constructed, scoped to Application instance. + * Passes in `options` as the only argument, which are Application constructor options. + * @property {function} destroy - Called when destroying Application, scoped to Application instance + */ + /** + * Collection of installed plugins. + * @static + * @private + * @type {PIXI.Application.Plugin[]} + */ + Application._plugins = []; + + /** + * Middleware for for Application's resize functionality + * @private + * @class + */ + var ResizePlugin = /** @class */ (function () { + function ResizePlugin() { + } + /** + * Initialize the plugin with scope of application instance + * @static + * @private + * @param {object} [options] - See application options + */ + ResizePlugin.init = function (options) { + var _this = this; + /** + * The HTML element or window to automatically resize the + * renderer's view element to match width and height. + * @type {Window|HTMLElement} + * @name resizeTo + * @memberof PIXI.Application# + */ + Object.defineProperty(this, 'resizeTo', { + set: function (dom) { + window.removeEventListener('resize', this.queueResize); + this._resizeTo = dom; + if (dom) { + window.addEventListener('resize', this.queueResize); + this.resize(); + } + }, + get: function () { + return this._resizeTo; + }, + }); + /** + * Resize is throttled, so it's + * safe to call this multiple times per frame and it'll + * only be called once. + * @method PIXI.Application#queueResize + */ + this.queueResize = function () { + if (!_this._resizeTo) { + return; + } + _this.cancelResize(); + // // Throttle resize events per raf + _this._resizeId = requestAnimationFrame(function () { return _this.resize(); }); + }; + /** + * Cancel the resize queue. + * @method PIXI.Application#cancelResize + * @private + */ + this.cancelResize = function () { + if (_this._resizeId) { + cancelAnimationFrame(_this._resizeId); + _this._resizeId = null; + } + }; + /** + * Execute an immediate resize on the renderer, this is not + * throttled and can be expensive to call many times in a row. + * Will resize only if `resizeTo` property is set. + * @method PIXI.Application#resize + */ + this.resize = function () { + if (!_this._resizeTo) { + return; + } + // clear queue resize + _this.cancelResize(); + var width; + var height; + // Resize to the window + if (_this._resizeTo === window) { + width = window.innerWidth; + height = window.innerHeight; + } + // Resize to other HTML entities + else { + var _a = _this._resizeTo, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight; + width = clientWidth; + height = clientHeight; + } + _this.renderer.resize(width, height); + }; + // On resize + this._resizeId = null; + this._resizeTo = null; + this.resizeTo = options.resizeTo || null; + }; + /** + * Clean up the ticker, scoped to application + * @static + * @private + */ + ResizePlugin.destroy = function () { + window.removeEventListener('resize', this.queueResize); + this.cancelResize(); + this.cancelResize = null; + this.queueResize = null; + this.resizeTo = null; + this.resize = null; + }; + return ResizePlugin; + }()); + + Application.registerPlugin(ResizePlugin); + + /*! + * @pixi/extract - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/extract is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + var TEMP_RECT = new Rectangle(); + var BYTES_PER_PIXEL = 4; + /** + * This class provides renderer-specific plugins for exporting content from a renderer. + * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels). + * + * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. + * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. + * @example + * // Create a new app (will auto-add extract plugin to renderer) + * const app = new PIXI.Application(); + * + * // Draw a red circle + * const graphics = new PIXI.Graphics() + * .beginFill(0xFF0000) + * .drawCircle(0, 0, 50); + * + * // Render the graphics as an HTMLImageElement + * const image = app.renderer.plugins.extract.image(graphics); + * document.body.appendChild(image); + * @class + * @memberof PIXI + */ + var Extract = /** @class */ (function () { + /** + * @param {PIXI.Renderer} renderer - A reference to the current renderer + */ + function Extract(renderer) { + this.renderer = renderer; + /** + * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture + * + * @member {PIXI.Extract} extract + * @memberof PIXI.Renderer# + * @see PIXI.Extract + */ + renderer.extract = this; + } + /** + * Will return a HTML Image of the target + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". + * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. + * @return {HTMLImageElement} HTML Image of the target + */ + Extract.prototype.image = function (target, format, quality) { + var image = new Image(); + image.src = this.base64(target, format, quality); + return image; + }; + /** + * Will return a a base64 encoded string of this target. It works by calling + * `Extract.getCanvas` and then running toDataURL on that. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". + * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. + * @return {string} A base64 encoded string of the texture. + */ + Extract.prototype.base64 = function (target, format, quality) { + return this.canvas(target).toDataURL(format, quality); + }; + /** + * Creates a Canvas element, renders this target to it and then returns it. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ + Extract.prototype.canvas = function (target) { + var renderer = this.renderer; + var resolution; + var frame; + var flipY = false; + var renderTexture; + var generated = false; + if (target) { + if (target instanceof RenderTexture) { + renderTexture = target; + } + else { + renderTexture = this.renderer.generateTexture(target); + generated = true; + } + } + if (renderTexture) { + resolution = renderTexture.baseTexture.resolution; + frame = renderTexture.frame; + flipY = false; + renderer.renderTexture.bind(renderTexture); + } + else { + resolution = this.renderer.resolution; + flipY = true; + frame = TEMP_RECT; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + renderer.renderTexture.bind(null); + } + var width = Math.floor((frame.width * resolution) + 1e-4); + var height = Math.floor((frame.height * resolution) + 1e-4); + var canvasBuffer = new CanvasRenderTarget(width, height, 1); + var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); + // add the pixels to the canvas + var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); + Extract.arrayPostDivide(webglPixels, canvasData.data); + canvasBuffer.context.putImageData(canvasData, 0, 0); + // pulling pixels + if (flipY) { + var target_1 = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1); + target_1.context.scale(1, -1); + // we can't render to itself because we should be empty before render. + target_1.context.drawImage(canvasBuffer.canvas, 0, -height); + canvasBuffer.destroy(); + canvasBuffer = target_1; + } + if (generated) { + renderTexture.destroy(true); + } + // send the canvas back.. + return canvasBuffer.canvas; + }; + /** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA + * order, with integer values between 0 and 255 (included). + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture + */ + Extract.prototype.pixels = function (target) { + var renderer = this.renderer; + var resolution; + var frame; + var renderTexture; + var generated = false; + if (target) { + if (target instanceof RenderTexture) { + renderTexture = target; + } + else { + renderTexture = this.renderer.generateTexture(target); + generated = true; + } + } + if (renderTexture) { + resolution = renderTexture.baseTexture.resolution; + frame = renderTexture.frame; + // bind the buffer + renderer.renderTexture.bind(renderTexture); + } + else { + resolution = renderer.resolution; + frame = TEMP_RECT; + frame.width = renderer.width; + frame.height = renderer.height; + renderer.renderTexture.bind(null); + } + var width = frame.width * resolution; + var height = frame.height * resolution; + var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); + if (generated) { + renderTexture.destroy(true); + } + Extract.arrayPostDivide(webglPixels, webglPixels); + return webglPixels; + }; + /** + * Destroys the extract + * + */ + Extract.prototype.destroy = function () { + this.renderer.extract = null; + this.renderer = null; + }; + /** + * Takes premultiplied pixel data and produces regular pixel data + * + * @private + * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data + * @param out {number[] | Uint8Array | Uint8ClampedArray} output array + */ + Extract.arrayPostDivide = function (pixels, out) { + for (var i = 0; i < pixels.length; i += 4) { + var alpha = out[i + 3] = pixels[i + 3]; + if (alpha !== 0) { + out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0)); + out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0)); + out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0)); + } + else { + out[i] = pixels[i]; + out[i + 1] = pixels[i + 1]; + out[i + 2] = pixels[i + 2]; + } + } + }; + return Extract; + }()); + + 'use strict'; + + var src = function (str, opts) { + if ( opts === void 0 ) opts = {}; + + if (!str) { return undefined } + + var o = { + key: [ + 'source', + 'protocol', + 'authority', + 'userInfo', + 'user', + 'password', + 'host', + 'port', + 'relative', + 'path', + 'directory', + 'file', + 'query', + 'anchor' + ], + q: { + name: 'queryKey', + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + parser: { + strict: /^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, + loose: /^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/ + } + }; + + var m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str); + var uri = {}; + var i = 14; + + while (i--) { uri[o.key[i]] = m[i] || ''; } + + uri[o.q.name] = {}; + uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { + if ($1) { uri[o.q.name][$1] = $2; } + }); + + return uri + }; + + var miniSignals = createCommonjsModule(function (module, exports) { + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var MiniSignalBinding = (function () { + function MiniSignalBinding(fn, once, thisArg) { + if (once === undefined) { once = false; } + + _classCallCheck(this, MiniSignalBinding); + + this._fn = fn; + this._once = once; + this._thisArg = thisArg; + this._next = this._prev = this._owner = null; + } + + _createClass(MiniSignalBinding, [{ + key: 'detach', + value: function detach() { + if (this._owner === null) { return false; } + this._owner.detach(this); + return true; + } + }]); + + return MiniSignalBinding; + })(); + + function _addMiniSignalBinding(self, node) { + if (!self._head) { + self._head = node; + self._tail = node; + } else { + self._tail._next = node; + node._prev = self._tail; + self._tail = node; + } + + node._owner = self; + + return node; + } + + var MiniSignal = (function () { + function MiniSignal() { + _classCallCheck(this, MiniSignal); + + this._head = this._tail = undefined; + } + + _createClass(MiniSignal, [{ + key: 'handlers', + value: function handlers() { + var exists = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + var node = this._head; + + if (exists) { return !!node; } + + var ee = []; + + while (node) { + ee.push(node); + node = node._next; + } + + return ee; + } + }, { + key: 'has', + value: function has(node) { + if (!(node instanceof MiniSignalBinding)) { + throw new Error('MiniSignal#has(): First arg must be a MiniSignalBinding object.'); + } + + return node._owner === this; + } + }, { + key: 'dispatch', + value: function dispatch() { + var arguments$1 = arguments; + + var node = this._head; + + if (!node) { return false; } + + while (node) { + if (node._once) { this.detach(node); } + node._fn.apply(node._thisArg, arguments$1); + node = node._next; + } + + return true; + } + }, { + key: 'add', + value: function add(fn) { + var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (typeof fn !== 'function') { + throw new Error('MiniSignal#add(): First arg must be a Function.'); + } + return _addMiniSignalBinding(this, new MiniSignalBinding(fn, false, thisArg)); + } + }, { + key: 'once', + value: function once(fn) { + var thisArg = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (typeof fn !== 'function') { + throw new Error('MiniSignal#once(): First arg must be a Function.'); + } + return _addMiniSignalBinding(this, new MiniSignalBinding(fn, true, thisArg)); + } + }, { + key: 'detach', + value: function detach(node) { + if (!(node instanceof MiniSignalBinding)) { + throw new Error('MiniSignal#detach(): First arg must be a MiniSignalBinding object.'); + } + if (node._owner !== this) { return this; } + + if (node._prev) { node._prev._next = node._next; } + if (node._next) { node._next._prev = node._prev; } + + if (node === this._head) { + this._head = node._next; + if (node._next === null) { + this._tail = null; + } + } else if (node === this._tail) { + this._tail = node._prev; + this._tail._next = null; + } + + node._owner = null; + return this; + } + }, { + key: 'detachAll', + value: function detachAll() { + var node = this._head; + if (!node) { return this; } + + this._head = this._tail = null; + + while (node) { + node._owner = null; + node = node._next; + } + return this; + } + }]); + + return MiniSignal; + })(); + + MiniSignal.MiniSignalBinding = MiniSignalBinding; + + exports['default'] = MiniSignal; + module.exports = exports['default']; + }); + + var Signal = unwrapExports(miniSignals); + + /*! + * resource-loader - v3.0.1 + * https://github.com/pixijs/pixi-sound + * Compiled Tue, 02 Jul 2019 14:06:18 UTC + * + * resource-loader is licensed under the MIT license. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Smaller version of the async library constructs. + * + * @namespace async + */ + + /** + * Noop function + * + * @ignore + * @function + * @memberof async + */ + function _noop() {} + /* empty */ + + /** + * Iterates an array in series. + * + * @memberof async + * @function eachSeries + * @param {Array.<*>} array - Array to iterate. + * @param {function} iterator - Function to call for each element. + * @param {function} callback - Function to call when done, or on error. + * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1. + */ + + + function eachSeries(array, iterator, callback, deferNext) { + var i = 0; + var len = array.length; + + (function next(err) { + if (err || i === len) { + if (callback) { + callback(err); + } + + return; + } + + if (deferNext) { + setTimeout(function () { + iterator(array[i++], next); + }, 1); + } else { + iterator(array[i++], next); + } + })(); + } + /** + * Ensures a function is only called once. + * + * @ignore + * @memberof async + * @param {function} fn - The function to wrap. + * @return {function} The wrapping function. + */ + + function onlyOnce(fn) { + return function onceWrapper() { + if (fn === null) { + throw new Error('Callback was already called.'); + } + + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; + } + /** + * Async queue implementation, + * + * @memberof async + * @function queue + * @param {function} worker - The worker function to call for each task. + * @param {number} concurrency - How many workers to run in parrallel. + * @return {*} The async queue object. + */ + + + function queue(worker, concurrency) { + if (concurrency == null) { + // eslint-disable-line no-eq-null,eqeqeq + concurrency = 1; + } else if (concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + + var workers = 0; + var q = { + _tasks: [], + concurrency: concurrency, + saturated: _noop, + unsaturated: _noop, + buffer: concurrency / 4, + empty: _noop, + drain: _noop, + error: _noop, + started: false, + paused: false, + push: function push(data, callback) { + _insert(data, false, callback); + }, + kill: function kill() { + workers = 0; + q.drain = _noop; + q.started = false; + q._tasks = []; + }, + unshift: function unshift(data, callback) { + _insert(data, true, callback); + }, + process: function process() { + while (!q.paused && workers < q.concurrency && q._tasks.length) { + var task = q._tasks.shift(); + + if (q._tasks.length === 0) { + q.empty(); + } + + workers += 1; + + if (workers === q.concurrency) { + q.saturated(); + } + + worker(task.data, onlyOnce(_next(task))); + } + }, + length: function length() { + return q._tasks.length; + }, + running: function running() { + return workers; + }, + idle: function idle() { + return q._tasks.length + workers === 0; + }, + pause: function pause() { + if (q.paused === true) { + return; + } + + q.paused = true; + }, + resume: function resume() { + if (q.paused === false) { + return; + } + + q.paused = false; // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + + for (var w = 1; w <= q.concurrency; w++) { + q.process(); + } + } + }; + + function _insert(data, insertAtFront, callback) { + if (callback != null && typeof callback !== 'function') { + // eslint-disable-line no-eq-null,eqeqeq + throw new Error('task callback must be a function'); + } + + q.started = true; + + if (data == null && q.idle()) { + // eslint-disable-line no-eq-null,eqeqeq + // call drain immediately if there are no tasks + setTimeout(function () { + return q.drain(); + }, 1); + return; + } + + var item = { + data: data, + callback: typeof callback === 'function' ? callback : _noop + }; + + if (insertAtFront) { + q._tasks.unshift(item); + } else { + q._tasks.push(item); + } + + setTimeout(function () { + return q.process(); + }, 1); + } + + function _next(task) { + return function next() { + workers -= 1; + task.callback.apply(task, arguments); + + if (arguments[0] != null) { + // eslint-disable-line no-eq-null,eqeqeq + q.error(arguments[0], task.data); + } + + if (workers <= q.concurrency - q.buffer) { + q.unsaturated(); + } + + if (q.idle()) { + q.drain(); + } + + q.process(); + }; + } + + return q; + } + + var async = ({ + eachSeries: eachSeries, + queue: queue + }); + + // a simple in-memory cache for resources + var cache = {}; + /** + * A simple in-memory cache for resource. + * + * @memberof middleware + * @function caching + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.caching); + * @param {Resource} resource - Current Resource + * @param {function} next - Callback when complete + */ + + function caching(resource, next) { + var _this = this; + + // if cached, then set data and complete the resource + if (cache[resource.url]) { + resource.data = cache[resource.url]; + resource.complete(); // marks resource load complete and stops processing before middlewares + } // if not cached, wait for complete and store it in the cache. + else { + resource.onComplete.once(function () { + return cache[_this.url] = _this.data; + }); + } + + next(); + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) { descriptor.writable = true; } + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) { _defineProperties(Constructor.prototype, protoProps); } + if (staticProps) { _defineProperties(Constructor, staticProps); } + return Constructor; + } + + var useXdr = !!(window.XDomainRequest && !('withCredentials' in new XMLHttpRequest())); + var tempAnchor$1 = null; // some status constants + + var STATUS_NONE = 0; + var STATUS_OK = 200; + var STATUS_EMPTY = 204; + var STATUS_IE_BUG_EMPTY = 1223; + var STATUS_TYPE_OK = 2; // noop + + function _noop$1() {} + /* empty */ + + /** + * Manages the state and loading of a resource and all child resources. + * + * @class + */ + + + var Resource$1 = + /*#__PURE__*/ + function () { + /** + * Sets the load type to be used for a specific extension. + * + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {Resource.LOAD_TYPE} loadType - The load type to set it to. + */ + Resource.setExtensionLoadType = function setExtensionLoadType(extname, loadType) { + setExtMap(Resource._loadTypeMap, extname, loadType); + } + /** + * Sets the load type to be used for a specific extension. + * + * @static + * @param {string} extname - The extension to set the type for, e.g. "png" or "fnt" + * @param {Resource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to. + */ + ; + + Resource.setExtensionXhrType = function setExtensionXhrType(extname, xhrType) { + setExtMap(Resource._xhrTypeMap, extname, xhrType); + } + /** + * @param {string} name - The name of the resource to load. + * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass + * an array of sources. + * @param {object} [options] - The options for the load. + * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @param {Resource.IMetadata} [options.metadata] - Extra configuration for middleware and the Resource object. + */ + ; + + function Resource(name, url, options) { + if (typeof name !== 'string' || typeof url !== 'string') { + throw new Error('Both name and url are required for constructing a resource.'); + } + + options = options || {}; + /** + * The state flags of this resource. + * + * @private + * @member {number} + */ + + this._flags = 0; // set data url flag, needs to be set early for some _determineX checks to work. + + this._setFlag(Resource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0); + /** + * The name of this resource. + * + * @readonly + * @member {string} + */ + + + this.name = name; + /** + * The url used to load this resource. + * + * @readonly + * @member {string} + */ + + this.url = url; + /** + * The extension used to load this resource. + * + * @readonly + * @member {string} + */ + + this.extension = this._getExtension(); + /** + * The data that was loaded by the resource. + * + * @member {any} + */ + + this.data = null; + /** + * Is this request cross-origin? If unset, determined automatically. + * + * @member {string} + */ + + this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin; + /** + * A timeout in milliseconds for the load. If the load takes longer than this time + * it is cancelled and the load is considered a failure. If this value is set to `0` + * then there is no explicit timeout. + * + * @member {number} + */ + + this.timeout = options.timeout || 0; + /** + * The method of loading to use for this resource. + * + * @member {Resource.LOAD_TYPE} + */ + + this.loadType = options.loadType || this._determineLoadType(); + /** + * The type used to load the resource via XHR. If unset, determined automatically. + * + * @member {string} + */ + + this.xhrType = options.xhrType; + /** + * Extra info for middleware, and controlling specifics about how the resource loads. + * + * Note that if you pass in a `loadElement`, the Resource class takes ownership of it. + * Meaning it will modify it as it sees fit. + * + * @member {Resource.IMetadata} + */ + + this.metadata = options.metadata || {}; + /** + * The error that occurred while loading (if any). + * + * @readonly + * @member {Error} + */ + + this.error = null; + /** + * The XHR object that was used to load this resource. This is only set + * when `loadType` is `Resource.LOAD_TYPE.XHR`. + * + * @readonly + * @member {XMLHttpRequest} + */ + + this.xhr = null; + /** + * The child resources this resource owns. + * + * @readonly + * @member {Resource[]} + */ + + this.children = []; + /** + * The resource type. + * + * @readonly + * @member {Resource.TYPE} + */ + + this.type = Resource.TYPE.UNKNOWN; + /** + * The progress chunk owned by this resource. + * + * @readonly + * @member {number} + */ + + this.progressChunk = 0; + /** + * The `dequeue` method that will be used a storage place for the async queue dequeue method + * used privately by the loader. + * + * @private + * @member {function} + */ + + this._dequeue = _noop$1; + /** + * Used a storage place for the on load binding used privately by the loader. + * + * @private + * @member {function} + */ + + this._onLoadBinding = null; + /** + * The timer for element loads to check if they timeout. + * + * @private + * @member {number} + */ + + this._elementTimer = 0; + /** + * The `complete` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundComplete = this.complete.bind(this); + /** + * The `_onError` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundOnError = this._onError.bind(this); + /** + * The `_onProgress` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundOnProgress = this._onProgress.bind(this); + /** + * The `_onTimeout` function bound to this resource's context. + * + * @private + * @member {function} + */ + + this._boundOnTimeout = this._onTimeout.bind(this); // xhr callbacks + + this._boundXhrOnError = this._xhrOnError.bind(this); + this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this); + this._boundXhrOnAbort = this._xhrOnAbort.bind(this); + this._boundXhrOnLoad = this._xhrOnLoad.bind(this); + /** + * Dispatched when the resource beings to load. + * + * The callback looks like {@link Resource.OnStartSignal}. + * + * @member {Signal} + */ + + this.onStart = new Signal(); + /** + * Dispatched each time progress of this resource load updates. + * Not all resources types and loader systems can support this event + * so sometimes it may not be available. If the resource + * is being loaded on a modern browser, using XHR, and the remote server + * properly sets Content-Length headers, then this will be available. + * + * The callback looks like {@link Resource.OnProgressSignal}. + * + * @member {Signal} + */ + + this.onProgress = new Signal(); + /** + * Dispatched once this resource has loaded, if there was an error it will + * be in the `error` property. + * + * The callback looks like {@link Resource.OnCompleteSignal}. + * + * @member {Signal} + */ + + this.onComplete = new Signal(); + /** + * Dispatched after this resource has had all the *after* middleware run on it. + * + * The callback looks like {@link Resource.OnCompleteSignal}. + * + * @member {Signal} + */ + + this.onAfterMiddleware = new Signal(); + } + /** + * When the resource starts to load. + * + * @memberof Resource + * @callback OnStartSignal + * @param {Resource} resource - The resource that the event happened on. + */ + + /** + * When the resource reports loading progress. + * + * @memberof Resource + * @callback OnProgressSignal + * @param {Resource} resource - The resource that the event happened on. + * @param {number} percentage - The progress of the load in the range [0, 1]. + */ + + /** + * When the resource finishes loading. + * + * @memberof Resource + * @callback OnCompleteSignal + * @param {Resource} resource - The resource that the event happened on. + */ + + /** + * @memberof Resource + * @typedef {object} IMetadata + * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The + * element to use for loading, instead of creating one. + * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This + * is useful if you want to pass in a `loadElement` that you already added load sources to. + * @property {string|string[]} [mimeType] - The mime type to use for the source element + * of a video/audio elment. If the urls are an array, you can pass this as an array as well + * where each index is the mime type to use for the corresponding url index. + */ + + /** + * Stores whether or not this url is a data url. + * + * @readonly + * @member {boolean} + */ + + + var _proto = Resource.prototype; + + /** + * Marks the resource as complete. + * + */ + _proto.complete = function complete() { + this._clearEvents(); + + this._finish(); + } + /** + * Aborts the loading of this resource, with an optional message. + * + * @param {string} message - The message to use for the error + */ + ; + + _proto.abort = function abort(message) { + // abort can be called multiple times, ignore subsequent calls. + if (this.error) { + return; + } // store error + + + this.error = new Error(message); // clear events before calling aborts + + this._clearEvents(); // abort the actual loading + + + if (this.xhr) { + this.xhr.abort(); + } else if (this.xdr) { + this.xdr.abort(); + } else if (this.data) { + // single source + if (this.data.src) { + this.data.src = Resource.EMPTY_GIF; + } // multi-source + else { + while (this.data.firstChild) { + this.data.removeChild(this.data.firstChild); + } + } + } // done now. + + + this._finish(); + } + /** + * Kicks off loading of this resource. This method is asynchronous. + * + * @param {Resource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded. + */ + ; + + _proto.load = function load(cb) { + var _this = this; + + if (this.isLoading) { + return; + } + + if (this.isComplete) { + if (cb) { + setTimeout(function () { + return cb(_this); + }, 1); + } + + return; + } else if (cb) { + this.onComplete.once(cb); + } + + this._setFlag(Resource.STATUS_FLAGS.LOADING, true); + + this.onStart.dispatch(this); // if unset, determine the value + + if (this.crossOrigin === false || typeof this.crossOrigin !== 'string') { + this.crossOrigin = this._determineCrossOrigin(this.url); + } + + switch (this.loadType) { + case Resource.LOAD_TYPE.IMAGE: + this.type = Resource.TYPE.IMAGE; + + this._loadElement('image'); + + break; + + case Resource.LOAD_TYPE.AUDIO: + this.type = Resource.TYPE.AUDIO; + + this._loadSourceElement('audio'); + + break; + + case Resource.LOAD_TYPE.VIDEO: + this.type = Resource.TYPE.VIDEO; + + this._loadSourceElement('video'); + + break; + + case Resource.LOAD_TYPE.XHR: + /* falls through */ + + default: + if (useXdr && this.crossOrigin) { + this._loadXdr(); + } else { + this._loadXhr(); + } + + break; + } + } + /** + * Checks if the flag is set. + * + * @private + * @param {number} flag - The flag to check. + * @return {boolean} True if the flag is set. + */ + ; + + _proto._hasFlag = function _hasFlag(flag) { + return (this._flags & flag) !== 0; + } + /** + * (Un)Sets the flag. + * + * @private + * @param {number} flag - The flag to (un)set. + * @param {boolean} value - Whether to set or (un)set the flag. + */ + ; + + _proto._setFlag = function _setFlag(flag, value) { + this._flags = value ? this._flags | flag : this._flags & ~flag; + } + /** + * Clears all the events from the underlying loading source. + * + * @private + */ + ; + + _proto._clearEvents = function _clearEvents() { + clearTimeout(this._elementTimer); + + if (this.data && this.data.removeEventListener) { + this.data.removeEventListener('error', this._boundOnError, false); + this.data.removeEventListener('load', this._boundComplete, false); + this.data.removeEventListener('progress', this._boundOnProgress, false); + this.data.removeEventListener('canplaythrough', this._boundComplete, false); + } + + if (this.xhr) { + if (this.xhr.removeEventListener) { + this.xhr.removeEventListener('error', this._boundXhrOnError, false); + this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false); + this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false); + this.xhr.removeEventListener('progress', this._boundOnProgress, false); + this.xhr.removeEventListener('load', this._boundXhrOnLoad, false); + } else { + this.xhr.onerror = null; + this.xhr.ontimeout = null; + this.xhr.onprogress = null; + this.xhr.onload = null; + } + } + } + /** + * Finalizes the load. + * + * @private + */ + ; + + _proto._finish = function _finish() { + if (this.isComplete) { + throw new Error('Complete called again for an already completed resource.'); + } + + this._setFlag(Resource.STATUS_FLAGS.COMPLETE, true); + + this._setFlag(Resource.STATUS_FLAGS.LOADING, false); + + this.onComplete.dispatch(this); + } + /** + * Loads this resources using an element that has a single source, + * like an HTMLImageElement. + * + * @private + * @param {string} type - The type of element to use. + */ + ; + + _proto._loadElement = function _loadElement(type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } else if (type === 'image' && typeof window.Image !== 'undefined') { + this.data = new Image(); + } else { + this.data = document.createElement(type); + } + + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + + if (!this.metadata.skipSource) { + this.data.src = this.url; + } + + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + } + /** + * Loads this resources using an element that has multiple sources, + * like an HTMLAudioElement or HTMLVideoElement. + * + * @private + * @param {string} type - The type of element to use. + */ + ; + + _proto._loadSourceElement = function _loadSourceElement(type) { + if (this.metadata.loadElement) { + this.data = this.metadata.loadElement; + } else if (type === 'audio' && typeof window.Audio !== 'undefined') { + this.data = new Audio(); + } else { + this.data = document.createElement(type); + } + + if (this.data === null) { + this.abort("Unsupported element: " + type); + return; + } + + if (this.crossOrigin) { + this.data.crossOrigin = this.crossOrigin; + } + + if (!this.metadata.skipSource) { + // support for CocoonJS Canvas+ runtime, lacks document.createElement('source') + if (navigator.isCocoonJS) { + this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; + } else if (Array.isArray(this.url)) { + var mimeTypes = this.metadata.mimeType; + + for (var i = 0; i < this.url.length; ++i) { + this.data.appendChild(this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)); + } + } else { + var _mimeTypes = this.metadata.mimeType; + this.data.appendChild(this._createSource(type, this.url, Array.isArray(_mimeTypes) ? _mimeTypes[0] : _mimeTypes)); + } + } + + this.data.addEventListener('error', this._boundOnError, false); + this.data.addEventListener('load', this._boundComplete, false); + this.data.addEventListener('progress', this._boundOnProgress, false); + this.data.addEventListener('canplaythrough', this._boundComplete, false); + this.data.load(); + + if (this.timeout) { + this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout); + } + } + /** + * Loads this resources using an XMLHttpRequest. + * + * @private + */ + ; + + _proto._loadXhr = function _loadXhr() { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + + var xhr = this.xhr = new XMLHttpRequest(); // set the request type and url + + xhr.open('GET', this.url, true); + xhr.timeout = this.timeout; // load json as text and parse it ourselves. We do this because some browsers + // *cough* safari *cough* can't deal with it. + + if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { + xhr.responseType = Resource.XHR_RESPONSE_TYPE.TEXT; + } else { + xhr.responseType = this.xhrType; + } + + xhr.addEventListener('error', this._boundXhrOnError, false); + xhr.addEventListener('timeout', this._boundXhrOnTimeout, false); + xhr.addEventListener('abort', this._boundXhrOnAbort, false); + xhr.addEventListener('progress', this._boundOnProgress, false); + xhr.addEventListener('load', this._boundXhrOnLoad, false); + xhr.send(); + } + /** + * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross). + * + * @private + */ + ; + + _proto._loadXdr = function _loadXdr() { + // if unset, determine the value + if (typeof this.xhrType !== 'string') { + this.xhrType = this._determineXhrType(); + } + + var xdr = this.xhr = new XDomainRequest(); // eslint-disable-line no-undef + // XDomainRequest has a few quirks. Occasionally it will abort requests + // A way to avoid this is to make sure ALL callbacks are set even if not used + // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9 + + xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9 + + xdr.onerror = this._boundXhrOnError; + xdr.ontimeout = this._boundXhrOnTimeout; + xdr.onprogress = this._boundOnProgress; + xdr.onload = this._boundXhrOnLoad; + xdr.open('GET', this.url, true); // Note: The xdr.send() call is wrapped in a timeout to prevent an + // issue with the interface where some requests are lost if multiple + // XDomainRequests are being sent at the same time. + // Some info here: https://github.com/photonstorm/phaser/issues/1248 + + setTimeout(function () { + return xdr.send(); + }, 1); + } + /** + * Creates a source used in loading via an element. + * + * @private + * @param {string} type - The element type (video or audio). + * @param {string} url - The source URL to load from. + * @param {string} [mime] - The mime type of the video + * @return {HTMLSourceElement} The source element. + */ + ; + + _proto._createSource = function _createSource(type, url, mime) { + if (!mime) { + mime = type + "/" + this._getExtension(url); + } + + var source = document.createElement('source'); + source.src = url; + source.type = mime; + return source; + } + /** + * Called if a load errors out. + * + * @param {Event} event - The error event from the element that emits it. + * @private + */ + ; + + _proto._onError = function _onError(event) { + this.abort("Failed to load element using: " + event.target.nodeName); + } + /** + * Called if a load progress event fires for an element or xhr/xdr. + * + * @private + * @param {XMLHttpRequestProgressEvent|Event} event - Progress event. + */ + ; + + _proto._onProgress = function _onProgress(event) { + if (event && event.lengthComputable) { + this.onProgress.dispatch(this, event.loaded / event.total); + } + } + /** + * Called if a timeout event fires for an element. + * + * @private + */ + ; + + _proto._onTimeout = function _onTimeout() { + this.abort("Load timed out."); + } + /** + * Called if an error event fires for xhr/xdr. + * + * @private + */ + ; + + _proto._xhrOnError = function _xhrOnError() { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request failed. Status: " + xhr.status + ", text: \"" + xhr.statusText + "\""); + } + /** + * Called if an error event fires for xhr/xdr. + * + * @private + */ + ; + + _proto._xhrOnTimeout = function _xhrOnTimeout() { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request timed out."); + } + /** + * Called if an abort event fires for xhr/xdr. + * + * @private + */ + ; + + _proto._xhrOnAbort = function _xhrOnAbort() { + var xhr = this.xhr; + this.abort(reqType(xhr) + " Request was aborted by the user."); + } + /** + * Called when data successfully loads from an xhr/xdr request. + * + * @private + * @param {XMLHttpRequestLoadEvent|Event} event - Load event + */ + ; + + _proto._xhrOnLoad = function _xhrOnLoad() { + var xhr = this.xhr; + var text = ''; + var status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200. + // responseText is accessible only if responseType is '' or 'text' and on older browsers + + if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined') { + text = xhr.responseText; + } // status can be 0 when using the `file://` protocol so we also check if a response is set. + // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request. + + + if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER)) { + status = STATUS_OK; + } // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + else if (status === STATUS_IE_BUG_EMPTY) { + status = STATUS_EMPTY; + } + + var statusType = status / 100 | 0; + + if (statusType === STATUS_TYPE_OK) { + // if text, just return it + if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) { + this.data = text; + this.type = Resource.TYPE.TEXT; + } // if json, parse into json object + else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) { + try { + this.data = JSON.parse(text); + this.type = Resource.TYPE.JSON; + } catch (e) { + this.abort("Error trying to parse loaded json: " + e); + return; + } + } // if xml, parse into an xml document or div element + else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) { + try { + if (window.DOMParser) { + var domparser = new DOMParser(); + this.data = domparser.parseFromString(text, 'text/xml'); + } else { + var div = document.createElement('div'); + div.innerHTML = text; + this.data = div; + } + + this.type = Resource.TYPE.XML; + } catch (e) { + this.abort("Error trying to parse loaded xml: " + e); + return; + } + } // other types just return the response + else { + this.data = xhr.response || text; + } + } else { + this.abort("[" + xhr.status + "] " + xhr.statusText + ": " + xhr.responseURL); + return; + } + + this.complete(); + } + /** + * Sets the `crossOrigin` property for this resource based on if the url + * for this resource is cross-origin. If crossOrigin was manually set, this + * function does nothing. + * + * @private + * @param {string} url - The url to test. + * @param {object} [loc=window.location] - The location object to test against. + * @return {string} The crossOrigin value to use (or empty string for none). + */ + ; + + _proto._determineCrossOrigin = function _determineCrossOrigin(url, loc) { + // data: and javascript: urls are considered same-origin + if (url.indexOf('data:') === 0) { + return ''; + } // A sandboxed iframe without the 'allow-same-origin' attribute will have a special + // origin designed not to match window.location.origin, and will always require + // crossOrigin requests regardless of whether the location matches. + + + if (window.origin !== window.location.origin) { + return 'anonymous'; + } // default is window.location + + + loc = loc || window.location; + + if (!tempAnchor$1) { + tempAnchor$1 = document.createElement('a'); + } // let the browser determine the full href for the url of this resource and then + // parse with the node url lib, we can't use the properties of the anchor element + // because they don't work in IE9 :( + + + tempAnchor$1.href = url; + url = src(tempAnchor$1.href, { + strictMode: true + }); + var samePort = !url.port && loc.port === '' || url.port === loc.port; + var protocol = url.protocol ? url.protocol + ":" : ''; // if cross origin + + if (url.host !== loc.hostname || !samePort || protocol !== loc.protocol) { + return 'anonymous'; + } + + return ''; + } + /** + * Determines the responseType of an XHR request based on the extension of the + * resource being loaded. + * + * @private + * @return {Resource.XHR_RESPONSE_TYPE} The responseType to use. + */ + ; + + _proto._determineXhrType = function _determineXhrType() { + return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT; + } + /** + * Determines the loadType of a resource based on the extension of the + * resource being loaded. + * + * @private + * @return {Resource.LOAD_TYPE} The loadType to use. + */ + ; + + _proto._determineLoadType = function _determineLoadType() { + return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR; + } + /** + * Extracts the extension (sans '.') of the file being loaded by the resource. + * + * @private + * @return {string} The extension. + */ + ; + + _proto._getExtension = function _getExtension() { + var url = this.url; + var ext = ''; + + if (this.isDataUrl) { + var slashIndex = url.indexOf('/'); + ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex)); + } else { + var queryStart = url.indexOf('?'); + var hashStart = url.indexOf('#'); + var index = Math.min(queryStart > -1 ? queryStart : url.length, hashStart > -1 ? hashStart : url.length); + url = url.substring(0, index); + ext = url.substring(url.lastIndexOf('.') + 1); + } + + return ext.toLowerCase(); + } + /** + * Determines the mime type of an XHR request based on the responseType of + * resource being loaded. + * + * @private + * @param {Resource.XHR_RESPONSE_TYPE} type - The type to get a mime type for. + * @return {string} The mime type to use. + */ + ; + + _proto._getMimeFromXhrType = function _getMimeFromXhrType(type) { + switch (type) { + case Resource.XHR_RESPONSE_TYPE.BUFFER: + return 'application/octet-binary'; + + case Resource.XHR_RESPONSE_TYPE.BLOB: + return 'application/blob'; + + case Resource.XHR_RESPONSE_TYPE.DOCUMENT: + return 'application/xml'; + + case Resource.XHR_RESPONSE_TYPE.JSON: + return 'application/json'; + + case Resource.XHR_RESPONSE_TYPE.DEFAULT: + case Resource.XHR_RESPONSE_TYPE.TEXT: + /* falls through */ + + default: + return 'text/plain'; + } + }; + + _createClass(Resource, [{ + key: "isDataUrl", + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL); + } + /** + * Describes if this resource has finished loading. Is true when the resource has completely + * loaded. + * + * @readonly + * @member {boolean} + */ + + }, { + key: "isComplete", + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE); + } + /** + * Describes if this resource is currently loading. Is true when the resource starts loading, + * and is false again when complete. + * + * @readonly + * @member {boolean} + */ + + }, { + key: "isLoading", + get: function get() { + return this._hasFlag(Resource.STATUS_FLAGS.LOADING); + } + }]); + + return Resource; + }(); + /** + * The types of resources a resource could represent. + * + * @static + * @readonly + * @enum {number} + */ + + + Resource$1.STATUS_FLAGS = { + NONE: 0, + DATA_URL: 1 << 0, + COMPLETE: 1 << 1, + LOADING: 1 << 2 + }; + /** + * The types of resources a resource could represent. + * + * @static + * @readonly + * @enum {number} + */ + + Resource$1.TYPE = { + UNKNOWN: 0, + JSON: 1, + XML: 2, + IMAGE: 3, + AUDIO: 4, + VIDEO: 5, + TEXT: 6 + }; + /** + * The types of loading a resource can use. + * + * @static + * @readonly + * @enum {number} + */ + + Resource$1.LOAD_TYPE = { + /** Uses XMLHttpRequest to load the resource. */ + XHR: 1, + + /** Uses an `Image` object to load the resource. */ + IMAGE: 2, + + /** Uses an `Audio` object to load the resource. */ + AUDIO: 3, + + /** Uses a `Video` object to load the resource. */ + VIDEO: 4 + }; + /** + * The XHR ready states, used internally. + * + * @static + * @readonly + * @enum {string} + */ + + Resource$1.XHR_RESPONSE_TYPE = { + /** string */ + DEFAULT: 'text', + + /** ArrayBuffer */ + BUFFER: 'arraybuffer', + + /** Blob */ + BLOB: 'blob', + + /** Document */ + DOCUMENT: 'document', + + /** Object */ + JSON: 'json', + + /** String */ + TEXT: 'text' + }; + Resource$1._loadTypeMap = { + // images + gif: Resource$1.LOAD_TYPE.IMAGE, + png: Resource$1.LOAD_TYPE.IMAGE, + bmp: Resource$1.LOAD_TYPE.IMAGE, + jpg: Resource$1.LOAD_TYPE.IMAGE, + jpeg: Resource$1.LOAD_TYPE.IMAGE, + tif: Resource$1.LOAD_TYPE.IMAGE, + tiff: Resource$1.LOAD_TYPE.IMAGE, + webp: Resource$1.LOAD_TYPE.IMAGE, + tga: Resource$1.LOAD_TYPE.IMAGE, + svg: Resource$1.LOAD_TYPE.IMAGE, + 'svg+xml': Resource$1.LOAD_TYPE.IMAGE, + // for SVG data urls + // audio + mp3: Resource$1.LOAD_TYPE.AUDIO, + ogg: Resource$1.LOAD_TYPE.AUDIO, + wav: Resource$1.LOAD_TYPE.AUDIO, + // videos + mp4: Resource$1.LOAD_TYPE.VIDEO, + webm: Resource$1.LOAD_TYPE.VIDEO + }; + Resource$1._xhrTypeMap = { + // xml + xhtml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + html: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + htm: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + xml: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + tmx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + svg: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component. + // Since it is way less likely for people to be loading TypeScript files instead of Tiled files, + // this should probably be fine. + tsx: Resource$1.XHR_RESPONSE_TYPE.DOCUMENT, + // images + gif: Resource$1.XHR_RESPONSE_TYPE.BLOB, + png: Resource$1.XHR_RESPONSE_TYPE.BLOB, + bmp: Resource$1.XHR_RESPONSE_TYPE.BLOB, + jpg: Resource$1.XHR_RESPONSE_TYPE.BLOB, + jpeg: Resource$1.XHR_RESPONSE_TYPE.BLOB, + tif: Resource$1.XHR_RESPONSE_TYPE.BLOB, + tiff: Resource$1.XHR_RESPONSE_TYPE.BLOB, + webp: Resource$1.XHR_RESPONSE_TYPE.BLOB, + tga: Resource$1.XHR_RESPONSE_TYPE.BLOB, + // json + json: Resource$1.XHR_RESPONSE_TYPE.JSON, + // text + text: Resource$1.XHR_RESPONSE_TYPE.TEXT, + txt: Resource$1.XHR_RESPONSE_TYPE.TEXT, + // fonts + ttf: Resource$1.XHR_RESPONSE_TYPE.BUFFER, + otf: Resource$1.XHR_RESPONSE_TYPE.BUFFER + }; // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif + + Resource$1.EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='; + /** + * Quick helper to set a value on one of the extension maps. Ensures there is no + * dot at the start of the extension. + * + * @ignore + * @param {object} map - The map to set on. + * @param {string} extname - The extension (or key) to set. + * @param {number} val - The value to set. + */ + + function setExtMap(map, extname, val) { + if (extname && extname.indexOf('.') === 0) { + extname = extname.substring(1); + } + + if (!extname) { + return; + } + + map[extname] = val; + } + /** + * Quick helper to get string xhr type. + * + * @ignore + * @param {XMLHttpRequest|XDomainRequest} xhr - The request to check. + * @return {string} The type. + */ + + + function reqType(xhr) { + return xhr.toString().replace('object ', ''); + } + + var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + /** + * Encodes binary into base64. + * + * @function encodeBinary + * @param {string} input The input data to encode. + * @returns {string} The encoded base64 string + */ + + function encodeBinary(input) { + var output = ''; + var inx = 0; + + while (inx < input.length) { + // Fill byte buffer array + var bytebuffer = [0, 0, 0]; + var encodedCharIndexes = [0, 0, 0, 0]; + + for (var jnx = 0; jnx < bytebuffer.length; ++jnx) { + if (inx < input.length) { + // throw away high-order byte, as documented at: + // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data + bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff; + } else { + bytebuffer[jnx] = 0; + } + } // Get each encoded character, 6 bits at a time + // index 1: first 6 bits + + + encodedCharIndexes[0] = bytebuffer[0] >> 2; // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2) + + encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4; // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3) + + encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6; // index 3: forth 6 bits (6 least significant bits from input byte 3) + + encodedCharIndexes[3] = bytebuffer[2] & 0x3f; // Determine whether padding happened, and adjust accordingly + + var paddingBytes = inx - (input.length - 1); + + switch (paddingBytes) { + case 2: + // Set last 2 characters to padding char + encodedCharIndexes[3] = 64; + encodedCharIndexes[2] = 64; + break; + + case 1: + // Set last character to padding char + encodedCharIndexes[3] = 64; + break; + + default: + break; + // No padding - proceed + } // Now we will grab each appropriate character out of our keystring + // based on our index array and append it to the output string + + + for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) { + output += _keyStr.charAt(encodedCharIndexes[_jnx]); + } + } + + return output; + } + + var Url$1 = window.URL || window.webkitURL; + /** + * A middleware for transforming XHR loaded Blobs into more useful objects + * + * @memberof middleware + * @function parsing + * @example + * import { Loader, middleware } from 'resource-loader'; + * const loader = new Loader(); + * loader.use(middleware.parsing); + * @param {Resource} resource - Current Resource + * @param {function} next - Callback when complete + */ + + function parsing(resource, next) { + if (!resource.data) { + next(); + return; + } // if this was an XHR load of a blob + + + if (resource.xhr && resource.xhrType === Resource$1.XHR_RESPONSE_TYPE.BLOB) { + // if there is no blob support we probably got a binary string back + if (!window.Blob || typeof resource.data === 'string') { + var type = resource.xhr.getResponseHeader('content-type'); // this is an image, convert the binary string into a data url + + if (type && type.indexOf('image') === 0) { + resource.data = new Image(); + resource.data.src = "data:" + type + ";base64," + encodeBinary(resource.xhr.responseText); + resource.type = Resource$1.TYPE.IMAGE; // wait until the image loads and then callback + + resource.data.onload = function () { + resource.data.onload = null; + next(); + }; // next will be called on load + + + return; + } + } // if content type says this is an image, then we should transform the blob into an Image object + else if (resource.data.type.indexOf('image') === 0) { + var src = Url$1.createObjectURL(resource.data); + resource.blob = resource.data; + resource.data = new Image(); + resource.data.src = src; + resource.type = Resource$1.TYPE.IMAGE; // cleanup the no longer used blob after the image loads + // TODO: Is this correct? Will the image be invalid after revoking? + + resource.data.onload = function () { + Url$1.revokeObjectURL(src); + resource.data.onload = null; + next(); + }; // next will be called on load. + + + return; + } + } + + next(); + } + + /** + * @namespace middleware + */ + + var index$1 = ({ + caching: caching, + parsing: parsing + }); + + var MAX_PROGRESS = 100; + var rgxExtractUrlHash = /(#[\w-]+)?$/; + /** + * Manages the state and loading of multiple resources to load. + * + * @class + */ + + var Loader = + /*#__PURE__*/ + function () { + /** + * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. + * @param {number} [concurrency=10] - The number of resources to load concurrently. + */ + function Loader(baseUrl, concurrency) { + var _this = this; + + if (baseUrl === void 0) { + baseUrl = ''; + } + + if (concurrency === void 0) { + concurrency = 10; + } + + /** + * The base url for all resources loaded by this loader. + * + * @member {string} + */ + this.baseUrl = baseUrl; + /** + * The progress percent of the loader going through the queue. + * + * @member {number} + * @default 0 + */ + + this.progress = 0; + /** + * Loading state of the loader, true if it is currently loading resources. + * + * @member {boolean} + * @default false + */ + + this.loading = false; + /** + * A querystring to append to every URL added to the loader. + * + * This should be a valid query string *without* the question-mark (`?`). The loader will + * also *not* escape values for you. Make sure to escape your parameters with + * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property. + * + * @example + * const loader = new Loader(); + * + * loader.defaultQueryString = 'user=me&password=secret'; + * + * // This will request 'image.png?user=me&password=secret' + * loader.add('image.png').load(); + * + * loader.reset(); + * + * // This will request 'image.png?v=1&user=me&password=secret' + * loader.add('iamge.png?v=1').load(); + * + * @member {string} + * @default '' + */ + + this.defaultQueryString = ''; + /** + * The middleware to run before loading each resource. + * + * @private + * @member {function[]} + */ + + this._beforeMiddleware = []; + /** + * The middleware to run after loading each resource. + * + * @private + * @member {function[]} + */ + + this._afterMiddleware = []; + /** + * The tracks the resources we are currently completing parsing for. + * + * @private + * @member {Resource[]} + */ + + this._resourcesParsing = []; + /** + * The `_loadResource` function bound with this object context. + * + * @private + * @member {function} + * @param {Resource} r - The resource to load + * @param {Function} d - The dequeue function + * @return {undefined} + */ + + this._boundLoadResource = function (r, d) { + return _this._loadResource(r, d); + }; + /** + * The resources waiting to be loaded. + * + * @private + * @member {Resource[]} + */ + + + this._queue = queue(this._boundLoadResource, concurrency); + + this._queue.pause(); + /** + * All the resources for this loader keyed by name. + * + * @member {object} + */ + + + this.resources = {}; + /** + * Dispatched once per loaded or errored resource. + * + * The callback looks like {@link Loader.OnProgressSignal}. + * + * @member {Signal} + */ + + this.onProgress = new Signal(); + /** + * Dispatched once per errored resource. + * + * The callback looks like {@link Loader.OnErrorSignal}. + * + * @member {Signal} + */ + + this.onError = new Signal(); + /** + * Dispatched once per loaded resource. + * + * The callback looks like {@link Loader.OnLoadSignal}. + * + * @member {Signal} + */ + + this.onLoad = new Signal(); + /** + * Dispatched when the loader begins to process the queue. + * + * The callback looks like {@link Loader.OnStartSignal}. + * + * @member {Signal} + */ + + this.onStart = new Signal(); + /** + * Dispatched when the queued resources all load. + * + * The callback looks like {@link Loader.OnCompleteSignal}. + * + * @member {Signal} + */ + + this.onComplete = new Signal(); // Add default before middleware + + for (var i = 0; i < Loader._defaultBeforeMiddleware.length; ++i) { + this.pre(Loader._defaultBeforeMiddleware[i]); + } // Add default after middleware + + + for (var _i = 0; _i < Loader._defaultAfterMiddleware.length; ++_i) { + this.use(Loader._defaultAfterMiddleware[_i]); + } + } + /** + * When the progress changes the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnProgressSignal + * @param {Loader} loader - The loader the progress is advancing on. + * @param {Resource} resource - The resource that has completed or failed to cause the progress to advance. + */ + + /** + * When an error occurrs the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnErrorSignal + * @param {Loader} loader - The loader the error happened in. + * @param {Resource} resource - The resource that caused the error. + */ + + /** + * When a load completes the loader and resource are disaptched. + * + * @memberof Loader + * @callback OnLoadSignal + * @param {Loader} loader - The loader that laoded the resource. + * @param {Resource} resource - The resource that has completed loading. + */ + + /** + * When the loader starts loading resources it dispatches this callback. + * + * @memberof Loader + * @callback OnStartSignal + * @param {Loader} loader - The loader that has started loading resources. + */ + + /** + * When the loader completes loading resources it dispatches this callback. + * + * @memberof Loader + * @callback OnCompleteSignal + * @param {Loader} loader - The loader that has finished loading resources. + */ + + /** + * Options for a call to `.add()`. + * + * @see Loader#add + * + * @typedef {object} IAddOptions + * @property {string} [name] - The name of the resource to load, if not passed the url is used. + * @property {string} [key] - Alias for `name`. + * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader. + * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to + * determine automatically. + * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes + * longer than this time it is cancelled and the load is considered a failure. If this value is + * set to `0` then there is no explicit timeout. + * @property {Resource.LOAD_TYPE} [loadType=Resource.LOAD_TYPE.XHR] - How should this resource + * be loaded? + * @property {Resource.XHR_RESPONSE_TYPE} [xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How + * should the data being loaded be interpreted when using XHR? + * @property {Resource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener. + * @property {Resource.OnCompleteSignal} [callback] - Alias for `onComplete`. + * @property {Resource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object. + */ + + /* eslint-disable require-jsdoc,valid-jsdoc */ + + /** + * Adds a resource (or multiple resources) to the loader queue. + * + * This function can take a wide variety of different parameters. The only thing that is always + * required the url to load. All the following will work: + * + * ```js + * loader + * // normal param syntax + * .add('key', 'http://...', function () {}) + * .add('http://...', function () {}) + * .add('http://...') + * + * // object syntax + * .add({ + * name: 'key2', + * url: 'http://...' + * }, function () {}) + * .add({ + * url: 'http://...' + * }, function () {}) + * .add({ + * name: 'key3', + * url: 'http://...' + * onComplete: function () {} + * }) + * .add({ + * url: 'https://...', + * onComplete: function () {}, + * crossOrigin: true + * }) + * + * // you can also pass an array of objects or urls or both + * .add([ + * { name: 'key4', url: 'http://...', onComplete: function () {} }, + * { url: 'http://...', onComplete: function () {} }, + * 'http://...' + * ]) + * + * // and you can use both params and options + * .add('key', 'http://...', { crossOrigin: true }, function () {}) + * .add('http://...', { crossOrigin: true }, function () {}); + * ``` + * + * @function + * @variation 1 + * @param {string} name - The name of the resource to load. + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 2 + * @param {string} name - The name of the resource to load. + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {IAddOptions} [options] - The options for the load. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 3 + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 4 + * @param {string} url - The url for this resource, relative to the baseUrl of this loader. + * @param {IAddOptions} [options] - The options for the load. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 5 + * @param {IAddOptions} options - The options for the load. This object must contain a `url` property. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + /** + * @function + * @variation 6 + * @param {Array} resources - An array of resources to load, where each is + * either an object with the options or a string url. If you pass an object, it must contain a `url` property. + * @param {Resource.OnCompleteSignal} [callback] - Function to call when this specific resource completes loading. + * @return {this} Returns itself. + */ + + + var _proto = Loader.prototype; + + _proto.add = function add(name, url, options, cb) { + // special case of an array of objects or urls + if (Array.isArray(name)) { + for (var i = 0; i < name.length; ++i) { + this.add(name[i]); + } + + return this; + } // if an object is passed instead of params + + + if (typeof name === 'object') { + cb = url || name.callback || name.onComplete; + options = name; + url = name.url; + name = name.name || name.key || name.url; + } // case where no name is passed shift all args over by one. + + + if (typeof url !== 'string') { + cb = options; + options = url; + url = name; + } // now that we shifted make sure we have a proper url. + + + if (typeof url !== 'string') { + throw new Error('No url passed to add resource to loader.'); + } // options are optional so people might pass a function and no options + + + if (typeof options === 'function') { + cb = options; + options = null; + } // if loading already you can only add resources that have a parent. + + + if (this.loading && (!options || !options.parentResource)) { + throw new Error('Cannot add resources while the loader is running.'); + } // check if resource already exists. + + + if (this.resources[name]) { + throw new Error("Resource named \"" + name + "\" already exists."); + } // add base url if this isn't an absolute url + + + url = this._prepareUrl(url); // create the store the resource + + this.resources[name] = new Resource$1(name, url, options); + + if (typeof cb === 'function') { + this.resources[name].onAfterMiddleware.once(cb); + } // if actively loading, make sure to adjust progress chunks for that parent and its children + + + if (this.loading) { + var parent = options.parentResource; + var incompleteChildren = []; + + for (var _i2 = 0; _i2 < parent.children.length; ++_i2) { + if (!parent.children[_i2].isComplete) { + incompleteChildren.push(parent.children[_i2]); + } + } + + var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent + + var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child + + parent.children.push(this.resources[name]); + parent.progressChunk = eachChunk; + + for (var _i3 = 0; _i3 < incompleteChildren.length; ++_i3) { + incompleteChildren[_i3].progressChunk = eachChunk; + } + + this.resources[name].progressChunk = eachChunk; + } // add the resource to the queue + + + this._queue.push(this.resources[name]); + + return this; + } + /* eslint-enable require-jsdoc,valid-jsdoc */ + + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * + * @param {function} fn - The middleware function to register. + * @return {this} Returns itself. + */ + ; + + _proto.pre = function pre(fn) { + this._beforeMiddleware.push(fn); + + return this; + } + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * + * @param {function} fn - The middleware function to register. + * @return {this} Returns itself. + */ + ; + + _proto.use = function use(fn) { + this._afterMiddleware.push(fn); + + return this; + } + /** + * Resets the queue of the loader to prepare for a new load. + * + * @return {this} Returns itself. + */ + ; + + _proto.reset = function reset() { + this.progress = 0; + this.loading = false; + + this._queue.kill(); + + this._queue.pause(); // abort all resource loads + + + for (var k in this.resources) { + var res = this.resources[k]; + + if (res._onLoadBinding) { + res._onLoadBinding.detach(); + } + + if (res.isLoading) { + res.abort(); + } + } + + this.resources = {}; + return this; + } + /** + * Starts loading the queued resources. + * + * @param {function} [cb] - Optional callback that will be bound to the `complete` event. + * @return {this} Returns itself. + */ + ; + + _proto.load = function load(cb) { + // register complete callback if they pass one + if (typeof cb === 'function') { + this.onComplete.once(cb); + } // if the queue has already started we are done here + + + if (this.loading) { + return this; + } + + if (this._queue.idle()) { + this._onStart(); + + this._onComplete(); + } else { + // distribute progress chunks + var numTasks = this._queue._tasks.length; + var chunk = MAX_PROGRESS / numTasks; + + for (var i = 0; i < this._queue._tasks.length; ++i) { + this._queue._tasks[i].data.progressChunk = chunk; + } // notify we are starting + + + this._onStart(); // start loading + + + this._queue.resume(); + } + + return this; + } + /** + * The number of resources to load concurrently. + * + * @member {number} + * @default 10 + */ + ; + + /** + * Prepares a url for usage based on the configuration of this object + * + * @private + * @param {string} url - The url to prepare. + * @return {string} The prepared url. + */ + _proto._prepareUrl = function _prepareUrl(url) { + var parsedUrl = src(url, { + strictMode: true + }); + var result; // absolute url, just use it as is. + + if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) { + result = url; + } // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween + else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') { + result = this.baseUrl + "/" + url; + } else { + result = this.baseUrl + url; + } // if we need to add a default querystring, there is a bit more work + + + if (this.defaultQueryString) { + var hash = rgxExtractUrlHash.exec(result)[0]; + result = result.substr(0, result.length - hash.length); + + if (result.indexOf('?') !== -1) { + result += "&" + this.defaultQueryString; + } else { + result += "?" + this.defaultQueryString; + } + + result += hash; + } + + return result; + } + /** + * Loads a single resource. + * + * @private + * @param {Resource} resource - The resource to load. + * @param {function} dequeue - The function to call when we need to dequeue this item. + */ + ; + + _proto._loadResource = function _loadResource(resource, dequeue) { + var _this2 = this; + + resource._dequeue = dequeue; // run before middleware + + eachSeries(this._beforeMiddleware, function (fn, next) { + fn.call(_this2, resource, function () { + // if the before middleware marks the resource as complete, + // break and don't process any more before middleware + next(resource.isComplete ? {} : null); + }); + }, function () { + if (resource.isComplete) { + _this2._onLoad(resource); + } else { + resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2); + resource.load(); + } + }, true); + } + /** + * Called once loading has started. + * + * @private + */ + ; + + _proto._onStart = function _onStart() { + this.progress = 0; + this.loading = true; + this.onStart.dispatch(this); + } + /** + * Called once each resource has loaded. + * + * @private + */ + ; + + _proto._onComplete = function _onComplete() { + this.progress = MAX_PROGRESS; + this.loading = false; + this.onComplete.dispatch(this, this.resources); + } + /** + * Called each time a resources is loaded. + * + * @private + * @param {Resource} resource - The resource that was loaded + */ + ; + + _proto._onLoad = function _onLoad(resource) { + var _this3 = this; + + resource._onLoadBinding = null; // remove this resource from the async queue, and add it to our list of resources that are being parsed + + this._resourcesParsing.push(resource); + + resource._dequeue(); // run all the after middleware for this resource + + + eachSeries(this._afterMiddleware, function (fn, next) { + fn.call(_this3, resource, next); + }, function () { + resource.onAfterMiddleware.dispatch(resource); + _this3.progress = Math.min(MAX_PROGRESS, _this3.progress + resource.progressChunk); + + _this3.onProgress.dispatch(_this3, resource); + + if (resource.error) { + _this3.onError.dispatch(resource.error, _this3, resource); + } else { + _this3.onLoad.dispatch(_this3, resource); + } + + _this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1); // do completion check + + + if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) { + _this3._onComplete(); + } + }, true); + }; + + _createClass(Loader, [{ + key: "concurrency", + get: function get() { + return this._queue.concurrency; + } // eslint-disable-next-line require-jsdoc + , + set: function set(concurrency) { + this._queue.concurrency = concurrency; + } + }]); + + return Loader; + }(); + /** + * A default array of middleware to run before loading each resource. + * Each of these middlewares are added to any new Loader instances when they are created. + * + * @private + * @member {function[]} + */ + + + Loader._defaultBeforeMiddleware = []; + /** + * A default array of middleware to run after loading each resource. + * Each of these middlewares are added to any new Loader instances when they are created. + * + * @private + * @member {function[]} + */ + + Loader._defaultAfterMiddleware = []; + /** + * Sets up a middleware function that will run *before* the + * resource is loaded. + * + * @static + * @param {function} fn - The middleware function to register. + * @return {Loader} Returns itself. + */ + + Loader.pre = function LoaderPreStatic(fn) { + Loader._defaultBeforeMiddleware.push(fn); + + return Loader; + }; + /** + * Sets up a middleware function that will run *after* the + * resource is loaded. + * + * @static + * @param {function} fn - The middleware function to register. + * @return {Loader} Returns itself. + */ + + + Loader.use = function LoaderUseStatic(fn) { + Loader._defaultAfterMiddleware.push(fn); + + return Loader; + }; + + /*! + * @pixi/loaders - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/loaders is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Reference to **{@link https://github.com/englercj/resource-loader + * resource-loader}**'s Resource class. + * @see http://englercj.github.io/resource-loader/Resource.html + * @class LoaderResource + * @memberof PIXI + */ + var LoaderResource = Resource$1; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$3 = function(d, b) { + extendStatics$3 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$3(d, b); + }; + + function __extends$3(d, b) { + extendStatics$3(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Loader plugin for handling Texture resources. + * @class + * @memberof PIXI + * @implements PIXI.ILoaderPlugin + */ + var TextureLoader = /** @class */ (function () { + function TextureLoader() { + } + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + TextureLoader.use = function (resource, next) { + // create a new texture if the data is an Image object + if (resource.data && resource.type === Resource$1.TYPE.IMAGE) { + resource.texture = Texture.fromLoader(resource.data, resource.url, resource.name); + } + next(); + }; + return TextureLoader; + }()); + + /** + * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader + * + * ```js + * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use. + * //or + * const loader = new PIXI.Loader(); // you can also create your own if you want + * + * const sprites = {}; + * + * // Chainable `add` to enqueue a resource + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.add('scoreFont', 'assets/score.fnt'); + * + * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource. + * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc). + * loader.pre(cachingMiddleware); + * + * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource. + * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc). + * loader.use(parsingMiddleware); + * + * // The `load` method loads the queue of resources, and calls the passed in callback called once all + * // resources have loaded. + * loader.load((loader, resources) => { + * // resources is an object where the key is the name of the resource loaded and the value is the resource object. + * // They have a couple default properties: + * // - `url`: The URL that the resource was loaded from + * // - `error`: The error that happened when trying to load (if any) + * // - `data`: The raw data that was loaded + * // also may contain other properties based on the middleware that runs. + * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture); + * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture); + * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture); + * }); + * + * // throughout the process multiple signals can be dispatched. + * loader.onProgress.add(() => {}); // called once per loaded/errored file + * loader.onError.add(() => {}); // called once per errored file + * loader.onLoad.add(() => {}); // called once per loaded file + * loader.onComplete.add(() => {}); // called once when the queued resources all load. + * ``` + * + * @see https://github.com/englercj/resource-loader + * + * @class Loader + * @memberof PIXI + * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. + * @param {number} [concurrency=10] - The number of resources to load concurrently. + */ + var Loader$1 = /** @class */ (function (_super) { + __extends$3(Loader, _super); + function Loader(baseUrl, concurrency) { + var _this = _super.call(this, baseUrl, concurrency) || this; + for (var i = 0; i < Loader._plugins.length; ++i) { + var plugin = Loader._plugins[i]; + var pre = plugin.pre, use = plugin.use; + if (pre) { + _this.pre(pre); + } + if (use) { + _this.use(use); + } + } + /** + * If this loader cannot be destroyed. + * @member {boolean} + * @default false + * @private + */ + _this._protected = false; + return _this; + } + /** + * Destroy the loader, removes references. + * @memberof PIXI.Loader# + * @method destroy + * @public + */ + Loader.prototype.destroy = function () { + if (!this._protected) { + this.reset(); + } + }; + Object.defineProperty(Loader, "shared", { + /** + * A premade instance of the loader that can be used to load resources. + * @name shared + * @type {PIXI.Loader} + * @static + * @memberof PIXI.Loader + */ + get: function () { + var shared = Loader._shared; + if (!shared) { + shared = new Loader(); + shared._protected = true; + Loader._shared = shared; + } + return shared; + }, + enumerable: false, + configurable: true + }); + /** + * Adds a Loader plugin for the global shared loader and all + * new Loader instances created. + * + * @static + * @method registerPlugin + * @memberof PIXI.Loader + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add + * @return {PIXI.Loader} Reference to PIXI.Loader for chaining + */ + Loader.registerPlugin = function (plugin) { + Loader._plugins.push(plugin); + if (plugin.add) { + plugin.add(); + } + return Loader; + }; + /** + * Collection of all installed `use` middleware for Loader. + * + * @static + * @member {Array} _plugins + * @memberof PIXI.Loader + * @private + */ + Loader._plugins = []; + return Loader; + }(Loader)); + // parse any blob into more usable objects (e.g. Image) + Loader$1.registerPlugin({ use: index$1.parsing }); + // parse any Image objects into textures + Loader$1.registerPlugin(TextureLoader); + /** + * Plugin to be installed for handling specific Loader resources. + * + * @memberof PIXI + * @typedef {object} ILoaderPlugin + * @property {function} [add] - Function to call immediate after registering plugin. + * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the + * arguments for this are `(resource, next)` + * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the + * arguments for this are `(resource, next)` + */ + /** + * @memberof PIXI.Loader + * @typedef {object} ICallbackID + */ + /** + * @memberof PIXI.Loader + * @typedef {function} ISignalCallback + * @param {function} callback - Callback function + * @param {object} [context] - Context + * @returns {ICallbackID} - CallbackID + */ + /** + * @memberof PIXI.Loader + * @typedef {function} ISignalDetach + * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods + */ + /** + * @memberof PIXI.Loader + * @typedef ILoaderSignal + * @property {ISignalCallback} add - Register callback + * @property {ISignalCallback} once - Register oneshot callback + * @property {ISignalDetach} detach - Detach specific callback by ID + */ + /** + * @memberof PIXI.Loader + * @callback loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + /** + * @memberof PIXI.Loader# + * @description Dispatched when the loader begins to loading process. + * @member {PIXI.Loader.ILoaderSignal} onStart + */ + /** + * @memberof PIXI.Loader# + * @description Dispatched once per loaded or errored resource. + * @member {PIXI.Loader.ILoaderSignal} onProgress + */ + /** + * @memberof PIXI.Loader# + * @description Dispatched once per errored resource. + * @member {PIXI.Loader.ILoaderSignal} onError + */ + /** + * @memberof PIXI.Loader# + * @description Dispatched once per loaded resource. + * @member {PIXI.Loader.ILoaderSignal} onLoad + */ + /** + * @memberof PIXI.Loader# + * @description Dispatched when completely loaded all resources. + * @member {PIXI.Loader.ILoaderSignal} onComplete + */ + + /** + * Application plugin for supporting loader option. Installing the LoaderPlugin + * is not necessary if using **pixi.js** or **pixi.js-legacy**. + * @example + * import {AppLoaderPlugin} from '@pixi/loaders'; + * import {Application} from '@pixi/app'; + * Application.registerPlugin(AppLoaderPlugin); + * @class + * @memberof PIXI + */ + var AppLoaderPlugin = /** @class */ (function () { + function AppLoaderPlugin() { + } + /** + * Called on application constructor + * @param {object} options + * @private + */ + AppLoaderPlugin.init = function (options) { + options = Object.assign({ + sharedLoader: false, + }, options); + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); + }; + /** + * Called when application destroyed + * @private + */ + AppLoaderPlugin.destroy = function () { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + }; + return AppLoaderPlugin; + }()); + + /*! + * @pixi/particles - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/particles is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$4 = function(d, b) { + extendStatics$4 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$4(d, b); + }; + + function __extends$4(d, b) { + extendStatics$4(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * The ParticleContainer class is a really fast version of the Container built solely for speed, + * so use when you need a lot of sprites or particles. + * + * The tradeoff of the ParticleContainer is that most advanced functionality will not work. + * ParticleContainer implements the basic object transform (position, scale, rotation) + * and some advanced functionality like tint (as of v4.5.6). + * + * Other more advanced functionality like masking, children, filters, etc will not work on sprites in this batch. + * + * It's extremely easy to use: + * ```js + * let container = new ParticleContainer(); + * + * for (let i = 0; i < 100; ++i) + * { + * let sprite = PIXI.Sprite.from("myImage.png"); + * container.addChild(sprite); + * } + * ``` + * + * And here you have a hundred sprites that will be rendered at the speed of light. + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + var ParticleContainer = /** @class */ (function (_super) { + __extends$4(ParticleContainer, _super); + /** + * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container. + * Affects size of allocated buffers. + * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied. + * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied. + * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`. + * @param {boolean} [properties.position=true] - When true, position be uploaded and applied. + * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied. + * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied. + * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied. + * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead. + * @param {boolean} [autoResize=false] - If true, container allocates more batches in case + * there are more than `maxSize` particles. + */ + function ParticleContainer(maxSize, properties, batchSize, autoResize) { + if (maxSize === void 0) { maxSize = 1500; } + if (batchSize === void 0) { batchSize = 16384; } + if (autoResize === void 0) { autoResize = false; } + var _this = _super.call(this) || this; + // Making sure the batch size is valid + // 65535 is max vertex index in the index buffer (see ParticleRenderer) + // so max number of particles is 65536 / 4 = 16384 + var maxBatchSize = 16384; + if (batchSize > maxBatchSize) { + batchSize = maxBatchSize; + } + /** + * Set properties to be dynamic (true) / static (false) + * + * @member {boolean[]} + * @private + */ + _this._properties = [false, true, false, false, false]; + /** + * @member {number} + * @private + */ + _this._maxSize = maxSize; + /** + * @member {number} + * @private + */ + _this._batchSize = batchSize; + /** + * @member {Array} + * @private + */ + _this._buffers = null; + /** + * for every batch stores _updateID corresponding to the last change in that batch + * @member {number[]} + * @private + */ + _this._bufferUpdateIDs = []; + /** + * when child inserted, removed or changes position this number goes up + * @member {number[]} + * @private + */ + _this._updateID = 0; + /** + * @member {boolean} + * + */ + _this.interactiveChildren = false; + /** + * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` + * to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + _this.blendMode = exports.BLEND_MODES.NORMAL; + /** + * If true, container allocates more batches in case there are more than `maxSize` particles. + * @member {boolean} + * @default false + */ + _this.autoResize = autoResize; + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * Default to true here as performance is usually the priority for particles. + * + * @member {boolean} + * @default true + */ + _this.roundPixels = true; + /** + * The texture used to render the children. + * + * @readonly + * @member {PIXI.BaseTexture} + */ + _this.baseTexture = null; + _this.setProperties(properties); + /** + * The tint applied to the container. + * This is a hex value. A value of 0xFFFFFF will remove any tint effect. + * + * @private + * @member {number} + * @default 0xFFFFFF + */ + _this._tint = 0; + _this.tintRgb = new Float32Array(4); + _this.tint = 0xFFFFFF; + return _this; + } + /** + * Sets the private properties array to dynamic / static based on the passed properties object + * + * @param {object} properties - The properties to be uploaded + */ + ParticleContainer.prototype.setProperties = function (properties) { + if (properties) { + this._properties[0] = 'vertices' in properties || 'scale' in properties + ? !!properties.vertices || !!properties.scale : this._properties[0]; + this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; + this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2]; + this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3]; + this._properties[4] = 'tint' in properties || 'alpha' in properties + ? !!properties.tint || !!properties.alpha : this._properties[4]; + } + }; + /** + * Updates the object transform for rendering + * + * @private + */ + ParticleContainer.prototype.updateTransform = function () { + // TODO don't need to! + this.displayObjectUpdateTransform(); + }; + Object.defineProperty(ParticleContainer.prototype, "tint", { + /** + * The tint applied to the container. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + hex2rgb(value, this.tintRgb); + }, + enumerable: false, + configurable: true + }); + /** + * Renders the container using the WebGL renderer + * + * @private + * @param {PIXI.Renderer} renderer - The webgl renderer + */ + ParticleContainer.prototype.render = function (renderer) { + var _this = this; + if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { + return; + } + if (!this.baseTexture) { + this.baseTexture = this.children[0]._texture.baseTexture; + if (!this.baseTexture.valid) { + this.baseTexture.once('update', function () { return _this.onChildrenChange(0); }); + } + } + renderer.batch.setObjectRenderer(renderer.plugins.particle); + renderer.plugins.particle.render(this); + }; + /** + * Set the flag that static data should be updated to true + * + * @private + * @param {number} smallestChildIndex - The smallest child index + */ + ParticleContainer.prototype.onChildrenChange = function (smallestChildIndex) { + var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); + while (this._bufferUpdateIDs.length < bufferIndex) { + this._bufferUpdateIDs.push(0); + } + this._bufferUpdateIDs[bufferIndex] = ++this._updateID; + }; + ParticleContainer.prototype.dispose = function () { + if (this._buffers) { + for (var i = 0; i < this._buffers.length; ++i) { + this._buffers[i].destroy(); + } + this._buffers = null; + } + }; + /** + * Destroys the container + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their + * destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + ParticleContainer.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.dispose(); + this._properties = null; + this._buffers = null; + this._bufferUpdateIDs = null; + }; + return ParticleContainer; + }(Container)); + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that + * they now share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's ParticleBuffer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java + */ + /** + * The particle buffer manages the static and dynamic buffers for a particle container. + * + * @class + * @private + * @memberof PIXI + */ + var ParticleBuffer = /** @class */ (function () { + /** + * @private + * @param {object} properties - The properties to upload. + * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. + * @param {number} size - The size of the batch. + */ + function ParticleBuffer(properties, dynamicPropertyFlags, size) { + this.geometry = new Geometry(); + this.indexBuffer = null; + /** + * The number of particles the buffer can hold + * + * @private + * @member {number} + */ + this.size = size; + /** + * A list of the properties that are dynamic. + * + * @private + * @member {object[]} + */ + this.dynamicProperties = []; + /** + * A list of the properties that are static. + * + * @private + * @member {object[]} + */ + this.staticProperties = []; + for (var i = 0; i < properties.length; ++i) { + var property = properties[i]; + // Make copy of properties object so that when we edit the offset it doesn't + // change all other instances of the object literal + property = { + attributeName: property.attributeName, + size: property.size, + uploadFunction: property.uploadFunction, + type: property.type || exports.TYPES.FLOAT, + offset: property.offset, + }; + if (dynamicPropertyFlags[i]) { + this.dynamicProperties.push(property); + } + else { + this.staticProperties.push(property); + } + } + this.staticStride = 0; + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + this.dynamicStride = 0; + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + this._updateID = 0; + this.initBuffers(); + } + /** + * Sets up the renderer context and necessary buffers. + * + * @private + */ + ParticleBuffer.prototype.initBuffers = function () { + var geometry = this.geometry; + var dynamicOffset = 0; + /** + * Holds the indices of the geometry (quads) to draw + * + * @member {Uint16Array} + * @private + */ + this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); + geometry.addIndex(this.indexBuffer); + this.dynamicStride = 0; + for (var i = 0; i < this.dynamicProperties.length; ++i) { + var property = this.dynamicProperties[i]; + property.offset = dynamicOffset; + dynamicOffset += property.size; + this.dynamicStride += property.size; + } + var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); + this.dynamicData = new Float32Array(dynBuffer); + this.dynamicDataUint32 = new Uint32Array(dynBuffer); + this.dynamicBuffer = new Buffer(this.dynamicData, false, false); + // static // + var staticOffset = 0; + this.staticStride = 0; + for (var i = 0; i < this.staticProperties.length; ++i) { + var property = this.staticProperties[i]; + property.offset = staticOffset; + staticOffset += property.size; + this.staticStride += property.size; + } + var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); + this.staticData = new Float32Array(statBuffer); + this.staticDataUint32 = new Uint32Array(statBuffer); + this.staticBuffer = new Buffer(this.staticData, true, false); + for (var i = 0; i < this.dynamicProperties.length; ++i) { + var property = this.dynamicProperties[i]; + geometry.addAttribute(property.attributeName, this.dynamicBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.dynamicStride * 4, property.offset * 4); + } + for (var i = 0; i < this.staticProperties.length; ++i) { + var property = this.staticProperties[i]; + geometry.addAttribute(property.attributeName, this.staticBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.staticStride * 4, property.offset * 4); + } + }; + /** + * Uploads the dynamic properties. + * + * @private + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + ParticleBuffer.prototype.uploadDynamic = function (children, startIndex, amount) { + for (var i = 0; i < this.dynamicProperties.length; i++) { + var property = this.dynamicProperties[i]; + property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset); + } + this.dynamicBuffer._updateID++; + }; + /** + * Uploads the static properties. + * + * @private + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + ParticleBuffer.prototype.uploadStatic = function (children, startIndex, amount) { + for (var i = 0; i < this.staticProperties.length; i++) { + var property = this.staticProperties[i]; + property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset); + } + this.staticBuffer._updateID++; + }; + /** + * Destroys the ParticleBuffer. + * + * @private + */ + ParticleBuffer.prototype.destroy = function () { + this.indexBuffer = null; + this.dynamicProperties = null; + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + this.staticProperties = null; + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + // all buffers are destroyed inside geometry + this.geometry.destroy(); + }; + return ParticleBuffer; + }()); + + var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}"; + + var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; + + /** + * @author Mat Groves + * + * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/ + * for creating the original PixiJS version! + * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now + * share 4 bytes on the vertex buffer + * + * Heavily inspired by LibGDX's ParticleRenderer: + * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java + */ + /** + * Renderer for Particles that is designer for speed over feature set. + * + * @class + * @memberof PIXI + */ + var ParticleRenderer = /** @class */ (function (_super) { + __extends$4(ParticleRenderer, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for. + */ + function ParticleRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + // 65535 is max vertex index in the index buffer (see ParticleRenderer) + // so max number of particles is 65536 / 4 = 16384 + // and max number of element in the index buffer is 16384 * 6 = 98304 + // Creating a full index buffer, overhead is 98304 * 2 = 196Ko + // let numIndices = 98304; + /** + * The default shader that is used if a sprite doesn't have a more specific one. + * + * @member {PIXI.Shader} + */ + _this.shader = null; + _this.properties = null; + _this.tempMatrix = new Matrix(); + _this.properties = [ + // verticesData + { + attributeName: 'aVertexPosition', + size: 2, + uploadFunction: _this.uploadVertices, + offset: 0, + }, + // positionData + { + attributeName: 'aPositionCoord', + size: 2, + uploadFunction: _this.uploadPosition, + offset: 0, + }, + // rotationData + { + attributeName: 'aRotation', + size: 1, + uploadFunction: _this.uploadRotation, + offset: 0, + }, + // uvsData + { + attributeName: 'aTextureCoord', + size: 2, + uploadFunction: _this.uploadUvs, + offset: 0, + }, + // tintData + { + attributeName: 'aColor', + size: 1, + type: exports.TYPES.UNSIGNED_BYTE, + uploadFunction: _this.uploadTint, + offset: 0, + } ]; + _this.shader = Shader.from(vertex$1, fragment$1, {}); + /** + * The WebGL state in which this renderer will work. + * + * @member {PIXI.State} + * @readonly + */ + _this.state = State.for2d(); + return _this; + } + /** + * Renders the particle container object. + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + */ + ParticleRenderer.prototype.render = function (container) { + var children = container.children; + var maxSize = container._maxSize; + var batchSize = container._batchSize; + var renderer = this.renderer; + var totalChildren = children.length; + if (totalChildren === 0) { + return; + } + else if (totalChildren > maxSize && !container.autoResize) { + totalChildren = maxSize; + } + var buffers = container._buffers; + if (!buffers) { + buffers = container._buffers = this.generateBuffers(container); + } + var baseTexture = children[0]._texture.baseTexture; + // if the uvs have not updated then no point rendering just yet! + this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode); + renderer.state.set(this.state); + var gl = renderer.gl; + var m = container.worldTransform.copyTo(this.tempMatrix); + m.prepend(renderer.globalUniforms.uniforms.projectionMatrix); + this.shader.uniforms.translationMatrix = m.toArray(true); + this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); + this.shader.uniforms.uSampler = baseTexture; + this.renderer.shader.bind(this.shader); + var updateStatic = false; + // now lets upload and render the buffers.. + for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) { + var amount = (totalChildren - i); + if (amount > batchSize) { + amount = batchSize; + } + if (j >= buffers.length) { + buffers.push(this._generateOneMoreBuffer(container)); + } + var buffer = buffers[j]; + // we always upload the dynamic + buffer.uploadDynamic(children, i, amount); + var bid = container._bufferUpdateIDs[j] || 0; + updateStatic = updateStatic || (buffer._updateID < bid); + // we only upload the static content when we have to! + if (updateStatic) { + buffer._updateID = container._updateID; + buffer.uploadStatic(children, i, amount); + } + // bind the buffer + renderer.geometry.bind(buffer.geometry); + gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); + } + }; + /** + * Creates one particle buffer for each child in the container we want to render and updates internal properties + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + * @return {PIXI.ParticleBuffer[]} The buffers + * @private + */ + ParticleRenderer.prototype.generateBuffers = function (container) { + var buffers = []; + var size = container._maxSize; + var batchSize = container._batchSize; + var dynamicPropertyFlags = container._properties; + for (var i = 0; i < size; i += batchSize) { + buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize)); + } + return buffers; + }; + /** + * Creates one more particle buffer, because container has autoResize feature + * + * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer + * @return {PIXI.ParticleBuffer} generated buffer + * @private + */ + ParticleRenderer.prototype._generateOneMoreBuffer = function (container) { + var batchSize = container._batchSize; + var dynamicPropertyFlags = container._properties; + return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize); + }; + /** + * Uploads the vertices. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their vertices uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadVertices = function (children, startIndex, amount, array, stride, offset) { + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + for (var i = 0; i < amount; ++i) { + var sprite = children[startIndex + i]; + var texture = sprite._texture; + var sx = sprite.scale.x; + var sy = sprite.scale.y; + var trim = texture.trim; + var orig = texture.orig; + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the + // extra space before transforming the sprite coords.. + w1 = trim.x - (sprite.anchor.x * orig.width); + w0 = w1 + trim.width; + h1 = trim.y - (sprite.anchor.y * orig.height); + h0 = h1 + trim.height; + } + else { + w0 = (orig.width) * (1 - sprite.anchor.x); + w1 = (orig.width) * -sprite.anchor.x; + h0 = orig.height * (1 - sprite.anchor.y); + h1 = orig.height * -sprite.anchor.y; + } + array[offset] = w1 * sx; + array[offset + 1] = h1 * sy; + array[offset + stride] = w0 * sx; + array[offset + stride + 1] = h1 * sy; + array[offset + (stride * 2)] = w0 * sx; + array[offset + (stride * 2) + 1] = h0 * sy; + array[offset + (stride * 3)] = w1 * sx; + array[offset + (stride * 3) + 1] = h0 * sy; + offset += stride * 4; + } + }; + /** + * Uploads the position. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their positions uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadPosition = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; i++) { + var spritePosition = children[startIndex + i].position; + array[offset] = spritePosition.x; + array[offset + 1] = spritePosition.y; + array[offset + stride] = spritePosition.x; + array[offset + stride + 1] = spritePosition.y; + array[offset + (stride * 2)] = spritePosition.x; + array[offset + (stride * 2) + 1] = spritePosition.y; + array[offset + (stride * 3)] = spritePosition.x; + array[offset + (stride * 3) + 1] = spritePosition.y; + offset += stride * 4; + } + }; + /** + * Uploads the rotation. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadRotation = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; i++) { + var spriteRotation = children[startIndex + i].rotation; + array[offset] = spriteRotation; + array[offset + stride] = spriteRotation; + array[offset + (stride * 2)] = spriteRotation; + array[offset + (stride * 3)] = spriteRotation; + offset += stride * 4; + } + }; + /** + * Uploads the Uvs + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadUvs = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; ++i) { + var textureUvs = children[startIndex + i]._texture._uvs; + if (textureUvs) { + array[offset] = textureUvs.x0; + array[offset + 1] = textureUvs.y0; + array[offset + stride] = textureUvs.x1; + array[offset + stride + 1] = textureUvs.y1; + array[offset + (stride * 2)] = textureUvs.x2; + array[offset + (stride * 2) + 1] = textureUvs.y2; + array[offset + (stride * 3)] = textureUvs.x3; + array[offset + (stride * 3) + 1] = textureUvs.y3; + offset += stride * 4; + } + else { + // TODO you know this can be easier! + array[offset] = 0; + array[offset + 1] = 0; + array[offset + stride] = 0; + array[offset + stride + 1] = 0; + array[offset + (stride * 2)] = 0; + array[offset + (stride * 2) + 1] = 0; + array[offset + (stride * 3)] = 0; + array[offset + (stride * 3) + 1] = 0; + offset += stride * 4; + } + } + }; + /** + * Uploads the tint. + * + * @param {PIXI.DisplayObject[]} children - the array of display objects to render + * @param {number} startIndex - the index to start from in the children array + * @param {number} amount - the amount of children that will have their rotation uploaded + * @param {number[]} array - The vertices to upload. + * @param {number} stride - Stride to use for iteration. + * @param {number} offset - Offset to start at. + */ + ParticleRenderer.prototype.uploadTint = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; ++i) { + var sprite = children[startIndex + i]; + var premultiplied = sprite._texture.baseTexture.alphaMode > 0; + var alpha = sprite.alpha; + // we dont call extra function if alpha is 1.0, that's faster + var argb = alpha < 1.0 && premultiplied + ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24); + array[offset] = argb; + array[offset + stride] = argb; + array[offset + (stride * 2)] = argb; + array[offset + (stride * 3)] = argb; + offset += stride * 4; + } + }; + /** + * Destroys the ParticleRenderer. + */ + ParticleRenderer.prototype.destroy = function () { + _super.prototype.destroy.call(this); + if (this.shader) { + this.shader.destroy(); + this.shader = null; + } + this.tempMatrix = null; + }; + return ParticleRenderer; + }(ObjectRenderer)); + + /*! + * @pixi/graphics - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/graphics is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Supported line joints in `PIXI.LineStyle` for graphics. + * + * @see PIXI.Graphics#lineStyle + * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator + * + * @name LINE_JOIN + * @memberof PIXI + * @static + * @enum {string} + * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet + * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn + * @property {string} ROUND - 'round': add an arc at the joint + */ + + (function (LINE_JOIN) { + LINE_JOIN["MITER"] = "miter"; + LINE_JOIN["BEVEL"] = "bevel"; + LINE_JOIN["ROUND"] = "round"; + })(exports.LINE_JOIN || (exports.LINE_JOIN = {})); + /** + * Support line caps in `PIXI.LineStyle` for graphics. + * + * @see PIXI.Graphics#lineStyle + * + * @name LINE_CAP + * @memberof PIXI + * @static + * @enum {string} + * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges) + * @property {string} ROUND - 'round': add semicircle at ends + * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end) + */ + + (function (LINE_CAP) { + LINE_CAP["BUTT"] = "butt"; + LINE_CAP["ROUND"] = "round"; + LINE_CAP["SQUARE"] = "square"; + })(exports.LINE_CAP || (exports.LINE_CAP = {})); + /** + * Graphics curves resolution settings. If `adaptive` flag is set to `true`, + * the resolution is calculated based on the curve's length to ensure better visual quality. + * Adaptive draw works with `bezierCurveTo` and `quadraticCurveTo`. + * + * @static + * @constant + * @memberof PIXI + * @name GRAPHICS_CURVES + * @type {object} + * @property {boolean} adaptive=false - flag indicating if the resolution should be adaptive + * @property {number} maxLength=10 - maximal length of a single segment of the curve (if adaptive = false, ignored) + * @property {number} minSegments=8 - minimal number of segments in the curve (if adaptive = false, ignored) + * @property {number} maxSegments=2048 - maximal number of segments in the curve (if adaptive = false, ignored) + */ + var GRAPHICS_CURVES = { + adaptive: true, + maxLength: 10, + minSegments: 8, + maxSegments: 2048, + epsilon: 0.0001, + _segmentsCount: function (length, defaultSegments) { + if (defaultSegments === void 0) { defaultSegments = 20; } + if (!this.adaptive || !length || isNaN(length)) { + return defaultSegments; + } + var result = Math.ceil(length / this.maxLength); + if (result < this.minSegments) { + result = this.minSegments; + } + else if (result > this.maxSegments) { + result = this.maxSegments; + } + return result; + }, + }; + + /** + * Fill style object for Graphics. + * + * @class + * @memberof PIXI + */ + var FillStyle = /** @class */ (function () { + function FillStyle() { + /** + * The hex color value used when coloring the Graphics object. + * + * @member {number} + * @default 0xFFFFFF + */ + this.color = 0xFFFFFF; + /** + * The alpha value used when filling the Graphics object. + * + * @member {number} + * @default 1 + */ + this.alpha = 1.0; + /** + * The texture to be used for the fill. + * + * @member {PIXI.Texture} + * @default 0 + */ + this.texture = Texture.WHITE; + /** + * The transform aplpied to the texture. + * + * @member {PIXI.Matrix} + * @default null + */ + this.matrix = null; + /** + * If the current fill is visible. + * + * @member {boolean} + * @default false + */ + this.visible = false; + this.reset(); + } + /** + * Clones the object + * + * @return {PIXI.FillStyle} + */ + FillStyle.prototype.clone = function () { + var obj = new FillStyle(); + obj.color = this.color; + obj.alpha = this.alpha; + obj.texture = this.texture; + obj.matrix = this.matrix; + obj.visible = this.visible; + return obj; + }; + /** + * Reset + */ + FillStyle.prototype.reset = function () { + this.color = 0xFFFFFF; + this.alpha = 1; + this.texture = Texture.WHITE; + this.matrix = null; + this.visible = false; + }; + /** + * Destroy and don't use after this + */ + FillStyle.prototype.destroy = function () { + this.texture = null; + this.matrix = null; + }; + return FillStyle; + }()); + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$5 = function(d, b) { + extendStatics$5 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$5(d, b); + }; + + function __extends$5(d, b) { + extendStatics$5(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Builds a polygon to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines + */ + var buildPoly = { + build: function (graphicsData) { + graphicsData.points = graphicsData.shape.points.slice(); + }, + triangulate: function (graphicsData, graphicsGeometry) { + var points = graphicsData.points; + var holes = graphicsData.holes; + var verts = graphicsGeometry.points; + var indices = graphicsGeometry.indices; + if (points.length >= 6) { + var holeArray = []; + // Process holes.. + for (var i = 0; i < holes.length; i++) { + var hole = holes[i]; + holeArray.push(points.length / 2); + points = points.concat(hole.points); + } + // sort color + var triangles = earcut_1(points, holeArray, 2); + if (!triangles) { + return; + } + var vertPos = verts.length / 2; + for (var i = 0; i < triangles.length; i += 3) { + indices.push(triangles[i] + vertPos); + indices.push(triangles[i + 1] + vertPos); + indices.push(triangles[i + 2] + vertPos); + } + for (var i = 0; i < points.length; i++) { + verts.push(points[i]); + } + } + }, + }; + + // for type only + /** + * Builds a circle to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines + */ + var buildCircle = { + build: function (graphicsData) { + // need to convert points to a nice regular data + var circleData = graphicsData.shape; + var points = graphicsData.points; + var x = circleData.x; + var y = circleData.y; + var width; + var height; + points.length = 0; + // TODO - bit hacky?? + if (graphicsData.type === exports.SHAPES.CIRC) { + width = circleData.radius; + height = circleData.radius; + } + else { + var ellipseData = graphicsData.shape; + width = ellipseData.width; + height = ellipseData.height; + } + if (width === 0 || height === 0) { + return; + } + var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius)) + || Math.floor(15 * Math.sqrt(width + height)); + totalSegs /= 2.3; + var seg = (Math.PI * 2) / totalSegs; + for (var i = 0; i < totalSegs - 0.5; i++) { + points.push(x + (Math.sin(-seg * i) * width), y + (Math.cos(-seg * i) * height)); + } + points.push(points[0], points[1]); + }, + triangulate: function (graphicsData, graphicsGeometry) { + var points = graphicsData.points; + var verts = graphicsGeometry.points; + var indices = graphicsGeometry.indices; + var vertPos = verts.length / 2; + var center = vertPos; + var circle = (graphicsData.shape); + var matrix = graphicsData.matrix; + var x = circle.x; + var y = circle.y; + // Push center (special point) + verts.push(graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x, graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y); + for (var i = 0; i < points.length; i += 2) { + verts.push(points[i], points[i + 1]); + // add some uvs + indices.push(vertPos++, center, vertPos); + } + }, + }; + + /** + * Builds a rectangle to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines + */ + var buildRectangle = { + build: function (graphicsData) { + // --- // + // need to convert points to a nice regular data + // + var rectData = graphicsData.shape; + var x = rectData.x; + var y = rectData.y; + var width = rectData.width; + var height = rectData.height; + var points = graphicsData.points; + points.length = 0; + points.push(x, y, x + width, y, x + width, y + height, x, y + height); + }, + triangulate: function (graphicsData, graphicsGeometry) { + var points = graphicsData.points; + var verts = graphicsGeometry.points; + var vertPos = verts.length / 2; + verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]); + graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3); + }, + }; + + /** + * Calculate a single point for a quadratic bezier curve. + * Utility function used by quadraticBezierCurve. + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} n1 - first number + * @param {number} n2 - second number + * @param {number} perc - percentage + * @return {number} the result + * + */ + function getPt(n1, n2, perc) { + var diff = n2 - n1; + return n1 + (diff * perc); + } + /** + * Calculate the points for a quadratic bezier curve. (helper function..) + * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} fromX - Origin point x + * @param {number} fromY - Origin point x + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created. + * @return {number[]} an array of points + */ + function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) { + if (out === void 0) { out = []; } + var n = 20; + var points = out; + var xa = 0; + var ya = 0; + var xb = 0; + var yb = 0; + var x = 0; + var y = 0; + for (var i = 0, j = 0; i <= n; ++i) { + j = i / n; + // The Green Line + xa = getPt(fromX, cpX, j); + ya = getPt(fromY, cpY, j); + xb = getPt(cpX, toX, j); + yb = getPt(cpY, toY, j); + // The Black Dot + x = getPt(xa, xb, j); + y = getPt(ya, yb, j); + points.push(x, y); + } + return points; + } + /** + * Builds a rounded rectangle to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines + */ + var buildRoundedRectangle = { + build: function (graphicsData) { + var rrectData = graphicsData.shape; + var points = graphicsData.points; + var x = rrectData.x; + var y = rrectData.y; + var width = rrectData.width; + var height = rrectData.height; + // Don't allow negative radius or greater than half the smallest width + var radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2)); + points.length = 0; + // No radius, do a simple rectangle + if (!radius) { + points.push(x, y, x + width, y, x + width, y + height, x, y + height); + } + else { + quadraticBezierCurve(x, y + radius, x, y, x + radius, y, points); + quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, points); + quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, points); + quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, points); + } + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. + // TODO - fix this properly, this is not very elegant.. but it works for now. + }, + triangulate: function (graphicsData, graphicsGeometry) { + var points = graphicsData.points; + var verts = graphicsGeometry.points; + var indices = graphicsGeometry.indices; + var vecPos = verts.length / 2; + var triangles = earcut_1(points, null, 2); + for (var i = 0, j = triangles.length; i < j; i += 3) { + indices.push(triangles[i] + vecPos); + // indices.push(triangles[i] + vecPos); + indices.push(triangles[i + 1] + vecPos); + // indices.push(triangles[i + 2] + vecPos); + indices.push(triangles[i + 2] + vecPos); + } + for (var i = 0, j = points.length; i < j; i++) { + verts.push(points[i], points[++i]); + } + }, + }; + + /** + * Buffers vertices to draw a square cap. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} x - X-coord of end point + * @param {number} y - Y-coord of end point + * @param {number} nx - X-coord of line normal pointing inside + * @param {number} ny - Y-coord of line normal pointing inside + * @param {Array} verts - vertex buffer + * @returns {} + */ + function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) { + var ix = x - (nx * innerWeight); + var iy = y - (ny * innerWeight); + var ox = x + (nx * outerWeight); + var oy = y + (ny * outerWeight); + /* Rotate nx,ny for extension vector */ + var exx; + var eyy; + if (clockwise) { + exx = ny; + eyy = -nx; + } + else { + exx = -ny; + eyy = nx; + } + /* [i|0]x,y extended at cap */ + var eix = ix + exx; + var eiy = iy + eyy; + var eox = ox + exx; + var eoy = oy + eyy; + /* Square itself must be inserted clockwise*/ + verts.push(eix, eiy); + verts.push(eox, eoy); + return 2; + } + /** + * Buffers vertices to draw an arc at the line joint or cap. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} cx - X-coord of center + * @param {number} cy - Y-coord of center + * @param {number} sx - X-coord of arc start + * @param {number} sy - Y-coord of arc start + * @param {number} ex - X-coord of arc end + * @param {number} ey - Y-coord of arc end + * @param {Array} verts - buffer of vertices + * @param {boolean} clockwise - orientation of vertices + * @returns {number} - no. of vertices pushed + */ + function round(cx, cy, sx, sy, ex, ey, verts, clockwise) { + var cx2p0x = sx - cx; + var cy2p0y = sy - cy; + var angle0 = Math.atan2(cx2p0x, cy2p0y); + var angle1 = Math.atan2(ex - cx, ey - cy); + if (clockwise && angle0 < angle1) { + angle0 += Math.PI * 2; + } + else if (!clockwise && angle0 > angle1) { + angle1 += Math.PI * 2; + } + var startAngle = angle0; + var angleDiff = angle1 - angle0; + var absAngleDiff = Math.abs(angleDiff); + /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND) + { + const r1x = cx - nxtPx; + const r1y = cy - nxtPy; + + if (r1x === 0) + { + if (r1y > 0) + { + angleDiff = -angleDiff; + } + } + else if (r1x >= -GRAPHICS_CURVES.epsilon) + { + angleDiff = -angleDiff; + } + }*/ + var radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y)); + var segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1; + var angleInc = angleDiff / segCount; + startAngle += angleInc; + if (clockwise) { + verts.push(cx, cy); + verts.push(sx, sy); + for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { + verts.push(cx, cy); + verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); + } + verts.push(cx, cy); + verts.push(ex, ey); + } + else { + verts.push(sx, sy); + verts.push(cx, cy); + for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { + verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); + verts.push(cx, cy); + } + verts.push(ex, ey); + verts.push(cx, cy); + } + return segCount * 2; + } + /** + * Builds a line to draw using the polygon method. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output + */ + function buildNonNativeLine(graphicsData, graphicsGeometry) { + var shape = graphicsData.shape; + var points = graphicsData.points || shape.points.slice(); + var eps = graphicsGeometry.closePointEps; + if (points.length === 0) { + return; + } + // if the line width is an odd number add 0.5 to align to a whole pixel + // commenting this out fixes #711 and #1620 + // if (graphicsData.lineWidth%2) + // { + // for (i = 0; i < points.length; i++) + // { + // points[i] += 0.5; + // } + // } + var style = graphicsData.lineStyle; + // get first and last point.. figure out the middle! + var firstPoint = new Point(points[0], points[1]); + var lastPoint = new Point(points[points.length - 2], points[points.length - 1]); + var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; + var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps + && Math.abs(firstPoint.y - lastPoint.y) < eps; + // if the first point is the last point - gonna have issues :) + if (closedShape) { + // need to clone as we are going to slightly modify the shape.. + points = points.slice(); + if (closedPath) { + points.pop(); + points.pop(); + lastPoint.set(points[points.length - 2], points[points.length - 1]); + } + var midPointX = (firstPoint.x + lastPoint.x) * 0.5; + var midPointY = (lastPoint.y + firstPoint.y) * 0.5; + points.unshift(midPointX, midPointY); + points.push(midPointX, midPointY); + } + var verts = graphicsGeometry.points; + var length = points.length / 2; + var indexCount = points.length; + var indexStart = verts.length / 2; + // Max. inner and outer width + var width = style.width / 2; + var widthSquared = width * width; + var miterLimitSquared = style.miterLimit * style.miterLimit; + /* Line segments of interest where (x1,y1) forms the corner. */ + var x0 = points[0]; + var y0 = points[1]; + var x1 = points[2]; + var y1 = points[3]; + var x2 = 0; + var y2 = 0; + /* perp[?](x|y) = the line normal with magnitude lineWidth. */ + var perpx = -(y0 - y1); + var perpy = x0 - x1; + var perp1x = 0; + var perp1y = 0; + var dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + var ratio = style.alignment; // 0.5; + var innerWeight = (1 - ratio) * 2; + var outerWeight = ratio * 2; + if (!closedShape) { + if (style.cap === exports.LINE_CAP.ROUND) { + indexCount += round(x0 - (perpx * (innerWeight - outerWeight) * 0.5), y0 - (perpy * (innerWeight - outerWeight) * 0.5), x0 - (perpx * innerWeight), y0 - (perpy * innerWeight), x0 + (perpx * outerWeight), y0 + (perpy * outerWeight), verts, true) + 2; + } + else if (style.cap === exports.LINE_CAP.SQUARE) { + indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts); + } + } + // Push first point (below & above vertices) + verts.push(x0 - (perpx * innerWeight), y0 - (perpy * innerWeight)); + verts.push(x0 + (perpx * outerWeight), y0 + (perpy * outerWeight)); + for (var i = 1; i < length - 1; ++i) { + x0 = points[(i - 1) * 2]; + y0 = points[((i - 1) * 2) + 1]; + x1 = points[i * 2]; + y1 = points[(i * 2) + 1]; + x2 = points[(i + 1) * 2]; + y2 = points[((i + 1) * 2) + 1]; + perpx = -(y0 - y1); + perpy = x0 - x1; + dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + perp1x = -(y1 - y2); + perp1y = x1 - x2; + dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y)); + perp1x /= dist; + perp1y /= dist; + perp1x *= width; + perp1y *= width; + /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */ + var dx0 = x1 - x0; + var dy0 = y0 - y1; + var dx1 = x1 - x2; + var dy1 = y2 - y1; + /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */ + var cross = (dy0 * dx1) - (dy1 * dx0); + var clockwise = (cross < 0); + /* Going nearly straight? */ + if (Math.abs(cross) < 0.1) { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); + continue; + } + /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */ + var c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0)); + var c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2)); + var px = ((dx0 * c2) - (dx1 * c1)) / cross; + var py = ((dy1 * c1) - (dy0 * c2)) / cross; + var pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1)); + /* Inner miter point */ + var imx = x1 + ((px - x1) * innerWeight); + var imy = y1 + ((py - y1) * innerWeight); + /* Outer miter point */ + var omx = x1 - ((px - x1) * outerWeight); + var omy = y1 - ((py - y1) * outerWeight); + /* Is the inside miter point too far away, creating a spike? */ + var smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1)); + var insideWeight = clockwise ? innerWeight : outerWeight; + var smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared); + var insideMiterOk = pdist <= smallerInsideDiagonalSq; + if (insideMiterOk) { + if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { + if (clockwise) /* rotating at inner angle */ { + verts.push(imx, imy); // inner miter point + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex + verts.push(imx, imy); // inner miter point + verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex + } + else /* rotating at outer angle */ { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex + verts.push(omx, omy); // outer miter point + verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's outer vertex + verts.push(omx, omy); // outer miter point + } + indexCount += 2; + } + else if (style.join === exports.LINE_JOIN.ROUND) { + if (clockwise) /* arc is outside */ { + verts.push(imx, imy); + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); + indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 4; + verts.push(imx, imy); + verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); + } + else /* arc is inside */ { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); + verts.push(omx, omy); + indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 4; + verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); + verts.push(omx, omy); + } + } + else { + verts.push(imx, imy); + verts.push(omx, omy); + } + } + else // inside miter is NOT ok + { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex + if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { ; } + else if (style.join === exports.LINE_JOIN.ROUND) { + if (clockwise) /* arc is outside */ { + indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 2; + } + else /* arc is inside */ { + indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 2; + } + } + else { + if (clockwise) { + verts.push(omx, omy); // inner miter point + verts.push(omx, omy); // inner miter point + } + else { + verts.push(imx, imy); // outer miter point + verts.push(imx, imy); // outer miter point + } + indexCount += 2; + } + verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex + verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex + indexCount += 2; + } + } + x0 = points[(length - 2) * 2]; + y0 = points[((length - 2) * 2) + 1]; + x1 = points[(length - 1) * 2]; + y1 = points[((length - 1) * 2) + 1]; + perpx = -(y0 - y1); + perpy = x0 - x1; + dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); + perpx /= dist; + perpy /= dist; + perpx *= width; + perpy *= width; + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); + if (!closedShape) { + if (style.cap === exports.LINE_CAP.ROUND) { + indexCount += round(x1 - (perpx * (innerWeight - outerWeight) * 0.5), y1 - (perpy * (innerWeight - outerWeight) * 0.5), x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), verts, false) + 2; + } + else if (style.cap === exports.LINE_CAP.SQUARE) { + indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts); + } + } + var indices = graphicsGeometry.indices; + var eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon; + // indices.push(indexStart); + for (var i = indexStart; i < indexCount + indexStart - 2; ++i) { + x0 = verts[(i * 2)]; + y0 = verts[(i * 2) + 1]; + x1 = verts[(i + 1) * 2]; + y1 = verts[((i + 1) * 2) + 1]; + x2 = verts[(i + 2) * 2]; + y2 = verts[((i + 2) * 2) + 1]; + /* Skip zero area triangles */ + if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2) { + continue; + } + indices.push(i, i + 1, i + 2); + } + } + /** + * Builds a line to draw using the gl.drawArrays(gl.LINES) method + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output + */ + function buildNativeLine(graphicsData, graphicsGeometry) { + var i = 0; + var shape = graphicsData.shape; + var points = graphicsData.points || shape.points; + var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; + if (points.length === 0) + { return; } + var verts = graphicsGeometry.points; + var indices = graphicsGeometry.indices; + var length = points.length / 2; + var startIndex = verts.length / 2; + var currentIndex = startIndex; + verts.push(points[0], points[1]); + for (i = 1; i < length; i++) { + verts.push(points[i * 2], points[(i * 2) + 1]); + indices.push(currentIndex, currentIndex + 1); + currentIndex++; + } + if (closedShape) { + indices.push(currentIndex, startIndex); + } + } + /** + * Builds a line to draw + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output + */ + function buildLine(graphicsData, graphicsGeometry) { + if (graphicsData.lineStyle.native) { + buildNativeLine(graphicsData, graphicsGeometry); + } + else { + buildNonNativeLine(graphicsData, graphicsGeometry); + } + } + + /** + * Draw a star shape with an arbitrary number of points. + * + * @class + * @extends PIXI.Polygon + * @memberof PIXI.graphicsUtils + * @param {number} x - Center X position of the star + * @param {number} y - Center Y position of the star + * @param {number} points - The number of points of the star, must be > 1 + * @param {number} radius - The outer radius of the star + * @param {number} [innerRadius] - The inner radius between points, default half `radius` + * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + var Star = /** @class */ (function (_super) { + __extends$5(Star, _super); + function Star(x, y, points, radius, innerRadius, rotation) { + if (rotation === void 0) { rotation = 0; } + var _this = this; + innerRadius = innerRadius || radius / 2; + var startAngle = (-1 * Math.PI / 2) + rotation; + var len = points * 2; + var delta = PI_2 / len; + var polygon = []; + for (var i = 0; i < len; i++) { + var r = i % 2 ? innerRadius : radius; + var angle = (i * delta) + startAngle; + polygon.push(x + (r * Math.cos(angle)), y + (r * Math.sin(angle))); + } + _this = _super.call(this, polygon) || this; + return _this; + } + return Star; + }(Polygon)); + + /** + * Utilities for arc curves + * @class + * @private + */ + var ArcUtils = /** @class */ (function () { + function ArcUtils() { + } + /** + * The arcTo() method creates an arc/curve between two tangents on the canvas. + * + * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! + * + * @private + * @param {number} x1 - The x-coordinate of the beginning of the arc + * @param {number} y1 - The y-coordinate of the beginning of the arc + * @param {number} x2 - The x-coordinate of the end of the arc + * @param {number} y2 - The y-coordinate of the end of the arc + * @param {number} radius - The radius of the arc + * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`. + */ + ArcUtils.curveTo = function (x1, y1, x2, y2, radius, points) { + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var a1 = fromY - y1; + var b1 = fromX - x1; + var a2 = y2 - y1; + var b2 = x2 - x1; + var mm = Math.abs((a1 * b2) - (b1 * a2)); + if (mm < 1.0e-8 || radius === 0) { + if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) { + points.push(x1, y1); + } + return null; + } + var dd = (a1 * a1) + (b1 * b1); + var cc = (a2 * a2) + (b2 * b2); + var tt = (a1 * a2) + (b1 * b2); + var k1 = radius * Math.sqrt(dd) / mm; + var k2 = radius * Math.sqrt(cc) / mm; + var j1 = k1 * tt / dd; + var j2 = k2 * tt / cc; + var cx = (k1 * b2) + (k2 * b1); + var cy = (k1 * a2) + (k2 * a1); + var px = b1 * (k2 + j1); + var py = a1 * (k2 + j1); + var qx = b2 * (k1 + j2); + var qy = a2 * (k1 + j2); + var startAngle = Math.atan2(py - cy, px - cx); + var endAngle = Math.atan2(qy - cy, qx - cx); + return { + cx: (cx + x1), + cy: (cy + y1), + radius: radius, + startAngle: startAngle, + endAngle: endAngle, + anticlockwise: (b1 * a2 > b2 * a1), + }; + }; + /* eslint-disable max-len */ + /** + * The arc method creates an arc/curve (used to create circles, or parts of circles). + * + * @private + * @param {number} startX - Start x location of arc + * @param {number} startY - Start y location of arc + * @param {number} cx - The x-coordinate of the center of the circle + * @param {number} cy - The y-coordinate of the center of the circle + * @param {number} radius - The radius of the circle + * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position + * of the arc's circle) + * @param {number} endAngle - The ending angle, in radians + * @param {boolean} anticlockwise - Specifies whether the drawing should be + * counter-clockwise or clockwise. False is default, and indicates clockwise, while true + * indicates counter-clockwise. + * @param {number[]} points - Collection of points to add to + */ + ArcUtils.arc = function (_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) { + var sweep = endAngle - startAngle; + var n = GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / PI_2) * 40); + var theta = (sweep) / (n * 2); + var theta2 = theta * 2; + var cTheta = Math.cos(theta); + var sTheta = Math.sin(theta); + var segMinus = n - 1; + var remainder = (segMinus % 1) / segMinus; + for (var i = 0; i <= segMinus; ++i) { + var real = i + (remainder * i); + var angle = ((theta) + startAngle + (theta2 * real)); + var c = Math.cos(angle); + var s = -Math.sin(angle); + points.push((((cTheta * c) + (sTheta * s)) * radius) + cx, (((cTheta * -s) + (sTheta * c)) * radius) + cy); + } + }; + return ArcUtils; + }()); + + /** + * Utilities for bezier curves + * @class + * @private + */ + var BezierUtils = /** @class */ (function () { + function BezierUtils() { + } + /** + * Calculate length of bezier curve. + * Analytical solution is impossible, since it involves an integral that does not integrate in general. + * Therefore numerical solution is used. + * + * @private + * @param {number} fromX - Starting point x + * @param {number} fromY - Starting point y + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {number} Length of bezier curve + */ + BezierUtils.curveLength = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) { + var n = 10; + var result = 0.0; + var t = 0.0; + var t2 = 0.0; + var t3 = 0.0; + var nt = 0.0; + var nt2 = 0.0; + var nt3 = 0.0; + var x = 0.0; + var y = 0.0; + var dx = 0.0; + var dy = 0.0; + var prevX = fromX; + var prevY = fromY; + for (var i = 1; i <= n; ++i) { + t = i / n; + t2 = t * t; + t3 = t2 * t; + nt = (1.0 - t); + nt2 = nt * nt; + nt3 = nt2 * nt; + x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX); + y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY); + dx = prevX - x; + dy = prevY - y; + prevX = x; + prevY = y; + result += Math.sqrt((dx * dx) + (dy * dy)); + } + return result; + }; + /** + * Calculate the points for a bezier curve and then draws it. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number[]} points - Path array to push points into + */ + BezierUtils.curveTo = function (cpX, cpY, cpX2, cpY2, toX, toY, points) { + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + points.length -= 2; + var n = GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)); + var dt = 0; + var dt2 = 0; + var dt3 = 0; + var t2 = 0; + var t3 = 0; + points.push(fromX, fromY); + for (var i = 1, j = 0; i <= n; ++i) { + j = i / n; + dt = (1 - j); + dt2 = dt * dt; + dt3 = dt2 * dt; + t2 = j * j; + t3 = t2 * j; + points.push((dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)); + } + }; + return BezierUtils; + }()); + + /** + * Utilities for quadratic curves + * @class + * @private + */ + var QuadraticUtils = /** @class */ (function () { + function QuadraticUtils() { + } + /** + * Calculate length of quadratic curve + * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/} + * for the detailed explanation of math behind this. + * + * @private + * @param {number} fromX - x-coordinate of curve start point + * @param {number} fromY - y-coordinate of curve start point + * @param {number} cpX - x-coordinate of curve control point + * @param {number} cpY - y-coordinate of curve control point + * @param {number} toX - x-coordinate of curve end point + * @param {number} toY - y-coordinate of curve end point + * @return {number} Length of quadratic curve + */ + QuadraticUtils.curveLength = function (fromX, fromY, cpX, cpY, toX, toY) { + var ax = fromX - (2.0 * cpX) + toX; + var ay = fromY - (2.0 * cpY) + toY; + var bx = (2.0 * cpX) - (2.0 * fromX); + var by = (2.0 * cpY) - (2.0 * fromY); + var a = 4.0 * ((ax * ax) + (ay * ay)); + var b = 4.0 * ((ax * bx) + (ay * by)); + var c = (bx * bx) + (by * by); + var s = 2.0 * Math.sqrt(a + b + c); + var a2 = Math.sqrt(a); + var a32 = 2.0 * a * a2; + var c2 = 2.0 * Math.sqrt(c); + var ba = b / a2; + return ((a32 * s) + + (a2 * b * (s - c2)) + + (((4.0 * c * a) - (b * b)) + * Math.log(((2.0 * a2) + ba + s) / (ba + c2)))) / (4.0 * a32); + }; + /** + * Calculate the points for a quadratic bezier curve and then draws it. + * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c + * + * @private + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number[]} points - Points to add segments to. + */ + QuadraticUtils.curveTo = function (cpX, cpY, toX, toY, points) { + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var n = GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)); + var xa = 0; + var ya = 0; + for (var i = 1; i <= n; ++i) { + var j = i / n; + xa = fromX + ((cpX - fromX) * j); + ya = fromY + ((cpY - fromY) * j); + points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j), ya + (((cpY + ((toY - cpY) * j)) - ya) * j)); + } + }; + return QuadraticUtils; + }()); + + /** + * A structure to hold interim batch objects for Graphics. + * @class + * @memberof PIXI.graphicsUtils + */ + var BatchPart = /** @class */ (function () { + function BatchPart() { + this.reset(); + } + /** + * Begin batch part + * + * @param {PIXI.FillStyle | PIXI.LineStyle} style + * @param {number} startIndex + * @param {number} attribStart + */ + BatchPart.prototype.begin = function (style, startIndex, attribStart) { + this.reset(); + this.style = style; + this.start = startIndex; + this.attribStart = attribStart; + }; + /** + * End batch part + * + * @param {number} endIndex + * @param {number} endAttrib + */ + BatchPart.prototype.end = function (endIndex, endAttrib) { + this.attribSize = endAttrib - this.attribStart; + this.size = endIndex - this.start; + }; + BatchPart.prototype.reset = function () { + this.style = null; + this.size = 0; + this.start = 0; + this.attribStart = 0; + this.attribSize = 0; + }; + return BatchPart; + }()); + + /** + * Generalized convenience utilities for Graphics. + * + * @namespace graphicsUtils + * @memberof PIXI + */ + var _a; + /** + * Map of fill commands for each shape type. + * + * @memberof PIXI.graphicsUtils + * @member {Object} FILL_COMMANDS + */ + var FILL_COMMANDS = (_a = {}, + _a[exports.SHAPES.POLY] = buildPoly, + _a[exports.SHAPES.CIRC] = buildCircle, + _a[exports.SHAPES.ELIP] = buildCircle, + _a[exports.SHAPES.RECT] = buildRectangle, + _a[exports.SHAPES.RREC] = buildRoundedRectangle, + _a); + /** + * Batch pool, stores unused batches for preventing allocations. + * + * @memberof PIXI.graphicsUtils + * @member {Array} BATCH_POOL + */ + var BATCH_POOL = []; + /** + * Draw call pool, stores unused draw calls for preventing allocations. + * + * @memberof PIXI.graphicsUtils + * @member {Array} DRAW_CALL_POOL + */ + var DRAW_CALL_POOL = []; + + var index$2 = ({ + buildPoly: buildPoly, + buildCircle: buildCircle, + buildRectangle: buildRectangle, + buildRoundedRectangle: buildRoundedRectangle, + FILL_COMMANDS: FILL_COMMANDS, + BATCH_POOL: BATCH_POOL, + DRAW_CALL_POOL: DRAW_CALL_POOL, + buildLine: buildLine, + Star: Star, + ArcUtils: ArcUtils, + BezierUtils: BezierUtils, + QuadraticUtils: QuadraticUtils, + BatchPart: BatchPart + }); + + /** + * A class to contain data useful for Graphics objects + * + * @class + * @memberof PIXI + */ + var GraphicsData = /** @class */ (function () { + /** + * + * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. + * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw + * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw + * @param {PIXI.Matrix} [matrix] - Transform matrix + */ + function GraphicsData(shape, fillStyle, lineStyle, matrix) { + if (fillStyle === void 0) { fillStyle = null; } + if (lineStyle === void 0) { lineStyle = null; } + if (matrix === void 0) { matrix = null; } + /** + * The shape object to draw. + * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} + */ + this.shape = shape; + /** + * The style of the line. + * @member {PIXI.LineStyle} + */ + this.lineStyle = lineStyle; + /** + * The style of the fill. + * @member {PIXI.FillStyle} + */ + this.fillStyle = fillStyle; + /** + * The transform matrix. + * @member {PIXI.Matrix} + */ + this.matrix = matrix; + /** + * The type of the shape, see the Const.Shapes file for all the existing types, + * @member {number} + */ + this.type = shape.type; + /** + * The collection of points. + * @member {number[]} + */ + this.points = []; + /** + * The collection of holes. + * @member {PIXI.GraphicsData[]} + */ + this.holes = []; + } + /** + * Creates a new GraphicsData object with the same values as this one. + * + * @return {PIXI.GraphicsData} Cloned GraphicsData object + */ + GraphicsData.prototype.clone = function () { + return new GraphicsData(this.shape, this.fillStyle, this.lineStyle, this.matrix); + }; + /** + * Destroys the Graphics data. + * + */ + GraphicsData.prototype.destroy = function () { + this.shape = null; + this.holes.length = 0; + this.holes = null; + this.points.length = 0; + this.points = null; + this.lineStyle = null; + this.fillStyle = null; + }; + return GraphicsData; + }()); + + var tmpPoint = new Point(); + var tmpBounds = new Bounds(); + /** + * The Graphics class contains methods used to draw primitive shapes such as lines, circles and + * rectangles to the display, and to color and fill them. + * + * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive + * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster. + * + * @class + * @extends PIXI.BatchGeometry + * @memberof PIXI + */ + var GraphicsGeometry = /** @class */ (function (_super) { + __extends$5(GraphicsGeometry, _super); + function GraphicsGeometry() { + var _this = _super.call(this) || this; + _this.uvsFloat32 = null; + _this.indicesUint16 = null; + /** + * An array of points to draw, 2 numbers per point + * + * @member {number[]} + * @protected + */ + _this.points = []; + /** + * The collection of colors + * + * @member {number[]} + * @protected + */ + _this.colors = []; + /** + * The UVs collection + * + * @member {number[]} + * @protected + */ + _this.uvs = []; + /** + * The indices of the vertices + * + * @member {number[]} + * @protected + */ + _this.indices = []; + /** + * Reference to the texture IDs. + * + * @member {number[]} + * @protected + */ + _this.textureIds = []; + /** + * The collection of drawn shapes. + * + * @member {PIXI.GraphicsData[]} + * @protected + */ + _this.graphicsData = []; + /** + * Used to detect if the graphics object has changed. + * + * @member {number} + * @protected + */ + _this.dirty = 0; + /** + * Batches need to regenerated if the geometry is updated. + * + * @member {number} + * @protected + */ + _this.batchDirty = -1; + /** + * Used to check if the cache is dirty. + * + * @member {number} + * @protected + */ + _this.cacheDirty = -1; + /** + * Used to detect if we cleared the graphicsData. + * + * @member {number} + * @default 0 + * @protected + */ + _this.clearDirty = 0; + /** + * List of current draw calls drived from the batches. + * + * @member {object[]} + * @protected + */ + _this.drawCalls = []; + /** + * Intermediate abstract format sent to batch system. + * Can be converted to drawCalls or to batchable objects. + * + * @member {PIXI.graphicsUtils.BatchPart[]} + * @protected + */ + _this.batches = []; + /** + * Index of the last batched shape in the stack of calls. + * + * @member {number} + * @protected + */ + _this.shapeIndex = 0; + /** + * Cached bounds. + * + * @member {PIXI.Bounds} + * @protected + */ + _this._bounds = new Bounds(); + /** + * The bounds dirty flag. + * + * @member {number} + * @protected + */ + _this.boundsDirty = -1; + /** + * Padding to add to the bounds. + * + * @member {number} + * @default 0 + */ + _this.boundsPadding = 0; + _this.batchable = false; + _this.indicesUint16 = null; + _this.uvsFloat32 = null; + /** + * Minimal distance between points that are considered different. + * Affects line tesselation. + * + * @member {number} + */ + _this.closePointEps = 1e-4; + return _this; + } + Object.defineProperty(GraphicsGeometry.prototype, "bounds", { + /** + * Get the current bounds of the graphic geometry. + * + * @member {PIXI.Bounds} + * @readonly + */ + get: function () { + if (this.boundsDirty !== this.dirty) { + this.boundsDirty = this.dirty; + this.calculateBounds(); + } + return this._bounds; + }, + enumerable: false, + configurable: true + }); + /** + * Call if you changed graphicsData manually. + * Empties all batch buffers. + */ + GraphicsGeometry.prototype.invalidate = function () { + this.boundsDirty = -1; + this.dirty++; + this.batchDirty++; + this.shapeIndex = 0; + this.points.length = 0; + this.colors.length = 0; + this.uvs.length = 0; + this.indices.length = 0; + this.textureIds.length = 0; + for (var i = 0; i < this.drawCalls.length; i++) { + this.drawCalls[i].texArray.clear(); + DRAW_CALL_POOL.push(this.drawCalls[i]); + } + this.drawCalls.length = 0; + for (var i = 0; i < this.batches.length; i++) { + var batchPart = this.batches[i]; + batchPart.reset(); + BATCH_POOL.push(batchPart); + } + this.batches.length = 0; + }; + /** + * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. + * + * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls + */ + GraphicsGeometry.prototype.clear = function () { + if (this.graphicsData.length > 0) { + this.invalidate(); + this.clearDirty++; + this.graphicsData.length = 0; + } + return this; + }; + /** + * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. + * + * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. + * @param {PIXI.FillStyle} fillStyle - Defines style of the fill. + * @param {PIXI.LineStyle} lineStyle - Defines style of the lines. + * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. + */ + GraphicsGeometry.prototype.drawShape = function (shape, fillStyle, lineStyle, matrix) { + if (fillStyle === void 0) { fillStyle = null; } + if (lineStyle === void 0) { lineStyle = null; } + if (matrix === void 0) { matrix = null; } + var data = new GraphicsData(shape, fillStyle, lineStyle, matrix); + this.graphicsData.push(data); + this.dirty++; + return this; + }; + /** + * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. + * + * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. + * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. + * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. + */ + GraphicsGeometry.prototype.drawHole = function (shape, matrix) { + if (matrix === void 0) { matrix = null; } + if (!this.graphicsData.length) { + return null; + } + var data = new GraphicsData(shape, null, null, matrix); + var lastShape = this.graphicsData[this.graphicsData.length - 1]; + data.lineStyle = lastShape.lineStyle; + lastShape.holes.push(data); + this.dirty++; + return this; + }; + /** + * Destroys the GraphicsGeometry object. + * + */ + GraphicsGeometry.prototype.destroy = function () { + _super.prototype.destroy.call(this); + // destroy each of the GraphicsData objects + for (var i = 0; i < this.graphicsData.length; ++i) { + this.graphicsData[i].destroy(); + } + this.points.length = 0; + this.points = null; + this.colors.length = 0; + this.colors = null; + this.uvs.length = 0; + this.uvs = null; + this.indices.length = 0; + this.indices = null; + this.indexBuffer.destroy(); + this.indexBuffer = null; + this.graphicsData.length = 0; + this.graphicsData = null; + this.drawCalls.length = 0; + this.drawCalls = null; + this.batches.length = 0; + this.batches = null; + this._bounds = null; + }; + /** + * Check to see if a point is contained within this geometry. + * + * @param {PIXI.IPointData} point - Point to check if it's contained. + * @return {Boolean} `true` if the point is contained within geometry. + */ + GraphicsGeometry.prototype.containsPoint = function (point) { + var graphicsData = this.graphicsData; + for (var i = 0; i < graphicsData.length; ++i) { + var data = graphicsData[i]; + if (!data.fillStyle.visible) { + continue; + } + // only deal with fills.. + if (data.shape) { + if (data.matrix) { + data.matrix.applyInverse(point, tmpPoint); + } + else { + tmpPoint.copyFrom(point); + } + if (data.shape.contains(tmpPoint.x, tmpPoint.y)) { + var hitHole = false; + if (data.holes) { + for (var i_1 = 0; i_1 < data.holes.length; i_1++) { + var hole = data.holes[i_1]; + if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) { + hitHole = true; + break; + } + } + } + if (!hitHole) { + return true; + } + } + } + } + return false; + }; + /** + * Generates intermediate batch data. Either gets converted to drawCalls + * or used to convert to batch objects directly by the Graphics object. + * + * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices + */ + GraphicsGeometry.prototype.updateBatches = function (allow32Indices) { + if (!this.graphicsData.length) { + this.batchable = true; + return; + } + if (!this.validateBatching()) { + return; + } + this.cacheDirty = this.dirty; + var uvs = this.uvs; + var graphicsData = this.graphicsData; + var batchPart = null; + var currentStyle = null; + if (this.batches.length > 0) { + batchPart = this.batches[this.batches.length - 1]; + currentStyle = batchPart.style; + } + for (var i = this.shapeIndex; i < graphicsData.length; i++) { + this.shapeIndex++; + var data = graphicsData[i]; + var fillStyle = data.fillStyle; + var lineStyle = data.lineStyle; + var command = FILL_COMMANDS[data.type]; + // build out the shapes points.. + command.build(data); + if (data.matrix) { + this.transformPoints(data.points, data.matrix); + } + for (var j = 0; j < 2; j++) { + var style = (j === 0) ? fillStyle : lineStyle; + if (!style.visible) + { continue; } + var nextTexture = style.texture.baseTexture; + var index_1 = this.indices.length; + var attribIndex = this.points.length / 2; + nextTexture.wrapMode = exports.WRAP_MODES.REPEAT; + if (j === 0) { + this.processFill(data); + } + else { + this.processLine(data); + } + var size = (this.points.length / 2) - attribIndex; + if (size === 0) + { continue; } + // close batch if style is different + if (batchPart && !this._compareStyles(currentStyle, style)) { + batchPart.end(index_1, attribIndex); + batchPart = null; + } + // spawn new batch if its first batch or previous was closed + if (!batchPart) { + batchPart = BATCH_POOL.pop() || new BatchPart(); + batchPart.begin(style, index_1, attribIndex); + this.batches.push(batchPart); + currentStyle = style; + } + this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix); + } + } + var index = this.indices.length; + var attrib = this.points.length / 2; + if (batchPart) { + batchPart.end(index, attrib); + } + if (this.batches.length === 0) { + // there are no visible styles in GraphicsData + // its possible that someone wants Graphics just for the bounds + this.batchable = true; + return; + } + // prevent allocation when length is same as buffer + if (this.indicesUint16 && this.indices.length === this.indicesUint16.length) { + this.indicesUint16.set(this.indices); + } + else { + var need32 = attrib > 0xffff && allow32Indices; + this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices); + } + // TODO make this a const.. + this.batchable = this.isBatchable(); + if (this.batchable) { + this.packBatches(); + } + else { + this.buildDrawCalls(); + } + }; + /** + * Affinity check + * + * @param {PIXI.FillStyle | PIXI.LineStyle} styleA + * @param {PIXI.FillStyle | PIXI.LineStyle} styleB + */ + GraphicsGeometry.prototype._compareStyles = function (styleA, styleB) { + if (!styleA || !styleB) { + return false; + } + if (styleA.texture.baseTexture !== styleB.texture.baseTexture) { + return false; + } + if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) { + return false; + } + if (!!styleA.native !== !!styleB.native) { + return false; + } + return true; + }; + /** + * Test geometry for batching process. + * + * @protected + */ + GraphicsGeometry.prototype.validateBatching = function () { + if (this.dirty === this.cacheDirty || !this.graphicsData.length) { + return false; + } + for (var i = 0, l = this.graphicsData.length; i < l; i++) { + var data = this.graphicsData[i]; + var fill = data.fillStyle; + var line = data.lineStyle; + if (fill && !fill.texture.baseTexture.valid) + { return false; } + if (line && !line.texture.baseTexture.valid) + { return false; } + } + return true; + }; + /** + * Offset the indices so that it works with the batcher. + * + * @protected + */ + GraphicsGeometry.prototype.packBatches = function () { + this.batchDirty++; + this.uvsFloat32 = new Float32Array(this.uvs); + var batches = this.batches; + for (var i = 0, l = batches.length; i < l; i++) { + var batch = batches[i]; + for (var j = 0; j < batch.size; j++) { + var index = batch.start + j; + this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart; + } + } + }; + /** + * Checks to see if this graphics geometry can be batched. + * Currently it needs to be small enough and not contain any native lines. + * + * @protected + */ + GraphicsGeometry.prototype.isBatchable = function () { + // prevent heavy mesh batching + if (this.points.length > 0xffff * 2) { + return false; + } + var batches = this.batches; + for (var i = 0; i < batches.length; i++) { + if (batches[i].style.native) { + return false; + } + } + return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2); + }; + /** + * Converts intermediate batches data to drawCalls. + * + * @protected + */ + GraphicsGeometry.prototype.buildDrawCalls = function () { + var TICK = ++BaseTexture._globalBatch; + for (var i = 0; i < this.drawCalls.length; i++) { + this.drawCalls[i].texArray.clear(); + DRAW_CALL_POOL.push(this.drawCalls[i]); + } + this.drawCalls.length = 0; + var colors = this.colors; + var textureIds = this.textureIds; + var currentGroup = DRAW_CALL_POOL.pop(); + if (!currentGroup) { + currentGroup = new BatchDrawCall(); + currentGroup.texArray = new BatchTextureArray(); + } + currentGroup.texArray.count = 0; + currentGroup.start = 0; + currentGroup.size = 0; + currentGroup.type = exports.DRAW_MODES.TRIANGLES; + var textureCount = 0; + var currentTexture = null; + var textureId = 0; + var native = false; + var drawMode = exports.DRAW_MODES.TRIANGLES; + var index = 0; + this.drawCalls.push(currentGroup); + // TODO - this can be simplified + for (var i = 0; i < this.batches.length; i++) { + var data = this.batches[i]; + // TODO add some full on MAX_TEXTURE CODE.. + var MAX_TEXTURES = 8; + // Forced cast for checking `native` without errors + var style = data.style; + var nextTexture = style.texture.baseTexture; + if (native !== !!style.native) { + native = !!style.native; + drawMode = native ? exports.DRAW_MODES.LINES : exports.DRAW_MODES.TRIANGLES; + // force the batch to break! + currentTexture = null; + textureCount = MAX_TEXTURES; + TICK++; + } + if (currentTexture !== nextTexture) { + currentTexture = nextTexture; + if (nextTexture._batchEnabled !== TICK) { + if (textureCount === MAX_TEXTURES) { + TICK++; + textureCount = 0; + if (currentGroup.size > 0) { + currentGroup = DRAW_CALL_POOL.pop(); + if (!currentGroup) { + currentGroup = new BatchDrawCall(); + currentGroup.texArray = new BatchTextureArray(); + } + this.drawCalls.push(currentGroup); + } + currentGroup.start = index; + currentGroup.size = 0; + currentGroup.texArray.count = 0; + currentGroup.type = drawMode; + } + // TODO add this to the render part.. + // Hack! Because texture has protected `touched` + nextTexture.touched = 1; // touch; + nextTexture._batchEnabled = TICK; + nextTexture._batchLocation = textureCount; + nextTexture.wrapMode = 10497; + currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture; + textureCount++; + } + } + currentGroup.size += data.size; + index += data.size; + textureId = nextTexture._batchLocation; + this.addColors(colors, style.color, style.alpha, data.attribSize, data.attribStart); + this.addTextureIds(textureIds, textureId, data.attribSize, data.attribStart); + } + BaseTexture._globalBatch = TICK; + // upload.. + // merge for now! + this.packAttributes(); + }; + /** + * Packs attributes to single buffer. + * + * @protected + */ + GraphicsGeometry.prototype.packAttributes = function () { + var verts = this.points; + var uvs = this.uvs; + var colors = this.colors; + var textureIds = this.textureIds; + // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes + var glPoints = new ArrayBuffer(verts.length * 3 * 4); + var f32 = new Float32Array(glPoints); + var u32 = new Uint32Array(glPoints); + var p = 0; + for (var i = 0; i < verts.length / 2; i++) { + f32[p++] = verts[i * 2]; + f32[p++] = verts[(i * 2) + 1]; + f32[p++] = uvs[i * 2]; + f32[p++] = uvs[(i * 2) + 1]; + u32[p++] = colors[i]; + f32[p++] = textureIds[i]; + } + this._buffer.update(glPoints); + this._indexBuffer.update(this.indicesUint16); + }; + /** + * Process fill part of Graphics. + * + * @param {PIXI.GraphicsData} data + * @protected + */ + GraphicsGeometry.prototype.processFill = function (data) { + if (data.holes.length) { + this.processHoles(data.holes); + buildPoly.triangulate(data, this); + } + else { + var command = FILL_COMMANDS[data.type]; + command.triangulate(data, this); + } + }; + /** + * Process line part of Graphics. + * + * @param {PIXI.GraphicsData} data + * @protected + */ + GraphicsGeometry.prototype.processLine = function (data) { + buildLine(data, this); + for (var i = 0; i < data.holes.length; i++) { + buildLine(data.holes[i], this); + } + }; + /** + * Process the holes data. + * + * @param {PIXI.GraphicsData[]} holes - Holes to render + * @protected + */ + GraphicsGeometry.prototype.processHoles = function (holes) { + for (var i = 0; i < holes.length; i++) { + var hole = holes[i]; + var command = FILL_COMMANDS[hole.type]; + command.build(hole); + if (hole.matrix) { + this.transformPoints(hole.points, hole.matrix); + } + } + }; + /** + * Update the local bounds of the object. Expensive to use performance-wise. + * + * @protected + */ + GraphicsGeometry.prototype.calculateBounds = function () { + var bounds = this._bounds; + var sequenceBounds = tmpBounds; + var curMatrix = Matrix.IDENTITY; + this._bounds.clear(); + sequenceBounds.clear(); + for (var i = 0; i < this.graphicsData.length; i++) { + var data = this.graphicsData[i]; + var shape = data.shape; + var type = data.type; + var lineStyle = data.lineStyle; + var nextMatrix = data.matrix || Matrix.IDENTITY; + var lineWidth = 0.0; + if (lineStyle && lineStyle.visible) { + var alignment = lineStyle.alignment; + lineWidth = lineStyle.width; + if (type === exports.SHAPES.POLY) { + lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment)); + } + else { + lineWidth = lineWidth * Math.max(0, alignment); + } + } + if (curMatrix !== nextMatrix) { + if (!sequenceBounds.isEmpty()) { + bounds.addBoundsMatrix(sequenceBounds, curMatrix); + sequenceBounds.clear(); + } + curMatrix = nextMatrix; + } + if (type === exports.SHAPES.RECT || type === exports.SHAPES.RREC) { + var rect = shape; + sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, lineWidth, lineWidth); + } + else if (type === exports.SHAPES.CIRC) { + var circle = shape; + sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y, circle.radius + lineWidth, circle.radius + lineWidth); + } + else if (type === exports.SHAPES.ELIP) { + var ellipse = shape; + sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y, ellipse.width + lineWidth, ellipse.height + lineWidth); + } + else { + var poly = shape; + // adding directly to the bounds + bounds.addVerticesMatrix(curMatrix, poly.points, 0, poly.points.length, lineWidth, lineWidth); + } + } + if (!sequenceBounds.isEmpty()) { + bounds.addBoundsMatrix(sequenceBounds, curMatrix); + } + bounds.pad(this.boundsPadding, this.boundsPadding); + }; + /** + * Transform points using matrix. + * + * @protected + * @param {number[]} points - Points to transform + * @param {PIXI.Matrix} matrix - Transform matrix + */ + GraphicsGeometry.prototype.transformPoints = function (points, matrix) { + for (var i = 0; i < points.length / 2; i++) { + var x = points[(i * 2)]; + var y = points[(i * 2) + 1]; + points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx; + points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty; + } + }; + /** + * Add colors. + * + * @protected + * @param {number[]} colors - List of colors to add to + * @param {number} color - Color to add + * @param {number} alpha - Alpha to use + * @param {number} size - Number of colors to add + * @param {number} offset + */ + GraphicsGeometry.prototype.addColors = function (colors, color, alpha, size, offset) { + if (offset === void 0) { offset = 0; } + // TODO use the premultiply bits Ivan added + var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16); + var rgba = premultiplyTint(rgb, alpha); + colors.length = Math.max(colors.length, offset + size); + for (var i = 0; i < size; i++) { + colors[offset + i] = rgba; + } + }; + /** + * Add texture id that the shader/fragment wants to use. + * + * @protected + * @param {number[]} textureIds + * @param {number} id + * @param {number} size + * @param {number} offset + */ + GraphicsGeometry.prototype.addTextureIds = function (textureIds, id, size, offset) { + if (offset === void 0) { offset = 0; } + textureIds.length = Math.max(textureIds.length, offset + size); + for (var i = 0; i < size; i++) { + textureIds[offset + i] = id; + } + }; + /** + * Generates the UVs for a shape. + * + * @protected + * @param {number[]} verts - Vertices + * @param {number[]} uvs - UVs + * @param {PIXI.Texture} texture - Reference to Texture + * @param {number} start - Index buffer start index. + * @param {number} size - The size/length for index buffer. + * @param {PIXI.Matrix} [matrix] - Optional transform for all points. + */ + GraphicsGeometry.prototype.addUvs = function (verts, uvs, texture, start, size, matrix) { + if (matrix === void 0) { matrix = null; } + var index = 0; + var uvsStart = uvs.length; + var frame = texture.frame; + while (index < size) { + var x = verts[(start + index) * 2]; + var y = verts[((start + index) * 2) + 1]; + if (matrix) { + var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx; + y = (matrix.b * x) + (matrix.d * y) + matrix.ty; + x = nx; + } + index++; + uvs.push(x / frame.width, y / frame.height); + } + var baseTexture = texture.baseTexture; + if (frame.width < baseTexture.width + || frame.height < baseTexture.height) { + this.adjustUvs(uvs, texture, uvsStart, size); + } + }; + /** + * Modify uvs array according to position of texture region + * Does not work with rotated or trimmed textures + * + * @param {number[]} uvs - array + * @param {PIXI.Texture} texture - region + * @param {number} start - starting index for uvs + * @param {number} size - how many points to adjust + */ + GraphicsGeometry.prototype.adjustUvs = function (uvs, texture, start, size) { + var baseTexture = texture.baseTexture; + var eps = 1e-6; + var finish = start + (size * 2); + var frame = texture.frame; + var scaleX = frame.width / baseTexture.width; + var scaleY = frame.height / baseTexture.height; + var offsetX = frame.x / frame.width; + var offsetY = frame.y / frame.height; + var minX = Math.floor(uvs[start] + eps); + var minY = Math.floor(uvs[start + 1] + eps); + for (var i = start + 2; i < finish; i += 2) { + minX = Math.min(minX, Math.floor(uvs[i] + eps)); + minY = Math.min(minY, Math.floor(uvs[i + 1] + eps)); + } + offsetX -= minX; + offsetY -= minY; + for (var i = start; i < finish; i += 2) { + uvs[i] = (uvs[i] + offsetX) * scaleX; + uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY; + } + }; + /** + * The maximum number of points to consider an object "batchable", + * able to be batched by the renderer's batch system. + * + * @memberof PIXI.GraphicsGeometry + * @static + * @member {number} BATCHABLE_SIZE + * @default 100 + */ + GraphicsGeometry.BATCHABLE_SIZE = 100; + return GraphicsGeometry; + }(BatchGeometry)); + + /** + * Represents the line style for Graphics. + * @memberof PIXI + * @class + * @extends PIXI.FillStyle + */ + var LineStyle = /** @class */ (function (_super) { + __extends$5(LineStyle, _super); + function LineStyle() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * The width (thickness) of any lines drawn. + * + * @member {number} + * @default 0 + */ + _this.width = 0; + /** + * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). + * + * @member {number} + * @default 0.5 + */ + _this.alignment = 0.5; + /** + * If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * + * @member {boolean} + * @default false + */ + _this.native = false; + /** + * Line cap style. + * + * @member {PIXI.LINE_CAP} + * @default PIXI.LINE_CAP.BUTT + */ + _this.cap = exports.LINE_CAP.BUTT; + /** + * Line join style. + * + * @member {PIXI.LINE_JOIN} + * @default PIXI.LINE_JOIN.MITER + */ + _this.join = exports.LINE_JOIN.MITER; + /** + * Miter limit. + * + * @member {number} + * @default 10 + */ + _this.miterLimit = 10; + return _this; + } + /** + * Clones the object + * + * @return {PIXI.LineStyle} + */ + LineStyle.prototype.clone = function () { + var obj = new LineStyle(); + obj.color = this.color; + obj.alpha = this.alpha; + obj.texture = this.texture; + obj.matrix = this.matrix; + obj.visible = this.visible; + obj.width = this.width; + obj.alignment = this.alignment; + obj.native = this.native; + obj.cap = this.cap; + obj.join = this.join; + obj.miterLimit = this.miterLimit; + return obj; + }; + /** + * Reset the line style to default. + */ + LineStyle.prototype.reset = function () { + _super.prototype.reset.call(this); + // Override default line style color + this.color = 0x0; + this.alignment = 0.5; + this.width = 0; + this.native = false; + }; + return LineStyle; + }(FillStyle)); + + var temp = new Float32Array(3); + // a default shaders map used by graphics.. + var DEFAULT_SHADERS = {}; + /** + * The Graphics class contains methods used to draw primitive shapes such as lines, circles and + * rectangles to the display, and to color and fill them. + * + * Note that because Graphics can share a GraphicsGeometry with other instances, + * it is necessary to call `destroy()` to properly dereference the underlying + * GraphicsGeometry and avoid a memory leak. Alternatively, keep using the same + * Graphics instance and call `clear()` between redraws. + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + var Graphics = /** @class */ (function (_super) { + __extends$5(Graphics, _super); + /** + * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted + * will create a new GraphicsGeometry instance. + */ + function Graphics(geometry) { + if (geometry === void 0) { geometry = null; } + var _this = _super.call(this) || this; + _this._geometry = geometry || new GraphicsGeometry(); + _this._geometry.refCount++; + /** + * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. + * Can be shared between multiple Graphics objects. + * + * @member {PIXI.Shader} + */ + _this.shader = null; + /** + * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., + * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. + * + * @member {PIXI.State} + */ + _this.state = State.for2d(); + /** + * Current fill style + * + * @member {PIXI.FillStyle} + * @protected + */ + _this._fillStyle = new FillStyle(); + /** + * Current line style + * + * @member {PIXI.LineStyle} + * @protected + */ + _this._lineStyle = new LineStyle(); + /** + * Current shape transform matrix. + * + * @member {PIXI.Matrix} + * @protected + */ + _this._matrix = null; + /** + * Current hole mode is enabled. + * + * @member {boolean} + * @default false + * @protected + */ + _this._holeMode = false; + /** + * Current path + * + * @member {PIXI.Polygon} + * @protected + */ + _this.currentPath = null; + /** + * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. + * This is useful if your graphics element does not change often, as it will speed up the rendering + * of the object in exchange for taking up texture memory. It is also useful if you need the graphics + * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if + * you are constantly redrawing the graphics element. + * + * @name cacheAsBitmap + * @member {boolean} + * @memberof PIXI.Graphics# + * @default false + */ + /** + * A collections of batches! These can be drawn by the renderer batch system. + * + * @protected + * @member {object[]} + */ + _this.batches = []; + /** + * Update dirty for limiting calculating tints for batches. + * + * @protected + * @member {number} + * @default -1 + */ + _this.batchTint = -1; + /** + * Update dirty for limiting calculating batches. + * + * @protected + * @member {number} + * @default -1 + */ + _this.batchDirty = -1; + /** + * Copy of the object vertex data. + * + * @protected + * @member {Float32Array} + */ + _this.vertexData = null; + /** + * Renderer plugin for batching + * + * @member {string} + * @default 'batch' + */ + _this.pluginName = 'batch'; + _this._transformID = -1; + // Set default + _this.tint = 0xFFFFFF; + _this.blendMode = exports.BLEND_MODES.NORMAL; + return _this; + } + Object.defineProperty(Graphics.prototype, "geometry", { + /** + * Includes vertex positions, face indices, normals, colors, UVs, and + * custom attributes within buffers, reducing the cost of passing all + * this data to the GPU. Can be shared between multiple Mesh or Graphics objects. + * + * @member {PIXI.GraphicsGeometry} + * @readonly + */ + get: function () { + return this._geometry; + }, + enumerable: false, + configurable: true + }); + /** + * Creates a new Graphics object with the same values as this one. + * Note that only the geometry of the object is cloned, not its transform (position,scale,etc) + * + * @return {PIXI.Graphics} A clone of the graphics object + */ + Graphics.prototype.clone = function () { + this.finishPoly(); + return new Graphics(this._geometry); + }; + Object.defineProperty(Graphics.prototype, "blendMode", { + get: function () { + return this.state.blendMode; + }, + /** + * The blend mode to be applied to the graphic shape. Apply a value of + * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL; + * @see PIXI.BLEND_MODES + */ + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Graphics.prototype, "tint", { + /** + * The tint applied to the graphic shape. This is a hex value. A value of + * 0xFFFFFF will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Graphics.prototype, "fill", { + /** + * The current fill style. + * + * @member {PIXI.FillStyle} + * @readonly + */ + get: function () { + return this._fillStyle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Graphics.prototype, "line", { + /** + * The current line style. + * + * @member {PIXI.LineStyle} + * @readonly + */ + get: function () { + return this._lineStyle; + }, + enumerable: false, + configurable: true + }); + /** + * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() + * method or the drawCircle() method. + * + * @method PIXI.Graphics#lineStyle + * @param {number} [width=0] - width of the line to draw, will update the objects stored style + * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style + * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style + * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + /** + * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() + * method or the drawCircle() method. + * + * @param {object} [options] - Line style options + * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style + * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style + * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style + * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style + * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style + * @param {number}[options.miterLimit=10] - miter limit ratio + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.lineStyle = function (options) { + if (options === void 0) { options = null; } + // Support non-object params: (width, color, alpha, alignment, native) + if (typeof options === 'number') { + // eslint-disable-next-line + var args = arguments; + options = { + width: args[0] || 0, + color: args[1] || 0x0, + alpha: args[2] !== undefined ? args[2] : 1, + alignment: args[3] !== undefined ? args[3] : 0.5, + native: !!args[4], + }; + } + return this.lineTextureStyle(options); + }; + /** + * Like line style but support texture for line fill. + * + * @param {object} [options] - Collection of options for setting line style. + * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style + * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use + * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style. + * Default 0xFFFFFF if texture present. + * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style + * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture + * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style + * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style + * @param {number}[options.miterLimit=10] - miter limit ratio + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.lineTextureStyle = function (options) { + // backward compatibility with params: (width, texture, + // color, alpha, matrix, alignment, native) + if (typeof options === 'number') { + deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle'); + // eslint-disable-next-line + var _a = arguments, width = _a[0], texture = _a[1], color = _a[2], alpha = _a[3], matrix = _a[4], alignment = _a[5], native = _a[6]; + options = { width: width, texture: texture, color: color, alpha: alpha, matrix: matrix, alignment: alignment, native: native }; + // Remove undefined keys + Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); + } + // Apply defaults + options = Object.assign({ + width: 0, + texture: Texture.WHITE, + color: (options && options.texture) ? 0xFFFFFF : 0x0, + alpha: 1, + matrix: null, + alignment: 0.5, + native: false, + cap: exports.LINE_CAP.BUTT, + join: exports.LINE_JOIN.MITER, + miterLimit: 10, + }, options); + if (this.currentPath) { + this.startPoly(); + } + var visible = options.width > 0 && options.alpha > 0; + if (!visible) { + this._lineStyle.reset(); + } + else { + if (options.matrix) { + options.matrix = options.matrix.clone(); + options.matrix.invert(); + } + Object.assign(this._lineStyle, { visible: visible }, options); + } + return this; + }; + /** + * Start a polygon object internally + * @protected + */ + Graphics.prototype.startPoly = function () { + if (this.currentPath) { + var points = this.currentPath.points; + var len = this.currentPath.points.length; + if (len > 2) { + this.drawShape(this.currentPath); + this.currentPath = new Polygon(); + this.currentPath.closeStroke = false; + this.currentPath.points.push(points[len - 2], points[len - 1]); + } + } + else { + this.currentPath = new Polygon(); + this.currentPath.closeStroke = false; + } + }; + /** + * Finish the polygon object. + * @protected + */ + Graphics.prototype.finishPoly = function () { + if (this.currentPath) { + if (this.currentPath.points.length > 2) { + this.drawShape(this.currentPath); + this.currentPath = null; + } + else { + this.currentPath.points.length = 0; + } + } + }; + /** + * Moves the current drawing position to x, y. + * + * @param {number} x - the X coordinate to move to + * @param {number} y - the Y coordinate to move to + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.moveTo = function (x, y) { + this.startPoly(); + this.currentPath.points[0] = x; + this.currentPath.points[1] = y; + return this; + }; + /** + * Draws a line using the current line style from the current drawing position to (x, y); + * The current drawing position is then set to (x, y). + * + * @param {number} x - the X coordinate to draw to + * @param {number} y - the Y coordinate to draw to + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.lineTo = function (x, y) { + if (!this.currentPath) { + this.moveTo(0, 0); + } + // remove duplicates.. + var points = this.currentPath.points; + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + if (fromX !== x || fromY !== y) { + points.push(x, y); + } + return this; + }; + /** + * Initialize the curve + * + * @protected + * @param {number} [x=0] + * @param {number} [y=0] + */ + Graphics.prototype._initCurve = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (this.currentPath) { + if (this.currentPath.points.length === 0) { + this.currentPath.points = [x, y]; + } + } + else { + this.moveTo(x, y); + } + }; + /** + * Calculate the points for a quadratic bezier curve and then draws it. + * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c + * + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.quadraticCurveTo = function (cpX, cpY, toX, toY) { + this._initCurve(); + var points = this.currentPath.points; + if (points.length === 0) { + this.moveTo(0, 0); + } + QuadraticUtils.curveTo(cpX, cpY, toX, toY, points); + return this; + }; + /** + * Calculate the points for a bezier curve and then draws it. + * + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.bezierCurveTo = function (cpX, cpY, cpX2, cpY2, toX, toY) { + this._initCurve(); + BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points); + return this; + }; + /** + * The arcTo() method creates an arc/curve between two tangents on the canvas. + * + * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! + * + * @param {number} x1 - The x-coordinate of the first tangent point of the arc + * @param {number} y1 - The y-coordinate of the first tangent point of the arc + * @param {number} x2 - The x-coordinate of the end of the arc + * @param {number} y2 - The y-coordinate of the end of the arc + * @param {number} radius - The radius of the arc + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.arcTo = function (x1, y1, x2, y2, radius) { + this._initCurve(x1, y1); + var points = this.currentPath.points; + var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points); + if (result) { + var cx = result.cx, cy = result.cy, radius_1 = result.radius, startAngle = result.startAngle, endAngle = result.endAngle, anticlockwise = result.anticlockwise; + this.arc(cx, cy, radius_1, startAngle, endAngle, anticlockwise); + } + return this; + }; + /** + * The arc method creates an arc/curve (used to create circles, or parts of circles). + * + * @param {number} cx - The x-coordinate of the center of the circle + * @param {number} cy - The y-coordinate of the center of the circle + * @param {number} radius - The radius of the circle + * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position + * of the arc's circle) + * @param {number} endAngle - The ending angle, in radians + * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be + * counter-clockwise or clockwise. False is default, and indicates clockwise, while true + * indicates counter-clockwise. + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.arc = function (cx, cy, radius, startAngle, endAngle, anticlockwise) { + if (anticlockwise === void 0) { anticlockwise = false; } + if (startAngle === endAngle) { + return this; + } + if (!anticlockwise && endAngle <= startAngle) { + endAngle += PI_2; + } + else if (anticlockwise && startAngle <= endAngle) { + startAngle += PI_2; + } + var sweep = endAngle - startAngle; + if (sweep === 0) { + return this; + } + var startX = cx + (Math.cos(startAngle) * radius); + var startY = cy + (Math.sin(startAngle) * radius); + var eps = this._geometry.closePointEps; + // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path. + var points = this.currentPath ? this.currentPath.points : null; + if (points) { + // TODO: make a better fix. + // We check how far our start is from the last existing point + var xDiff = Math.abs(points[points.length - 2] - startX); + var yDiff = Math.abs(points[points.length - 1] - startY); + if (xDiff < eps && yDiff < eps) { ; } + else { + points.push(startX, startY); + } + } + else { + this.moveTo(startX, startY); + points = this.currentPath.points; + } + ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points); + return this; + }; + /** + * Specifies a simple one-color fill that subsequent calls to other Graphics methods + * (such as lineTo() or drawCircle()) use when drawing. + * + * @param {number} [color=0] - the color of the fill + * @param {number} [alpha=1] - the alpha of the fill + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.beginFill = function (color, alpha) { + if (color === void 0) { color = 0; } + if (alpha === void 0) { alpha = 1; } + return this.beginTextureFill({ texture: Texture.WHITE, color: color, alpha: alpha }); + }; + /** + * Begin the texture fill + * + * @param {object} [options] - Object object. + * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill + * @param {number} [options.color=0xffffff] - Background to fill behind texture + * @param {number} [options.alpha=1] - Alpha of fill + * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.beginTextureFill = function (options) { + // backward compatibility with params: (texture, color, alpha, matrix) + if (options instanceof Texture) { + deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill'); + // eslint-disable-next-line + var _a = arguments, texture = _a[0], color = _a[1], alpha = _a[2], matrix = _a[3]; + options = { texture: texture, color: color, alpha: alpha, matrix: matrix }; + // Remove undefined keys + Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); + } + // Apply defaults + options = Object.assign({ + texture: Texture.WHITE, + color: 0xFFFFFF, + alpha: 1, + matrix: null, + }, options); + if (this.currentPath) { + this.startPoly(); + } + var visible = options.alpha > 0; + if (!visible) { + this._fillStyle.reset(); + } + else { + if (options.matrix) { + options.matrix = options.matrix.clone(); + options.matrix.invert(); + } + Object.assign(this._fillStyle, { visible: visible }, options); + } + return this; + }; + /** + * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. + * + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.endFill = function () { + this.finishPoly(); + this._fillStyle.reset(); + return this; + }; + /** + * Draws a rectangle shape. + * + * @param {number} x - The X coord of the top-left of the rectangle + * @param {number} y - The Y coord of the top-left of the rectangle + * @param {number} width - The width of the rectangle + * @param {number} height - The height of the rectangle + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawRect = function (x, y, width, height) { + return this.drawShape(new Rectangle(x, y, width, height)); + }; + /** + * Draw a rectangle shape with rounded/beveled corners. + * + * @param {number} x - The X coord of the top-left of the rectangle + * @param {number} y - The Y coord of the top-left of the rectangle + * @param {number} width - The width of the rectangle + * @param {number} height - The height of the rectangle + * @param {number} radius - Radius of the rectangle corners + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawRoundedRect = function (x, y, width, height, radius) { + return this.drawShape(new RoundedRectangle(x, y, width, height, radius)); + }; + /** + * Draws a circle. + * + * @param {number} x - The X coordinate of the center of the circle + * @param {number} y - The Y coordinate of the center of the circle + * @param {number} radius - The radius of the circle + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawCircle = function (x, y, radius) { + return this.drawShape(new Circle(x, y, radius)); + }; + /** + * Draws an ellipse. + * + * @param {number} x - The X coordinate of the center of the ellipse + * @param {number} y - The Y coordinate of the center of the ellipse + * @param {number} width - The half width of the ellipse + * @param {number} height - The half height of the ellipse + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawEllipse = function (x, y, width, height) { + return this.drawShape(new Ellipse(x, y, width, height)); + }; + /** + * Draws a polygon using the given path. + * + * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon. + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawPolygon = function () { + var arguments$1 = arguments; + + var path = []; + for (var _i = 0; _i < arguments.length; _i++) { + path[_i] = arguments$1[_i]; + } + var points; + var closeStroke = true; // !!this._fillStyle; + var poly = path[0]; + // check if data has points.. + if (poly.points) { + closeStroke = poly.closeStroke; + points = poly.points; + } + else if (Array.isArray(path[0])) { + points = path[0]; + } + else { + points = path; + } + var shape = new Polygon(points); + shape.closeStroke = closeStroke; + this.drawShape(shape); + return this; + }; + /** + * Draw any shape. + * + * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawShape = function (shape) { + if (!this._holeMode) { + this._geometry.drawShape(shape, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix); + } + else { + this._geometry.drawHole(shape, this._matrix); + } + return this; + }; + /** + * Draw a star shape with an arbitrary number of points. + * + * @param {number} x - Center X position of the star + * @param {number} y - Center Y position of the star + * @param {number} points - The number of points of the star, must be > 1 + * @param {number} radius - The outer radius of the star + * @param {number} [innerRadius] - The inner radius between points, default half `radius` + * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.drawStar = function (x, y, points, radius, innerRadius, rotation) { + if (rotation === void 0) { rotation = 0; } + return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation)); + }; + /** + * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. + * + * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls + */ + Graphics.prototype.clear = function () { + this._geometry.clear(); + this._lineStyle.reset(); + this._fillStyle.reset(); + this._boundsID++; + this._matrix = null; + this._holeMode = false; + this.currentPath = null; + return this; + }; + /** + * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and + * masked with gl.scissor. + * + * @returns {boolean} True if only 1 rect. + */ + Graphics.prototype.isFastRect = function () { + var data = this._geometry.graphicsData; + return data.length === 1 + && data[0].shape.type === exports.SHAPES.RECT + && !(data[0].lineStyle.visible && data[0].lineStyle.width); + }; + /** + * Renders the object using the WebGL renderer + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Graphics.prototype._render = function (renderer) { + this.finishPoly(); + var geometry = this._geometry; + var hasuint32 = renderer.context.supports.uint32Indices; + // batch part.. + // batch it! + geometry.updateBatches(hasuint32); + if (geometry.batchable) { + if (this.batchDirty !== geometry.batchDirty) { + this._populateBatches(); + } + this._renderBatched(renderer); + } + else { + // no batching... + renderer.batch.flush(); + this._renderDirect(renderer); + } + }; + /** + * Populating batches for rendering + * + * @protected + */ + Graphics.prototype._populateBatches = function () { + var geometry = this._geometry; + var blendMode = this.blendMode; + var len = geometry.batches.length; + this.batchTint = -1; + this._transformID = -1; + this.batchDirty = geometry.batchDirty; + this.batches.length = len; + this.vertexData = new Float32Array(geometry.points); + for (var i = 0; i < len; i++) { + var gI = geometry.batches[i]; + var color = gI.style.color; + var vertexData = new Float32Array(this.vertexData.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); + var uvs = new Float32Array(geometry.uvsFloat32.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); + var indices = new Uint16Array(geometry.indicesUint16.buffer, gI.start * 2, gI.size); + var batch = { + vertexData: vertexData, + blendMode: blendMode, + indices: indices, + uvs: uvs, + _batchRGB: hex2rgb(color), + _tintRGB: color, + _texture: gI.style.texture, + alpha: gI.style.alpha, + worldAlpha: 1 + }; + this.batches[i] = batch; + } + }; + /** + * Renders the batches using the BathedRenderer plugin + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Graphics.prototype._renderBatched = function (renderer) { + if (!this.batches.length) { + return; + } + renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); + this.calculateVertices(); + this.calculateTints(); + for (var i = 0, l = this.batches.length; i < l; i++) { + var batch = this.batches[i]; + batch.worldAlpha = this.worldAlpha * batch.alpha; + renderer.plugins[this.pluginName].render(batch); + } + }; + /** + * Renders the graphics direct + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Graphics.prototype._renderDirect = function (renderer) { + var shader = this._resolveDirectShader(renderer); + var geometry = this._geometry; + var tint = this.tint; + var worldAlpha = this.worldAlpha; + var uniforms = shader.uniforms; + var drawCalls = geometry.drawCalls; + // lets set the transfomr + uniforms.translationMatrix = this.transform.worldTransform; + // and then lets set the tint.. + uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha; + uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha; + uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha; + uniforms.tint[3] = worldAlpha; + // the first draw call, we can set the uniforms of the shader directly here. + // this means that we can tack advantage of the sync function of pixi! + // bind and sync uniforms.. + // there is a way to optimise this.. + renderer.shader.bind(shader); + renderer.geometry.bind(geometry, shader); + // set state.. + renderer.state.set(this.state); + // then render the rest of them... + for (var i = 0, l = drawCalls.length; i < l; i++) { + this._renderDrawCallDirect(renderer, geometry.drawCalls[i]); + } + }; + /** + * Renders specific DrawCall + * + * @param {PIXI.Renderer} renderer + * @param {PIXI.BatchDrawCall} drawCall + */ + Graphics.prototype._renderDrawCallDirect = function (renderer, drawCall) { + var texArray = drawCall.texArray, type = drawCall.type, size = drawCall.size, start = drawCall.start; + var groupTextureCount = texArray.count; + for (var j = 0; j < groupTextureCount; j++) { + renderer.texture.bind(texArray.elements[j], j); + } + renderer.geometry.draw(type, size, start); + }; + /** + * Resolves shader for direct rendering + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Graphics.prototype._resolveDirectShader = function (renderer) { + var shader = this.shader; + var pluginName = this.pluginName; + if (!shader) { + // if there is no shader here, we can use the default shader. + // and that only gets created if we actually need it.. + // but may be more than one plugins for graphics + if (!DEFAULT_SHADERS[pluginName]) { + var MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES; + var sampleValues = new Int32Array(MAX_TEXTURES); + for (var i = 0; i < MAX_TEXTURES; i++) { + sampleValues[i] = i; + } + var uniforms = { + tint: new Float32Array([1, 1, 1, 1]), + translationMatrix: new Matrix(), + default: UniformGroup.from({ uSamplers: sampleValues }, true), + }; + var program = renderer.plugins[pluginName]._shader.program; + DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms); + } + shader = DEFAULT_SHADERS[pluginName]; + } + return shader; + }; + /** + * Retrieves the bounds of the graphic shape as a rectangle object + * + * @protected + */ + Graphics.prototype._calculateBounds = function () { + this.finishPoly(); + var geometry = this._geometry; + // skipping when graphics is empty, like a container + if (!geometry.graphicsData.length) { + return; + } + var _a = geometry.bounds, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY; + this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); + }; + /** + * Tests if a point is inside this graphics object + * + * @param {PIXI.IPointData} point - the point to test + * @return {boolean} the result of the test + */ + Graphics.prototype.containsPoint = function (point) { + this.worldTransform.applyInverse(point, Graphics._TEMP_POINT); + return this._geometry.containsPoint(Graphics._TEMP_POINT); + }; + /** + * Recalcuate the tint by applying tin to batches using Graphics tint. + * @protected + */ + Graphics.prototype.calculateTints = function () { + if (this.batchTint !== this.tint) { + this.batchTint = this.tint; + var tintRGB = hex2rgb(this.tint, temp); + for (var i = 0; i < this.batches.length; i++) { + var batch = this.batches[i]; + var batchTint = batch._batchRGB; + var r = (tintRGB[0] * batchTint[0]) * 255; + var g = (tintRGB[1] * batchTint[1]) * 255; + var b = (tintRGB[2] * batchTint[2]) * 255; + // TODO Ivan, can this be done in one go? + var color = (r << 16) + (g << 8) + (b | 0); + batch._tintRGB = (color >> 16) + + (color & 0xff00) + + ((color & 0xff) << 16); + } + } + }; + /** + * If there's a transform update or a change to the shape of the + * geometry, recaculate the vertices. + * @protected + */ + Graphics.prototype.calculateVertices = function () { + var wtID = this.transform._worldID; + if (this._transformID === wtID) { + return; + } + this._transformID = wtID; + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var data = this._geometry.points; // batch.vertexDataOriginal; + var vertexData = this.vertexData; + var count = 0; + for (var i = 0; i < data.length; i += 2) { + var x = data[i]; + var y = data[i + 1]; + vertexData[count++] = (a * x) + (c * y) + tx; + vertexData[count++] = (d * y) + (b * x) + ty; + } + }; + /** + * Closes the current path. + * + * @return {PIXI.Graphics} Returns itself. + */ + Graphics.prototype.closePath = function () { + var currentPath = this.currentPath; + if (currentPath) { + // we don't need to add extra point in the end because buildLine will take care of that + currentPath.closeStroke = true; + } + return this; + }; + /** + * Apply a matrix to the positional data. + * + * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape. + * @return {PIXI.Graphics} Returns itself. + */ + Graphics.prototype.setMatrix = function (matrix) { + this._matrix = matrix; + return this; + }; + /** + * Begin adding holes to the last draw shape + * IMPORTANT: holes must be fully inside a shape to work + * Also weirdness ensues if holes overlap! + * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer, + * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle. + * @return {PIXI.Graphics} Returns itself. + */ + Graphics.prototype.beginHole = function () { + this.finishPoly(); + this._holeMode = true; + return this; + }; + /** + * End adding holes to the last draw shape + * @return {PIXI.Graphics} Returns itself. + */ + Graphics.prototype.endHole = function () { + this.finishPoly(); + this._holeMode = false; + return this; + }; + /** + * Destroys the Graphics object. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all + * options have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have + * their destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the texture of the child sprite + * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true + * Should it destroy the base texture of the child sprite + */ + Graphics.prototype.destroy = function (options) { + this._geometry.refCount--; + if (this._geometry.refCount === 0) { + this._geometry.dispose(); + } + this._matrix = null; + this.currentPath = null; + this._lineStyle.destroy(); + this._lineStyle = null; + this._fillStyle.destroy(); + this._fillStyle = null; + this._geometry = null; + this.shader = null; + this.vertexData = null; + this.batches.length = 0; + this.batches = null; + _super.prototype.destroy.call(this, options); + }; + /** + * Temporary point to use for containsPoint + * + * @static + * @private + * @member {PIXI.Point} + */ + Graphics._TEMP_POINT = new Point(); + return Graphics; + }(Container)); + + /*! + * @pixi/sprite - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/sprite is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$6 = function(d, b) { + extendStatics$6 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$6(d, b); + }; + + function __extends$6(d, b) { + extendStatics$6(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var tempPoint = new Point(); + var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); + /** + * The Sprite object is the base for all textured objects that are rendered to the screen + * + * A sprite can be created directly from an image like this: + * + * ```js + * let sprite = PIXI.Sprite.from('assets/image.png'); + * ``` + * + * The more efficient way to create sprites is using a {@link PIXI.Spritesheet}, + * as swapping base textures when rendering to the screen is inefficient. + * + * ```js + * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; + * let sprite = new PIXI.Sprite(sheet.textures["image.png"]); + * ... + * } + * ``` + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + var Sprite = /** @class */ (function (_super) { + __extends$6(Sprite, _super); + /** + * @param {PIXI.Texture} [texture] - The texture for this sprite. + */ + function Sprite(texture) { + var _this = _super.call(this) || this; + /** + * The anchor point defines the normalized coordinates + * in the texture that map to the position of this + * sprite. + * + * By default, this is `(0,0)` (or `texture.defaultAnchor` + * if you have modified that), which means the position + * `(x,y)` of this `Sprite` will be the top-left corner. + * + * Note: Updating `texture.defaultAnchor` after + * constructing a `Sprite` does _not_ update its anchor. + * + * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html} + * + * @default `texture.defaultAnchor` + * @member {PIXI.ObservablePoint} + * @private + */ + _this._anchor = new ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); + /** + * The texture that the sprite is using + * + * @private + * @member {PIXI.Texture} + */ + _this._texture = null; + /** + * The width of the sprite (this is initially set by the texture) + * + * @protected + * @member {number} + */ + _this._width = 0; + /** + * The height of the sprite (this is initially set by the texture) + * + * @protected + * @member {number} + */ + _this._height = 0; + /** + * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. + * + * @private + * @member {number} + * @default 0xFFFFFF + */ + _this._tint = null; + /** + * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect. + * + * @private + * @member {number} + * @default 16777215 + */ + _this._tintRGB = null; + _this.tint = 0xFFFFFF; + /** + * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + _this.blendMode = exports.BLEND_MODES.NORMAL; + /** + * Cached tint value so we can tell when the tint is changed. + * Value is used for 2d CanvasRenderer. + * + * @protected + * @member {number} + * @default 0xFFFFFF + */ + _this._cachedTint = 0xFFFFFF; + /** + * this is used to store the uvs data of the sprite, assigned at the same time + * as the vertexData in calculateVertices() + * + * @private + * @member {Float32Array} + */ + _this.uvs = null; + // call texture setter + _this.texture = texture || Texture.EMPTY; + /** + * this is used to store the vertex data of the sprite (basically a quad) + * + * @private + * @member {Float32Array} + */ + _this.vertexData = new Float32Array(8); + /** + * This is used to calculate the bounds of the object IF it is a trimmed sprite + * + * @private + * @member {Float32Array} + */ + _this.vertexTrimmedData = null; + _this._transformID = -1; + _this._textureID = -1; + _this._transformTrimmedID = -1; + _this._textureTrimmedID = -1; + // Batchable stuff.. + // TODO could make this a mixin? + _this.indices = indices; + /** + * Plugin that is responsible for rendering this element. + * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods. + * + * @member {string} + * @default 'batch' + */ + _this.pluginName = 'batch'; + /** + * used to fast check if a sprite is.. a sprite! + * @member {boolean} + */ + _this.isSprite = true; + /** + * Internal roundPixels field + * + * @member {boolean} + * @private + */ + _this._roundPixels = settings.ROUND_PIXELS; + return _this; + } + /** + * When the texture is updated, this event will fire to update the scale and frame + * + * @protected + */ + Sprite.prototype._onTextureUpdate = function () { + this._textureID = -1; + this._textureTrimmedID = -1; + this._cachedTint = 0xFFFFFF; + // so if _width is 0 then width was not set.. + if (this._width) { + this.scale.x = sign$1(this.scale.x) * this._width / this._texture.orig.width; + } + if (this._height) { + this.scale.y = sign$1(this.scale.y) * this._height / this._texture.orig.height; + } + }; + /** + * Called when the anchor position updates. + * + * @private + */ + Sprite.prototype._onAnchorUpdate = function () { + this._transformID = -1; + this._transformTrimmedID = -1; + }; + /** + * calculates worldTransform * vertices, store it in vertexData + */ + Sprite.prototype.calculateVertices = function () { + var texture = this._texture; + if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { + return; + } + // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` + if (this._textureID !== texture._updateID) { + this.uvs = this._texture._uvs.uvsFloat32; + } + this._transformID = this.transform._worldID; + this._textureID = texture._updateID; + // set the vertex data + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + var trim = texture.trim; + var orig = texture.orig; + var anchor = this._anchor; + var w0 = 0; + var w1 = 0; + var h0 = 0; + var h1 = 0; + if (trim) { + // if the sprite is trimmed and is not a tilingsprite then we need to add the extra + // space before transforming the sprite coords. + w1 = trim.x - (anchor._x * orig.width); + w0 = w1 + trim.width; + h1 = trim.y - (anchor._y * orig.height); + h0 = h1 + trim.height; + } + else { + w1 = -anchor._x * orig.width; + w0 = w1 + orig.width; + h1 = -anchor._y * orig.height; + h0 = h1 + orig.height; + } + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + if (this._roundPixels) { + var resolution = settings.RESOLUTION; + for (var i = 0; i < vertexData.length; ++i) { + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); + } + } + }; + /** + * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData + * This is used to ensure that the true width and height of a trimmed texture is respected + */ + Sprite.prototype.calculateTrimmedVertices = function () { + if (!this.vertexTrimmedData) { + this.vertexTrimmedData = new Float32Array(8); + } + else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { + return; + } + this._transformTrimmedID = this.transform._worldID; + this._textureTrimmedID = this._texture._updateID; + // lets do some special trim code! + var texture = this._texture; + var vertexData = this.vertexTrimmedData; + var orig = texture.orig; + var anchor = this._anchor; + // lets calculate the new untrimmed bounds.. + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var w1 = -anchor._x * orig.width; + var w0 = w1 + orig.width; + var h1 = -anchor._y * orig.height; + var h0 = h1 + orig.height; + // xy + vertexData[0] = (a * w1) + (c * h1) + tx; + vertexData[1] = (d * h1) + (b * w1) + ty; + // xy + vertexData[2] = (a * w0) + (c * h1) + tx; + vertexData[3] = (d * h1) + (b * w0) + ty; + // xy + vertexData[4] = (a * w0) + (c * h0) + tx; + vertexData[5] = (d * h0) + (b * w0) + ty; + // xy + vertexData[6] = (a * w1) + (c * h0) + tx; + vertexData[7] = (d * h0) + (b * w1) + ty; + }; + /** + * + * Renders the object using the WebGL renderer + * + * @protected + * @param {PIXI.Renderer} renderer - The webgl renderer to use. + */ + Sprite.prototype._render = function (renderer) { + this.calculateVertices(); + renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + /** + * Updates the bounds of the sprite. + * + * @protected + */ + Sprite.prototype._calculateBounds = function () { + var trim = this._texture.trim; + var orig = this._texture.orig; + // First lets check to see if the current texture has a trim.. + if (!trim || (trim.width === orig.width && trim.height === orig.height)) { + // no trim! lets use the usual calculations.. + this.calculateVertices(); + this._bounds.addQuad(this.vertexData); + } + else { + // lets calculate a special trimmed bounds... + this.calculateTrimmedVertices(); + this._bounds.addQuad(this.vertexTrimmedData); + } + }; + /** + * Gets the local bounds of the sprite object. + * + * @param {PIXI.Rectangle} [rect] - The output rectangle. + * @return {PIXI.Rectangle} The bounds. + */ + Sprite.prototype.getLocalBounds = function (rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + this._bounds.minX = this._texture.orig.width * -this._anchor._x; + this._bounds.minY = this._texture.orig.height * -this._anchor._y; + this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x); + this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y); + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new Rectangle(); + } + rect = this._localBoundsRect; + } + return this._bounds.getRectangle(rect); + } + return _super.prototype.getLocalBounds.call(this, rect); + }; + /** + * Tests if a point is inside this sprite + * + * @param {PIXI.IPointData} point - the point to test + * @return {boolean} the result of the test + */ + Sprite.prototype.containsPoint = function (point) { + this.worldTransform.applyInverse(point, tempPoint); + var width = this._texture.orig.width; + var height = this._texture.orig.height; + var x1 = -width * this.anchor.x; + var y1 = 0; + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { + y1 = -height * this.anchor.y; + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { + return true; + } + } + return false; + }; + /** + * Destroys this sprite and optionally its texture and children + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + Sprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this._texture.off('update', this._onTextureUpdate, this); + this._anchor = null; + var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; + if (destroyTexture) { + var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; + this._texture.destroy(!!destroyBaseTexture); + } + this._texture = null; + }; + // some helper functions.. + /** + * Helper function that creates a new sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * + * @static + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. + * @return {PIXI.Sprite} The newly created sprite + */ + Sprite.from = function (source, options) { + var texture = (source instanceof Texture) + ? source + : Texture.from(source, options); + return new Sprite(texture); + }; + Object.defineProperty(Sprite.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} + * + * @member {boolean} + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; + } + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "width", { + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + var s = sign$1(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "height", { + /** + * The height of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + var s = sign$1(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "anchor", { + /** + * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} + * and passed to the constructor. + * + * The default is `(0,0)`, this means the sprite's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. + * + * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this._anchor; + }, + set: function (value) { + this._anchor.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "tint", { + /** + * The tint applied to the sprite. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "texture", { + /** + * The texture that the sprite is using + * + * @member {PIXI.Texture} + */ + get: function () { + return this._texture; + }, + set: function (value) { + if (this._texture === value) { + return; + } + if (this._texture) { + this._texture.off('update', this._onTextureUpdate, this); + } + this._texture = value || Texture.EMPTY; + this._cachedTint = 0xFFFFFF; + this._textureID = -1; + this._textureTrimmedID = -1; + if (value) { + // wait for the texture to load + if (value.baseTexture.valid) { + this._onTextureUpdate(); + } + else { + value.once('update', this._onTextureUpdate, this); + } + } + }, + enumerable: false, + configurable: true + }); + return Sprite; + }(Container)); + + /*! + * @pixi/text - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/text is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$7 = function(d, b) { + extendStatics$7 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$7(d, b); + }; + + function __extends$7(d, b) { + extendStatics$7(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Constants that define the type of gradient on text. + * + * @static + * @constant + * @name TEXT_GRADIENT + * @memberof PIXI + * @type {object} + * @property {number} LINEAR_VERTICAL Vertical gradient + * @property {number} LINEAR_HORIZONTAL Linear gradient + */ + + (function (TEXT_GRADIENT) { + TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_VERTICAL"] = 0] = "LINEAR_VERTICAL"; + TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_HORIZONTAL"] = 1] = "LINEAR_HORIZONTAL"; + })(exports.TEXT_GRADIENT || (exports.TEXT_GRADIENT = {})); + + // disabling eslint for now, going to rewrite this in v5 + var defaultStyle = { + align: 'left', + breakWords: false, + dropShadow: false, + dropShadowAlpha: 1, + dropShadowAngle: Math.PI / 6, + dropShadowBlur: 0, + dropShadowColor: 'black', + dropShadowDistance: 5, + fill: 'black', + fillGradientType: exports.TEXT_GRADIENT.LINEAR_VERTICAL, + fillGradientStops: [], + fontFamily: 'Arial', + fontSize: 26, + fontStyle: 'normal', + fontVariant: 'normal', + fontWeight: 'normal', + letterSpacing: 0, + lineHeight: 0, + lineJoin: 'miter', + miterLimit: 10, + padding: 0, + stroke: 'black', + strokeThickness: 0, + textBaseline: 'alphabetic', + trim: false, + whiteSpace: 'pre', + wordWrap: false, + wordWrapWidth: 100, + leading: 0, + }; + var genericFontFamilies = [ + 'serif', + 'sans-serif', + 'monospace', + 'cursive', + 'fantasy', + 'system-ui' ]; + /** + * A TextStyle Object contains information to decorate a Text objects. + * + * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it. + * + * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style). + * + * @class + * @memberof PIXI + */ + var TextStyle = /** @class */ (function () { + /** + * @param {object} [style] - The style parameters + * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), + * does not affect single line text + * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it + * needs wordWrap to be set to true + * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text + * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow + * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow + * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius + * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00' + * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow + * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas + * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient + * eg ['#000000','#FFFFFF'] + * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} + * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours + * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT} + * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set + * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. + * @param {string|string[]} [style.fontFamily='Arial'] - The font family + * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string, + * equivalents are '26px','20pt','160%' or '1.6em') + * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique') + * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps') + * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100', + * '200', '300', '400', '500', '600', '700', '800' or '900') + * @param {number} [style.leading=0] - The space between lines + * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0 + * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses + * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve + * spiked text issues. Possible values "miter" (creates a sharp corner), "round" (creates a round corner) or "bevel" + * (creates a squared corner). + * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce + * or increase the spikiness of rendered text. + * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from + * happening by adding padding to all sides of the text. + * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke + * e.g 'blue', '#FCFF00' + * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. + * Default is 0 (no stroke) + * @param {boolean} [style.trim=false] - Trim transparent borders + * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered. + * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved "normal" + * (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true + * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used + * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true + */ + function TextStyle(style) { + this.styleID = 0; + this.reset(); + deepCopyProperties(this, style, style); + } + /** + * Creates a new TextStyle object with the same values as this one. + * Note that the only the properties of the object are cloned. + * + * @return {PIXI.TextStyle} New cloned TextStyle object + */ + TextStyle.prototype.clone = function () { + var clonedProperties = {}; + deepCopyProperties(clonedProperties, this, defaultStyle); + return new TextStyle(clonedProperties); + }; + /** + * Resets all properties to the defaults specified in TextStyle.prototype._default + */ + TextStyle.prototype.reset = function () { + deepCopyProperties(this, defaultStyle, defaultStyle); + }; + Object.defineProperty(TextStyle.prototype, "align", { + /** + * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text + * + * @member {string} + */ + get: function () { + return this._align; + }, + set: function (align) { + if (this._align !== align) { + this._align = align; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "breakWords", { + /** + * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true + * + * @member {boolean} + */ + get: function () { + return this._breakWords; + }, + set: function (breakWords) { + if (this._breakWords !== breakWords) { + this._breakWords = breakWords; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadow", { + /** + * Set a drop shadow for the text + * + * @member {boolean} + */ + get: function () { + return this._dropShadow; + }, + set: function (dropShadow) { + if (this._dropShadow !== dropShadow) { + this._dropShadow = dropShadow; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowAlpha", { + /** + * Set alpha for the drop shadow + * + * @member {number} + */ + get: function () { + return this._dropShadowAlpha; + }, + set: function (dropShadowAlpha) { + if (this._dropShadowAlpha !== dropShadowAlpha) { + this._dropShadowAlpha = dropShadowAlpha; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowAngle", { + /** + * Set a angle of the drop shadow + * + * @member {number} + */ + get: function () { + return this._dropShadowAngle; + }, + set: function (dropShadowAngle) { + if (this._dropShadowAngle !== dropShadowAngle) { + this._dropShadowAngle = dropShadowAngle; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowBlur", { + /** + * Set a shadow blur radius + * + * @member {number} + */ + get: function () { + return this._dropShadowBlur; + }, + set: function (dropShadowBlur) { + if (this._dropShadowBlur !== dropShadowBlur) { + this._dropShadowBlur = dropShadowBlur; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowColor", { + /** + * A fill style to be used on the dropshadow e.g 'red', '#00FF00' + * + * @member {string|number} + */ + get: function () { + return this._dropShadowColor; + }, + set: function (dropShadowColor) { + var outputColor = getColor(dropShadowColor); + if (this._dropShadowColor !== outputColor) { + this._dropShadowColor = outputColor; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowDistance", { + /** + * Set a distance of the drop shadow + * + * @member {number} + */ + get: function () { + return this._dropShadowDistance; + }, + set: function (dropShadowDistance) { + if (this._dropShadowDistance !== dropShadowDistance) { + this._dropShadowDistance = dropShadowDistance; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fill", { + /** + * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'. + * Can be an array to create a gradient eg ['#000000','#FFFFFF'] + * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} + * + * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern} + */ + get: function () { + return this._fill; + }, + set: function (fill) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in + // without casting here. + var outputColor = getColor(fill); + if (this._fill !== outputColor) { + this._fill = outputColor; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fillGradientType", { + /** + * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. + * See {@link PIXI.TEXT_GRADIENT} + * + * @member {number} + */ + get: function () { + return this._fillGradientType; + }, + set: function (fillGradientType) { + if (this._fillGradientType !== fillGradientType) { + this._fillGradientType = fillGradientType; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fillGradientStops", { + /** + * If fill is an array of colours to create a gradient, this array can set the stop points + * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. + * + * @member {number[]} + */ + get: function () { + return this._fillGradientStops; + }, + set: function (fillGradientStops) { + if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) { + this._fillGradientStops = fillGradientStops; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontFamily", { + /** + * The font family + * + * @member {string|string[]} + */ + get: function () { + return this._fontFamily; + }, + set: function (fontFamily) { + if (this.fontFamily !== fontFamily) { + this._fontFamily = fontFamily; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontSize", { + /** + * The font size + * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') + * + * @member {number|string} + */ + get: function () { + return this._fontSize; + }, + set: function (fontSize) { + if (this._fontSize !== fontSize) { + this._fontSize = fontSize; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontStyle", { + /** + * The font style + * ('normal', 'italic' or 'oblique') + * + * @member {string} + */ + get: function () { + return this._fontStyle; + }, + set: function (fontStyle) { + if (this._fontStyle !== fontStyle) { + this._fontStyle = fontStyle; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontVariant", { + /** + * The font variant + * ('normal' or 'small-caps') + * + * @member {string} + */ + get: function () { + return this._fontVariant; + }, + set: function (fontVariant) { + if (this._fontVariant !== fontVariant) { + this._fontVariant = fontVariant; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontWeight", { + /** + * The font weight + * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900') + * + * @member {string} + */ + get: function () { + return this._fontWeight; + }, + set: function (fontWeight) { + if (this._fontWeight !== fontWeight) { + this._fontWeight = fontWeight; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "letterSpacing", { + /** + * The amount of spacing between letters, default is 0 + * + * @member {number} + */ + get: function () { + return this._letterSpacing; + }, + set: function (letterSpacing) { + if (this._letterSpacing !== letterSpacing) { + this._letterSpacing = letterSpacing; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "lineHeight", { + /** + * The line height, a number that represents the vertical space that a letter uses + * + * @member {number} + */ + get: function () { + return this._lineHeight; + }, + set: function (lineHeight) { + if (this._lineHeight !== lineHeight) { + this._lineHeight = lineHeight; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "leading", { + /** + * The space between lines + * + * @member {number} + */ + get: function () { + return this._leading; + }, + set: function (leading) { + if (this._leading !== leading) { + this._leading = leading; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "lineJoin", { + /** + * The lineJoin property sets the type of corner created, it can resolve spiked text issues. + * Default is 'miter' (creates a sharp corner). + * + * @member {string} + */ + get: function () { + return this._lineJoin; + }, + set: function (lineJoin) { + if (this._lineJoin !== lineJoin) { + this._lineJoin = lineJoin; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "miterLimit", { + /** + * The miter limit to use when using the 'miter' lineJoin mode + * This can reduce or increase the spikiness of rendered text. + * + * @member {number} + */ + get: function () { + return this._miterLimit; + }, + set: function (miterLimit) { + if (this._miterLimit !== miterLimit) { + this._miterLimit = miterLimit; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "padding", { + /** + * Occasionally some fonts are cropped. Adding some padding will prevent this from happening + * by adding padding to all sides of the text. + * + * @member {number} + */ + get: function () { + return this._padding; + }, + set: function (padding) { + if (this._padding !== padding) { + this._padding = padding; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "stroke", { + /** + * A canvas fillstyle that will be used on the text stroke + * e.g 'blue', '#FCFF00' + * + * @member {string|number} + */ + get: function () { + return this._stroke; + }, + set: function (stroke) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + var outputColor = getColor(stroke); + if (this._stroke !== outputColor) { + this._stroke = outputColor; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "strokeThickness", { + /** + * A number that represents the thickness of the stroke. + * Default is 0 (no stroke) + * + * @member {number} + */ + get: function () { + return this._strokeThickness; + }, + set: function (strokeThickness) { + if (this._strokeThickness !== strokeThickness) { + this._strokeThickness = strokeThickness; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "textBaseline", { + /** + * The baseline of the text that is rendered. + * + * @member {string} + */ + get: function () { + return this._textBaseline; + }, + set: function (textBaseline) { + if (this._textBaseline !== textBaseline) { + this._textBaseline = textBaseline; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "trim", { + /** + * Trim transparent borders + * + * @member {boolean} + */ + get: function () { + return this._trim; + }, + set: function (trim) { + if (this._trim !== trim) { + this._trim = trim; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "whiteSpace", { + /** + * How newlines and spaces should be handled. + * Default is 'pre' (preserve, preserve). + * + * value | New lines | Spaces + * --- | --- | --- + * 'normal' | Collapse | Collapse + * 'pre' | Preserve | Preserve + * 'pre-line' | Preserve | Collapse + * + * @member {string} + */ + get: function () { + return this._whiteSpace; + }, + set: function (whiteSpace) { + if (this._whiteSpace !== whiteSpace) { + this._whiteSpace = whiteSpace; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "wordWrap", { + /** + * Indicates if word wrap should be used + * + * @member {boolean} + */ + get: function () { + return this._wordWrap; + }, + set: function (wordWrap) { + if (this._wordWrap !== wordWrap) { + this._wordWrap = wordWrap; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "wordWrapWidth", { + /** + * The width at which text will wrap, it needs wordWrap to be set to true + * + * @member {number} + */ + get: function () { + return this._wordWrapWidth; + }, + set: function (wordWrapWidth) { + if (this._wordWrapWidth !== wordWrapWidth) { + this._wordWrapWidth = wordWrapWidth; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + /** + * Generates a font style string to use for `TextMetrics.measureFont()`. + * + * @return {string} Font style string, for passing to `TextMetrics.measureFont()` + */ + TextStyle.prototype.toFontString = function () { + // build canvas api font setting from individual components. Convert a numeric this.fontSize to px + var fontSizeString = (typeof this.fontSize === 'number') ? this.fontSize + "px" : this.fontSize; + // Clean-up fontFamily property by quoting each font name + // this will support font names with spaces + var fontFamilies = this.fontFamily; + if (!Array.isArray(this.fontFamily)) { + fontFamilies = this.fontFamily.split(','); + } + for (var i = fontFamilies.length - 1; i >= 0; i--) { + // Trim any extra white-space + var fontFamily = fontFamilies[i].trim(); + // Check if font already contains strings + if (!(/([\"\'])[^\'\"]+\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) { + fontFamily = "\"" + fontFamily + "\""; + } + fontFamilies[i] = fontFamily; + } + return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + fontSizeString + " " + fontFamilies.join(','); + }; + return TextStyle; + }()); + /** + * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. + * @private + * @param {string|number} color + * @return {string} The color as a string. + */ + function getSingleColor(color) { + if (typeof color === 'number') { + return hex2string(color); + } + else if (typeof color === 'string') { + if (color.indexOf('0x') === 0) { + color = color.replace('0x', '#'); + } + } + return color; + } + function getColor(color) { + if (!Array.isArray(color)) { + return getSingleColor(color); + } + else { + for (var i = 0; i < color.length; ++i) { + color[i] = getSingleColor(color[i]); + } + return color; + } + } + /** + * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. + * This version can also convert array of colors + * @private + * @param {Array} array1 - First array to compare + * @param {Array} array2 - Second array to compare + * @return {boolean} Do the arrays contain the same values in the same order + */ + function areArraysEqual(array1, array2) { + if (!Array.isArray(array1) || !Array.isArray(array2)) { + return false; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; ++i) { + if (array1[i] !== array2[i]) { + return false; + } + } + return true; + } + /** + * Utility function to ensure that object properties are copied by value, and not by reference + * @private + * @param {Object} target - Target object to copy properties into + * @param {Object} source - Source object for the properties to copy + * @param {string} propertyObj - Object containing properties names we want to loop over + */ + function deepCopyProperties(target, source, propertyObj) { + for (var prop in propertyObj) { + if (Array.isArray(source[prop])) { + target[prop] = source[prop].slice(); + } + else { + target[prop] = source[prop]; + } + } + } + + /** + * The TextMetrics object represents the measurement of a block of text with a specified style. + * + * ```js + * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}) + * let textMetrics = PIXI.TextMetrics.measureText('Your text', style) + * ``` + * + * @class + * @memberof PIXI + */ + var TextMetrics = /** @class */ (function () { + /** + * @param {string} text - the text that was measured + * @param {PIXI.TextStyle} style - the style that was measured + * @param {number} width - the measured width of the text + * @param {number} height - the measured height of the text + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` + * @param {number} lineHeight - the measured line height for this style + * @param {number} maxLineWidth - the maximum line width for all measured lines + * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont + */ + function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) { + /** + * The text that was measured + * + * @member {string} + */ + this.text = text; + /** + * The style that was measured + * + * @member {PIXI.TextStyle} + */ + this.style = style; + /** + * The measured width of the text + * + * @member {number} + */ + this.width = width; + /** + * The measured height of the text + * + * @member {number} + */ + this.height = height; + /** + * An array of lines of the text broken by new lines and wrapping is specified in style + * + * @member {string[]} + */ + this.lines = lines; + /** + * An array of the line widths for each line matched to `lines` + * + * @member {number[]} + */ + this.lineWidths = lineWidths; + /** + * The measured line height for this style + * + * @member {number} + */ + this.lineHeight = lineHeight; + /** + * The maximum line width for all measured lines + * + * @member {number} + */ + this.maxLineWidth = maxLineWidth; + /** + * The font properties object from TextMetrics.measureFont + * + * @member {PIXI.IFontMetrics} + */ + this.fontProperties = fontProperties; + } + /** + * Measures the supplied string of text and returns a Rectangle. + * + * @param {string} text - the text to measure. + * @param {PIXI.TextStyle} style - the text style to use for measuring + * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text. + * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. + * @return {PIXI.TextMetrics} measured width and height of the text. + */ + TextMetrics.measureText = function (text, style, wordWrap, canvas) { + if (canvas === void 0) { canvas = TextMetrics._canvas; } + wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap; + var font = style.toFontString(); + var fontProperties = TextMetrics.measureFont(font); + // fallback in case UA disallow canvas data extraction + // (toDataURI, getImageData functions) + if (fontProperties.fontSize === 0) { + fontProperties.fontSize = style.fontSize; + fontProperties.ascent = style.fontSize; + } + var context = canvas.getContext('2d'); + context.font = font; + var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text; + var lines = outputText.split(/(?:\r\n|\r|\n)/); + var lineWidths = new Array(lines.length); + var maxLineWidth = 0; + for (var i = 0; i < lines.length; i++) { + var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing); + lineWidths[i] = lineWidth; + maxLineWidth = Math.max(maxLineWidth, lineWidth); + } + var width = maxLineWidth + style.strokeThickness; + if (style.dropShadow) { + width += style.dropShadowDistance; + } + var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness; + var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) + + ((lines.length - 1) * (lineHeight + style.leading)); + if (style.dropShadow) { + height += style.dropShadowDistance; + } + return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties); + }; + /** + * Applies newlines to a string to have it optimally fit into the horizontal + * bounds set by the Text object's wordWrapWidth property. + * + * @private + * @param {string} text - String to apply word wrapping to + * @param {PIXI.TextStyle} style - the style to use when wrapping + * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. + * @return {string} New string with new lines applied where required + */ + TextMetrics.wordWrap = function (text, style, canvas) { + if (canvas === void 0) { canvas = TextMetrics._canvas; } + var context = canvas.getContext('2d'); + var width = 0; + var line = ''; + var lines = ''; + var cache = Object.create(null); + var letterSpacing = style.letterSpacing, whiteSpace = style.whiteSpace; + // How to handle whitespaces + var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace); + var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace); + // whether or not spaces may be added to the beginning of lines + var canPrependSpaces = !collapseSpaces; + // There is letterSpacing after every char except the last one + // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_! + // so for convenience the above needs to be compared to width + 1 extra letterSpace + // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_ + // ________________________________________________ + // And then the final space is simply no appended to each line + var wordWrapWidth = style.wordWrapWidth + letterSpacing; + // break text into words, spaces and newline chars + var tokens = TextMetrics.tokenize(text); + for (var i = 0; i < tokens.length; i++) { + // get the word, space or newlineChar + var token = tokens[i]; + // if word is a new line + if (TextMetrics.isNewline(token)) { + // keep the new line + if (!collapseNewlines) { + lines += TextMetrics.addLine(line); + canPrependSpaces = !collapseSpaces; + line = ''; + width = 0; + continue; + } + // if we should collapse new lines + // we simply convert it into a space + token = ' '; + } + // if we should collapse repeated whitespaces + if (collapseSpaces) { + // check both this and the last tokens for spaces + var currIsBreakingSpace = TextMetrics.isBreakingSpace(token); + var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]); + if (currIsBreakingSpace && lastIsBreakingSpace) { + continue; + } + } + // get word width from cache if possible + var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context); + // word is longer than desired bounds + if (tokenWidth > wordWrapWidth) { + // if we are not already at the beginning of a line + if (line !== '') { + // start newlines for overflow words + lines += TextMetrics.addLine(line); + line = ''; + width = 0; + } + // break large word over multiple lines + if (TextMetrics.canBreakWords(token, style.breakWords)) { + // break word into characters + var characters = TextMetrics.wordWrapSplit(token); + // loop the characters + for (var j = 0; j < characters.length; j++) { + var char = characters[j]; + var k = 1; + // we are not at the end of the token + while (characters[j + k]) { + var nextChar = characters[j + k]; + var lastChar = char[char.length - 1]; + // should not split chars + if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) { + // combine chars & move forward one + char += nextChar; + } + else { + break; + } + k++; + } + j += char.length - 1; + var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context); + if (characterWidth + width > wordWrapWidth) { + lines += TextMetrics.addLine(line); + canPrependSpaces = false; + line = ''; + width = 0; + } + line += char; + width += characterWidth; + } + } + // run word out of the bounds + else { + // if there are words in this line already + // finish that line and start a new one + if (line.length > 0) { + lines += TextMetrics.addLine(line); + line = ''; + width = 0; + } + var isLastToken = i === tokens.length - 1; + // give it its own line if it's not the end + lines += TextMetrics.addLine(token, !isLastToken); + canPrependSpaces = false; + line = ''; + width = 0; + } + } + // word could fit + else { + // word won't fit because of existing words + // start a new line + if (tokenWidth + width > wordWrapWidth) { + // if its a space we don't want it + canPrependSpaces = false; + // add a new line + lines += TextMetrics.addLine(line); + // start a new line + line = ''; + width = 0; + } + // don't add spaces to the beginning of lines + if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) { + // add the word to the current line + line += token; + // update width counter + width += tokenWidth; + } + } + } + lines += TextMetrics.addLine(line, false); + return lines; + }; + /** + * Convienience function for logging each line added during the wordWrap + * method + * + * @private + * @param {string} line - The line of text to add + * @param {boolean} newLine - Add new line character to end + * @return {string} A formatted line + */ + TextMetrics.addLine = function (line, newLine) { + if (newLine === void 0) { newLine = true; } + line = TextMetrics.trimRight(line); + line = (newLine) ? line + "\n" : line; + return line; + }; + /** + * Gets & sets the widths of calculated characters in a cache object + * + * @private + * @param {string} key - The key + * @param {number} letterSpacing - The letter spacing + * @param {object} cache - The cache + * @param {CanvasRenderingContext2D} context - The canvas context + * @return {number} The from cache. + */ + TextMetrics.getFromCache = function (key, letterSpacing, cache, context) { + var width = cache[key]; + if (typeof width !== 'number') { + var spacing = ((key.length) * letterSpacing); + width = context.measureText(key).width + spacing; + cache[key] = width; + } + return width; + }; + /** + * Determines whether we should collapse breaking spaces + * + * @private + * @param {string} whiteSpace - The TextStyle property whiteSpace + * @return {boolean} should collapse + */ + TextMetrics.collapseSpaces = function (whiteSpace) { + return (whiteSpace === 'normal' || whiteSpace === 'pre-line'); + }; + /** + * Determines whether we should collapse newLine chars + * + * @private + * @param {string} whiteSpace - The white space + * @return {boolean} should collapse + */ + TextMetrics.collapseNewlines = function (whiteSpace) { + return (whiteSpace === 'normal'); + }; + /** + * trims breaking whitespaces from string + * + * @private + * @param {string} text - The text + * @return {string} trimmed string + */ + TextMetrics.trimRight = function (text) { + if (typeof text !== 'string') { + return ''; + } + for (var i = text.length - 1; i >= 0; i--) { + var char = text[i]; + if (!TextMetrics.isBreakingSpace(char)) { + break; + } + text = text.slice(0, -1); + } + return text; + }; + /** + * Determines if char is a newline. + * + * @private + * @param {string} char - The character + * @return {boolean} True if newline, False otherwise. + */ + TextMetrics.isNewline = function (char) { + if (typeof char !== 'string') { + return false; + } + return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0); + }; + /** + * Determines if char is a breaking whitespace. + * + * @private + * @param {string} char - The character + * @return {boolean} True if whitespace, False otherwise. + */ + TextMetrics.isBreakingSpace = function (char) { + if (typeof char !== 'string') { + return false; + } + return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0); + }; + /** + * Splits a string into words, breaking-spaces and newLine characters + * + * @private + * @param {string} text - The text + * @return {string[]} A tokenized array + */ + TextMetrics.tokenize = function (text) { + var tokens = []; + var token = ''; + if (typeof text !== 'string') { + return tokens; + } + for (var i = 0; i < text.length; i++) { + var char = text[i]; + if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) { + if (token !== '') { + tokens.push(token); + token = ''; + } + tokens.push(char); + continue; + } + token += char; + } + if (token !== '') { + tokens.push(token); + } + return tokens; + }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It allows one to customise which words should break + * Examples are if the token is CJK or numbers. + * It must return a boolean. + * + * @param {string} token - The token + * @param {boolean} breakWords - The style attr break words + * @return {boolean} whether to break word or not + */ + TextMetrics.canBreakWords = function (_token, breakWords) { + return breakWords; + }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It allows one to determine whether a pair of characters + * should be broken by newlines + * For example certain characters in CJK langs or numbers. + * It must return a boolean. + * + * @param {string} char - The character + * @param {string} nextChar - The next character + * @param {string} token - The token/word the characters are from + * @param {number} index - The index in the token of the char + * @param {boolean} breakWords - The style attr break words + * @return {boolean} whether to break word or not + */ + TextMetrics.canBreakChars = function (_char, _nextChar, _token, _index, _breakWords) { + return true; + }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It is called when a token (usually a word) has to be split into separate pieces + * in order to determine the point to break a word. + * It must return an array of characters. + * + * @example + * // Correctly splits emojis, eg "🤪🤪" will result in two element array, each with one emoji. + * TextMetrics.wordWrapSplit = (token) => [...token]; + * + * @param {string} token - The token to split + * @return {string[]} The characters of the token + */ + TextMetrics.wordWrapSplit = function (token) { + return token.split(''); + }; + /** + * Calculates the ascent, descent and fontSize of a given font-style + * + * @static + * @param {string} font - String representing the style of the font + * @return {PIXI.IFontMetrics} Font properties object + */ + TextMetrics.measureFont = function (font) { + // as this method is used for preparing assets, don't recalculate things if we don't need to + if (TextMetrics._fonts[font]) { + return TextMetrics._fonts[font]; + } + var properties = { + ascent: 0, + descent: 0, + fontSize: 0, + }; + var canvas = TextMetrics._canvas; + var context = TextMetrics._context; + context.font = font; + var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL; + var width = Math.ceil(context.measureText(metricsString).width); + var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width); + var height = 2 * baseline; + baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0; + canvas.width = width; + canvas.height = height; + context.fillStyle = '#f00'; + context.fillRect(0, 0, width, height); + context.font = font; + context.textBaseline = 'alphabetic'; + context.fillStyle = '#000'; + context.fillText(metricsString, 0, baseline); + var imagedata = context.getImageData(0, 0, width, height).data; + var pixels = imagedata.length; + var line = width * 4; + var i = 0; + var idx = 0; + var stop = false; + // ascent. scan from top to bottom until we find a non red pixel + for (i = 0; i < baseline; ++i) { + for (var j = 0; j < line; j += 4) { + if (imagedata[idx + j] !== 255) { + stop = true; + break; + } + } + if (!stop) { + idx += line; + } + else { + break; + } + } + properties.ascent = baseline - i; + idx = pixels - line; + stop = false; + // descent. scan from bottom to top until we find a non red pixel + for (i = height; i > baseline; --i) { + for (var j = 0; j < line; j += 4) { + if (imagedata[idx + j] !== 255) { + stop = true; + break; + } + } + if (!stop) { + idx -= line; + } + else { + break; + } + } + properties.descent = i - baseline; + properties.fontSize = properties.ascent + properties.descent; + TextMetrics._fonts[font] = properties; + return properties; + }; + /** + * Clear font metrics in metrics cache. + * + * @static + * @param {string} [font] - font name. If font name not set then clear cache for all fonts. + */ + TextMetrics.clearMetrics = function (font) { + if (font === void 0) { font = ''; } + if (font) { + delete TextMetrics._fonts[font]; + } + else { + TextMetrics._fonts = {}; + } + }; + return TextMetrics; + }()); + /** + * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. + * + * @typedef {object} FontMetrics + * @property {number} ascent - The ascent distance + * @property {number} descent - The descent distance + * @property {number} fontSize - Font size from ascent to descent + * @memberof PIXI.TextMetrics + * @private + */ + var canvas = (function () { + try { + // OffscreenCanvas2D measureText can be up to 40% faster. + var c = new OffscreenCanvas(0, 0); + var context = c.getContext('2d'); + if (context && context.measureText) { + return c; + } + return document.createElement('canvas'); + } + catch (ex) { + return document.createElement('canvas'); + } + })(); + canvas.width = canvas.height = 10; + /** + * Cached canvas element for measuring text + * + * @memberof PIXI.TextMetrics + * @type {HTMLCanvasElement} + * @private + */ + TextMetrics._canvas = canvas; + /** + * Cache for context to use. + * + * @memberof PIXI.TextMetrics + * @type {CanvasRenderingContext2D} + * @private + */ + TextMetrics._context = canvas.getContext('2d'); + /** + * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. + * + * @memberof PIXI.TextMetrics + * @type {Object} + * @private + */ + TextMetrics._fonts = {}; + /** + * String used for calculate font metrics. + * These characters are all tall to help calculate the height required for text. + * + * @static + * @memberof PIXI.TextMetrics + * @name METRICS_STRING + * @type {string} + * @default |ÉqÅ + */ + TextMetrics.METRICS_STRING = '|ÉqÅ'; + /** + * Baseline symbol for calculate font metrics. + * + * @static + * @memberof PIXI.TextMetrics + * @name BASELINE_SYMBOL + * @type {string} + * @default M + */ + TextMetrics.BASELINE_SYMBOL = 'M'; + /** + * Baseline multiplier for calculate font metrics. + * + * @static + * @memberof PIXI.TextMetrics + * @name BASELINE_MULTIPLIER + * @type {number} + * @default 1.4 + */ + TextMetrics.BASELINE_MULTIPLIER = 1.4; + /** + * Cache of new line chars. + * + * @memberof PIXI.TextMetrics + * @type {number[]} + * @private + */ + TextMetrics._newlines = [ + 0x000A, + 0x000D ]; + /** + * Cache of breaking spaces. + * + * @memberof PIXI.TextMetrics + * @type {number[]} + * @private + */ + TextMetrics._breakingSpaces = [ + 0x0009, + 0x0020, + 0x2000, + 0x2001, + 0x2002, + 0x2003, + 0x2004, + 0x2005, + 0x2006, + 0x2008, + 0x2009, + 0x200A, + 0x205F, + 0x3000 ]; + /** + * A number, or a string containing a number. + * + * @memberof PIXI + * @typedef IFontMetrics + * @property {number} ascent - Font ascent + * @property {number} descent - Font descent + * @property {number} fontSize - Font size + */ + + var defaultDestroyOptions = { + texture: true, + children: false, + baseTexture: true, + }; + /** + * A Text Object will create a line or multiple lines of text. + * + * The text is created using the [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API). + * + * The primary advantage of this class over BitmapText is that you have great control over the style of the next, + * which you can change at runtime. + * + * The primary disadvantages is that each piece of text has it's own texture, which can use more memory. + * When text changes, this texture has to be re-generated and re-uploaded to the GPU, taking up time. + * + * To split a line you can use '\n' in your text string, or, on the `style` object, + * change its `wordWrap` property to true and and give the `wordWrapWidth` property a value. + * + * A Text can be created directly from a string and a style object, + * which can be generated [here](https://pixijs.io/pixi-text-style). + * + * ```js + * let text = new PIXI.Text('This is a PixiJS text',{fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'}); + * ``` + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI + */ + var Text = /** @class */ (function (_super) { + __extends$7(Text, _super); + /** + * @param {string} text - The string that you would like the text to display + * @param {object|PIXI.TextStyle} [style] - The style parameters + * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text + */ + function Text(text, style, canvas) { + var _this = this; + var ownCanvas = false; + if (!canvas) { + canvas = document.createElement('canvas'); + ownCanvas = true; + } + canvas.width = 3; + canvas.height = 3; + var texture = Texture.from(canvas); + texture.orig = new Rectangle(); + texture.trim = new Rectangle(); + _this = _super.call(this, texture) || this; + /** + * Keep track if this Text object created it's own canvas + * element (`true`) or uses the constructor argument (`false`). + * Used to workaround a GC issues with Safari < 13 when + * destroying Text. See `destroy` for more info. + * + * @member {boolean} + * @private + */ + _this._ownCanvas = ownCanvas; + /** + * The canvas element that everything is drawn to + * + * @member {HTMLCanvasElement} + */ + _this.canvas = canvas; + /** + * The canvas 2d context that everything is drawn with + * @member {CanvasRenderingContext2D} + */ + _this.context = _this.canvas.getContext('2d'); + /** + * The resolution / device pixel ratio of the canvas. + * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. + * @member {number} + * @default 1 + */ + _this._resolution = settings.RESOLUTION; + _this._autoResolution = true; + /** + * Private tracker for the current text. + * + * @member {string} + * @private + */ + _this._text = null; + /** + * Private tracker for the current style. + * + * @member {object} + * @private + */ + _this._style = null; + /** + * Private listener to track style changes. + * + * @member {Function} + * @private + */ + _this._styleListener = null; + /** + * Private tracker for the current font. + * + * @member {string} + * @private + */ + _this._font = ''; + _this.text = text; + _this.style = style; + _this.localStyleID = -1; + return _this; + } + /** + * Renders text to its canvas, and updates its texture. + * By default this is used internally to ensure the texture is correct before rendering, + * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text, + * and then shared across multiple Sprites. + * + * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called. + */ + Text.prototype.updateText = function (respectDirty) { + var style = this._style; + // check if style has changed.. + if (this.localStyleID !== style.styleID) { + this.dirty = true; + this.localStyleID = style.styleID; + } + if (!this.dirty && respectDirty) { + return; + } + this._font = this._style.toFontString(); + var context = this.context; + var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas); + var width = measured.width; + var height = measured.height; + var lines = measured.lines; + var lineHeight = measured.lineHeight; + var lineWidths = measured.lineWidths; + var maxLineWidth = measured.maxLineWidth; + var fontProperties = measured.fontProperties; + this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution); + this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution); + context.scale(this._resolution, this._resolution); + context.clearRect(0, 0, this.canvas.width, this.canvas.height); + context.font = this._font; + context.lineWidth = style.strokeThickness; + context.textBaseline = style.textBaseline; + context.lineJoin = style.lineJoin; + context.miterLimit = style.miterLimit; + var linePositionX; + var linePositionY; + // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text + var passesCount = style.dropShadow ? 2 : 1; + // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex, + // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow. + // + // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more + // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill + // and the stroke; and fill drop shadows would appear over the top of the stroke. + // + // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal + // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the + // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow + // beneath the text, whilst also having the proper text shadow styling. + for (var i = 0; i < passesCount; ++i) { + var isShadowPass = style.dropShadow && i === 0; + // we only want the drop shadow, so put text way off-screen + var dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0; + var dsOffsetShadow = dsOffsetText * this._resolution; + if (isShadowPass) { + // On Safari, text with gradient and drop shadows together do not position correctly + // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689 + // Therefore we'll set the styles to be a plain black whilst generating this drop shadow + context.fillStyle = 'black'; + context.strokeStyle = 'black'; + var dropShadowColor = style.dropShadowColor; + var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); + var dropShadowBlur = style.dropShadowBlur * this._resolution; + var dropShadowDistance = style.dropShadowDistance * this._resolution; + context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; + context.shadowBlur = dropShadowBlur; + context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance; + context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * dropShadowDistance) + dsOffsetShadow; + } + else { + // set canvas text styles + context.fillStyle = this._generateFillStyle(style, lines, measured); + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + context.strokeStyle = style.stroke; + context.shadowColor = 'black'; + context.shadowBlur = 0; + context.shadowOffsetX = 0; + context.shadowOffsetY = 0; + } + // draw lines line by line + for (var i_1 = 0; i_1 < lines.length; i_1++) { + linePositionX = style.strokeThickness / 2; + linePositionY = ((style.strokeThickness / 2) + (i_1 * lineHeight)) + fontProperties.ascent; + if (style.align === 'right') { + linePositionX += maxLineWidth - lineWidths[i_1]; + } + else if (style.align === 'center') { + linePositionX += (maxLineWidth - lineWidths[i_1]) / 2; + } + if (style.stroke && style.strokeThickness) { + this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText, true); + } + if (style.fill) { + this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText); + } + } + } + this.updateTexture(); + }; + /** + * Render the text with letter-spacing. + * @param {string} text - The text to draw + * @param {number} x - Horizontal position to draw the text + * @param {number} y - Vertical position to draw the text + * @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the + * text? If not, it's for the inside fill + * @private + */ + Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) { + if (isStroke === void 0) { isStroke = false; } + var style = this._style; + // letterSpacing of 0 means normal + var letterSpacing = style.letterSpacing; + if (letterSpacing === 0) { + if (isStroke) { + this.context.strokeText(text, x, y); + } + else { + this.context.fillText(text, x, y); + } + return; + } + var currentPosition = x; + // Using Array.from correctly splits characters whilst keeping emoji together. + // This is not supported on IE as it requires ES6, so regular text splitting occurs. + // This also doesn't account for emoji that are multiple emoji put together to make something else. + // Handling all of this would require a big library itself. + // https://medium.com/@giltayar/iterating-over-emoji-characters-the-es6-way-f06e4589516 + // https://github.com/orling/grapheme-splitter + var stringArray = Array.from ? Array.from(text) : text.split(''); + var previousWidth = this.context.measureText(text).width; + var currentWidth = 0; + for (var i = 0; i < stringArray.length; ++i) { + var currentChar = stringArray[i]; + if (isStroke) { + this.context.strokeText(currentChar, currentPosition, y); + } + else { + this.context.fillText(currentChar, currentPosition, y); + } + currentWidth = this.context.measureText(text.substring(i + 1)).width; + currentPosition += previousWidth - currentWidth + letterSpacing; + previousWidth = currentWidth; + } + }; + /** + * Updates texture size based on canvas size + * + * @private + */ + Text.prototype.updateTexture = function () { + var canvas = this.canvas; + if (this._style.trim) { + var trimmed = trimCanvas(canvas); + if (trimmed.data) { + canvas.width = trimmed.width; + canvas.height = trimmed.height; + this.context.putImageData(trimmed.data, 0, 0); + } + } + var texture = this._texture; + var style = this._style; + var padding = style.trim ? 0 : style.padding; + var baseTexture = texture.baseTexture; + texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution); + texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution); + texture.trim.x = -padding; + texture.trim.y = -padding; + texture.orig.width = texture._frame.width - (padding * 2); + texture.orig.height = texture._frame.height - (padding * 2); + // call sprite onTextureUpdate to update scale if _width or _height were set + this._onTextureUpdate(); + baseTexture.setRealSize(canvas.width, canvas.height, this._resolution); + // Recursively updates transform of all objects from the root to this one + this._recursivePostUpdateTransform(); + this.dirty = false; + }; + /** + * Renders the object using the WebGL renderer + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + Text.prototype._render = function (renderer) { + if (this._autoResolution && this._resolution !== renderer.resolution) { + this._resolution = renderer.resolution; + this.dirty = true; + } + this.updateText(true); + _super.prototype._render.call(this, renderer); + }; + /** + * Gets the local bounds of the text object. + * + * @param {PIXI.Rectangle} rect - The output rectangle. + * @return {PIXI.Rectangle} The bounds. + */ + Text.prototype.getLocalBounds = function (rect) { + this.updateText(true); + return _super.prototype.getLocalBounds.call(this, rect); + }; + /** + * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. + * @protected + */ + Text.prototype._calculateBounds = function () { + this.updateText(true); + this.calculateVertices(); + // if we have already done this on THIS frame. + this._bounds.addQuad(this.vertexData); + }; + /** + * Generates the fill style. Can automatically generate a gradient based on the fill style being an array + * + * @private + * @param {object} style - The style. + * @param {string[]} lines - The lines of text. + * @return {string|number|CanvasGradient} The fill style + */ + Text.prototype._generateFillStyle = function (style, lines, metrics) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + var fillStyle = style.fill; + if (!Array.isArray(fillStyle)) { + return fillStyle; + } + else if (fillStyle.length === 1) { + return fillStyle[0]; + } + // the gradient will be evenly spaced out according to how large the array is. + // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 + var gradient; + // a dropshadow will enlarge the canvas and result in the gradient being + // generated with the incorrect dimensions + var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; + // should also take padding into account, padding can offset the gradient + var padding = style.padding || 0; + var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2); + var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2); + // make a copy of the style settings, so we can manipulate them later + var fill = fillStyle.slice(); + var fillGradientStops = style.fillGradientStops.slice(); + // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 + if (!fillGradientStops.length) { + var lengthPlus1 = fill.length + 1; + for (var i = 1; i < lengthPlus1; ++i) { + fillGradientStops.push(i / lengthPlus1); + } + } + // stop the bleeding of the last gradient on the line above to the top gradient of the this line + // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 + fill.unshift(fillStyle[0]); + fillGradientStops.unshift(0); + fill.push(fillStyle[fillStyle.length - 1]); + fillGradientStops.push(1); + if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { + // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas + gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding); + // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect + // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 + // There's potential for floating point precision issues at the seams between gradient repeats. + // The loop below generates the stops in order, so track the last generated one to prevent + // floating point precision from making us go the teeniest bit backwards, resulting in + // the first and last colors getting swapped. + var lastIterationStop = 0; + // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc + var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; + // textHeight, but as a 0-1 size in global gradient stop space + var gradStopLineHeight = textHeight / height; + for (var i = 0; i < lines.length; i++) { + var thisLineTop = metrics.lineHeight * i; + for (var j = 0; j < fill.length; j++) { + // 0-1 stop point for the current line, multiplied to global space afterwards + var lineStop = 0; + if (typeof fillGradientStops[j] === 'number') { + lineStop = fillGradientStops[j]; + } + else { + lineStop = j / fill.length; + } + var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); + // Prevent color stop generation going backwards from floating point imprecision + var clampedStop = Math.max(lastIterationStop, globalStop); + clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. + gradient.addColorStop(clampedStop, fill[j]); + lastIterationStop = clampedStop; + } + } + } + else { + // start the gradient at the center left of the canvas, and end at the center right of the canvas + gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2); + // can just evenly space out the gradients in this case, as multiple lines makes no difference + // to an even left to right gradient + var totalIterations = fill.length + 1; + var currentIteration = 1; + for (var i = 0; i < fill.length; i++) { + var stop = void 0; + if (typeof fillGradientStops[i] === 'number') { + stop = fillGradientStops[i]; + } + else { + stop = currentIteration / totalIterations; + } + gradient.addColorStop(stop, fill[i]); + currentIteration++; + } + } + return gradient; + }; + /** + * Destroys this text object. + * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as + * the majority of the time the texture will not be shared with any other Sprites. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their + * destroy method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well + */ + Text.prototype.destroy = function (options) { + if (typeof options === 'boolean') { + options = { children: options }; + } + options = Object.assign({}, defaultDestroyOptions, options); + _super.prototype.destroy.call(this, options); + // set canvas width and height to 0 to workaround memory leak in Safari < 13 + // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12 + if (this._ownCanvas) { + this.canvas.height = this.canvas.width = 0; + } + // make sure to reset the the context and canvas.. dont want this hanging around in memory! + this.context = null; + this.canvas = null; + this._style = null; + }; + Object.defineProperty(Text.prototype, "width", { + /** + * The width of the Text, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + this.updateText(true); + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + this.updateText(true); + var s = sign$1(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "height", { + /** + * The height of the Text, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + this.updateText(true); + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + this.updateText(true); + var s = sign$1(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "style", { + /** + * Set the style of the text. Set up an event listener to listen for changes on the style + * object and mark the text as dirty. + * + * @member {object|PIXI.TextStyle} + */ + get: function () { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle + // since the setter creates the TextStyle. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + return this._style; + }, + set: function (style) { + style = style || {}; + if (style instanceof TextStyle) { + this._style = style; + } + else { + this._style = new TextStyle(style); + } + this.localStyleID = -1; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "text", { + /** + * Set the copy for the text object. To split a line you can use '\n'. + * + * @member {string} + */ + get: function () { + return this._text; + }, + set: function (text) { + text = String(text === null || text === undefined ? '' : text); + if (this._text === text) { + return; + } + this._text = text; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "resolution", { + /** + * The resolution / device pixel ratio of the canvas. + * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. + * @member {number} + * @default 1 + */ + get: function () { + return this._resolution; + }, + set: function (value) { + this._autoResolution = false; + if (this._resolution === value) { + return; + } + this._resolution = value; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + return Text; + }(Sprite)); + + /*! + * @pixi/prepare - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/prepare is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Default number of uploads per frame using prepare plugin. + * + * @static + * @memberof PIXI.settings + * @name UPLOADS_PER_FRAME + * @type {number} + * @default 4 + */ + settings.UPLOADS_PER_FRAME = 4; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$8 = function(d, b) { + extendStatics$8 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$8(d, b); + }; + + function __extends$8(d, b) { + extendStatics$8(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified + * number of items per frame. + * + * @class + * @memberof PIXI + */ + var CountLimiter = /** @class */ (function () { + /** + * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame. + */ + function CountLimiter(maxItemsPerFrame) { + /** + * The maximum number of items that can be prepared each frame. + * @type {number} + * @private + */ + this.maxItemsPerFrame = maxItemsPerFrame; + /** + * The number of items that can be prepared in the current frame. + * @type {number} + * @private + */ + this.itemsLeft = 0; + } + /** + * Resets any counting properties to start fresh on a new frame. + */ + CountLimiter.prototype.beginFrame = function () { + this.itemsLeft = this.maxItemsPerFrame; + }; + /** + * Checks to see if another item can be uploaded. This should only be called once per item. + * @return {boolean} If the item is allowed to be uploaded. + */ + CountLimiter.prototype.allowedToUpload = function () { + return this.itemsLeft-- > 0; + }; + return CountLimiter; + }()); + + /** + * Built-in hook to find multiple textures from objects like AnimatedSprites. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + function findMultipleBaseTextures(item, queue) { + var result = false; + // Objects with multiple textures + if (item && item._textures && item._textures.length) { + for (var i = 0; i < item._textures.length; i++) { + if (item._textures[i] instanceof Texture) { + var baseTexture = item._textures[i].baseTexture; + if (queue.indexOf(baseTexture) === -1) { + queue.push(baseTexture); + result = true; + } + } + } + } + return result; + } + /** + * Built-in hook to find BaseTextures from Texture. + * + * @private + * @param {PIXI.Texture} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + function findBaseTexture(item, queue) { + if (item.baseTexture instanceof BaseTexture) { + var texture = item.baseTexture; + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + return true; + } + return false; + } + /** + * Built-in hook to find textures from objects. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + function findTexture(item, queue) { + if (item._texture && item._texture instanceof Texture) { + var texture = item._texture.baseTexture; + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + return true; + } + return false; + } + /** + * Built-in hook to draw PIXI.Text to its texture. + * + * @private + * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function drawText(_helper, item) { + if (item instanceof Text) { + // updating text will return early if it is not dirty + item.updateText(true); + return true; + } + return false; + } + /** + * Built-in hook to calculate a text style for a PIXI.Text object. + * + * @private + * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function calculateTextStyle(_helper, item) { + if (item instanceof TextStyle) { + var font = item.toFontString(); + TextMetrics.measureFont(font); + return true; + } + return false; + } + /** + * Built-in hook to find Text objects. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Text object was found. + */ + function findText(item, queue) { + if (item instanceof Text) { + // push the text style to prepare it - this can be really expensive + if (queue.indexOf(item.style) === -1) { + queue.push(item.style); + } + // also push the text object so that we can render it (to canvas/texture) if needed + if (queue.indexOf(item) === -1) { + queue.push(item); + } + // also push the Text's texture for upload to GPU + var texture = item._texture.baseTexture; + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + return true; + } + return false; + } + /** + * Built-in hook to find TextStyle objects. + * + * @private + * @param {PIXI.TextStyle} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.TextStyle object was found. + */ + function findTextStyle(item, queue) { + if (item instanceof TextStyle) { + if (queue.indexOf(item) === -1) { + queue.push(item); + } + return true; + } + return false; + } + /** + * The prepare manager provides functionality to upload content to the GPU. + * + * BasePrepare handles basic queuing functionality and is extended by + * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare} + * to provide preparation capabilities specific to their respective renderers. + * + * @example + * // Create a sprite + * const sprite = PIXI.Sprite.from('something.png'); + * + * // Load object into GPU + * app.renderer.plugins.prepare.upload(sprite, () => { + * + * //Texture(s) has been uploaded to GPU + * app.stage.addChild(sprite); + * + * }) + * + * @abstract + * @class + * @memberof PIXI + */ + var BasePrepare = /** @class */ (function () { + /** + * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer + */ + function BasePrepare(renderer) { + var _this = this; + /** + * The limiter to be used to control how quickly items are prepared. + * @type {PIXI.CountLimiter|PIXI.TimeLimiter} + */ + this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME); + /** + * Reference to the renderer. + * @type {PIXI.AbstractRenderer} + * @protected + */ + this.renderer = renderer; + /** + * The only real difference between CanvasPrepare and Prepare is what they pass + * to upload hooks. That different parameter is stored here. + * @type {object} + * @protected + */ + this.uploadHookHelper = null; + /** + * Collection of items to uploads at once. + * @type {Array<*>} + * @private + */ + this.queue = []; + /** + * Collection of additional hooks for finding assets. + * @type {Array} + * @private + */ + this.addHooks = []; + /** + * Collection of additional hooks for processing assets. + * @type {Array} + * @private + */ + this.uploadHooks = []; + /** + * Callback to call after completed. + * @type {Array} + * @private + */ + this.completes = []; + /** + * If prepare is ticking (running). + * @type {boolean} + * @private + */ + this.ticking = false; + /** + * 'bound' call for prepareItems(). + * @type {Function} + * @private + */ + this.delayedTick = function () { + // unlikely, but in case we were destroyed between tick() and delayedTick() + if (!_this.queue) { + return; + } + _this.prepareItems(); + }; + // hooks to find the correct texture + this.registerFindHook(findText); + this.registerFindHook(findTextStyle); + this.registerFindHook(findMultipleBaseTextures); + this.registerFindHook(findBaseTexture); + this.registerFindHook(findTexture); + // upload hooks + this.registerUploadHook(drawText); + this.registerUploadHook(calculateTextStyle); + } + /** + * Upload all the textures and graphics to the GPU. + * + * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item - + * Either the container or display object to search for items to upload, the items to upload themselves, + * or the callback function, if items have been added using `prepare.add`. + * @param {Function} [done] - Optional callback when all queued uploads have completed + */ + BasePrepare.prototype.upload = function (item, done) { + if (typeof item === 'function') { + done = item; + item = null; + } + // If a display object, search for items + // that we could upload + if (item) { + this.add(item); + } + // Get the items for upload from the display + if (this.queue.length) { + if (done) { + this.completes.push(done); + } + if (!this.ticking) { + this.ticking = true; + Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); + } + } + else if (done) { + done(); + } + }; + /** + * Handle tick update + * + * @private + */ + BasePrepare.prototype.tick = function () { + setTimeout(this.delayedTick, 0); + }; + /** + * Actually prepare items. This is handled outside of the tick because it will take a while + * and we do NOT want to block the current animation frame from rendering. + * + * @private + */ + BasePrepare.prototype.prepareItems = function () { + this.limiter.beginFrame(); + // Upload the graphics + while (this.queue.length && this.limiter.allowedToUpload()) { + var item = this.queue[0]; + var uploaded = false; + if (item && !item._destroyed) { + for (var i = 0, len = this.uploadHooks.length; i < len; i++) { + if (this.uploadHooks[i](this.uploadHookHelper, item)) { + this.queue.shift(); + uploaded = true; + break; + } + } + } + if (!uploaded) { + this.queue.shift(); + } + } + // We're finished + if (!this.queue.length) { + this.ticking = false; + var completes = this.completes.slice(0); + this.completes.length = 0; + for (var i = 0, len = completes.length; i < len; i++) { + completes[i](); + } + } + else { + // if we are not finished, on the next rAF do this again + Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); + } + }; + /** + * Adds hooks for finding items. + * + * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` + * function must return `true` if it was able to add item to the queue. + * @return {this} Instance of plugin for chaining. + */ + BasePrepare.prototype.registerFindHook = function (addHook) { + if (addHook) { + this.addHooks.push(addHook); + } + return this; + }; + /** + * Adds hooks for uploading items. + * + * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and + * function must return `true` if it was able to handle upload of item. + * @return {this} Instance of plugin for chaining. + */ + BasePrepare.prototype.registerUploadHook = function (uploadHook) { + if (uploadHook) { + this.uploadHooks.push(uploadHook); + } + return this; + }; + /** + * Manually add an item to the uploading queue. + * + * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to + * add to the queue + * @return {this} Instance of plugin for chaining. + */ + BasePrepare.prototype.add = function (item) { + // Add additional hooks for finding elements on special + // types of objects that + for (var i = 0, len = this.addHooks.length; i < len; i++) { + if (this.addHooks[i](item, this.queue)) { + break; + } + } + // Get children recursively + if (item instanceof Container) { + for (var i = item.children.length - 1; i >= 0; i--) { + this.add(item.children[i]); + } + } + return this; + }; + /** + * Destroys the plugin, don't use after this. + * + */ + BasePrepare.prototype.destroy = function () { + if (this.ticking) { + Ticker.system.remove(this.tick, this); + } + this.ticking = false; + this.addHooks = null; + this.uploadHooks = null; + this.renderer = null; + this.completes = null; + this.queue = null; + this.limiter = null; + this.uploadHookHelper = null; + }; + return BasePrepare; + }()); + + /** + * Built-in hook to upload PIXI.Texture objects to the GPU. + * + * @private + * @param {PIXI.Renderer} renderer - instance of the webgl renderer + * @param {PIXI.BaseTexture} item - Item to check + * @return {boolean} If item was uploaded. + */ + function uploadBaseTextures(renderer, item) { + if (item instanceof BaseTexture) { + // if the texture already has a GL texture, then the texture has been prepared or rendered + // before now. If the texture changed, then the changer should be calling texture.update() which + // reuploads the texture without need for preparing it again + if (!item._glTextures[renderer.CONTEXT_UID]) { + renderer.texture.bind(item); + } + return true; + } + return false; + } + /** + * Built-in hook to upload PIXI.Graphics to the GPU. + * + * @private + * @param {PIXI.Renderer} renderer - instance of the webgl renderer + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function uploadGraphics(renderer, item) { + if (!(item instanceof Graphics)) { + return false; + } + var geometry = item.geometry; + // update dirty graphics to get batches + item.finishPoly(); + geometry.updateBatches(); + var batches = geometry.batches; + // upload all textures found in styles + for (var i = 0; i < batches.length; i++) { + var texture = batches[i].style.texture; + if (texture) { + uploadBaseTextures(renderer, texture.baseTexture); + } + } + // if its not batchable - update vao for particular shader + if (!geometry.batchable) { + renderer.geometry.bind(geometry, item._resolveDirectShader(renderer)); + } + return true; + } + /** + * Built-in hook to find graphics. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Graphics object was found. + */ + function findGraphics(item, queue) { + if (item instanceof Graphics) { + queue.push(item); + return true; + } + return false; + } + /** + * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for + * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed. + * + * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property. + * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}. + * @example + * // Create a new application + * const app = new PIXI.Application(); + * document.body.appendChild(app.view); + * + * // Don't start rendering right away + * app.stop(); + * + * // create a display object + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add to the stage + * app.stage.addChild(rect); + * + * // Don't start rendering until the graphic is uploaded to the GPU + * app.renderer.plugins.prepare.upload(app.stage, () => { + * app.start(); + * }); + * + * @class + * @extends PIXI.BasePrepare + * @memberof PIXI + */ + var Prepare = /** @class */ (function (_super) { + __extends$8(Prepare, _super); + /** + * @param {PIXI.Renderer} renderer - A reference to the current renderer + */ + function Prepare(renderer) { + var _this = _super.call(this, renderer) || this; + _this.uploadHookHelper = _this.renderer; + // Add textures and graphics to upload + _this.registerFindHook(findGraphics); + _this.registerUploadHook(uploadBaseTextures); + _this.registerUploadHook(uploadGraphics); + return _this; + } + return Prepare; + }(BasePrepare)); + + /** + * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified + * number of milliseconds per frame. + * + * @class + * @memberof PIXI + */ + var TimeLimiter = /** @class */ (function () { + /** + * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. + */ + function TimeLimiter(maxMilliseconds) { + /** + * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} + * @private + */ + this.maxMilliseconds = maxMilliseconds; + /** + * The start time of the current frame. + * @type {number} + * @private + */ + this.frameStart = 0; + } + /** + * Resets any counting properties to start fresh on a new frame. + */ + TimeLimiter.prototype.beginFrame = function () { + this.frameStart = Date.now(); + }; + /** + * Checks to see if another item can be uploaded. This should only be called once per item. + * @return {boolean} If the item is allowed to be uploaded. + */ + TimeLimiter.prototype.allowedToUpload = function () { + return Date.now() - this.frameStart < this.maxMilliseconds; + }; + return TimeLimiter; + }()); + + /*! + * @pixi/spritesheet - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/spritesheet is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Utility class for maintaining reference to a collection + * of Textures on a single Spritesheet. + * + * To access a sprite sheet from your code pass its JSON data file to Pixi's loader: + * + * ```js + * PIXI.Loader.shared.add("images/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["images/spritesheet.json"].spritesheet; + * ... + * } + * ``` + * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite. + * + * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker}, + * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}. + * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only + * supported by TexturePacker. + * + * @class + * @memberof PIXI + */ + var Spritesheet = /** @class */ (function () { + /** + * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object. + * @param {Object} data - Spritesheet image data. + * @param {string} [resolutionFilename] - The filename to consider when determining + * the resolution of the spritesheet. If not provided, the imageUrl will + * be used on the BaseTexture. + */ + function Spritesheet(texture, data, resolutionFilename) { + if (resolutionFilename === void 0) { resolutionFilename = null; } + /** + * Reference to original source image from the Loader. This reference is retained so we + * can destroy the Texture later on. It is never used internally. + * @type {PIXI.Texture} + * @private + */ + this._texture = texture instanceof Texture ? texture : null; + /** + * Reference to ths source texture. + * @type {PIXI.BaseTexture} + */ + this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture; + /** + * A map containing all textures of the sprite sheet. + * Can be used to create a {@link PIXI.Sprite|Sprite}: + * ```js + * new PIXI.Sprite(sheet.textures["image.png"]); + * ``` + * @member {Object} + */ + this.textures = {}; + /** + * A map containing the textures for each animation. + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: + * ```js + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) + * ``` + * @member {Object} + */ + this.animations = {}; + /** + * Reference to the original JSON data. + * @type {Object} + */ + this.data = data; + var resource = this.baseTexture.resource; + /** + * The resolution of the spritesheet. + * @type {number} + */ + this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null)); + /** + * Map of spritesheet frames. + * @type {Object} + * @private + */ + this._frames = this.data.frames; + /** + * Collection of frame names. + * @type {string[]} + * @private + */ + this._frameKeys = Object.keys(this._frames); + /** + * Current batch index being processed. + * @type {number} + * @private + */ + this._batchIndex = 0; + /** + * Callback when parse is completed. + * @type {Function} + * @private + */ + this._callback = null; + } + /** + * Generate the resolution from the filename or fallback + * to the meta.scale field of the JSON data. + * + * @private + * @param {string} resolutionFilename - The filename to use for resolving + * the default resolution. + * @return {number} Resolution to use for spritesheet. + */ + Spritesheet.prototype._updateResolution = function (resolutionFilename) { + if (resolutionFilename === void 0) { resolutionFilename = null; } + var scale = this.data.meta.scale; + // Use a defaultValue of `null` to check if a url-based resolution is set + var resolution = getResolutionOfUrl(resolutionFilename, null); + // No resolution found via URL + if (resolution === null) { + // Use the scale value or default to 1 + resolution = scale !== undefined ? parseFloat(scale) : 1; + } + // For non-1 resolutions, update baseTexture + if (resolution !== 1) { + this.baseTexture.setResolution(resolution); + } + return resolution; + }; + /** + * Parser spritesheet from loaded data. This is done asynchronously + * to prevent creating too many Texture within a single process. + * + * @param {Function} callback - Callback when complete returns + * a map of the Textures for this spritesheet. + */ + Spritesheet.prototype.parse = function (callback) { + this._batchIndex = 0; + this._callback = callback; + if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) { + this._processFrames(0); + this._processAnimations(); + this._parseComplete(); + } + else { + this._nextBatch(); + } + }; + /** + * Process a batch of frames + * + * @private + * @param {number} initialFrameIndex - The index of frame to start. + */ + Spritesheet.prototype._processFrames = function (initialFrameIndex) { + var frameIndex = initialFrameIndex; + var maxFrames = Spritesheet.BATCH_SIZE; + while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) { + var i = this._frameKeys[frameIndex]; + var data = this._frames[i]; + var rect = data.frame; + if (rect) { + var frame = null; + var trim = null; + var sourceSize = data.trimmed !== false && data.sourceSize + ? data.sourceSize : data.frame; + var orig = new Rectangle(0, 0, Math.floor(sourceSize.w) / this.resolution, Math.floor(sourceSize.h) / this.resolution); + if (data.rotated) { + frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.h) / this.resolution, Math.floor(rect.w) / this.resolution); + } + else { + frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); + } + // Check to see if the sprite is trimmed + if (data.trimmed !== false && data.spriteSourceSize) { + trim = new Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); + } + this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor); + // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions + Texture.addToCache(this.textures[i], i); + } + frameIndex++; + } + }; + /** + * Parse animations config + * + * @private + */ + Spritesheet.prototype._processAnimations = function () { + var animations = this.data.animations || {}; + for (var animName in animations) { + this.animations[animName] = []; + for (var i = 0; i < animations[animName].length; i++) { + var frameName = animations[animName][i]; + this.animations[animName].push(this.textures[frameName]); + } + } + }; + /** + * The parse has completed. + * + * @private + */ + Spritesheet.prototype._parseComplete = function () { + var callback = this._callback; + this._callback = null; + this._batchIndex = 0; + callback.call(this, this.textures); + }; + /** + * Begin the next batch of textures. + * + * @private + */ + Spritesheet.prototype._nextBatch = function () { + var _this = this; + this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE); + this._batchIndex++; + setTimeout(function () { + if (_this._batchIndex * Spritesheet.BATCH_SIZE < _this._frameKeys.length) { + _this._nextBatch(); + } + else { + _this._processAnimations(); + _this._parseComplete(); + } + }, 0); + }; + /** + * Destroy Spritesheet and don't use after this. + * + * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well + */ + Spritesheet.prototype.destroy = function (destroyBase) { + var _a; + if (destroyBase === void 0) { destroyBase = false; } + for (var i in this.textures) { + this.textures[i].destroy(); + } + this._frames = null; + this._frameKeys = null; + this.data = null; + this.textures = null; + if (destroyBase) { + (_a = this._texture) === null || _a === void 0 ? void 0 : _a.destroy(); + this.baseTexture.destroy(); + } + this._texture = null; + this.baseTexture = null; + }; + /** + * The maximum number of Textures to build per process. + * + * @type {number} + * @default 1000 + */ + Spritesheet.BATCH_SIZE = 1000; + return Spritesheet; + }()); + + /** + * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with + * TexturePacker or similar JSON-based spritesheet. + * + * This middleware automatically generates Texture resources. + * + * @class + * @memberof PIXI + * @implements PIXI.ILoaderPlugin + */ + var SpritesheetLoader = /** @class */ (function () { + function SpritesheetLoader() { + } + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + SpritesheetLoader.use = function (resource, next) { + // because this is middleware, it execute in loader context. `this` = loader + var loader = this; + var imageResourceName = resource.name + "_image"; + // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists + if (!resource.data + || resource.type !== LoaderResource.TYPE.JSON + || !resource.data.frames + || loader.resources[imageResourceName]) { + next(); + return; + } + var loadOptions = { + crossOrigin: resource.crossOrigin, + metadata: resource.metadata.imageMetadata, + parentResource: resource, + }; + var resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl); + // load the image for this sheet + loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) { + if (res.error) { + next(res.error); + return; + } + var spritesheet = new Spritesheet(res.texture, resource.data, resource.url); + spritesheet.parse(function () { + resource.spritesheet = spritesheet; + resource.textures = spritesheet.textures; + next(); + }); + }); + }; + /** + * Get the spritesheets root path + * @param {PIXI.LoaderResource} resource - Resource to check path + * @param {string} baseUrl - Base root url + */ + SpritesheetLoader.getResourcePath = function (resource, baseUrl) { + // Prepend url path unless the resource image is a data url + if (resource.isDataUrl) { + return resource.data.meta.image; + } + return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); + }; + return SpritesheetLoader; + }()); + + /*! + * @pixi/sprite-tiling - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/sprite-tiling is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$9 = function(d, b) { + extendStatics$9 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$9(d, b); + }; + + function __extends$9(d, b) { + extendStatics$9(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var tempPoint$1 = new Point(); + /** + * A tiling sprite is a fast way of rendering a tiling image + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI + */ + var TilingSprite = /** @class */ (function (_super) { + __extends$9(TilingSprite, _super); + /** + * @param {PIXI.Texture} texture - the texture of the tiling sprite + * @param {number} [width=100] - the width of the tiling sprite + * @param {number} [height=100] - the height of the tiling sprite + */ + function TilingSprite(texture, width, height) { + if (width === void 0) { width = 100; } + if (height === void 0) { height = 100; } + var _this = _super.call(this, texture) || this; + /** + * Tile transform + * + * @member {PIXI.Transform} + */ + _this.tileTransform = new Transform(); + /** + * The with of the tiling sprite + * + * @member {number} + * @private + */ + _this._width = width; + /** + * The height of the tiling sprite + * + * @member {number} + * @private + */ + _this._height = height; + /** + * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space + * + * @member {PIXI.TextureMatrix} + */ + _this.uvMatrix = _this.texture.uvMatrix || new TextureMatrix(texture); + /** + * Plugin that is responsible for rendering this element. + * Allows to customize the rendering process without overriding '_render' method. + * + * @member {string} + * @default 'tilingSprite' + */ + _this.pluginName = 'tilingSprite'; + /** + * Whether or not anchor affects uvs + * + * @member {boolean} + * @default false + */ + _this.uvRespectAnchor = false; + return _this; + } + Object.defineProperty(TilingSprite.prototype, "clampMargin", { + /** + * Changes frame clamping in corresponding textureTransform, shortcut + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * + * @default 0.5 + * @member {number} + */ + get: function () { + return this.uvMatrix.clampMargin; + }, + set: function (value) { + this.uvMatrix.clampMargin = value; + this.uvMatrix.update(true); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TilingSprite.prototype, "tileScale", { + /** + * The scaling of the image that is being tiled + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.tileTransform.scale; + }, + set: function (value) { + this.tileTransform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TilingSprite.prototype, "tilePosition", { + /** + * The offset of the image that is being tiled + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.tileTransform.position; + }, + set: function (value) { + this.tileTransform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + /** + * @protected + */ + TilingSprite.prototype._onTextureUpdate = function () { + if (this.uvMatrix) { + this.uvMatrix.texture = this._texture; + } + this._cachedTint = 0xFFFFFF; + }; + /** + * Renders the object using the WebGL renderer + * + * @protected + * @param {PIXI.Renderer} renderer - The renderer + */ + TilingSprite.prototype._render = function (renderer) { + // tweak our texture temporarily.. + var texture = this._texture; + if (!texture || !texture.valid) { + return; + } + this.tileTransform.updateLocalTransform(); + this.uvMatrix.update(); + renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); + renderer.plugins[this.pluginName].render(this); + }; + /** + * Updates the bounds of the tiling sprite. + * + * @protected + */ + TilingSprite.prototype._calculateBounds = function () { + var minX = this._width * -this._anchor._x; + var minY = this._height * -this._anchor._y; + var maxX = this._width * (1 - this._anchor._x); + var maxY = this._height * (1 - this._anchor._y); + this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); + }; + /** + * Gets the local bounds of the sprite object. + * + * @param {PIXI.Rectangle} rect - The output rectangle. + * @return {PIXI.Rectangle} The bounds. + */ + TilingSprite.prototype.getLocalBounds = function (rect) { + // we can do a fast local bounds if the sprite has no children! + if (this.children.length === 0) { + this._bounds.minX = this._width * -this._anchor._x; + this._bounds.minY = this._height * -this._anchor._y; + this._bounds.maxX = this._width * (1 - this._anchor._x); + this._bounds.maxY = this._height * (1 - this._anchor._y); + if (!rect) { + if (!this._localBoundsRect) { + this._localBoundsRect = new Rectangle(); + } + rect = this._localBoundsRect; + } + return this._bounds.getRectangle(rect); + } + return _super.prototype.getLocalBounds.call(this, rect); + }; + /** + * Checks if a point is inside this tiling sprite. + * + * @param {PIXI.IPointData} point - the point to check + * @return {boolean} Whether or not the sprite contains the point. + */ + TilingSprite.prototype.containsPoint = function (point) { + this.worldTransform.applyInverse(point, tempPoint$1); + var width = this._width; + var height = this._height; + var x1 = -width * this.anchor._x; + if (tempPoint$1.x >= x1 && tempPoint$1.x < x1 + width) { + var y1 = -height * this.anchor._y; + if (tempPoint$1.y >= y1 && tempPoint$1.y < y1 + height) { + return true; + } + } + return false; + }; + /** + * Destroys this sprite and optionally its texture and children + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well + * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well + */ + TilingSprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.tileTransform = null; + this.uvMatrix = null; + }; + /** + * Helper function that creates a new tiling sprite based on the source you provide. + * The source can be - frame id, image url, video url, canvas element, video element, base texture + * + * @static + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {number} options.width - required width of the tiling sprite + * @param {number} options.height - required height of the tiling sprite + * @return {PIXI.TilingSprite} The newly created texture + */ + TilingSprite.from = function (source, options) { + // Deprecated + if (typeof options === 'number') { + deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args'); + // eslint-disable-next-line prefer-rest-params + options = { width: options, height: arguments[2] }; + } + return new TilingSprite(Texture.from(source, options), options.width, options.height); + }; + Object.defineProperty(TilingSprite.prototype, "width", { + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this._width; + }, + set: function (value) { + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TilingSprite.prototype, "height", { + /** + * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this._height; + }, + set: function (value) { + this._height = value; + }, + enumerable: false, + configurable: true + }); + return TilingSprite; + }(Sprite)); + + var vertex$2 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n"; + + var fragment$2 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture2D(uSampler, coord);\n gl_FragColor = texSample * uColor;\n}\n"; + + var fragmentSimple = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n"; + + var tempMat$1 = new Matrix(); + /** + * WebGL renderer plugin for tiling sprites + * + * @class + * @memberof PIXI + * @extends PIXI.ObjectRenderer + */ + var TilingSpriteRenderer = /** @class */ (function (_super) { + __extends$9(TilingSpriteRenderer, _super); + /** + * constructor for renderer + * + * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for. + */ + function TilingSpriteRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + var uniforms = { globals: _this.renderer.globalUniforms }; + _this.shader = Shader.from(vertex$2, fragment$2, uniforms); + _this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms); + _this.quad = new QuadUv(); + /** + * The WebGL state in which this renderer will work. + * + * @member {PIXI.State} + * @readonly + */ + _this.state = State.for2d(); + return _this; + } + /** + * + * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered + */ + TilingSpriteRenderer.prototype.render = function (ts) { + var renderer = this.renderer; + var quad = this.quad; + var vertices = quad.vertices; + vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x; + vertices[1] = vertices[3] = ts._height * -ts.anchor.y; + vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x); + vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y); + if (ts.uvRespectAnchor) { + vertices = quad.uvs; + vertices[0] = vertices[6] = -ts.anchor.x; + vertices[1] = vertices[3] = -ts.anchor.y; + vertices[2] = vertices[4] = 1.0 - ts.anchor.x; + vertices[5] = vertices[7] = 1.0 - ts.anchor.y; + } + quad.invalidate(); + var tex = ts._texture; + var baseTex = tex.baseTexture; + var lt = ts.tileTransform.localTransform; + var uv = ts.uvMatrix; + var isSimple = baseTex.isPowerOfTwo + && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height; + // auto, force repeat wrapMode for big tiling textures + if (isSimple) { + if (!baseTex._glTextures[renderer.CONTEXT_UID]) { + if (baseTex.wrapMode === exports.WRAP_MODES.CLAMP) { + baseTex.wrapMode = exports.WRAP_MODES.REPEAT; + } + } + else { + isSimple = baseTex.wrapMode !== exports.WRAP_MODES.CLAMP; + } + } + var shader = isSimple ? this.simpleShader : this.shader; + var w = tex.width; + var h = tex.height; + var W = ts._width; + var H = ts._height; + tempMat$1.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H); + // that part is the same as above: + // tempMat.identity(); + // tempMat.scale(tex.width, tex.height); + // tempMat.prepend(lt); + // tempMat.scale(1.0 / ts._width, 1.0 / ts._height); + tempMat$1.invert(); + if (isSimple) { + tempMat$1.prepend(uv.mapCoord); + } + else { + shader.uniforms.uMapCoord = uv.mapCoord.toArray(true); + shader.uniforms.uClampFrame = uv.uClampFrame; + shader.uniforms.uClampOffset = uv.uClampOffset; + } + shader.uniforms.uTransform = tempMat$1.toArray(true); + shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.alphaMode); + shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true); + shader.uniforms.uSampler = tex; + renderer.shader.bind(shader); + renderer.geometry.bind(quad); + this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode); + renderer.state.set(this.state); + renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0); + }; + return TilingSpriteRenderer; + }(ObjectRenderer)); + + /*! + * @pixi/mesh - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/mesh is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$a = function(d, b) { + extendStatics$a = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$a(d, b); + }; + + function __extends$a(d, b) { + extendStatics$a(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space. + * + * @class + * @memberof PIXI + */ + var MeshBatchUvs = /** @class */ (function () { + /** + * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's + * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix + */ + function MeshBatchUvs(uvBuffer, uvMatrix) { + /** + * Buffer with normalized UV's + * @member {PIXI.Buffer} + */ + this.uvBuffer = uvBuffer; + /** + * Material UV matrix + * @member {PIXI.TextureMatrix} + */ + this.uvMatrix = uvMatrix; + /** + * UV Buffer data + * @member {Float32Array} + * @readonly + */ + this.data = null; + this._bufferUpdateId = -1; + this._textureUpdateId = -1; + this._updateID = 0; + } + /** + * updates + * + * @param {boolean} [forceUpdate] - force the update + */ + MeshBatchUvs.prototype.update = function (forceUpdate) { + if (!forceUpdate + && this._bufferUpdateId === this.uvBuffer._updateID + && this._textureUpdateId === this.uvMatrix._updateID) { + return; + } + this._bufferUpdateId = this.uvBuffer._updateID; + this._textureUpdateId = this.uvMatrix._updateID; + var data = this.uvBuffer.data; + if (!this.data || this.data.length !== data.length) { + this.data = new Float32Array(data.length); + } + this.uvMatrix.multiplyUvs(data, this.data); + this._updateID++; + }; + return MeshBatchUvs; + }()); + + var tempPoint$2 = new Point(); + var tempPolygon = new Polygon(); + /** + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. + * If you know a bit this should abstract enough away to make you life easier! + * + * Pretty much ALL WebGL can be broken down into the following: + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * + * Through a combination of the above elements you can render anything you want, 2D or 3D! + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + var Mesh = /** @class */ (function (_super) { + __extends$a(Mesh, _super); + /** + * @param {PIXI.Geometry} geometry - the geometry the mesh will use + * @param {PIXI.MeshMaterial} shader - the shader the mesh will use + * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh + * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. + * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts + */ + function Mesh(geometry, shader, state, drawMode) { + if (drawMode === void 0) { drawMode = exports.DRAW_MODES.TRIANGLES; } + var _this = _super.call(this) || this; + /** + * Includes vertex positions, face indices, normals, colors, UVs, and + * custom attributes within buffers, reducing the cost of passing all + * this data to the GPU. Can be shared between multiple Mesh objects. + * @member {PIXI.Geometry} + * @readonly + */ + _this.geometry = geometry; + geometry.refCount++; + /** + * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. + * Can be shared between multiple Mesh objects. + * @member {PIXI.Shader|PIXI.MeshMaterial} + */ + _this.shader = shader; + /** + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., + * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. + * @member {PIXI.State} + */ + _this.state = state || State.for2d(); + /** + * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants. + * + * @member {number} + * @see PIXI.DRAW_MODES + */ + _this.drawMode = drawMode; + /** + * Typically the index of the IndexBuffer where to start drawing. + * @member {number} + * @default 0 + */ + _this.start = 0; + /** + * How much of the geometry to draw, by default `0` renders everything. + * @member {number} + * @default 0 + */ + _this.size = 0; + /** + * thease are used as easy access for batching + * @member {Float32Array} + * @private + */ + _this.uvs = null; + /** + * thease are used as easy access for batching + * @member {Uint16Array} + * @private + */ + _this.indices = null; + /** + * this is the caching layer used by the batcher + * @member {Float32Array} + * @private + */ + _this.vertexData = new Float32Array(1); + /** + * If geometry is changed used to decide to re-transform + * the vertexData. + * @member {number} + * @private + */ + _this.vertexDirty = 0; + _this._transformID = -1; + /** + * Internal roundPixels field + * + * @member {boolean} + * @private + */ + _this._roundPixels = settings.ROUND_PIXELS; + /** + * Batched UV's are cached for atlas textures + * @member {PIXI.MeshBatchUvs} + * @private + */ + _this.batchUvs = null; + return _this; + } + Object.defineProperty(Mesh.prototype, "uvBuffer", { + /** + * To change mesh uv's, change its uvBuffer data and increment its _updateID. + * @member {PIXI.Buffer} + * @readonly + */ + get: function () { + return this.geometry.buffers[1]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "verticesBuffer", { + /** + * To change mesh vertices, change its uvBuffer data and increment its _updateID. + * Incrementing _updateID is optional because most of Mesh objects do it anyway. + * @member {PIXI.Buffer} + * @readonly + */ + get: function () { + return this.geometry.buffers[0]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "material", { + get: function () { + return this.shader; + }, + /** + * Alias for {@link PIXI.Mesh#shader}. + * @member {PIXI.MeshMaterial} + */ + set: function (value) { + this.shader = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "blendMode", { + get: function () { + return this.state.blendMode; + }, + /** + * The blend mode to be applied to the Mesh. Apply a value of + * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL; + * @see PIXI.BLEND_MODES + */ + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} + * + * @member {boolean} + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; + } + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "tint", { + /** + * The multiply tint applied to the Mesh. This is a hex value. A value of + * `0xFFFFFF` will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this.shader.tint; + }, + set: function (value) { + this.shader.tint = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "texture", { + /** + * The texture that the Mesh uses. + * + * @member {PIXI.Texture} + */ + get: function () { + return this.shader.texture; + }, + set: function (value) { + this.shader.texture = value; + }, + enumerable: false, + configurable: true + }); + /** + * Standard renderer draw. + * @protected + * @param {PIXI.Renderer} renderer - Instance to renderer. + */ + Mesh.prototype._render = function (renderer) { + // set properties for batching.. + // TODO could use a different way to grab verts? + var vertices = this.geometry.buffers[0].data; + // TODO benchmark check for attribute size.. + if (this.shader.batchable + && this.drawMode === exports.DRAW_MODES.TRIANGLES + && vertices.length < Mesh.BATCHABLE_SIZE * 2) { + this._renderToBatch(renderer); + } + else { + this._renderDefault(renderer); + } + }; + /** + * Standard non-batching way of rendering. + * @protected + * @param {PIXI.Renderer} renderer - Instance to renderer. + */ + Mesh.prototype._renderDefault = function (renderer) { + var shader = this.shader; + shader.alpha = this.worldAlpha; + if (shader.update) { + shader.update(); + } + renderer.batch.flush(); + if (shader.program.uniformData.translationMatrix) { + shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true); + } + // bind and sync uniforms.. + renderer.shader.bind(shader); + // set state.. + renderer.state.set(this.state); + // bind the geometry... + renderer.geometry.bind(this.geometry, shader); + // then render it + renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount); + }; + /** + * Rendering by using the Batch system. + * @protected + * @param {PIXI.Renderer} renderer - Instance to renderer. + */ + Mesh.prototype._renderToBatch = function (renderer) { + var geometry = this.geometry; + if (this.shader.uvMatrix) { + this.shader.uvMatrix.update(); + this.calculateUvs(); + } + // set properties for batching.. + this.calculateVertices(); + this.indices = geometry.indexBuffer.data; + this._tintRGB = this.shader._tintRGB; + this._texture = this.shader.texture; + var pluginName = this.material.pluginName; + renderer.batch.setObjectRenderer(renderer.plugins[pluginName]); + renderer.plugins[pluginName].render(this); + }; + /** + * Updates vertexData field based on transform and vertices + */ + Mesh.prototype.calculateVertices = function () { + var geometry = this.geometry; + var vertices = geometry.buffers[0].data; + if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) { + return; + } + this._transformID = this.transform._worldID; + if (this.vertexData.length !== vertices.length) { + this.vertexData = new Float32Array(vertices.length); + } + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + for (var i = 0; i < vertexData.length / 2; i++) { + var x = vertices[(i * 2)]; + var y = vertices[(i * 2) + 1]; + vertexData[(i * 2)] = (a * x) + (c * y) + tx; + vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty; + } + if (this._roundPixels) { + var resolution = settings.RESOLUTION; + for (var i = 0; i < vertexData.length; ++i) { + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); + } + } + this.vertexDirty = geometry.vertexDirtyId; + }; + /** + * Updates uv field based on from geometry uv's or batchUvs + */ + Mesh.prototype.calculateUvs = function () { + var geomUvs = this.geometry.buffers[1]; + if (!this.shader.uvMatrix.isSimple) { + if (!this.batchUvs) { + this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix); + } + this.batchUvs.update(); + this.uvs = this.batchUvs.data; + } + else { + this.uvs = geomUvs.data; + } + }; + /** + * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. + * + * @protected + */ + Mesh.prototype._calculateBounds = function () { + this.calculateVertices(); + this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length); + }; + /** + * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES. + * + * @param {PIXI.IPointData} point - the point to test + * @return {boolean} the result of the test + */ + Mesh.prototype.containsPoint = function (point) { + if (!this.getBounds().contains(point.x, point.y)) { + return false; + } + this.worldTransform.applyInverse(point, tempPoint$2); + var vertices = this.geometry.getBuffer('aVertexPosition').data; + var points = tempPolygon.points; + var indices = this.geometry.getIndex().data; + var len = indices.length; + var step = this.drawMode === 4 ? 3 : 1; + for (var i = 0; i + 2 < len; i += step) { + var ind0 = indices[i] * 2; + var ind1 = indices[i + 1] * 2; + var ind2 = indices[i + 2] * 2; + points[0] = vertices[ind0]; + points[1] = vertices[ind0 + 1]; + points[2] = vertices[ind1]; + points[3] = vertices[ind1 + 1]; + points[4] = vertices[ind2]; + points[5] = vertices[ind2 + 1]; + if (tempPolygon.contains(tempPoint$2.x, tempPoint$2.y)) { + return true; + } + } + return false; + }; + /** + * Destroys the Mesh object. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all + * options have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have + * their destroy method called as well. 'options' will be passed on to those calls. + */ + Mesh.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.geometry.refCount--; + if (this.geometry.refCount === 0) { + this.geometry.dispose(); + } + this.geometry = null; + this.shader = null; + this.state = null; + this.uvs = null; + this.indices = null; + this.vertexData = null; + }; + /** + * The maximum number of vertices to consider batchable. Generally, the complexity + * of the geometry. + * @memberof PIXI.Mesh + * @static + * @member {number} BATCHABLE_SIZE + */ + Mesh.BATCHABLE_SIZE = 100; + return Mesh; + }(Container)); + + var fragment$3 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"; + + var vertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"; + + /** + * Slightly opinionated default shader for PixiJS 2D objects. + * @class + * @memberof PIXI + * @extends PIXI.Shader + */ + var MeshMaterial = /** @class */ (function (_super) { + __extends$a(MeshMaterial, _super); + /** + * @param {PIXI.Texture} uSampler - Texture that material uses to render. + * @param {object} [options] - Additional options + * @param {number} [options.alpha=1] - Default alpha. + * @param {number} [options.tint=0xFFFFFF] - Default tint. + * @param {string} [options.pluginName='batch'] - Renderer plugin for batching. + * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program. + * @param {object} [options.uniforms] - Custom uniforms. + */ + function MeshMaterial(uSampler, options) { + var _this = this; + var uniforms = { + uSampler: uSampler, + alpha: 1, + uTextureMatrix: Matrix.IDENTITY, + uColor: new Float32Array([1, 1, 1, 1]), + }; + // Set defaults + options = Object.assign({ + tint: 0xFFFFFF, + alpha: 1, + pluginName: 'batch', + }, options); + if (options.uniforms) { + Object.assign(uniforms, options.uniforms); + } + _this = _super.call(this, options.program || Program.from(vertex$3, fragment$3), uniforms) || this; + /** + * Only do update if tint or alpha changes. + * @member {boolean} + * @private + * @default false + */ + _this._colorDirty = false; + /** + * TextureMatrix instance for this Mesh, used to track Texture changes + * + * @member {PIXI.TextureMatrix} + * @readonly + */ + _this.uvMatrix = new TextureMatrix(uSampler); + /** + * `true` if shader can be batch with the renderer's batch system. + * @member {boolean} + * @default true + */ + _this.batchable = options.program === undefined; + /** + * Renderer plugin for batching + * + * @member {string} + * @default 'batch' + */ + _this.pluginName = options.pluginName; + _this.tint = options.tint; + _this.alpha = options.alpha; + return _this; + } + Object.defineProperty(MeshMaterial.prototype, "texture", { + /** + * Reference to the texture being rendered. + * @member {PIXI.Texture} + */ + get: function () { + return this.uniforms.uSampler; + }, + set: function (value) { + if (this.uniforms.uSampler !== value) { + this.uniforms.uSampler = value; + this.uvMatrix.texture = value; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MeshMaterial.prototype, "alpha", { + get: function () { + return this._alpha; + }, + /** + * This gets automatically set by the object using this. + * + * @default 1 + * @member {number} + */ + set: function (value) { + if (value === this._alpha) + { return; } + this._alpha = value; + this._colorDirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MeshMaterial.prototype, "tint", { + get: function () { + return this._tint; + }, + /** + * Multiply tint for the material. + * @member {number} + * @default 0xFFFFFF + */ + set: function (value) { + if (value === this._tint) + { return; } + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + this._colorDirty = true; + }, + enumerable: false, + configurable: true + }); + /** + * Gets called automatically by the Mesh. Intended to be overridden for custom + * MeshMaterial objects. + */ + MeshMaterial.prototype.update = function () { + if (this._colorDirty) { + this._colorDirty = false; + var baseTexture = this.texture.baseTexture; + premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode); + } + if (this.uvMatrix.update()) { + this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord; + } + }; + return MeshMaterial; + }(Shader)); + + /** + * Standard 2D geometry used in PixiJS. + * + * Geometry can be defined without passing in a style or data if required. + * + * ```js + * const geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2); + * geometry.addIndex([0,1,2,1,3,2]); + * + * ``` + * @class + * @memberof PIXI + * @extends PIXI.Geometry + */ + var MeshGeometry = /** @class */ (function (_super) { + __extends$a(MeshGeometry, _super); + /** + * @param {Float32Array|number[]} [vertices] - Positional data on geometry. + * @param {Float32Array|number[]} [uvs] - Texture UVs. + * @param {Uint16Array|number[]} [index] - IndexBuffer + */ + function MeshGeometry(vertices, uvs, index) { + var _this = _super.call(this) || this; + var verticesBuffer = new Buffer(vertices); + var uvsBuffer = new Buffer(uvs, true); + var indexBuffer = new Buffer(index, true, true); + _this.addAttribute('aVertexPosition', verticesBuffer, 2, false, exports.TYPES.FLOAT) + .addAttribute('aTextureCoord', uvsBuffer, 2, false, exports.TYPES.FLOAT) + .addIndex(indexBuffer); + /** + * Dirty flag to limit update calls on Mesh. For example, + * limiting updates on a single Mesh instance with a shared Geometry + * within the render loop. + * @private + * @member {number} + * @default -1 + */ + _this._updateId = -1; + return _this; + } + Object.defineProperty(MeshGeometry.prototype, "vertexDirtyId", { + /** + * If the vertex position is updated. + * @member {number} + * @readonly + * @private + */ + get: function () { + return this.buffers[0]._updateID; + }, + enumerable: false, + configurable: true + }); + return MeshGeometry; + }(Geometry)); + + /*! + * @pixi/text-bitmap - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/text-bitmap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$b = function(d, b) { + extendStatics$b = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$b(d, b); + }; + + function __extends$b(d, b) { + extendStatics$b(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /* eslint-disable max-len */ + /** + * Normalized parsed data from .fnt files. + * + * @class + * @memberof PIXI + */ + var BitmapFontData = /** @class */ (function () { + function BitmapFontData() { + /** + * @member {PIXI.IBitmapFontDataInfo[]} + * @readOnly + */ + this.info = []; + /** + * @member {PIXI.IBitmapFontDataCommon[]} + * @readOnly + */ + this.common = []; + /** + * @member {PIXI.IBitmapFontDataPage[]} + * @readOnly + */ + this.page = []; + /** + * @member {PIXI.IBitmapFontDataChar[]} + * @readOnly + */ + this.char = []; + /** + * @member {PIXI.IBitmapFontDataKerning[]} + * @readOnly + */ + this.kerning = []; + } + return BitmapFontData; + }()); + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataInfo + * @property {string} face + * @property {number} size + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataCommon + * @property {number} lineHeight + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataPage + * @property {number} id + * @property {string} file + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataChar + * @property {string} id + * @property {number} page + * @property {number} x + * @property {number} y + * @property {number} width + * @property {number} height + * @property {number} xoffset + * @property {number} yoffset + * @property {number} xadvance + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataKerning + * @property {number} first + * @property {number} second + * @property {number} amount + */ + + /** + * BitmapFont format that's Text-based. + * + * @class + * @private + */ + var TextFormat = /** @class */ (function () { + function TextFormat() { + } + /** + * Check if resource refers to txt font data. + * + * @static + * @private + * @param {any} data + * @return {boolean} True if resource could be treated as font data, false otherwise. + */ + TextFormat.test = function (data) { + return typeof data === 'string' && data.indexOf('info face=') === 0; + }; + /** + * Convert text font data to a javascript object. + * + * @static + * @private + * @param {string} txt - Raw string data to be converted + * @return {PIXI.BitmapFontData} Parsed font data + */ + TextFormat.parse = function (txt) { + // Retrieve data item + var items = txt.match(/^[a-z]+\s+.+$/gm); + var rawData = { + info: [], + common: [], + page: [], + char: [], + chars: [], + kerning: [], + kernings: [], + }; + for (var i in items) { + // Extract item name + var name = items[i].match(/^[a-z]+/gm)[0]; + // Extract item attribute list as string ex.: "width=10" + var attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm); + // Convert attribute list into an object + var itemData = {}; + for (var i_1 in attributeList) { + // Split key-value pairs + var split = attributeList[i_1].split('='); + var key = split[0]; + // Remove eventual quotes from value + var strValue = split[1].replace(/"/gm, ''); + // Try to convert value into float + var floatValue = parseFloat(strValue); + // Use string value case float value is NaN + var value = isNaN(floatValue) ? strValue : floatValue; + itemData[key] = value; + } + // Push current item to the resulting data + rawData[name].push(itemData); + } + var font = new BitmapFontData(); + rawData.info.forEach(function (info) { return font.info.push({ + face: info.face, + size: parseInt(info.size, 10), + }); }); + rawData.common.forEach(function (common) { return font.common.push({ + lineHeight: parseInt(common.lineHeight, 10), + }); }); + rawData.page.forEach(function (page) { return font.page.push({ + id: parseInt(page.id, 10), + file: page.file, + }); }); + rawData.char.forEach(function (char) { return font.char.push({ + id: parseInt(char.id, 10), + page: parseInt(char.page, 10), + x: parseInt(char.x, 10), + y: parseInt(char.y, 10), + width: parseInt(char.width, 10), + height: parseInt(char.height, 10), + xoffset: parseInt(char.xoffset, 10), + yoffset: parseInt(char.yoffset, 10), + xadvance: parseInt(char.xadvance, 10), + }); }); + rawData.kerning.forEach(function (kerning) { return font.kerning.push({ + first: parseInt(kerning.first, 10), + second: parseInt(kerning.second, 10), + amount: parseInt(kerning.amount, 10), + }); }); + return font; + }; + return TextFormat; + }()); + + /** + * BitmapFont format that's XML-based. + * + * @class + * @private + */ + var XMLFormat = /** @class */ (function () { + function XMLFormat() { + } + /** + * Check if resource refers to xml font data. + * + * @static + * @private + * @param {any} data + * @return {boolean} True if resource could be treated as font data, false otherwise. + */ + XMLFormat.test = function (data) { + return data instanceof XMLDocument + && data.getElementsByTagName('page').length + && data.getElementsByTagName('info')[0].getAttribute('face') !== null; + }; + /** + * Convert the XML into BitmapFontData that we can use. + * + * @static + * @private + * @param {XMLDocument} xml + * @return {BitmapFontData} Data to use for BitmapFont + */ + XMLFormat.parse = function (xml) { + var data = new BitmapFontData(); + var info = xml.getElementsByTagName('info'); + var common = xml.getElementsByTagName('common'); + var page = xml.getElementsByTagName('page'); + var char = xml.getElementsByTagName('char'); + var kerning = xml.getElementsByTagName('kerning'); + for (var i = 0; i < info.length; i++) { + data.info.push({ + face: info[i].getAttribute('face'), + size: parseInt(info[i].getAttribute('size'), 10), + }); + } + for (var i = 0; i < common.length; i++) { + data.common.push({ + lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10), + }); + } + for (var i = 0; i < page.length; i++) { + data.page.push({ + id: parseInt(page[i].getAttribute('id'), 10) || 0, + file: page[i].getAttribute('file'), + }); + } + for (var i = 0; i < char.length; i++) { + var letter = char[i]; + data.char.push({ + id: parseInt(letter.getAttribute('id'), 10), + page: parseInt(letter.getAttribute('page'), 10) || 0, + x: parseInt(letter.getAttribute('x'), 10), + y: parseInt(letter.getAttribute('y'), 10), + width: parseInt(letter.getAttribute('width'), 10), + height: parseInt(letter.getAttribute('height'), 10), + xoffset: parseInt(letter.getAttribute('xoffset'), 10), + yoffset: parseInt(letter.getAttribute('yoffset'), 10), + xadvance: parseInt(letter.getAttribute('xadvance'), 10), + }); + } + for (var i = 0; i < kerning.length; i++) { + data.kerning.push({ + first: parseInt(kerning[i].getAttribute('first'), 10), + second: parseInt(kerning[i].getAttribute('second'), 10), + amount: parseInt(kerning[i].getAttribute('amount'), 10), + }); + } + return data; + }; + return XMLFormat; + }()); + + /** + * BitmapFont format that's XML-based. + * + * @class + * @private + */ + var XMLStringFormat = /** @class */ (function () { + function XMLStringFormat() { + } + /** + * Check if resource refers to text xml font data. + * + * @static + * @private + * @param {any} data + * @return {boolean} True if resource could be treated as font data, false otherwise. + */ + XMLStringFormat.test = function (data) { + if (typeof data === 'string' && data.indexOf('') > -1) { + var xml = new self.DOMParser().parseFromString(data, 'text/xml'); + return XMLFormat.test(xml); + } + return false; + }; + /** + * Convert the text XML into BitmapFontData that we can use. + * + * @static + * @private + * @param {string} xmlTxt + * @return {BitmapFontData} Data to use for BitmapFont + */ + XMLStringFormat.parse = function (xmlTxt) { + var xml = new window.DOMParser().parseFromString(xmlTxt, 'text/xml'); + return XMLFormat.parse(xml); + }; + return XMLStringFormat; + }()); + + // Registered formats, maybe make this extensible in the future? + var formats = [ + TextFormat, + XMLFormat, + XMLStringFormat ]; + /** + * Auto-detect BitmapFont parsing format based on data. + * @private + * @param {any} data - Data to detect format + * @return {any} Format or null + */ + function autoDetectFormat(data) { + for (var i = 0; i < formats.length; i++) { + if (formats[i].test(data)) { + return formats[i]; + } + } + return null; + } + + // TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle + /** + * Generates the fill style. Can automatically generate a gradient based on the fill style being an array + * + * @private + * @param {object} style - The style. + * @param {string[]} lines - The lines of text. + * @return {string|number|CanvasGradient} The fill style + */ + function generateFillStyle(canvas, context, style, resolution, lines, metrics) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + var fillStyle = style.fill; + if (!Array.isArray(fillStyle)) { + return fillStyle; + } + else if (fillStyle.length === 1) { + return fillStyle[0]; + } + // the gradient will be evenly spaced out according to how large the array is. + // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 + var gradient; + // a dropshadow will enlarge the canvas and result in the gradient being + // generated with the incorrect dimensions + var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; + // should also take padding into account, padding can offset the gradient + var padding = style.padding || 0; + var width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2); + var height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2); + // make a copy of the style settings, so we can manipulate them later + var fill = fillStyle.slice(); + var fillGradientStops = style.fillGradientStops.slice(); + // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 + if (!fillGradientStops.length) { + var lengthPlus1 = fill.length + 1; + for (var i = 1; i < lengthPlus1; ++i) { + fillGradientStops.push(i / lengthPlus1); + } + } + // stop the bleeding of the last gradient on the line above to the top gradient of the this line + // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 + fill.unshift(fillStyle[0]); + fillGradientStops.unshift(0); + fill.push(fillStyle[fillStyle.length - 1]); + fillGradientStops.push(1); + if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { + // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas + gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding); + // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect + // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 + // There's potential for floating point precision issues at the seams between gradient repeats. + // The loop below generates the stops in order, so track the last generated one to prevent + // floating point precision from making us go the teeniest bit backwards, resulting in + // the first and last colors getting swapped. + var lastIterationStop = 0; + // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc + var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; + // textHeight, but as a 0-1 size in global gradient stop space + var gradStopLineHeight = textHeight / height; + for (var i = 0; i < lines.length; i++) { + var thisLineTop = metrics.lineHeight * i; + for (var j = 0; j < fill.length; j++) { + // 0-1 stop point for the current line, multiplied to global space afterwards + var lineStop = 0; + if (typeof fillGradientStops[j] === 'number') { + lineStop = fillGradientStops[j]; + } + else { + lineStop = j / fill.length; + } + var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); + // Prevent color stop generation going backwards from floating point imprecision + var clampedStop = Math.max(lastIterationStop, globalStop); + clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. + gradient.addColorStop(clampedStop, fill[j]); + lastIterationStop = clampedStop; + } + } + } + else { + // start the gradient at the center left of the canvas, and end at the center right of the canvas + gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2); + // can just evenly space out the gradients in this case, as multiple lines makes no difference + // to an even left to right gradient + var totalIterations = fill.length + 1; + var currentIteration = 1; + for (var i = 0; i < fill.length; i++) { + var stop = void 0; + if (typeof fillGradientStops[i] === 'number') { + stop = fillGradientStops[i]; + } + else { + stop = currentIteration / totalIterations; + } + gradient.addColorStop(stop, fill[i]); + currentIteration++; + } + } + return gradient; + } + + // TODO: Prevent code duplication b/w drawGlyph & Text#updateText + /** + * Draws the glyph `metrics.text` on the given canvas. + * + * Ignored because not directly exposed. + * + * @ignore + * @param {HTMLCanvasElement} canvas + * @param {CanvasRenderingContext2D} context + * @param {TextMetrics} metrics + * @param {number} x + * @param {number} y + * @param {number} resolution + * @param {TextStyle} style + */ + function drawGlyph(canvas, context, metrics, x, y, resolution, style) { + var char = metrics.text; + var fontProperties = metrics.fontProperties; + context.translate(x, y); + context.scale(resolution, resolution); + var tx = style.strokeThickness / 2; + var ty = -(style.strokeThickness / 2); + context.font = style.toFontString(); + context.lineWidth = style.strokeThickness; + context.textBaseline = style.textBaseline; + context.lineJoin = style.lineJoin; + context.miterLimit = style.miterLimit; + // set canvas text styles + context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); + context.strokeStyle = style.stroke; + if (style.dropShadow) { + var dropShadowColor = style.dropShadowColor; + var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); + var dropShadowBlur = style.dropShadowBlur * resolution; + var dropShadowDistance = style.dropShadowDistance * resolution; + context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; + context.shadowBlur = dropShadowBlur; + context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance; + context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance; + } + else { + context.shadowColor = 'black'; + context.shadowBlur = 0; + context.shadowOffsetX = 0; + context.shadowOffsetY = 0; + } + if (style.stroke && style.strokeThickness) { + context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent); + } + if (style.fill) { + context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent); + } + context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29) + context.fillStyle = 'rgba(0, 0, 0, 0)'; + } + + /** + * Processes the passed character set data and returns a flattened array of all the characters. + * + * Ignored because not directly exposed. + * + * @ignore + * @param {string | string[] | string[][] } chars + * @returns {string[]} + */ + function resolveCharacters(chars) { + // Split the chars string into individual characters + if (typeof chars === 'string') { + chars = [chars]; + } + // Handle an array of characters+ranges + var result = []; + for (var i = 0, j = chars.length; i < j; i++) { + var item = chars[i]; + // Handle range delimited by start/end chars + if (Array.isArray(item)) { + if (item.length !== 2) { + throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got " + item.length + "."); + } + var startCode = item[0].charCodeAt(0); + var endCode = item[1].charCodeAt(0); + if (endCode < startCode) { + throw new Error('[BitmapFont]: Invalid character range.'); + } + for (var i_1 = startCode, j_1 = endCode; i_1 <= j_1; i_1++) { + result.push(String.fromCharCode(i_1)); + } + } + // Handle a character set string + else { + result.push.apply(result, item.split('')); + } + } + if (result.length === 0) { + throw new Error('[BitmapFont]: Empty set when resolving characters.'); + } + return result; + } + + /** + * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install` + * method for adding a font to be used. + * + * @class + * @memberof PIXI + */ + var BitmapFont = /** @class */ (function () { + /** + * @param {PIXI.BitmapFontData} data + * @param {PIXI.Texture[]|Object.} textures + * @param {boolean} [ownsTextures] - Setting to `true` will destroy page textures + * when the font is uninstalled. + */ + function BitmapFont(data, textures, ownsTextures) { + var info = data.info[0]; + var common = data.common[0]; + var page = data.page[0]; + var res = getResolutionOfUrl(page.file); + var pageTextures = {}; + this._ownsTextures = ownsTextures; + /** + * The name of the font face. + * + * @member {string} + * @readonly + */ + this.font = info.face; + /** + * The size of the font face in pixels. + * + * @member {number} + * @readonly + */ + this.size = info.size; + /** + * The line-height of the font face in pixels. + * + * @member {number} + * @readonly + */ + this.lineHeight = common.lineHeight / res; + /** + * The map of characters by character code. + * + * @member {object} + * @readonly + */ + this.chars = {}; + /** + * The map of base page textures (i.e., sheets of glyphs). + * + * @member {object} + * @readonly + * @private + */ + this.pageTextures = pageTextures; + // Convert the input Texture, Textures or object + // into a page Texture lookup by "id" + for (var i = 0; i < data.page.length; i++) { + var _a = data.page[i], id = _a.id, file = _a.file; + pageTextures[id] = textures instanceof Array + ? textures[i] : textures[file]; + } + // parse letters + for (var i = 0; i < data.char.length; i++) { + var _b = data.char[i], id = _b.id, page_1 = _b.page; + var _c = data.char[i], x = _c.x, y = _c.y, width = _c.width, height = _c.height, xoffset = _c.xoffset, yoffset = _c.yoffset, xadvance = _c.xadvance; + x /= res; + y /= res; + width /= res; + height /= res; + xoffset /= res; + yoffset /= res; + xadvance /= res; + var rect = new Rectangle(x + (pageTextures[page_1].frame.x / res), y + (pageTextures[page_1].frame.y / res), width, height); + this.chars[id] = { + xOffset: xoffset, + yOffset: yoffset, + xAdvance: xadvance, + kerning: {}, + texture: new Texture(pageTextures[page_1].baseTexture, rect), + page: page_1, + }; + } + // parse kernings + for (var i = 0; i < data.kerning.length; i++) { + var _d = data.kerning[i], first = _d.first, second = _d.second, amount = _d.amount; + first /= res; + second /= res; + amount /= res; + if (this.chars[second]) { + this.chars[second].kerning[first] = amount; + } + } + } + /** + * Remove references to created glyph textures. + */ + BitmapFont.prototype.destroy = function () { + for (var id in this.chars) { + this.chars[id].texture.destroy(); + this.chars[id].texture = null; + } + for (var id in this.pageTextures) { + if (this._ownsTextures) { + this.pageTextures[id].destroy(true); + } + this.pageTextures[id] = null; + } + // Set readonly null. + this.chars = null; + this.pageTextures = null; + }; + /** + * Register a new bitmap font. + * + * @static + * @param {XMLDocument|string|PIXI.BitmapFontData} data - The + * characters map that could be provided as xml or raw string. + * @param {Object.|PIXI.Texture|PIXI.Texture[]} + * textures - List of textures for each page. + * @param {boolean} managedTexture - Set to `true` to destroy page textures + * when the font is uninstalled. By default fonts created with + * `BitmapFont.from` or from the `BitmapFontLoader` are `true`. + * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight + * and char fields. + */ + BitmapFont.install = function (data, textures, ownsTextures) { + var fontData; + if (data instanceof BitmapFontData) { + fontData = data; + } + else { + var format = autoDetectFormat(data); + if (!format) { + throw new Error('Unrecognized data format for font.'); + } + fontData = format.parse(data); + } + // Single texture, convert to list + if (textures instanceof Texture) { + textures = [textures]; + } + var font = new BitmapFont(fontData, textures, ownsTextures); + BitmapFont.available[font.font] = font; + return font; + }; + /** + * Remove bitmap font by name. + * + * @static + * @param {string} name - Name of the font to uninstall. + */ + BitmapFont.uninstall = function (name) { + var font = BitmapFont.available[name]; + if (!font) { + throw new Error("No font found named '" + name + "'"); + } + font.destroy(); + delete BitmapFont.available[name]; + }; + /** + * Generates a bitmap-font for the given style and character set. This does not support + * kernings yet. With `style` properties, only the following non-layout properties are used: + * + * - {@link PIXI.TextStyle#dropShadow|dropShadow} + * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance} + * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor} + * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur} + * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle} + * - {@link PIXI.TextStyle#fill|fill} + * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops} + * - {@link PIXI.TextStyle#fillGradientType|fillGradientType} + * - {@link PIXI.TextStyle#fontFamily|fontFamily} + * - {@link PIXI.TextStyle#fontSize|fontSize} + * - {@link PIXI.TextStyle#fontVariant|fontVariant} + * - {@link PIXI.TextStyle#fontWeight|fontWeight} + * - {@link PIXI.TextStyle#lineJoin|lineJoin} + * - {@link PIXI.TextStyle#miterLimit|miterLimit} + * - {@link PIXI.TextStyle#stroke|stroke} + * - {@link PIXI.TextStyle#strokeThickness|strokeThickness} + * - {@link PIXI.TextStyle#textBaseline|textBaseline} + * + * @param {string} name - The name of the custom font to use with BitmapText. + * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont. + * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font. + * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included + * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], "!@#$%^&*()~{}[] "]`. + * Don't forget to include spaces ' ' in your character set! + * @param {number} [options.resolution=1] - Render resolution for glyphs. + * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory. + * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory. + * @param {number} [options.padding=4] - Padding between glyphs on texture atlas. + * @return {PIXI.BitmapFont} Font generated by style options. + * @static + * @example + * PIXI.BitmapFont.from("TitleFont", { + * fontFamily: "Arial", + * fontSize: 12, + * strokeThickness: 2, + * fill: "purple" + * }); + * + * const title = new PIXI.BitmapText("This is the title", { fontName: "TitleFont" }); + */ + BitmapFont.from = function (name, textStyle, options) { + if (!name) { + throw new Error('[BitmapFont] Property `name` is required.'); + } + var _a = Object.assign({}, BitmapFont.defaultOptions, options), chars = _a.chars, padding = _a.padding, resolution = _a.resolution, textureWidth = _a.textureWidth, textureHeight = _a.textureHeight; + var charsList = resolveCharacters(chars); + var style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle); + var lineWidth = textureWidth; + var fontData = new BitmapFontData(); + fontData.info[0] = { + face: style.fontFamily, + size: style.fontSize, + }; + fontData.common[0] = { + lineHeight: style.fontSize, + }; + var positionX = 0; + var positionY = 0; + var canvas; + var context; + var baseTexture; + var maxCharHeight = 0; + var textures = []; + for (var i = 0; i < charsList.length; i++) { + if (!canvas) { + canvas = document.createElement('canvas'); + canvas.width = textureWidth; + canvas.height = textureHeight; + context = canvas.getContext('2d'); + baseTexture = new BaseTexture(canvas, { resolution: resolution }); + textures.push(new Texture(baseTexture)); + fontData.page.push({ + id: textures.length - 1, + file: '', + }); + } + // Measure glyph dimensions + var metrics = TextMetrics.measureText(charsList[i], style, false, canvas); + var width = metrics.width; + var height = Math.ceil(metrics.height); + // This is ugly - but italics are given more space so they don't overlap + var textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width); + // Can't fit char anymore: next canvas please! + if (positionY >= textureHeight - (height * resolution)) { + if (positionY === 0) { + // We don't want user debugging an infinite loop (or do we? :) + throw new Error("[BitmapFont] textureHeight " + textureHeight + "px is " + + ("too small for " + style.fontSize + "px fonts")); + } + --i; + // Create new atlas once current has filled up + canvas = null; + context = null; + baseTexture = null; + positionY = 0; + positionX = 0; + maxCharHeight = 0; + continue; + } + maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight); + // Wrap line once full row has been rendered + if ((textureGlyphWidth * resolution) + positionX >= lineWidth) { + --i; + positionY += maxCharHeight * resolution; + positionY = Math.ceil(positionY); + positionX = 0; + maxCharHeight = 0; + continue; + } + drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style); + // Unique (numeric) ID mapping to this glyph + var id = metrics.text.charCodeAt(0); + // Create a texture holding just the glyph + fontData.char.push({ + id: id, + page: textures.length - 1, + x: positionX / resolution, + y: positionY / resolution, + width: textureGlyphWidth, + height: height, + xoffset: 0, + yoffset: 0, + xadvance: Math.ceil(width + - (style.dropShadow ? style.dropShadowDistance : 0) + - (style.stroke ? style.strokeThickness : 0)), + }); + positionX += (textureGlyphWidth + (2 * padding)) * resolution; + positionX = Math.ceil(positionX); + } + var font = new BitmapFont(fontData, textures, true); + // Make it easier to replace a font + if (BitmapFont.available[name] !== undefined) { + BitmapFont.uninstall(name); + } + BitmapFont.available[name] = font; + return font; + }; + /** + * This character set includes all the letters in the alphabet (both lower- and upper- case). + * @readonly + * @static + * @member {string[][]} + * @example + * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.ALPHA }) + */ + BitmapFont.ALPHA = [['a', 'z'], ['A', 'Z'], ' ']; + /** + * This character set includes all decimal digits (from 0 to 9). + * @readonly + * @static + * @member {string[][]} + * @example + * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.NUMERIC }) + */ + BitmapFont.NUMERIC = [['0', '9']]; + /** + * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`. + * @readonly + * @static + * @member {string[][]} + */ + BitmapFont.ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' ']; + /** + * This character set consists of all the ASCII table. + * @readonly + * @static + * @member {string[][]} + * @see http://www.asciitable.com/ + */ + BitmapFont.ASCII = [[' ', '~']]; + /** + * Collection of default options when using `BitmapFont.from`. + * + * @readonly + * @static + * @member {PIXI.IBitmapFontOptions} + * @property {number} resolution=1 + * @property {number} textureWidth=512 + * @property {number} textureHeight=512 + * @property {number} padding=4 + * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC + */ + BitmapFont.defaultOptions = { + resolution: 1, + textureWidth: 512, + textureHeight: 512, + padding: 4, + chars: BitmapFont.ALPHANUMERIC, + }; + /** + * Collection of available/installed fonts. + * + * @readonly + * @static + * @member {Object.} + */ + BitmapFont.available = {}; + return BitmapFont; + }()); + /** + * @memberof PIXI + * @interface IBitmapFontOptions + * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate + * @property {number} [resolution=1] - the resolution for rendering + * @property {number} [padding=4] - the padding between glyphs in the atlas + * @property {number} [textureWidth=512] - the width of the texture atlas + * @property {number} [textureHeight=512] - the height of the texture atlas + */ + + var pageMeshDataPool = []; + var charRenderDataPool = []; + /** + * A BitmapText object will create a line or multiple lines of text using bitmap font. + * + * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, + * meaning that rendering is fast, and changing text has no performance implications. + * + * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. + * + * To split a line you can use '\n', '\r' or '\r\n' in your string. + * + * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by: + * http://www.angelcode.com/products/bmfont/ for Windows or + * http://www.bmglyph.com/ for Mac. + * + * A BitmapText can only be created when the font is loaded. + * + * ```js + * // in this case the font is in a file called 'desyrel.fnt' + * let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "35px Desyrel", align: "right"}); + * ``` + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + var BitmapText = /** @class */ (function (_super) { + __extends$b(BitmapText, _super); + /** + * @param {string} text - A string that you would like the text to display. + * @param {object} style - The style parameters. + * @param {string} style.fontName - The installed BitmapFont name. + * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined, + *. this will default to the BitmapFont size. + * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), + * does not affect single line text. + * @param {number} [style.tint=0xFFFFFF] - The tint color. + * @param {number} [style.letterSpacing=0] - The amount of spacing between letters. + * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping. + */ + function BitmapText(text, style) { + if (style === void 0) { style = {}; } + var _this = _super.call(this) || this; + _this._tint = 0xFFFFFF; + if (style.font) { + deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.'); + _this._upgradeStyle(style); + } + // Apply the defaults + var _a = Object.assign({}, BitmapText.styleDefaults, style), align = _a.align, tint = _a.tint, maxWidth = _a.maxWidth, letterSpacing = _a.letterSpacing, fontName = _a.fontName, fontSize = _a.fontSize; + if (!BitmapFont.available[fontName]) { + throw new Error("Missing BitmapFont \"" + fontName + "\""); + } + /** + * Collection of page mesh data. + * + * @member {object} + * @private + */ + _this._activePagesMeshData = []; + /** + * Private tracker for the width of the overall text + * + * @member {number} + * @private + */ + _this._textWidth = 0; + /** + * Private tracker for the height of the overall text + * + * @member {number} + * @private + */ + _this._textHeight = 0; + /** + * Private tracker for the current text align. + * + * @member {string} + * @private + */ + _this._align = align; + /** + * Private tracker for the current tint. + * + * @member {number} + * @private + */ + _this._tint = tint; + /** + * Private tracker for the current font name. + * + * @member {string} + * @private + */ + _this._fontName = fontName; + /** + * Private tracker for the current font size. + * + * @member {number} + * @private + */ + _this._fontSize = fontSize || BitmapFont.available[fontName].size; + /** + * Private tracker for the current text. + * + * @member {string} + * @private + */ + _this._text = text; + /** + * The max width of this bitmap text in pixels. If the text provided is longer than the + * value provided, line breaks will be automatically inserted in the last whitespace. + * Disable by setting value to 0 + * + * @member {number} + * @private + */ + _this._maxWidth = maxWidth; + /** + * The max line height. This is useful when trying to use the total height of the Text, + * ie: when trying to vertically align. (Internally used) + * + * @member {number} + * @private + */ + _this._maxLineHeight = 0; + /** + * Letter spacing. This is useful for setting the space between characters. + * @member {number} + * @private + */ + _this._letterSpacing = letterSpacing; + /** + * Text anchor. read-only + * + * @member {PIXI.ObservablePoint} + * @private + */ + _this._anchor = new ObservablePoint(function () { _this.dirty = true; }, _this, 0, 0); + /** + * If true PixiJS will Math.floor() x/y values when rendering + * + * @member {boolean} + * @default PIXI.settings.ROUND_PIXELS + */ + _this._roundPixels = settings.ROUND_PIXELS; + /** + * Set to `true` if the BitmapText needs to be redrawn. + * + * @member {boolean} + */ + _this.dirty = true; + /** + * Cached char texture is destroyed when BitmapText is destroyed + * @member {Record} + * @private + */ + _this._textureCache = {}; + return _this; + } + /** + * Renders text and updates it when needed. This should only be called + * if the BitmapFont is regenerated. + */ + BitmapText.prototype.updateText = function () { + var _a; + var data = BitmapFont.available[this._fontName]; + var scale = this._fontSize / data.size; + var pos = new Point(); + var chars = []; + var lineWidths = []; + var text = this._text.replace(/(?:\r\n|\r)/g, '\n') || ' '; + var textLength = text.length; + var maxWidth = this._maxWidth * data.size / this._fontSize; + var prevCharCode = null; + var lastLineWidth = 0; + var maxLineWidth = 0; + var line = 0; + var lastBreakPos = -1; + var lastBreakWidth = 0; + var spacesRemoved = 0; + var maxLineHeight = 0; + for (var i = 0; i < textLength; i++) { + var charCode = text.charCodeAt(i); + var char = text.charAt(i); + if ((/(?:\s)/).test(char)) { + lastBreakPos = i; + lastBreakWidth = lastLineWidth; + } + if (char === '\r' || char === '\n') { + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); + ++line; + ++spacesRemoved; + pos.x = 0; + pos.y += data.lineHeight; + prevCharCode = null; + continue; + } + var charData = data.chars[charCode]; + if (!charData) { + continue; + } + if (prevCharCode && charData.kerning[prevCharCode]) { + pos.x += charData.kerning[prevCharCode]; + } + var charRenderData = charRenderDataPool.pop() || { + texture: Texture.EMPTY, + line: 0, + charCode: 0, + position: new Point(), + }; + charRenderData.texture = charData.texture; + charRenderData.line = line; + charRenderData.charCode = charCode; + charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2); + charRenderData.position.y = pos.y + charData.yOffset; + chars.push(charRenderData); + pos.x += charData.xAdvance + this._letterSpacing; + lastLineWidth = pos.x; + maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height)); + prevCharCode = charCode; + if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) { + ++spacesRemoved; + removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos); + i = lastBreakPos; + lastBreakPos = -1; + lineWidths.push(lastBreakWidth); + maxLineWidth = Math.max(maxLineWidth, lastBreakWidth); + line++; + pos.x = 0; + pos.y += data.lineHeight; + prevCharCode = null; + } + } + var lastChar = text.charAt(text.length - 1); + if (lastChar !== '\r' && lastChar !== '\n') { + if ((/(?:\s)/).test(lastChar)) { + lastLineWidth = lastBreakWidth; + } + lineWidths.push(lastLineWidth); + maxLineWidth = Math.max(maxLineWidth, lastLineWidth); + } + var lineAlignOffsets = []; + for (var i = 0; i <= line; i++) { + var alignOffset = 0; + if (this._align === 'right') { + alignOffset = maxLineWidth - lineWidths[i]; + } + else if (this._align === 'center') { + alignOffset = (maxLineWidth - lineWidths[i]) / 2; + } + lineAlignOffsets.push(alignOffset); + } + var lenChars = chars.length; + var pagesMeshData = {}; + var newPagesMeshData = []; + var activePagesMeshData = this._activePagesMeshData; + for (var i = 0; i < activePagesMeshData.length; i++) { + pageMeshDataPool.push(activePagesMeshData[i]); + } + for (var i = 0; i < lenChars; i++) { + var texture = chars[i].texture; + var baseTextureUid = texture.baseTexture.uid; + if (!pagesMeshData[baseTextureUid]) { + var pageMeshData = pageMeshDataPool.pop(); + if (!pageMeshData) { + var geometry = new MeshGeometry(); + var material = new MeshMaterial(Texture.EMPTY); + var mesh = new Mesh(geometry, material); + pageMeshData = { + index: 0, + indexCount: 0, + vertexCount: 0, + uvsCount: 0, + total: 0, + mesh: mesh, + vertices: null, + uvs: null, + indices: null, + }; + } + // reset data.. + pageMeshData.index = 0; + pageMeshData.indexCount = 0; + pageMeshData.vertexCount = 0; + pageMeshData.uvsCount = 0; + pageMeshData.total = 0; + // TODO need to get page texture here somehow.. + var _textureCache = this._textureCache; + _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture); + pageMeshData.mesh.texture = _textureCache[baseTextureUid]; + pageMeshData.mesh.tint = this._tint; + newPagesMeshData.push(pageMeshData); + pagesMeshData[baseTextureUid] = pageMeshData; + } + pagesMeshData[baseTextureUid].total++; + } + // lets find any previously active pageMeshDatas that are no longer required for + // the updated text (if any), removed and return them to the pool. + for (var i = 0; i < activePagesMeshData.length; i++) { + if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1) { + this.removeChild(activePagesMeshData[i].mesh); + } + } + // next lets add any new meshes, that have not yet been added to this BitmapText + // we only add if its not already a child of this BitmapObject + for (var i = 0; i < newPagesMeshData.length; i++) { + if (newPagesMeshData[i].mesh.parent !== this) { + this.addChild(newPagesMeshData[i].mesh); + } + } + // active page mesh datas are set to be the new pages added. + this._activePagesMeshData = newPagesMeshData; + for (var i in pagesMeshData) { + var pageMeshData = pagesMeshData[i]; + var total = pageMeshData.total; + // lets only allocate new buffers if we can fit the new text in the current ones.. + // unless that is, we will be batching. Currently batching dose not respect the size property of mesh + if (!(((_a = pageMeshData.indices) === null || _a === void 0 ? void 0 : _a.length) > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2) { + pageMeshData.vertices = new Float32Array(4 * 2 * total); + pageMeshData.uvs = new Float32Array(4 * 2 * total); + pageMeshData.indices = new Uint16Array(6 * total); + } + else { + var total_1 = pageMeshData.total; + var vertices = pageMeshData.vertices; + // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation. + for (var i_1 = total_1 * 4 * 2; i_1 < vertices.length; i_1++) { + vertices[i_1] = 0; + } + } + // as a buffer maybe bigger than the current word, we set the size of the meshMaterial + // to match the number of letters needed + pageMeshData.mesh.size = 6 * total; + } + for (var i = 0; i < lenChars; i++) { + var char = chars[i]; + var offset = char.position.x + lineAlignOffsets[char.line]; + if (this._roundPixels) { + offset = Math.round(offset); + } + var xPos = offset * scale; + var yPos = char.position.y * scale; + var texture = char.texture; + var pageMesh = pagesMeshData[texture.baseTexture.uid]; + var textureFrame = texture.frame; + var textureUvs = texture._uvs; + var index = pageMesh.index++; + pageMesh.indices[(index * 6) + 0] = 0 + (index * 4); + pageMesh.indices[(index * 6) + 1] = 1 + (index * 4); + pageMesh.indices[(index * 6) + 2] = 2 + (index * 4); + pageMesh.indices[(index * 6) + 3] = 0 + (index * 4); + pageMesh.indices[(index * 6) + 4] = 2 + (index * 4); + pageMesh.indices[(index * 6) + 5] = 3 + (index * 4); + pageMesh.vertices[(index * 8) + 0] = xPos; + pageMesh.vertices[(index * 8) + 1] = yPos; + pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale); + pageMesh.vertices[(index * 8) + 3] = yPos; + pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale); + pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale); + pageMesh.vertices[(index * 8) + 6] = xPos; + pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale); + pageMesh.uvs[(index * 8) + 0] = textureUvs.x0; + pageMesh.uvs[(index * 8) + 1] = textureUvs.y0; + pageMesh.uvs[(index * 8) + 2] = textureUvs.x1; + pageMesh.uvs[(index * 8) + 3] = textureUvs.y1; + pageMesh.uvs[(index * 8) + 4] = textureUvs.x2; + pageMesh.uvs[(index * 8) + 5] = textureUvs.y2; + pageMesh.uvs[(index * 8) + 6] = textureUvs.x3; + pageMesh.uvs[(index * 8) + 7] = textureUvs.y3; + } + this._textWidth = maxLineWidth * scale; + this._textHeight = (pos.y + data.lineHeight) * scale; + for (var i in pagesMeshData) { + var pageMeshData = pagesMeshData[i]; + // apply anchor + if (this.anchor.x !== 0 || this.anchor.y !== 0) { + var vertexCount = 0; + var anchorOffsetX = this._textWidth * this.anchor.x; + var anchorOffsetY = this._textHeight * this.anchor.y; + for (var i_2 = 0; i_2 < pageMeshData.total; i_2++) { + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + } + } + this._maxLineHeight = maxLineHeight * scale; + var vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition'); + var textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord'); + var indexBuffer = pageMeshData.mesh.geometry.getIndex(); + vertexBuffer.data = pageMeshData.vertices; + textureBuffer.data = pageMeshData.uvs; + indexBuffer.data = pageMeshData.indices; + vertexBuffer.update(); + textureBuffer.update(); + indexBuffer.update(); + } + for (var i = 0; i < chars.length; i++) { + charRenderDataPool.push(chars[i]); + } + }; + /** + * Updates the transform of this object + * + * @private + */ + BitmapText.prototype.updateTransform = function () { + this.validate(); + this.containerUpdateTransform(); + }; + /** + * Validates text before calling parent's getLocalBounds + * + * @return {PIXI.Rectangle} The rectangular bounding area + */ + BitmapText.prototype.getLocalBounds = function () { + this.validate(); + return _super.prototype.getLocalBounds.call(this); + }; + /** + * Updates text when needed + * + * @private + */ + BitmapText.prototype.validate = function () { + if (this.dirty) { + this.updateText(); + this.dirty = false; + } + }; + Object.defineProperty(BitmapText.prototype, "tint", { + /** + * The tint of the BitmapText object. + * + * @member {number} + * @default 0xffffff + */ + get: function () { + return this._tint; + }, + set: function (value) { + if (this._tint === value) + { return; } + this._tint = value; + for (var i = 0; i < this._activePagesMeshData.length; i++) { + this._activePagesMeshData[i].mesh.tint = value; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "align", { + /** + * The alignment of the BitmapText object. + * + * @member {string} + * @default 'left' + */ + get: function () { + return this._align; + }, + set: function (value) { + if (this._align !== value) { + this._align = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "fontName", { + /** + * The name of the BitmapFont. + * + * @member {string} + */ + get: function () { + return this._fontName; + }, + set: function (value) { + if (!BitmapFont.available[value]) { + throw new Error("Missing BitmapFont \"" + value + "\""); + } + if (this._fontName !== value) { + this._fontName = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "fontSize", { + /** + * The size of the font to display. + * + * @member {number} + */ + get: function () { + return this._fontSize; + }, + set: function (value) { + if (this._fontSize !== value) { + this._fontSize = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "anchor", { + /** + * The anchor sets the origin point of the text. + * + * The default is `(0,0)`, this means the text's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the text's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner. + * + * @member {PIXI.Point | number} + */ + get: function () { + return this._anchor; + }, + set: function (value) { + if (typeof value === 'number') { + this._anchor.set(value); + } + else { + this._anchor.copyFrom(value); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "text", { + /** + * The text of the BitmapText object. + * + * @member {string} + */ + get: function () { + return this._text; + }, + set: function (text) { + text = String(text === null || text === undefined ? '' : text); + if (this._text === text) { + return; + } + this._text = text; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "maxWidth", { + /** + * The max width of this bitmap text in pixels. If the text provided is longer than the + * value provided, line breaks will be automatically inserted in the last whitespace. + * Disable by setting the value to 0. + * + * @member {number} + */ + get: function () { + return this._maxWidth; + }, + set: function (value) { + if (this._maxWidth === value) { + return; + } + this._maxWidth = value; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "maxLineHeight", { + /** + * The max line height. This is useful when trying to use the total height of the Text, + * i.e. when trying to vertically align. + * + * @member {number} + * @readonly + */ + get: function () { + this.validate(); + return this._maxLineHeight; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "textWidth", { + /** + * The width of the overall text, different from fontSize, + * which is defined in the style object. + * + * @member {number} + * @readonly + */ + get: function () { + this.validate(); + return this._textWidth; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "letterSpacing", { + /** + * Additional space between characters. + * + * @member {number} + */ + get: function () { + return this._letterSpacing; + }, + set: function (value) { + if (this._letterSpacing !== value) { + this._letterSpacing = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "roundPixels", { + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} + * + * @member {boolean} + * @default PIXI.settings.ROUND_PIXELS + */ + get: function () { + return this._roundPixels; + }, + set: function (value) { + if (value !== this._roundPixels) { + this._roundPixels = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "textHeight", { + /** + * The height of the overall text, different from fontSize, + * which is defined in the style object. + * + * @member {number} + * @readonly + */ + get: function () { + this.validate(); + return this._textHeight; + }, + enumerable: false, + configurable: true + }); + /** + * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties. + * + * @private + * @deprecated since 5.3.0 + */ + BitmapText.prototype._upgradeStyle = function (style) { + if (typeof style.font === 'string') { + var valueSplit = style.font.split(' '); + style.fontName = valueSplit.length === 1 + ? valueSplit[0] + : valueSplit.slice(1).join(' '); + if (valueSplit.length >= 2) { + style.fontSize = parseInt(valueSplit[0], 10); + } + } + else { + style.fontName = style.font.name; + style.fontSize = typeof style.font.size === 'number' + ? style.font.size + : parseInt(style.font.size, 10); + } + }; + BitmapText.prototype.destroy = function (options) { + var _textureCache = this._textureCache; + for (var id in _textureCache) { + var texture = _textureCache[id]; + texture.destroy(); + delete _textureCache[id]; + } + this._textureCache = null; + _super.prototype.destroy.call(this, options); + }; + /** + * Register a bitmap font with data and a texture. + * + * @deprecated since 5.3.0 + * @see PIXI.BitmapFont.install + * @static + */ + BitmapText.registerFont = function (data, textures) { + deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install'); + return BitmapFont.install(data, textures); + }; + Object.defineProperty(BitmapText, "fonts", { + /** + * Get the list of installed fonts. + * + * @see PIXI.BitmapFont.available + * @deprecated since 5.3.0 + * @static + * @readonly + * @member {Object.} + */ + get: function () { + deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available'); + return BitmapFont.available; + }, + enumerable: false, + configurable: true + }); + BitmapText.styleDefaults = { + align: 'left', + tint: 0xFFFFFF, + maxWidth: 0, + letterSpacing: 0, + }; + return BitmapText; + }(Container)); + + /** + * {@link PIXI.Loader Loader} middleware for loading + * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. + * @class + * @memberof PIXI + * @implements PIXI.ILoaderPlugin + */ + var BitmapFontLoader = /** @class */ (function () { + function BitmapFontLoader() { + } + /** + * Called when the plugin is installed. + * + * @see PIXI.Loader.registerPlugin + */ + BitmapFontLoader.add = function () { + LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT); + }; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + BitmapFontLoader.use = function (resource, next) { + var format = autoDetectFormat(resource.data); + // Resource was not recognised as any of the expected font data format + if (!format) { + next(); + return; + } + var baseUrl = BitmapFontLoader.getBaseUrl(this, resource); + var data = format.parse(resource.data); + var textures = {}; + // Handle completed, when the number of textures + // load is the same number as references in the fnt file + var completed = function (page) { + textures[page.metadata.pageFile] = page.texture; + if (Object.keys(textures).length === data.page.length) { + resource.bitmapFont = BitmapFont.install(data, textures, true); + next(); + } + }; + for (var i = 0; i < data.page.length; ++i) { + var pageFile = data.page[i].file; + var url = baseUrl + pageFile; + var exists = false; + // incase the image is loaded outside + // using the same loader, resource will be available + for (var name in this.resources) { + var bitmapResource = this.resources[name]; + if (bitmapResource.url === url) { + bitmapResource.metadata.pageFile = pageFile; + if (bitmapResource.texture) { + completed(bitmapResource); + } + else { + bitmapResource.onAfterMiddleware.add(completed); + } + exists = true; + break; + } + } + // texture is not loaded, we'll attempt to add + // it to the load and add the texture to the list + if (!exists) { + // Standard loading options for images + var options = { + crossOrigin: resource.crossOrigin, + loadType: LoaderResource.LOAD_TYPE.IMAGE, + metadata: Object.assign({ pageFile: pageFile }, resource.metadata.imageMetadata), + parentResource: resource, + }; + this.add(url, options, completed); + } + } + }; + /** + * Get folder path from a resource + * @private + * @param {PIXI.Loader} loader + * @param {PIXI.LoaderResource} resource + * @return {string} + */ + BitmapFontLoader.getBaseUrl = function (loader, resource) { + var resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : ''; + if (resource.isDataUrl) { + if (resUrl === '.') { + resUrl = ''; + } + if (loader.baseUrl && resUrl) { + // if baseurl has a trailing slash then add one to resUrl so the replace works below + if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/') { + resUrl += '/'; + } + } + } + // remove baseUrl from resUrl + resUrl = resUrl.replace(loader.baseUrl, ''); + // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. + if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/') { + resUrl += '/'; + } + return resUrl; + }; + /** + * Replacement for NodeJS's path.dirname + * @private + * @param {string} url - Path to get directory for + */ + BitmapFontLoader.dirname = function (url) { + var dir = url + .replace(/\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character + .replace(/\/$/, '') // replace trailing slash + .replace(/\/[^\/]*$/, ''); // remove everything after the last + // File request is relative, use current directory + if (dir === url) { + return '.'; + } + // Started with a slash + else if (dir === '') { + return '/'; + } + return dir; + }; + return BitmapFontLoader; + }()); + + /*! + * @pixi/filter-alpha - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/filter-alpha is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$c = function(d, b) { + extendStatics$c = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$c(d, b); + }; + + function __extends$c(d, b) { + extendStatics$c(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$4 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n"; + + /** + * Simplest filter - applies alpha. + * + * Use this instead of Container's alpha property to avoid visual layering of individual elements. + * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains. + * If elements are not opaque, they will blend with each other anyway. + * + * Very handy if you want to use common features of all filters: + * + * 1. Assign a blendMode to this filter, blend all elements inside display object with background. + * + * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var AlphaFilter = /** @class */ (function (_super) { + __extends$c(AlphaFilter, _super); + /** + * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent + */ + function AlphaFilter(alpha) { + if (alpha === void 0) { alpha = 1.0; } + var _this = _super.call(this, _default, fragment$4, { uAlpha: 1 }) || this; + _this.alpha = alpha; + return _this; + } + Object.defineProperty(AlphaFilter.prototype, "alpha", { + /** + * Coefficient for alpha multiplication + * + * @member {number} + * @default 1 + */ + get: function () { + return this.uniforms.uAlpha; + }, + set: function (value) { + this.uniforms.uAlpha = value; + }, + enumerable: false, + configurable: true + }); + return AlphaFilter; + }(Filter)); + + /*! + * @pixi/filter-blur - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/filter-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$d = function(d, b) { + extendStatics$d = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$d(d, b); + }; + + function __extends$d(d, b) { + extendStatics$d(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var vertTemplate = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }"; + function generateBlurVertSource(kernelSize, x) { + var halfLength = Math.ceil(kernelSize / 2); + var vertSource = vertTemplate; + var blurLoop = ''; + var template; + if (x) { + template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);'; + } + else { + template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);'; + } + for (var i = 0; i < kernelSize; i++) { + var blur = template.replace('%index%', i.toString()); + blur = blur.replace('%sampleIndex%', i - (halfLength - 1) + ".0"); + blurLoop += blur; + blurLoop += '\n'; + } + vertSource = vertSource.replace('%blur%', blurLoop); + vertSource = vertSource.replace('%size%', kernelSize.toString()); + return vertSource; + } + + var GAUSSIAN_VALUES = { + 5: [0.153388, 0.221461, 0.250301], + 7: [0.071303, 0.131514, 0.189879, 0.214607], + 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236], + 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596], + 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641], + 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448], + }; + var fragTemplate$1 = [ + 'varying vec2 vBlurTexCoords[%size%];', + 'uniform sampler2D uSampler;', + 'void main(void)', + '{', + ' gl_FragColor = vec4(0.0);', + ' %blur%', + '}' ].join('\n'); + function generateBlurFragSource(kernelSize) { + var kernel = GAUSSIAN_VALUES[kernelSize]; + var halfLength = kernel.length; + var fragSource = fragTemplate$1; + var blurLoop = ''; + var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;'; + var value; + for (var i = 0; i < kernelSize; i++) { + var blur = template.replace('%index%', i.toString()); + value = i; + if (i >= halfLength) { + value = kernelSize - i - 1; + } + blur = blur.replace('%value%', kernel[value].toString()); + blurLoop += blur; + blurLoop += '\n'; + } + fragSource = fragSource.replace('%blur%', blurLoop); + fragSource = fragSource.replace('%size%', kernelSize.toString()); + return fragSource; + } + + /** + * Different types of environments for WebGL. + * + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ + var ENV; + (function (ENV) { + ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; + ENV[ENV["WEBGL"] = 1] = "WEBGL"; + ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; + })(ENV || (ENV = {})); + /** + * Constant to identify the Renderer Type. + * + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ + var RENDERER_TYPE; + (function (RENDERER_TYPE) { + RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; + RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; + RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; + })(RENDERER_TYPE || (RENDERER_TYPE = {})); + /** + * Bitwise OR of masks that indicate the buffers to be cleared. + * + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ + var BUFFER_BITS; + (function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; + })(BUFFER_BITS || (BUFFER_BITS = {})); + /** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL + * @property {number} ADD + * @property {number} MULTIPLY + * @property {number} SCREEN + * @property {number} OVERLAY + * @property {number} DARKEN + * @property {number} LIGHTEN + * @property {number} COLOR_DODGE + * @property {number} COLOR_BURN + * @property {number} HARD_LIGHT + * @property {number} SOFT_LIGHT + * @property {number} DIFFERENCE + * @property {number} EXCLUSION + * @property {number} HUE + * @property {number} SATURATION + * @property {number} COLOR + * @property {number} LUMINOSITY + * @property {number} NORMAL_NPM + * @property {number} ADD_NPM + * @property {number} SCREEN_NPM + * @property {number} NONE + * @property {number} SRC_IN + * @property {number} SRC_OUT + * @property {number} SRC_ATOP + * @property {number} DST_OVER + * @property {number} DST_IN + * @property {number} DST_OUT + * @property {number} DST_ATOP + * @property {number} SUBTRACT + * @property {number} SRC_OVER + * @property {number} ERASE + * @property {number} XOR + */ + var BLEND_MODES; + (function (BLEND_MODES) { + BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; + BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; + BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; + BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; + BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; + BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; + BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; + BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; + BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; + BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; + BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; + BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; + BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; + BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; + BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; + BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; + BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; + BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; + BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; + BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; + BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; + BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; + BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; + BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; + BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; + BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; + BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; + BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; + BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; + BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; + BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; + BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; + })(BLEND_MODES || (BLEND_MODES = {})); + /** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS + * @property {number} LINES + * @property {number} LINE_LOOP + * @property {number} LINE_STRIP + * @property {number} TRIANGLES + * @property {number} TRIANGLE_STRIP + * @property {number} TRIANGLE_FAN + */ + var DRAW_MODES; + (function (DRAW_MODES) { + DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; + DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; + DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; + DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; + DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; + })(DRAW_MODES || (DRAW_MODES = {})); + /** + * Various GL texture/resources formats. + * + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} RGBA=6408 + * @property {number} RGB=6407 + * @property {number} ALPHA=6406 + * @property {number} LUMINANCE=6409 + * @property {number} LUMINANCE_ALPHA=6410 + * @property {number} DEPTH_COMPONENT=6402 + * @property {number} DEPTH_STENCIL=34041 + */ + var FORMATS; + (function (FORMATS) { + FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; + FORMATS[FORMATS["RGB"] = 6407] = "RGB"; + FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; + FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; + FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; + FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; + FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; + })(FORMATS || (FORMATS = {})); + /** + * Various GL target types. + * + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} TEXTURE_2D=3553 + * @property {number} TEXTURE_CUBE_MAP=34067 + * @property {number} TEXTURE_2D_ARRAY=35866 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 + */ + var TARGETS; + (function (TARGETS) { + TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; + TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; + })(TARGETS || (TARGETS = {})); + /** + * Various GL data format types. + * + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} UNSIGNED_BYTE=5121 + * @property {number} UNSIGNED_SHORT=5123 + * @property {number} UNSIGNED_SHORT_5_6_5=33635 + * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 + * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 + * @property {number} FLOAT=5126 + * @property {number} HALF_FLOAT=36193 + */ + var TYPES; + (function (TYPES) { + TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; + TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; + TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; + TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; + TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; + TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; + TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; + })(TYPES || (TYPES = {})); + /** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ + var SCALE_MODES; + (function (SCALE_MODES) { + SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; + SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; + })(SCALE_MODES || (SCALE_MODES = {})); + /** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ + var WRAP_MODES; + (function (WRAP_MODES) { + WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; + WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; + WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; + })(WRAP_MODES || (WRAP_MODES = {})); + /** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + */ + var MIPMAP_MODES; + (function (MIPMAP_MODES) { + MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; + MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; + MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; + })(MIPMAP_MODES || (MIPMAP_MODES = {})); + /** + * How to treat textures with premultiplied alpha + * + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ + var ALPHA_MODES; + (function (ALPHA_MODES) { + ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; + ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; + ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; + ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; + })(ALPHA_MODES || (ALPHA_MODES = {})); + /** + * How to clear renderTextures in filter + * + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Preserve the information in the texture, blend above + * @property {number} CLEAR - Must use `gl.clear` operation + * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ + var CLEAR_MODES; + (function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; + })(CLEAR_MODES || (CLEAR_MODES = {})); + /** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ + var GC_MODES; + (function (GC_MODES) { + GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; + GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; + })(GC_MODES || (GC_MODES = {})); + /** + * Constants that specify float precision in shaders. + * + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} LOW='lowp' + * @property {string} MEDIUM='mediump' + * @property {string} HIGH='highp' + */ + var PRECISION; + (function (PRECISION) { + PRECISION["LOW"] = "lowp"; + PRECISION["MEDIUM"] = "mediump"; + PRECISION["HIGH"] = "highp"; + })(PRECISION || (PRECISION = {})); + /** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + */ + var MASK_TYPES; + (function (MASK_TYPES) { + MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; + MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; + MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; + MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; + })(MASK_TYPES || (MASK_TYPES = {})); + /** + * Constants for multi-sampling antialiasing. + * + * @see PIXI.Framebuffer#multisample + * + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ + var MSAA_QUALITY; + (function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; + })(MSAA_QUALITY || (MSAA_QUALITY = {})); + + /** + * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var BlurFilterPass = /** @class */ (function (_super) { + __extends$d(BlurFilterPass, _super); + /** + * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`). + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize) { + if (strength === void 0) { strength = 8; } + if (quality === void 0) { quality = 4; } + if (resolution === void 0) { resolution = settings.FILTER_RESOLUTION; } + if (kernelSize === void 0) { kernelSize = 5; } + var _this = this; + var vertSrc = generateBlurVertSource(kernelSize, horizontal); + var fragSrc = generateBlurFragSource(kernelSize); + _this = _super.call(this, + // vertex shader + vertSrc, + // fragment shader + fragSrc) || this; + _this.horizontal = horizontal; + _this.resolution = resolution; + _this._quality = 0; + _this.quality = quality; + _this.blur = strength; + return _this; + } + /** + * Applies the filter. + * + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. + * @param {PIXI.CLEAR_MODES} clearMode - How to clear + */ + BlurFilterPass.prototype.apply = function (filterManager, input, output, clearMode) { + if (output) { + if (this.horizontal) { + this.uniforms.strength = (1 / output.width) * (output.width / input.width); + } + else { + this.uniforms.strength = (1 / output.height) * (output.height / input.height); + } + } + else { + if (this.horizontal) // eslint-disable-line + { + this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width); + } + else { + this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line + } + } + // screen space! + this.uniforms.strength *= this.strength; + this.uniforms.strength /= this.passes; + if (this.passes === 1) { + filterManager.applyFilter(this, input, output, clearMode); + } + else { + var renderTarget = filterManager.getFilterTexture(); + var renderer = filterManager.renderer; + var flip = input; + var flop = renderTarget; + this.state.blend = false; + filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR); + for (var i = 1; i < this.passes - 1; i++) { + filterManager.bindAndClear(flip, CLEAR_MODES.BLIT); + this.uniforms.uSampler = flop; + var temp = flop; + flop = flip; + flip = temp; + renderer.shader.bind(this); + renderer.geometry.draw(5); + } + this.state.blend = true; + filterManager.applyFilter(this, flop, output, clearMode); + filterManager.returnFilterTexture(renderTarget); + } + }; + Object.defineProperty(BlurFilterPass.prototype, "blur", { + /** + * Sets the strength of both the blur. + * + * @member {number} + * @default 16 + */ + get: function () { + return this.strength; + }, + set: function (value) { + this.padding = 1 + (Math.abs(value) * 2); + this.strength = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilterPass.prototype, "quality", { + /** + * Sets the quality of the blur by modifying the number of passes. More passes means higher + * quaility bluring but the lower the performance. + * + * @member {number} + * @default 4 + */ + get: function () { + return this._quality; + }, + set: function (value) { + this._quality = value; + this.passes = value; + }, + enumerable: false, + configurable: true + }); + return BlurFilterPass; + }(Filter)); + + /** + * The BlurFilter applies a Gaussian blur to an object. + * + * The strength of the blur can be set for the x-axis and y-axis separately. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var BlurFilter = /** @class */ (function (_super) { + __extends$d(BlurFilter, _super); + /** + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurFilter(strength, quality, resolution, kernelSize) { + if (strength === void 0) { strength = 8; } + if (quality === void 0) { quality = 4; } + if (resolution === void 0) { resolution = settings.FILTER_RESOLUTION; } + if (kernelSize === void 0) { kernelSize = 5; } + var _this = _super.call(this) || this; + _this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize); + _this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize); + _this.resolution = resolution; + _this.quality = quality; + _this.blur = strength; + _this.repeatEdgePixels = false; + return _this; + } + /** + * Applies the filter. + * + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. + * @param {PIXI.CLEAR_MODES} clearMode - How to clear + */ + BlurFilter.prototype.apply = function (filterManager, input, output, clearMode) { + var xStrength = Math.abs(this.blurXFilter.strength); + var yStrength = Math.abs(this.blurYFilter.strength); + if (xStrength && yStrength) { + var renderTarget = filterManager.getFilterTexture(); + this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR); + this.blurYFilter.apply(filterManager, renderTarget, output, clearMode); + filterManager.returnFilterTexture(renderTarget); + } + else if (yStrength) { + this.blurYFilter.apply(filterManager, input, output, clearMode); + } + else { + this.blurXFilter.apply(filterManager, input, output, clearMode); + } + }; + BlurFilter.prototype.updatePadding = function () { + if (this._repeatEdgePixels) { + this.padding = 0; + } + else { + this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; + } + }; + Object.defineProperty(BlurFilter.prototype, "blur", { + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * + * @member {number} + * @default 2 + */ + get: function () { + return this.blurXFilter.blur; + }, + set: function (value) { + this.blurXFilter.blur = this.blurYFilter.blur = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "quality", { + /** + * Sets the number of passes for blur. More passes means higher quaility bluring. + * + * @member {number} + * @default 1 + */ + get: function () { + return this.blurXFilter.quality; + }, + set: function (value) { + this.blurXFilter.quality = this.blurYFilter.quality = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "blurX", { + /** + * Sets the strength of the blurX property + * + * @member {number} + * @default 2 + */ + get: function () { + return this.blurXFilter.blur; + }, + set: function (value) { + this.blurXFilter.blur = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "blurY", { + /** + * Sets the strength of the blurY property + * + * @member {number} + * @default 2 + */ + get: function () { + return this.blurYFilter.blur; + }, + set: function (value) { + this.blurYFilter.blur = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "blendMode", { + /** + * Sets the blendmode of the filter + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.blurYFilter.blendMode; + }, + set: function (value) { + this.blurYFilter.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "repeatEdgePixels", { + /** + * If set to true the edge of the target will be clamped + * + * @member {boolean} + * @default false + */ + get: function () { + return this._repeatEdgePixels; + }, + set: function (value) { + this._repeatEdgePixels = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + return BlurFilter; + }(Filter)); + + /*! + * @pixi/filter-color-matrix - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/filter-color-matrix is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$e = function(d, b) { + extendStatics$e = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$e(d, b); + }; + + function __extends$e(d, b) { + extendStatics$e(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$5 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n"; + + /** + * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA + * color and alpha values of every pixel on your displayObject to produce a result + * with a new set of RGBA color and alpha values. It's pretty powerful! + * + * ```js + * let colorMatrix = new PIXI.filters.ColorMatrixFilter(); + * container.filters = [colorMatrix]; + * colorMatrix.contrast(2); + * ``` + * @author Clément Chenebault + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var ColorMatrixFilter = /** @class */ (function (_super) { + __extends$e(ColorMatrixFilter, _super); + function ColorMatrixFilter() { + var _this = this; + var uniforms = { + m: new Float32Array([1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0]), + uAlpha: 1, + }; + _this = _super.call(this, defaultFilter, fragment$5, uniforms) || this; + _this.alpha = 1; + return _this; + } + /** + * Transforms current matrix and set the new one + * + * @param {number[]} matrix - 5x4 matrix + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) { + if (multiply === void 0) { multiply = false; } + var newMatrix = matrix; + if (multiply) { + this._multiply(newMatrix, this.uniforms.m, matrix); + newMatrix = this._colorMatrix(newMatrix); + } + // set the new matrix + this.uniforms.m = newMatrix; + }; + /** + * Multiplies two mat5's + * + * @private + * @param {number[]} out - 5x4 matrix the receiving matrix + * @param {number[]} a - 5x4 matrix the first operand + * @param {number[]} b - 5x4 matrix the second operand + * @returns {number[]} 5x4 matrix + */ + ColorMatrixFilter.prototype._multiply = function (out, a, b) { + // Red Channel + out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]); + out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]); + out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]); + out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]); + out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4]; + // Green Channel + out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]); + out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]); + out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]); + out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]); + out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9]; + // Blue Channel + out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]); + out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]); + out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]); + out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]); + out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14]; + // Alpha Channel + out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]); + out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]); + out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]); + out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]); + out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19]; + return out; + }; + /** + * Create a Float32 Array and normalize the offset component to 0-1 + * + * @private + * @param {number[]} matrix - 5x4 matrix + * @return {number[]} 5x4 matrix with all values between 0-1 + */ + ColorMatrixFilter.prototype._colorMatrix = function (matrix) { + // Create a Float32 Array and normalize the offset component to 0-1 + var m = new Float32Array(matrix); + m[4] /= 255; + m[9] /= 255; + m[14] /= 255; + m[19] /= 255; + return m; + }; + /** + * Adjusts brightness + * + * @param {number} b - value of the brigthness (0-1, where 0 is black) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.brightness = function (b, multiply) { + var matrix = [ + b, 0, 0, 0, 0, + 0, b, 0, 0, 0, + 0, 0, b, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Set the matrices in grey scales + * + * @param {number} scale - value of the grey (0-1, where 0 is black) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.greyscale = function (scale, multiply) { + var matrix = [ + scale, scale, scale, 0, 0, + scale, scale, scale, 0, 0, + scale, scale, scale, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Set the black and white matrice. + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.blackAndWhite = function (multiply) { + var matrix = [ + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0.3, 0.6, 0.1, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Set the hue property of the color + * + * @param {number} rotation - in degrees + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.hue = function (rotation, multiply) { + rotation = (rotation || 0) / 180 * Math.PI; + var cosR = Math.cos(rotation); + var sinR = Math.sin(rotation); + var sqrt = Math.sqrt; + /* a good approximation for hue rotation + This matrix is far better than the versions with magic luminance constants + formerly used here, but also used in the starling framework (flash) and known from this + old part of the internet: quasimondo.com/archives/000565.php + + This new matrix is based on rgb cube rotation in space. Look here for a more descriptive + implementation as a shader not a general matrix: + https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js + + This is the source for the code: + see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751 + */ + var w = 1 / 3; + var sqrW = sqrt(w); // weight is + var a00 = cosR + ((1.0 - cosR) * w); + var a01 = (w * (1.0 - cosR)) - (sqrW * sinR); + var a02 = (w * (1.0 - cosR)) + (sqrW * sinR); + var a10 = (w * (1.0 - cosR)) + (sqrW * sinR); + var a11 = cosR + (w * (1.0 - cosR)); + var a12 = (w * (1.0 - cosR)) - (sqrW * sinR); + var a20 = (w * (1.0 - cosR)) - (sqrW * sinR); + var a21 = (w * (1.0 - cosR)) + (sqrW * sinR); + var a22 = cosR + (w * (1.0 - cosR)); + var matrix = [ + a00, a01, a02, 0, 0, + a10, a11, a12, 0, 0, + a20, a21, a22, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Set the contrast matrix, increase the separation between dark and bright + * Increase contrast : shadows darker and highlights brighter + * Decrease contrast : bring the shadows up and the highlights down + * + * @param {number} amount - value of the contrast (0-1) + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.contrast = function (amount, multiply) { + var v = (amount || 0) + 1; + var o = -0.5 * (v - 1); + var matrix = [ + v, 0, 0, 0, o, + 0, v, 0, 0, o, + 0, 0, v, 0, o, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Set the saturation matrix, increase the separation between colors + * Increase saturation : increase contrast, brightness, and sharpness + * + * @param {number} amount - The saturation amount (0-1) + * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.saturate = function (amount, multiply) { + if (amount === void 0) { amount = 0; } + var x = (amount * 2 / 3) + 1; + var y = ((x - 1) * -0.5); + var matrix = [ + x, y, y, 0, 0, + y, x, y, 0, 0, + y, y, x, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Desaturate image (remove color) + * + * Call the saturate function + * + */ + ColorMatrixFilter.prototype.desaturate = function () { + this.saturate(-1); + }; + /** + * Negative image (inverse of classic rgb matrix) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.negative = function (multiply) { + var matrix = [ + -1, 0, 0, 1, 0, + 0, -1, 0, 1, 0, + 0, 0, -1, 1, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Sepia image + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.sepia = function (multiply) { + var matrix = [ + 0.393, 0.7689999, 0.18899999, 0, 0, + 0.349, 0.6859999, 0.16799999, 0, 0, + 0.272, 0.5339999, 0.13099999, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Color motion picture process invented in 1916 (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.technicolor = function (multiply) { + var matrix = [ + 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, + -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, + -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Polaroid filter + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.polaroid = function (multiply) { + var matrix = [ + 1.438, -0.062, -0.062, 0, 0, + -0.122, 1.378, -0.122, 0, 0, + -0.016, -0.016, 1.483, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Filter who transforms : Red -> Blue and Blue -> Red + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.toBGR = function (multiply) { + var matrix = [ + 0, 0, 1, 0, 0, + 0, 1, 0, 0, 0, + 1, 0, 0, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.kodachrome = function (multiply) { + var matrix = [ + 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, + -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, + -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Brown delicious browni filter (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.browni = function (multiply) { + var matrix = [ + 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, + -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, + 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Vintage filter (thanks Dominic Szablewski) + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.vintage = function (multiply) { + var matrix = [ + 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, + 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, + 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * We don't know exactly what it does, kind of gradient map, but funny to play with! + * + * @param {number} desaturation - Tone values. + * @param {number} toned - Tone values. + * @param {number} lightColor - Tone values, example: `0xFFE580` + * @param {number} darkColor - Tone values, example: `0xFFE580` + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) { + desaturation = desaturation || 0.2; + toned = toned || 0.15; + lightColor = lightColor || 0xFFE580; + darkColor = darkColor || 0x338000; + var lR = ((lightColor >> 16) & 0xFF) / 255; + var lG = ((lightColor >> 8) & 0xFF) / 255; + var lB = (lightColor & 0xFF) / 255; + var dR = ((darkColor >> 16) & 0xFF) / 255; + var dG = ((darkColor >> 8) & 0xFF) / 255; + var dB = (darkColor & 0xFF) / 255; + var matrix = [ + 0.3, 0.59, 0.11, 0, 0, + lR, lG, lB, desaturation, 0, + dR, dG, dB, toned, 0, + lR - dR, lG - dG, lB - dB, 0, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Night effect + * + * @param {number} intensity - The intensity of the night effect. + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.night = function (intensity, multiply) { + intensity = intensity || 0.1; + var matrix = [ + intensity * (-2.0), -intensity, 0, 0, 0, + -intensity, 0, intensity, 0, 0, + 0, intensity, intensity * 2.0, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Predator effect + * + * Erase the current matrix by setting a new indepent one + * + * @param {number} amount - how much the predator feels his future victim + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.predator = function (amount, multiply) { + var matrix = [ + // row 1 + 11.224130630493164 * amount, + -4.794486999511719 * amount, + -2.8746118545532227 * amount, + 0 * amount, + 0.40342438220977783 * amount, + // row 2 + -3.6330697536468506 * amount, + 9.193157196044922 * amount, + -2.951810836791992 * amount, + 0 * amount, + -1.316135048866272 * amount, + // row 3 + -3.2184197902679443 * amount, + -4.2375030517578125 * amount, + 7.476448059082031 * amount, + 0 * amount, + 0.8044459223747253 * amount, + // row 4 + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * LSD effect + * + * Multiply the current matrix + * + * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * just set the current matrix with @param matrix + */ + ColorMatrixFilter.prototype.lsd = function (multiply) { + var matrix = [ + 2, -0.4, 0.5, 0, 0, + -0.5, 2, -0.4, 0, 0, + -0.4, -0.5, 3, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, multiply); + }; + /** + * Erase the current matrix by setting the default one + * + */ + ColorMatrixFilter.prototype.reset = function () { + var matrix = [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 ]; + this._loadMatrix(matrix, false); + }; + Object.defineProperty(ColorMatrixFilter.prototype, "matrix", { + /** + * The matrix of the color matrix filter + * + * @member {number[]} + * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] + */ + get: function () { + return this.uniforms.m; + }, + set: function (value) { + this.uniforms.m = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ColorMatrixFilter.prototype, "alpha", { + /** + * The opacity value to use when mixing the original and resultant colors. + * + * When the value is 0, the original color is used without modification. + * When the value is 1, the result color is used. + * When in the range (0, 1) the color is interpolated between the original and result by this amount. + * + * @member {number} + * @default 1 + */ + get: function () { + return this.uniforms.uAlpha; + }, + set: function (value) { + this.uniforms.uAlpha = value; + }, + enumerable: false, + configurable: true + }); + return ColorMatrixFilter; + }(Filter)); + // Americanized alias + ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; + + /*! + * @pixi/filter-displacement - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/filter-displacement is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$f = function(d, b) { + extendStatics$f = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$f(d, b); + }; + + function __extends$f(d, b) { + extendStatics$f(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$6 = "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n"; + + var vertex$4 = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n"; + + /** + * The DisplacementFilter class uses the pixel values from the specified texture + * (called the displacement map) to perform a displacement of an object. + * + * You can use this filter to apply all manor of crazy warping effects. + * Currently the `r` property of the texture is used to offset the `x` + * and the `g` property of the texture is used to offset the `y`. + * + * The way it works is it uses the values of the displacement map to look up the + * correct pixels to output. This means it's not technically moving the original. + * Instead, it's starting at the output and asking "which pixel from the original goes here". + * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`, + * this filter will output the pixel approximately 20 pixels to the right of the original. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var DisplacementFilter = /** @class */ (function (_super) { + __extends$f(DisplacementFilter, _super); + /** + * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) + * @param {number} [scale] - The scale of the displacement + */ + function DisplacementFilter(sprite, scale) { + var _this = this; + var maskMatrix = new Matrix(); + sprite.renderable = false; + _this = _super.call(this, vertex$4, fragment$6, { + mapSampler: sprite._texture, + filterMatrix: maskMatrix, + scale: { x: 1, y: 1 }, + rotation: new Float32Array([1, 0, 0, 1]), + }) || this; + _this.maskSprite = sprite; + _this.maskMatrix = maskMatrix; + if (scale === null || scale === undefined) { + scale = 20; + } + /** + * scaleX, scaleY for displacements + * @member {PIXI.Point} + */ + _this.scale = new Point(scale, scale); + return _this; + } + /** + * Applies the filter. + * + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. + * @param {PIXI.CLEAR_MODES} clearMode - clearMode. + */ + DisplacementFilter.prototype.apply = function (filterManager, input, output, clearMode) { + // fill maskMatrix with _normalized sprite texture coords_ + this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite); + this.uniforms.scale.x = this.scale.x; + this.uniforms.scale.y = this.scale.y; + // Extract rotation from world transform + var wt = this.maskSprite.worldTransform; + var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b)); + var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d)); + if (lenX !== 0 && lenY !== 0) { + this.uniforms.rotation[0] = wt.a / lenX; + this.uniforms.rotation[1] = wt.b / lenX; + this.uniforms.rotation[2] = wt.c / lenY; + this.uniforms.rotation[3] = wt.d / lenY; + } + // draw the filter... + filterManager.applyFilter(this, input, output, clearMode); + }; + Object.defineProperty(DisplacementFilter.prototype, "map", { + /** + * The texture used for the displacement map. Must be power of 2 sized texture. + * + * @member {PIXI.Texture} + */ + get: function () { + return this.uniforms.mapSampler; + }, + set: function (value) { + this.uniforms.mapSampler = value; + }, + enumerable: false, + configurable: true + }); + return DisplacementFilter; + }(Filter)); + + /*! + * @pixi/filter-fxaa - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/filter-fxaa is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$g = function(d, b) { + extendStatics$g = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$g(d, b); + }; + + function __extends$g(d, b) { + extendStatics$g(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var vertex$5 = "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n"; + + var fragment$7 = "varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it's\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n"; + + /** + * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com + * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL. + * + * @see https://github.com/mitsuhiko/webgl-meincraft + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + * + */ + var FXAAFilter = /** @class */ (function (_super) { + __extends$g(FXAAFilter, _super); + function FXAAFilter() { + // TODO - needs work + return _super.call(this, vertex$5, fragment$7) || this; + } + return FXAAFilter; + }(Filter)); + + /*! + * @pixi/filter-noise - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/filter-noise is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$h = function(d, b) { + extendStatics$h = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$h(d, b); + }; + + function __extends$h(d, b) { + extendStatics$h(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$8 = "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n"; + + /** + * @author Vico @vicocotea + * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js + */ + /** + * A Noise effect filter. + * + * @class + * @extends PIXI.Filter + * @memberof PIXI.filters + */ + var NoiseFilter = /** @class */ (function (_super) { + __extends$h(NoiseFilter, _super); + /** + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. + */ + function NoiseFilter(noise, seed) { + if (noise === void 0) { noise = 0.5; } + if (seed === void 0) { seed = Math.random(); } + var _this = _super.call(this, defaultFilter, fragment$8, { + uNoise: 0, + uSeed: 0, + }) || this; + _this.noise = noise; + _this.seed = seed; + return _this; + } + Object.defineProperty(NoiseFilter.prototype, "noise", { + /** + * The amount of noise to apply, this value should be in the range (0, 1]. + * + * @member {number} + * @default 0.5 + */ + get: function () { + return this.uniforms.uNoise; + }, + set: function (value) { + this.uniforms.uNoise = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NoiseFilter.prototype, "seed", { + /** + * A seed value to apply to the random noise generation. `Math.random()` is a good value to use. + * + * @member {number} + */ + get: function () { + return this.uniforms.uSeed; + }, + set: function (value) { + this.uniforms.uSeed = value; + }, + enumerable: false, + configurable: true + }); + return NoiseFilter; + }(Filter)); + + /*! + * @pixi/mixin-cache-as-bitmap - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/mixin-cache-as-bitmap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + var _tempMatrix = new Matrix(); + DisplayObject.prototype._cacheAsBitmap = false; + DisplayObject.prototype._cacheData = null; + // figured there's no point adding ALL the extra variables to prototype. + // this model can hold the information needed. This can also be generated on demand as + // most objects are not cached as bitmaps. + /** + * @class + * @ignore + */ + var CacheData = /** @class */ (function () { + function CacheData() { + this.textureCacheId = null; + this.originalRender = null; + this.originalRenderCanvas = null; + this.originalCalculateBounds = null; + this.originalGetLocalBounds = null; + this.originalUpdateTransform = null; + this.originalDestroy = null; + this.originalMask = null; + this.originalFilterArea = null; + this.originalContainsPoint = null; + this.sprite = null; + } + return CacheData; + }()); + Object.defineProperties(DisplayObject.prototype, { + /** + * Set this to true if you want this display object to be cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can + * provide a performance benefit for complex static displayObjects. + * To remove simply set this property to `false` + * + * IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true + * as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear. + * + * @member {boolean} + * @memberof PIXI.DisplayObject# + */ + cacheAsBitmap: { + get: function () { + return this._cacheAsBitmap; + }, + set: function (value) { + if (this._cacheAsBitmap === value) { + return; + } + this._cacheAsBitmap = value; + var data; + if (value) { + if (!this._cacheData) { + this._cacheData = new CacheData(); + } + data = this._cacheData; + data.originalRender = this.render; + data.originalRenderCanvas = this.renderCanvas; + data.originalUpdateTransform = this.updateTransform; + data.originalCalculateBounds = this.calculateBounds; + data.originalGetLocalBounds = this.getLocalBounds; + data.originalDestroy = this.destroy; + data.originalContainsPoint = this.containsPoint; + data.originalMask = this._mask; + data.originalFilterArea = this.filterArea; + this.render = this._renderCached; + this.renderCanvas = this._renderCachedCanvas; + this.destroy = this._cacheAsBitmapDestroy; + } + else { + data = this._cacheData; + if (data.sprite) { + this._destroyCachedDisplayObject(); + } + this.render = data.originalRender; + this.renderCanvas = data.originalRenderCanvas; + this.calculateBounds = data.originalCalculateBounds; + this.getLocalBounds = data.originalGetLocalBounds; + this.destroy = data.originalDestroy; + this.updateTransform = data.originalUpdateTransform; + this.containsPoint = data.originalContainsPoint; + this._mask = data.originalMask; + this.filterArea = data.originalFilterArea; + } + }, + }, + }); + /** + * Renders a cached version of the sprite with WebGL + * + * @private + * @function _renderCached + * @memberof PIXI.DisplayObject# + * @param {PIXI.Renderer} renderer - the WebGL renderer + */ + DisplayObject.prototype._renderCached = function _renderCached(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + this._initCachedDisplayObject(renderer); + this._cacheData.sprite.transform._worldID = this.transform._worldID; + this._cacheData.sprite.worldAlpha = this.worldAlpha; + this._cacheData.sprite._render(renderer); + }; + /** + * Prepares the WebGL renderer to cache the sprite + * + * @private + * @function _initCachedDisplayObject + * @memberof PIXI.DisplayObject# + * @param {PIXI.Renderer} renderer - the WebGL renderer + */ + DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) { + if (this._cacheData && this._cacheData.sprite) { + return; + } + // make sure alpha is set to 1 otherwise it will get rendered as invisible! + var cacheAlpha = this.alpha; + this.alpha = 1; + // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) + renderer.batch.flush(); + // this.filters= []; + // next we find the dimensions of the untransformed object + // this function also calls updatetransform on all its children as part of the measuring. + // This means we don't need to update the transform again in this function + // TODO pass an object to clone too? saves having to create a new one each time! + var bounds = this.getLocalBounds(null, true).clone(); + // add some padding! + if (this.filters) { + var padding = this.filters[0].padding; + bounds.pad(padding); + } + bounds.ceil(settings.RESOLUTION); + // for now we cache the current renderTarget that the WebGL renderer is currently using. + // this could be more elegant.. + var cachedRenderTexture = renderer.renderTexture.current; + var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone(); + var cachedDestinationFrame = renderer.renderTexture.destinationFrame.clone(); + var cachedProjectionTransform = renderer.projection.transform; + // We also store the filter stack - I will definitely look to change how this works a little later down the line. + // const stack = renderer.filterManager.filterStack; + // this renderTexture will be used to store the cached DisplayObject + var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); + var textureCacheId = "cacheAsBitmap_" + uid(); + this._cacheData.textureCacheId = textureCacheId; + BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); + Texture.addToCache(renderTexture, textureCacheId); + // need to set // + var m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y); + // set all properties to there original so we can render to a texture + this.render = this._cacheData.originalRender; + renderer.render(this, renderTexture, true, m, false); + // now restore the state be setting the new properties + renderer.projection.transform = cachedProjectionTransform; + renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame, cachedDestinationFrame); + // renderer.filterManager.filterStack = stack; + this.render = this._renderCached; + // the rest is the same as for Canvas + this.updateTransform = this.displayObjectUpdateTransform; + this.calculateBounds = this._calculateCachedBounds; + this.getLocalBounds = this._getCachedLocalBounds; + this._mask = null; + this.filterArea = null; + // create our cached sprite + var cachedSprite = new Sprite(renderTexture); + cachedSprite.transform.worldTransform = this.transform.worldTransform; + cachedSprite.anchor.x = -(bounds.x / bounds.width); + cachedSprite.anchor.y = -(bounds.y / bounds.height); + cachedSprite.alpha = cacheAlpha; + cachedSprite._bounds = this._bounds; + this._cacheData.sprite = cachedSprite; + this.transform._parentID = -1; + // restore the transform of the cached sprite to avoid the nasty flicker.. + if (!this.parent) { + this.enableTempParent(); + this.updateTransform(); + this.disableTempParent(null); + } + else { + this.updateTransform(); + } + // map the hit test.. + this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); + }; + /** + * Renders a cached version of the sprite with canvas + * + * @private + * @function _renderCachedCanvas + * @memberof PIXI.DisplayObject# + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer + */ + DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + this._initCachedDisplayObjectCanvas(renderer); + this._cacheData.sprite.worldAlpha = this.worldAlpha; + this._cacheData.sprite._renderCanvas(renderer); + }; + // TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. + /** + * Prepares the Canvas renderer to cache the sprite + * + * @private + * @function _initCachedDisplayObjectCanvas + * @memberof PIXI.DisplayObject# + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer + */ + DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) { + if (this._cacheData && this._cacheData.sprite) { + return; + } + // get bounds actually transforms the object for us already! + var bounds = this.getLocalBounds(null, true); + var cacheAlpha = this.alpha; + this.alpha = 1; + var cachedRenderTarget = renderer.context; + var cachedProjectionTransform = renderer._projTransform; + bounds.ceil(settings.RESOLUTION); + var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); + var textureCacheId = "cacheAsBitmap_" + uid(); + this._cacheData.textureCacheId = textureCacheId; + BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); + Texture.addToCache(renderTexture, textureCacheId); + // need to set // + var m = _tempMatrix; + this.transform.localTransform.copyTo(m); + m.invert(); + m.tx -= bounds.x; + m.ty -= bounds.y; + // m.append(this.transform.worldTransform.) + // set all properties to there original so we can render to a texture + this.renderCanvas = this._cacheData.originalRenderCanvas; + renderer.render(this, renderTexture, true, m, false); + // now restore the state be setting the new properties + renderer.context = cachedRenderTarget; + renderer._projTransform = cachedProjectionTransform; + this.renderCanvas = this._renderCachedCanvas; + // the rest is the same as for WebGL + this.updateTransform = this.displayObjectUpdateTransform; + this.calculateBounds = this._calculateCachedBounds; + this.getLocalBounds = this._getCachedLocalBounds; + this._mask = null; + this.filterArea = null; + // create our cached sprite + var cachedSprite = new Sprite(renderTexture); + cachedSprite.transform.worldTransform = this.transform.worldTransform; + cachedSprite.anchor.x = -(bounds.x / bounds.width); + cachedSprite.anchor.y = -(bounds.y / bounds.height); + cachedSprite.alpha = cacheAlpha; + cachedSprite._bounds = this._bounds; + this._cacheData.sprite = cachedSprite; + this.transform._parentID = -1; + // restore the transform of the cached sprite to avoid the nasty flicker.. + if (!this.parent) { + this.parent = renderer._tempDisplayObjectParent; + this.updateTransform(); + this.parent = null; + } + else { + this.updateTransform(); + } + // map the hit test.. + this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); + }; + /** + * Calculates the bounds of the cached sprite + * + * @private + */ + DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() { + this._bounds.clear(); + this._cacheData.sprite.transform._worldID = this.transform._worldID; + this._cacheData.sprite._calculateBounds(); + this._bounds.updateID = this._boundsID; + }; + /** + * Gets the bounds of the cached sprite. + * + * @private + * @return {Rectangle} The local bounds. + */ + DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() { + return this._cacheData.sprite.getLocalBounds(null); + }; + /** + * Destroys the cached sprite. + * + * @private + */ + DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() { + this._cacheData.sprite._texture.destroy(true); + this._cacheData.sprite = null; + BaseTexture.removeFromCache(this._cacheData.textureCacheId); + Texture.removeFromCache(this._cacheData.textureCacheId); + this._cacheData.textureCacheId = null; + }; + /** + * Destroys the cached object. + * + * @private + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value. + * Used when destroying containers, see the Container.destroy method. + */ + DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) { + this.cacheAsBitmap = false; + this.destroy(options); + }; + + /*! + * @pixi/mixin-get-child-by-name - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/mixin-get-child-by-name is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * The instance name of the object. + * + * @memberof PIXI.DisplayObject# + * @member {string} name + */ + DisplayObject.prototype.name = null; + /** + * Returns the display object in the container. + * + * Recursive searches are done in a preorder traversal. + * + * @method getChildByName + * @memberof PIXI.Container# + * @param {string} name - Instance name. + * @param {boolean}[deep=false] - Whether to search recursively + * @return {PIXI.DisplayObject} The child with the specified name. + */ + Container.prototype.getChildByName = function getChildByName(name, deep) { + for (var i = 0, j = this.children.length; i < j; i++) { + if (this.children[i].name === name) { + return this.children[i]; + } + } + if (deep) { + for (var i = 0, j = this.children.length; i < j; i++) { + var child = this.children[i]; + if (!child.getChildByName) { + continue; + } + var target = this.children[i].getChildByName(name, true); + if (target) { + return target; + } + } + } + return null; + }; + + /*! + * @pixi/mixin-get-global-position - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/mixin-get-global-position is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /** + * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot. + * + * @method getGlobalPosition + * @memberof PIXI.DisplayObject# + * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to. + * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from + * being updated. This means the calculation returned MAY be out of date BUT will give you a + * nice performance boost. + * @return {PIXI.Point} The updated point. + */ + DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) { + if (point === void 0) { point = new Point(); } + if (skipUpdate === void 0) { skipUpdate = false; } + if (this.parent) { + this.parent.toGlobal(this.position, point, skipUpdate); + } + else { + point.x = this.position.x; + point.y = this.position.y; + } + return point; + }; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$i = function(d, b) { + extendStatics$i = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$i(d, b); + }; + + function __extends$i(d, b) { + extendStatics$i(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __rest(s, e) { + var t = {}; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + { t[p] = s[p]; } } + if (s != null && typeof Object.getOwnPropertySymbols === "function") + { for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) + { t[p[i]] = s[p[i]]; } } } + return t; + } + + function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") { r = Reflect.decorate(decorators, target, key, desc); } + else { for (var i = decorators.length - 1; i >= 0; i--) { if (d = decorators[i]) { r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; } } } + return c > 3 && r && Object.defineProperty(target, key, r), r; + } + + function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + } + + function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } + } + + function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) { throw new TypeError("Generator is already executing."); } + while (_) { try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } + if (y = 0, t) { op = [op[0] & 2, t.value]; } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) { _.ops.pop(); } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } + if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __exportStar(m, exports) { + for (var p in m) { if (!exports.hasOwnProperty(p)) { exports[p] = m[p]; } } + } + + function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) { return m.call(o); } + return { + next: function () { + if (o && i >= o.length) { o = void 0; } + return { value: o && o[i++], done: !o }; + } + }; + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) { return o; } + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) { m.call(i); } + } + finally { if (e) { throw e.error; } } + } + return ar; + } + + function __spread() { + var arguments$1 = arguments; + + for (var ar = [], i = 0; i < arguments.length; i++) + { ar = ar.concat(__read(arguments$1[i])); } + return ar; + } + + function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } + } + + function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + } + + function __asyncValues(o) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + } + + function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + function __importStar(mod) { + if (mod && mod.__esModule) { return mod; } + var result = {}; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } + result.default = mod; + return result; + } + + function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; + } + + var v5 = '5.0.0'; + /** + * Deprecations (backward compatibilities) are automatically applied for browser bundles + * in the UMD module format. If using Webpack or Rollup, you'll need to apply these + * deprecations manually by doing something like this: + * @example + * import * as PIXI from 'pixi.js'; + * PIXI.useDeprecated(); // MUST be bound to namespace + * @memberof PIXI + * @function useDeprecated + */ + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function useDeprecated() { + // eslint-disable-next-line @typescript-eslint/no-this-alias + var PIXI = this; + Object.defineProperties(PIXI, { + /** + * @constant {RegExp|string} SVG_SIZE + * @memberof PIXI + * @see PIXI.resources.SVGResource.SVG_SIZE + * @deprecated since 5.0.0 + */ + SVG_SIZE: { + get: function () { + deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE'); + return PIXI.SVGResource.SVG_SIZE; + }, + }, + /** + * @class PIXI.TransformStatic + * @deprecated since 5.0.0 + * @see PIXI.Transform + */ + TransformStatic: { + get: function () { + deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform'); + return PIXI.Transform; + }, + }, + /** + * @class PIXI.TransformBase + * @deprecated since 5.0.0 + * @see PIXI.Transform + */ + TransformBase: { + get: function () { + deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform'); + return PIXI.Transform; + }, + }, + /** + * Constants that specify the transform type. + * + * @static + * @constant + * @name TRANSFORM_MODE + * @memberof PIXI + * @enum {number} + * @deprecated since 5.0.0 + * @property {number} STATIC + * @property {number} DYNAMIC + */ + TRANSFORM_MODE: { + get: function () { + deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed'); + return { STATIC: 0, DYNAMIC: 1 }; + }, + }, + /** + * @class PIXI.WebGLRenderer + * @see PIXI.Renderer + * @deprecated since 5.0.0 + */ + WebGLRenderer: { + get: function () { + deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer'); + return PIXI.Renderer; + }, + }, + /** + * @class PIXI.CanvasRenderTarget + * @see PIXI.utils.CanvasRenderTarget + * @deprecated since 5.0.0 + */ + CanvasRenderTarget: { + get: function () { + deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget'); + return PIXI.utils.CanvasRenderTarget; + }, + }, + /** + * @memberof PIXI + * @name loader + * @type {PIXI.Loader} + * @see PIXI.Loader.shared + * @deprecated since 5.0.0 + */ + loader: { + get: function () { + deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared'); + return PIXI.Loader.shared; + }, + }, + /** + * @class PIXI.FilterManager + * @see PIXI.systems.FilterSystem + * @deprecated since 5.0.0 + */ + FilterManager: { + get: function () { + deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem'); + return PIXI.systems.FilterSystem; + }, + }, + /** + * @namespace PIXI.CanvasTinter + * @see PIXI.canvasUtils + * @deprecated since 5.2.0 + */ + CanvasTinter: { + get: function () { + deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils'); + return PIXI.canvasUtils; + }, + }, + /** + * @namespace PIXI.GroupD8 + * @see PIXI.groupD8 + * @deprecated since 5.2.0 + */ + GroupD8: { + get: function () { + deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8'); + return PIXI.groupD8; + }, + }, + }); + /** + * @namespace PIXI.accessibility + * @see PIXI + * @deprecated since 5.3.0 + */ + PIXI.accessibility = {}; + Object.defineProperties(PIXI.accessibility, { + /** + * @class PIXI.accessibility.AccessibilityManager + * @deprecated since 5.3.0 + * @see PIXI.AccessibilityManager + */ + AccessibilityManager: { + get: function () { + deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager'); + return PIXI.AccessibilityManager; + }, + }, + }); + /** + * @namespace PIXI.interaction + * @see PIXI + * @deprecated since 5.3.0 + */ + PIXI.interaction = {}; + Object.defineProperties(PIXI.interaction, { + /** + * @class PIXI.interaction.InteractionManager + * @deprecated since 5.3.0 + * @see PIXI.InteractionManager + */ + InteractionManager: { + get: function () { + deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager'); + return PIXI.InteractionManager; + }, + }, + /** + * @class PIXI.interaction.InteractionData + * @deprecated since 5.3.0 + * @see PIXI.InteractionData + */ + InteractionData: { + get: function () { + deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData'); + return PIXI.InteractionData; + }, + }, + /** + * @class PIXI.interaction.InteractionEvent + * @deprecated since 5.3.0 + * @see PIXI.InteractionEvent + */ + InteractionEvent: { + get: function () { + deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent'); + return PIXI.InteractionEvent; + }, + }, + }); + /** + * @namespace PIXI.prepare + * @see PIXI + * @deprecated since 5.2.1 + */ + PIXI.prepare = {}; + Object.defineProperties(PIXI.prepare, { + /** + * @class PIXI.prepare.BasePrepare + * @deprecated since 5.2.1 + * @see PIXI.BasePrepare + */ + BasePrepare: { + get: function () { + deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare'); + return PIXI.BasePrepare; + }, + }, + /** + * @class PIXI.prepare.Prepare + * @deprecated since 5.2.1 + * @see PIXI.Prepare + */ + Prepare: { + get: function () { + deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare'); + return PIXI.Prepare; + }, + }, + /** + * @class PIXI.prepare.CanvasPrepare + * @deprecated since 5.2.1 + * @see PIXI.CanvasPrepare + */ + CanvasPrepare: { + get: function () { + deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare'); + return PIXI.CanvasPrepare; + }, + }, + }); + /** + * @namespace PIXI.extract + * @see PIXI + * @deprecated since 5.2.1 + */ + PIXI.extract = {}; + Object.defineProperties(PIXI.extract, { + /** + * @class PIXI.extract.Extract + * @deprecated since 5.2.1 + * @see PIXI.Extract + */ + Extract: { + get: function () { + deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract'); + return PIXI.Extract; + }, + }, + /** + * @class PIXI.extract.CanvasExtract + * @deprecated since 5.2.1 + * @see PIXI.CanvasExtract + */ + CanvasExtract: { + get: function () { + deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract'); + return PIXI.CanvasExtract; + }, + }, + }); + /** + * This namespace has been removed. All classes previous nested + * under this namespace have been moved to the top-level `PIXI` object. + * @namespace PIXI.extras + * @deprecated since 5.0.0 + */ + PIXI.extras = {}; + Object.defineProperties(PIXI.extras, { + /** + * @class PIXI.extras.TilingSprite + * @see PIXI.TilingSprite + * @deprecated since 5.0.0 + */ + TilingSprite: { + get: function () { + deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite'); + return PIXI.TilingSprite; + }, + }, + /** + * @class PIXI.extras.TilingSpriteRenderer + * @see PIXI.TilingSpriteRenderer + * @deprecated since 5.0.0 + */ + TilingSpriteRenderer: { + get: function () { + deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer'); + return PIXI.TilingSpriteRenderer; + }, + }, + /** + * @class PIXI.extras.AnimatedSprite + * @see PIXI.AnimatedSprite + * @deprecated since 5.0.0 + */ + AnimatedSprite: { + get: function () { + deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite'); + return PIXI.AnimatedSprite; + }, + }, + /** + * @class PIXI.extras.BitmapText + * @see PIXI.BitmapText + * @deprecated since 5.0.0 + */ + BitmapText: { + get: function () { + deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText'); + return PIXI.BitmapText; + }, + }, + }); + /** + * @static + * @method PIXI.TilingSprite.fromFrame + * @deprecated since 5.3.0 + * @see PIXI.TilingSprite.from + */ + PIXI.TilingSprite.fromFrame = function fromFrame(frameId, width, height) { + deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from'); + return PIXI.TilingSprite.from(frameId, { width: width, height: height }); + }; + /** + * @static + * @method PIXI.TilingSprite.fromImage + * @deprecated since 5.3.0 + * @see PIXI.TilingSprite.from + */ + PIXI.TilingSprite.fromImage = function fromImage(imageId, width, height, options) { + if (options === void 0) { options = {}; } + deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from'); + // Fallback support for crossorigin, scaleMode parameters + if (options && typeof options !== 'object') { + options = { + // eslint-disable-next-line prefer-rest-params + scaleMode: arguments[4], + resourceOptions: { + // eslint-disable-next-line prefer-rest-params + crossorigin: arguments[3], + }, + }; + } + options.width = width; + options.height = height; + return PIXI.TilingSprite.from(imageId, options); + }; + Object.defineProperties(PIXI.utils, { + /** + * @function PIXI.utils.getSvgSize + * @see PIXI.resources.SVGResource.getSize + * @deprecated since 5.0.0 + */ + getSvgSize: { + get: function () { + deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize'); + return PIXI.resources.SVGResource.getSize; + }, + }, + }); + /** + * All classes on this namespace have moved to the high-level `PIXI` object. + * @namespace PIXI.mesh + * @deprecated since 5.0.0 + */ + PIXI.mesh = {}; + Object.defineProperties(PIXI.mesh, { + /** + * @class PIXI.mesh.Mesh + * @see PIXI.SimpleMesh + * @deprecated since 5.0.0 + */ + Mesh: { + get: function () { + deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh'); + return PIXI.SimpleMesh; + }, + }, + /** + * @class PIXI.mesh.NineSlicePlane + * @see PIXI.NineSlicePlane + * @deprecated since 5.0.0 + */ + NineSlicePlane: { + get: function () { + deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane'); + return PIXI.NineSlicePlane; + }, + }, + /** + * @class PIXI.mesh.Plane + * @see PIXI.SimplePlane + * @deprecated since 5.0.0 + */ + Plane: { + get: function () { + deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane'); + return PIXI.SimplePlane; + }, + }, + /** + * @class PIXI.mesh.Rope + * @see PIXI.SimpleRope + * @deprecated since 5.0.0 + */ + Rope: { + get: function () { + deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope'); + return PIXI.SimpleRope; + }, + }, + /** + * @class PIXI.mesh.RawMesh + * @see PIXI.Mesh + * @deprecated since 5.0.0 + */ + RawMesh: { + get: function () { + deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh'); + return PIXI.Mesh; + }, + }, + /** + * @class PIXI.mesh.CanvasMeshRenderer + * @see PIXI.CanvasMeshRenderer + * @deprecated since 5.0.0 + */ + CanvasMeshRenderer: { + get: function () { + deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer'); + return PIXI.CanvasMeshRenderer; + }, + }, + /** + * @class PIXI.mesh.MeshRenderer + * @see PIXI.MeshRenderer + * @deprecated since 5.0.0 + */ + MeshRenderer: { + get: function () { + deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer'); + return PIXI.MeshRenderer; + }, + }, + }); + /** + * This namespace has been removed and items have been moved to + * the top-level `PIXI` object. + * @namespace PIXI.particles + * @deprecated since 5.0.0 + */ + PIXI.particles = {}; + Object.defineProperties(PIXI.particles, { + /** + * @class PIXI.particles.ParticleContainer + * @deprecated since 5.0.0 + * @see PIXI.ParticleContainer + */ + ParticleContainer: { + get: function () { + deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer'); + return PIXI.ParticleContainer; + }, + }, + /** + * @class PIXI.particles.ParticleRenderer + * @deprecated since 5.0.0 + * @see PIXI.ParticleRenderer + */ + ParticleRenderer: { + get: function () { + deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer'); + return PIXI.ParticleRenderer; + }, + }, + }); + /** + * This namespace has been removed and items have been moved to + * the top-level `PIXI` object. + * @namespace PIXI.ticker + * @deprecated since 5.0.0 + */ + PIXI.ticker = {}; + Object.defineProperties(PIXI.ticker, { + /** + * @class PIXI.ticker.Ticker + * @deprecated since 5.0.0 + * @see PIXI.Ticker + */ + Ticker: { + get: function () { + deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker'); + return PIXI.Ticker; + }, + }, + /** + * @name PIXI.ticker.shared + * @type {PIXI.Ticker} + * @deprecated since 5.0.0 + * @see PIXI.Ticker.shared + */ + shared: { + get: function () { + deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared'); + return PIXI.Ticker.shared; + }, + }, + }); + /** + * All classes on this namespace have moved to the high-level `PIXI` object. + * @namespace PIXI.loaders + * @deprecated since 5.0.0 + */ + PIXI.loaders = {}; + Object.defineProperties(PIXI.loaders, { + /** + * @class PIXI.loaders.Loader + * @see PIXI.Loader + * @deprecated since 5.0.0 + */ + Loader: { + get: function () { + deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader'); + return PIXI.Loader; + }, + }, + /** + * @class PIXI.loaders.Resource + * @see PIXI.LoaderResource + * @deprecated since 5.0.0 + */ + Resource: { + get: function () { + deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource'); + return PIXI.LoaderResource; + }, + }, + /** + * @function PIXI.loaders.bitmapFontParser + * @see PIXI.BitmapFontLoader.use + * @deprecated since 5.0.0 + */ + bitmapFontParser: { + get: function () { + deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use'); + return PIXI.BitmapFontLoader.use; + }, + }, + /** + * @function PIXI.loaders.parseBitmapFontData + * @deprecated since 5.0.0 + */ + parseBitmapFontData: { + get: function () { + deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed'); + }, + }, + /** + * @function PIXI.loaders.spritesheetParser + * @see PIXI.SpritesheetLoader.use + * @deprecated since 5.0.0 + */ + spritesheetParser: { + get: function () { + deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use'); + return PIXI.SpritesheetLoader.use; + }, + }, + /** + * @function PIXI.loaders.getResourcePath + * @see PIXI.SpritesheetLoader.getResourcePath + * @deprecated since 5.0.0 + */ + getResourcePath: { + get: function () { + deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath'); + return PIXI.SpritesheetLoader.getResourcePath; + }, + }, + }); + /** + * @function PIXI.loaders.Loader.addPixiMiddleware + * @see PIXI.Loader.registerPlugin + * @deprecated since 5.0.0 + * @param {function} middleware + */ + PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware) { + deprecation(v5, 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'); + return PIXI.loaders.Loader.registerPlugin({ use: middleware() }); + }; + // convenience for converting event name to signal name + var eventToSignal = function (event) { + return "on" + event.charAt(0).toUpperCase() + event.slice(1); + }; + Object.assign(PIXI.Loader.prototype, { + /** + * Use the corresponding signal, e.g., event `start`` is signal `onStart`. + * @method PIXI.Loader#on + * @deprecated since 5.0.0 + */ + on: function (event) { + var signal = eventToSignal(event); + deprecation(v5, "PIXI.Loader#on is completely deprecated, use PIXI.Loader#" + signal + ".add"); + }, + /** + * Use the corresponding signal, e.g., event `start`` is signal `onStart`. + * @method PIXI.Loader#once + * @deprecated since 5.0.0 + */ + once: function (event) { + var signal = eventToSignal(event); + deprecation(v5, "PIXI.Loader#once is completely deprecated, use PIXI.Loader#" + signal + ".once"); + }, + /** + * Use the corresponding signal, e.g., event `start`` is signal `onStart`. + * @method PIXI.Loader#off + * @deprecated since 5.0.0 + */ + off: function (event) { + var signal = eventToSignal(event); + deprecation(v5, "PIXI.Loader#off is completely deprecated, use PIXI.Loader#" + signal + ".detach"); + }, + }); + /** + * @class PIXI.extract.WebGLExtract + * @deprecated since 5.0.0 + * @see PIXI.Extract + */ + Object.defineProperty(PIXI.extract, 'WebGLExtract', { + get: function () { + deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract'); + return PIXI.Extract; + }, + }); + /** + * @class PIXI.prepare.WebGLPrepare + * @deprecated since 5.0.0 + * @see PIXI.Prepare + */ + Object.defineProperty(PIXI.prepare, 'WebGLPrepare', { + get: function () { + deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare'); + return PIXI.Prepare; + }, + }); + /** + * @method PIXI.Container#_renderWebGL + * @private + * @deprecated since 5.0.0 + * @see PIXI.Container#render + * @param {PIXI.Renderer} renderer Instance of renderer + */ + PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer) { + deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render'); + this._render(renderer); + }; + /** + * @method PIXI.Container#renderWebGL + * @deprecated since 5.0.0 + * @see PIXI.Container#render + * @param {PIXI.Renderer} renderer Instance of renderer + */ + PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer) { + deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render'); + this.render(renderer); + }; + /** + * @method PIXI.DisplayObject#renderWebGL + * @deprecated since 5.0.0 + * @see PIXI.DisplayObject#render + * @param {PIXI.Renderer} renderer Instance of renderer + */ + PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) { + deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render'); + this.render(renderer); + }; + /** + * @method PIXI.Container#renderAdvancedWebGL + * @deprecated since 5.0.0 + * @see PIXI.Container#renderAdvanced + * @param {PIXI.Renderer} renderer Instance of renderer + */ + PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) { + deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced'); + this.renderAdvanced(renderer); + }; + Object.defineProperties(PIXI.settings, { + /** + * Default transform type. + * + * @static + * @deprecated since 5.0.0 + * @memberof PIXI.settings + * @type {PIXI.TRANSFORM_MODE} + * @default PIXI.TRANSFORM_MODE.STATIC + */ + TRANSFORM_MODE: { + get: function () { + deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); + return 0; + }, + set: function () { + deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); + }, + }, + }); + var BaseTextureAny = PIXI.BaseTexture; + /** + * @method loadSource + * @memberof PIXI.BaseTexture# + * @deprecated since 5.0.0 + */ + BaseTextureAny.prototype.loadSource = function loadSource(image) { + deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated'); + var resource = PIXI.resources.autoDetectResource(image); + resource.internal = true; + this.setResource(resource); + this.update(); + }; + var baseTextureIdDeprecation = false; + Object.defineProperties(BaseTextureAny.prototype, { + /** + * @name PIXI.BaseTexture#hasLoaded + * @type {boolean} + * @deprecated since 5.0.0 + * @readonly + * @see PIXI.BaseTexture#valid + */ + hasLoaded: { + get: function () { + deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid'); + return this.valid; + }, + }, + /** + * @name PIXI.BaseTexture#imageUrl + * @type {string} + * @deprecated since 5.0.0 + * @see PIXI.resources.ImageResource#url + */ + imageUrl: { + get: function () { + var _a; + deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); + return (_a = this.resource) === null || _a === void 0 ? void 0 : _a.url; + }, + set: function (imageUrl) { + deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); + if (this.resource) { + this.resource.url = imageUrl; + } + }, + }, + /** + * @name PIXI.BaseTexture#source + * @type {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} + * @deprecated since 5.0.0 + * @readonly + * @see PIXI.resources.BaseImageResource#source + */ + source: { + get: function () { + deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`'); + return this.resource.source; + }, + set: function (source) { + deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` ' + + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.'); + if (this.resource) { + this.resource.source = source; + } + }, + }, + /** + * @name PIXI.BaseTexture#premultiplyAlpha + * @type {boolean} + * @deprecated since 5.2.0 + * @readonly + * @see PIXI.BaseTexture#alphaMode + */ + premultiplyAlpha: { + get: function () { + deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' + + ', see `PIXI.ALPHA_MODES`'); + return this.alphaMode !== 0; + }, + set: function (value) { + deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' + + ', see `PIXI.ALPHA_MODES`'); + this.alphaMode = Number(value); + }, + }, + /** + * Batch local field, stores current texture location + * + * @name PIXI.BaseTexture#_id + * @deprecated since 5.2.0 + * @type {number} + * @see PIXI.BaseTexture#_batchLocation + */ + _id: { + get: function () { + if (!baseTextureIdDeprecation) { + // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible + deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`'); + baseTextureIdDeprecation = true; + } + return this._batchLocation; + }, + set: function (value) { + this._batchLocation = value; + }, + }, + }); + /** + * @method fromImage + * @static + * @memberof PIXI.BaseTexture + * @deprecated since 5.0.0 + * @see PIXI.BaseTexture.from + */ + BaseTextureAny.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale) { + deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from'); + var resourceOptions = { scale: scale, crossorigin: crossorigin }; + return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); + }; + /** + * @method fromCanvas + * @static + * @memberof PIXI.BaseTexture + * @deprecated since 5.0.0 + * @see PIXI.BaseTexture.from + */ + BaseTextureAny.fromCanvas = function fromCanvas(canvas, scaleMode) { + deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from'); + return BaseTextureAny.from(canvas, { scaleMode: scaleMode }); + }; + /** + * @method fromSVG + * @static + * @memberof PIXI.BaseTexture + * @deprecated since 5.0.0 + * @see PIXI.BaseTexture.from + */ + BaseTextureAny.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale) { + deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from'); + var resourceOptions = { scale: scale, crossorigin: crossorigin }; + return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); + }; + Object.defineProperties(PIXI.resources.ImageResource.prototype, { + /** + * @name PIXI.resources.ImageResource#premultiplyAlpha + * @type {boolean} + * @deprecated since 5.2.0 + * @readonly + * @see PIXI.resources.ImageResource#alphaMode + */ + premultiplyAlpha: { + get: function () { + deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' + + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); + return this.alphaMode !== 0; + }, + set: function (value) { + deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' + + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); + this.alphaMode = Number(value); + }, + }, + }); + /** + * @method PIXI.Point#copy + * @deprecated since 5.0.0 + * @see PIXI.Point#copyFrom + */ + PIXI.Point.prototype.copy = function copy(p) { + deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom'); + return this.copyFrom(p); + }; + /** + * @method PIXI.ObservablePoint#copy + * @deprecated since 5.0.0 + * @see PIXI.ObservablePoint#copyFrom + */ + PIXI.ObservablePoint.prototype.copy = function copy(p) { + deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom'); + return this.copyFrom(p); + }; + /** + * @method PIXI.Rectangle#copy + * @deprecated since 5.0.0 + * @see PIXI.Rectangle#copyFrom + */ + PIXI.Rectangle.prototype.copy = function copy(p) { + deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom'); + return this.copyFrom(p); + }; + /** + * @method PIXI.Matrix#copy + * @deprecated since 5.0.0 + * @see PIXI.Matrix#copyTo + */ + PIXI.Matrix.prototype.copy = function copy(p) { + deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo'); + return this.copyTo(p); + }; + /** + * @method PIXI.systems.StateSystem#setState + * @deprecated since 5.1.0 + * @see PIXI.systems.StateSystem#set + */ + PIXI.systems.StateSystem.prototype.setState = function setState(s) { + deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set'); + return this.set(s); + }; + Object.assign(PIXI.systems.FilterSystem.prototype, { + /** + * @method PIXI.FilterManager#getRenderTarget + * @deprecated since 5.0.0 + * @see PIXI.systems.FilterSystem#getFilterTexture + */ + getRenderTarget: function (_clear, resolution) { + deprecation(v5, 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'); + return this.getFilterTexture(null, resolution); + }, + /** + * @method PIXI.FilterManager#returnRenderTarget + * @deprecated since 5.0.0 + * @see PIXI.systems.FilterSystem#returnFilterTexture + */ + returnRenderTarget: function (renderTexture) { + deprecation(v5, 'PIXI.FilterManager.returnRenderTarget method has been replaced with ' + + 'PIXI.systems.FilterSystem.returnFilterTexture'); + this.returnFilterTexture(renderTexture); + }, + /** + * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix + * @deprecated since 5.0.0 + * @param {PIXI.Matrix} outputMatrix - the matrix to output to. + * @return {PIXI.Matrix} The mapped matrix. + */ + calculateScreenSpaceMatrix: function (outputMatrix) { + deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, ' + + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead'); + var mappedMatrix = outputMatrix.identity(); + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); + mappedMatrix.scale(destinationFrame.width, destinationFrame.height); + return mappedMatrix; + }, + /** + * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix + * @deprecated since 5.0.0 + * @param {PIXI.Matrix} outputMatrix - The matrix to output to. + * @return {PIXI.Matrix} The mapped matrix. + */ + calculateNormalizedScreenSpaceMatrix: function (outputMatrix) { + deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, ' + + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.'); + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var mappedMatrix = outputMatrix.identity(); + mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); + var translateScaleX = (destinationFrame.width / sourceFrame.width); + var translateScaleY = (destinationFrame.height / sourceFrame.height); + mappedMatrix.scale(translateScaleX, translateScaleY); + return mappedMatrix; + }, + }); + Object.defineProperties(PIXI.RenderTexture.prototype, { + /** + * @name PIXI.RenderTexture#sourceFrame + * @type {PIXI.Rectangle} + * @deprecated since 5.0.0 + * @readonly + */ + sourceFrame: { + get: function () { + deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed'); + return this.filterFrame; + }, + }, + /** + * @name PIXI.RenderTexture#size + * @type {PIXI.Rectangle} + * @deprecated since 5.0.0 + * @readonly + */ + size: { + get: function () { + deprecation(v5, 'PIXI.RenderTexture.size property has been removed'); + return this._frame; + }, + }, + }); + /** + * @class BlurXFilter + * @memberof PIXI.filters + * @deprecated since 5.0.0 + * @see PIXI.filters.BlurFilterPass + */ + var BlurXFilter = /** @class */ (function (_super) { + __extends$i(BlurXFilter, _super); + function BlurXFilter(strength, quality, resolution, kernelSize) { + var _this = this; + deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass'); + _this = _super.call(this, true, strength, quality, resolution, kernelSize) || this; + return _this; + } + return BlurXFilter; + }(PIXI.filters.BlurFilterPass)); + /** + * @class BlurYFilter + * @memberof PIXI.filters + * @deprecated since 5.0.0 + * @see PIXI.filters.BlurFilterPass + */ + var BlurYFilter = /** @class */ (function (_super) { + __extends$i(BlurYFilter, _super); + function BlurYFilter(strength, quality, resolution, kernelSize) { + var _this = this; + deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass'); + _this = _super.call(this, false, strength, quality, resolution, kernelSize) || this; + return _this; + } + return BlurYFilter; + }(PIXI.filters.BlurFilterPass)); + Object.assign(PIXI.filters, { + BlurXFilter: BlurXFilter, + BlurYFilter: BlurYFilter, + }); + var SpriteAny = PIXI.Sprite, TextureAny = PIXI.Texture, GraphicsAny = PIXI.Graphics; + // Support for pixi.js-legacy bifurcation + // give users a friendly assist to use legacy + if (!GraphicsAny.prototype.generateCanvasTexture) { + GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture() { + deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in "pixi.js-legacy"'); + }; + } + /** + * @deprecated since 5.0.0 + * @member {PIXI.Graphics} PIXI.Graphics#graphicsData + * @see PIXI.Graphics#geometry + * @readonly + */ + Object.defineProperty(GraphicsAny.prototype, 'graphicsData', { + get: function () { + deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData'); + return this.geometry.graphicsData; + }, + }); + // Use these to deprecate all the Sprite from* methods + function spriteFrom(name, source, crossorigin, scaleMode) { + deprecation(v5, "PIXI.Sprite." + name + " method is deprecated, use PIXI.Sprite.from"); + return SpriteAny.from(source, { + resourceOptions: { + scale: scaleMode, + crossorigin: crossorigin, + }, + }); + } + /** + * @deprecated since 5.0.0 + * @see PIXI.Sprite.from + * @method PIXI.Sprite.fromImage + * @return {PIXI.Sprite} + */ + SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Sprite.fromSVG + * @see PIXI.Sprite.from + * @return {PIXI.Sprite} + */ + SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Sprite.fromCanvas + * @see PIXI.Sprite.from + * @return {PIXI.Sprite} + */ + SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Sprite.fromVideo + * @see PIXI.Sprite.from + * @return {PIXI.Sprite} + */ + SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Sprite.fromFrame + * @see PIXI.Sprite.from + * @return {PIXI.Sprite} + */ + SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame'); + // Use these to deprecate all the Texture from* methods + function textureFrom(name, source, crossorigin, scaleMode) { + deprecation(v5, "PIXI.Texture." + name + " method is deprecated, use PIXI.Texture.from"); + return TextureAny.from(source, { + resourceOptions: { + scale: scaleMode, + crossorigin: crossorigin, + }, + }); + } + /** + * @deprecated since 5.0.0 + * @method PIXI.Texture.fromImage + * @see PIXI.Texture.from + * @return {PIXI.Texture} + */ + TextureAny.fromImage = textureFrom.bind(null, 'fromImage'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Texture.fromSVG + * @see PIXI.Texture.from + * @return {PIXI.Texture} + */ + TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Texture.fromCanvas + * @see PIXI.Texture.from + * @return {PIXI.Texture} + */ + TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Texture.fromVideo + * @see PIXI.Texture.from + * @return {PIXI.Texture} + */ + TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo'); + /** + * @deprecated since 5.0.0 + * @method PIXI.Texture.fromFrame + * @see PIXI.Texture.from + * @return {PIXI.Texture} + */ + TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame'); + /** + * @deprecated since 5.0.0 + * @member {boolean} PIXI.AbstractRenderer#autoResize + * @see PIXI.AbstractRenderer#autoDensity + */ + Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', { + get: function () { + deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' + + 'use PIXI.AbstractRenderer.autoDensity'); + return this.autoDensity; + }, + set: function (value) { + deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' + + 'use PIXI.AbstractRenderer.autoDensity'); + this.autoDensity = value; + }, + }); + /** + * @deprecated since 5.0.0 + * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager + * @see PIXI.Renderer#texture + */ + Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', { + get: function () { + deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture'); + return this.texture; + }, + }); + /** + * @namespace PIXI.utils.mixins + * @deprecated since 5.0.0 + */ + PIXI.utils.mixins = { + /** + * @memberof PIXI.utils.mixins + * @function mixin + * @deprecated since 5.0.0 + */ + mixin: function () { + deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available'); + }, + /** + * @memberof PIXI.utils.mixins + * @function delayMixin + * @deprecated since 5.0.0 + */ + delayMixin: function () { + deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available'); + }, + /** + * @memberof PIXI.utils.mixins + * @function performMixins + * @deprecated since 5.0.0 + */ + performMixins: function () { + deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available'); + }, + }; + /** + * @memberof PIXI.BitmapText + * @member {object} font + * @deprecated since 5.3.0 + */ + Object.defineProperty(PIXI.BitmapText.prototype, 'font', { + get: function () { + deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' + + 'use fontName, fontSize, tint or align properties'); + return { + name: this._fontName, + size: this._fontSize, + tint: this._tint, + align: this._align, + }; + }, + set: function (value) { + deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' + + 'use fontName, fontSize, tint or align properties'); + if (!value) { + return; + } + var style = { font: value }; + this._upgradeStyle(style); + style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size; + this._fontName = style.fontName; + this._fontSize = style.fontSize; + this.dirty = true; + }, + }); + } + + /*! + * @pixi/mesh-extras - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/mesh-extras is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$j = function(d, b) { + extendStatics$j = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$j(d, b); + }; + + function __extends$j(d, b) { + extendStatics$j(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var PlaneGeometry = /** @class */ (function (_super) { + __extends$j(PlaneGeometry, _super); + function PlaneGeometry(width, height, segWidth, segHeight) { + if (width === void 0) { width = 100; } + if (height === void 0) { height = 100; } + if (segWidth === void 0) { segWidth = 10; } + if (segHeight === void 0) { segHeight = 10; } + var _this = _super.call(this) || this; + _this.segWidth = segWidth; + _this.segHeight = segHeight; + _this.width = width; + _this.height = height; + _this.build(); + return _this; + } + /** + * Refreshes plane coordinates + * @private + */ + PlaneGeometry.prototype.build = function () { + var total = this.segWidth * this.segHeight; + var verts = []; + var uvs = []; + var indices = []; + var segmentsX = this.segWidth - 1; + var segmentsY = this.segHeight - 1; + var sizeX = (this.width) / segmentsX; + var sizeY = (this.height) / segmentsY; + for (var i = 0; i < total; i++) { + var x = (i % this.segWidth); + var y = ((i / this.segWidth) | 0); + verts.push(x * sizeX, y * sizeY); + uvs.push(x / segmentsX, y / segmentsY); + } + var totalSub = segmentsX * segmentsY; + for (var i = 0; i < totalSub; i++) { + var xpos = i % segmentsX; + var ypos = (i / segmentsX) | 0; + var value = (ypos * this.segWidth) + xpos; + var value2 = (ypos * this.segWidth) + xpos + 1; + var value3 = ((ypos + 1) * this.segWidth) + xpos; + var value4 = ((ypos + 1) * this.segWidth) + xpos + 1; + indices.push(value, value2, value3, value2, value4, value3); + } + this.buffers[0].data = new Float32Array(verts); + this.buffers[1].data = new Float32Array(uvs); + this.indexBuffer.data = new Uint16Array(indices); + // ensure that the changes are uploaded + this.buffers[0].update(); + this.buffers[1].update(); + this.indexBuffer.update(); + }; + return PlaneGeometry; + }(MeshGeometry)); + + /** + * RopeGeometry allows you to draw a geometry across several points and then manipulate these points. + * + * ```js + * for (let i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * const rope = new PIXI.RopeGeometry(100, points); + * ``` + * + * @class + * @extends PIXI.MeshGeometry + * @memberof PIXI + * + */ + var RopeGeometry = /** @class */ (function (_super) { + __extends$j(RopeGeometry, _super); + /** + * @param {number} [width=200] - The width (i.e., thickness) of the rope. + * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope. + * @param {number} [textureScale=0] - By default the rope texture will be stretched to match + * rope length. If textureScale is positive this value will be treated as a scaling + * factor and the texture will preserve its aspect ratio instead. To create a tiling rope + * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture, + * then set textureScale=1 to keep the original texture pixel size. + * In order to reduce alpha channel artifacts provide a larger texture and downsample - + * i.e. set textureScale=0.5 to scale it down twice. + */ + function RopeGeometry(width, points, textureScale) { + if (width === void 0) { width = 200; } + if (textureScale === void 0) { textureScale = 0; } + var _this = _super.call(this, new Float32Array(points.length * 4), new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)) || this; + /** + * An array of points that determine the rope + * @member {PIXI.Point[]} + */ + _this.points = points; + /** + * The width (i.e., thickness) of the rope. + * @member {number} + * @readOnly + */ + _this._width = width; + /** + * Rope texture scale, if zero then the rope texture is stretched. + * @member {number} + * @readOnly + */ + _this.textureScale = textureScale; + _this.build(); + return _this; + } + Object.defineProperty(RopeGeometry.prototype, "width", { + /** + * The width (i.e., thickness) of the rope. + * @member {number} + * @readOnly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); + /** + * Refreshes Rope indices and uvs + * @private + */ + RopeGeometry.prototype.build = function () { + var points = this.points; + if (!points) + { return; } + var vertexBuffer = this.getBuffer('aVertexPosition'); + var uvBuffer = this.getBuffer('aTextureCoord'); + var indexBuffer = this.getIndex(); + // if too little points, or texture hasn't got UVs set yet just move on. + if (points.length < 1) { + return; + } + // if the number of points has changed we will need to recreate the arraybuffers + if (vertexBuffer.data.length / 4 !== points.length) { + vertexBuffer.data = new Float32Array(points.length * 4); + uvBuffer.data = new Float32Array(points.length * 4); + indexBuffer.data = new Uint16Array((points.length - 1) * 6); + } + var uvs = uvBuffer.data; + var indices = indexBuffer.data; + uvs[0] = 0; + uvs[1] = 0; + uvs[2] = 0; + uvs[3] = 1; + var amount = 0; + var prev = points[0]; + var textureWidth = this._width * this.textureScale; + var total = points.length; // - 1; + for (var i = 0; i < total; i++) { + // time to do some smart drawing! + var index = i * 4; + if (this.textureScale > 0) { + // calculate pixel distance from previous point + var dx = prev.x - points[i].x; + var dy = prev.y - points[i].y; + var distance = Math.sqrt((dx * dx) + (dy * dy)); + prev = points[i]; + amount += distance / textureWidth; + } + else { + // stretch texture + amount = i / (total - 1); + } + uvs[index] = amount; + uvs[index + 1] = 0; + uvs[index + 2] = amount; + uvs[index + 3] = 1; + } + var indexCount = 0; + for (var i = 0; i < total - 1; i++) { + var index = i * 2; + indices[indexCount++] = index; + indices[indexCount++] = index + 1; + indices[indexCount++] = index + 2; + indices[indexCount++] = index + 2; + indices[indexCount++] = index + 1; + indices[indexCount++] = index + 3; + } + // ensure that the changes are uploaded + uvBuffer.update(); + indexBuffer.update(); + this.updateVertices(); + }; + /** + * refreshes vertices of Rope mesh + */ + RopeGeometry.prototype.updateVertices = function () { + var points = this.points; + if (points.length < 1) { + return; + } + var lastPoint = points[0]; + var nextPoint; + var perpX = 0; + var perpY = 0; + var vertices = this.buffers[0].data; + var total = points.length; + for (var i = 0; i < total; i++) { + var point = points[i]; + var index = i * 4; + if (i < points.length - 1) { + nextPoint = points[i + 1]; + } + else { + nextPoint = point; + } + perpY = -(nextPoint.x - lastPoint.x); + perpX = nextPoint.y - lastPoint.y; + var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY)); + var num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2; + perpX /= perpLength; + perpY /= perpLength; + perpX *= num; + perpY *= num; + vertices[index] = point.x + perpX; + vertices[index + 1] = point.y + perpY; + vertices[index + 2] = point.x - perpX; + vertices[index + 3] = point.y - perpY; + lastPoint = point; + } + this.buffers[0].update(); + }; + RopeGeometry.prototype.update = function () { + if (this.textureScale > 0) { + this.build(); // we need to update UVs + } + else { + this.updateVertices(); + } + }; + return RopeGeometry; + }(MeshGeometry)); + + /** + * The rope allows you to draw a texture across several points and then manipulate these points + * + *```js + * for (let i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * let rope = new PIXI.SimpleRope(PIXI.Texture.from("snake.png"), points); + * ``` + * + * @class + * @extends PIXI.Mesh + * @memberof PIXI + * + */ + var SimpleRope = /** @class */ (function (_super) { + __extends$j(SimpleRope, _super); + /** + * @param {PIXI.Texture} texture - The texture to use on the rope. + * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope. + * @param {number} [textureScale=0] - Optional. Positive values scale rope texture + * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture + * and downsampling here. If set to zero, texture will be streched instead. + */ + function SimpleRope(texture, points, textureScale) { + if (textureScale === void 0) { textureScale = 0; } + var _this = this; + var ropeGeometry = new RopeGeometry(texture.height, points, textureScale); + var meshMaterial = new MeshMaterial(texture); + if (textureScale > 0) { + // attempt to set UV wrapping, will fail on non-power of two textures + texture.baseTexture.wrapMode = exports.WRAP_MODES.REPEAT; + } + _this = _super.call(this, ropeGeometry, meshMaterial) || this; + /** + * re-calculate vertices by rope points each frame + * + * @member {boolean} + */ + _this.autoUpdate = true; + return _this; + } + SimpleRope.prototype._render = function (renderer) { + var geometry = this.geometry; + if (this.autoUpdate || geometry._width !== this.shader.texture.height) { + geometry._width = this.shader.texture.height; + geometry.update(); + } + _super.prototype._render.call(this, renderer); + }; + return SimpleRope; + }(Mesh)); + + /** + * The SimplePlane allows you to draw a texture across several points and then manipulate these points + * + *```js + * for (let i = 0; i < 20; i++) { + * points.push(new PIXI.Point(i * 50, 0)); + * }; + * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from("snake.png"), points); + * ``` + * + * @class + * @extends PIXI.Mesh + * @memberof PIXI + * + */ + var SimplePlane = /** @class */ (function (_super) { + __extends$j(SimplePlane, _super); + /** + * @param {PIXI.Texture} texture - The texture to use on the SimplePlane. + * @param {number} verticesX - The number of vertices in the x-axis + * @param {number} verticesY - The number of vertices in the y-axis + */ + function SimplePlane(texture, verticesX, verticesY) { + var _this = this; + var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY); + var meshMaterial = new MeshMaterial(Texture.WHITE); + _this = _super.call(this, planeGeometry, meshMaterial) || this; + // lets call the setter to ensure all necessary updates are performed + _this.texture = texture; + return _this; + } + /** + * Method used for overrides, to do something in case texture frame was changed. + * Meshes based on plane can override it and change more details based on texture. + */ + SimplePlane.prototype.textureUpdated = function () { + this._textureID = this.shader.texture._updateID; + var geometry = this.geometry; + geometry.width = this.shader.texture.width; + geometry.height = this.shader.texture.height; + geometry.build(); + }; + Object.defineProperty(SimplePlane.prototype, "texture", { + get: function () { + return this.shader.texture; + }, + set: function (value) { + // Track texture same way sprite does. + // For generated meshes like NineSlicePlane it can change the geometry. + // Unfortunately, this method might not work if you directly change texture in material. + if (this.shader.texture === value) { + return; + } + this.shader.texture = value; + this._textureID = -1; + if (value.baseTexture.valid) { + this.textureUpdated(); + } + else { + value.once('update', this.textureUpdated, this); + } + }, + enumerable: false, + configurable: true + }); + SimplePlane.prototype._render = function (renderer) { + if (this._textureID !== this.shader.texture._updateID) { + this.textureUpdated(); + } + _super.prototype._render.call(this, renderer); + }; + SimplePlane.prototype.destroy = function (options) { + this.shader.texture.off('update', this.textureUpdated, this); + _super.prototype.destroy.call(this, options); + }; + return SimplePlane; + }(Mesh)); + + /** + * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments. + * For more robust customization, use {@link PIXI.Mesh}. + * + * @class + * @extends PIXI.Mesh + * @memberof PIXI + */ + var SimpleMesh = /** @class */ (function (_super) { + __extends$j(SimpleMesh, _super); + /** + * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use + * @param {Float32Array} [vertices] - if you want to specify the vertices + * @param {Float32Array} [uvs] - if you want to specify the uvs + * @param {Uint16Array} [indices] - if you want to specify the indices + * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts + */ + function SimpleMesh(texture, vertices, uvs, indices, drawMode) { + if (texture === void 0) { texture = Texture.EMPTY; } + var _this = this; + var geometry = new MeshGeometry(vertices, uvs, indices); + geometry.getBuffer('aVertexPosition').static = false; + var meshMaterial = new MeshMaterial(texture); + _this = _super.call(this, geometry, meshMaterial, null, drawMode) || this; + /** + * upload vertices buffer each frame + * @member {boolean} + */ + _this.autoUpdate = true; + return _this; + } + Object.defineProperty(SimpleMesh.prototype, "vertices", { + /** + * Collection of vertices data. + * @member {Float32Array} + */ + get: function () { + return this.geometry.getBuffer('aVertexPosition').data; + }, + set: function (value) { + this.geometry.getBuffer('aVertexPosition').data = value; + }, + enumerable: false, + configurable: true + }); + SimpleMesh.prototype._render = function (renderer) { + if (this.autoUpdate) { + this.geometry.getBuffer('aVertexPosition').update(); + } + _super.prototype._render.call(this, renderer); + }; + return SimpleMesh; + }(Mesh)); + + var DEFAULT_BORDER_SIZE = 10; + /** + * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful + * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically + * + *```js + * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15); + * ``` + *
+	 *      A                          B
+	 *    +---+----------------------+---+
+	 *  C | 1 |          2           | 3 |
+	 *    +---+----------------------+---+
+	 *    |   |                      |   |
+	 *    | 4 |          5           | 6 |
+	 *    |   |                      |   |
+	 *    +---+----------------------+---+
+	 *  D | 7 |          8           | 9 |
+	 *    +---+----------------------+---+
+
+	 *  When changing this objects width and/or height:
+	 *     areas 1 3 7 and 9 will remain unscaled.
+	 *     areas 2 and 8 will be stretched horizontally
+	 *     areas 4 and 6 will be stretched vertically
+	 *     area 5 will be stretched both horizontally and vertically
+	 * 
+ * + * @class + * @extends PIXI.SimplePlane + * @memberof PIXI + * + */ + var NineSlicePlane = /** @class */ (function (_super) { + __extends$j(NineSlicePlane, _super); + /** + * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. + * @param {number} [leftWidth=10] - size of the left vertical bar (A) + * @param {number} [topHeight=10] - size of the top horizontal bar (C) + * @param {number} [rightWidth=10] - size of the right vertical bar (B) + * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D) + */ + function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) { + if (leftWidth === void 0) { leftWidth = DEFAULT_BORDER_SIZE; } + if (topHeight === void 0) { topHeight = DEFAULT_BORDER_SIZE; } + if (rightWidth === void 0) { rightWidth = DEFAULT_BORDER_SIZE; } + if (bottomHeight === void 0) { bottomHeight = DEFAULT_BORDER_SIZE; } + var _this = _super.call(this, Texture.WHITE, 4, 4) || this; + _this._origWidth = texture.orig.width; + _this._origHeight = texture.orig.height; + /** + * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + * @override + */ + _this._width = _this._origWidth; + /** + * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + * @override + */ + _this._height = _this._origHeight; + /** + * The width of the left column (a) + * + * @member {number} + * @private + */ + _this._leftWidth = leftWidth; + /** + * The width of the right column (b) + * + * @member {number} + * @private + */ + _this._rightWidth = rightWidth; + /** + * The height of the top row (c) + * + * @member {number} + * @private + */ + _this._topHeight = topHeight; + /** + * The height of the bottom row (d) + * + * @member {number} + * @private + */ + _this._bottomHeight = bottomHeight; + // lets call the setter to ensure all necessary updates are performed + _this.texture = texture; + return _this; + } + NineSlicePlane.prototype.textureUpdated = function () { + this._textureID = this.shader.texture._updateID; + this._refresh(); + }; + Object.defineProperty(NineSlicePlane.prototype, "vertices", { + get: function () { + return this.geometry.getBuffer('aVertexPosition').data; + }, + set: function (value) { + this.geometry.getBuffer('aVertexPosition').data = value; + }, + enumerable: false, + configurable: true + }); + /** + * Updates the horizontal vertices. + * + */ + NineSlicePlane.prototype.updateHorizontalVertices = function () { + var vertices = this.vertices; + var scale = this._getMinScale(); + vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale; + vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale); + vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height; + }; + /** + * Updates the vertical vertices. + * + */ + NineSlicePlane.prototype.updateVerticalVertices = function () { + var vertices = this.vertices; + var scale = this._getMinScale(); + vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale; + vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale); + vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width; + }; + /** + * Returns the smaller of a set of vertical and horizontal scale of nine slice corners. + * + * @return {number} Smaller number of vertical and horizontal scale. + * @private + */ + NineSlicePlane.prototype._getMinScale = function () { + var w = this._leftWidth + this._rightWidth; + var scaleW = this._width > w ? 1.0 : this._width / w; + var h = this._topHeight + this._bottomHeight; + var scaleH = this._height > h ? 1.0 : this._height / h; + var scale = Math.min(scaleW, scaleH); + return scale; + }; + Object.defineProperty(NineSlicePlane.prototype, "width", { + /** + * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + */ + get: function () { + return this._width; + }, + set: function (value) { + this._width = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "height", { + /** + * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + */ + get: function () { + return this._height; + }, + set: function (value) { + this._height = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "leftWidth", { + /** + * The width of the left column + * + * @member {number} + */ + get: function () { + return this._leftWidth; + }, + set: function (value) { + this._leftWidth = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "rightWidth", { + /** + * The width of the right column + * + * @member {number} + */ + get: function () { + return this._rightWidth; + }, + set: function (value) { + this._rightWidth = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "topHeight", { + /** + * The height of the top row + * + * @member {number} + */ + get: function () { + return this._topHeight; + }, + set: function (value) { + this._topHeight = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "bottomHeight", { + /** + * The height of the bottom row + * + * @member {number} + */ + get: function () { + return this._bottomHeight; + }, + set: function (value) { + this._bottomHeight = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + /** + * Refreshes NineSlicePlane coords. All of them. + */ + NineSlicePlane.prototype._refresh = function () { + var texture = this.texture; + var uvs = this.geometry.buffers[1].data; + this._origWidth = texture.orig.width; + this._origHeight = texture.orig.height; + var _uvw = 1.0 / this._origWidth; + var _uvh = 1.0 / this._origHeight; + uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0; + uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0; + uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1; + uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1; + uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth; + uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth); + uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight; + uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight); + this.updateHorizontalVertices(); + this.updateVerticalVertices(); + this.geometry.buffers[0].update(); + this.geometry.buffers[1].update(); + }; + return NineSlicePlane; + }(SimplePlane)); + + /*! + * @pixi/sprite-animated - v5.3.12 + * Compiled Wed, 23 Mar 2022 18:38:07 UTC + * + * @pixi/sprite-animated is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$k = function(d, b) { + extendStatics$k = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$k(d, b); + }; + + function __extends$k(d, b) { + extendStatics$k(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. + * + * ```js + * let alienImages = ["image_sequence_01.png","image_sequence_02.png","image_sequence_03.png","image_sequence_04.png"]; + * let textureArray = []; + * + * for (let i=0; i < 4; i++) + * { + * let texture = PIXI.Texture.from(alienImages[i]); + * textureArray.push(texture); + * }; + * + * let animatedSprite = new PIXI.AnimatedSprite(textureArray); + * ``` + * + * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet} + * containing the animation definitions: + * + * ```js + * PIXI.Loader.shared.add("assets/spritesheet.json").load(setup); + * + * function setup() { + * let sheet = PIXI.Loader.shared.resources["assets/spritesheet.json"].spritesheet; + * animatedSprite = new PIXI.AnimatedSprite(sheet.animations["image_sequence"]); + * ... + * } + * ``` + * + * @class + * @extends PIXI.Sprite + * @memberof PIXI + */ + var AnimatedSprite = /** @class */ (function (_super) { + __extends$k(AnimatedSprite, _super); + /** + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * objects that make up the animation. + * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. + */ + function AnimatedSprite(textures, autoUpdate) { + if (autoUpdate === void 0) { autoUpdate = true; } + var _this = _super.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture) || this; + /** + * @type {PIXI.Texture[]} + * @private + */ + _this._textures = null; + /** + * @type {number[]} + * @private + */ + _this._durations = null; + /** + * `true` uses PIXI.Ticker.shared to auto update animation time. + * + * @type {boolean} + * @default true + * @private + */ + _this._autoUpdate = autoUpdate; + /** + * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time. + * + * @type {boolean} + * @default false + * @private + */ + _this._isConnectedToTicker = false; + /** + * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower. + * + * @member {number} + * @default 1 + */ + _this.animationSpeed = 1; + /** + * Whether or not the animate sprite repeats after playing. + * + * @member {boolean} + * @default true + */ + _this.loop = true; + /** + * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes. + * + * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools. + * Changing anchor for each frame allows to pin sprite origin to certain moving feature + * of the frame (e.g. left foot). + * + * Note: Enabling this will override any previously set `anchor` on each frame change. + * + * @member {boolean} + * @default false + */ + _this.updateAnchor = false; + /** + * User-assigned function to call when an AnimatedSprite finishes playing. + * + * @example + * animation.onComplete = function () { + * // finished! + * }; + * @member {Function} + */ + _this.onComplete = null; + /** + * User-assigned function to call when an AnimatedSprite changes which texture is being rendered. + * + * @example + * animation.onFrameChange = function () { + * // updated! + * }; + * @member {Function} + */ + _this.onFrameChange = null; + /** + * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and + * loops around to start again. + * + * @example + * animation.onLoop = function () { + * // looped! + * }; + * @member {Function} + */ + _this.onLoop = null; + /** + * Elapsed time since animation has been started, used internally to display current texture. + * + * @member {number} + * @private + */ + _this._currentTime = 0; + _this._playing = false; + /** + * The texture index that was displayed last time + * + * @member {number} + * @private + */ + _this._previousFrame = null; + _this.textures = textures; + return _this; + } + /** + * Stops the AnimatedSprite. + * + */ + AnimatedSprite.prototype.stop = function () { + if (!this._playing) { + return; + } + this._playing = false; + if (this._autoUpdate && this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + }; + /** + * Plays the AnimatedSprite. + * + */ + AnimatedSprite.prototype.play = function () { + if (this._playing) { + return; + } + this._playing = true; + if (this._autoUpdate && !this._isConnectedToTicker) { + Ticker.shared.add(this.update, this, exports.UPDATE_PRIORITY.HIGH); + this._isConnectedToTicker = true; + } + }; + /** + * Stops the AnimatedSprite and goes to a specific frame. + * + * @param {number} frameNumber - Frame index to stop at. + */ + AnimatedSprite.prototype.gotoAndStop = function (frameNumber) { + this.stop(); + var previousFrame = this.currentFrame; + this._currentTime = frameNumber; + if (previousFrame !== this.currentFrame) { + this.updateTexture(); + } + }; + /** + * Goes to a specific frame and begins playing the AnimatedSprite. + * + * @param {number} frameNumber - Frame index to start at. + */ + AnimatedSprite.prototype.gotoAndPlay = function (frameNumber) { + var previousFrame = this.currentFrame; + this._currentTime = frameNumber; + if (previousFrame !== this.currentFrame) { + this.updateTexture(); + } + this.play(); + }; + /** + * Updates the object transform for rendering. + * + * @param {number} deltaTime - Time since last tick. + */ + AnimatedSprite.prototype.update = function (deltaTime) { + if (!this._playing) { + return; + } + var elapsed = this.animationSpeed * deltaTime; + var previousFrame = this.currentFrame; + if (this._durations !== null) { + var lag = this._currentTime % 1 * this._durations[this.currentFrame]; + lag += elapsed / 60 * 1000; + while (lag < 0) { + this._currentTime--; + lag += this._durations[this.currentFrame]; + } + var sign = Math.sign(this.animationSpeed * deltaTime); + this._currentTime = Math.floor(this._currentTime); + while (lag >= this._durations[this.currentFrame]) { + lag -= this._durations[this.currentFrame] * sign; + this._currentTime += sign; + } + this._currentTime += lag / this._durations[this.currentFrame]; + } + else { + this._currentTime += elapsed; + } + if (this._currentTime < 0 && !this.loop) { + this.gotoAndStop(0); + if (this.onComplete) { + this.onComplete(); + } + } + else if (this._currentTime >= this._textures.length && !this.loop) { + this.gotoAndStop(this._textures.length - 1); + if (this.onComplete) { + this.onComplete(); + } + } + else if (previousFrame !== this.currentFrame) { + if (this.loop && this.onLoop) { + if (this.animationSpeed > 0 && this.currentFrame < previousFrame) { + this.onLoop(); + } + else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) { + this.onLoop(); + } + } + this.updateTexture(); + } + }; + /** + * Updates the displayed texture to match the current frame index. + * + * @private + */ + AnimatedSprite.prototype.updateTexture = function () { + var currentFrame = this.currentFrame; + if (this._previousFrame === currentFrame) { + return; + } + this._previousFrame = currentFrame; + this._texture = this._textures[currentFrame]; + this._textureID = -1; + this._textureTrimmedID = -1; + this._cachedTint = 0xFFFFFF; + this.uvs = this._texture._uvs.uvsFloat32; + if (this.updateAnchor) { + this._anchor.copyFrom(this._texture.defaultAnchor); + } + if (this.onFrameChange) { + this.onFrameChange(this.currentFrame); + } + }; + /** + * Stops the AnimatedSprite and destroys it. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options + * have been set to that value. + * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy + * method called as well. 'options' will be passed on to those calls. + * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well. + * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well. + */ + AnimatedSprite.prototype.destroy = function (options) { + this.stop(); + _super.prototype.destroy.call(this, options); + this.onComplete = null; + this.onFrameChange = null; + this.onLoop = null; + }; + /** + * A short hand way of creating an AnimatedSprite from an array of frame ids. + * + * @static + * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames. + * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames. + */ + AnimatedSprite.fromFrames = function (frames) { + var textures = []; + for (var i = 0; i < frames.length; ++i) { + textures.push(Texture.from(frames[i])); + } + return new AnimatedSprite(textures); + }; + /** + * A short hand way of creating an AnimatedSprite from an array of image ids. + * + * @static + * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames. + * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames. + */ + AnimatedSprite.fromImages = function (images) { + var textures = []; + for (var i = 0; i < images.length; ++i) { + textures.push(Texture.from(images[i])); + } + return new AnimatedSprite(textures); + }; + Object.defineProperty(AnimatedSprite.prototype, "totalFrames", { + /** + * The total number of frames in the AnimatedSprite. This is the same as number of textures + * assigned to the AnimatedSprite. + * + * @readonly + * @member {number} + * @default 0 + */ + get: function () { + return this._textures.length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "textures", { + /** + * The array of textures used for this AnimatedSprite. + * + * @member {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} + */ + get: function () { + return this._textures; + }, + set: function (value) { + if (value[0] instanceof Texture) { + this._textures = value; + this._durations = null; + } + else { + this._textures = []; + this._durations = []; + for (var i = 0; i < value.length; i++) { + this._textures.push(value[i].texture); + this._durations.push(value[i].time); + } + } + this._previousFrame = null; + this.gotoAndStop(0); + this.updateTexture(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "currentFrame", { + /** + * The AnimatedSprites current frame index. + * + * @member {number} + * @readonly + */ + get: function () { + var currentFrame = Math.floor(this._currentTime) % this._textures.length; + if (currentFrame < 0) { + currentFrame += this._textures.length; + } + return currentFrame; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "playing", { + /** + * Indicates if the AnimatedSprite is currently playing. + * + * @member {boolean} + * @readonly + */ + get: function () { + return this._playing; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "autoUpdate", { + /** + * Whether to use PIXI.Ticker.shared to auto update animation time + * + * @member {boolean} + */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + } + }, + enumerable: false, + configurable: true + }); + return AnimatedSprite; + }(Sprite)); + + // Install renderer plugins + Renderer.registerPlugin('accessibility', AccessibilityManager); + Renderer.registerPlugin('extract', Extract); + Renderer.registerPlugin('interaction', InteractionManager); + Renderer.registerPlugin('particle', ParticleRenderer); + Renderer.registerPlugin('prepare', Prepare); + Renderer.registerPlugin('batch', BatchRenderer); + Renderer.registerPlugin('tilingSprite', TilingSpriteRenderer); + Loader$1.registerPlugin(BitmapFontLoader); + Loader$1.registerPlugin(SpritesheetLoader); + Application.registerPlugin(TickerPlugin); + Application.registerPlugin(AppLoaderPlugin); + /** + * String of the current PIXI version. + * + * @static + * @constant + * @memberof PIXI + * @name VERSION + * @type {string} + */ + var VERSION$1 = '5.3.12'; + /** + * @namespace PIXI + */ + /** + * This namespace contains WebGL-only display filters that can be applied + * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. + * + * Since PixiJS only had a handful of built-in filters, additional filters + * can be downloaded {@link https://github.com/pixijs/pixi-filters here} from the + * PixiJS Filters repository. + * + * All filters must extend {@link PIXI.Filter}. + * + * @example + * // Create a new application + * const app = new PIXI.Application(); + * + * // Draw a green rectangle + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add a blur filter + * rect.filters = [new PIXI.filters.BlurFilter()]; + * + * // Display rectangle + * app.stage.addChild(rect); + * document.body.appendChild(app.view); + * @namespace PIXI.filters + */ + var filters = { + AlphaFilter: AlphaFilter, + BlurFilter: BlurFilter, + BlurFilterPass: BlurFilterPass, + ColorMatrixFilter: ColorMatrixFilter, + DisplacementFilter: DisplacementFilter, + FXAAFilter: FXAAFilter, + NoiseFilter: NoiseFilter, + }; + + exports.AbstractBatchRenderer = AbstractBatchRenderer; + exports.AbstractRenderer = AbstractRenderer; + exports.AccessibilityManager = AccessibilityManager; + exports.AnimatedSprite = AnimatedSprite; + exports.AppLoaderPlugin = AppLoaderPlugin; + exports.Application = Application; + exports.Attribute = Attribute; + exports.BasePrepare = BasePrepare; + exports.BaseRenderTexture = BaseRenderTexture; + exports.BaseTexture = BaseTexture; + exports.BatchDrawCall = BatchDrawCall; + exports.BatchGeometry = BatchGeometry; + exports.BatchPluginFactory = BatchPluginFactory; + exports.BatchRenderer = BatchRenderer; + exports.BatchShaderGenerator = BatchShaderGenerator; + exports.BatchTextureArray = BatchTextureArray; + exports.BitmapFont = BitmapFont; + exports.BitmapFontData = BitmapFontData; + exports.BitmapFontLoader = BitmapFontLoader; + exports.BitmapText = BitmapText; + exports.Bounds = Bounds; + exports.Buffer = Buffer; + exports.Circle = Circle; + exports.Container = Container; + exports.CountLimiter = CountLimiter; + exports.DEG_TO_RAD = DEG_TO_RAD; + exports.DisplayObject = DisplayObject; + exports.Ellipse = Ellipse; + exports.Extract = Extract; + exports.FillStyle = FillStyle; + exports.Filter = Filter; + exports.FilterState = FilterState; + exports.Framebuffer = Framebuffer; + exports.GLFramebuffer = GLFramebuffer; + exports.GLProgram = GLProgram; + exports.GLTexture = GLTexture; + exports.GRAPHICS_CURVES = GRAPHICS_CURVES; + exports.Geometry = Geometry; + exports.Graphics = Graphics; + exports.GraphicsData = GraphicsData; + exports.GraphicsGeometry = GraphicsGeometry; + exports.IGLUniformData = IGLUniformData; + exports.InteractionData = InteractionData; + exports.InteractionEvent = InteractionEvent; + exports.InteractionManager = InteractionManager; + exports.InteractionTrackingData = InteractionTrackingData; + exports.LineStyle = LineStyle; + exports.Loader = Loader$1; + exports.LoaderResource = LoaderResource; + exports.MaskData = MaskData; + exports.Matrix = Matrix; + exports.Mesh = Mesh; + exports.MeshBatchUvs = MeshBatchUvs; + exports.MeshGeometry = MeshGeometry; + exports.MeshMaterial = MeshMaterial; + exports.NineSlicePlane = NineSlicePlane; + exports.ObjectRenderer = ObjectRenderer; + exports.ObservablePoint = ObservablePoint; + exports.PI_2 = PI_2; + exports.ParticleContainer = ParticleContainer; + exports.ParticleRenderer = ParticleRenderer; + exports.PlaneGeometry = PlaneGeometry; + exports.Point = Point; + exports.Polygon = Polygon; + exports.Prepare = Prepare; + exports.Program = Program; + exports.Quad = Quad; + exports.QuadUv = QuadUv; + exports.RAD_TO_DEG = RAD_TO_DEG; + exports.Rectangle = Rectangle; + exports.RenderTexture = RenderTexture; + exports.RenderTexturePool = RenderTexturePool; + exports.Renderer = Renderer; + exports.RopeGeometry = RopeGeometry; + exports.RoundedRectangle = RoundedRectangle; + exports.Runner = Runner; + exports.Shader = Shader; + exports.SimpleMesh = SimpleMesh; + exports.SimplePlane = SimplePlane; + exports.SimpleRope = SimpleRope; + exports.Sprite = Sprite; + exports.SpriteMaskFilter = SpriteMaskFilter; + exports.Spritesheet = Spritesheet; + exports.SpritesheetLoader = SpritesheetLoader; + exports.State = State; + exports.System = System; + exports.TemporaryDisplayObject = TemporaryDisplayObject; + exports.Text = Text; + exports.TextMetrics = TextMetrics; + exports.TextStyle = TextStyle; + exports.Texture = Texture; + exports.TextureLoader = TextureLoader; + exports.TextureMatrix = TextureMatrix; + exports.TextureUvs = TextureUvs; + exports.Ticker = Ticker; + exports.TickerPlugin = TickerPlugin; + exports.TilingSprite = TilingSprite; + exports.TilingSpriteRenderer = TilingSpriteRenderer; + exports.TimeLimiter = TimeLimiter; + exports.Transform = Transform; + exports.UniformGroup = UniformGroup; + exports.VERSION = VERSION$1; + exports.ViewableBuffer = ViewableBuffer; + exports.accessibleTarget = accessibleTarget; + exports.autoDetectRenderer = autoDetectRenderer; + exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; + exports.defaultFilterVertex = defaultFilter; + exports.defaultVertex = _default; + exports.filters = filters; + exports.graphicsUtils = index$2; + exports.groupD8 = groupD8; + exports.interactiveTarget = interactiveTarget; + exports.isMobile = isMobile$1; + exports.resources = index; + exports.settings = settings; + exports.systems = systems; + exports.uniformParsers = uniformParsers; + exports.useDeprecated = useDeprecated; + exports.utils = utils_es; + + return exports; + +}({})); +PIXI.useDeprecated(); +//# sourceMappingURL=pixi.js.map diff --git a/js/libs/vorbisdecoder.js b/js/libs/vorbisdecoder.js new file mode 100644 index 0000000..ce59529 --- /dev/null +++ b/js/libs/vorbisdecoder.js @@ -0,0 +1,6 @@ +//============================================================================= +// vorbisdecoder.js v1.0.1 +// This code is based on: http://nothings.org/stb_vorbis/ +//============================================================================= +var VorbisDecoderModule={};VorbisDecoderModule["wasmBinary"]=Uint8Array.from(atob("AGFzbQEAAAABnAEWYAF/AX9gAn9/AX9gAn9/AGABfwBgA39/fwF/YAZ/f39/f38AYAR/f39/AGAEf39/fwF/YAF8AXxgA39/fwBgBX9/f39/AX9gBn9/f39/fwF/YAAAYAV/f39/fwBgAnx8AXxgB39/f39/f38AYAd/f39/f39/AX9gCH9/f39/f39/AX9gAnx/AX9gAX8BfWACfH8BfGADfHx/AXwCLAUBYQFhAAYBYQFiAAQBYQFjAAABYQZtZW1vcnkCARAQAWEFdGFibGUBcAADA2FgAgEBAgAABAkAAxQAAAEABAEIFQ4FAgUCAAADAA4IBgAAAAAEARIAAgAJAQUDAQ0RABMABAMCAwcICAcAAgIGBAEKBw0PBQsEAAUFBgsKAAEDCQcDBgEMAAIKARALBwMMBggBfwFB4LkECwcZBgFkAGIBZQBhAWYAHQFnAE8BaABcAWkAHgkIAQBBAQsCWEMK0ccCYAkAIAAgATYCZAvHAQEDfwJAAn9BACAAKAL0CiICQQBIDQAaIAIgAUgEQCABQRlODQIgAkUEQCAAQQA2AvAKCwJAA0AgAiABTg0BIAAQHCIDQX9HBEAgACAAKAL0CiIEQQhqIgI2AvQKIAAgACgC8AogAyAEdGo2AvAKDAELCyAAQX82AvQKQQAPC0EAIAJBAEgNARoLIAAgAiABazYC9AogACAAKALwCiIAIAF2NgLwCiAAQX8gAXRBf3NxCw8LIABBGBAEIAAgAUFoahAEQRh0agtXAQJ/IAAgAUEHakF4cSIBIAAoAghqNgIIAn8gACgCUCICBEBBACABIAAoAlgiAWoiAyAAKAJcSg0BGiAAIAM2AlggASACag8LIAFFBEBBAA8LIAEQHgsLDwAgACgCUEUEQCABEB0LCzUBAX8CfyAAKAIgIgEgACgCKE8EQCAAQQE2AmBBAAwBCyAAIAFBAWo2AiAgAS0AAAtB/wFxCxQBAX8gABAcIQEgAEEANgL0CiABC/MCAgJ/AX4CQCACRQ0AIAAgAmoiA0F/aiABOgAAIAAgAToAACACQQNJDQAgA0F+aiABOgAAIAAgAToAASADQX1qIAE6AAAgACABOgACIAJBB0kNACADQXxqIAE6AAAgACABOgADIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQXxqIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkF4aiABNgIAIAJBdGogATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBcGogATYCACACQWxqIAE2AgAgAkFoaiABNgIAIAJBZGogATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtIgVCIIYgBYQhBSADIARqIQEDQCABIAU3AxggASAFNwMQIAEgBTcDCCABIAU3AwAgAUEgaiEBIAJBYGoiAkEfSw0ACwsgAAsiACAAKAJQBEAgACAAKAJcIAJBA2pBfHFqNgJcDwsgARAdCx4AIAAQByAAEAdBCHRyIAAQB0EQdHIgABAHQRh0cgtsAQJ/AkAgACgC9AoiAUEYSg0AIAFFBEAgAEEANgLwCgsDQCAAKALoCgRAIAAtAOAKRQ0CCyAAEBwiAkF/Rg0BIAAgACgC9AoiAUEIajYC9AogACAAKALwCiACIAF0ajYC8AogAUERSA0ACwsLqAEAAkAgAUGACE4EQCAARAAAAAAAAOB/oiEAIAFB/w9IBEAgAUGBeGohAQwCCyAARAAAAAAAAOB/oiEAIAFB/RcgAUH9F0gbQYJwaiEBDAELIAFBgXhKDQAgAEQAAAAAAAAQAKIhACABQYNwSgRAIAFB/gdqIQEMAQsgAEQAAAAAAAAQAKIhACABQYZoIAFBhmhKG0H8D2ohAQsgACABQf8Haq1CNIa/ogtSAQJ/QcA4KAIAIgEgAEEDakF8cSICaiEAAkAgAkEBTkEAIAAgAU0bDQAgAD8AQRB0SwRAIAAQAkUNAQtBwDggADYCACABDwtBwDRBMDYCAEF/C2cAIABBAXZB1arVqgVxIABBAXRBqtWq1XpxciIAQQJ2QbPmzJkDcSAAQQJ0QcyZs+Z8cXIiAEEEdkGPnrz4AHEgAEEEdEHw4cOHf3FyIgBBCHZB/4H8B3EgAEEIdEGA/oN4cXJBEHcLoQMBB38gABAMAkACQAJAAkAgASgCICIERQRAIAEoAqQQIgUNAQwDCyABKAIEIgJBCUgNASABKAKkECIFRQ0BCyAAKALwCiIGEA8hByABKAKsECEDQQAhAgNAIANBAkhFBEAgA0EBdiIEIAMgBGsgBSACIARqIgRBAnRqKAIAIAdLIggbIQMgAiAEIAgbIQIMAQsLIAACfwJ/IAEtABdFBEAgASgCqBAgAkECdGooAgAhAgsgACgC9AoiAyABKAIIIAJqLQAAIgFICwRAQX8hAkEADAELIAAgBiABdjYC8AogAyABaws2AvQKIAIPCyABLQAXDQEgAkEAIAJBAEobIQUDQCADIAVHBEACQCABKAIIIANqIgYtAAAiAkH/AUYNACAEIANBAnRqKAIAIAAoAvAKIgdBfyACdEF/c3FHDQAgACgC9AoiASACTgRAIAAgByACdjYC8AogACABIAYtAABrNgL0CiADDwsgAEEANgL0CgwDCyADQQFqIQMMAQsLIABBFRADIABBADYC9AoLQX8PC0HqCUGACEGMDUH1CRAAAAu0AQEBfyAAQQBOBH8gAEH//wBMBEAgAEEPTARAIABBsAlqLAAADwsgAEH/A0wEQCAAQQV2QbAJaiwAAEEFag8LIABBCnZBsAlqLAAAQQpqDwsgAEH///8HTARAIABB//8fTARAIABBD3ZBsAlqLAAAQQ9qDwsgAEEUdkGwCWosAABBFGoPCyAAQf////8BTARAIABBGXZBsAlqLAAAQRlqDwsgAEEedkGwCWosAABBHmoFQQALC4IEAQN/IAJBgARPBEAgACABIAIQARogAA8LIAAgAmohAwJAIAAgAXNBA3FFBEACQCACQQFIBEAgACECDAELIABBA3FFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANPDQEgAkEDcQ0ACwsCQCADQXxxIgRBwABJDQAgAiAEQUBqIgVLDQADQCACIAEoAgA2AgAgAiABKAIENgIEIAIgASgCCDYCCCACIAEoAgw2AgwgAiABKAIQNgIQIAIgASgCFDYCFCACIAEoAhg2AhggAiABKAIcNgIcIAIgASgCIDYCICACIAEoAiQ2AiQgAiABKAIoNgIoIAIgASgCLDYCLCACIAEoAjA2AjAgAiABKAI0NgI0IAIgASgCODYCOCACIAEoAjw2AjwgAUFAayEBIAJBQGsiAiAFTQ0ACwsgAiAETw0BA0AgAiABKAIANgIAIAFBBGohASACQQRqIgIgBEkNAAsMAQsgA0EESQRAIAAhAgwBCyADQXxqIgQgAEkEQCAAIQIMAQsgACECA0AgAiABLQAAOgAAIAIgAS0AAToAASACIAEtAAI6AAIgAiABLQADOgADIAFBBGohASACQQRqIgIgBE0NAAsLIAIgA0kEQANAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANHDQALCyAAC0EBAX8gAUEHakF4cSEBAn8gACgCUCICBEBBACAAKAJcIAFrIgEgACgCWEgNARogACABNgJcIAEgAmoPCyABEB4LC84BAQJ/IwBBEGsiASQAAkAgAL1CIIinQf////8HcSICQfvDpP8DTQRAIAJBgIDA8gNJDQEgAEQAAAAAAAAAAEEAEBUhAAwBCyACQYCAwP8HTwRAIAAgAKEhAAwBCyAAIAEQKEEDcSICQQJNBEACQAJAAkAgAkEBaw4CAQIACyABKwMAIAErAwhBARAVIQAMAwsgASsDACABKwMIEBYhAAwCCyABKwMAIAErAwhBARAVmiEADAELIAErAwAgASsDCBAWmiEACyABQRBqJAAgAAuZAQEDfCAAIACiIgMgAyADoqIgA0R81c9aOtnlPaJE65wriublWr6goiADIANEff6xV+Mdxz6iRNVhwRmgASq/oKJEpvgQERERgT+goCEFIAMgAKIhBCACRQRAIAQgAyAFokRJVVVVVVXFv6CiIACgDwsgACADIAFEAAAAAAAA4D+iIAQgBaKhoiABoSAERElVVVVVVcU/oqChC5IBAQN8RAAAAAAAAPA/IAAgAKIiAkQAAAAAAADgP6IiA6EiBEQAAAAAAADwPyAEoSADoSACIAIgAiACRJAVyxmgAfo+okR3UcEWbMFWv6CiRExVVVVVVaU/oKIgAiACoiIDIAOiIAIgAkTUOIi+6fqovaJExLG0vZ7uIT6gokStUpyAT36SvqCioKIgACABoqGgoAuxBAICfwR9IAEgAkECdGoiASADQQJ0aiECIABBAnUhACAFQQJ0IQMDQCAAQQFIRQRAIAJBfGoiBSoCACEIIAEgASoCACIJIAIqAgAiCpI4AgAgAUF8aiIGIAYqAgAiCyAFKgIAkjgCACACIAkgCpMiCSAEKgIAlCALIAiTIgggBCoCBJSTOAIAIAUgCCAEKgIAlCAJIAQqAgSUkjgCACACQXRqIgUqAgAhCCABQXhqIgYgBioCACIJIAJBeGoiBioCACIKkjgCACABQXRqIgcgByoCACILIAUqAgCSOAIAIAYgCSAKkyIJIAMgBGoiBCoCAJQgCyAIkyIIIAQqAgSUkzgCACAFIAggBCoCAJQgCSAEKgIElJI4AgAgAkFsaiIFKgIAIQggAUFwaiIGIAYqAgAiCSACQXBqIgYqAgAiCpI4AgAgAUFsaiIHIAcqAgAiCyAFKgIAkjgCACAGIAkgCpMiCSADIARqIgQqAgCUIAsgCJMiCCAEKgIElJM4AgAgBSAIIAQqAgCUIAkgBCoCBJSSOAIAIAJBZGoiBSoCACEIIAFBaGoiBiAGKgIAIgkgAkFoaiIGKgIAIgqSOAIAIAFBZGoiByAHKgIAIgsgBSoCAJI4AgAgBiAJIAqTIgkgAyAEaiIEKgIAlCALIAiTIgggBCoCBJSTOAIAIAUgCCAEKgIAlCAJIAQqAgSUkjgCACADIARqIQQgAEF/aiEAIAJBYGohAiABQWBqIQEMAQsLC1YBAn8gAAJ/IAFBH00EQCAAKAIEIQIgACgCAAwBCyAAIAAoAgAiAjYCBCAAQQA2AgAgAUFgaiEBQQALIgMgAXQ2AgAgACACIAF0IANBICABa3ZyNgIEC84CAQR/IwBB8AFrIgYkACAGIAIoAgAiBzYC6AEgAigCBCECIAYgADYCACAGIAI2AuwBQQEhCAJAAkACQAJAQQAgB0EBRiACGw0AIAAgBSADQQJ0aigCAGsiByAAIAERAQBBAUgNACAERSEJA0ACQCAHIQIgCUUgA0ECSHJFBEAgA0ECdCAFakF4aigCACEEIABBfGoiByACIAERAQBBf0oNASAHIARrIAIgAREBAEF/Sg0BCyAGIAhBAnRqIAI2AgAgBkHoAWogBkHoAWoQKyIAEBogCEEBaiEIIAAgA2ohAyAGKALoAUEBRgRAIAYoAuwBRQ0FC0EAIQRBASEJIAIhACACIAUgA0ECdGooAgBrIgcgBigCACABEQEAQQBKDQEMAwsLIAAhAgwCCyAAIQILIAQNAQsgBiAIECogAiABIAMgBRAhCyAGQfABaiQAC1gBAn8gAAJ/IAFBH00EQCAAKAIAIQIgACgCBAwBCyAAKAIEIQIgAEEANgIEIAAgAjYCACABQWBqIQFBAAsiAyABdjYCBCAAIANBICABa3QgAiABdnI2AgALFwAgABBLRQRAIABBHhADQQAPCyAAEDMLZgEBfwJAAkAgAC0A4AoiAUUEQEF/IQEgACgC6AoNASAAECNFDQEgAC0A4AoiAUUNAgsgACABQX9qOgDgCiAAIAAoAvgKQQFqNgL4CiAAEAchAQsgAQ8LQdsIQYAIQY4MQe8IEAAAC4ENAQd/AkAgAEUNACAAQXhqIgMgAEF8aigCACIBQXhxIgBqIQUCQCABQQFxDQAgAUEDcUUNASADIAMoAgAiAmsiA0HUNCgCACIESQ0BIAAgAmohACADQdg0KAIARwRAIAJB/wFNBEAgAygCCCIEIAJBA3YiAkEDdEHsNGpHGiAEIAMoAgwiAUYEQEHENEHENCgCAEF+IAJ3cTYCAAwDCyAEIAE2AgwgASAENgIIDAILIAMoAhghBgJAIAMgAygCDCIBRwRAIAQgAygCCCICTQRAIAIoAgwaCyACIAE2AgwgASACNgIIDAELAkAgA0EUaiICKAIAIgQNACADQRBqIgIoAgAiBA0AQQAhAQwBCwNAIAIhByAEIgFBFGoiAigCACIEDQAgAUEQaiECIAEoAhAiBA0ACyAHQQA2AgALIAZFDQECQCADIAMoAhwiAkECdEH0NmoiBCgCAEYEQCAEIAE2AgAgAQ0BQcg0Qcg0KAIAQX4gAndxNgIADAMLIAZBEEEUIAYoAhAgA0YbaiABNgIAIAFFDQILIAEgBjYCGCADKAIQIgIEQCABIAI2AhAgAiABNgIYCyADKAIUIgJFDQEgASACNgIUIAIgATYCGAwBCyAFKAIEIgFBA3FBA0cNAEHMNCAANgIAIAUgAUF+cTYCBCADIABBAXI2AgQgACADaiAANgIADwsgBSADTQ0AIAUoAgQiAUEBcUUNAAJAIAFBAnFFBEAgBUHcNCgCAEYEQEHcNCADNgIAQdA0QdA0KAIAIABqIgA2AgAgAyAAQQFyNgIEIANB2DQoAgBHDQNBzDRBADYCAEHYNEEANgIADwsgBUHYNCgCAEYEQEHYNCADNgIAQcw0Qcw0KAIAIABqIgA2AgAgAyAAQQFyNgIEIAAgA2ogADYCAA8LIAFBeHEgAGohAAJAIAFB/wFNBEAgBSgCDCECIAUoAggiBCABQQN2IgFBA3RB7DRqIgdHBEBB1DQoAgAaCyACIARGBEBBxDRBxDQoAgBBfiABd3E2AgAMAgsgAiAHRwRAQdQ0KAIAGgsgBCACNgIMIAIgBDYCCAwBCyAFKAIYIQYCQCAFIAUoAgwiAUcEQEHUNCgCACAFKAIIIgJNBEAgAigCDBoLIAIgATYCDCABIAI2AggMAQsCQCAFQRRqIgIoAgAiBA0AIAVBEGoiAigCACIEDQBBACEBDAELA0AgAiEHIAQiAUEUaiICKAIAIgQNACABQRBqIQIgASgCECIEDQALIAdBADYCAAsgBkUNAAJAIAUgBSgCHCICQQJ0QfQ2aiIEKAIARgRAIAQgATYCACABDQFByDRByDQoAgBBfiACd3E2AgAMAgsgBkEQQRQgBigCECAFRhtqIAE2AgAgAUUNAQsgASAGNgIYIAUoAhAiAgRAIAEgAjYCECACIAE2AhgLIAUoAhQiAkUNACABIAI2AhQgAiABNgIYCyADIABBAXI2AgQgACADaiAANgIAIANB2DQoAgBHDQFBzDQgADYCAA8LIAUgAUF+cTYCBCADIABBAXI2AgQgACADaiAANgIACyAAQf8BTQRAIABBA3YiAUEDdEHsNGohAAJ/QcQ0KAIAIgJBASABdCIBcUUEQEHENCABIAJyNgIAIAAMAQsgACgCCAshAiAAIAM2AgggAiADNgIMIAMgADYCDCADIAI2AggPCyADQgA3AhAgAwJ/QQAgAEEIdiIBRQ0AGkEfIABB////B0sNABogASABQYD+P2pBEHZBCHEiAXQiAiACQYDgH2pBEHZBBHEiAnQiBCAEQYCAD2pBEHZBAnEiBHRBD3YgASACciAEcmsiAUEBdCAAIAFBFWp2QQFxckEcagsiAjYCHCACQQJ0QfQ2aiEBAkACQAJAQcg0KAIAIgRBASACdCIHcUUEQEHINCAEIAdyNgIAIAEgAzYCACADIAE2AhgMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgASgCACEBA0AgASIEKAIEQXhxIABGDQIgAkEddiEBIAJBAXQhAiAEIAFBBHFqIgdBEGooAgAiAQ0ACyAHIAM2AhAgAyAENgIYCyADIAM2AgwgAyADNgIIDAELIAQoAggiACADNgIMIAQgAzYCCCADQQA2AhggAyAENgIMIAMgADYCCAtB5DRB5DQoAgBBf2oiADYCACAADQBBjDghAwNAIAMoAgAiAEEIaiEDIAANAAtB5DRBfzYCAAsLvS0BC38jAEEQayILJAACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBBxDQoAgAiBkEQIABBC2pBeHEgAEELSRsiBUEDdiIAdiIBQQNxBEAgAUF/c0EBcSAAaiICQQN0IgRB9DRqKAIAIgFBCGohAAJAIAEoAggiAyAEQew0aiIERgRAQcQ0IAZBfiACd3E2AgAMAQtB1DQoAgAaIAMgBDYCDCAEIAM2AggLIAEgAkEDdCICQQNyNgIEIAEgAmoiASABKAIEQQFyNgIEDAwLIAVBzDQoAgAiCE0NASABBEACQEECIAB0IgJBACACa3IgASAAdHEiAEEAIABrcUF/aiIAIABBDHZBEHEiAHYiAUEFdkEIcSICIAByIAEgAnYiAEECdkEEcSIBciAAIAF2IgBBAXZBAnEiAXIgACABdiIAQQF2QQFxIgFyIAAgAXZqIgJBA3QiA0H0NGooAgAiASgCCCIAIANB7DRqIgNGBEBBxDQgBkF+IAJ3cSIGNgIADAELQdQ0KAIAGiAAIAM2AgwgAyAANgIICyABQQhqIQAgASAFQQNyNgIEIAEgBWoiByACQQN0IgIgBWsiA0EBcjYCBCABIAJqIAM2AgAgCARAIAhBA3YiBEEDdEHsNGohAUHYNCgCACECAn8gBkEBIAR0IgRxRQRAQcQ0IAQgBnI2AgAgAQwBCyABKAIICyEEIAEgAjYCCCAEIAI2AgwgAiABNgIMIAIgBDYCCAtB2DQgBzYCAEHMNCADNgIADAwLQcg0KAIAIgpFDQEgCkEAIAprcUF/aiIAIABBDHZBEHEiAHYiAUEFdkEIcSICIAByIAEgAnYiAEECdkEEcSIBciAAIAF2IgBBAXZBAnEiAXIgACABdiIAQQF2QQFxIgFyIAAgAXZqQQJ0QfQ2aigCACIBKAIEQXhxIAVrIQMgASECA0ACQCACKAIQIgBFBEAgAigCFCIARQ0BCyAAKAIEQXhxIAVrIgIgAyACIANJIgIbIQMgACABIAIbIQEgACECDAELCyABKAIYIQkgASABKAIMIgRHBEBB1DQoAgAgASgCCCIATQRAIAAoAgwaCyAAIAQ2AgwgBCAANgIIDAsLIAFBFGoiAigCACIARQRAIAEoAhAiAEUNAyABQRBqIQILA0AgAiEHIAAiBEEUaiICKAIAIgANACAEQRBqIQIgBCgCECIADQALIAdBADYCAAwKC0F/IQUgAEG/f0sNACAAQQtqIgBBeHEhBUHINCgCACIHRQ0AQQAgBWshAgJAAkACQAJ/QQAgAEEIdiIARQ0AGkEfIAVB////B0sNABogACAAQYD+P2pBEHZBCHEiAHQiASABQYDgH2pBEHZBBHEiAXQiAyADQYCAD2pBEHZBAnEiA3RBD3YgACABciADcmsiAEEBdCAFIABBFWp2QQFxckEcagsiCEECdEH0NmooAgAiA0UEQEEAIQAMAQsgBUEAQRkgCEEBdmsgCEEfRht0IQFBACEAA0ACQCADKAIEQXhxIAVrIgYgAk8NACADIQQgBiICDQBBACECIAMhAAwDCyAAIAMoAhQiBiAGIAMgAUEddkEEcWooAhAiA0YbIAAgBhshACABIANBAEd0IQEgAw0ACwsgACAEckUEQEECIAh0IgBBACAAa3IgB3EiAEUNAyAAQQAgAGtxQX9qIgAgAEEMdkEQcSIAdiIBQQV2QQhxIgMgAHIgASADdiIAQQJ2QQRxIgFyIAAgAXYiAEEBdkECcSIBciAAIAF2IgBBAXZBAXEiAXIgACABdmpBAnRB9DZqKAIAIQALIABFDQELA0AgACgCBEF4cSAFayIDIAJJIQEgAyACIAEbIQIgACAEIAEbIQQgACgCECIBBH8gAQUgACgCFAsiAA0ACwsgBEUNACACQcw0KAIAIAVrTw0AIAQoAhghCCAEIAQoAgwiAUcEQEHUNCgCACAEKAIIIgBNBEAgACgCDBoLIAAgATYCDCABIAA2AggMCQsgBEEUaiIDKAIAIgBFBEAgBCgCECIARQ0DIARBEGohAwsDQCADIQYgACIBQRRqIgMoAgAiAA0AIAFBEGohAyABKAIQIgANAAsgBkEANgIADAgLQcw0KAIAIgEgBU8EQEHYNCgCACEAAkAgASAFayICQRBPBEBBzDQgAjYCAEHYNCAAIAVqIgM2AgAgAyACQQFyNgIEIAAgAWogAjYCACAAIAVBA3I2AgQMAQtB2DRBADYCAEHMNEEANgIAIAAgAUEDcjYCBCAAIAFqIgEgASgCBEEBcjYCBAsgAEEIaiEADAoLQdA0KAIAIgEgBUsEQEHQNCABIAVrIgE2AgBB3DRB3DQoAgAiACAFaiICNgIAIAIgAUEBcjYCBCAAIAVBA3I2AgQgAEEIaiEADAoLQQAhACAFQS9qIgQCf0GcOCgCAARAQaQ4KAIADAELQag4Qn83AgBBoDhCgKCAgICABDcCAEGcOCALQQxqQXBxQdiq1aoFczYCAEGwOEEANgIAQYA4QQA2AgBBgCALIgJqIgZBACACayIHcSICIAVNDQlB/DcoAgAiAwRAQfQ3KAIAIgggAmoiCSAITSAJIANLcg0KC0GAOC0AAEEEcQ0EAkACQEHcNCgCACIDBEBBhDghAANAIAAoAgAiCCADTQRAIAggACgCBGogA0sNAwsgACgCCCIADQALC0EAEA4iAUF/Rg0FIAIhBkGgOCgCACIAQX9qIgMgAXEEQCACIAFrIAEgA2pBACAAa3FqIQYLIAYgBU0gBkH+////B0tyDQVB/DcoAgAiAARAQfQ3KAIAIgMgBmoiByADTSAHIABLcg0GCyAGEA4iACABRw0BDAcLIAYgAWsgB3EiBkH+////B0sNBCAGEA4iASAAKAIAIAAoAgRqRg0DIAEhAAsgAEF/RiAFQTBqIAZNckUEQEGkOCgCACIBIAQgBmtqQQAgAWtxIgFB/v///wdLBEAgACEBDAcLIAEQDkF/RwRAIAEgBmohBiAAIQEMBwtBACAGaxAOGgwECyAAIgFBf0cNBQwDC0EAIQQMBwtBACEBDAULIAFBf0cNAgtBgDhBgDgoAgBBBHI2AgALIAJB/v///wdLDQEgAhAOIgFBABAOIgBPIAFBf0ZyIABBf0ZyDQEgACABayIGIAVBKGpNDQELQfQ3QfQ3KAIAIAZqIgA2AgAgAEH4NygCAEsEQEH4NyAANgIACwJAAkACQEHcNCgCACIDBEBBhDghAANAIAEgACgCACICIAAoAgQiBGpGDQIgACgCCCIADQALDAILQdQ0KAIAIgBBACABIABPG0UEQEHUNCABNgIAC0EAIQBBiDggBjYCAEGEOCABNgIAQeQ0QX82AgBB6DRBnDgoAgA2AgBBkDhBADYCAANAIABBA3QiAkH0NGogAkHsNGoiAzYCACACQfg0aiADNgIAIABBAWoiAEEgRw0AC0HQNCAGQVhqIgBBeCABa0EHcUEAIAFBCGpBB3EbIgJrIgM2AgBB3DQgASACaiICNgIAIAIgA0EBcjYCBCAAIAFqQSg2AgRB4DRBrDgoAgA2AgAMAgsgAC0ADEEIcSABIANNciACIANLcg0AIAAgBCAGajYCBEHcNCADQXggA2tBB3FBACADQQhqQQdxGyIAaiIBNgIAQdA0QdA0KAIAIAZqIgIgAGsiADYCACABIABBAXI2AgQgAiADakEoNgIEQeA0Qaw4KAIANgIADAELIAFB1DQoAgAiBEkEQEHUNCABNgIAIAEhBAsgASAGaiECQYQ4IQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQYQ4IQADQCAAKAIAIgIgA00EQCACIAAoAgRqIgQgA0sNAwsgACgCCCEADAAACwALIAAgATYCACAAIAAoAgQgBmo2AgQgAUF4IAFrQQdxQQAgAUEIakEHcRtqIgkgBUEDcjYCBCACQXggAmtBB3FBACACQQhqQQdxG2oiASAJayAFayEAIAUgCWohByABIANGBEBB3DQgBzYCAEHQNEHQNCgCACAAaiIANgIAIAcgAEEBcjYCBAwDCyABQdg0KAIARgRAQdg0IAc2AgBBzDRBzDQoAgAgAGoiADYCACAHIABBAXI2AgQgACAHaiAANgIADAMLIAEoAgQiAkEDcUEBRgRAIAJBeHEhCgJAIAJB/wFNBEAgASgCCCIDIAJBA3YiBEEDdEHsNGpHGiADIAEoAgwiAkYEQEHENEHENCgCAEF+IAR3cTYCAAwCCyADIAI2AgwgAiADNgIIDAELIAEoAhghCAJAIAEgASgCDCIGRwRAIAQgASgCCCICTQRAIAIoAgwaCyACIAY2AgwgBiACNgIIDAELAkAgAUEUaiIDKAIAIgUNACABQRBqIgMoAgAiBQ0AQQAhBgwBCwNAIAMhAiAFIgZBFGoiAygCACIFDQAgBkEQaiEDIAYoAhAiBQ0ACyACQQA2AgALIAhFDQACQCABIAEoAhwiAkECdEH0NmoiAygCAEYEQCADIAY2AgAgBg0BQcg0Qcg0KAIAQX4gAndxNgIADAILIAhBEEEUIAgoAhAgAUYbaiAGNgIAIAZFDQELIAYgCDYCGCABKAIQIgIEQCAGIAI2AhAgAiAGNgIYCyABKAIUIgJFDQAgBiACNgIUIAIgBjYCGAsgASAKaiEBIAAgCmohAAsgASABKAIEQX5xNgIEIAcgAEEBcjYCBCAAIAdqIAA2AgAgAEH/AU0EQCAAQQN2IgFBA3RB7DRqIQACf0HENCgCACICQQEgAXQiAXFFBEBBxDQgASACcjYCACAADAELIAAoAggLIQEgACAHNgIIIAEgBzYCDCAHIAA2AgwgByABNgIIDAMLIAcCf0EAIABBCHYiAUUNABpBHyAAQf///wdLDQAaIAEgAUGA/j9qQRB2QQhxIgF0IgIgAkGA4B9qQRB2QQRxIgJ0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAEgAnIgA3JrIgFBAXQgACABQRVqdkEBcXJBHGoLIgE2AhwgB0IANwIQIAFBAnRB9DZqIQICQEHINCgCACIDQQEgAXQiBHFFBEBByDQgAyAEcjYCACACIAc2AgAMAQsgAEEAQRkgAUEBdmsgAUEfRht0IQMgAigCACEBA0AgASICKAIEQXhxIABGDQMgA0EddiEBIANBAXQhAyACIAFBBHFqIgQoAhAiAQ0ACyAEIAc2AhALIAcgAjYCGCAHIAc2AgwgByAHNgIIDAILQdA0IAZBWGoiAEF4IAFrQQdxQQAgAUEIakEHcRsiAmsiBzYCAEHcNCABIAJqIgI2AgAgAiAHQQFyNgIEIAAgAWpBKDYCBEHgNEGsOCgCADYCACADIARBJyAEa0EHcUEAIARBWWpBB3EbakFRaiIAIAAgA0EQakkbIgJBGzYCBCACQYw4KQIANwIQIAJBhDgpAgA3AghBjDggAkEIajYCAEGIOCAGNgIAQYQ4IAE2AgBBkDhBADYCACACQRhqIQADQCAAQQc2AgQgAEEIaiEBIABBBGohACAEIAFLDQALIAIgA0YNAyACIAIoAgRBfnE2AgQgAyACIANrIgRBAXI2AgQgAiAENgIAIARB/wFNBEAgBEEDdiIBQQN0Qew0aiEAAn9BxDQoAgAiAkEBIAF0IgFxRQRAQcQ0IAEgAnI2AgAgAAwBCyAAKAIICyEBIAAgAzYCCCABIAM2AgwgAyAANgIMIAMgATYCCAwECyADQgA3AhAgAwJ/QQAgBEEIdiIARQ0AGkEfIARB////B0sNABogACAAQYD+P2pBEHZBCHEiAHQiASABQYDgH2pBEHZBBHEiAXQiAiACQYCAD2pBEHZBAnEiAnRBD3YgACABciACcmsiAEEBdCAEIABBFWp2QQFxckEcagsiADYCHCAAQQJ0QfQ2aiEBAkBByDQoAgAiAkEBIAB0IgZxRQRAQcg0IAIgBnI2AgAgASADNgIAIAMgATYCGAwBCyAEQQBBGSAAQQF2ayAAQR9GG3QhACABKAIAIQEDQCABIgIoAgRBeHEgBEYNBCAAQR12IQEgAEEBdCEAIAIgAUEEcWoiBigCECIBDQALIAYgAzYCECADIAI2AhgLIAMgAzYCDCADIAM2AggMAwsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIICyAJQQhqIQAMBQsgAigCCCIAIAM2AgwgAiADNgIIIANBADYCGCADIAI2AgwgAyAANgIIC0HQNCgCACIAIAVNDQBB0DQgACAFayIBNgIAQdw0Qdw0KAIAIgAgBWoiAjYCACACIAFBAXI2AgQgACAFQQNyNgIEIABBCGohAAwDC0HANEEwNgIAQQAhAAwCCwJAIAhFDQACQCAEKAIcIgBBAnRB9DZqIgMoAgAgBEYEQCADIAE2AgAgAQ0BQcg0IAdBfiAAd3EiBzYCAAwCCyAIQRBBFCAIKAIQIARGG2ogATYCACABRQ0BCyABIAg2AhggBCgCECIABEAgASAANgIQIAAgATYCGAsgBCgCFCIARQ0AIAEgADYCFCAAIAE2AhgLAkAgAkEPTQRAIAQgAiAFaiIAQQNyNgIEIAAgBGoiACAAKAIEQQFyNgIEDAELIAQgBUEDcjYCBCAEIAVqIgMgAkEBcjYCBCACIANqIAI2AgAgAkH/AU0EQCACQQN2IgFBA3RB7DRqIQACf0HENCgCACICQQEgAXQiAXFFBEBBxDQgASACcjYCACAADAELIAAoAggLIQEgACADNgIIIAEgAzYCDCADIAA2AgwgAyABNgIIDAELIAMCf0EAIAJBCHYiAEUNABpBHyACQf///wdLDQAaIAAgAEGA/j9qQRB2QQhxIgB0IgEgAUGA4B9qQRB2QQRxIgF0IgUgBUGAgA9qQRB2QQJxIgV0QQ92IAAgAXIgBXJrIgBBAXQgAiAAQRVqdkEBcXJBHGoLIgA2AhwgA0IANwIQIABBAnRB9DZqIQECQAJAIAdBASAAdCIFcUUEQEHINCAFIAdyNgIAIAEgAzYCAAwBCyACQQBBGSAAQQF2ayAAQR9GG3QhACABKAIAIQUDQCAFIgEoAgRBeHEgAkYNAiAAQR12IQUgAEEBdCEAIAEgBUEEcWoiBigCECIFDQALIAYgAzYCEAsgAyABNgIYIAMgAzYCDCADIAM2AggMAQsgASgCCCIAIAM2AgwgASADNgIIIANBADYCGCADIAE2AgwgAyAANgIICyAEQQhqIQAMAQsCQCAJRQ0AAkAgASgCHCIAQQJ0QfQ2aiICKAIAIAFGBEAgAiAENgIAIAQNAUHINCAKQX4gAHdxNgIADAILIAlBEEEUIAkoAhAgAUYbaiAENgIAIARFDQELIAQgCTYCGCABKAIQIgAEQCAEIAA2AhAgACAENgIYCyABKAIUIgBFDQAgBCAANgIUIAAgBDYCGAsCQCADQQ9NBEAgASADIAVqIgBBA3I2AgQgACABaiIAIAAoAgRBAXI2AgQMAQsgASAFQQNyNgIEIAEgBWoiBCADQQFyNgIEIAMgBGogAzYCACAIBEAgCEEDdiIFQQN0Qew0aiEAQdg0KAIAIQICf0EBIAV0IgUgBnFFBEBBxDQgBSAGcjYCACAADAELIAAoAggLIQUgACACNgIIIAUgAjYCDCACIAA2AgwgAiAFNgIIC0HYNCAENgIAQcw0IAM2AgALIAFBCGohAAsgC0EQaiQAIAAL0Q8DCH8Cfgh8RAAAAAAAAPA/IQwCQAJAAkAgAb0iCkIgiKciA0H/////B3EiAiAKpyIGckUNACAAvSILQiCIpyEHIAunIglFQQAgB0GAgMD/A0YbDQAgB0H/////B3EiBEGAgMD/B0sgBEGAgMD/B0YgCUEAR3FyIAJBgIDA/wdLckVBACAGRSACQYCAwP8HR3IbRQRAIAAgAaAPCwJAAn8CQAJ/QQAgB0F/Sg0AGkECIAJB////mQRLDQAaQQAgAkGAgMD/A0kNABogAkEUdiEIIAJBgICAigRJDQFBACAGQbMIIAhrIgV2IgggBXQgBkcNABpBAiAIQQFxawsiBSAGRQ0BGgwCCyAGDQFBACACQZMIIAhrIgV2IgYgBXQgAkcNABpBAiAGQQFxawshBSACQYCAwP8HRgRAIARBgIDAgHxqIAlyRQ0CIARBgIDA/wNPBEAgAUQAAAAAAAAAACADQX9KGw8LRAAAAAAAAAAAIAGaIANBf0obDwsgAkGAgMD/A0YEQCADQX9KBEAgAA8LRAAAAAAAAPA/IACjDwsgA0GAgICABEYEQCAAIACiDwsgA0GAgID/A0cgB0EASHINACAAnw8LIACZIQwgB0H/////A3FBgIDA/wNHQQAgBBsgCXJFBEBEAAAAAAAA8D8gDKMgDCADQQBIGyEMIAdBf0oNASAFIARBgIDAgHxqckUEQCAMIAyhIgAgAKMPCyAMmiAMIAVBAUYbDwtEAAAAAAAA8D8hDSAHQX9KIAVBAUtyRQRAIAVBAWsEQCAAIAChIgAgAKMPC0QAAAAAAADwvyENCwJ8IAJBgYCAjwRPBEAgAkGBgMCfBE8EQCAEQf//v/8DTQRARAAAAAAAAPB/RAAAAAAAAAAAIANBAEgbDwtEAAAAAAAA8H9EAAAAAAAAAAAgA0EAShsPCyAEQf7/v/8DTQRAIA1EnHUAiDzkN36iRJx1AIg85Dd+oiANRFnz+MIfbqUBokRZ8/jCH26lAaIgA0EASBsPCyAEQYGAwP8DTwRAIA1EnHUAiDzkN36iRJx1AIg85Dd+oiANRFnz+MIfbqUBokRZ8/jCH26lAaIgA0EAShsPCyAMRAAAAAAAAPC/oCIARAAAAGBHFfc/oiIMIABERN9d+AuuVD6iIAAgAKJEAAAAAAAA4D8gACAARAAAAAAAANC/okRVVVVVVVXVP6CioaJE/oIrZUcV97+ioCIPoL1CgICAgHCDvyIAIAyhDAELIAxEAAAAAAAAQEOiIgAgDCAEQYCAwABJIgIbIQwgAL1CIIinIAQgAhsiA0H//z9xIgRBgIDA/wNyIQUgA0EUdUHMd0GBeCACG2ohA0EAIQICQCAEQY+xDkkNACAEQfrsLkkEQEEBIQIMAQsgBUGAgEBqIQUgA0EBaiEDCyACQQN0IgRBoCxqKwMAIhEgDL1C/////w+DIAWtQiCGhL8iDyAEQYAsaisDACIOoSIQRAAAAAAAAPA/IA4gD6CjIhKiIgy9QoCAgIBwg78iACAAIACiIhNEAAAAAAAACECgIAwgAKAgEiAQIAAgBUEBdUGAgICAAnIgAkESdGpBgIAgaq1CIIa/IhCioSAAIA8gECAOoaGioaIiD6IgDCAMoiIAIACiIAAgACAAIAAgAETvTkVKKH7KP6JEZdvJk0qGzT+gokQBQR2pYHTRP6CiRE0mj1FVVdU/oKJE/6tv27Zt2z+gokQDMzMzMzPjP6CioCIOoL1CgICAgHCDvyIAoiIQIA8gAKIgDCAOIABEAAAAAAAACMCgIBOhoaKgIgygvUKAgICAcIO/IgBEAAAA4AnH7j+iIg4gBEGQLGorAwAgDCAAIBChoUT9AzrcCcfuP6IgAET1AVsU4C8+vqKgoCIPoKAgA7ciDKC9QoCAgIBwg78iACAMoSARoSAOoQshDiAAIApCgICAgHCDvyIRoiIMIA8gDqEgAaIgASARoSAAoqAiAKAiAb0iCqchAgJAIApCIIinIgNBgIDAhAROBEAgA0GAgMD7e2ogAnINAyAARP6CK2VHFZc8oCABIAyhZEEBcw0BDAMLIANBgPj//wdxQYCYw4QESQ0AIANBgOi8+wNqIAJyDQMgACABIAyhZUEBcw0ADAMLQQAhAiANAnwgA0H/////B3EiBEGBgID/A08EfkEAQYCAwAAgBEEUdkGCeGp2IANqIgRB//8/cUGAgMAAckGTCCAEQRR2Qf8PcSIFa3YiAmsgAiADQQBIGyECIAAgDEGAgEAgBUGBeGp1IARxrUIghr+hIgygvQUgCgtCgICAgHCDvyIBRAAAAABDLuY/oiINIAAgASAMoaFE7zn6/kIu5j+iIAFEOWyoDGFcIL6ioCIMoCIAIAAgACAAIACiIgEgASABIAEgAUTQpL5yaTdmPqJE8WvSxUG9u76gokQs3iWvalYRP6CiRJO9vhZswWa/oKJEPlVVVVVVxT+goqEiAaIgAUQAAAAAAAAAwKCjIAwgACANoaEiASAAIAGioKGhRAAAAAAAAPA/oCIAvSIKQiCIpyACQRR0aiIDQf//P0wEQCAAIAIQDQwBCyAKQv////8PgyADrUIghoS/C6IhDAsgDA8LIA1EnHUAiDzkN36iRJx1AIg85Dd+og8LIA1EWfP4wh9upQGiRFnz+MIfbqUBogvKAQECfyMAQRBrIgEkAAJ8IAC9QiCIp0H/////B3EiAkH7w6T/A00EQEQAAAAAAADwPyACQZ7BmvIDSQ0BGiAARAAAAAAAAAAAEBYMAQsgACAAoSACQYCAwP8HTw0AGiAAIAEQKEEDcSICQQJNBEACQAJAAkAgAkEBaw4CAQIACyABKwMAIAErAwgQFgwDCyABKwMAIAErAwhBARAVmgwCCyABKwMAIAErAwgQFpoMAQsgASsDACABKwMIQQEQFQshACABQRBqJAAgAAvBAQEFfyMAQfABayIEJAAgBCAANgIAQQEhBgJAIAJBAkgNACAAIQUDQCAAIAVBfGoiByADIAJBfmoiCEECdGooAgBrIgUgAREBAEEATgRAIAAgByABEQEAQX9KDQILIAQgBkECdGohAAJAIAUgByABEQEAQQBOBEAgACAFNgIAIAJBf2ohCAwBCyAAIAc2AgAgByEFCyAGQQFqIQYgCEECSA0BIAQoAgAhACAIIQIMAAALAAsgBCAGECogBEHwAWokAAseACAAEAggABAIQQh0aiAAEAhBEHRqIAAQCEEYdGoLyQEBA38CQAJAIAAoAugKRQRAIAAoAuQKIgFBf0YEQCAAIAAoAtwIQX9qNgLsCiAAEBtFBEAgAEEBNgLoCkEADwsgAC0A3wpBAXFFDQIgACgC5AohAQsgACABQQFqIgM2AuQKIAAgAWpB4AhqLQAAIgJB/wFHBEAgACABNgLsCiAAQQE2AugKCyADIAAoAtwITgRAIABBfzYC5AoLIAAtAOAKDQIgACACOgDgCgsgAg8LIABBIBADQQAPC0H/CEGACEGADEGUCRAAAAtPAAJ/AkADQCAAKALkCkF/Rw0BQQAgABAbRQ0CGiAALQDfCkEBcUUNAAsgAEEgEANBAA8LIABCADcC9AogAEEANgLoCiAAQQA6AOAKQQELCwcAIAAQPkULOQEBfyAAKAIgIgMgAmogACgCKEsEQCAAQQE2AmBBAA8LIAEgAyACEBIaIAAgACgCICACajYCIEEBCxoAIABBGHYgAXNBAnRBwCxqKAIAIABBCHRzC78JAwR/AX4EfCMAQTBrIgQkAAJAAkACQCAAvSIGQiCIpyICQf////8HcSIDQfrUvYAETQRAIAJB//8/cUH7wyRGDQEgA0H8souABE0EQCAGQgBZBEAgASAARAAAQFT7Ifm/oCIARDFjYhphtNC9oCIHOQMAIAEgACAHoUQxY2IaYbTQvaA5AwhBASECDAULIAEgAEQAAEBU+yH5P6AiAEQxY2IaYbTQPaAiBzkDACABIAAgB6FEMWNiGmG00D2gOQMIQX8hAgwECyAGQgBZBEAgASAARAAAQFT7IQnAoCIARDFjYhphtOC9oCIHOQMAIAEgACAHoUQxY2IaYbTgvaA5AwhBAiECDAQLIAEgAEQAAEBU+yEJQKAiAEQxY2IaYbTgPaAiBzkDACABIAAgB6FEMWNiGmG04D2gOQMIQX4hAgwDCyADQbuM8YAETQRAIANBvPvXgARNBEAgA0H8ssuABEYNAiAGQgBZBEAgASAARAAAMH982RLAoCIARMqUk6eRDum9oCIHOQMAIAEgACAHoUTKlJOnkQ7pvaA5AwhBAyECDAULIAEgAEQAADB/fNkSQKAiAETKlJOnkQ7pPaAiBzkDACABIAAgB6FEypSTp5EO6T2gOQMIQX0hAgwECyADQfvD5IAERg0BIAZCAFkEQCABIABEAABAVPshGcCgIgBEMWNiGmG08L2gIgc5AwAgASAAIAehRDFjYhphtPC9oDkDCEEEIQIMBAsgASAARAAAQFT7IRlAoCIARDFjYhphtPA9oCIHOQMAIAEgACAHoUQxY2IaYbTwPaA5AwhBfCECDAMLIANB+sPkiQRLDQELIAEgACAARIPIyW0wX+Q/okQAAAAAAAA4Q6BEAAAAAAAAOMOgIghEAABAVPsh+b+ioCIHIAhEMWNiGmG00D2iIgqhIgA5AwAgA0EUdiIFIAC9QjSIp0H/D3FrQRFIIQMCfyAImUQAAAAAAADgQWMEQCAIqgwBC0GAgICAeAshAgJAIAMNACABIAcgCEQAAGAaYbTQPaIiAKEiCSAIRHNwAy6KGaM7oiAHIAmhIAChoSIKoSIAOQMAIAUgAL1CNIinQf8PcWtBMkgEQCAJIQcMAQsgASAJIAhEAAAALooZozuiIgChIgcgCETBSSAlmoN7OaIgCSAHoSAAoaEiCqEiADkDAAsgASAHIAChIAqhOQMIDAELIANBgIDA/wdPBEAgASAAIAChIgA5AwAgASAAOQMIQQAhAgwBCyAGQv////////8Hg0KAgICAgICAsMEAhL8hAEEAIQIDQCAEQRBqIAIiBUEDdGoCfyAAmUQAAAAAAADgQWMEQCAAqgwBC0GAgICAeAu3Igc5AwAgACAHoUQAAAAAAABwQaIhAEEBIQIgBUUNAAsgBCAAOQMgAkAgAEQAAAAAAAAAAGIEQEECIQIMAQtBASEFA0AgBSICQX9qIQUgBEEQaiACQQN0aisDAEQAAAAAAAAAAGENAAsLIARBEGogBCADQRR2Qep3aiACQQFqED0hAiAEKwMAIQAgBkJ/VwRAIAEgAJo5AwAgASAEKwMImjkDCEEAIAJrIQIMAQsgASAAOQMAIAEgBCkDCDcDCAsgBEEwaiQAIAILkQMBBn8gACgCICECAkACQCAAKALkCiIBQX9GBEBBASEDQX8hAQwBCyABIAAoAtwIIgQgASAEShshAwNAAkACQCABIANHBEAgAiAAIAFqQeAIai0AACIFaiECIAVB/wFGDQEgASEDCyACIAAoAihLDQFBfyADIAMgBEYbIQFBACEDDAMLIAFBAWohAQwBCwsgAEEBEAMMAQsDQCABQX9HBEBBAQ8LIAJBGmogACgCKCIETwRAIABBARADDAILIAIoAABBsCwoAABHBEAgAEEVEAMMAgsgAi0ABARAIABBFRADDAILAkAgAwRAIAAoAuAHRQ0BIAItAAVBAXFFDQEgAEEVEAMMAwsgAi0ABUEBcQ0AIABBFRADDAILQQAhASACQRtqIgUgAi0AGiIDaiICIARLBEAgAEEBEAMMAgsDQAJAIAEgA0YEQCADIQEMAQsgAiABIAVqLQAAIgZqIQIgBkH/AUcNACABQQFqIQEMAQsLQX8gASABIANGGyEBQQAhAyACIARNDQALIABBARADC0EAC6QBAQZ/QQQhAyMAQYACayIEJAACQCABQQJIDQAgACABQQJ0aiIHIAQ2AgAgBCECA0AgAiAAKAIAIANBgAIgA0GAAkkbIgUQEhpBACECA0AgACACQQJ0aiIGKAIAIAAgAkEBaiICQQJ0aigCACAFEBIaIAYgBigCACAFajYCACABIAJHDQALIAMgBWsiA0UNASAHKAIAIQIMAAALAAsgBEGAAmokAAsmAQF/IAAoAgBBf2poIgFFBEAgACgCBGgiAEEgakEAIAAbDwsgAQuqBAEFfyMAQdABayIDJAAgA0IBNwMIAkAgAUECdCIHRQ0AIANBBDYCECADQQQ2AhRBBCIBIQZBAiEEA0AgA0EQaiAEQQJ0aiABIgUgBkEEamoiATYCACAEQQFqIQQgBSEGIAEgB0kNAAsCQCAAIAdqQXxqIgUgAE0EQEEBIQRBASEBDAELQQEhBEEBIQEDQAJ/IARBA3FBA0YEQCAAIAIgASADQRBqECEgA0EIakECEBogAUECagwBCwJAIANBEGogAUF/aiIGQQJ0aigCACAFIABrTwRAIAAgAiADQQhqIAFBACADQRBqEBkMAQsgACACIAEgA0EQahAhCyABQQFGBEAgA0EIakEBEBhBAAwBCyADQQhqIAYQGEEBCyEBIAMgAygCCEEBciIENgIIIABBBGoiACAFSQ0ACwsgACACIANBCGogAUEAIANBEGoQGQNAAn8CQAJAIAFBAUcgBEEBR3JFBEAgAygCDA0BDAULIAFBAUoNAQsgA0EIaiADQQhqECsiBRAaIAMoAgghBCABIAVqDAELIANBCGpBAhAYIAMgAygCCEEHczYCCCADQQhqQQEQGiAAQXxqIgYgA0EQaiABQX5qIgVBAnRqKAIAayACIANBCGogAUF/akEBIANBEGoQGSADQQhqQQEQGCADIAMoAghBAXIiBDYCCCAGIAIgA0EIaiAFQQEgA0EQahAZIAULIQEgAEF8aiEADAAACwALIANB0AFqJAALOAACfyAALQAXBEBBASABQf8BRw0BGkGuFUGACEGACUG9FRAAAAsgAUH/AUYEQEEADwsgAUEKSwsLSQECfyAAKAIgIQYCfyAGIAJBAnRqIAAtABdFDQAaIAYgA0ECdCIHaiABNgIAIAAoAgggA2ogBDoAACACIQEgBSAHagsgATYCAAvJAQIFfwp9IAAgACoCACIHIABBcGoiAioCACIIkiIGIABBeGoiASoCACIJIABBaGoiAyoCACILkiIKkjgCACABIAYgCpM4AgAgAEF0aiIBIABBfGoiBCoCACIGIABBbGoiBSoCACIKkiIMIAEqAgAiDSAAQWRqIgAqAgAiDpIiD5M4AgAgACAJIAuTIgkgBiAKkyIGkjgCACACIAcgCJMiByANIA6TIgiSOAIAIAMgByAIkzgCACAEIA8gDJI4AgAgBSAGIAmTOAIAC9IBAQJ/IAEtABVFBEAgAEEVEANBfw8LIAAoAvQKQQlMBEAgABAMCwJ/IAEgACgC8AoiAkH/B3FBAXRqLgEkIgNBAE4EQCAAIAIgASgCCCADai0AACICdjYC8AogAEEAIAAoAvQKIAJrIgIgAkEASCICGzYC9ApBfyADIAIbDAELIAAgARAQCyEDAkAgAS0AFwRAIAMgASgCrBBODQELAkAgA0F/Sg0AIAAtAOAKRQRAIAAoAugKDQELIABBFRADCyADDwtB2ApBgAhB5A1B7goQAAALtQQCAn8EfSAAQQNxRQRAIABBAnUhBiABIAJBAnRqIgAgA0ECdGohAwNAIAZBAUhFBEAgA0F8aiIBKgIAIQcgACAAKgIAIgggAyoCACIJkjgCACAAQXxqIgIgAioCACIKIAEqAgCSOAIAIAMgCCAJkyIIIAQqAgCUIAogB5MiByAEKgIElJM4AgAgASAHIAQqAgCUIAggBCoCBJSSOAIAIANBdGoiASoCACEHIABBeGoiAiACKgIAIgggA0F4aiICKgIAIgmSOAIAIABBdGoiBSAFKgIAIgogASoCAJI4AgAgAiAIIAmTIgggBCoCIJQgCiAHkyIHIAQqAiSUkzgCACABIAcgBCoCIJQgCCAEKgIklJI4AgAgA0FsaiIBKgIAIQcgAEFwaiICIAIqAgAiCCADQXBqIgIqAgAiCZI4AgAgAEFsaiIFIAUqAgAiCiABKgIAkjgCACACIAggCZMiCCAEKgJAlCAKIAeTIgcgBCoCRJSTOAIAIAEgByAEKgJAlCAIIAQqAkSUkjgCACADQWRqIgEqAgAhByAAQWhqIgIgAioCACIIIANBaGoiAioCACIJkjgCACAAQWRqIgUgBSoCACIKIAEqAgCSOAIAIAIgCCAJkyIIIAQqAmCUIAogB5MiByAEKgJklJM4AgAgASAHIAQqAmCUIAggBCoCZJSSOAIAIAZBf2ohBiADQWBqIQMgAEFgaiEAIARBgAFqIQQMAQsLDwtBkBNBgAhB2hJBnRMQAAALsgQCB38BfQJAIAEtABUEQCADIAZsIQ4gBCgCACEJIAUoAgAhCyABKAIAIQwCfwNAIAdBAU4EQCAAKAL0CkEJTARAIAAQDAsCfyABIAAoAvAKIghB/wdxQQF0ai4BJCIGQQBOBEAgACAIIAEoAgggBmotAAAiCHY2AvAKIABBACAAKAL0CiAIayIIIAhBAEgiCBs2AvQKQX8gBiAIGwwBCyAAIAEQEAshCCABLQAXBEAgCCABKAKsEE4NBQsgCEF/TARAIAAtAOAKRQRAQQAgACgC6AoNBBoLIABBFRADQQAPC0EAIQYgDiADIAtsIg1rIAlqIAwgDCANaiAJaiAOShsiDEEAIAxBAEobIQ0gASgCACAIbCEIQwAAAAAhDwJAIAEtABYEQANAIAYgDUYNAiAPIAEoAhwgBiAIakECdGoqAgCSIQ8gAiAJQQJ0aigCACIKBEAgCiALQQJ0aiIKIA8gCioCAJI4AgALQQAgCUEBaiIJIAMgCUYiChshCSAGQQFqIQYgCiALaiELDAAACwALA0AgBiANRg0BIAIgCUECdGooAgAiCgRAIAogC0ECdGoiCiAKKgIAIAEoAhwgBiAIakECdGoqAgBDAAAAAJKSOAIAC0EAIAlBAWoiCSADIAlGIgobIQkgBkEBaiEGIAogC2ohCwwAAAsACyAHIAxrIQcMAQsLIAQgCTYCACAFIAs2AgBBAQsPCyAAQRUQA0EADwtBkApBgAhBwg5BtAoQAAALwAIBBX8CQCAALQDhCkUNACAALQAwDQAgACAAEDVBfGo2AjgLIAAQBwRAIABBHxADQQAPCyAAIAAQBzoA3wogABALIQMgABALIQEgABALGiAAIAAQCzYC2AggABALGiAAIAAQByICNgLcCCAAIABB4AhqIAIQJkUEQCAAQQoQA0EADwsgAEF+NgL8CgJAIAEgA3FBf0YNACAAKALcCCEBA0AgAUEBSA0BIAAgAUF/aiIBakHgCGotAABB/wFGDQALIAAgAzYCgAsgACABNgL8CgsgAC0A4QoEQEEAIQEgACgC3AgiBEEAIARBAEobIQVBACECA0AgASAFRkUEQCACIAAgAWpB4AhqLQAAaiECIAFBAWohAQwBCwsgAEFAayADNgIAIAAgACgCOCACIARqakEbajYCPAsgAEEANgLkCkEBCyoBAXwgAEH///8AcbgiAZogASAAQQBIG7a7IABBFXZB/wdxQex5ahANtgsaAQF/IAAtADAEf0EABSAAKAIgIAAoAiRrCwvMAQEEfyAAIAFBAnRqIgNBrAhqIgQgACACQQF0QXxxIgYQBTYCACADQbQIaiIFIAAgBhAFNgIAIANBvAhqIAAgAkF8cRAFIgM2AgACQAJAIAQoAgAiBEUgA0VyRQRAIAUoAgAiBQ0BCwwBCyACIAQgBSADEEEgACABQQJ0aiIDQcQIaiAAIAYQBSIBNgIAIAFFBEAMAQsgAiABEEAgA0HMCGogACACQQN1QQF0EAUiATYCACABRQRADAELIAIgARA/QQEPCyAAQQMQA0EACw4AA0AgABAcQX9HDQALCyMAIAAgACgCICABaiIBNgIgIAEgACgCKE8EQCAAQQE2AmALC8EEAQR/IAAgACgCFBAGA0AgACgCHCECIAEgACgCGE5FBEAgACACIAFBAnRqKAIAEAYgAUEBaiEBDAELCyAAIAIQBgJAIAAoAowDRQ0AA0AgAyAAKAKIAk4NASAAKAKMAyADQRhsaiIEKAIQIgIEQEEAIQEDQCABIAAoAnwgBC0ADUGwEGxqKAIETkUEQCAAIAIgAUECdGooAgAQBiABQQFqIQEgBCgCECECDAELCyAAIAIQBgsgACAEKAIUEAYgA0EBaiEDDAAACwALIAAoAnwEQEEAIQIDQCACIAAoAnhORQRAIAAgACgCfCACQbAQbGoiASgCCBAGIAAgASgCHBAGIAAgASgCIBAGIAAgASgCpBAQBiAAIAEoAqgQIgFBfGpBACABGxAGIAJBAWohAgwBCwsgACAAKAJ8EAYLIAAgACgChAIQBiAAIAAoAowDEAYgACgClAMiAgRAQQAhAQNAIAEgACgCkANORQRAIAAgAiABQShsaigCBBAGIAFBAWohASAAKAKUAyECDAELCyAAIAIQBgtBACECQQAhAQNAAkAgAUEPSw0AIAEgACgCBE4NACAAIAAgAUECdGoiAygCoAYQBiAAIAMoAqAHEAYgACADKALkBxAGIAFBAWohAQwBCwsDQCACQQJGRQRAIAAgACACQQJ0aiIBQawIaigCABAGIAAgAUG0CGooAgAQBiAAIAFBvAhqKAIAEAYgACABQcQIaigCABAGIAAgAUHMCGooAgAQBiACQQFqIQIMAQsLC14BAX8jAEEQayIEJAACf0EAIAAgAiAEQQhqIAMgBEEEaiAEQQxqEF9FDQAaIAAgASAAIAQoAgxBBmxqQZwDaiACKAIAIAMoAgAgBCgCBCACEF4LIQAgBEEQaiQAIAALnQMDA38BfgJ8AkACQAJAAkAgAL0iBEIAWQRAIARCIIinIgFB//8/Sw0BCyAEQv///////////wCDUARARAAAAAAAAPC/IAAgAKKjDwsgBEJ/VQ0BIAAgAKFEAAAAAAAAAACjDwsgAUH//7//B0sNAkGAgMD/AyECQYF4IQMgAUGAgMD/A0cEQCABIQIMAgsgBKcNAUQAAAAAAAAAAA8LIABEAAAAAAAAUEOivSIEQiCIpyECQct3IQMLIAMgAkHiviVqIgFBFHZqtyIFRAAA4P5CLuY/oiAEQv////8PgyABQf//P3FBnsGa/wNqrUIghoS/RAAAAAAAAPC/oCIAIAVEdjx5Ne856j2iIAAgAEQAAAAAAAAAQKCjIgUgACAARAAAAAAAAOA/oqIiBiAFIAWiIgUgBaIiACAAIABEn8Z40Amawz+iRK94jh3Fccw/oKJEBPqXmZmZ2T+goiAFIAAgACAARERSPt8S8cI/okTeA8uWZEbHP6CiRFmTIpQkSdI/oKJEk1VVVVVV5T+goqCgoqAgBqGgoCEACyAAC7cDAwJ/AX4CfCAAvSIDQj+IpyEBAkACQAJ8AkAgAAJ/AkACQCADQiCIp0H/////B3EiAkGrxpiEBE8EQCADQv///////////wCDQoCAgICAgID4/wBWBEAgAA8LIABE7zn6/kIuhkBkQQFzRQRAIABEAAAAAAAA4H+iDwsgAETSvHrdKyOGwGNBAXMNASAARFEwLdUQSYfAY0UNAQwGCyACQcPc2P4DSQ0DIAJBssXC/wNJDQELIABE/oIrZUcV9z+iIAFBA3RB8CtqKwMAoCIEmUQAAAAAAADgQWMEQCAEqgwCC0GAgICAeAwBCyABQQFzIAFrCyIBtyIERAAA4P5CLua/oqAiACAERHY8eTXvOeo9oiIFoQwBCyACQYCAwPEDTQ0CQQAhASAACyEEIAAgBCAEIAQgBKIiACAAIAAgACAARNCkvnJpN2Y+okTxa9LFQb27vqCiRCzeJa9qVhE/oKJEk72+FmzBZr+gokQ+VVVVVVXFP6CioSIAokQAAAAAAAAAQCAAoaMgBaGgRAAAAAAAAPA/oCEEIAFFDQAgBCABEA0hBAsgBA8LIABEAAAAAAAA8D+gC6AOAhF/AnwjAEGwBGsiBiQAIAIgAkF9akEYbSIEQQAgBEEAShsiDkFobGohB0HUFSgCACILIANBf2oiCGpBAE4EQCADIAtqIQQgDiAIayECA0AgBkHAAmogBUEDdGogAkEASAR8RAAAAAAAAAAABSACQQJ0QeAVaigCALcLOQMAIAJBAWohAiAFQQFqIgUgBEcNAAsLIAdBaGohCUEAIQQgC0EAIAtBAEobIQ0gA0EBSCEFA0ACQCAFBEBEAAAAAAAAAAAhFQwBCyAEIAhqIQpBACECRAAAAAAAAAAAIRUDQCAVIAAgAkEDdGorAwAgBkHAAmogCiACa0EDdGorAwCioCEVIAJBAWoiAiADRw0ACwsgBiAEQQN0aiAVOQMAIAQgDUYhAiAEQQFqIQQgAkUNAAtBLyAHayESQTAgB2shDyAHQWdqIRAgCyEEAkADQCAGIARBA3RqKwMAIRVBACECIAQhBSAEQQFIIgxFBEADQCAGQeADaiACQQJ0agJ/IBUCfyAVRAAAAAAAAHA+oiIVmUQAAAAAAADgQWMEQCAVqgwBC0GAgICAeAu3IhVEAAAAAAAAcMGioCIWmUQAAAAAAADgQWMEQCAWqgwBC0GAgICAeAs2AgAgBiAFQX9qIgVBA3RqKwMAIBWgIRUgAkEBaiICIARHDQALCwJ/IBUgCRANIhUgFUQAAAAAAADAP6KcRAAAAAAAACDAoqAiFZlEAAAAAAAA4EFjBEAgFaoMAQtBgICAgHgLIQggFSAIt6EhFQJAAkACQAJ/IAlBAUgiE0UEQCAEQQJ0IAZqIgIgAigC3AMiAiACIA91IgIgD3RrIgU2AtwDIAIgCGohCCAFIBJ1DAELIAkNASAEQQJ0IAZqKALcA0EXdQsiCkEBSA0CDAELQQIhCiAVRAAAAAAAAOA/ZkEBc0UNAEEAIQoMAQtBACECQQAhBSAMRQRAA0AgBkHgA2ogAkECdGoiFCgCACEMQf///wchEQJ/AkAgBQ0AQYCAgAghESAMDQBBAAwBCyAUIBEgDGs2AgBBAQshBSACQQFqIgIgBEcNAAsLAkAgEyAQQQFLcg0AIBBBAWsEQCAEQQJ0IAZqIgIgAigC3ANB////A3E2AtwDDAELIARBAnQgBmoiAiACKALcA0H///8BcTYC3AMLIAhBAWohCCAKQQJHDQBEAAAAAAAA8D8gFaEhFUECIQogBUUNACAVRAAAAAAAAPA/IAkQDaEhFQsgFUQAAAAAAAAAAGEEQEEAIQUCQCAEIgIgC0wNAANAIAZB4ANqIAJBf2oiAkECdGooAgAgBXIhBSACIAtKDQALIAVFDQAgCSEHA0AgB0FoaiEHIAZB4ANqIARBf2oiBEECdGooAgBFDQALDAMLQQEhAgNAIAIiBUEBaiECIAZB4ANqIAsgBWtBAnRqKAIARQ0ACyAEIAVqIQUDQCAGQcACaiADIARqIghBA3RqIARBAWoiBCAOakECdEHgFWooAgC3OQMAQQAhAkQAAAAAAAAAACEVIANBAU4EQANAIBUgACACQQN0aisDACAGQcACaiAIIAJrQQN0aisDAKKgIRUgAkEBaiICIANHDQALCyAGIARBA3RqIBU5AwAgBCAFSA0ACyAFIQQMAQsLAkAgFUEAIAlrEA0iFUQAAAAAAABwQWZBAXNFBEAgBkHgA2ogBEECdGoCfyAVAn8gFUQAAAAAAABwPqIiFZlEAAAAAAAA4EFjBEAgFaoMAQtBgICAgHgLIgK3RAAAAAAAAHDBoqAiFZlEAAAAAAAA4EFjBEAgFaoMAQtBgICAgHgLNgIAIARBAWohBAwBCwJ/IBWZRAAAAAAAAOBBYwRAIBWqDAELQYCAgIB4CyECIAkhBwsgBkHgA2ogBEECdGogAjYCAAtEAAAAAAAA8D8gBxANIRUgBEEATgRAIAQhAgNAIAYgAkEDdGogFSAGQeADaiACQQJ0aigCALeiOQMAIBVEAAAAAAAAcD6iIRVBACEAIAJBAEohAyACQX9qIQIgAw0ACyAEIQUDQCANIAAgDSAASRshAyAEIAVrIQdBACECRAAAAAAAAAAAIRUDQCAVIAJBA3RBsCtqKwMAIAYgAiAFakEDdGorAwCioCEVIAIgA0chCSACQQFqIQIgCQ0ACyAGQaABaiAHQQN0aiAVOQMAIAVBf2ohBSAAIARHIQIgAEEBaiEAIAINAAsLRAAAAAAAAAAAIRUgBEEATgRAIAQhAgNAIBUgBkGgAWogAkEDdGorAwCgIRUgAkEASiEAIAJBf2ohAiAADQALCyABIBWaIBUgChs5AwAgBisDoAEgFaEhFUEBIQIgBEEBTgRAA0AgFSAGQaABaiACQQN0aisDAKAhFSACIARHIQAgAkEBaiECIAANAAsLIAEgFZogFSAKGzkDCCAGQbAEaiQAIAhBB3ELRwEFf0EGIQJBtCwhAQJAA0AgAC0AACIDIAEtAAAiBEYEQCABQQFqIQEgAEEBaiEAIAJBf2oiAg0BDAILCyADIARrIQULIAULSAECfyAAQQN1IgNBACADQQBKGyEDQSQgABARayEAA0AgAiADRkUEQCABIAJBAXRqIAIQDyAAdkECdDsBACACQQFqIQIMAQsLC3cDAn8BfQF8IABBAXUiAEEAIABBAEobIQMgALchBQNAIAIgA0cEQCABIAJBAnRqIAK3RAAAAAAAAOA/oCAFo0QAAAAAAADgP6JEGC1EVPshCUCiEBS2IgQgBJS7RBgtRFT7Ifk/ohAUtjgCACACQQFqIQIMAQsLC6cCAgZ/AnwgAEECdSIEQQAgBEEAShshBiAAtyELQQAhBANAIAUgBkYEQEEAIQQgAEEDdSIAQQAgAEEAShshAEEAIQUDQCAAIARGRQRAIAMgBUECdGogBUEBciIBQQF0t0QYLURU+yEJQKIgC6MiChAgtjgCACADIAFBAnRqIAoQFLaMOAIAIAVBAmohBSAEQQFqIQQMAQsLBSABIARBAnQiB2ogBUECdLdEGC1EVPshCUCiIAujIgoQILY4AgAgASAEQQFyIghBAnQiCWogChAUtow4AgAgAiAHaiAIt0QYLURU+yEJQKIgC6NEAAAAAAAA4D+iIgoQILZDAAAAP5Q4AgAgAiAJaiAKEBS2QwAAAD+UOAIAIARBAmohBCAFQQFqIQUMAQsLC4wGAQx/IAAoAowLIgRBACAEQQBKGyEFA0AgAyAFRkUEQCAAIANBFGxqQZwLakEANgIAIANBAWohAwwBCwsCQAJAIARBA0oNAEEAIQMgAkEESA0BIAJBfWohAkEAIQQDQCACIARGDQECQAJAIAEgBGoiBy0AAEHPAEcNACAHKAAAQbAsKAAARw0AIARBGmoiCCACTg0BIARBG2oiCiABIAhqIgstAAAiBmogAk4NASAGQRtqIQlBACEFQQAhAwNAIAMgBkYEQEEAIQYDQEEWIQMgBUEWRkUEQCAGIAEgBCAFamotAAAQJyEGIAVBAWohBQwBCwsDQCADQRpGRQRAIANBAWohAyAGQQAQJyEGDAELCyAAIAAoAowLIgNBAWoiBTYCjAsgACADQRRsaiIDQZgLaiAGNgIAIANBlAtqIAlBZmo2AgAgA0GQC2ogBygAFjYCAAJ/QX8gASAIIAstAABqai0AAEH/AUYNABogBygABgshBiADQZwLaiAINgIAIANBoAtqIAY2AgAgBUEERg0FBSAJIAEgAyAKamotAABqIQkgA0EBaiEDDAELCwsgBEEBaiEEDAELCyAEIQILQQAhBANAIAAgBEEUbGoiA0GQC2ohBiADQZgLaiEIIANBlAtqIQkgA0GcC2ohDANAIAQgACgCjAsiDU4EQCACDwtBACEDIAIgDCgCACIKayIFIAkoAgAiCyALIAVKGyIHQQAgB0EAShshDiAIKAIAIQUDQCADIA5GRQRAIAUgASADIApqai0AABAnIQUgA0EBaiEDDAELCyAJIAsgB2siAzYCACAIIAU2AgAgA0UEQCAGKAIAIAVGBEAgAEF/NgLkCiAAQQA2AuAHIABBfzYCjAsgACAAIARBFGxqQaALaigCACIBNgKkCCAAIAFBf0c2AqgIIAcgCmohAwwECyAAIA1Bf2oiAzYCjAsgBiAAIANBFGxqIgNBoAtqKAIANgIQIAYgA0GYC2opAgA3AgggBiADQZALaikCADcCAAwBCwsgBEEBaiEEDAAACwALIAMLGQBBfyAAKAIAIgAgASgCACIBSyAAIAFJGwuPAQIDfwJ9AkAgACABEDAiBkEASA0AQQAhACABKAIAIgUgAyAFIANIGyIDQQAgA0EAShshAyAFIAZsIQZBASEFA0AgACADRg0BIAIgACAEbEECdGoiByAHKgIAIAggASgCHCAAIAZqQQJ0aioCAJIiCZI4AgAgCSAIIAEtABYbIQggAEEBaiEADAAACwALIAUL6AECA38BfQJAIAAgARAwIgVBAEgNACABKAIAIgQgAyAEIANIGyEAIAQgBWwhBSABLQAWRQRAQQAhAyAAQQAgAEEAShshAEEBIQQDQCAAIANGDQIgAiADQQJ0aiIGIAYqAgAgASgCHCADIAVqQQJ0aioCAEMAAAAAkpI4AgAgA0EBaiEDDAAACwALQQAhAyAAQQAgAEEAShshAEEBIQQDQCAAIANGDQEgAiADQQJ0aiIGIAYqAgAgByABKAIcIAMgBWpBAnRqKgIAkiIHkjgCACADQQFqIQMgByABKgIMkiEHDAAACwALIAQLqAMCAn8FfSABIAJBAnRqIgEgAEEGdGshAiADIARBA3VBAnRqKgIAIQsDQCABIAJNRQRAIAEgASoCACIHIAFBYGoiACoCACIIkjgCACABQXxqIgMgAyoCACIJIAFBXGoiAyoCACIKkjgCACAAIAcgCJM4AgAgAyAJIAqTOAIAIAFBeGoiAyADKgIAIgcgAUFYaiIDKgIAIgiSOAIAIAFBdGoiBCAEKgIAIgkgAUFUaiIEKgIAIgqSOAIAIAMgCyAHIAiTIgcgCSAKkyIIkpQ4AgAgBCALIAggB5OUOAIAIAFBbGoiAyoCACEHIAFBTGoiBCoCACEIIAFBcGoiBSABQVBqIgYqAgAiCSAFKgIAIgqSOAIAIAMgByAIkjgCACAGIAcgCJM4AgAgBCAJIAqTOAIAIAFBRGoiAyoCACEHIAFBZGoiBCoCACEIIAFBaGoiBSABQUhqIgYqAgAiCSAFKgIAIgqSOAIAIAQgCCAHkjgCACAGIAsgCSAKkyIJIAggB5MiB5KUOAIAIAMgCyAJIAeTlDgCACABEC8gABAvIAFBQGohAQwBCwsLvQQCAX8MfSABIAJBAnRqIgEgA0ECdGohAiAEIAVBDGxqIgMqAgAhDCAEIAVBA3QiB2oqAgAhDSAEIAVBAnRqIgUqAgAhDiADKgIEIQ8gBCAHQQRyaioCACEQIAUqAgQhESAEKgIEIRIgBCoCACETQQAgBmtBAnQhAwNAIABBAUhFBEAgAkF8aiIEKgIAIQggASABKgIAIgkgAioCACIKkjgCACABQXxqIgUgBSoCACILIAQqAgCSOAIAIAQgEiAJIAqTIgmUIBMgCyAIkyIIlJI4AgAgAiATIAmUIBIgCJSTOAIAIAJBdGoiBCoCACEIIAFBeGoiBSAFKgIAIgkgAkF4aiIFKgIAIgqSOAIAIAFBdGoiBiAGKgIAIgsgBCoCAJI4AgAgBCARIAkgCpMiCZQgDiALIAiTIgiUkjgCACAFIA4gCZQgESAIlJM4AgAgAkFsaiIEKgIAIQggAUFwaiIFIAUqAgAiCSACQXBqIgUqAgAiCpI4AgAgAUFsaiIGIAYqAgAiCyAEKgIAkjgCACAEIBAgCSAKkyIJlCANIAsgCJMiCJSSOAIAIAUgDSAJlCAQIAiUkzgCACACQWRqIgQqAgAhCCABQWhqIgUgBSoCACIJIAJBaGoiBSoCACIKkjgCACABQWRqIgYgBioCACILIAQqAgCSOAIAIAQgDyAJIAqTIgmUIAwgCyAIkyIIlJI4AgAgBSAMIAmUIA8gCJSTOAIAIABBf2ohACACIANqIQIgASADaiEBDAELCwvcAQEFfyAEIAJrIgYgAyABayIHbSEEAkAgBSADIAMgBUobIgMgAUwNACAEQQAgBGsgBEEASBsgB2wgBiAGQR91IgVqIAVzaiEFQX9BASAGQQBIGyEGIAAgAUECdGoiCCACQf8BcUECdEGQC2oqAgAgCCoCAJQ4AgAgA0F/aiEIQQAhAwNAIAEgCEYNASAAIAFBAWoiAUECdGoiCSACIARqQQAgBiADIAVqIgMgB0giChtqIgJB/wFxQQJ0QZALaioCACAJKgIAlDgCACADQQAgByAKG2shAwwAAAsACwuxAQEEfwJAAkAgBQRAQQAhBQNAIAUgBE4EQEEBDwsgACABIAIgA0ECdGogBCAFaxBFRQ0CIAEoAgAiBiADaiEDIAUgBmohBQwAAAsAC0EAIQUgBCABKAIAbSIGQQAgBkEAShshByAEIANrIQQgAiADQQJ0aiEDQQEhAgNAIAUgB0YNAiAEIAVrIQggBUECdCEJIAVBAWohBSAAIAEgAyAJaiAIIAYQRA0ACwtBACECCyACC0UBAn8gAUEAIAFBAEobIQQgACABQQJ0aiEBA0AgAyAERkUEQCAAIANBAnRqIAE2AgAgA0EBaiEDIAEgAmohAQwBCwsgAAsxAQF/AkAgABAHQc8ARw0AIAAQB0HnAEcNACAAEAdB5wBHDQAgABAHQdMARiEBCyABC4AOAQ9/IwBBEGsiByELIAckACAAKAIEIgwgACgCjAMiDyAEQRhsaiIJKAIEIgggAyAAIARBAXRqLwGMAiISQQJGdCIGIAggBkkbIAkoAgAiCCAGIAggBkkbayAJKAIIbiIQQQJ0IgZBBGpsIQggACgCfCAJLQANQbAQbGooAgAhEyAAKAJcIRQCQCAAKAJQBEAgACAIEBMhDiAAKAIEIQwMAQsgByAIQQ9qQXBxayIOJAALIAJBACACQQBKGyEIIANBAnQhByAOIAwgBhBKIRFBACEGA0AgBiAIRwRAIAUgBmotAABFBEAgASAGQQJ0aigCAEEAIAcQCRoLIAZBAWohBgwBCwsCQCACQQFGIBJBAkdyRQRAQQAhBgNAAkAgBiAIRwR/IAUgBmotAAANASAGBSAICyACRg0DIA8gBEEYbGoiDSEMIAJBAkchEiACQQNIIQ9BACEEA0AgBEEIRg0EAkAgEkUEQEEAIQpBACEIA0AgCCAQTg0CIAsgCSgCACAJKAIIIAhsaiIFQQFxNgIMIAsgBUEBdTYCCAJ/AkAgBEUEQCAAKAJ8IAktAA1BsBBsaiEHIAAoAvQKQQlMBEAgABAMCwJ/IAcgACgC8AoiBUH/B3FBAXRqLgEkIgZBAE4EQCAAIAUgBygCCCAGai0AACIFdjYC8AogAEEAIAAoAvQKIAVrIgUgBUEASCIFGzYC9ApBfyAGIAUbDAELIAAgBxAQCyEFIActABcEQCAHKAKoECAFQQJ0aigCACEFCyAFQX9GDQEgESgCACAKQQJ0aiANKAIQIAVBAnRqKAIANgIAC0EAIQYDQCAIIBBOIAYgE05yRQRAIAkoAgghBwJAIAwoAhQgESgCACAKQQJ0aigCACAGai0AAEEEdGogBEEBdGouAQAiBUEATgRAIAAgACgCfCAFQf//A3FBsBBsaiABQQIgC0EMaiALQQhqIAMgBxAyRQ0EDAELIAsgCSgCACAHIAhsIAdqaiIFQQF1NgIIIAsgBUEBcTYCDAsgCEEBaiEIIAZBAWohBgwBCwsgCkEBaiEKQQEMAQtBAAsNAAsMBgsgDw0AQQAhCkEAIQgDQCAIIBBODQEgCyAJKAIAIAkoAgggCGxqIgUgBSACbSIFIAJsazYCDCALIAU2AggCfwJAIARFBEAgACgCfCAJLQANQbAQbGohByAAKAL0CkEJTARAIAAQDAsCfyAHIAAoAvAKIgVB/wdxQQF0ai4BJCIGQQBOBEAgACAFIAcoAgggBmotAAAiBXY2AvAKIABBACAAKAL0CiAFayIFIAVBAEgiBRs2AvQKQX8gBiAFGwwBCyAAIAcQEAshBSAHLQAXBEAgBygCqBAgBUECdGooAgAhBQsgBUF/Rg0BIBEoAgAgCkECdGogDSgCECAFQQJ0aigCADYCAAtBACEGA0AgCCAQTiAGIBNOckUEQCAJKAIIIQcCQCAMKAIUIBEoAgAgCkECdGooAgAgBmotAABBBHRqIARBAXRqLgEAIgVBAE4EQCAAIAAoAnwgBUH//wNxQbAQbGogASACIAtBDGogC0EIaiADIAcQMkUNBAwBCyALIAkoAgAgByAIbCAHamoiByACbSIFNgIIIAsgByACIAVsazYCDAsgCEEBaiEIIAZBAWohBgwBCwsgCkEBaiEKQQEMAQtBAAsNAAsMBQsgBEEBaiEEDAAACwALIAZBAWohBgwAAAsACyAPIARBGGxqIg8hB0EAIQMDQCADQQhGDQFBACENQQAhCgNAIA0gEEgEQAJAIAMNAEEAIQYDQCAGIAhGDQEgBSAGai0AAEUEQCAAKAJ8IAktAA1BsBBsaiEMIAAoAvQKQQlMBEAgABAMCwJ/IAwgACgC8AoiAkH/B3FBAXRqLgEkIgRBAE4EQCAAIAIgDCgCCCAEai0AACICdjYC8AogAEEAIAAoAvQKIAJrIgIgAkEASCICGzYC9ApBfyAEIAIbDAELIAAgDBAQCyEEIAwtABcEQCAMKAKoECAEQQJ0aigCACEECyAEQX9GDQYgESAGQQJ0aigCACAKQQJ0aiAPKAIQIARBAnRqKAIANgIACyAGQQFqIQYMAAALAAtBACEOA0ACQCANIBBODQBBACEGIA4gE04NAANAIAYgCEcEQAJAIAUgBmotAAANACAHKAIUIBEgBkECdCIEaigCACAKQQJ0aigCACAOai0AAEEEdGogA0EBdGouAQAiAkEASA0AIAAgACgCfCACQf//A3FBsBBsaiABIARqKAIAIAkoAgAgCSgCCCICIA1saiACIBIQSUUNCAsgBkEBaiEGDAELCyANQQFqIQ0gDkEBaiEODAELCyAKQQFqIQoMAQsLIANBAWohAwwAAAsACyAAIBQ2AlwgC0EQaiQAC5YCAQV/AkAgACABIAEoAgQgAkEDbGotAAJqLQAJIgFBAXRqLwGEAUUEQCAAQRUQAwwBCyADQQF1IQggACgChAIgAUG8DGxqIgZBuAxqIQkgBkG0DGohCiAGLQC0DCAFLgEAbCECQQEhAEEAIQEDQCAAIAkoAgBORQRAIAUgACAGai0AxgZBAXQiB2ouAQAiA0EATgRAIAotAAAgA0H//wNxbCEDIAYgB2ovAdICIgcgAUcEQCAEIAEgAiAHIAMgCBBIIAchAQsgAyECCyAAQQFqIQAMAQsLIAEgCE4NACACQQJ0QZALaiEAA0AgASAIRg0BIAQgAUECdGoiAiAAKgIAIAIqAgCUOAIAIAFBAWohAQwAAAsACwvLDwITfwh9IwAiBSEUIAFBAXUiDEECdCEEIAIoAlwhFQJAIAIoAlAEQCACIAQQEyELDAELIAUgBEEPakFwcWsiCyQACyABQQN1IQogAUECdSEPIAAgDEECdCIEaiENIAQgC2pBeGohBiACIANBAnRqQawIaigCACIHIQUgACEEA0AgBCANRkUEQCAGIAQqAgAgBSoCAJQgBCoCCCAFKgIElJM4AgQgBiAEKgIAIAUqAgSUIAQqAgggBSoCAJSSOAIAIARBEGohBCAFQQhqIQUgBkF4aiEGDAELCyAMQQJ0IABqQXRqIQQDQCAGIAtJRQRAIAYgBCoCACAFKgIElCAEKgIIIAUqAgCUkzgCBCAGIAUqAgAgBCoCAIyUIAQqAgggBSoCBJSTOAIAIARBcGohBCAFQQhqIQUgBkF4aiEGDAELCyAAIA9BAnQiBGohCCAEIAtqIQYgDEECdCAHakFgaiEFIAshBCAAIQkDQCAFIAdJRQRAIAQqAgAhFyAGKgIAIRggCCAGKgIEIhkgBCoCBCIakjgCBCAIIAYqAgAgBCoCAJI4AgAgCSAZIBqTIhkgBSoCEJQgGCAXkyIXIAUqAhSUkzgCBCAJIBcgBSoCEJQgGSAFKgIUlJI4AgAgBCoCCCEXIAYqAgghGCAIIAYqAgwiGSAEKgIMIhqSOAIMIAggBioCCCAEKgIIkjgCCCAJIBkgGpMiGSAFKgIAlCAYIBeTIhcgBSoCBJSTOAIMIAkgFyAFKgIAlCAZIAUqAgSUkjgCCCAEQRBqIQQgBkEQaiEGIAlBEGohCSAIQRBqIQggBUFgaiEFDAELCyABEBEhBiABQQR1IgQgACAMQX9qIglBACAKayIFIAcQMSAEIAAgCSAPayAFIAcQMSABQQV1Ig4gACAJQQAgBGsiBCAHQRAQFyAOIAAgCSAKayAEIAdBEBAXIA4gACAJIApBAXRrIAQgB0EQEBcgDiAAIApBfWwgCWogBCAHQRAQFyAGQXxqQQF1IgRBAiAEQQJKGyEIQQIhBANAAkACQCAEIAhGBEAgCCAGQXlqIgQgCCAEShshCgwBC0EAIQVBAiAEdCIKQQAgCkEAShshCkEIIAR0IRAgASAEQQRqdSERQQAgASAEQQJqdSISQQF1ayETA0AgBSAKRg0CIBEgACAJIAUgEmxrIBMgByAQEBcgBUEBaiEFDAAACwALA0ACQCAIIApHBEBBAiAIdCEQQQggCHQiEUECdCESIAEgCEEGanUhBUEAIAEgCEECanUiE0EBdWshFiAJIQYgByEEA0AgBUEBSA0CIBAgACAGIBYgBCARIBMQRyAFQX9qIQUgBkF4aiEGIAQgEkECdGohBAwAAAsACyAOIAAgCSAHIAEQRiALIAxBfGoiCEECdGohBiAPQQJ0IAtqQXBqIQUgAiADQQJ0akHMCGooAgAhBANAIAUgC0lFBEAgBiAAIAQvAQBBAnRqIgcoAgA2AgwgBiAHKAIENgIIIAUgBygCCDYCDCAFIAcoAgw2AgggBiAAIAQvAQJBAnRqIgcoAgA2AgQgBiAHKAIENgIAIAUgBygCCDYCBCAFIAcoAgw2AgAgBEEEaiEEIAZBcGohBiAFQXBqIQUMAQsLIAIgA0ECdGpBvAhqKAIAIQQgCyIFIAxBAnRqIgYhBwNAIAUgB0FwaiIJT0UEQCAFIAUqAgQiFyAHQXxqIgoqAgAiGJMiGSAEKgIEIhogFyAYkiIXlCAFKgIAIhggB0F4aiIOKgIAIhuTIhwgBCoCACIdlJMiHpI4AgQgBSAYIBuSIhggHCAalCAXIB2UkiIXkjgCACAKIB4gGZM4AgAgDiAYIBeTOAIAIAUgBSoCCCIXIAkqAgAiGJIiGSAXIBiTIhcgBCoCDCIYlCAFKgIMIhogB0F0aiIHKgIAIhuSIhwgBCoCCCIdlJIiHpI4AgggBSAaIBuTIhogGCAclCAXIB2UkyIXkjgCDCAJIBkgHpM4AgAgByAXIBqTOAIAIAVBEGohBSAEQRBqIQQgCSEHDAELCyACIANBAnRqQbQIaigCACAMQQJ0aiEFIAAgCEECdGohBCABQQJ0IABqQXBqIQcDQCAGQWBqIgEgC0lFBEAgACAGQXhqKgIAIhcgBUF8aioCACIYlCAGQXxqKgIAIhkgBUF4aioCACIalJMiGzgCACAEIBuMOAIMIA0gGiAXjJQgGCAZlJMiFzgCACAHIBc4AgwgACAGQXBqKgIAIhcgBUF0aioCACIYlCAGQXRqKgIAIhkgBUFwaioCACIalJMiGzgCBCAEIBuMOAIIIA0gGiAXjJQgGCAZlJMiFzgCBCAHIBc4AgggACAGQWhqKgIAIhcgBUFsaioCACIYlCAGQWxqKgIAIhkgBUFoaioCACIalJMiGzgCCCAEIBuMOAIEIA0gGiAXjJQgGCAZlJMiFzgCCCAHIBc4AgQgACABKgIAIhcgBUFkaioCACIYlCAGQWRqKgIAIhkgBUFgaiIFKgIAIhqUkyIbOAIMIAQgG4w4AgAgDSAaIBeMlCAYIBmUkyIXOAIMIAcgFzgCACAHQXBqIQcgBEFwaiEEIA1BEGohDSAAQRBqIQAgASEGDAELCyACIBU2AlwgFCQADwsgCEEBaiEIDAAACwALIARBAWohBAwAAAsAC7ADAQZ/IwBBEGsiBiQAAn8gAC0AMEUEQCAAQQIQA0EADAELIAAoAowLQQBOBEAgBUEANgIAIAAgASACEEIMAQsgAEEANgJkIAAgATYCICAAIAEgAmo2AiggABApRQRAIAVBADYCAEEADAELIAAgBkEMaiAGQQRqIAZBCGoQOkUEQAJAIAAoAmQiAkFgaiIDQQNLDQACQAJAIANBAWsOAwICAAELIABBADYCZANAIAAQCEF/RwRAIAAoAmBFDQELCyAFQQA2AgAgACgCICABawwDCyAAKALgBw0AIABBADYCZANAIAAQCEF/RwRAIAAoAmBFDQELCyAFQQA2AgAgACgCICABawwCCyAAEFYgACACNgJkIAVBADYCAEEBDAELIAYgACAGKAIMIAYoAgQiCCAGKAIIEGAiCTYCDEEAIQIgACgCBCIHQQAgB0EAShshCgNAIAIgCkZFBEAgACACQQJ0aiILIAsoAqAGIAhBAnRqNgLgBiACQQFqIQIMAQsLIAMEQCADIAc2AgALIAUgCTYCACAEIABB4AZqNgIAIAAoAiAgAWsLIQIgBkEQaiQAIAILMAAgA0EAIAAgAWsgBCADayIAIABBH3UiA2ogA3NsIAIgAWttIgFrIAEgAEEASBtqC5QBAQJ/AkACQAJAIAAoAuQKQX9HDQAgABAHIQIgACgCYA0BIAJBzwBHBEAMAwsgABAHQecARwRADAMLIAAQB0HnAEcEQAwDCyAAEAdB0wBHBEAMAwsgABAzRQ0BIAAtAN8KQQFxRQ0AIABBADoA4AogAEEANgLoCiAAQSAQA0EADwsgABAkIQELIAEPCyAAQR4QA0EAC7sBAwJ/AX0CfAJ/An8gALK7EDu2IAGylbsQPJwiBZlEAAAAAAAA4EFjBEAgBaoMAQtBgICAgHgLIgKyQwAAgD+SuyABtyIFEB+cIgaZRAAAAAAAAOBBYwRAIAaqDAELQYCAgIB4CyEDQX8hASADIABMIAJqIgKyIgRDAACAP5K7IAUQHyAAt2UEf0F/BUF/IAICfyAEuyAFEB+cIgWZRAAAAAAAAOBBYwRAIAWqDAELQYCAgIB4CyAAShsLC9MBAQV/A0AgAUGACEZFBEAgACABQQF0akH//wM7ASQgAUEBaiEBDAELCyAAQawQQQQgAC0AFyIDG2ooAgAiAUH//wEgAUH//wFIGyIBQQAgAUEAShshBANAIAIgBEcEQAJAIAAoAgggAmoiBS0AAEEKSw0AAn8gAwRAIAAoAqQQIAJBAnRqKAIAEA8MAQsgACgCICACQQJ0aigCAAshAQNAIAFB/wdLDQEgACABQQF0aiACOwEkQQEgBS0AAHQgAWohAQwAAAsACyACQQFqIQIMAQsLC/UDAQl/AkACQCAALQAXBEADQCADIAAoAqwQIgRODQIgA0ECdCIFIAAoAqQQaiAAKAIgIAVqKAIAEA82AgAgA0EBaiEDDAAACwALA0AgAyAAKAIETkUEQCAAIAEgA2otAAAQLQRAIAAoAqQQIARBAnRqIAAoAiAgA0ECdGooAgAQDzYCACAEQQFqIQQLIANBAWohAwwBCwsgBCAAKAKsEEcNAQsgACgCpBAgBEECECwgACgCpBAgACgCrBBBAnRqQX82AgBBACEFIABBrBBBBCAALQAXG2ooAgAiA0EAIANBAEobIQgCQANAIAUgCEcEQCAFIQMCQCAAIAAtABcEfyACIAVBAnRqKAIABSADCyABai0AACIJEC1FDQAgBUECdCIKIAAoAiBqKAIAEA8hByAAKAKsECEDQQAhBANAIANBAkhFBEAgA0EBdiIGIAMgBmsgACgCpBAgBCAGaiILQQJ0aigCACAHSyIGGyEDIAQgCyAGGyEEDAELCyAEQQJ0IgMgACgCpBBqKAIAIAdHDQMgAC0AFwRAIAAoAqgQIANqIAIgCmooAgA2AgAgACgCCCAEaiAJOgAADAELIAAoAqgQIANqIAU2AgALIAVBAWohBQwBCwsPC0GPFUGACEGyCUH4FBAAAAtB4RRBgAhBlAlB+BQQAAALygMBCH8jAEGAAWsiBSQAIAVBAEGAARAJIQcgAkEAIAJBAEobIQUDQAJAAkACfyAEIAVHBEAgASAEai0AAEH/AUYNAiAEIQULIAIgBUYLBEBBASEEIAAoAqwQRQ0CQfoTQYAIQbMIQZEUEAAACyAAQQAgBUEAIAEgBWoiBC0AACADEC5BASEIIAQtAABBAWohBkEBIQQCQAJAA0AgBCAGRgRAA0ACQEEBIQQgBUEBaiIFIAJODQcgASAFaiIJLQAAIgZB/wFGDQEgBiEEA0AgBEEBSARAQQAhBAwJCyAHIARBAnRqIgsoAgAiCkUEQCAEQX9qIQQMAQsLIARBIE8NACALQQA2AgAgACAKEA8gBSAIIAYgAxAuIAhBAWohCCAEIAktAAAiBkYNASAGQSBPDQQDQCAGIARMDQIgByAGQQJ0aiIJKAIADQYgCUEBQSAgBmt0IApqNgIAIAZBf2ohBgwAAAsACwsFIAcgBEECdGpBAUEgIARrdDYCACAEQQFqIQQMAQsLQaMUQYAIQcoIQZEUEAAAC0G0FEGACEHPCEGRFBAAAAtBzxRBgAhB0QhBkRQQAAALIARBAWohBAwBCwsgB0GAAWokACAECzIAIABBADYCjAsgAEEANgLgByAAQgA3AuALIABCADcChAsgAEEAOgDhCiAAQQA2AqgIC4IBAQV/IAFBACABQQBKGyEIIAAgAUEBdGohBUGAgAQhBkF/IQcDQCAEIAhGRQRAAkAgByAAIARBAXRqLwEAIgFODQAgASAFLwEATw0AIAIgBDYCACABIQcLAkAgBiABTA0AIAEgBS8BAE0NACADIAQ2AgAgASEGCyAEQQFqIQQMAQsLCxkAQX8gAC8BACIAIAEvAQAiAUsgACABSRsLWwEDfwNAIABBgAJGRQRAIABBGHQhAUEAIQIDQCACQQhGRQRAIAFBH3VBt7uEJnEgAUEBdHMhASACQQFqIQIMAQsLIABBAnRBwCxqIAE2AgAgAEEBaiEADAELCwvEMQIQfwJ9IwBBgAhrIgokACAAQQE6AOEKAkAgABAbRQ0AIAAtAN8KIgJBAnFFBEAgAEEiEAMMAQsgAkEEcQRAIABBIhADDAELIAJBAXEEQCAAQSIQAwwBCyAAKALcCEEBRwRAIABBIhADDAELIAAtAOAIIgJBHkcEQAJAIAJBwABHDQAgACAKQfoHakEGECZFDQAgCi0A+gdB5gBHDQAgCi0A+wdB6QBHDQAgCi0A/AdB8wBHDQAgCi0A/QdB6ABHDQAgCi0A/gdB5QBHDQAgCi0A/wdB4QBHDQAgABAHQeQARw0AIAAQBw0AIABBJhADDAILIABBIhADDAELIAAQB0EBRwRAIABBIhADDAELIAAgCkH6B2pBBhAmRQRAIABBChADDAELIApB+gdqECVFBEAgAEEiEAMMAQsgABALBEAgAEEiEAMMAQsgACAAEAciAjYCBCACRQRAIABBIhADDAELIAJBEU8EQCAAQQUQAwwBCyAAIAAQCyICNgIAIAJFBEAgAEEiEAMMAQsgABALGiAAEAsaIAAQCxogAEEBIAAQByIGQQR2IgJ0NgJ0IABBASAGQQ9xIgR0NgJwIARBempBCE8EQCAAQRQQAwwBCyAGQRh0QYCAgIB6akEYdUF/TARAIABBFBADDAELIAQgAksEQCAAQRQQAwwBCyAAEAdBAXFFBEAgAEEiEAMMAQsgABAbRQ0AIAAQJEUNACAAECNFDQACQCAAEAhBA0YEQANAIAFBBkZFBEAgCkH6B2ogAWogABAIOgAAIAFBAWohAQwBCwsgCkH6B2oQJUUEQCAAQRQQAwwCCyAAIAAgABAiIgZBAWoQBTYCFEEAIQEgBkEAIAZBAEobIQQDQCABIARGRQRAIAAQCCECIAAoAhQgAWogAjoAACABQQFqIQEMAQsLIAAoAhQgBmpBADoAACAAIAAQIiICNgIYIAAgACACQQJ0EAU2AhwDQCAJIAAoAhhORQRAIAAgABAiIgNBAWoQBSECIAlBAnQiBiAAKAIcaiACNgIAQQAhASADQQAgA0EAShshBANAIAEgBEZFBEAgABAIIQIgACgCHCAGaigCACABaiACOgAAIAFBAWohAQwBCwsgACgCHCAGaigCACADakEAOgAAIAlBAWohCQwBCwsgABAIQQFxRQRAIABBFBADDAILIAAgAC0A4AoQOCAAQQA6AOAKA0AgACAAECMiAhA4IABBADoA4AogAg0AC0EAIQEgABAkRQ0CAkAgAC0AMEUNACAAECkNACAAKAJkQRVHDQMgAEEUNgJkDAMLEFkgABAIQQVGBEADQCABQQZGRQRAIApB+gdqIAFqIAAQCDoAACABQQFqIQEMAQsLIApB+gdqECVFBEAgAEEUEAMMAwsgACAAQQgQBEEBaiICNgJ4IAAgACACQbAQbBAFIgI2AnwgAkUEQCAAQQMQAwwDCyACQQAgACgCeEGwEGwQCRoCQANAAkAgCyAAKAJ4SARAIAAoAnwhAiAAQQgQBEH/AXFBwgBHBEAgAEEUEAMMBwsgAEEIEARB/wFxQcMARwRAIABBFBADDAcLIABBCBAEQf8BcUHWAEcEQCAAQRQQAwwHCyACIAtBsBBsaiIFIABBCBAEQf8BcSAAQQgQBEEIdHI2AgAgAEEIEAQhAiAFIABBCBAEQQh0QYD+A3EgAkH/AXFyIABBCBAEQRB0cjYCBCAFQQRqIQhBACEBIABBARAEIgRFBEAgAEEBEAQhAQsgBSABOgAXIAgoAgAhAiAFKAIABEAgAiEDDAILQQAhAyACRQ0BIABBFBADDAYLIABBBhAEQQFqQf8BcSECQQAhAQJAA0AgASACRg0BIAFBAWohASAAQRAQBEUNAAsgAEEUEAMMBgsgACAAQQYQBEEBaiICNgKAASAAIAAgAkG8DGwQBSICNgKEAgJAIAIEQEEAIRBBACENA0AgDSAAKAKAAU4NAiAAIA1BAXRqIABBEBAEIgI7AYQBIAJB//8DcSICQQJPBEAgAEEUEAMMCQsgAkUEQCAAKAKEAiANQbwMbGoiBCAAQQgQBDoAACAEIABBEBAEOwECIAQgAEEQEAQ7AQQgBCAAQQYQBDoABiAEIABBCBAEOgAHIAQgAEEEEARBAWoiBjoACCAEQQlqIQJBACEBA0AgASAGQf8BcU9FBEAgASACaiAAQQgQBDoAACABQQFqIQEgBC0ACCEGDAELCyAAQQQQAwwJCyAAKAKEAiANQbwMbGoiCyAAQQUQBCIDOgAAQQAhAUF/IQwDQCABIANB/wFxTwRAIAxBAWohBEEAIQMDQAJAIAMgBEcEQCADIAtqIgYgAEEDEARBAWo6ACEgBiAAQQIQBCICOgAxIAJB/wFxRQ0BIAYgAEEIEAQiAjoAQSACQf8BcSAAKAJ4SA0BIABBFBADDA0LQQIhAyALIABBAhAEQQFqOgC0DCAAQQQQBCECIAtBAjYCuAxBACEJIAtBADsB0gIgCyACOgC1DCALQQEgAkH/AXF0OwHUAiALQbgMaiEOIAtB0gJqIQggC0G1DGohBwNAIAkgCy0AAE8EQAJAQQAhASADQQAgA0EAShshBgNAIAEgBkYNASALIAFBAXRqLwHSAiEEIApBEGogAUECdGoiAiABOwECIAIgBDsBACABQQFqIQEMAAALAAsFIAsgCSALai0AAWohBkEAIQEDQCABIAYtACFPRQRAIAAgBy0AABAEIQQgCyAOKAIAIgJBAXRqIAQ7AdICIA4gAkEBaiIDNgIAIAFBAWohAQwBCwsgCUEBaiEJDAELCyAKQRBqIANBARAsQQAhASAOKAIAIgNBf2oiAkEAIAJBAEobIQJBACEJAkADQCACIAlGDQEgCkEQaiAJQQJ0ai8BACAKQRBqIAlBAWoiCUECdGovAQBHDQALIABBFBADDA0LA0AgASADTkUEQCABIAtqIApBEGogAUECdGotAAI6AMYGIAFBAWohASAOKAIAIQMMAQsLQQIhAQNAIAEgA05FBEAgCkEANgIMIApBADYCCCAIIAEgCkEMaiAKQQhqEFcgCyABQQF0aiICQcAIaiAKKAIMOgAAIAJBwQhqIAooAgg6AAAgAUEBaiEBIA4oAgAhAwwBCwsgAyAQIAMgEEobIRAgDUEBaiENDAQLQQAhAQJAA0AgAUEBIAYtADF0Tg0BIAsgA0EEdGogAUEBdGogAEEIEARBf2oiAjsBUiABQQFqIQEgACgCeCACQRB0QRB1Sg0ACyAAQRQQAwwMCyADQQFqIQMMAAALAAUgASALaiAAQQQQBCICOgABIAJB/wFxIgIgDCACIAxKGyEMIAFBAWohASALLQAAIQMMAQsAAAsAAAsACyAAQQMQAwwGCyAAIABBBhAEQQFqIgI2AogCIAAgACACQRhsEAUiAjYCjAMgAkUEQCAAQQMQAwwGC0EAIQ0gAkEAIAAoAogCQRhsEAkaAkACQANAIA0gACgCiAJIBEAgACgCjAMhASAAIA1BAXRqIABBEBAEIgI7AYwCIAJB//8DcUEDTwRAIABBFBADDAoLIAEgDUEYbGoiByAAQRgQBDYCACAHIABBGBAEIgI2AgQgAiAHKAIASQRAIABBFBADDAoLIAcgAEEYEARBAWo2AgggByAAQQYQBEEBajoADCAHIABBCBAEIgI6AA0gAkH/AXEgACgCeE4NA0EAIQEDQCABIActAAwiAk9FBEAgCkEQaiABaiAAQQMQBAJ/QQAgAEEBEARFDQAaIABBBRAEC0EDdGo6AAAgAUEBaiEBDAELCyAHIAAgAkEEdBAFIgI2AhQgAkUNAkEAIQMDQCADIActAAxJBEAgCkEQaiADai0AACEEQQAhAQNAIAFBCEcEQAJAIAQgAXZBAXEEQCAAQQgQBCEGIAcoAhQiAiADQQR0aiABQQF0aiAGOwEAIAAoAnggBkEQdEEQdUoNASAAQRQQAwwPCyACIANBBHRqIAFBAXRqQf//AzsBAAsgAUEBaiEBDAELCyADQQFqIQMMAQsLIAcgACAAKAJ8IActAA1BsBBsaigCBEECdBAFIgE2AhAgAUUEQCAAQQMQAwwKC0EAIQIgAUEAIAAoAnwgBy0ADUGwEGxqKAIEQQJ0EAkaA0AgAiAAKAJ8IActAA1BsBBsaiIBKAIESARAIAAgASgCACIBEAUhBCACQQJ0IgMgBygCEGogBDYCACACIQYgBygCECADaigCAARAA0AgAUEBSEUEQCABQX9qIgEgBygCECADaigCAGogBiAHLQAMbzoAACAGIActAAxtIQYMAQsLIAJBAWohAgwCBSAAQQMQAwwMCwALCyANQQFqIQ0MAQsLIAAgAEEGEARBAWoiAjYCkAMgACAAIAJBKGwQBSICNgKUAyACRQRAIABBAxADDAgLIAJBACAAKAKQA0EobBAJGkEAIQcDQAJAIAcgACgCkANIBEAgACgClAMhAiAAQRAQBARAIABBFBADDAsLIAIgB0EobGoiCCAAIAAoAgRBA2wQBSICNgIEIAJFBEAgAEEDEAMMCwtBASEBIAggAEEBEAQEfyAAQQQQBEEBagVBAQs6AAgCQCAAQQEQBARAIAggAEEIEARBAWoiAzsBAEEAIQEgACgCBCIMIANB//8DcUgEQCAAQRQQAwwNCwNAIAEgA0H//wNxTw0CIAAgDEF/ahAREAQhBCABQQNsIgIgCCgCBGogBDoAACAAIAAoAgRBf2oQERAEIQYgCCgCBCACaiICIAY6AAEgACgCBCIMIAItAAAiBEwEQCAAQRQQAwwOCyAMIAZB/wFxIgJMBEAgAEEUEAMMDgsgAiAERwRAIAFBAWohASAILwEAIQMMAQsLIABBFBADDAwLIAhBADsBAAsgAEECEAQEQCAAQRQQAwwLC0EAIQEgCC0ACCIMQQFNBEAgACgCBCICQQAgAkEAShshAgNAIAEgAkYNAyAIKAIEIAFBA2xqQQA6AAIgAUEBaiEBDAAACwALA0AgASAAKAIETg0CIABBBBAEIQIgCCgCBCABQQNsaiACOgACIAFBAWohASAILQAIIgwgAkH/AXFLDQALIABBFBADDAoLIAAgAEEGEARBAWoiATYCmANBACEGAkADQCAGIAFODQEgACAGQQZsaiIBIABBARAEOgCcAyABIABBEBAEOwGeAyABIABBEBAEOwGgAyABIABBCBAEIgI6AJ0DIAEvAZ4DBEAgAEEUEAMMDAsgAS8BoAMEQCAAQRQQAwwMCyACQf8BcSAAKAKQA0gEQCAGQQFqIQYgACgCmAMhAQwBCwsgAEEUEAMMCgsgABA3IABBADYC4AcgEEEBdCEGQQAhAQNAIAEgACgCBEgEQCAAIAFBAnRqIgMiAkGgBmogACAAKAJ0QQJ0EAU2AgAgAyAAIAAoAnRBAXRB/v///wdxEAU2AqAHIAMgACAGEAUiBDYC5AcCQCACKAKgBiICRSAERXJFBEAgAygCoAcNAQsgAEEDEAMMDAsgAkEAIAAoAnRBAnQQCRogAUEBaiEBDAELC0EAIQEgAEEAIAAoAnAQNkUNCiAAQQEgACgCdBA2RQ0KIAAgACgCcDYCaCAAIAAoAnQiBDYCbCAAKAKIAiICQQAgAkEAShshBiAEQQJtIQcgBEEBdCEEQQAhDANAIAEgBkZFBEAgACgCjAMgAUEYbGoiAygCBCICIAcgAiAHSRsgAygCACICIAcgAiAHSRtrIAMoAghuIgIgDCACIAxKGyEMIAFBAWohAQwBCwsgACAEQf7///8HcSIBIAAoAgQgDEECdEEEamwiAiABIAJLGyIBNgIMAkACQCAAKAJQRQ0AIAAoAlwiAiAAKAJURw0BIAEgACgCWGpB6AtqIAJNDQAgAEEDEAMMCwsCQCAAKALkCkF/RgRAIAAgABA1NgI0DAELIABBADYCNAtBASEBDAsLQbQTQYAIQcAgQewTEAAAC0EAIQECQANAIAEgDEH/AXFPDQEgAEEIEAQaIAEgCGoiAiIEQQlqIABBCBAEOgAAIAIgAEEIEAQiAjoAGCAAKAKAASAELQAJTARAIABBFBADDAsLIAJB/wFxIAAoAogCSARAIAFBAWohASAILQAIIQwMAQsLIABBFBADDAkLIAdBAWohBwwAAAsACyAAQQMQAwwGCyAAQRQQAwwFCwJAIAFB/wFxBEAgACADEBMhBgwBCyAFIAAgAxAFIgY2AggLIAZFBEAgAEEDEAMMBQtBACEHAkAgBEUEQEEAIQEDQCABIAgoAgAiA04NAgJAAkAgBS0AFwRAIABBARAERQ0BCyABIAZqIABBBRAEQQFqIgI6AAAgAkH/AXFBIEcEQCAHQQFqIQcMAgsgAEEUEAMMCQsgASAGakH/AToAAAsgAUEBaiEBDAAACwALIABBBRAEIQlBACEBA0AgCCgCACIDIAFMDQEgACADIAFrEBEQBCEEIAlBAWoiCUEgTgRAIABBFBADDAcLIAEgBGoiAiAIKAIASgRAIABBFBADDAcFIAEgBmogCSAEEAkaIAIhAQwBCwAACwALAkACQCAFLQAXBEAgByADQQJ1SA0BIAMgACgCEEoEQCAAIAM2AhALIAUgACADEAUiAjYCCCACRQRAIABBAxADDAgLIAIgBiAIKAIAEBIaIAAgBiAIKAIAEAogBSgCCCEGIAVBADoAFwtBACEDIAgoAgAiBEEAIARBAEobIQJBACEBA0AgASACRkUEQCADIAEgBmotAABBdWpB/wFxQfQBSWohAyABQQFqIQEMAQsLIAUgAzYCrBAgBSAAIARBAnQQBSICNgIgIAIEQCAFQawQaiEEIAgoAgAhA0EAIQEMAgsgAEEDEAMMBgsgBSAHNgKsECAFQawQaiEEAkAgB0UEQEEAIQEMAQsgBSAAIAcQBSICNgIIIAJFBEAgAEEDEAMMBwsgBSAAIAQoAgBBAnQQEyICNgIgIAJFBEAgAEEDEAMMBwsgACAEKAIAQQJ0EBMiAQ0AIABBAxADDAYLIAgoAgAiAyAEKAIAQQN0aiICIAAoAhBNDQAgACACNgIQCyAFIAYgAyABEFVFBEAgBS0AFwRAIAAgAUEAEAoLIABBFBADDAULIAQoAgAiAgRAIAUgACACQQJ0QQRqEAUiAjYCpBAgAkUEQCAAQQMQAwwGCyAFIAAgBCgCAEECdEEEahAFIgI2AqgQIAJFBEAgAEEDEAMMBgsgBUGoEGogAkEEajYCACACQX82AgAgBSAGIAEQVAsgBS0AFwRAIAAgASAEKAIAQQJ0EAogACAFKAIgIAQoAgBBAnQQCiAAIAYgCCgCABAKIAVBADYCIAsgBRBTIAUgAEEEEAQiAjoAFSACQf8BcSICQQNPBEAgAEEUEAMMBQsCQCACBEAgBSAAQSAQBBA0OAIMIAUgAEEgEAQQNDgCECAFIABBBBAEQQFqOgAUIAUgAEEBEAQ6ABYgBSgCACEBIAgoAgAhAgJAIAUtABVBAUYEQCACIAEQUiIBQX9KDQEgAEEUEAMMCAsgASACbCEBCyAFIAE2AhggAUUEQCAAQRQQAwwHCyAAIAFBAXQQEyIPRQ0BQQAhAQNAIAEgBSgCGCIJSARAIAAgBS0AFBAEIgJBf0YEQCAAIA8gBSgCGEEBdBAKIABBFBADDAkFIA8gAUEBdGogAjsBACABQQFqIQEMAgsACwsCQAJAIAUtABVBAUYEQAJAIAUtABciEARAIAQoAgAiAQ0BDAQLIAgoAgAhAQsgBSAAIAEgBSgCAGxBAnQQBSIJNgIcIAlFBEAgACAPIAUoAhhBAXQQCiAAQQMQAwwKC0EAIQIgBCAIIBAbKAIAIgFBACABQQBKGyEIIAVBqBBqIQdDAAAAACERA0AgAiAIRg0CIAIhBCAQBEAgBygCACACQQJ0aigCACEEC0EAIQEgBSgCACINQQAgDUEAShshAyACIA1sIQZBASEMAkADQCABIANGDQEgCSABIAZqQQJ0aiARIAUqAhAgDyAEIAxuIAUoAhgiDnBBAXRqLwEAs5QgBSoCDJKSIhI4AgAgEiARIAUtABYbIREgAUEBaiIBIA1ODQAgDq0gDK1+QiCIp0UEQCAMIA5sIQwMAQsLIAAgDyAOQQF0EAogAEEUEAMMCwsgAkEBaiECDAAACwALIAUgACAJQQJ0EAUiBDYCHCAFKAIYIQkgBEUNBUEAIQEgCUEAIAlBAEobIQJDAAAAACERA0AgASACRg0CIAQgAUECdGogESAFKgIQIA8gAUEBdGovAQCzlCAFKgIMkpIiEjgCACASIBEgBS0AFhshESABQQFqIQEMAAALAAsgBUECOgAVIAUoAhghCQsgACAPIAlBAXQQCgsgC0EBaiELDAELCyAAQQMQAwwDCyAAIA8gCUEBdBAKIABBAxADDAILIABBFBADDAELIABBFBADC0EAIQELIApBgAhqJAAgAQtXAQF+IABBAEHoCxAJIQAgAQRAIAAgASkCACICNwJQIAAgAkIgiKdBA2pBfHEiATYCXCAAIAE2AlQLIABCADcCYCAAQX82AowLIABBADYCfCAAQQA2AiALmAEBAX8jAEHwC2siBSQAIAVBCGogBBBbIAVBAToAOCAFIAAgAWo2AjAgBSAANgIoAkACQCAFQQhqEFpFBEAgA0EBIAUoAmwgBSgCaBs2AgAMAQsgBUEIakHoCxAFIgEEQCACIAEgBUEIakHoCxASKAIgIABrNgIAIANBADYCAAwCCyAFQQhqEDkLQQAhAQsgBUHwC2okACABCzQAAn8CfyAAQcQIaiABQQF0IgEgACgCcEYNABpBACABIAAoAnRHDQEaIABByAhqCygCAAsLqxICF38DfSMAQcASayILJAAgACgClAMiGiACLQABIhtBKGxqIhQhFUEAIAAgAi0AAEECdGooAmgiF0EBdSISayEcAkADQCAOIAAoAgQiB0gEQCAVKAIEIA5BA2xqLQACIQcgC0HACmogDkECdGoiE0EANgIAIAAgByAUai0ACSIKQQF0ai8BhAFFBEAgAEEVEANBACEHDAMLIAAoAoQCIQgCQAJAIABBARAERQ0AQQIhByAAIA5BAnRqKALkByIPIAAgCCAKQbwMbGoiDS0AtAxBAnRBvAlqKAIAIhkQEUF/aiIKEAQ7AQAgDyAAIAoQBDsBAkEAIRADQCAQIA0tAABPRQRAQX8gDSANIBBqLQABIhhqIgotADEiFnQhDCAKLQAhIRECQCAWRQRAQQAhCQwBCyAAKAJ8IAotAEFBsBBsaiEKIAAoAvQKQQlMBEAgABAMCwJ/IAogACgC8AoiCUH/B3FBAXRqLgEkIghBAE4EQCAAIAkgCigCCCAIai0AACIJdjYC8AogAEEAIAAoAvQKIAlrIgkgCUEASCIJGzYC9ApBfyAIIAkbDAELIAAgChAQCyEJIAotABdFDQAgCigCqBAgCUECdGooAgAhCQsgDEF/cyEdIAcgEWohCgNAIAcgCkZFBEBBACEIAkAgDSAYQQR0aiAJIB1xQQF0ai4BUiIMQQBIDQAgACgCfCAMQf//A3FBsBBsaiEMIAAoAvQKQQlMBEAgABAMCwJ/IAwgACgC8AoiEUH/B3FBAXRqLgEkIghBAE4EQCAAIBEgDCgCCCAIai0AACIRdjYC8AogAEEAIAAoAvQKIBFrIhEgEUEASCIRGzYC9ApBfyAIIBEbDAELIAAgDBAQCyEIIAwtABdFDQAgDCgCqBAgCEECdGooAgAhCAsgCSAWdSEJIA8gB0EBdGogCDsBACAHQQFqIQcMAQsLIBBBAWohECAKIQcMAQsLIAAoAvQKQX9GDQAgC0GBAjsBwAJBAiEHIA0oArgMIgpBAiAKQQJKGyEWA0AgByAWRgRAQQAhByAKQQAgCkEAShshCgNAIAcgCkYNBCALQcACaiAHai0AAEUEQCAPIAdBAXRqQf//AzsBAAsgB0EBaiEHDAAACwAFIA1B0gJqIgggB0EBdCIJai8BACAIIAkgDWoiDEHACGotAAAiEEEBdCITai8BACAIIAxBwQhqLQAAIhhBAXQiDGovAQAgDyATai4BACAMIA9qLgEAEFAhCAJAAkAgCSAPaiITLwEAIgwEQCALQcACaiAYakEBOgAAIAtBwAJqIBBqQQE6AAAgC0HAAmogB2pBAToAACAZIAhrIhAgCCAQIAhIG0EBdCAMQRB0QRB1IglMBEAgECAISg0DIAxBf3MgGWohCAwCCyAJQQFxBEAgCCAJQQFqQQF2ayEIDAILIAlBAXUgCGohCAwBCyALQcACaiAHakEAOgAACyATIAg7AQALIAdBAWohBwwBCwAACwALIBNBATYCAAsgDkEBaiEODAELCwJAIAAoAlAEQCAAKAJUIAAoAlxHDQELIAtBwAJqIAtBwApqIAdBAnQQEhogFC8BACEIQQAhBwNAIAcgCEYEQCAaIBtBKGxqIg0hDkEAIQkFIBUoAgQgB0EDbGoiCS0AASEKAkAgC0HACmogCS0AAEECdGoiCSgCAARAIAtBwApqIApBAnRqKAIADQELIAtBwApqIApBAnRqQQA2AgAgCUEANgIACyAHQQFqIQcMAQsLA0ACQCAJIA4tAAhJBEBBACEIIAAoAgQiB0EAIAdBAEobIQ9BACEHA0AgByAPRg0CIBUoAgQgB0EDbGotAAIgCUYEQCAIIAtqIQoCQCAHQQJ0IgwgC0HACmpqKAIABEAgCkEBOgAAIAtBgAJqIAhBAnRqQQA2AgAMAQsgCkEAOgAAIAtBgAJqIAhBAnRqIAAgDGooAqAGNgIACyAIQQFqIQgLIAdBAWohBwwAAAsACwJAIAAoAlAEQCAAKAJUIAAoAlxHDQELIBJBACASQQBKGyEJIBQvAQAhCiAAQaAGaiEIA0AgCkEATARAIBJBAnQhDUEAIQhBACEHA0AgByAAKAIEIglOBEADQAJAIAggCU4NACAAIAhBAnRqKAKgBiAXIAAgAi0AABBOIAhBAWohCCAAKAIEIQkMAQsLBSAAIAdBAnQiCWoiDiEKAkAgC0HAAmogCWooAgAEQCAKKAKgBkEAIA0QCRoMAQsgACAUIAcgFyAKKAKgBiAOKALkBxBNCyAHQQFqIQcMAQsLIAAQNwJAIAAtAOEKBEAgACAcNgKkCCAAQQA6AOEKIABBATYCqAggACAXIAVrNgKECwwBCyAAKAKECyICRQ0AIAIgBCADayIHTgRAIAAgAiAHazYChAsgBiAENgIAIAQhAwwBCyAGIAIgA2oiAzYCACAAQQA2AoQLCyAAKAKoCCECAkACQAJAAkAgACgC7AogACgC/ApGBEACQCACRQ0AIAAtAN8KQQRxRQ0AIAAoAoALIgIgACgCpAgiBiAFIANrak8NACABIAVBACACIAZrIgEgASACSxsgA2oiASABIAVKGyIBNgIAIAAgACgCpAggAWo2AqQIDAQLIABBATYCqAggACAAKAKACyADIBJrajYCpAgMAQsgAkUNAQsgACAAKAKkCCAEIANrajYCpAgLIAAoAlAEQCAAKAJUIAAoAlxHDQILIAEgBTYCAAtBASEHDAcLQY0IQYAIQd0aQdAJEAAACyAIIBUoAgQgCkF/aiIKQQNsaiIHLQABQQJ0aigCACENIAggBy0AAEECdGooAgAhDkEAIQcDQCAHIAlGDQEgDSAHQQJ0Ig9qIgwqAgAhHwJAIA4gD2oiDyoCACIeQwAAAABeQQFzRQRAIB9DAAAAAF5BAXNFBEAgHiAfkyEgDAILIB4iICAfkiEeDAELIB9DAAAAAF5BAXNFBEAgHiAfkiEgDAELIB4iICAfkyEeCyAPIB44AgAgDCAgOAIAIAdBAWohBwwAAAsAAAsAC0GNCEGACEHpGUHQCRAAAAsgACALQYACaiAIIBIgCSANai0AGCALEEwgCUEBaiEJDAAACwALQY0IQYAIQcgZQdAJEAAACyALQcASaiQAIAcL5gIBBH8gAEIANwLgCwJAA0AgACgCYA0BIAAQUUUNASAAQQEQBARAIAAtADAEQCAAQSMQA0EADwsDQCAAEAhBf0cNAAsMAQsLIAICfwJAAkAgACgCUARAIAAoAlQgACgCXEcNAQsgACAAKAKYA0F/ahAREAQiAkF/Rg0DIAIgACgCmANODQMgBSACNgIAIAAgAkEGbGoiAkGcA2otAABFBEBBASECIAAoAnAiBkEBdSEFDAILIAAoAnQiBkEBdSEFIABBARAEIQggAEEBEAQhByACLQCcAyIJRSECIAggCUVyDQEgASAGIAAoAnBrQQJ1NgIAQQAhAiAAKAJwIAZqQQJ1DAILQY0IQYAIQbMYQcUIEAAACyABQQA2AgAgBQs2AgACQCACIAdyRQRAIAMgBkEDbCIBIAAoAnBrQQJ1NgIAIAAoAnAgAWpBAnUhBgwBCyADIAU2AgALIAQgBjYCAEEBIQYLIAYL9AIBCn8CQAJAIAAoAuAHIgdFBEAgACgCBCEGDAELIAAgBxBdIghFDQEgB0EAIAdBAEobIQkgACgCBCIGQQAgBkEAShshCgNAIAUgCkYNASAAIAVBAnRqIgshDUEAIQQDQCAEIAlGRQRAIAsoAqAGIAIgBGpBAnRqIgwgDCoCACAIIARBAnQiDGoqAgCUIA0oAqAHIAxqKgIAIAggByAEQX9zakECdGoqAgCUkjgCACAEQQFqIQQMAQsLIAVBAWohBQwAAAsACyAAIAEgA2siBDYC4AdBACEFQQAgBCABIANIIggbIQkgBkEAIAZBAEobIQYDQAJAIAUgBkcEQCAAIAVBAnRqIgohC0EAIQQDQCAEIAlGDQIgCygCoAcgBEECdGogCigCoAYgAyAEakECdGooAgA2AgAgBEEBaiEEDAAACwALIAdFDQIgACABIAMgCBsgAmsiASAAKAKIC2o2AogLIAEPCyAFQQFqIQUMAAALAAtBAAsRACAABEAgABA5IAAgABAGCwsDAAELC60kBgBBgAgLoAFzdGJfdm9yYmlzLmMAZi0+YWxsb2MuYWxsb2NfYnVmZmVyX2xlbmd0aF9pbl9ieXRlcyA9PSBmLT50ZW1wX29mZnNldAB2b3JiaXNfZGVjb2RlX2luaXRpYWwAZi0+Ynl0ZXNfaW5fc2VnID4gMABnZXQ4X3BhY2tldF9yYXcAZi0+Ynl0ZXNfaW5fc2VnID09IDAAbmV4dF9zZWdtZW50AEGxCQvSAQECAgMDAwMEBAQEBAQEBAABAACAAAAAVgAAAEAAAAB2b3JiaXNfZGVjb2RlX3BhY2tldF9yZXN0ACFjLT5zcGFyc2UAY29kZWJvb2tfZGVjb2RlX3NjYWxhcl9yYXcAIWMtPnNwYXJzZSB8fCB6IDwgYy0+c29ydGVkX2VudHJpZXMAY29kZWJvb2tfZGVjb2RlX2RlaW50ZXJsZWF2ZV9yZXBlYXQAeiA8IGMtPnNvcnRlZF9lbnRyaWVzAGNvZGVib29rX2RlY29kZV9zdGFydABBkAsLlyA+tOQzCZHzM4uyATQ8IAo0IxoTNGCpHDSn1yY0S68xNFA7PTRwh0k0I6BWNLiSZDRVbXM0iJ+BNPwLijSTBJM0aZKcNDK/pjQ/lbE0kx+9NORpyTStgNY0NnHkNKZJ8zSIjAE1wPcJNQbvEjV2exw1wKYmNTd7MTXaAz01XkxJNTthVjW5T2Q1/CVzNYp5gTWG44k1fNmSNYVknDVSjqY1M2GxNSXovDXcLsk1zkHWNUEu5DVXAvM1j2YBNk/PCTb1wxI2mE0cNuh1JjYyRzE2dMw8Nl4RSTZlIlY2zgxkNrjecjaXU4E2HLuJNnKukjavNpw2gV2mNjUtsTbHsLw25PPINgED1jZg6+M2HrvyNqJAATfrpgk38ZgSN8kfHDceRSY3PRMxNx6VPDdv1kg3ouNVN/fJYzeJl3I3ry2BN76SiTd0g5I35gicN74spjdH+bA3eXm8N/64yDdHxNU3kqjjN/hz8jfAGgE4k34JOPltEjgG8hs4YhQmOFbfMDjYXTw4kptIOPKkVTgzh2M4blByONMHgThraok4gliSOCrbmzgJ/KU4aMWwODtCvDgpfsg4oIXVONll4zjoLPI46fQAOUZWCTkOQxI5UcQbObXjJTl/qzA5oiY8OcVgSDlTZlU5g0RjOWgJcjkB4oA5JEKJOZ0tkjl7rZs5Y8ulOZmRsDkNC7w5ZkPIOQtH1TkyI+M57eXxOR3PADoFLgk6MBgSOqmWGzoVsyU6t3cwOnzvOzoKJkg6xydVOuYBYzp4wnE6O7yAOukZiTrGApI623+bOsuapTrYXbA679O7OrMIyDqICNU6n+DiOgef8TpcqQA70AUJO17tETsPaRs7hIIlO/1DMDtnuDs7YetHO03pVDtdv2I7nHtxO3+WgDu68Yg7+deRO0dSmztBaqU7JyqwO+KcuzsSzsc7F8rUOyCe4js1WPE7poMAPKfdCDyYwhE8gjsbPAFSJTxUEDA8YYE7PMiwRzzlqlQ86HxiPNQ0cTzPcIA8lsmIPDqtkTzAJJs8xTmlPIX2rzzlZbs8gpPHPLmL1Dy0W+I8eRHxPPtdAD2JtQg935cRPQIOGz2NISU9udwvPW1KOz1Adkc9kWxUPYU6Yj0i7nA9KkuAPX+hiD2IgpE9SPeaPVgJpT3ywq89+C67PQNZxz1tTdQ9XBniPdHK8D1bOAA+d40IPjNtET6Q4Bo+J/EkPi6pLz6HEzs+yjtHPk0uVD43+GE+hKdwPo8lgD5zeYg+4leRPtzJmj752KQ+bY+vPhv4uj6VHsc+Mw/UPhfX4T49hPA+xhIAP3JlCD+TQhE/K7MaP87AJD+xdS8/stw6P2UBRz8d8FM/+7VhP/tgcD8AAIA/KG4gJiAzKSA9PSAwAGltZGN0X3N0ZXAzX2l0ZXIwX2xvb3AAZi0+dGVtcF9vZmZzZXQgPT0gZi0+YWxsb2MuYWxsb2NfYnVmZmVyX2xlbmd0aF9pbl9ieXRlcwBzdGFydF9kZWNvZGVyAGMtPnNvcnRlZF9lbnRyaWVzID09IDAAY29tcHV0ZV9jb2Rld29yZHMAeiA+PSAwICYmIHogPCAzMgBsZW5baV0gPj0gMCAmJiBsZW5baV0gPCAzMgBhdmFpbGFibGVbeV0gPT0gMABrID09IGMtPnNvcnRlZF9lbnRyaWVzAGNvbXB1dGVfc29ydGVkX2h1ZmZtYW4AYy0+c29ydGVkX2NvZGV3b3Jkc1t4XSA9PSBjb2RlAGxlbiAhPSBOT19DT0RFAGluY2x1ZGVfaW5fc29ydAAAAAADAAAABAAAAAQAAAAGAAAAg/miAERObgD8KRUA0VcnAN009QBi28AAPJmVAEGQQwBjUf4Au96rALdhxQA6biQA0k1CAEkG4AAJ6i4AHJLRAOsd/gApsRwA6D6nAPU1ggBEuy4AnOmEALQmcABBfl8A1pE5AFODOQCc9DkAi1+EACj5vQD4HzsA3v+XAA+YBQARL+8AClqLAG0fbQDPfjYACcsnAEZPtwCeZj8ALepfALondQDl68cAPXvxAPc5BwCSUooA+2vqAB+xXwAIXY0AMANWAHv8RgDwq2sAILzPADb0mgDjqR0AXmGRAAgb5gCFmWUAoBRfAI1AaACA2P8AJ3NNAAYGMQDKVhUAyahzAHviYABrjMAAGcRHAM1nwwAJ6NwAWYMqAIt2xACmHJYARK/dABlX0QClPgUABQf/ADN+PwDCMugAmE/eALt9MgAmPcMAHmvvAJ/4XgA1HzoAf/LKAPGHHQB8kCEAaiR8ANVu+gAwLXcAFTtDALUUxgDDGZ0ArcTCACxNQQAMAF0Ahn1GAONxLQCbxpoAM2IAALTSfAC0p5cAN1XVANc+9gCjEBgATXb8AGSdKgBw16sAY3z4AHqwVwAXFecAwElWADvW2QCnhDgAJCPLANaKdwBaVCMAAB+5APEKGwAZzt8AnzH/AGYeagCZV2EArPtHAH5/2AAiZbcAMuiJAOa/YADvxM0AbDYJAF0/1AAW3tcAWDveAN6bkgDSIigAKIboAOJYTQDGyjIACOMWAOB9ywAXwFAA8x2nABjgWwAuEzQAgxJiAINIAQD1jlsArbB/AB7p8gBISkMAEGfTAKrd2ACuX0IAamHOAAoopADTmbQABqbyAFx3fwCjwoMAYTyIAIpzeACvjFoAb9e9AC2mYwD0v8sAjYHvACbBZwBVykUAytk2ACio0gDCYY0AEsl3AAQmFAASRpsAxFnEAMjFRABNspEAABfzANRDrQApSeUA/dUQAAC+/AAelMwAcM7uABM+9QDs8YAAs+fDAMf4KACTBZQAwXE+AC4JswALRfMAiBKcAKsgewAutZ8AR5LCAHsyLwAMVW0AcqeQAGvnHwAxy5YAeRZKAEF54gD034kA6JSXAOLmhACZMZcAiO1rAF9fNgC7/Q4ASJq0AGekbABxckIAjV0yAJ8VuAC85QkAjTElAPd0OQAwBRwADQwBAEsIaAAs7lgAR6qQAHTnAgC91iQA932mAG5IcgCfFu8AjpSmALSR9gDRU1EAzwryACCYMwD1S34AsmNoAN0+XwBAXQMAhYl/AFVSKQA3ZMAAbdgQADJIMgBbTHUATnHUAEVUbgALCcEAKvVpABRm1QAnB50AXQRQALQ72wDqdsUAh/kXAElrfQAdJ7oAlmkpAMbMrACtFFQAkOJqAIjZiQAsclAABKS+AHcHlADzMHAAAPwnAOpxqABmwkkAZOA9AJfdgwCjP5cAQ5T9AA2GjAAxQd4AkjmdAN1wjAAXt+cACN87ABU3KwBcgKAAWoCTABARkgAP6NgAbICvANv/SwA4kA8AWRh2AGKlFQBhy7sAx4m5ABBAvQDS8gQASXUnAOu29gDbIrsAChSqAIkmLwBkg3YACTszAA6UGgBROqoAHaPCAK/trgBcJhIAbcJNAC16nADAVpcAAz+DAAnw9gArQIwAbTGZADm0BwAMIBUA2MNbAPWSxADGrUsATsqlAKc3zQDmqTYAq5KUAN1CaAAZY94AdozvAGiLUgD82zcArqGrAN8VMQAArqEADPvaAGRNZgDtBbcAKWUwAFdWvwBH/zoAavm5AHW+8wAok98Aq4AwAGaM9gAEyxUA+iIGANnkHQA9s6QAVxuPADbNCQBOQukAE76kADMjtQDwqhoAT2WoANLBpQALPw8AW3jNACP5dgB7iwQAiRdyAMamUwBvbuIA7+sAAJtKWADE2rcAqma6AHbPzwDRAh0AsfEtAIyZwQDDrXcAhkjaAPddoADGgPQArPAvAN3smgA/XLwA0N5tAJDHHwAq27YAoyU6AACvmgCtU5MAtlcEACkttABLgH4A2genAHaqDgB7WaEAFhIqANy3LQD65f0Aidv+AIm+/QDkdmwABqn8AD6AcACFbhUA/Yf/ACg+BwBhZzMAKhiGAE296gCz568Aj21uAJVnOQAxv1sAhNdIADDfFgDHLUMAJWE1AMlwzgAwy7gAv2z9AKQAogAFbOQAWt2gACFvRwBiEtIAuVyEAHBhSQBrVuAAmVIBAFBVNwAe1bcAM/HEABNuXwBdMOQAhS6pAB2ywwChMjYACLekAOqx1AAW9yEAj2nkACf/dwAMA4AAjUAtAE/NoAAgpZkAs6LTAC9dCgC0+UIAEdrLAH2+0ACb28EAqxe9AMqigQAIalwALlUXACcAVQB/FPAA4QeGABQLZACWQY0Ah77eANr9KgBrJbYAe4k0AAXz/gC5v54AaGpPAEoqqABPxFoALfi8ANdamAD0x5UADU2NACA6pgCkV18AFD+xAIA4lQDMIAEAcd2GAMnetgC/YPUATWURAAEHawCMsKwAssDQAFFVSAAe+w4AlXLDAKMGOwDAQDUABtx7AOBFzABOKfoA1srIAOjzQQB8ZN4Am2TYANm+MQCkl8MAd1jUAGnjxQDw2hMAujo8AEYYRgBVdV8A0r31AG6SxgCsLl0ADkTtABw+QgBhxIcAKf3pAOfW8wAifMoAb5E1AAjgxQD/140AbmriALD9xgCTCMEAfF10AGutsgDNbp0APnJ7AMYRagD3z6kAKXPfALXJugC3AFEA4rINAHS6JADlfWAAdNiKAA0VLACBGAwAfmaUAAEpFgCfenYA/f2+AFZF7wDZfjYA7NkTAIu6uQDEl/wAMagnAPFuwwCUxTYA2KhWALSotQDPzA4AEoktAG9XNAAsVokAmc7jANYguQBrXqoAPiqcABFfzAD9C0oA4fT7AI47bQDihiwA6dSEAPy0qQDv7tEALjXJAC85YQA4IUQAG9nIAIH8CgD7SmoALxzYAFO0hABOmYwAVCLMACpV3ADAxtYACxmWABpwuABplWQAJlpgAD9S7gB/EQ8A9LURAPzL9QA0vC0ANLzuAOhdzADdXmAAZ46bAJIz7wDJF7gAYVibAOFXvABRg8YA2D4QAN1xSAAtHN0ArxihACEsRgBZ89cA2XqYAJ5UwABPhvoAVgb8AOV5rgCJIjYAOK0iAGeT3ABV6KoAgiY4AMrnmwBRDaQAmTOxAKnXDgBpBUgAZbLwAH+IpwCITJcA+dE2ACGSswB7gkoAmM8hAECf3ADcR1UA4XQ6AGfrQgD+nd8AXtRfAHtnpAC6rHoAVfaiACuIIwBBulUAWW4IACEqhgA5R4MAiePmAOWe1ABJ+0AA/1bpABwPygDFWYoAlPorANPBxQAPxc8A21quAEfFhgCFQ2IAIYY7ACx5lAAQYYcAKkx7AIAsGgBDvxIAiCaQAHg8iQCoxOQA5dt7AMQ6wgAm9OoA92eKAA2SvwBloysAPZOxAL18CwCkUdwAJ91jAGnh3QCalBkAqCmVAGjOKAAJ7bQARJ8gAE6YygBwgmMAfnwjAA+5MgCn9Y4AFFbnACHxCAC1nSoAb35NAKUZUQC1+asAgt/WAJbdYQAWNgIAxDqfAIOioQBy7W0AOY16AIK4qQBrMlwARidbAAA07QDSAHcA/PRVAAFZTQDgcYAAQbMrC21A+yH5PwAAAAAtRHQ+AAAAgJhG+DwAAABgUcx4OwAAAICDG/A5AAAAQCAlejgAAACAIoLjNgAAAAAd82k1AAAAAAAA4D8AAAAAAADgvwAAAAAAAPA/AAAAAAAA+D8AAAAAAAAAAAbQz0Pr/Uw+AEGrLAsFQAO44j8AQbAsCwpPZ2dTdm9yYmlz"),function(c){return c.charCodeAt(0)}); +var __dirname=null;var Module=typeof VorbisDecoderModule!=="undefined"?VorbisDecoderModule:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);return nodeFS["readFileSync"](filename,binary?null:"utf8")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!=="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);quit_=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){arguments_=scriptArgs}else if(typeof arguments!="undefined"){arguments_=arguments}if(typeof quit==="function"){quit_=function(status){quit(status)}}if(typeof print!=="undefined"){if(typeof console==="undefined")console={};console.log=print;console.warn=console.error=typeof printErr!=="undefined"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime;if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(typeof WebAssembly!=="object"){err("no native wasm support detected")}function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for getValue: "+type)}return null}var wasmMemory;var wasmTable=new WebAssembly.Table({"initial":3,"maximum":3+0,"element":"anyfunc"});var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heap,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heap[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}var WASM_PAGE_SIZE=65536;var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var DYNAMIC_BASE=72928,DYNAMICTOP_PTR=7232;var INITIAL_INITIAL_MEMORY=Module["INITIAL_MEMORY"]||1048576;if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_INITIAL_MEMORY/WASM_PAGE_SIZE,"maximum":INITIAL_INITIAL_MEMORY/WASM_PAGE_SIZE})}if(wasmMemory){buffer=wasmMemory.buffer}INITIAL_INITIAL_MEMORY=buffer.byteLength;updateGlobalBufferAndViews(buffer);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";out(what);err(what);ABORT=true;EXITSTATUS=1;what="abort("+what+"). Build with -s ASSERTIONS=1 for more info.";throw new WebAssembly.RuntimeError(what)}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix="file://";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile="vorbisdecoder.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return new Promise(function(resolve,reject){resolve(getBinary())})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}__ATINIT__.push({func:function(){___wasm_call_ctors()}});function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var asmLibraryArg={"a":___assert_fail,"b":_emscripten_memcpy_big,"c":_emscripten_resize_heap,"memory":wasmMemory,"table":wasmTable};var asm=createWasm();Module["asm"]=asm;var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["d"]).apply(null,arguments)};var _stb_vorbis_close=Module["_stb_vorbis_close"]=function(){return(_stb_vorbis_close=Module["_stb_vorbis_close"]=Module["asm"]["e"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["f"]).apply(null,arguments)};var _stb_vorbis_decode_frame_pushdata=Module["_stb_vorbis_decode_frame_pushdata"]=function(){return(_stb_vorbis_decode_frame_pushdata=Module["_stb_vorbis_decode_frame_pushdata"]=Module["asm"]["g"]).apply(null,arguments)};var _stb_vorbis_open_pushdata=Module["_stb_vorbis_open_pushdata"]=function(){return(_stb_vorbis_open_pushdata=Module["_stb_vorbis_open_pushdata"]=Module["asm"]["h"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["i"]).apply(null,arguments)};Module["asm"]=asm;Module["getValue"]=getValue;var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run();class VorbisDecoder{constructor(context,decodeHandler,errorHandler){VorbisDecoder.id=(VorbisDecoder.id||0)%1e3;this.id=VorbisDecoder.id++;this.context=context;this.decodeHandler=decodeHandler;this.errorHandler=errorHandler;VorbisDecoder.instances=VorbisDecoder.instances||[];VorbisDecoder.instances[this.id]=this}destroy(){const message={id:this.id,destroy:true};VorbisDecoder.worker.postMessage(message);delete VorbisDecoder.instances[this.id]}send(arrayBuffer,isLoaded){const message={id:this.id,arrayBuffer:arrayBuffer,isLoaded:isLoaded};VorbisDecoder.worker.postMessage(message)}onMessage(message){const channels=message.data.length;if(channels>0){const length=message.data[0].length;const buffer=this.context.createBuffer(channels,length,message.sampleRate);for(let i=0;i=8e3&&this.sampleRate<22050){this.sampleScale=Math.ceil(22050/this.sampleRate)}this.totalSamples=0;this.arrays=[];this.data=[];for(let i=0;i0){const output=Module.getValue(this.outputPtr,"i32");const samples=Module.getValue(this.samplesPtr,"i32");this.byteOffset+=used;for(let i=0;i=this.sampleRate*5){this.sendBack();setTimeout(this.decode.bind(this));break}}}}resample(array){if(this.sampleScale===1){return array.slice()}else{const scale=this.sampleScale;const expanded=new Float32Array(array.length*scale);for(let i=0;i0){this.concatenate();const message={id:this.id,sampleRate:this.sampleRate*this.sampleScale,data:this.data};const transfer=[];for(let i=0;i{const id=e.data.id;const instances=VorbisWorkerDecoder.instances;if(!instances[id]){instances[id]=new VorbisWorkerDecoder(id)}if(instances[id]){instances[id].onMessage(e.data)}if(e.data.destroy){instances[id].close();delete instances[id]}})}else{VorbisDecoder.instances=[];VorbisDecoder.worker=new Worker(document.currentScript.src);VorbisDecoder.worker.addEventListener("message",e=>{const instances=VorbisDecoder.instances;const id=e.data.id;if(instances[id]){instances[id].onMessage(e.data)}})} diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..ef1d462 --- /dev/null +++ b/js/main.js @@ -0,0 +1,161 @@ +//============================================================================= +// main.js v1.8.1 +//============================================================================= + +const scriptUrls = [ + "js/libs/pixi.js", + "js/libs/pako.min.js", + "js/libs/localforage.min.js", + "js/libs/effekseer.min.js", + "js/libs/vorbisdecoder.js", + "js/rmmz_core.js", + "js/rmmz_managers.js", + "js/rmmz_objects.js", + "js/rmmz_scenes.js", + "js/rmmz_sprites.js", + "js/rmmz_windows.js", + "js/plugins.js" +]; +const effekseerWasmUrl = "js/libs/effekseer.wasm"; + +class Main { + constructor() { + this.xhrSucceeded = false; + this.loadCount = 0; + this.error = null; + } + + run() { + this.showLoadingSpinner(); + this.testXhr(); + this.hookNwjsClose(); + this.loadMainScripts(); + } + + showLoadingSpinner() { + const loadingSpinner = document.createElement("div"); + const loadingSpinnerImage = document.createElement("div"); + loadingSpinner.id = "loadingSpinner"; + loadingSpinnerImage.id = "loadingSpinnerImage"; + loadingSpinner.appendChild(loadingSpinnerImage); + document.body.appendChild(loadingSpinner); + } + + eraseLoadingSpinner() { + const loadingSpinner = document.getElementById("loadingSpinner"); + if (loadingSpinner) { + document.body.removeChild(loadingSpinner); + } + } + + testXhr() { + const xhr = new XMLHttpRequest(); + xhr.open("GET", document.currentScript.src); + xhr.onload = () => (this.xhrSucceeded = true); + xhr.send(); + } + + hookNwjsClose() { + // [Note] When closing the window, the NW.js process sometimes does + // not terminate properly. This code is a workaround for that. + if (typeof nw === "object") { + nw.Window.get().on("close", () => nw.App.quit()); + } + } + + loadMainScripts() { + for (const url of scriptUrls) { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.src = url; + script.async = false; + script.defer = true; + script.onload = this.onScriptLoad.bind(this); + script.onerror = this.onScriptError.bind(this); + script._url = url; + document.body.appendChild(script); + } + this.numScripts = scriptUrls.length; + window.addEventListener("load", this.onWindowLoad.bind(this)); + window.addEventListener("error", this.onWindowError.bind(this)); + } + + onScriptLoad() { + if (++this.loadCount === this.numScripts) { + PluginManager.setup($plugins); + } + } + + onScriptError(e) { + this.printError("Failed to load", e.target._url); + } + + printError(name, message) { + this.eraseLoadingSpinner(); + if (!document.getElementById("errorPrinter")) { + const errorPrinter = document.createElement("div"); + errorPrinter.id = "errorPrinter"; + errorPrinter.innerHTML = this.makeErrorHtml(name, message); + document.body.appendChild(errorPrinter); + } + } + + makeErrorHtml(name, message) { + const nameDiv = document.createElement("div"); + const messageDiv = document.createElement("div"); + nameDiv.id = "errorName"; + messageDiv.id = "errorMessage"; + nameDiv.innerHTML = name; + messageDiv.innerHTML = message; + return nameDiv.outerHTML + messageDiv.outerHTML; + } + + onWindowLoad() { + if (!this.xhrSucceeded) { + const message = "Your browser does not allow to read local files."; + this.printError("Error", message); + } else if (this.isPathRandomized()) { + const message = "Please move the Game.app to a different folder."; + this.printError("Error", message); + } else if (this.error) { + this.printError(this.error.name, this.error.message); + } else { + this.initEffekseerRuntime(); + } + } + + onWindowError(event) { + if (!this.error) { + this.error = event.error; + } + } + + isPathRandomized() { + // [Note] We cannot save the game properly when Gatekeeper Path + // Randomization is in effect. + return ( + typeof process === "object" && + process.mainModule.filename.startsWith("/private/var") + ); + } + + initEffekseerRuntime() { + const onLoad = this.onEffekseerLoad.bind(this); + const onError = this.onEffekseerError.bind(this); + effekseer.initRuntime(effekseerWasmUrl, onLoad, onError); + } + + onEffekseerLoad() { + this.eraseLoadingSpinner(); + SceneManager.run(Scene_Boot); + } + + onEffekseerError() { + this.printError("Failed to load", effekseerWasmUrl); + } +} + +const main = new Main(); +main.run(); + +//----------------------------------------------------------------------------- diff --git a/js/plugins.js b/js/plugins.js new file mode 100644 index 0000000..04d5b05 --- /dev/null +++ b/js/plugins.js @@ -0,0 +1,5 @@ +// Generated by RPG Maker. +// Do not edit this file directly. +var $plugins = +[ +]; diff --git a/js/plugins/AltMenuScreen.js b/js/plugins/AltMenuScreen.js new file mode 100644 index 0000000..a984a26 --- /dev/null +++ b/js/plugins/AltMenuScreen.js @@ -0,0 +1,105 @@ +//============================================================================= +// RPG Maker MZ - Alternative Menu Screen +//============================================================================= + +/*: + * @target MZ + * @plugindesc Alternative menu screen layout. + * @author Yoji Ojima + * + * @help AltMenuScreen.js + * + * This plugin changes the layout of the menu screen. + * It puts the commands on the top and the status on the bottom. + * + * It does not provide plugin commands. + */ + +/*:ja + * @target MZ + * @plugindesc メニュー画面のレイアウトを変更します。 + * @author Yoji Ojima + * + * @help AltMenuScreen.js + * + * このプラグインは、メニュー画面のレイアウトを変更します。 + * コマンドを上側に、ステータスを下側に配置します。 + * + * プラグインコマンドはありません。 + */ + +(() => { + Scene_MenuBase.prototype.commandWindowHeight = function() { + return this.calcWindowHeight(2, true); + }; + + Scene_MenuBase.prototype.goldWindowHeight = function() { + return this.calcWindowHeight(1, true); + }; + + Scene_Menu.prototype.commandWindowRect = function() { + const ww = Graphics.boxWidth; + const wh = this.commandWindowHeight(); + const wx = 0; + const wy = this.mainAreaTop(); + return new Rectangle(wx, wy, ww, wh); + }; + + Scene_Menu.prototype.statusWindowRect = function() { + const h1 = this.commandWindowHeight(); + const h2 = this.goldWindowHeight(); + const ww = Graphics.boxWidth; + const wh = this.mainAreaHeight() - h1 - h2; + const wx = 0; + const wy = this.mainAreaTop() + this.commandWindowHeight(); + return new Rectangle(wx, wy, ww, wh); + }; + + Scene_ItemBase.prototype.actorWindowRect = function() { + const rect = Scene_Menu.prototype.statusWindowRect(); + rect.y = this.mainAreaBottom() - rect.height; + return rect; + }; + + Window_MenuCommand.prototype.maxCols = function() { + return 4; + }; + + Window_MenuCommand.prototype.numVisibleRows = function() { + return 2; + }; + + Window_MenuStatus.prototype.maxCols = function() { + return 4; + }; + + Window_MenuStatus.prototype.numVisibleRows = function() { + return 1; + }; + + Window_MenuStatus.prototype.drawItemImage = function(index) { + const actor = this.actor(index); + const rect = this.itemRectWithPadding(index); + const w = Math.min(rect.width, 144); + const h = Math.min(rect.height, 144); + const lineHeight = this.lineHeight(); + this.changePaintOpacity(actor.isBattleMember()); + this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2, w, h); + this.changePaintOpacity(true); + }; + + Window_MenuStatus.prototype.drawItemStatus = function(index) { + const actor = this.actor(index); + const rect = this.itemRectWithPadding(index); + const x = rect.x; + const y = rect.y; + const width = rect.width; + const bottom = y + rect.height; + const lineHeight = this.lineHeight(); + this.drawActorName(actor, x, y + lineHeight * 0, width); + this.drawActorLevel(actor, x, y + lineHeight * 1, width); + this.drawActorClass(actor, x, bottom - lineHeight * 4, width); + this.placeBasicGauges(actor, x, bottom - lineHeight * 3, width); + this.drawActorIcons(actor, x, bottom - lineHeight * 1, width); + }; +})(); diff --git a/js/plugins/AltSaveScreen.js b/js/plugins/AltSaveScreen.js new file mode 100644 index 0000000..86b8bb1 --- /dev/null +++ b/js/plugins/AltSaveScreen.js @@ -0,0 +1,126 @@ +//============================================================================= +// RPG Maker MZ - Alternative Save Screen +//============================================================================= + +/*: + * @target MZ + * @plugindesc Alternative save/load screen layout. + * @author Yoji Ojima + * + * @help AltSaveScreen.js + * + * This plugin changes the layout of the save/load screen. + * It puts the file list on the top and the details on the bottom. + * + * It does not provide plugin commands. + */ + +/*:ja + * @target MZ + * @plugindesc セーブ/ロード画面のレイアウトを変更します。 + * @author Yoji Ojima + * + * @help AltSaveScreen.js + * + * このプラグインは、セーブ/ロード画面のレイアウトを変更します。 + * ファイル一覧を上側に、詳細を下側に配置します。 + * + * プラグインコマンドはありません。 + */ + +(() => { + const _Scene_File_create = Scene_File.prototype.create; + Scene_File.prototype.create = function() { + _Scene_File_create.apply(this, arguments); + this._listWindow.height = this._listWindow.fittingHeight(3); + const x = 0; + const y = this._listWindow.y + this._listWindow.height; + const width = Graphics.boxWidth; + const height = Graphics.boxHeight - y; + const rect = new Rectangle(x, y, width, height); + const statusWindow = new Window_SavefileStatus(rect); + this._listWindow.mzkp_statusWindow = statusWindow; + this.addWindow(statusWindow); + }; + + const _Scene_File_start = Scene_File.prototype.start; + Scene_File.prototype.start = function() { + _Scene_File_start.apply(this, arguments); + this._listWindow.ensureCursorVisible(); + this._listWindow.callUpdateHelp(); + }; + + Window_SavefileList.prototype.windowWidth = function() { + return Graphics.boxWidth; + }; + + Window_SavefileList.prototype.maxCols = function() { + return 4; + }; + + Window_SavefileList.prototype.itemHeight = function() { + return this.lineHeight() * 2 + 16; + }; + + const _Window_SavefileList_callUpdateHelp = + Window_SavefileList.prototype.callUpdateHelp; + Window_SavefileList.prototype.callUpdateHelp = function() { + _Window_SavefileList_callUpdateHelp.apply(this, arguments); + if (this.active && this.mzkp_statusWindow) { + this.mzkp_statusWindow.setSavefileId(this.savefileId()); + } + }; + + function Window_SavefileStatus() { + this.initialize.apply(this, arguments); + } + + Window_SavefileStatus.prototype = Object.create(Window_Base.prototype); + Window_SavefileStatus.prototype.constructor = Window_SavefileStatus; + + Window_SavefileStatus.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, rect); + this._savefileId = 1; + }; + + Window_SavefileStatus.prototype.setSavefileId = function(id) { + this._savefileId = id; + this.refresh(); + }; + + Window_SavefileStatus.prototype.refresh = function() { + const info = DataManager.savefileInfo(this._savefileId); + const rect = this.contents.rect; + this.contents.clear(); + this.resetTextColor(); + this.drawTitle(this._savefileId, rect.x, rect.y); + if (info) { + this.drawContents(info, rect); + } + }; + + Window_SavefileStatus.prototype.drawTitle = function(savefileId, x, y) { + if (savefileId === 0) { + this.drawText(TextManager.autosave, x, y, 180); + } else { + this.drawText(TextManager.file + " " + savefileId, x, y, 180); + } + }; + + Window_SavefileStatus.prototype.drawContents = function(info, rect) { + const bottom = rect.y + rect.height; + const playtimeY = bottom - this.lineHeight(); + this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192); + this.drawPartyfaces(info.faces, rect.x, bottom - 144); + this.drawText(info.playtime, rect.x, playtimeY, rect.width, "right"); + }; + + Window_SavefileStatus.prototype.drawPartyfaces = function(faces, x, y) { + if (faces) { + for (let i = 0; i < faces.length; i++) { + const data = faces[i]; + this.drawFace(data[0], data[1], x + i * 150, y); + } + } + }; +})(); diff --git a/js/plugins/ButtonPicture.js b/js/plugins/ButtonPicture.js new file mode 100644 index 0000000..05f74d6 --- /dev/null +++ b/js/plugins/ButtonPicture.js @@ -0,0 +1,106 @@ +//============================================================================= +// RPG Maker MZ - Button Picture +//============================================================================= + +/*: + * @target MZ + * @plugindesc Makes a picture clickable. + * @author Yoji Ojima + * + * @help ButtonPicture.js + * + * This plugin provides a command to call a common event when a picture is + * clicked. + * + * Use it in the following procedure. + * 1. Execute "Show Picture" to display your button image. + * 2. Call the plugin command "Set Button Picture". + * + * @command set + * @text Set Button Picture + * @desc Makes the specified picture clickable. + * + * @arg pictureId + * @type number + * @min 1 + * @max 100 + * @default 1 + * @text Picture Number + * @desc Control number of the picture. + * + * @arg commonEventId + * @type common_event + * @default 1 + * @text Common Event + * @desc Common event to call when the picture is clicked. + */ + +/*:ja + * @target MZ + * @plugindesc ピクチャをクリック可能にします。 + * @author Yoji Ojima + * + * @help ButtonPicture.js + * + * このプラグインは、ピクチャのクリック時にコモンイベントを呼び出すコマンドを + * 提供します。 + * + * 次の手順で使用してください。 + * 1. 「ピクチャの表示」を実行して、ボタン画像を表示します。 + * 2. プラグインコマンド「ボタンピクチャの設定」を呼び出します。 + * + * @command set + * @text ボタンピクチャの設定 + * @desc 指定したピクチャをクリック可能にします。 + * + * @arg pictureId + * @type number + * @min 1 + * @max 100 + * @default 1 + * @text ピクチャ番号 + * @desc ピクチャの管理番号です。 + * + * @arg commonEventId + * @type common_event + * @default 1 + * @text コモンイベント + * @desc ピクチャがクリックされた時に呼び出すコモンイベントです。 + */ + +(() => { + const pluginName = "ButtonPicture"; + + PluginManager.registerCommand(pluginName, "set", args => { + const pictureId = Number(args.pictureId); + const commonEventId = Number(args.commonEventId); + const picture = $gameScreen.picture(pictureId); + if (picture) { + picture.mzkp_commonEventId = commonEventId; + } + }); + + Sprite_Picture.prototype.isClickEnabled = function() { + const picture = this.picture(); + return picture && picture.mzkp_commonEventId && !$gameMessage.isBusy(); + }; + + Sprite_Picture.prototype.onClick = function() { + $gameTemp.reserveCommonEvent(this.picture().mzkp_commonEventId); + }; + + Spriteset_Base.prototype.mzkp_isAnyPicturePressed = function() { + return this._pictureContainer.children.some(sprite => + sprite.isPressed() + ); + }; + + const _Scene_Map_isAnyButtonPressed = + Scene_Map.prototype.isAnyButtonPressed; + Scene_Map.prototype.isAnyButtonPressed = function() { + return ( + _Scene_Map_isAnyButtonPressed.apply(this, arguments) || + this._spriteset.mzkp_isAnyPicturePressed() + ); + }; +})(); diff --git a/js/plugins/TextPicture.js b/js/plugins/TextPicture.js new file mode 100644 index 0000000..3521c4b --- /dev/null +++ b/js/plugins/TextPicture.js @@ -0,0 +1,116 @@ +//============================================================================= +// RPG Maker MZ - Text Picture +//============================================================================= + +/*: + * @target MZ + * @plugindesc Displays text as a picture. + * @author Yoji Ojima + * + * @help TextPicture.js + * + * This plugin provides a command to show text as a picture. + * + * Use it in the following procedure. + * 1. Call the plugin command "Set Text Picture". + * 2. Execute "Show Picture" without specifying an image. + * + * @command set + * @text Set Text Picture + * @desc Sets text to display as a picture. + * After this, execute "Show Picture" without specifying an image. + * + * @arg text + * @type multiline_string + * @text Text + * @desc Text to display as a picture. + * Control characters are allowed. + */ + +/*:ja + * @target MZ + * @plugindesc テキストをピクチャとして表示します。 + * @author Yoji Ojima + * + * @help TextPicture.js + * + * このプラグインは、テキストをピクチャとして表示するコマンドを提供します。 + * + * 次の手順で使用してください。 + * 1. プラグインコマンド「テキストピクチャの設定」を呼び出します。 + * 2. 画像を指定せずに「ピクチャの表示」を実行します。 + * + * @command set + * @text テキストピクチャの設定 + * @desc ピクチャとして表示するテキストを設定します。 + * この後、画像を指定せずに「ピクチャの表示」を実行してください。 + * + * @arg text + * @type multiline_string + * @text テキスト + * @desc ピクチャとして表示するテキストです。 + * 制御文字が使用可能です。 + */ + +(() => { + const pluginName = "TextPicture"; + let textPictureText = ""; + + PluginManager.registerCommand(pluginName, "set", args => { + textPictureText = String(args.text); + }); + + const _Game_Picture_show = Game_Picture.prototype.show; + Game_Picture.prototype.show = function() { + _Game_Picture_show.apply(this, arguments); + if (this._name === "" && textPictureText) { + this.mzkp_text = textPictureText; + this.mzkp_textChanged = true; + textPictureText = ""; + } + }; + + const _Sprite_Picture_destroy = Sprite_Picture.prototype.destroy; + Sprite_Picture.prototype.destroy = function() { + destroyTextPictureBitmap(this.bitmap); + _Sprite_Picture_destroy.apply(this, arguments); + }; + + const _Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap; + Sprite_Picture.prototype.updateBitmap = function() { + _Sprite_Picture_updateBitmap.apply(this, arguments); + if (this.visible && this._pictureName === "") { + const picture = this.picture(); + const text = picture ? picture.mzkp_text || "" : ""; + const textChanged = picture && picture.mzkp_textChanged; + if (this.mzkp_text !== text || textChanged) { + this.mzkp_text = text; + destroyTextPictureBitmap(this.bitmap); + this.bitmap = createTextPictureBitmap(text); + picture.mzkp_textChanged = false; + } + } else { + this.mzkp_text = ""; + } + }; + + function createTextPictureBitmap(text) { + const tempWindow = new Window_Base(new Rectangle()); + const size = tempWindow.textSizeEx(text); + tempWindow.padding = 0; + tempWindow.move(0, 0, size.width, size.height); + tempWindow.createContents(); + tempWindow.drawTextEx(text, 0, 0, 0); + const bitmap = tempWindow.contents; + tempWindow.contents = null; + tempWindow.destroy(); + bitmap.mzkp_isTextPicture = true; + return bitmap; + } + + function destroyTextPictureBitmap(bitmap) { + if (bitmap && bitmap.mzkp_isTextPicture) { + bitmap.destroy(); + } + } +})(); diff --git a/js/rmmz_core.js b/js/rmmz_core.js new file mode 100644 index 0000000..9008587 --- /dev/null +++ b/js/rmmz_core.js @@ -0,0 +1,6493 @@ +//============================================================================= +// rmmz_core.js v1.8.1 +//============================================================================= + +//----------------------------------------------------------------------------- +/** + * This section contains some methods that will be added to the standard + * Javascript objects. + * + * @namespace JsExtensions + */ + +/** + * Makes a shallow copy of the array. + * + * @memberof JsExtensions + * @returns {array} A shallow copy of the array. + */ +Array.prototype.clone = function() { + return this.slice(0); +}; + +Object.defineProperty(Array.prototype, "clone", { + enumerable: false +}); + +/** + * Checks whether the array contains a given element. + * + * @memberof JsExtensions + * @param {any} element - The element to search for. + * @returns {boolean} True if the array contains a given element. + * @deprecated includes() should be used instead. + */ +Array.prototype.contains = function(element) { + return this.includes(element); +}; + +Object.defineProperty(Array.prototype, "contains", { + enumerable: false +}); + +/** + * Checks whether the two arrays are the same. + * + * @memberof JsExtensions + * @param {array} array - The array to compare to. + * @returns {boolean} True if the two arrays are the same. + */ +Array.prototype.equals = function(array) { + if (!array || this.length !== array.length) { + return false; + } + for (let i = 0; i < this.length; i++) { + if (this[i] instanceof Array && array[i] instanceof Array) { + if (!this[i].equals(array[i])) { + return false; + } + } else if (this[i] !== array[i]) { + return false; + } + } + return true; +}; + +Object.defineProperty(Array.prototype, "equals", { + enumerable: false +}); + +/** + * Removes a given element from the array (in place). + * + * @memberof JsExtensions + * @param {any} element - The element to remove. + * @returns {array} The array after remove. + */ +Array.prototype.remove = function(element) { + for (;;) { + const index = this.indexOf(element); + if (index >= 0) { + this.splice(index, 1); + } else { + return this; + } + } +}; + +Object.defineProperty(Array.prototype, "remove", { + enumerable: false +}); + +/** + * Generates a random integer in the range (0, max-1). + * + * @memberof JsExtensions + * @param {number} max - The upper boundary (excluded). + * @returns {number} A random integer. + */ +Math.randomInt = function(max) { + return Math.floor(max * Math.random()); +}; + +/** + * Returns a number whose value is limited to the given range. + * + * @memberof JsExtensions + * @param {number} min - The lower boundary. + * @param {number} max - The upper boundary. + * @returns {number} A number in the range (min, max). + */ +Number.prototype.clamp = function(min, max) { + return Math.min(Math.max(this, min), max); +}; + +/** + * Returns a modulo value which is always positive. + * + * @memberof JsExtensions + * @param {number} n - The divisor. + * @returns {number} A modulo value. + */ +Number.prototype.mod = function(n) { + return ((this % n) + n) % n; +}; + +/** + * Makes a number string with leading zeros. + * + * @memberof JsExtensions + * @param {number} length - The length of the output string. + * @returns {string} A string with leading zeros. + */ +Number.prototype.padZero = function(length) { + return String(this).padZero(length); +}; + +/** + * Checks whether the string contains a given string. + * + * @memberof JsExtensions + * @param {string} string - The string to search for. + * @returns {boolean} True if the string contains a given string. + * @deprecated includes() should be used instead. + */ +String.prototype.contains = function(string) { + return this.includes(string); +}; + +/** + * Replaces %1, %2 and so on in the string to the arguments. + * + * @memberof JsExtensions + * @param {any} ...args The objects to format. + * @returns {string} A formatted string. + */ +String.prototype.format = function() { + return this.replace(/%([0-9]+)/g, (s, n) => arguments[Number(n) - 1]); +}; + +/** + * Makes a number string with leading zeros. + * + * @memberof JsExtensions + * @param {number} length - The length of the output string. + * @returns {string} A string with leading zeros. + */ +String.prototype.padZero = function(length) { + return this.padStart(length, "0"); +}; + +//----------------------------------------------------------------------------- +/** + * The static class that defines utility methods. + * + * @namespace + */ +function Utils() { + throw new Error("This is a static class"); +} + +/** + * The name of the RPG Maker. "MZ" in the current version. + * + * @type string + * @constant + */ +Utils.RPGMAKER_NAME = "MZ"; + +/** + * The version of the RPG Maker. + * + * @type string + * @constant + */ +Utils.RPGMAKER_VERSION = "1.8.1"; + +/** + * Checks whether the current RPG Maker version is greater than or equal to + * the given version. + * + * @param {string} version - The "x.x.x" format string to compare. + * @returns {boolean} True if the current version is greater than or equal + * to the given version. + */ +Utils.checkRMVersion = function(version) { + const array1 = this.RPGMAKER_VERSION.split("."); + const array2 = String(version).split("."); + for (let i = 0; i < array1.length; i++) { + const v1 = parseInt(array1[i]); + const v2 = parseInt(array2[i]); + if (v1 > v2) { + return true; + } else if (v1 < v2) { + return false; + } + } + return true; +}; + +/** + * Checks whether the option is in the query string. + * + * @param {string} name - The option name. + * @returns {boolean} True if the option is in the query string. + */ +Utils.isOptionValid = function(name) { + const args = location.search.slice(1); + if (args.split("&").includes(name)) { + return true; + } + if (this.isNwjs() && nw.App.argv.length > 0) { + return nw.App.argv[0].split("&").includes(name); + } + return false; +}; + +/** + * Checks whether the platform is NW.js. + * + * @returns {boolean} True if the platform is NW.js. + */ +Utils.isNwjs = function() { + return typeof require === "function" && typeof process === "object"; +}; + +/** + * Checks whether the platform is a mobile device. + * + * @returns {boolean} True if the platform is a mobile device. + */ +Utils.isMobileDevice = function() { + const r = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i; + return !!navigator.userAgent.match(r); +}; + +/** + * Checks whether the browser is Mobile Safari. + * + * @returns {boolean} True if the browser is Mobile Safari. + */ +Utils.isMobileSafari = function() { + const agent = navigator.userAgent; + return !!( + agent.match(/iPhone|iPad|iPod/) && + agent.match(/AppleWebKit/) && + !agent.match("CriOS") + ); +}; + +/** + * Checks whether the browser is Android Chrome. + * + * @returns {boolean} True if the browser is Android Chrome. + */ +Utils.isAndroidChrome = function() { + const agent = navigator.userAgent; + return !!(agent.match(/Android/) && agent.match(/Chrome/)); +}; + +/** + * Checks whether the browser is accessing local files. + * + * @returns {boolean} True if the browser is accessing local files. + */ +Utils.isLocal = function() { + return window.location.href.startsWith("file:"); +}; + +/** + * Checks whether the browser supports WebGL. + * + * @returns {boolean} True if the browser supports WebGL. + */ +Utils.canUseWebGL = function() { + try { + const canvas = document.createElement("canvas"); + return !!canvas.getContext("webgl"); + } catch (e) { + return false; + } +}; + +/** + * Checks whether the browser supports Web Audio API. + * + * @returns {boolean} True if the browser supports Web Audio API. + */ +Utils.canUseWebAudioAPI = function() { + return !!(window.AudioContext || window.webkitAudioContext); +}; + +/** + * Checks whether the browser supports CSS Font Loading. + * + * @returns {boolean} True if the browser supports CSS Font Loading. + */ +Utils.canUseCssFontLoading = function() { + return !!(document.fonts && document.fonts.ready); +}; + +/** + * Checks whether the browser supports IndexedDB. + * + * @returns {boolean} True if the browser supports IndexedDB. + */ +Utils.canUseIndexedDB = function() { + return !!( + window.indexedDB || + window.mozIndexedDB || + window.webkitIndexedDB + ); +}; + +/** + * Checks whether the browser can play ogg files. + * + * @returns {boolean} True if the browser can play ogg files. + */ +Utils.canPlayOgg = function() { + if (!Utils._audioElement) { + Utils._audioElement = document.createElement("audio"); + } + return !!( + Utils._audioElement && + Utils._audioElement.canPlayType('audio/ogg; codecs="vorbis"') + ); +}; + +/** + * Checks whether the browser can play webm files. + * + * @returns {boolean} True if the browser can play webm files. + */ +Utils.canPlayWebm = function() { + if (!Utils._videoElement) { + Utils._videoElement = document.createElement("video"); + } + return !!( + Utils._videoElement && + Utils._videoElement.canPlayType('video/webm; codecs="vp8, vorbis"') + ); +}; + +/** + * Encodes a URI component without escaping slash characters. + * + * @param {string} str - The input string. + * @returns {string} Encoded string. + */ +Utils.encodeURI = function(str) { + return encodeURIComponent(str).replace(/%2F/g, "/"); +}; + +/** + * Gets the filename that does not include subfolders. + * + * @param {string} filename - The filename with subfolders. + * @returns {string} The filename without subfolders. + */ +Utils.extractFileName = function(filename) { + return filename.split("/").pop(); +}; + +/** + * Escapes special characters for HTML. + * + * @param {string} str - The input string. + * @returns {string} Escaped string. + */ +Utils.escapeHtml = function(str) { + const entityMap = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "/": "/" + }; + return String(str).replace(/[&<>"'/]/g, s => entityMap[s]); +}; + +/** + * Checks whether the string contains any Arabic characters. + * + * @returns {boolean} True if the string contains any Arabic characters. + */ +Utils.containsArabic = function(str) { + const regExp = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]/; + return regExp.test(str); +}; + +/** + * Sets information related to encryption. + * + * @param {boolean} hasImages - Whether the image files are encrypted. + * @param {boolean} hasAudio - Whether the audio files are encrypted. + * @param {string} key - The encryption key. + */ +Utils.setEncryptionInfo = function(hasImages, hasAudio, key) { + // [Note] This function is implemented for module independence. + this._hasEncryptedImages = hasImages; + this._hasEncryptedAudio = hasAudio; + this._encryptionKey = key; +}; + +/** + * Checks whether the image files in the game are encrypted. + * + * @returns {boolean} True if the image files are encrypted. + */ +Utils.hasEncryptedImages = function() { + return this._hasEncryptedImages; +}; + +/** + * Checks whether the audio files in the game are encrypted. + * + * @returns {boolean} True if the audio files are encrypted. + */ +Utils.hasEncryptedAudio = function() { + return this._hasEncryptedAudio; +}; + +/** + * Decrypts encrypted data. + * + * @param {ArrayBuffer} source - The data to be decrypted. + * @returns {ArrayBuffer} The decrypted data. + */ +Utils.decryptArrayBuffer = function(source) { + const header = new Uint8Array(source, 0, 16); + const headerHex = Array.from(header, x => x.toString(16)).join(","); + if (headerHex !== "52,50,47,4d,56,0,0,0,0,3,1,0,0,0,0,0") { + throw new Error("Decryption error"); + } + const body = source.slice(16); + const view = new DataView(body); + const key = this._encryptionKey.match(/.{2}/g); + for (let i = 0; i < 16; i++) { + view.setUint8(i, view.getUint8(i) ^ parseInt(key[i], 16)); + } + return body; +}; + +//----------------------------------------------------------------------------- +/** + * The static class that carries out graphics processing. + * + * @namespace + */ +function Graphics() { + throw new Error("This is a static class"); +} + +/** + * Initializes the graphics system. + * + * @returns {boolean} True if the graphics system is available. + */ +Graphics.initialize = function() { + this._width = 0; + this._height = 0; + this._defaultScale = 1; + this._realScale = 1; + this._errorPrinter = null; + this._tickHandler = null; + this._canvas = null; + this._fpsCounter = null; + this._loadingSpinner = null; + this._stretchEnabled = this._defaultStretchMode(); + this._app = null; + this._effekseer = null; + this._wasLoading = false; + + /** + * The total frame count of the game screen. + * + * @type number + * @name Graphics.frameCount + */ + this.frameCount = 0; + + /** + * The width of the window display area. + * + * @type number + * @name Graphics.boxWidth + */ + this.boxWidth = this._width; + + /** + * The height of the window display area. + * + * @type number + * @name Graphics.boxHeight + */ + this.boxHeight = this._height; + + this._updateRealScale(); + this._createAllElements(); + this._disableContextMenu(); + this._setupEventHandlers(); + this._createPixiApp(); + this._createEffekseerContext(); + + return !!this._app; +}; + +/** + * The PIXI.Application object. + * + * @readonly + * @type PIXI.Application + * @name Graphics.app + */ +Object.defineProperty(Graphics, "app", { + get: function() { + return this._app; + }, + configurable: true +}); + +/** + * The context object of Effekseer. + * + * @readonly + * @type EffekseerContext + * @name Graphics.effekseer + */ +Object.defineProperty(Graphics, "effekseer", { + get: function() { + return this._effekseer; + }, + configurable: true +}); + +/** + * Register a handler for tick events. + * + * @param {function} handler - The listener function to be added for updates. + */ +Graphics.setTickHandler = function(handler) { + this._tickHandler = handler; +}; + +/** + * Starts the game loop. + */ +Graphics.startGameLoop = function() { + if (this._app) { + this._app.start(); + } +}; + +/** + * Stops the game loop. + */ +Graphics.stopGameLoop = function() { + if (this._app) { + this._app.stop(); + } +}; + +/** + * Sets the stage to be rendered. + * + * @param {Stage} stage - The stage object to be rendered. + */ +Graphics.setStage = function(stage) { + if (this._app) { + this._app.stage = stage; + } +}; + +/** + * Shows the loading spinner. + */ +Graphics.startLoading = function() { + if (!document.getElementById("loadingSpinner")) { + document.body.appendChild(this._loadingSpinner); + } +}; + +/** + * Erases the loading spinner. + * + * @returns {boolean} True if the loading spinner was active. + */ +Graphics.endLoading = function() { + if (document.getElementById("loadingSpinner")) { + document.body.removeChild(this._loadingSpinner); + return true; + } else { + return false; + } +}; + +/** + * Displays the error text to the screen. + * + * @param {string} name - The name of the error. + * @param {string} message - The message of the error. + * @param {Error} [error] - The error object. + */ +Graphics.printError = function(name, message, error = null) { + if (!this._errorPrinter) { + this._createErrorPrinter(); + } + this._errorPrinter.innerHTML = this._makeErrorHtml(name, message, error); + this._wasLoading = this.endLoading(); + this._applyCanvasFilter(); +}; + +/** + * Displays a button to try to reload resources. + * + * @param {function} retry - The callback function to be called when the button + * is pressed. + */ +Graphics.showRetryButton = function(retry) { + const button = document.createElement("button"); + button.id = "retryButton"; + button.innerHTML = "Retry"; + // [Note] stopPropagation() is required for iOS Safari. + button.ontouchstart = e => e.stopPropagation(); + button.onclick = () => { + Graphics.eraseError(); + retry(); + }; + this._errorPrinter.appendChild(button); + button.focus(); +}; + +/** + * Erases the loading error text. + */ +Graphics.eraseError = function() { + if (this._errorPrinter) { + this._errorPrinter.innerHTML = this._makeErrorHtml(); + if (this._wasLoading) { + this.startLoading(); + } + } + this._clearCanvasFilter(); +}; + +/** + * Converts an x coordinate on the page to the corresponding + * x coordinate on the canvas area. + * + * @param {number} x - The x coordinate on the page to be converted. + * @returns {number} The x coordinate on the canvas area. + */ +Graphics.pageToCanvasX = function(x) { + if (this._canvas) { + const left = this._canvas.offsetLeft; + return Math.round((x - left) / this._realScale); + } else { + return 0; + } +}; + +/** + * Converts a y coordinate on the page to the corresponding + * y coordinate on the canvas area. + * + * @param {number} y - The y coordinate on the page to be converted. + * @returns {number} The y coordinate on the canvas area. + */ +Graphics.pageToCanvasY = function(y) { + if (this._canvas) { + const top = this._canvas.offsetTop; + return Math.round((y - top) / this._realScale); + } else { + return 0; + } +}; + +/** + * Checks whether the specified point is inside the game canvas area. + * + * @param {number} x - The x coordinate on the canvas area. + * @param {number} y - The y coordinate on the canvas area. + * @returns {boolean} True if the specified point is inside the game canvas area. + */ +Graphics.isInsideCanvas = function(x, y) { + return x >= 0 && x < this._width && y >= 0 && y < this._height; +}; + +/** + * Shows the game screen. + */ +Graphics.showScreen = function() { + this._canvas.style.opacity = 1; +}; + +/** + * Hides the game screen. + */ +Graphics.hideScreen = function() { + this._canvas.style.opacity = 0; +}; + +/** + * Changes the size of the game screen. + * + * @param {number} width - The width of the game screen. + * @param {number} height - The height of the game screen. + */ +Graphics.resize = function(width, height) { + this._width = width; + this._height = height; + this._app.renderer.resize(width, height); + this._updateAllElements(); +}; + +/** + * The width of the game screen. + * + * @type number + * @name Graphics.width + */ +Object.defineProperty(Graphics, "width", { + get: function() { + return this._width; + }, + set: function(value) { + if (this._width !== value) { + this._width = value; + this._updateAllElements(); + } + }, + configurable: true +}); + +/** + * The height of the game screen. + * + * @type number + * @name Graphics.height + */ +Object.defineProperty(Graphics, "height", { + get: function() { + return this._height; + }, + set: function(value) { + if (this._height !== value) { + this._height = value; + this._updateAllElements(); + } + }, + configurable: true +}); + +/** + * The default zoom scale of the game screen. + * + * @type number + * @name Graphics.defaultScale + */ +Object.defineProperty(Graphics, "defaultScale", { + get: function() { + return this._defaultScale; + }, + set: function(value) { + if (this._defaultScale !== value) { + this._defaultScale = value; + this._updateAllElements(); + } + }, + configurable: true +}); + +Graphics._createAllElements = function() { + this._createErrorPrinter(); + this._createCanvas(); + this._createLoadingSpinner(); + this._createFPSCounter(); +}; + +Graphics._updateAllElements = function() { + this._updateRealScale(); + this._updateErrorPrinter(); + this._updateCanvas(); + this._updateVideo(); +}; + +Graphics._onTick = function(deltaTime) { + this._fpsCounter.startTick(); + if (this._tickHandler) { + this._tickHandler(deltaTime); + } + if (this._canRender()) { + this._app.render(); + } + this._fpsCounter.endTick(); +}; + +Graphics._canRender = function() { + return !!this._app.stage; +}; + +Graphics._updateRealScale = function() { + if (this._stretchEnabled && this._width > 0 && this._height > 0) { + const h = this._stretchWidth() / this._width; + const v = this._stretchHeight() / this._height; + this._realScale = Math.min(h, v); + window.scrollTo(0, 0); + } else { + this._realScale = this._defaultScale; + } +}; + +Graphics._stretchWidth = function() { + if (Utils.isMobileDevice()) { + return document.documentElement.clientWidth; + } else { + return window.innerWidth; + } +}; + +Graphics._stretchHeight = function() { + if (Utils.isMobileDevice()) { + // [Note] Mobile browsers often have special operations at the top and + // bottom of the screen. + const rate = Utils.isLocal() ? 1.0 : 0.9; + return document.documentElement.clientHeight * rate; + } else { + return window.innerHeight; + } +}; + +Graphics._makeErrorHtml = function(name, message /*, error*/) { + const nameDiv = document.createElement("div"); + const messageDiv = document.createElement("div"); + nameDiv.id = "errorName"; + messageDiv.id = "errorMessage"; + nameDiv.innerHTML = Utils.escapeHtml(name || ""); + messageDiv.innerHTML = Utils.escapeHtml(message || ""); + return nameDiv.outerHTML + messageDiv.outerHTML; +}; + +Graphics._defaultStretchMode = function() { + return Utils.isNwjs() || Utils.isMobileDevice(); +}; + +Graphics._createErrorPrinter = function() { + this._errorPrinter = document.createElement("div"); + this._errorPrinter.id = "errorPrinter"; + this._errorPrinter.innerHTML = this._makeErrorHtml(); + document.body.appendChild(this._errorPrinter); +}; + +Graphics._updateErrorPrinter = function() { + const width = this._width * 0.8 * this._realScale; + const height = 100 * this._realScale; + this._errorPrinter.style.width = width + "px"; + this._errorPrinter.style.height = height + "px"; +}; + +Graphics._createCanvas = function() { + this._canvas = document.createElement("canvas"); + this._canvas.id = "gameCanvas"; + this._updateCanvas(); + document.body.appendChild(this._canvas); +}; + +Graphics._updateCanvas = function() { + this._canvas.width = this._width; + this._canvas.height = this._height; + this._canvas.style.zIndex = 1; + this._centerElement(this._canvas); +}; + +Graphics._updateVideo = function() { + const width = this._width * this._realScale; + const height = this._height * this._realScale; + Video.resize(width, height); +}; + +Graphics._createLoadingSpinner = function() { + const loadingSpinner = document.createElement("div"); + const loadingSpinnerImage = document.createElement("div"); + loadingSpinner.id = "loadingSpinner"; + loadingSpinnerImage.id = "loadingSpinnerImage"; + loadingSpinner.appendChild(loadingSpinnerImage); + this._loadingSpinner = loadingSpinner; +}; + +Graphics._createFPSCounter = function() { + this._fpsCounter = new Graphics.FPSCounter(); +}; + +Graphics._centerElement = function(element) { + const width = element.width * this._realScale; + const height = element.height * this._realScale; + element.style.position = "absolute"; + element.style.margin = "auto"; + element.style.top = 0; + element.style.left = 0; + element.style.right = 0; + element.style.bottom = 0; + element.style.width = width + "px"; + element.style.height = height + "px"; +}; + +Graphics._disableContextMenu = function() { + const elements = document.body.getElementsByTagName("*"); + const oncontextmenu = () => false; + for (const element of elements) { + element.oncontextmenu = oncontextmenu; + } +}; + +Graphics._applyCanvasFilter = function() { + if (this._canvas) { + this._canvas.style.opacity = 0.5; + this._canvas.style.filter = "blur(8px)"; + this._canvas.style.webkitFilter = "blur(8px)"; + } +}; + +Graphics._clearCanvasFilter = function() { + if (this._canvas) { + this._canvas.style.opacity = 1; + this._canvas.style.filter = ""; + this._canvas.style.webkitFilter = ""; + } +}; + +Graphics._setupEventHandlers = function() { + window.addEventListener("resize", this._onWindowResize.bind(this)); + document.addEventListener("keydown", this._onKeyDown.bind(this)); +}; + +Graphics._onWindowResize = function() { + this._updateAllElements(); +}; + +Graphics._onKeyDown = function(event) { + if (!event.ctrlKey && !event.altKey) { + switch (event.keyCode) { + case 113: // F2 + event.preventDefault(); + this._switchFPSCounter(); + break; + case 114: // F3 + event.preventDefault(); + this._switchStretchMode(); + break; + case 115: // F4 + event.preventDefault(); + this._switchFullScreen(); + break; + } + } +}; + +Graphics._switchFPSCounter = function() { + this._fpsCounter.switchMode(); +}; + +Graphics._switchStretchMode = function() { + this._stretchEnabled = !this._stretchEnabled; + this._updateAllElements(); +}; + +Graphics._switchFullScreen = function() { + if (this._isFullScreen()) { + this._cancelFullScreen(); + } else { + this._requestFullScreen(); + } +}; + +Graphics._isFullScreen = function() { + return ( + document.fullScreenElement || + document.mozFullScreen || + document.webkitFullscreenElement + ); +}; + +Graphics._requestFullScreen = function() { + const element = document.body; + if (element.requestFullScreen) { + element.requestFullScreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullScreen) { + element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); + } +}; + +Graphics._cancelFullScreen = function() { + if (document.cancelFullScreen) { + document.cancelFullScreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } +}; + +Graphics._createPixiApp = function() { + try { + this._setupPixi(); + this._app = new PIXI.Application({ + view: this._canvas, + autoStart: false + }); + this._app.ticker.remove(this._app.render, this._app); + this._app.ticker.add(this._onTick, this); + } catch (e) { + this._app = null; + } +}; + +Graphics._setupPixi = function() { + PIXI.utils.skipHello(); + PIXI.settings.GC_MAX_IDLE = 600; +}; + +Graphics._createEffekseerContext = function() { + if (this._app && window.effekseer) { + try { + this._effekseer = effekseer.createContext(); + if (this._effekseer) { + this._effekseer.init(this._app.renderer.gl); + this._effekseer.setRestorationOfStatesFlag(false); + } + } catch (e) { + this._app = null; + } + } +}; + +//::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// FPSCounter +// +// This is based on Darsain's FPSMeter which is under the MIT license. +// The original can be found at https://github.com/Darsain/fpsmeter. + +Graphics.FPSCounter = function() { + this.initialize(...arguments); +}; + +Graphics.FPSCounter.prototype.initialize = function() { + this._tickCount = 0; + this._frameTime = 100; + this._frameStart = 0; + this._lastLoop = performance.now() - 100; + this._showFps = true; + this.fps = 0; + this.duration = 0; + this._createElements(); + this._update(); +}; + +Graphics.FPSCounter.prototype.startTick = function() { + this._frameStart = performance.now(); +}; + +Graphics.FPSCounter.prototype.endTick = function() { + const time = performance.now(); + const thisFrameTime = time - this._lastLoop; + this._frameTime += (thisFrameTime - this._frameTime) / 12; + this.fps = 1000 / this._frameTime; + this.duration = Math.max(0, time - this._frameStart); + this._lastLoop = time; + if (this._tickCount++ % 15 === 0) { + this._update(); + } +}; + +Graphics.FPSCounter.prototype.switchMode = function() { + if (this._boxDiv.style.display === "none") { + this._boxDiv.style.display = "block"; + this._showFps = true; + } else if (this._showFps) { + this._showFps = false; + } else { + this._boxDiv.style.display = "none"; + } + this._update(); +}; + +Graphics.FPSCounter.prototype._createElements = function() { + this._boxDiv = document.createElement("div"); + this._labelDiv = document.createElement("div"); + this._numberDiv = document.createElement("div"); + this._boxDiv.id = "fpsCounterBox"; + this._labelDiv.id = "fpsCounterLabel"; + this._numberDiv.id = "fpsCounterNumber"; + this._boxDiv.style.display = "none"; + this._boxDiv.appendChild(this._labelDiv); + this._boxDiv.appendChild(this._numberDiv); + document.body.appendChild(this._boxDiv); +}; + +Graphics.FPSCounter.prototype._update = function() { + const count = this._showFps ? this.fps : this.duration; + this._labelDiv.textContent = this._showFps ? "FPS" : "ms"; + this._numberDiv.textContent = count.toFixed(0); +}; + +//----------------------------------------------------------------------------- +/** + * The point class. + * + * @class + * @extends PIXI.Point + * @param {number} x - The x coordinate. + * @param {number} y - The y coordinate. + */ +function Point() { + this.initialize(...arguments); +} + +Point.prototype = Object.create(PIXI.Point.prototype); +Point.prototype.constructor = Point; + +Point.prototype.initialize = function(x, y) { + PIXI.Point.call(this, x, y); +}; + +//----------------------------------------------------------------------------- +/** + * The rectangle class. + * + * @class + * @extends PIXI.Rectangle + * @param {number} x - The x coordinate for the upper-left corner. + * @param {number} y - The y coordinate for the upper-left corner. + * @param {number} width - The width of the rectangle. + * @param {number} height - The height of the rectangle. + */ +function Rectangle() { + this.initialize(...arguments); +} + +Rectangle.prototype = Object.create(PIXI.Rectangle.prototype); +Rectangle.prototype.constructor = Rectangle; + +Rectangle.prototype.initialize = function(x, y, width, height) { + PIXI.Rectangle.call(this, x, y, width, height); +}; + +//----------------------------------------------------------------------------- +/** + * The basic object that represents an image. + * + * @class + * @param {number} width - The width of the bitmap. + * @param {number} height - The height of the bitmap. + */ +function Bitmap() { + this.initialize(...arguments); +} + +Bitmap.prototype.initialize = function(width, height) { + this._canvas = null; + this._context = null; + this._baseTexture = null; + this._image = null; + this._url = ""; + this._paintOpacity = 255; + this._smooth = true; + this._loadListeners = []; + + // "none", "loading", "loaded", or "error" + this._loadingState = "none"; + + if (width > 0 && height > 0) { + this._createCanvas(width, height); + } + + /** + * The face name of the font. + * + * @type string + */ + this.fontFace = "sans-serif"; + + /** + * The size of the font in pixels. + * + * @type number + */ + this.fontSize = 16; + + /** + * Whether the font is bold. + * + * @type boolean + */ + this.fontBold = false; + + /** + * Whether the font is italic. + * + * @type boolean + */ + this.fontItalic = false; + + /** + * The color of the text in CSS format. + * + * @type string + */ + this.textColor = "#ffffff"; + + /** + * The color of the outline of the text in CSS format. + * + * @type string + */ + this.outlineColor = "rgba(0, 0, 0, 0.5)"; + + /** + * The width of the outline of the text. + * + * @type number + */ + this.outlineWidth = 3; +}; + +/** + * Loads a image file. + * + * @param {string} url - The image url of the texture. + * @returns {Bitmap} The new bitmap object. + */ +Bitmap.load = function(url) { + const bitmap = Object.create(Bitmap.prototype); + bitmap.initialize(); + bitmap._url = url; + bitmap._startLoading(); + return bitmap; +}; + +/** + * Takes a snapshot of the game screen. + * + * @param {Stage} stage - The stage object. + * @returns {Bitmap} The new bitmap object. + */ +Bitmap.snap = function(stage) { + const width = Graphics.width; + const height = Graphics.height; + const bitmap = new Bitmap(width, height); + const renderTexture = PIXI.RenderTexture.create(width, height); + if (stage) { + const renderer = Graphics.app.renderer; + renderer.render(stage, renderTexture); + stage.worldTransform.identity(); + const canvas = renderer.extract.canvas(renderTexture); + bitmap.context.drawImage(canvas, 0, 0); + canvas.width = 0; + canvas.height = 0; + } + renderTexture.destroy({ destroyBase: true }); + bitmap.baseTexture.update(); + return bitmap; +}; + +/** + * Checks whether the bitmap is ready to render. + * + * @returns {boolean} True if the bitmap is ready to render. + */ +Bitmap.prototype.isReady = function() { + return this._loadingState === "loaded" || this._loadingState === "none"; +}; + +/** + * Checks whether a loading error has occurred. + * + * @returns {boolean} True if a loading error has occurred. + */ +Bitmap.prototype.isError = function() { + return this._loadingState === "error"; +}; + +/** + * The url of the image file. + * + * @readonly + * @type string + * @name Bitmap#url + */ +Object.defineProperty(Bitmap.prototype, "url", { + get: function() { + return this._url; + }, + configurable: true +}); + +/** + * The base texture that holds the image. + * + * @readonly + * @type PIXI.BaseTexture + * @name Bitmap#baseTexture + */ +Object.defineProperty(Bitmap.prototype, "baseTexture", { + get: function() { + return this._baseTexture; + }, + configurable: true +}); + +/** + * The bitmap image. + * + * @readonly + * @type HTMLImageElement + * @name Bitmap#image + */ +Object.defineProperty(Bitmap.prototype, "image", { + get: function() { + return this._image; + }, + configurable: true +}); + +/** + * The bitmap canvas. + * + * @readonly + * @type HTMLCanvasElement + * @name Bitmap#canvas + */ +Object.defineProperty(Bitmap.prototype, "canvas", { + get: function() { + this._ensureCanvas(); + return this._canvas; + }, + configurable: true +}); + +/** + * The 2d context of the bitmap canvas. + * + * @readonly + * @type CanvasRenderingContext2D + * @name Bitmap#context + */ +Object.defineProperty(Bitmap.prototype, "context", { + get: function() { + this._ensureCanvas(); + return this._context; + }, + configurable: true +}); + +/** + * The width of the bitmap. + * + * @readonly + * @type number + * @name Bitmap#width + */ +Object.defineProperty(Bitmap.prototype, "width", { + get: function() { + const image = this._canvas || this._image; + return image ? image.width : 0; + }, + configurable: true +}); + +/** + * The height of the bitmap. + * + * @readonly + * @type number + * @name Bitmap#height + */ +Object.defineProperty(Bitmap.prototype, "height", { + get: function() { + const image = this._canvas || this._image; + return image ? image.height : 0; + }, + configurable: true +}); + +/** + * The rectangle of the bitmap. + * + * @readonly + * @type Rectangle + * @name Bitmap#rect + */ +Object.defineProperty(Bitmap.prototype, "rect", { + get: function() { + return new Rectangle(0, 0, this.width, this.height); + }, + configurable: true +}); + +/** + * Whether the smooth scaling is applied. + * + * @type boolean + * @name Bitmap#smooth + */ +Object.defineProperty(Bitmap.prototype, "smooth", { + get: function() { + return this._smooth; + }, + set: function(value) { + if (this._smooth !== value) { + this._smooth = value; + this._updateScaleMode(); + } + }, + configurable: true +}); + +/** + * The opacity of the drawing object in the range (0, 255). + * + * @type number + * @name Bitmap#paintOpacity + */ +Object.defineProperty(Bitmap.prototype, "paintOpacity", { + get: function() { + return this._paintOpacity; + }, + set: function(value) { + if (this._paintOpacity !== value) { + this._paintOpacity = value; + this.context.globalAlpha = this._paintOpacity / 255; + } + }, + configurable: true +}); + +/** + * Destroys the bitmap. + */ +Bitmap.prototype.destroy = function() { + if (this._baseTexture) { + this._baseTexture.destroy(); + this._baseTexture = null; + } + this._destroyCanvas(); +}; + +/** + * Resizes the bitmap. + * + * @param {number} width - The new width of the bitmap. + * @param {number} height - The new height of the bitmap. + */ +Bitmap.prototype.resize = function(width, height) { + width = Math.max(width || 0, 1); + height = Math.max(height || 0, 1); + this.canvas.width = width; + this.canvas.height = height; + this.baseTexture.width = width; + this.baseTexture.height = height; +}; + +/** + * Performs a block transfer. + * + * @param {Bitmap} source - The bitmap to draw. + * @param {number} sx - The x coordinate in the source. + * @param {number} sy - The y coordinate in the source. + * @param {number} sw - The width of the source image. + * @param {number} sh - The height of the source image. + * @param {number} dx - The x coordinate in the destination. + * @param {number} dy - The y coordinate in the destination. + * @param {number} [dw=sw] The width to draw the image in the destination. + * @param {number} [dh=sh] The height to draw the image in the destination. + */ +Bitmap.prototype.blt = function(source, sx, sy, sw, sh, dx, dy, dw, dh) { + dw = dw || sw; + dh = dh || sh; + try { + const image = source._canvas || source._image; + this.context.globalCompositeOperation = "source-over"; + this.context.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh); + this._baseTexture.update(); + } catch (e) { + // + } +}; + +/** + * Returns pixel color at the specified point. + * + * @param {number} x - The x coordinate of the pixel in the bitmap. + * @param {number} y - The y coordinate of the pixel in the bitmap. + * @returns {string} The pixel color (hex format). + */ +Bitmap.prototype.getPixel = function(x, y) { + const data = this.context.getImageData(x, y, 1, 1).data; + let result = "#"; + for (let i = 0; i < 3; i++) { + result += data[i].toString(16).padZero(2); + } + return result; +}; + +/** + * Returns alpha pixel value at the specified point. + * + * @param {number} x - The x coordinate of the pixel in the bitmap. + * @param {number} y - The y coordinate of the pixel in the bitmap. + * @returns {string} The alpha value. + */ +Bitmap.prototype.getAlphaPixel = function(x, y) { + const data = this.context.getImageData(x, y, 1, 1).data; + return data[3]; +}; + +/** + * Clears the specified rectangle. + * + * @param {number} x - The x coordinate for the upper-left corner. + * @param {number} y - The y coordinate for the upper-left corner. + * @param {number} width - The width of the rectangle to clear. + * @param {number} height - The height of the rectangle to clear. + */ +Bitmap.prototype.clearRect = function(x, y, width, height) { + this.context.clearRect(x, y, width, height); + this._baseTexture.update(); +}; + +/** + * Clears the entire bitmap. + */ +Bitmap.prototype.clear = function() { + this.clearRect(0, 0, this.width, this.height); +}; + +/** + * Fills the specified rectangle. + * + * @param {number} x - The x coordinate for the upper-left corner. + * @param {number} y - The y coordinate for the upper-left corner. + * @param {number} width - The width of the rectangle to fill. + * @param {number} height - The height of the rectangle to fill. + * @param {string} color - The color of the rectangle in CSS format. + */ +Bitmap.prototype.fillRect = function(x, y, width, height, color) { + const context = this.context; + context.save(); + context.fillStyle = color; + context.fillRect(x, y, width, height); + context.restore(); + this._baseTexture.update(); +}; + +/** + * Fills the entire bitmap. + * + * @param {string} color - The color of the rectangle in CSS format. + */ +Bitmap.prototype.fillAll = function(color) { + this.fillRect(0, 0, this.width, this.height, color); +}; + +/** + * Draws the specified rectangular frame. + * + * @param {number} x - The x coordinate for the upper-left corner. + * @param {number} y - The y coordinate for the upper-left corner. + * @param {number} width - The width of the rectangle to fill. + * @param {number} height - The height of the rectangle to fill. + * @param {string} color - The color of the rectangle in CSS format. + */ +Bitmap.prototype.strokeRect = function(x, y, width, height, color) { + const context = this.context; + context.save(); + context.strokeStyle = color; + context.strokeRect(x, y, width, height); + context.restore(); + this._baseTexture.update(); +}; + +// prettier-ignore +/** + * Draws the rectangle with a gradation. + * + * @param {number} x - The x coordinate for the upper-left corner. + * @param {number} y - The y coordinate for the upper-left corner. + * @param {number} width - The width of the rectangle to fill. + * @param {number} height - The height of the rectangle to fill. + * @param {string} color1 - The gradient starting color. + * @param {string} color2 - The gradient ending color. + * @param {boolean} vertical - Whether the gradient should be draw as vertical or not. + */ +Bitmap.prototype.gradientFillRect = function( + x, y, width, height, color1, color2, vertical +) { + const context = this.context; + const x1 = vertical ? x : x + width; + const y1 = vertical ? y + height : y; + const grad = context.createLinearGradient(x, y, x1, y1); + grad.addColorStop(0, color1); + grad.addColorStop(1, color2); + context.save(); + context.fillStyle = grad; + context.fillRect(x, y, width, height); + context.restore(); + this._baseTexture.update(); +}; + +/** + * Draws a bitmap in the shape of a circle. + * + * @param {number} x - The x coordinate based on the circle center. + * @param {number} y - The y coordinate based on the circle center. + * @param {number} radius - The radius of the circle. + * @param {string} color - The color of the circle in CSS format. + */ +Bitmap.prototype.drawCircle = function(x, y, radius, color) { + const context = this.context; + context.save(); + context.fillStyle = color; + context.beginPath(); + context.arc(x, y, radius, 0, Math.PI * 2, false); + context.fill(); + context.restore(); + this._baseTexture.update(); +}; + +/** + * Draws the outline text to the bitmap. + * + * @param {string} text - The text that will be drawn. + * @param {number} x - The x coordinate for the left of the text. + * @param {number} y - The y coordinate for the top of the text. + * @param {number} maxWidth - The maximum allowed width of the text. + * @param {number} lineHeight - The height of the text line. + * @param {string} align - The alignment of the text. + */ +Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) { + // [Note] Different browser makes different rendering with + // textBaseline == 'top'. So we use 'alphabetic' here. + const context = this.context; + const alpha = context.globalAlpha; + maxWidth = maxWidth || 0xffffffff; + let tx = x; + let ty = Math.round(y + lineHeight / 2 + this.fontSize * 0.35); + if (align === "center") { + tx += maxWidth / 2; + } + if (align === "right") { + tx += maxWidth; + } + context.save(); + context.font = this._makeFontNameText(); + context.textAlign = align; + context.textBaseline = "alphabetic"; + context.globalAlpha = 1; + this._drawTextOutline(text, tx, ty, maxWidth); + context.globalAlpha = alpha; + this._drawTextBody(text, tx, ty, maxWidth); + context.restore(); + this._baseTexture.update(); +}; + +/** + * Returns the width of the specified text. + * + * @param {string} text - The text to be measured. + * @returns {number} The width of the text in pixels. + */ +Bitmap.prototype.measureTextWidth = function(text) { + const context = this.context; + context.save(); + context.font = this._makeFontNameText(); + const width = context.measureText(text).width; + context.restore(); + return width; +}; + +/** + * Adds a callback function that will be called when the bitmap is loaded. + * + * @param {function} listner - The callback function. + */ +Bitmap.prototype.addLoadListener = function(listner) { + if (!this.isReady()) { + this._loadListeners.push(listner); + } else { + listner(this); + } +}; + +/** + * Tries to load the image again. + */ +Bitmap.prototype.retry = function() { + this._startLoading(); +}; + +Bitmap.prototype._makeFontNameText = function() { + const italic = this.fontItalic ? "Italic " : ""; + const bold = this.fontBold ? "Bold " : ""; + return italic + bold + this.fontSize + "px " + this.fontFace; +}; + +Bitmap.prototype._drawTextOutline = function(text, tx, ty, maxWidth) { + const context = this.context; + context.strokeStyle = this.outlineColor; + context.lineWidth = this.outlineWidth; + context.lineJoin = "round"; + context.strokeText(text, tx, ty, maxWidth); +}; + +Bitmap.prototype._drawTextBody = function(text, tx, ty, maxWidth) { + const context = this.context; + context.fillStyle = this.textColor; + context.fillText(text, tx, ty, maxWidth); +}; + +Bitmap.prototype._createCanvas = function(width, height) { + this._canvas = document.createElement("canvas"); + this._context = this._canvas.getContext("2d"); + this._canvas.width = width; + this._canvas.height = height; + this._createBaseTexture(this._canvas); +}; + +Bitmap.prototype._ensureCanvas = function() { + if (!this._canvas) { + if (this._image) { + this._createCanvas(this._image.width, this._image.height); + this._context.drawImage(this._image, 0, 0); + } else { + this._createCanvas(0, 0); + } + } +}; + +Bitmap.prototype._destroyCanvas = function() { + if (this._canvas) { + this._canvas.width = 0; + this._canvas.height = 0; + this._canvas = null; + } +}; + +Bitmap.prototype._createBaseTexture = function(source) { + this._baseTexture = new PIXI.BaseTexture(source); + this._baseTexture.mipmap = false; + this._baseTexture.width = source.width; + this._baseTexture.height = source.height; + this._updateScaleMode(); +}; + +Bitmap.prototype._updateScaleMode = function() { + if (this._baseTexture) { + if (this._smooth) { + this._baseTexture.scaleMode = PIXI.SCALE_MODES.LINEAR; + } else { + this._baseTexture.scaleMode = PIXI.SCALE_MODES.NEAREST; + } + } +}; + +Bitmap.prototype._startLoading = function() { + this._image = new Image(); + this._image.onload = this._onLoad.bind(this); + this._image.onerror = this._onError.bind(this); + this._destroyCanvas(); + this._loadingState = "loading"; + if (Utils.hasEncryptedImages()) { + this._startDecrypting(); + } else { + this._image.src = this._url; + if (this._image.width > 0) { + this._image.onload = null; + this._onLoad(); + } + } +}; + +Bitmap.prototype._startDecrypting = function() { + const xhr = new XMLHttpRequest(); + xhr.open("GET", this._url + "_"); + xhr.responseType = "arraybuffer"; + xhr.onload = () => this._onXhrLoad(xhr); + xhr.onerror = this._onError.bind(this); + xhr.send(); +}; + +Bitmap.prototype._onXhrLoad = function(xhr) { + if (xhr.status < 400) { + const arrayBuffer = Utils.decryptArrayBuffer(xhr.response); + const blob = new Blob([arrayBuffer]); + this._image.src = URL.createObjectURL(blob); + } else { + this._onError(); + } +}; + +Bitmap.prototype._onLoad = function() { + if (Utils.hasEncryptedImages()) { + URL.revokeObjectURL(this._image.src); + } + this._loadingState = "loaded"; + this._createBaseTexture(this._image); + this._callLoadListeners(); +}; + +Bitmap.prototype._callLoadListeners = function() { + while (this._loadListeners.length > 0) { + const listener = this._loadListeners.shift(); + listener(this); + } +}; + +Bitmap.prototype._onError = function() { + this._loadingState = "error"; +}; + +//----------------------------------------------------------------------------- +/** + * The basic object that is rendered to the game screen. + * + * @class + * @extends PIXI.Sprite + * @param {Bitmap} bitmap - The image for the sprite. + */ +function Sprite() { + this.initialize(...arguments); +} + +Sprite.prototype = Object.create(PIXI.Sprite.prototype); +Sprite.prototype.constructor = Sprite; + +Sprite.prototype.initialize = function(bitmap) { + if (!Sprite._emptyBaseTexture) { + Sprite._emptyBaseTexture = new PIXI.BaseTexture(); + Sprite._emptyBaseTexture.setSize(1, 1); + } + const frame = new Rectangle(); + const texture = new PIXI.Texture(Sprite._emptyBaseTexture, frame); + PIXI.Sprite.call(this, texture); + this.spriteId = Sprite._counter++; + this._bitmap = bitmap; + this._frame = frame; + this._hue = 0; + this._blendColor = [0, 0, 0, 0]; + this._colorTone = [0, 0, 0, 0]; + this._colorFilter = null; + this._blendMode = PIXI.BLEND_MODES.NORMAL; + this._hidden = false; + this._onBitmapChange(); +}; + +Sprite._emptyBaseTexture = null; +Sprite._counter = 0; + +/** + * The image for the sprite. + * + * @type Bitmap + * @name Sprite#bitmap + */ +Object.defineProperty(Sprite.prototype, "bitmap", { + get: function() { + return this._bitmap; + }, + set: function(value) { + if (this._bitmap !== value) { + this._bitmap = value; + this._onBitmapChange(); + } + }, + configurable: true +}); + +/** + * The width of the sprite without the scale. + * + * @type number + * @name Sprite#width + */ +Object.defineProperty(Sprite.prototype, "width", { + get: function() { + return this._frame.width; + }, + set: function(value) { + this._frame.width = value; + this._refresh(); + }, + configurable: true +}); + +/** + * The height of the sprite without the scale. + * + * @type number + * @name Sprite#height + */ +Object.defineProperty(Sprite.prototype, "height", { + get: function() { + return this._frame.height; + }, + set: function(value) { + this._frame.height = value; + this._refresh(); + }, + configurable: true +}); + +/** + * The opacity of the sprite (0 to 255). + * + * @type number + * @name Sprite#opacity + */ +Object.defineProperty(Sprite.prototype, "opacity", { + get: function() { + return this.alpha * 255; + }, + set: function(value) { + this.alpha = value.clamp(0, 255) / 255; + }, + configurable: true +}); + +/** + * The blend mode to be applied to the sprite. + * + * @type number + * @name Sprite#blendMode + */ +Object.defineProperty(Sprite.prototype, "blendMode", { + get: function() { + if (this._colorFilter) { + return this._colorFilter.blendMode; + } else { + return this._blendMode; + } + }, + set: function(value) { + this._blendMode = value; + if (this._colorFilter) { + this._colorFilter.blendMode = value; + } + }, + configurable: true +}); + +/** + * Destroys the sprite. + */ +Sprite.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Sprite.prototype.destroy.call(this, options); +}; + +/** + * Updates the sprite for each frame. + */ +Sprite.prototype.update = function() { + for (const child of this.children) { + if (child.update) { + child.update(); + } + } +}; + +/** + * Makes the sprite "hidden". + */ +Sprite.prototype.hide = function() { + this._hidden = true; + this.updateVisibility(); +}; + +/** + * Releases the "hidden" state of the sprite. + */ +Sprite.prototype.show = function() { + this._hidden = false; + this.updateVisibility(); +}; + +/** + * Reflects the "hidden" state of the sprite to the visible state. + */ +Sprite.prototype.updateVisibility = function() { + this.visible = !this._hidden; +}; + +/** + * Sets the x and y at once. + * + * @param {number} x - The x coordinate of the sprite. + * @param {number} y - The y coordinate of the sprite. + */ +Sprite.prototype.move = function(x, y) { + this.x = x; + this.y = y; +}; + +/** + * Sets the rectagle of the bitmap that the sprite displays. + * + * @param {number} x - The x coordinate of the frame. + * @param {number} y - The y coordinate of the frame. + * @param {number} width - The width of the frame. + * @param {number} height - The height of the frame. + */ +Sprite.prototype.setFrame = function(x, y, width, height) { + this._refreshFrame = false; + const frame = this._frame; + if ( + x !== frame.x || + y !== frame.y || + width !== frame.width || + height !== frame.height + ) { + frame.x = x; + frame.y = y; + frame.width = width; + frame.height = height; + this._refresh(); + } +}; + +/** + * Sets the hue rotation value. + * + * @param {number} hue - The hue value (-360, 360). + */ +Sprite.prototype.setHue = function(hue) { + if (this._hue !== Number(hue)) { + this._hue = Number(hue); + this._updateColorFilter(); + } +}; + +/** + * Gets the blend color for the sprite. + * + * @returns {array} The blend color [r, g, b, a]. + */ +Sprite.prototype.getBlendColor = function() { + return this._blendColor.clone(); +}; + +/** + * Sets the blend color for the sprite. + * + * @param {array} color - The blend color [r, g, b, a]. + */ +Sprite.prototype.setBlendColor = function(color) { + if (!(color instanceof Array)) { + throw new Error("Argument must be an array"); + } + if (!this._blendColor.equals(color)) { + this._blendColor = color.clone(); + this._updateColorFilter(); + } +}; + +/** + * Gets the color tone for the sprite. + * + * @returns {array} The color tone [r, g, b, gray]. + */ +Sprite.prototype.getColorTone = function() { + return this._colorTone.clone(); +}; + +/** + * Sets the color tone for the sprite. + * + * @param {array} tone - The color tone [r, g, b, gray]. + */ +Sprite.prototype.setColorTone = function(tone) { + if (!(tone instanceof Array)) { + throw new Error("Argument must be an array"); + } + if (!this._colorTone.equals(tone)) { + this._colorTone = tone.clone(); + this._updateColorFilter(); + } +}; + +Sprite.prototype._onBitmapChange = function() { + if (this._bitmap) { + this._refreshFrame = true; + this._bitmap.addLoadListener(this._onBitmapLoad.bind(this)); + } else { + this._refreshFrame = false; + this.texture.frame = new Rectangle(); + } +}; + +Sprite.prototype._onBitmapLoad = function(bitmapLoaded) { + if (bitmapLoaded === this._bitmap) { + if (this._refreshFrame && this._bitmap) { + this._refreshFrame = false; + this._frame.width = this._bitmap.width; + this._frame.height = this._bitmap.height; + } + } + this._refresh(); +}; + +Sprite.prototype._refresh = function() { + const texture = this.texture; + const frameX = Math.floor(this._frame.x); + const frameY = Math.floor(this._frame.y); + const frameW = Math.floor(this._frame.width); + const frameH = Math.floor(this._frame.height); + const baseTexture = this._bitmap ? this._bitmap.baseTexture : null; + const baseTextureW = baseTexture ? baseTexture.width : 0; + const baseTextureH = baseTexture ? baseTexture.height : 0; + const realX = frameX.clamp(0, baseTextureW); + const realY = frameY.clamp(0, baseTextureH); + const realW = (frameW - realX + frameX).clamp(0, baseTextureW - realX); + const realH = (frameH - realY + frameY).clamp(0, baseTextureH - realY); + const frame = new Rectangle(realX, realY, realW, realH); + if (texture) { + this.pivot.x = frameX - realX; + this.pivot.y = frameY - realY; + if (baseTexture) { + texture.baseTexture = baseTexture; + try { + texture.frame = frame; + } catch (e) { + texture.frame = new Rectangle(); + } + } + texture._updateID++; + } +}; + +Sprite.prototype._createColorFilter = function() { + this._colorFilter = new ColorFilter(); + if (!this.filters) { + this.filters = []; + } + this.filters.push(this._colorFilter); +}; + +Sprite.prototype._updateColorFilter = function() { + if (!this._colorFilter) { + this._createColorFilter(); + } + this._colorFilter.setHue(this._hue); + this._colorFilter.setBlendColor(this._blendColor); + this._colorFilter.setColorTone(this._colorTone); +}; + +//----------------------------------------------------------------------------- +/** + * The tilemap which displays 2D tile-based game map. + * + * @class + * @extends PIXI.Container + */ +function Tilemap() { + this.initialize(...arguments); +} + +Tilemap.prototype = Object.create(PIXI.Container.prototype); +Tilemap.prototype.constructor = Tilemap; + +Tilemap.prototype.initialize = function() { + PIXI.Container.call(this); + + this._width = Graphics.width; + this._height = Graphics.height; + this._margin = 20; + this._mapWidth = 0; + this._mapHeight = 0; + this._mapData = null; + this._bitmaps = []; + + /** + * The width of each tile. + * + * @type number + */ + this.tileWidth = 48; + + /** + * The height of each tile. + * + * @type number + */ + this.tileHeight = 48; + + /** + * The origin point of the tilemap for scrolling. + * + * @type Point + */ + this.origin = new Point(); + + /** + * The tileset flags. + * + * @type array + */ + this.flags = []; + + /** + * The animation count for autotiles. + * + * @type number + */ + this.animationCount = 0; + + /** + * Whether the tilemap loops horizontal. + * + * @type boolean + */ + this.horizontalWrap = false; + + /** + * Whether the tilemap loops vertical. + * + * @type boolean + */ + this.verticalWrap = false; + + this._createLayers(); + this.refresh(); +}; + +/** + * The width of the tilemap. + * + * @type number + * @name Tilemap#width + */ +Object.defineProperty(Tilemap.prototype, "width", { + get: function() { + return this._width; + }, + set: function(value) { + this._width = value; + }, + configurable: true +}); + +/** + * The height of the tilemap. + * + * @type number + * @name Tilemap#height + */ +Object.defineProperty(Tilemap.prototype, "height", { + get: function() { + return this._height; + }, + set: function(value) { + this._height = value; + }, + configurable: true +}); + +/** + * Destroys the tilemap. + */ +Tilemap.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Container.prototype.destroy.call(this, options); +}; + +/** + * Sets the tilemap data. + * + * @param {number} width - The width of the map in number of tiles. + * @param {number} height - The height of the map in number of tiles. + * @param {array} data - The one dimensional array for the map data. + */ +Tilemap.prototype.setData = function(width, height, data) { + this._mapWidth = width; + this._mapHeight = height; + this._mapData = data; +}; + +/** + * Checks whether the tileset is ready to render. + * + * @type boolean + * @returns {boolean} True if the tilemap is ready. + */ +Tilemap.prototype.isReady = function() { + for (const bitmap of this._bitmaps) { + if (bitmap && !bitmap.isReady()) { + return false; + } + } + return true; +}; + +/** + * Updates the tilemap for each frame. + */ +Tilemap.prototype.update = function() { + this.animationCount++; + this.animationFrame = Math.floor(this.animationCount / 30); + for (const child of this.children) { + if (child.update) { + child.update(); + } + } +}; + +/** + * Sets the bitmaps used as a tileset. + * + * @param {array} bitmaps - The array of the tileset bitmaps. + */ +Tilemap.prototype.setBitmaps = function(bitmaps) { + // [Note] We wait for the images to finish loading. Creating textures + // from bitmaps that are not yet loaded here brings some maintenance + // difficulties. e.g. PIXI overwrites img.onload internally. + this._bitmaps = bitmaps; + const listener = this._updateBitmaps.bind(this); + for (const bitmap of this._bitmaps) { + if (!bitmap.isReady()) { + bitmap.addLoadListener(listener); + } + } + this._needsBitmapsUpdate = true; + this._updateBitmaps(); +}; + +/** + * Forces to repaint the entire tilemap. + */ +Tilemap.prototype.refresh = function() { + this._needsRepaint = true; +}; + +/** + * Updates the transform on all children of this container for rendering. + */ +Tilemap.prototype.updateTransform = function() { + const ox = Math.ceil(this.origin.x); + const oy = Math.ceil(this.origin.y); + const startX = Math.floor((ox - this._margin) / this.tileWidth); + const startY = Math.floor((oy - this._margin) / this.tileHeight); + this._lowerLayer.x = startX * this.tileWidth - ox; + this._lowerLayer.y = startY * this.tileHeight - oy; + this._upperLayer.x = startX * this.tileWidth - ox; + this._upperLayer.y = startY * this.tileHeight - oy; + if ( + this._needsRepaint || + this._lastAnimationFrame !== this.animationFrame || + this._lastStartX !== startX || + this._lastStartY !== startY + ) { + this._lastAnimationFrame = this.animationFrame; + this._lastStartX = startX; + this._lastStartY = startY; + this._addAllSpots(startX, startY); + this._needsRepaint = false; + } + this._sortChildren(); + PIXI.Container.prototype.updateTransform.call(this); +}; + +Tilemap.prototype._createLayers = function() { + /* + * [Z coordinate] + * 0 : Lower tiles + * 1 : Lower characters + * 3 : Normal characters + * 4 : Upper tiles + * 5 : Upper characters + * 6 : Airship shadow + * 7 : Balloon + * 8 : Animation + * 9 : Destination + */ + this._lowerLayer = new Tilemap.CombinedLayer(); + this._lowerLayer.z = 0; + this._upperLayer = new Tilemap.CombinedLayer(); + this._upperLayer.z = 4; + this.addChild(this._lowerLayer); + this.addChild(this._upperLayer); + this._needsRepaint = true; +}; + +Tilemap.prototype._updateBitmaps = function() { + if (this._needsBitmapsUpdate && this.isReady()) { + this._lowerLayer.setBitmaps(this._bitmaps); + this._needsBitmapsUpdate = false; + this._needsRepaint = true; + } +}; + +Tilemap.prototype._addAllSpots = function(startX, startY) { + this._lowerLayer.clear(); + this._upperLayer.clear(); + const widthWithMatgin = this.width + this._margin * 2; + const heightWithMatgin = this.height + this._margin * 2; + const tileCols = Math.ceil(widthWithMatgin / this.tileWidth) + 1; + const tileRows = Math.ceil(heightWithMatgin / this.tileHeight) + 1; + for (let y = 0; y < tileRows; y++) { + for (let x = 0; x < tileCols; x++) { + this._addSpot(startX, startY, x, y); + } + } +}; + +Tilemap.prototype._addSpot = function(startX, startY, x, y) { + const mx = startX + x; + const my = startY + y; + const dx = x * this.tileWidth; + const dy = y * this.tileHeight; + const tileId0 = this._readMapData(mx, my, 0); + const tileId1 = this._readMapData(mx, my, 1); + const tileId2 = this._readMapData(mx, my, 2); + const tileId3 = this._readMapData(mx, my, 3); + const shadowBits = this._readMapData(mx, my, 4); + const upperTileId1 = this._readMapData(mx, my - 1, 1); + + this._addSpotTile(tileId0, dx, dy); + this._addSpotTile(tileId1, dx, dy); + this._addShadow(this._lowerLayer, shadowBits, dx, dy); + if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) { + if (!Tilemap.isShadowingTile(tileId0)) { + this._addTableEdge(this._lowerLayer, upperTileId1, dx, dy); + } + } + if (this._isOverpassPosition(mx, my)) { + this._addTile(this._upperLayer, tileId2, dx, dy); + this._addTile(this._upperLayer, tileId3, dx, dy); + } else { + this._addSpotTile(tileId2, dx, dy); + this._addSpotTile(tileId3, dx, dy); + } +}; + +Tilemap.prototype._addSpotTile = function(tileId, dx, dy) { + if (this._isHigherTile(tileId)) { + this._addTile(this._upperLayer, tileId, dx, dy); + } else { + this._addTile(this._lowerLayer, tileId, dx, dy); + } +}; + +Tilemap.prototype._addTile = function(layer, tileId, dx, dy) { + if (Tilemap.isVisibleTile(tileId)) { + if (Tilemap.isAutotile(tileId)) { + this._addAutotile(layer, tileId, dx, dy); + } else { + this._addNormalTile(layer, tileId, dx, dy); + } + } +}; + +Tilemap.prototype._addNormalTile = function(layer, tileId, dx, dy) { + let setNumber = 0; + + if (Tilemap.isTileA5(tileId)) { + setNumber = 4; + } else { + setNumber = 5 + Math.floor(tileId / 256); + } + + const w = this.tileWidth; + const h = this.tileHeight; + const sx = ((Math.floor(tileId / 128) % 2) * 8 + (tileId % 8)) * w; + const sy = (Math.floor((tileId % 256) / 8) % 16) * h; + + layer.addRect(setNumber, sx, sy, dx, dy, w, h); +}; + +Tilemap.prototype._addAutotile = function(layer, tileId, dx, dy) { + const kind = Tilemap.getAutotileKind(tileId); + const shape = Tilemap.getAutotileShape(tileId); + const tx = kind % 8; + const ty = Math.floor(kind / 8); + let setNumber = 0; + let bx = 0; + let by = 0; + let autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE; + let isTable = false; + + if (Tilemap.isTileA1(tileId)) { + const waterSurfaceIndex = [0, 1, 2, 1][this.animationFrame % 4]; + setNumber = 0; + if (kind === 0) { + bx = waterSurfaceIndex * 2; + by = 0; + } else if (kind === 1) { + bx = waterSurfaceIndex * 2; + by = 3; + } else if (kind === 2) { + bx = 6; + by = 0; + } else if (kind === 3) { + bx = 6; + by = 3; + } else { + bx = Math.floor(tx / 4) * 8; + by = ty * 6 + (Math.floor(tx / 2) % 2) * 3; + if (kind % 2 === 0) { + bx += waterSurfaceIndex * 2; + } else { + bx += 6; + autotileTable = Tilemap.WATERFALL_AUTOTILE_TABLE; + by += this.animationFrame % 3; + } + } + } else if (Tilemap.isTileA2(tileId)) { + setNumber = 1; + bx = tx * 2; + by = (ty - 2) * 3; + isTable = this._isTableTile(tileId); + } else if (Tilemap.isTileA3(tileId)) { + setNumber = 2; + bx = tx * 2; + by = (ty - 6) * 2; + autotileTable = Tilemap.WALL_AUTOTILE_TABLE; + } else if (Tilemap.isTileA4(tileId)) { + setNumber = 3; + bx = tx * 2; + by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0)); + if (ty % 2 === 1) { + autotileTable = Tilemap.WALL_AUTOTILE_TABLE; + } + } + + const table = autotileTable[shape]; + const w1 = this.tileWidth / 2; + const h1 = this.tileHeight / 2; + for (let i = 0; i < 4; i++) { + const qsx = table[i][0]; + const qsy = table[i][1]; + const sx1 = (bx * 2 + qsx) * w1; + const sy1 = (by * 2 + qsy) * h1; + const dx1 = dx + (i % 2) * w1; + const dy1 = dy + Math.floor(i / 2) * h1; + if (isTable && (qsy === 1 || qsy === 5)) { + const qsx2 = qsy === 1 ? (4 - qsx) % 4 : qsx; + const qsy2 = 3; + const sx2 = (bx * 2 + qsx2) * w1; + const sy2 = (by * 2 + qsy2) * h1; + layer.addRect(setNumber, sx2, sy2, dx1, dy1, w1, h1); + layer.addRect(setNumber, sx1, sy1, dx1, dy1 + h1 / 2, w1, h1 / 2); + } else { + layer.addRect(setNumber, sx1, sy1, dx1, dy1, w1, h1); + } + } +}; + +Tilemap.prototype._addTableEdge = function(layer, tileId, dx, dy) { + if (Tilemap.isTileA2(tileId)) { + const autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE; + const kind = Tilemap.getAutotileKind(tileId); + const shape = Tilemap.getAutotileShape(tileId); + const tx = kind % 8; + const ty = Math.floor(kind / 8); + const setNumber = 1; + const bx = tx * 2; + const by = (ty - 2) * 3; + const table = autotileTable[shape]; + const w1 = this.tileWidth / 2; + const h1 = this.tileHeight / 2; + for (let i = 0; i < 2; i++) { + const qsx = table[2 + i][0]; + const qsy = table[2 + i][1]; + const sx1 = (bx * 2 + qsx) * w1; + const sy1 = (by * 2 + qsy) * h1 + h1 / 2; + const dx1 = dx + (i % 2) * w1; + const dy1 = dy + Math.floor(i / 2) * h1; + layer.addRect(setNumber, sx1, sy1, dx1, dy1, w1, h1 / 2); + } + } +}; + +Tilemap.prototype._addShadow = function(layer, shadowBits, dx, dy) { + if (shadowBits & 0x0f) { + const w1 = this.tileWidth / 2; + const h1 = this.tileHeight / 2; + for (let i = 0; i < 4; i++) { + if (shadowBits & (1 << i)) { + const dx1 = dx + (i % 2) * w1; + const dy1 = dy + Math.floor(i / 2) * h1; + layer.addRect(-1, 0, 0, dx1, dy1, w1, h1); + } + } + } +}; + +Tilemap.prototype._readMapData = function(x, y, z) { + if (this._mapData) { + const width = this._mapWidth; + const height = this._mapHeight; + if (this.horizontalWrap) { + x = x.mod(width); + } + if (this.verticalWrap) { + y = y.mod(height); + } + if (x >= 0 && x < width && y >= 0 && y < height) { + return this._mapData[(z * height + y) * width + x] || 0; + } else { + return 0; + } + } else { + return 0; + } +}; + +Tilemap.prototype._isHigherTile = function(tileId) { + return this.flags[tileId] & 0x10; +}; + +Tilemap.prototype._isTableTile = function(tileId) { + return Tilemap.isTileA2(tileId) && this.flags[tileId] & 0x80; +}; + +Tilemap.prototype._isOverpassPosition = function(/*mx, my*/) { + return false; +}; + +Tilemap.prototype._sortChildren = function() { + this.children.sort(this._compareChildOrder.bind(this)); +}; + +Tilemap.prototype._compareChildOrder = function(a, b) { + if (a.z !== b.z) { + return a.z - b.z; + } else if (a.y !== b.y) { + return a.y - b.y; + } else { + return a.spriteId - b.spriteId; + } +}; + +//::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Tile type checkers + +Tilemap.TILE_ID_B = 0; +Tilemap.TILE_ID_C = 256; +Tilemap.TILE_ID_D = 512; +Tilemap.TILE_ID_E = 768; +Tilemap.TILE_ID_A5 = 1536; +Tilemap.TILE_ID_A1 = 2048; +Tilemap.TILE_ID_A2 = 2816; +Tilemap.TILE_ID_A3 = 4352; +Tilemap.TILE_ID_A4 = 5888; +Tilemap.TILE_ID_MAX = 8192; + +Tilemap.isVisibleTile = function(tileId) { + return tileId > 0 && tileId < this.TILE_ID_MAX; +}; + +Tilemap.isAutotile = function(tileId) { + return tileId >= this.TILE_ID_A1; +}; + +Tilemap.getAutotileKind = function(tileId) { + return Math.floor((tileId - this.TILE_ID_A1) / 48); +}; + +Tilemap.getAutotileShape = function(tileId) { + return (tileId - this.TILE_ID_A1) % 48; +}; + +Tilemap.makeAutotileId = function(kind, shape) { + return this.TILE_ID_A1 + kind * 48 + shape; +}; + +Tilemap.isSameKindTile = function(tileID1, tileID2) { + if (this.isAutotile(tileID1) && this.isAutotile(tileID2)) { + return this.getAutotileKind(tileID1) === this.getAutotileKind(tileID2); + } else { + return tileID1 === tileID2; + } +}; + +Tilemap.isTileA1 = function(tileId) { + return tileId >= this.TILE_ID_A1 && tileId < this.TILE_ID_A2; +}; + +Tilemap.isTileA2 = function(tileId) { + return tileId >= this.TILE_ID_A2 && tileId < this.TILE_ID_A3; +}; + +Tilemap.isTileA3 = function(tileId) { + return tileId >= this.TILE_ID_A3 && tileId < this.TILE_ID_A4; +}; + +Tilemap.isTileA4 = function(tileId) { + return tileId >= this.TILE_ID_A4 && tileId < this.TILE_ID_MAX; +}; + +Tilemap.isTileA5 = function(tileId) { + return tileId >= this.TILE_ID_A5 && tileId < this.TILE_ID_A1; +}; + +Tilemap.isWaterTile = function(tileId) { + if (this.isTileA1(tileId)) { + return !( + tileId >= this.TILE_ID_A1 + 96 && tileId < this.TILE_ID_A1 + 192 + ); + } else { + return false; + } +}; + +Tilemap.isWaterfallTile = function(tileId) { + if (tileId >= this.TILE_ID_A1 + 192 && tileId < this.TILE_ID_A2) { + return this.getAutotileKind(tileId) % 2 === 1; + } else { + return false; + } +}; + +Tilemap.isGroundTile = function(tileId) { + return ( + this.isTileA1(tileId) || this.isTileA2(tileId) || this.isTileA5(tileId) + ); +}; + +Tilemap.isShadowingTile = function(tileId) { + return this.isTileA3(tileId) || this.isTileA4(tileId); +}; + +Tilemap.isRoofTile = function(tileId) { + return this.isTileA3(tileId) && this.getAutotileKind(tileId) % 16 < 8; +}; + +Tilemap.isWallTopTile = function(tileId) { + return this.isTileA4(tileId) && this.getAutotileKind(tileId) % 16 < 8; +}; + +Tilemap.isWallSideTile = function(tileId) { + return ( + (this.isTileA3(tileId) || this.isTileA4(tileId)) && + this.getAutotileKind(tileId) % 16 >= 8 + ); +}; + +Tilemap.isWallTile = function(tileId) { + return this.isWallTopTile(tileId) || this.isWallSideTile(tileId); +}; + +Tilemap.isFloorTypeAutotile = function(tileId) { + return ( + (this.isTileA1(tileId) && !this.isWaterfallTile(tileId)) || + this.isTileA2(tileId) || + this.isWallTopTile(tileId) + ); +}; + +Tilemap.isWallTypeAutotile = function(tileId) { + return this.isRoofTile(tileId) || this.isWallSideTile(tileId); +}; + +Tilemap.isWaterfallTypeAutotile = function(tileId) { + return this.isWaterfallTile(tileId); +}; + +//::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Autotile shape number to coordinates of tileset images + +// prettier-ignore +Tilemap.FLOOR_AUTOTILE_TABLE = [ + [[2, 4], [1, 4], [2, 3], [1, 3]], + [[2, 0], [1, 4], [2, 3], [1, 3]], + [[2, 4], [3, 0], [2, 3], [1, 3]], + [[2, 0], [3, 0], [2, 3], [1, 3]], + [[2, 4], [1, 4], [2, 3], [3, 1]], + [[2, 0], [1, 4], [2, 3], [3, 1]], + [[2, 4], [3, 0], [2, 3], [3, 1]], + [[2, 0], [3, 0], [2, 3], [3, 1]], + [[2, 4], [1, 4], [2, 1], [1, 3]], + [[2, 0], [1, 4], [2, 1], [1, 3]], + [[2, 4], [3, 0], [2, 1], [1, 3]], + [[2, 0], [3, 0], [2, 1], [1, 3]], + [[2, 4], [1, 4], [2, 1], [3, 1]], + [[2, 0], [1, 4], [2, 1], [3, 1]], + [[2, 4], [3, 0], [2, 1], [3, 1]], + [[2, 0], [3, 0], [2, 1], [3, 1]], + [[0, 4], [1, 4], [0, 3], [1, 3]], + [[0, 4], [3, 0], [0, 3], [1, 3]], + [[0, 4], [1, 4], [0, 3], [3, 1]], + [[0, 4], [3, 0], [0, 3], [3, 1]], + [[2, 2], [1, 2], [2, 3], [1, 3]], + [[2, 2], [1, 2], [2, 3], [3, 1]], + [[2, 2], [1, 2], [2, 1], [1, 3]], + [[2, 2], [1, 2], [2, 1], [3, 1]], + [[2, 4], [3, 4], [2, 3], [3, 3]], + [[2, 4], [3, 4], [2, 1], [3, 3]], + [[2, 0], [3, 4], [2, 3], [3, 3]], + [[2, 0], [3, 4], [2, 1], [3, 3]], + [[2, 4], [1, 4], [2, 5], [1, 5]], + [[2, 0], [1, 4], [2, 5], [1, 5]], + [[2, 4], [3, 0], [2, 5], [1, 5]], + [[2, 0], [3, 0], [2, 5], [1, 5]], + [[0, 4], [3, 4], [0, 3], [3, 3]], + [[2, 2], [1, 2], [2, 5], [1, 5]], + [[0, 2], [1, 2], [0, 3], [1, 3]], + [[0, 2], [1, 2], [0, 3], [3, 1]], + [[2, 2], [3, 2], [2, 3], [3, 3]], + [[2, 2], [3, 2], [2, 1], [3, 3]], + [[2, 4], [3, 4], [2, 5], [3, 5]], + [[2, 0], [3, 4], [2, 5], [3, 5]], + [[0, 4], [1, 4], [0, 5], [1, 5]], + [[0, 4], [3, 0], [0, 5], [1, 5]], + [[0, 2], [3, 2], [0, 3], [3, 3]], + [[0, 2], [1, 2], [0, 5], [1, 5]], + [[0, 4], [3, 4], [0, 5], [3, 5]], + [[2, 2], [3, 2], [2, 5], [3, 5]], + [[0, 2], [3, 2], [0, 5], [3, 5]], + [[0, 0], [1, 0], [0, 1], [1, 1]] +]; + +// prettier-ignore +Tilemap.WALL_AUTOTILE_TABLE = [ + [[2, 2], [1, 2], [2, 1], [1, 1]], + [[0, 2], [1, 2], [0, 1], [1, 1]], + [[2, 0], [1, 0], [2, 1], [1, 1]], + [[0, 0], [1, 0], [0, 1], [1, 1]], + [[2, 2], [3, 2], [2, 1], [3, 1]], + [[0, 2], [3, 2], [0, 1], [3, 1]], + [[2, 0], [3, 0], [2, 1], [3, 1]], + [[0, 0], [3, 0], [0, 1], [3, 1]], + [[2, 2], [1, 2], [2, 3], [1, 3]], + [[0, 2], [1, 2], [0, 3], [1, 3]], + [[2, 0], [1, 0], [2, 3], [1, 3]], + [[0, 0], [1, 0], [0, 3], [1, 3]], + [[2, 2], [3, 2], [2, 3], [3, 3]], + [[0, 2], [3, 2], [0, 3], [3, 3]], + [[2, 0], [3, 0], [2, 3], [3, 3]], + [[0, 0], [3, 0], [0, 3], [3, 3]] +]; + +// prettier-ignore +Tilemap.WATERFALL_AUTOTILE_TABLE = [ + [[2, 0], [1, 0], [2, 1], [1, 1]], + [[0, 0], [1, 0], [0, 1], [1, 1]], + [[2, 0], [3, 0], [2, 1], [3, 1]], + [[0, 0], [3, 0], [0, 1], [3, 1]] +]; + +//::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +// Internal classes + +Tilemap.Layer = function() { + this.initialize(...arguments); +}; + +Tilemap.Layer.prototype = Object.create(PIXI.Container.prototype); +Tilemap.Layer.prototype.constructor = Tilemap.Layer; + +Tilemap.Layer.prototype.initialize = function() { + PIXI.Container.call(this); + this._elements = []; + this._indexBuffer = null; + this._indexArray = new Float32Array(0); + this._vertexBuffer = null; + this._vertexArray = new Float32Array(0); + this._vao = null; + this._needsTexturesUpdate = false; + this._needsVertexUpdate = false; + this._images = []; + this._state = PIXI.State.for2d(); + this._createVao(); +}; + +Tilemap.Layer.MAX_GL_TEXTURES = 3; +Tilemap.Layer.VERTEX_STRIDE = 9 * 4; +Tilemap.Layer.MAX_SIZE = 16000; + +Tilemap.Layer.prototype.destroy = function() { + if (this._vao) { + this._vao.destroy(); + this._indexBuffer.destroy(); + this._vertexBuffer.destroy(); + } + this._indexBuffer = null; + this._vertexBuffer = null; + this._vao = null; +}; + +Tilemap.Layer.prototype.setBitmaps = function(bitmaps) { + this._images = bitmaps.map(bitmap => bitmap.image || bitmap.canvas); + this._needsTexturesUpdate = true; +}; + +Tilemap.Layer.prototype.clear = function() { + this._elements.length = 0; + this._needsVertexUpdate = true; +}; + +Tilemap.Layer.prototype.size = function() { + return this._elements.length; +}; + +Tilemap.Layer.prototype.addRect = function(setNumber, sx, sy, dx, dy, w, h) { + this._elements.push([setNumber, sx, sy, dx, dy, w, h]); +}; + +Tilemap.Layer.prototype.render = function(renderer) { + const gl = renderer.gl; + const tilemapRenderer = renderer.plugins.rpgtilemap; + const shader = tilemapRenderer.getShader(); + const matrix = shader.uniforms.uProjectionMatrix; + + renderer.batch.setObjectRenderer(tilemapRenderer); + renderer.projection.projectionMatrix.copyTo(matrix); + matrix.append(this.worldTransform); + renderer.shader.bind(shader); + + if (this._needsTexturesUpdate) { + tilemapRenderer.updateTextures(renderer, this._images); + this._needsTexturesUpdate = false; + } + tilemapRenderer.bindTextures(renderer); + renderer.geometry.bind(this._vao, shader); + this._updateIndexBuffer(); + if (this._needsVertexUpdate) { + this._updateVertexBuffer(); + this._needsVertexUpdate = false; + } + renderer.geometry.updateBuffers(); + + const numElements = this._elements.length; + if (numElements > 0) { + renderer.state.set(this._state); + renderer.geometry.draw(gl.TRIANGLES, numElements * 6, 0); + } +}; + +Tilemap.Layer.prototype.isReady = function() { + if (this._images.length === 0) { + return false; + } + for (const texture of this._images) { + if (!texture || !texture.valid) { + return false; + } + } + return true; +}; + +Tilemap.Layer.prototype._createVao = function() { + const ib = new PIXI.Buffer(null, true, true); + const vb = new PIXI.Buffer(null, true, false); + const stride = Tilemap.Layer.VERTEX_STRIDE; + const type = PIXI.TYPES.FLOAT; + const geometry = new PIXI.Geometry(); + this._indexBuffer = ib; + this._vertexBuffer = vb; + this._vao = geometry + .addIndex(this._indexBuffer) + .addAttribute("aTextureId", vb, 1, false, type, stride, 0) + .addAttribute("aFrame", vb, 4, false, type, stride, 1 * 4) + .addAttribute("aSource", vb, 2, false, type, stride, 5 * 4) + .addAttribute("aDest", vb, 2, false, type, stride, 7 * 4); +}; + +Tilemap.Layer.prototype._updateIndexBuffer = function() { + const numElements = this._elements.length; + if (this._indexArray.length < numElements * 6 * 2) { + this._indexArray = PIXI.utils.createIndicesForQuads(numElements * 2); + this._indexBuffer.update(this._indexArray); + } +}; + +Tilemap.Layer.prototype._updateVertexBuffer = function() { + const numElements = this._elements.length; + const required = numElements * Tilemap.Layer.VERTEX_STRIDE; + if (this._vertexArray.length < required) { + this._vertexArray = new Float32Array(required * 2); + } + const vertexArray = this._vertexArray; + let index = 0; + for (const item of this._elements) { + const setNumber = item[0]; + const tid = setNumber >> 2; + const sxOffset = 1024 * (setNumber & 1); + const syOffset = 1024 * ((setNumber >> 1) & 1); + const sx = item[1] + sxOffset; + const sy = item[2] + syOffset; + const dx = item[3]; + const dy = item[4]; + const w = item[5]; + const h = item[6]; + const frameLeft = sx + 0.5; + const frameTop = sy + 0.5; + const frameRight = sx + w - 0.5; + const frameBottom = sy + h - 0.5; + vertexArray[index++] = tid; + vertexArray[index++] = frameLeft; + vertexArray[index++] = frameTop; + vertexArray[index++] = frameRight; + vertexArray[index++] = frameBottom; + vertexArray[index++] = sx; + vertexArray[index++] = sy; + vertexArray[index++] = dx; + vertexArray[index++] = dy; + vertexArray[index++] = tid; + vertexArray[index++] = frameLeft; + vertexArray[index++] = frameTop; + vertexArray[index++] = frameRight; + vertexArray[index++] = frameBottom; + vertexArray[index++] = sx + w; + vertexArray[index++] = sy; + vertexArray[index++] = dx + w; + vertexArray[index++] = dy; + vertexArray[index++] = tid; + vertexArray[index++] = frameLeft; + vertexArray[index++] = frameTop; + vertexArray[index++] = frameRight; + vertexArray[index++] = frameBottom; + vertexArray[index++] = sx + w; + vertexArray[index++] = sy + h; + vertexArray[index++] = dx + w; + vertexArray[index++] = dy + h; + vertexArray[index++] = tid; + vertexArray[index++] = frameLeft; + vertexArray[index++] = frameTop; + vertexArray[index++] = frameRight; + vertexArray[index++] = frameBottom; + vertexArray[index++] = sx; + vertexArray[index++] = sy + h; + vertexArray[index++] = dx; + vertexArray[index++] = dy + h; + } + this._vertexBuffer.update(vertexArray); +}; + +Tilemap.CombinedLayer = function() { + this.initialize(...arguments); +}; + +Tilemap.CombinedLayer.prototype = Object.create(PIXI.Container.prototype); +Tilemap.CombinedLayer.prototype.constructor = Tilemap.CombinedLayer; + +Tilemap.CombinedLayer.prototype.initialize = function() { + PIXI.Container.call(this); + for (let i = 0; i < 2; i++) { + this.addChild(new Tilemap.Layer()); + } +}; + +Tilemap.CombinedLayer.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Container.prototype.destroy.call(this, options); +}; + +Tilemap.CombinedLayer.prototype.setBitmaps = function(bitmaps) { + for (const child of this.children) { + child.setBitmaps(bitmaps); + } +}; + +Tilemap.CombinedLayer.prototype.clear = function() { + for (const child of this.children) { + child.clear(); + } +}; + +Tilemap.CombinedLayer.prototype.size = function() { + return this.children.reduce((r, child) => r + child.size(), 0); +}; + +// prettier-ignore +Tilemap.CombinedLayer.prototype.addRect = function( + setNumber, sx, sy, dx, dy, w, h +) { + for (const child of this.children) { + if (child.size() < Tilemap.Layer.MAX_SIZE) { + child.addRect(setNumber, sx, sy, dx, dy, w, h); + break; + } + } +}; + +Tilemap.CombinedLayer.prototype.isReady = function() { + return this.children.every(child => child.isReady()); +}; + +Tilemap.Renderer = function() { + this.initialize(...arguments); +}; + +Tilemap.Renderer.prototype = Object.create(PIXI.ObjectRenderer.prototype); +Tilemap.Renderer.prototype.constructor = Tilemap.Renderer; + +Tilemap.Renderer.prototype.initialize = function(renderer) { + PIXI.ObjectRenderer.call(this, renderer); + this._shader = null; + this._images = []; + this._internalTextures = []; + this._clearBuffer = new Uint8Array(1024 * 1024 * 4); + this.contextChange(); +}; + +Tilemap.Renderer.prototype.destroy = function() { + PIXI.ObjectRenderer.prototype.destroy.call(this); + this._destroyInternalTextures(); + this._shader.destroy(); + this._shader = null; +}; + +Tilemap.Renderer.prototype.getShader = function() { + return this._shader; +}; + +Tilemap.Renderer.prototype.contextChange = function() { + this._shader = this._createShader(); + this._images = []; + this._createInternalTextures(); +}; + +Tilemap.Renderer.prototype._createShader = function() { + const vertexSrc = + "attribute float aTextureId;" + + "attribute vec4 aFrame;" + + "attribute vec2 aSource;" + + "attribute vec2 aDest;" + + "uniform mat3 uProjectionMatrix;" + + "varying vec4 vFrame;" + + "varying vec2 vTextureCoord;" + + "varying float vTextureId;" + + "void main(void) {" + + " vec3 position = uProjectionMatrix * vec3(aDest, 1.0);" + + " gl_Position = vec4(position, 1.0);" + + " vFrame = aFrame;" + + " vTextureCoord = aSource;" + + " vTextureId = aTextureId;" + + "}"; + const fragmentSrc = + "varying vec4 vFrame;" + + "varying vec2 vTextureCoord;" + + "varying float vTextureId;" + + "uniform sampler2D uSampler0;" + + "uniform sampler2D uSampler1;" + + "uniform sampler2D uSampler2;" + + "void main(void) {" + + " vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);" + + " int textureId = int(vTextureId);" + + " vec4 color;" + + " if (textureId < 0) {" + + " color = vec4(0.0, 0.0, 0.0, 0.5);" + + " } else if (textureId == 0) {" + + " color = texture2D(uSampler0, textureCoord / 2048.0);" + + " } else if (textureId == 1) {" + + " color = texture2D(uSampler1, textureCoord / 2048.0);" + + " } else if (textureId == 2) {" + + " color = texture2D(uSampler2, textureCoord / 2048.0);" + + " }" + + " gl_FragColor = color;" + + "}"; + + return new PIXI.Shader(PIXI.Program.from(vertexSrc, fragmentSrc), { + uSampler0: 0, + uSampler1: 0, + uSampler2: 0, + uProjectionMatrix: new PIXI.Matrix() + }); +}; + +Tilemap.Renderer.prototype._createInternalTextures = function() { + this._destroyInternalTextures(); + for (let i = 0; i < Tilemap.Layer.MAX_GL_TEXTURES; i++) { + const baseTexture = new PIXI.BaseRenderTexture(); + baseTexture.resize(2048, 2048); + baseTexture.scaleMode = PIXI.SCALE_MODES.NEAREST; + this._internalTextures.push(baseTexture); + } +}; + +Tilemap.Renderer.prototype._destroyInternalTextures = function() { + for (const internalTexture of this._internalTextures) { + internalTexture.destroy(); + } + this._internalTextures = []; +}; + +Tilemap.Renderer.prototype.updateTextures = function(renderer, images) { + for (let i = 0; i < images.length; i++) { + const internalTexture = this._internalTextures[i >> 2]; + renderer.texture.bind(internalTexture, 0); + const gl = renderer.gl; + const x = 1024 * (i % 2); + const y = 1024 * ((i >> 1) % 2); + const format = gl.RGBA; + const type = gl.UNSIGNED_BYTE; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0); + // prettier-ignore + gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, 1024, 1024, format, type, + this._clearBuffer); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1); + gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, format, type, images[i]); + } +}; + +Tilemap.Renderer.prototype.bindTextures = function(renderer) { + for (let ti = 0; ti < Tilemap.Layer.MAX_GL_TEXTURES; ti++) { + renderer.texture.bind(this._internalTextures[ti], ti); + } +}; + +PIXI.Renderer.registerPlugin("rpgtilemap", Tilemap.Renderer); + +//----------------------------------------------------------------------------- +/** + * The sprite object for a tiling image. + * + * @class + * @extends PIXI.TilingSprite + * @param {Bitmap} bitmap - The image for the tiling sprite. + */ +function TilingSprite() { + this.initialize(...arguments); +} + +TilingSprite.prototype = Object.create(PIXI.TilingSprite.prototype); +TilingSprite.prototype.constructor = TilingSprite; + +TilingSprite.prototype.initialize = function(bitmap) { + if (!TilingSprite._emptyBaseTexture) { + TilingSprite._emptyBaseTexture = new PIXI.BaseTexture(); + TilingSprite._emptyBaseTexture.setSize(1, 1); + } + const frame = new Rectangle(); + const texture = new PIXI.Texture(TilingSprite._emptyBaseTexture, frame); + PIXI.TilingSprite.call(this, texture); + this._bitmap = bitmap; + this._width = 0; + this._height = 0; + this._frame = frame; + + /** + * The origin point of the tiling sprite for scrolling. + * + * @type Point + */ + this.origin = new Point(); + + this._onBitmapChange(); +}; + +TilingSprite._emptyBaseTexture = null; + +/** + * The image for the tiling sprite. + * + * @type Bitmap + * @name TilingSprite#bitmap + */ +Object.defineProperty(TilingSprite.prototype, "bitmap", { + get: function() { + return this._bitmap; + }, + set: function(value) { + if (this._bitmap !== value) { + this._bitmap = value; + this._onBitmapChange(); + } + }, + configurable: true +}); + +/** + * The opacity of the tiling sprite (0 to 255). + * + * @type number + * @name TilingSprite#opacity + */ +Object.defineProperty(TilingSprite.prototype, "opacity", { + get: function() { + return this.alpha * 255; + }, + set: function(value) { + this.alpha = value.clamp(0, 255) / 255; + }, + configurable: true +}); + +/** + * Destroys the tiling sprite. + */ +TilingSprite.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.TilingSprite.prototype.destroy.call(this, options); +}; + +/** + * Updates the tiling sprite for each frame. + */ +TilingSprite.prototype.update = function() { + for (const child of this.children) { + if (child.update) { + child.update(); + } + } +}; + +/** + * Sets the x, y, width, and height all at once. + * + * @param {number} x - The x coordinate of the tiling sprite. + * @param {number} y - The y coordinate of the tiling sprite. + * @param {number} width - The width of the tiling sprite. + * @param {number} height - The height of the tiling sprite. + */ +TilingSprite.prototype.move = function(x, y, width, height) { + this.x = x || 0; + this.y = y || 0; + this._width = width || 0; + this._height = height || 0; +}; + +/** + * Specifies the region of the image that the tiling sprite will use. + * + * @param {number} x - The x coordinate of the frame. + * @param {number} y - The y coordinate of the frame. + * @param {number} width - The width of the frame. + * @param {number} height - The height of the frame. + */ +TilingSprite.prototype.setFrame = function(x, y, width, height) { + this._frame.x = x; + this._frame.y = y; + this._frame.width = width; + this._frame.height = height; + this._refresh(); +}; + +/** + * Updates the transform on all children of this container for rendering. + */ +TilingSprite.prototype.updateTransform = function() { + this.tilePosition.x = Math.round(-this.origin.x); + this.tilePosition.y = Math.round(-this.origin.y); + PIXI.TilingSprite.prototype.updateTransform.call(this); +}; + +TilingSprite.prototype._onBitmapChange = function() { + if (this._bitmap) { + this._bitmap.addLoadListener(this._onBitmapLoad.bind(this)); + } else { + this.texture.frame = new Rectangle(); + } +}; + +TilingSprite.prototype._onBitmapLoad = function() { + this.texture.baseTexture = this._bitmap.baseTexture; + this._refresh(); +}; + +TilingSprite.prototype._refresh = function() { + const texture = this.texture; + const frame = this._frame.clone(); + if (frame.width === 0 && frame.height === 0 && this._bitmap) { + frame.width = this._bitmap.width; + frame.height = this._bitmap.height; + } + if (texture) { + if (texture.baseTexture) { + try { + texture.frame = frame; + } catch (e) { + texture.frame = new Rectangle(); + } + } + texture._updateID++; + } +}; + +//----------------------------------------------------------------------------- +/** + * The sprite which covers the entire game screen. + * + * @class + * @extends PIXI.Container + */ +function ScreenSprite() { + this.initialize(...arguments); +} + +ScreenSprite.prototype = Object.create(PIXI.Container.prototype); +ScreenSprite.prototype.constructor = ScreenSprite; + +ScreenSprite.prototype.initialize = function() { + PIXI.Container.call(this); + this._graphics = new PIXI.Graphics(); + this.addChild(this._graphics); + this.opacity = 0; + this._red = -1; + this._green = -1; + this._blue = -1; + this.setBlack(); +}; + +/** + * The opacity of the sprite (0 to 255). + * + * @type number + * @name ScreenSprite#opacity + */ +Object.defineProperty(ScreenSprite.prototype, "opacity", { + get: function() { + return this.alpha * 255; + }, + set: function(value) { + this.alpha = value.clamp(0, 255) / 255; + }, + configurable: true +}); + +/** + * Destroys the screen sprite. + */ +ScreenSprite.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Container.prototype.destroy.call(this, options); +}; + +/** + * Sets black to the color of the screen sprite. + */ +ScreenSprite.prototype.setBlack = function() { + this.setColor(0, 0, 0); +}; + +/** + * Sets white to the color of the screen sprite. + */ +ScreenSprite.prototype.setWhite = function() { + this.setColor(255, 255, 255); +}; + +/** + * Sets the color of the screen sprite by values. + * + * @param {number} r - The red value in the range (0, 255). + * @param {number} g - The green value in the range (0, 255). + * @param {number} b - The blue value in the range (0, 255). + */ +ScreenSprite.prototype.setColor = function(r, g, b) { + if (this._red !== r || this._green !== g || this._blue !== b) { + r = Math.round(r || 0).clamp(0, 255); + g = Math.round(g || 0).clamp(0, 255); + b = Math.round(b || 0).clamp(0, 255); + this._red = r; + this._green = g; + this._blue = b; + const graphics = this._graphics; + graphics.clear(); + graphics.beginFill((r << 16) | (g << 8) | b, 1); + graphics.drawRect(-50000, -50000, 100000, 100000); + } +}; + +//----------------------------------------------------------------------------- +/** + * The window in the game. + * + * @class + * @extends PIXI.Container + */ +function Window() { + this.initialize(...arguments); +} + +Window.prototype = Object.create(PIXI.Container.prototype); +Window.prototype.constructor = Window; + +Window.prototype.initialize = function() { + PIXI.Container.call(this); + + this._isWindow = true; + this._windowskin = null; + this._width = 0; + this._height = 0; + this._cursorRect = new Rectangle(); + this._openness = 255; + this._animationCount = 0; + + this._padding = 12; + this._margin = 4; + this._colorTone = [0, 0, 0, 0]; + this._innerChildren = []; + + this._container = null; + this._backSprite = null; + this._frameSprite = null; + this._contentsBackSprite = null; + this._cursorSprite = null; + this._contentsSprite = null; + this._downArrowSprite = null; + this._upArrowSprite = null; + this._pauseSignSprite = null; + + this._createAllParts(); + + /** + * The origin point of the window for scrolling. + * + * @type Point + */ + this.origin = new Point(); + + /** + * The active state for the window. + * + * @type boolean + */ + this.active = true; + + /** + * The visibility of the frame. + * + * @type boolean + */ + this.frameVisible = true; + + /** + * The visibility of the cursor. + * + * @type boolean + */ + this.cursorVisible = true; + + /** + * The visibility of the down scroll arrow. + * + * @type boolean + */ + this.downArrowVisible = false; + + /** + * The visibility of the up scroll arrow. + * + * @type boolean + */ + this.upArrowVisible = false; + + /** + * The visibility of the pause sign. + * + * @type boolean + */ + this.pause = false; +}; + +/** + * The image used as a window skin. + * + * @type Bitmap + * @name Window#windowskin + */ +Object.defineProperty(Window.prototype, "windowskin", { + get: function() { + return this._windowskin; + }, + set: function(value) { + if (this._windowskin !== value) { + this._windowskin = value; + this._windowskin.addLoadListener(this._onWindowskinLoad.bind(this)); + } + }, + configurable: true +}); + +/** + * The bitmap used for the window contents. + * + * @type Bitmap + * @name Window#contents + */ +Object.defineProperty(Window.prototype, "contents", { + get: function() { + return this._contentsSprite.bitmap; + }, + set: function(value) { + this._contentsSprite.bitmap = value; + }, + configurable: true +}); + +/** + * The bitmap used for the window contents background. + * + * @type Bitmap + * @name Window#contentsBack + */ +Object.defineProperty(Window.prototype, "contentsBack", { + get: function() { + return this._contentsBackSprite.bitmap; + }, + set: function(value) { + this._contentsBackSprite.bitmap = value; + }, + configurable: true +}); + +/** + * The width of the window in pixels. + * + * @type number + * @name Window#width + */ +Object.defineProperty(Window.prototype, "width", { + get: function() { + return this._width; + }, + set: function(value) { + this._width = value; + this._refreshAllParts(); + }, + configurable: true +}); + +/** + * The height of the window in pixels. + * + * @type number + * @name Window#height + */ +Object.defineProperty(Window.prototype, "height", { + get: function() { + return this._height; + }, + set: function(value) { + this._height = value; + this._refreshAllParts(); + }, + configurable: true +}); + +/** + * The size of the padding between the frame and contents. + * + * @type number + * @name Window#padding + */ +Object.defineProperty(Window.prototype, "padding", { + get: function() { + return this._padding; + }, + set: function(value) { + this._padding = value; + this._refreshAllParts(); + }, + configurable: true +}); + +/** + * The size of the margin for the window background. + * + * @type number + * @name Window#margin + */ +Object.defineProperty(Window.prototype, "margin", { + get: function() { + return this._margin; + }, + set: function(value) { + this._margin = value; + this._refreshAllParts(); + }, + configurable: true +}); + +/** + * The opacity of the window without contents (0 to 255). + * + * @type number + * @name Window#opacity + */ +Object.defineProperty(Window.prototype, "opacity", { + get: function() { + return this._container.alpha * 255; + }, + set: function(value) { + this._container.alpha = value.clamp(0, 255) / 255; + }, + configurable: true +}); + +/** + * The opacity of the window background (0 to 255). + * + * @type number + * @name Window#backOpacity + */ +Object.defineProperty(Window.prototype, "backOpacity", { + get: function() { + return this._backSprite.alpha * 255; + }, + set: function(value) { + this._backSprite.alpha = value.clamp(0, 255) / 255; + }, + configurable: true +}); + +/** + * The opacity of the window contents (0 to 255). + * + * @type number + * @name Window#contentsOpacity + */ +Object.defineProperty(Window.prototype, "contentsOpacity", { + get: function() { + return this._contentsSprite.alpha * 255; + }, + set: function(value) { + this._contentsSprite.alpha = value.clamp(0, 255) / 255; + }, + configurable: true +}); + +/** + * The openness of the window (0 to 255). + * + * @type number + * @name Window#openness + */ +Object.defineProperty(Window.prototype, "openness", { + get: function() { + return this._openness; + }, + set: function(value) { + if (this._openness !== value) { + this._openness = value.clamp(0, 255); + this._container.scale.y = this._openness / 255; + this._container.y = (this.height / 2) * (1 - this._openness / 255); + } + }, + configurable: true +}); + +/** + * The width of the content area in pixels. + * + * @readonly + * @type number + * @name Window#innerWidth + */ +Object.defineProperty(Window.prototype, "innerWidth", { + get: function() { + return Math.max(0, this._width - this._padding * 2); + }, + configurable: true +}); + +/** + * The height of the content area in pixels. + * + * @readonly + * @type number + * @name Window#innerHeight + */ +Object.defineProperty(Window.prototype, "innerHeight", { + get: function() { + return Math.max(0, this._height - this._padding * 2); + }, + configurable: true +}); + +/** + * The rectangle of the content area. + * + * @readonly + * @type Rectangle + * @name Window#innerRect + */ +Object.defineProperty(Window.prototype, "innerRect", { + get: function() { + return new Rectangle( + this._padding, + this._padding, + this.innerWidth, + this.innerHeight + ); + }, + configurable: true +}); + +/** + * Destroys the window. + */ +Window.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Container.prototype.destroy.call(this, options); +}; + +/** + * Updates the window for each frame. + */ +Window.prototype.update = function() { + if (this.active) { + this._animationCount++; + } + for (const child of this.children) { + if (child.update) { + child.update(); + } + } +}; + +/** + * Sets the x, y, width, and height all at once. + * + * @param {number} x - The x coordinate of the window. + * @param {number} y - The y coordinate of the window. + * @param {number} width - The width of the window. + * @param {number} height - The height of the window. + */ +Window.prototype.move = function(x, y, width, height) { + this.x = x || 0; + this.y = y || 0; + if (this._width !== width || this._height !== height) { + this._width = width || 0; + this._height = height || 0; + this._refreshAllParts(); + } +}; + +/** + * Checks whether the window is completely open (openness == 255). + * + * @returns {boolean} True if the window is open. + */ +Window.prototype.isOpen = function() { + return this._openness >= 255; +}; + +/** + * Checks whether the window is completely closed (openness == 0). + * + * @returns {boolean} True if the window is closed. + */ +Window.prototype.isClosed = function() { + return this._openness <= 0; +}; + +/** + * Sets the position of the command cursor. + * + * @param {number} x - The x coordinate of the cursor. + * @param {number} y - The y coordinate of the cursor. + * @param {number} width - The width of the cursor. + * @param {number} height - The height of the cursor. + */ +Window.prototype.setCursorRect = function(x, y, width, height) { + const cw = Math.floor(width || 0); + const ch = Math.floor(height || 0); + this._cursorRect.x = Math.floor(x || 0); + this._cursorRect.y = Math.floor(y || 0); + if (this._cursorRect.width !== cw || this._cursorRect.height !== ch) { + this._cursorRect.width = cw; + this._cursorRect.height = ch; + this._refreshCursor(); + } +}; + +/** + * Moves the cursor position by the given amount. + * + * @param {number} x - The amount of horizontal movement. + * @param {number} y - The amount of vertical movement. + */ +Window.prototype.moveCursorBy = function(x, y) { + this._cursorRect.x += x; + this._cursorRect.y += y; +}; + +/** + * Moves the inner children by the given amount. + * + * @param {number} x - The amount of horizontal movement. + * @param {number} y - The amount of vertical movement. + */ +Window.prototype.moveInnerChildrenBy = function(x, y) { + for (const child of this._innerChildren) { + child.x += x; + child.y += y; + } +}; + +/** + * Changes the color of the background. + * + * @param {number} r - The red value in the range (-255, 255). + * @param {number} g - The green value in the range (-255, 255). + * @param {number} b - The blue value in the range (-255, 255). + */ +Window.prototype.setTone = function(r, g, b) { + const tone = this._colorTone; + if (r !== tone[0] || g !== tone[1] || b !== tone[2]) { + this._colorTone = [r, g, b, 0]; + this._refreshBack(); + } +}; + +/** + * Adds a child between the background and contents. + * + * @param {object} child - The child to add. + * @returns {object} The child that was added. + */ +Window.prototype.addChildToBack = function(child) { + const containerIndex = this.children.indexOf(this._container); + return this.addChildAt(child, containerIndex + 1); +}; + +/** + * Adds a child to the client area. + * + * @param {object} child - The child to add. + * @returns {object} The child that was added. + */ +Window.prototype.addInnerChild = function(child) { + this._innerChildren.push(child); + return this._clientArea.addChild(child); +}; + +/** + * Updates the transform on all children of this container for rendering. + */ +Window.prototype.updateTransform = function() { + this._updateClientArea(); + this._updateFrame(); + this._updateContentsBack(); + this._updateCursor(); + this._updateContents(); + this._updateArrows(); + this._updatePauseSign(); + PIXI.Container.prototype.updateTransform.call(this); + this._updateFilterArea(); +}; + +/** + * Draws the window shape into PIXI.Graphics object. Used by WindowLayer. + */ +Window.prototype.drawShape = function(graphics) { + if (graphics) { + const width = this.width; + const height = (this.height * this._openness) / 255; + const x = this.x; + const y = this.y + (this.height - height) / 2; + graphics.beginFill(0xffffff); + graphics.drawRoundedRect(x, y, width, height, 0); + graphics.endFill(); + } +}; + +Window.prototype._createAllParts = function() { + this._createContainer(); + this._createBackSprite(); + this._createFrameSprite(); + this._createClientArea(); + this._createContentsBackSprite(); + this._createCursorSprite(); + this._createContentsSprite(); + this._createArrowSprites(); + this._createPauseSignSprites(); +}; + +Window.prototype._createContainer = function() { + this._container = new PIXI.Container(); + this.addChild(this._container); +}; + +Window.prototype._createBackSprite = function() { + this._backSprite = new Sprite(); + this._backSprite.addChild(new TilingSprite()); + this._container.addChild(this._backSprite); +}; + +Window.prototype._createFrameSprite = function() { + this._frameSprite = new Sprite(); + for (let i = 0; i < 8; i++) { + this._frameSprite.addChild(new Sprite()); + } + this._container.addChild(this._frameSprite); +}; + +Window.prototype._createClientArea = function() { + this._clientArea = new Sprite(); + this._clientArea.filters = [new PIXI.filters.AlphaFilter()]; + this._clientArea.filterArea = new Rectangle(); + this._clientArea.move(this._padding, this._padding); + this.addChild(this._clientArea); +}; + +Window.prototype._createContentsBackSprite = function() { + this._contentsBackSprite = new Sprite(); + this._clientArea.addChild(this._contentsBackSprite); +}; + +Window.prototype._createCursorSprite = function() { + this._cursorSprite = new Sprite(); + for (let i = 0; i < 9; i++) { + this._cursorSprite.addChild(new Sprite()); + } + this._clientArea.addChild(this._cursorSprite); +}; + +Window.prototype._createContentsSprite = function() { + this._contentsSprite = new Sprite(); + this._clientArea.addChild(this._contentsSprite); +}; + +Window.prototype._createArrowSprites = function() { + this._downArrowSprite = new Sprite(); + this.addChild(this._downArrowSprite); + this._upArrowSprite = new Sprite(); + this.addChild(this._upArrowSprite); +}; + +Window.prototype._createPauseSignSprites = function() { + this._pauseSignSprite = new Sprite(); + this.addChild(this._pauseSignSprite); +}; + +Window.prototype._onWindowskinLoad = function() { + this._refreshAllParts(); +}; + +Window.prototype._refreshAllParts = function() { + this._refreshBack(); + this._refreshFrame(); + this._refreshCursor(); + this._refreshArrows(); + this._refreshPauseSign(); +}; + +Window.prototype._refreshBack = function() { + const m = this._margin; + const w = Math.max(0, this._width - m * 2); + const h = Math.max(0, this._height - m * 2); + const sprite = this._backSprite; + const tilingSprite = sprite.children[0]; + // [Note] We use 95 instead of 96 here to avoid blurring edges. + sprite.bitmap = this._windowskin; + sprite.setFrame(0, 0, 95, 95); + sprite.move(m, m); + sprite.scale.x = w / 95; + sprite.scale.y = h / 95; + tilingSprite.bitmap = this._windowskin; + tilingSprite.setFrame(0, 96, 96, 96); + tilingSprite.move(0, 0, w, h); + tilingSprite.scale.x = 1 / sprite.scale.x; + tilingSprite.scale.y = 1 / sprite.scale.y; + sprite.setColorTone(this._colorTone); +}; + +Window.prototype._refreshFrame = function() { + const drect = { x: 0, y: 0, width: this._width, height: this._height }; + const srect = { x: 96, y: 0, width: 96, height: 96 }; + const m = 24; + for (const child of this._frameSprite.children) { + child.bitmap = this._windowskin; + } + this._setRectPartsGeometry(this._frameSprite, srect, drect, m); +}; + +Window.prototype._refreshCursor = function() { + const drect = this._cursorRect.clone(); + const srect = { x: 96, y: 96, width: 48, height: 48 }; + const m = 4; + for (const child of this._cursorSprite.children) { + child.bitmap = this._windowskin; + } + this._setRectPartsGeometry(this._cursorSprite, srect, drect, m); +}; + +Window.prototype._setRectPartsGeometry = function(sprite, srect, drect, m) { + const sx = srect.x; + const sy = srect.y; + const sw = srect.width; + const sh = srect.height; + const dx = drect.x; + const dy = drect.y; + const dw = drect.width; + const dh = drect.height; + const smw = sw - m * 2; + const smh = sh - m * 2; + const dmw = dw - m * 2; + const dmh = dh - m * 2; + const children = sprite.children; + sprite.setFrame(0, 0, dw, dh); + sprite.move(dx, dy); + // corner + children[0].setFrame(sx, sy, m, m); + children[1].setFrame(sx + sw - m, sy, m, m); + children[2].setFrame(sx, sy + sw - m, m, m); + children[3].setFrame(sx + sw - m, sy + sw - m, m, m); + children[0].move(0, 0); + children[1].move(dw - m, 0); + children[2].move(0, dh - m); + children[3].move(dw - m, dh - m); + // edge + children[4].move(m, 0); + children[5].move(m, dh - m); + children[6].move(0, m); + children[7].move(dw - m, m); + children[4].setFrame(sx + m, sy, smw, m); + children[5].setFrame(sx + m, sy + sw - m, smw, m); + children[6].setFrame(sx, sy + m, m, smh); + children[7].setFrame(sx + sw - m, sy + m, m, smh); + children[4].scale.x = dmw / smw; + children[5].scale.x = dmw / smw; + children[6].scale.y = dmh / smh; + children[7].scale.y = dmh / smh; + // center + if (children[8]) { + children[8].setFrame(sx + m, sy + m, smw, smh); + children[8].move(m, m); + children[8].scale.x = dmw / smw; + children[8].scale.y = dmh / smh; + } + for (const child of children) { + child.visible = dw > 0 && dh > 0; + } +}; + +Window.prototype._refreshArrows = function() { + const w = this._width; + const h = this._height; + const p = 24; + const q = p / 2; + const sx = 96 + p; + const sy = 0 + p; + this._downArrowSprite.bitmap = this._windowskin; + this._downArrowSprite.anchor.x = 0.5; + this._downArrowSprite.anchor.y = 0.5; + this._downArrowSprite.setFrame(sx + q, sy + q + p, p, q); + this._downArrowSprite.move(w / 2, h - q); + this._upArrowSprite.bitmap = this._windowskin; + this._upArrowSprite.anchor.x = 0.5; + this._upArrowSprite.anchor.y = 0.5; + this._upArrowSprite.setFrame(sx + q, sy, p, q); + this._upArrowSprite.move(w / 2, q); +}; + +Window.prototype._refreshPauseSign = function() { + const sx = 144; + const sy = 96; + const p = 24; + this._pauseSignSprite.bitmap = this._windowskin; + this._pauseSignSprite.anchor.x = 0.5; + this._pauseSignSprite.anchor.y = 1; + this._pauseSignSprite.move(this._width / 2, this._height); + this._pauseSignSprite.setFrame(sx, sy, p, p); + this._pauseSignSprite.alpha = 0; +}; + +Window.prototype._updateClientArea = function() { + const pad = this._padding; + this._clientArea.move(pad, pad); + this._clientArea.x = pad - this.origin.x; + this._clientArea.y = pad - this.origin.y; + if (this.innerWidth > 0 && this.innerHeight > 0) { + this._clientArea.visible = this.isOpen(); + } else { + this._clientArea.visible = false; + } +}; + +Window.prototype._updateFrame = function() { + this._frameSprite.visible = this.frameVisible; +}; + +Window.prototype._updateContentsBack = function() { + const bitmap = this._contentsBackSprite.bitmap; + if (bitmap) { + this._contentsBackSprite.setFrame(0, 0, bitmap.width, bitmap.height); + } +}; + +Window.prototype._updateCursor = function() { + this._cursorSprite.alpha = this._makeCursorAlpha(); + this._cursorSprite.visible = this.isOpen() && this.cursorVisible; + this._cursorSprite.x = this._cursorRect.x; + this._cursorSprite.y = this._cursorRect.y; +}; + +Window.prototype._makeCursorAlpha = function() { + const blinkCount = this._animationCount % 40; + const baseAlpha = this.contentsOpacity / 255; + if (this.active) { + if (blinkCount < 20) { + return baseAlpha - blinkCount / 32; + } else { + return baseAlpha - (40 - blinkCount) / 32; + } + } + return baseAlpha; +}; + +Window.prototype._updateContents = function() { + const bitmap = this._contentsSprite.bitmap; + if (bitmap) { + this._contentsSprite.setFrame(0, 0, bitmap.width, bitmap.height); + } +}; + +Window.prototype._updateArrows = function() { + this._downArrowSprite.visible = this.isOpen() && this.downArrowVisible; + this._upArrowSprite.visible = this.isOpen() && this.upArrowVisible; +}; + +Window.prototype._updatePauseSign = function() { + const sprite = this._pauseSignSprite; + const x = Math.floor(this._animationCount / 16) % 2; + const y = Math.floor(this._animationCount / 16 / 2) % 2; + const sx = 144; + const sy = 96; + const p = 24; + if (!this.pause) { + sprite.alpha = 0; + } else if (sprite.alpha < 1) { + sprite.alpha = Math.min(sprite.alpha + 0.1, 1); + } + sprite.setFrame(sx + x * p, sy + y * p, p, p); + sprite.visible = this.isOpen(); +}; + +Window.prototype._updateFilterArea = function() { + const pos = this._clientArea.worldTransform.apply(new Point(0, 0)); + const filterArea = this._clientArea.filterArea; + filterArea.x = pos.x + this.origin.x; + filterArea.y = pos.y + this.origin.y; + filterArea.width = this.innerWidth; + filterArea.height = this.innerHeight; +}; + +//----------------------------------------------------------------------------- +/** + * The layer which contains game windows. + * + * @class + * @extends PIXI.Container + */ +function WindowLayer() { + this.initialize(...arguments); +} + +WindowLayer.prototype = Object.create(PIXI.Container.prototype); +WindowLayer.prototype.constructor = WindowLayer; + +WindowLayer.prototype.initialize = function() { + PIXI.Container.call(this); +}; + +/** + * Updates the window layer for each frame. + */ +WindowLayer.prototype.update = function() { + for (const child of this.children) { + if (child.update) { + child.update(); + } + } +}; + +/** + * Renders the object using the WebGL renderer. + * + * @param {PIXI.Renderer} renderer - The renderer. + */ +WindowLayer.prototype.render = function render(renderer) { + if (!this.visible) { + return; + } + + const graphics = new PIXI.Graphics(); + const gl = renderer.gl; + const children = this.children.clone(); + + renderer.framebuffer.forceStencil(); + graphics.transform = this.transform; + renderer.batch.flush(); + gl.enable(gl.STENCIL_TEST); + + while (children.length > 0) { + const win = children.pop(); + if (win._isWindow && win.visible && win.openness > 0) { + gl.stencilFunc(gl.EQUAL, 0, ~0); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + win.render(renderer); + renderer.batch.flush(); + graphics.clear(); + win.drawShape(graphics); + gl.stencilFunc(gl.ALWAYS, 1, ~0); + gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE); + gl.blendFunc(gl.ZERO, gl.ONE); + graphics.render(renderer); + renderer.batch.flush(); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + } + } + + gl.disable(gl.STENCIL_TEST); + gl.clear(gl.STENCIL_BUFFER_BIT); + gl.clearStencil(0); + renderer.batch.flush(); + + for (const child of this.children) { + if (!child._isWindow && child.visible) { + child.render(renderer); + } + } + + renderer.batch.flush(); +}; + +//----------------------------------------------------------------------------- +/** + * The weather effect which displays rain, storm, or snow. + * + * @class + * @extends PIXI.Container + */ +function Weather() { + this.initialize(...arguments); +} + +Weather.prototype = Object.create(PIXI.Container.prototype); +Weather.prototype.constructor = Weather; + +Weather.prototype.initialize = function() { + PIXI.Container.call(this); + + this._width = Graphics.width; + this._height = Graphics.height; + this._sprites = []; + + this._createBitmaps(); + this._createDimmer(); + + /** + * The type of the weather in ["none", "rain", "storm", "snow"]. + * + * @type string + */ + this.type = "none"; + + /** + * The power of the weather in the range (0, 9). + * + * @type number + */ + this.power = 0; + + /** + * The origin point of the weather for scrolling. + * + * @type Point + */ + this.origin = new Point(); +}; + +/** + * Destroys the weather. + */ +Weather.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Container.prototype.destroy.call(this, options); + this._rainBitmap.destroy(); + this._stormBitmap.destroy(); + this._snowBitmap.destroy(); +}; + +/** + * Updates the weather for each frame. + */ +Weather.prototype.update = function() { + this._updateDimmer(); + this._updateAllSprites(); +}; + +Weather.prototype._createBitmaps = function() { + this._rainBitmap = new Bitmap(1, 60); + this._rainBitmap.fillAll("white"); + this._stormBitmap = new Bitmap(2, 100); + this._stormBitmap.fillAll("white"); + this._snowBitmap = new Bitmap(9, 9); + this._snowBitmap.drawCircle(4, 4, 4, "white"); +}; + +Weather.prototype._createDimmer = function() { + this._dimmerSprite = new ScreenSprite(); + this._dimmerSprite.setColor(80, 80, 80); + this.addChild(this._dimmerSprite); +}; + +Weather.prototype._updateDimmer = function() { + this._dimmerSprite.opacity = Math.floor(this.power * 6); +}; + +Weather.prototype._updateAllSprites = function() { + const maxSprites = Math.floor(this.power * 10); + while (this._sprites.length < maxSprites) { + this._addSprite(); + } + while (this._sprites.length > maxSprites) { + this._removeSprite(); + } + for (const sprite of this._sprites) { + this._updateSprite(sprite); + sprite.x = sprite.ax - this.origin.x; + sprite.y = sprite.ay - this.origin.y; + } +}; + +Weather.prototype._addSprite = function() { + const sprite = new Sprite(this.viewport); + sprite.opacity = 0; + this._sprites.push(sprite); + this.addChild(sprite); +}; + +Weather.prototype._removeSprite = function() { + this.removeChild(this._sprites.pop()); +}; + +Weather.prototype._updateSprite = function(sprite) { + switch (this.type) { + case "rain": + this._updateRainSprite(sprite); + break; + case "storm": + this._updateStormSprite(sprite); + break; + case "snow": + this._updateSnowSprite(sprite); + break; + } + if (sprite.opacity < 40) { + this._rebornSprite(sprite); + } +}; + +Weather.prototype._updateRainSprite = function(sprite) { + sprite.bitmap = this._rainBitmap; + sprite.rotation = Math.PI / 16; + sprite.ax -= 6 * Math.sin(sprite.rotation); + sprite.ay += 6 * Math.cos(sprite.rotation); + sprite.opacity -= 6; +}; + +Weather.prototype._updateStormSprite = function(sprite) { + sprite.bitmap = this._stormBitmap; + sprite.rotation = Math.PI / 8; + sprite.ax -= 8 * Math.sin(sprite.rotation); + sprite.ay += 8 * Math.cos(sprite.rotation); + sprite.opacity -= 8; +}; + +Weather.prototype._updateSnowSprite = function(sprite) { + sprite.bitmap = this._snowBitmap; + sprite.rotation = Math.PI / 16; + sprite.ax -= 3 * Math.sin(sprite.rotation); + sprite.ay += 3 * Math.cos(sprite.rotation); + sprite.opacity -= 3; +}; + +Weather.prototype._rebornSprite = function(sprite) { + sprite.ax = Math.randomInt(Graphics.width + 100) - 100 + this.origin.x; + sprite.ay = Math.randomInt(Graphics.height + 200) - 200 + this.origin.y; + sprite.opacity = 160 + Math.randomInt(60); +}; + +//----------------------------------------------------------------------------- +/** + * The color filter for WebGL. + * + * @class + * @extends PIXI.Filter + */ +function ColorFilter() { + this.initialize(...arguments); +} + +ColorFilter.prototype = Object.create(PIXI.Filter.prototype); +ColorFilter.prototype.constructor = ColorFilter; + +ColorFilter.prototype.initialize = function() { + PIXI.Filter.call(this, null, this._fragmentSrc()); + this.uniforms.hue = 0; + this.uniforms.colorTone = [0, 0, 0, 0]; + this.uniforms.blendColor = [0, 0, 0, 0]; + this.uniforms.brightness = 255; +}; + +/** + * Sets the hue rotation value. + * + * @param {number} hue - The hue value (-360, 360). + */ +ColorFilter.prototype.setHue = function(hue) { + this.uniforms.hue = Number(hue); +}; + +/** + * Sets the color tone. + * + * @param {array} tone - The color tone [r, g, b, gray]. + */ +ColorFilter.prototype.setColorTone = function(tone) { + if (!(tone instanceof Array)) { + throw new Error("Argument must be an array"); + } + this.uniforms.colorTone = tone.clone(); +}; + +/** + * Sets the blend color. + * + * @param {array} color - The blend color [r, g, b, a]. + */ +ColorFilter.prototype.setBlendColor = function(color) { + if (!(color instanceof Array)) { + throw new Error("Argument must be an array"); + } + this.uniforms.blendColor = color.clone(); +}; + +/** + * Sets the brightness. + * + * @param {number} brightness - The brightness (0 to 255). + */ +ColorFilter.prototype.setBrightness = function(brightness) { + this.uniforms.brightness = Number(brightness); +}; + +ColorFilter.prototype._fragmentSrc = function() { + const src = + "varying vec2 vTextureCoord;" + + "uniform sampler2D uSampler;" + + "uniform float hue;" + + "uniform vec4 colorTone;" + + "uniform vec4 blendColor;" + + "uniform float brightness;" + + "vec3 rgbToHsl(vec3 rgb) {" + + " float r = rgb.r;" + + " float g = rgb.g;" + + " float b = rgb.b;" + + " float cmin = min(r, min(g, b));" + + " float cmax = max(r, max(g, b));" + + " float h = 0.0;" + + " float s = 0.0;" + + " float l = (cmin + cmax) / 2.0;" + + " float delta = cmax - cmin;" + + " if (delta > 0.0) {" + + " if (r == cmax) {" + + " h = mod((g - b) / delta + 6.0, 6.0) / 6.0;" + + " } else if (g == cmax) {" + + " h = ((b - r) / delta + 2.0) / 6.0;" + + " } else {" + + " h = ((r - g) / delta + 4.0) / 6.0;" + + " }" + + " if (l < 1.0) {" + + " s = delta / (1.0 - abs(2.0 * l - 1.0));" + + " }" + + " }" + + " return vec3(h, s, l);" + + "}" + + "vec3 hslToRgb(vec3 hsl) {" + + " float h = hsl.x;" + + " float s = hsl.y;" + + " float l = hsl.z;" + + " float c = (1.0 - abs(2.0 * l - 1.0)) * s;" + + " float x = c * (1.0 - abs((mod(h * 6.0, 2.0)) - 1.0));" + + " float m = l - c / 2.0;" + + " float cm = c + m;" + + " float xm = x + m;" + + " if (h < 1.0 / 6.0) {" + + " return vec3(cm, xm, m);" + + " } else if (h < 2.0 / 6.0) {" + + " return vec3(xm, cm, m);" + + " } else if (h < 3.0 / 6.0) {" + + " return vec3(m, cm, xm);" + + " } else if (h < 4.0 / 6.0) {" + + " return vec3(m, xm, cm);" + + " } else if (h < 5.0 / 6.0) {" + + " return vec3(xm, m, cm);" + + " } else {" + + " return vec3(cm, m, xm);" + + " }" + + "}" + + "void main() {" + + " vec4 sample = texture2D(uSampler, vTextureCoord);" + + " float a = sample.a;" + + " vec3 hsl = rgbToHsl(sample.rgb);" + + " hsl.x = mod(hsl.x + hue / 360.0, 1.0);" + + " hsl.y = hsl.y * (1.0 - colorTone.a / 255.0);" + + " vec3 rgb = hslToRgb(hsl);" + + " float r = rgb.r;" + + " float g = rgb.g;" + + " float b = rgb.b;" + + " float r2 = colorTone.r / 255.0;" + + " float g2 = colorTone.g / 255.0;" + + " float b2 = colorTone.b / 255.0;" + + " float r3 = blendColor.r / 255.0;" + + " float g3 = blendColor.g / 255.0;" + + " float b3 = blendColor.b / 255.0;" + + " float i3 = blendColor.a / 255.0;" + + " float i1 = 1.0 - i3;" + + " r = clamp((r / a + r2) * a, 0.0, 1.0);" + + " g = clamp((g / a + g2) * a, 0.0, 1.0);" + + " b = clamp((b / a + b2) * a, 0.0, 1.0);" + + " r = clamp(r * i1 + r3 * i3 * a, 0.0, 1.0);" + + " g = clamp(g * i1 + g3 * i3 * a, 0.0, 1.0);" + + " b = clamp(b * i1 + b3 * i3 * a, 0.0, 1.0);" + + " r = r * brightness / 255.0;" + + " g = g * brightness / 255.0;" + + " b = b * brightness / 255.0;" + + " gl_FragColor = vec4(r, g, b, a);" + + "}"; + return src; +}; + +//----------------------------------------------------------------------------- +/** + * The root object of the display tree. + * + * @class + * @extends PIXI.Container + */ +function Stage() { + this.initialize(...arguments); +} + +Stage.prototype = Object.create(PIXI.Container.prototype); +Stage.prototype.constructor = Stage; + +Stage.prototype.initialize = function() { + PIXI.Container.call(this); +}; + +/** + * Destroys the stage. + */ +Stage.prototype.destroy = function() { + const options = { children: true, texture: true }; + PIXI.Container.prototype.destroy.call(this, options); +}; + +//----------------------------------------------------------------------------- +/** + * The audio object of Web Audio API. + * + * @class + * @param {string} url - The url of the audio file. + */ +function WebAudio() { + this.initialize(...arguments); +} + +WebAudio.prototype.initialize = function(url) { + this.clear(); + this._url = url; + this._startLoading(); +}; + +/** + * Initializes the audio system. + * + * @returns {boolean} True if the audio system is available. + */ +WebAudio.initialize = function() { + this._context = null; + this._masterGainNode = null; + this._masterVolume = 1; + this._createContext(); + this._createMasterGainNode(); + this._setupEventHandlers(); + return !!this._context; +}; + +/** + * Sets the master volume for all audio. + * + * @param {number} value - The master volume (0 to 1). + */ +WebAudio.setMasterVolume = function(value) { + this._masterVolume = value; + this._resetVolume(); +}; + +WebAudio._createContext = function() { + try { + const AudioContext = window.AudioContext || window.webkitAudioContext; + this._context = new AudioContext(); + } catch (e) { + this._context = null; + } +}; + +WebAudio._currentTime = function() { + return this._context ? this._context.currentTime : 0; +}; + +WebAudio._createMasterGainNode = function() { + const context = this._context; + if (context) { + this._masterGainNode = context.createGain(); + this._resetVolume(); + this._masterGainNode.connect(context.destination); + } +}; + +WebAudio._setupEventHandlers = function() { + const onUserGesture = this._onUserGesture.bind(this); + const onVisibilityChange = this._onVisibilityChange.bind(this); + document.addEventListener("keydown", onUserGesture); + document.addEventListener("mousedown", onUserGesture); + document.addEventListener("touchend", onUserGesture); + document.addEventListener("visibilitychange", onVisibilityChange); +}; + +WebAudio._onUserGesture = function() { + const context = this._context; + if (context && context.state === "suspended") { + context.resume(); + } +}; + +WebAudio._onVisibilityChange = function() { + if (document.visibilityState === "hidden") { + this._onHide(); + } else { + this._onShow(); + } +}; + +WebAudio._onHide = function() { + if (this._shouldMuteOnHide()) { + this._fadeOut(1); + } +}; + +WebAudio._onShow = function() { + if (this._shouldMuteOnHide()) { + this._fadeIn(1); + } +}; + +WebAudio._shouldMuteOnHide = function() { + return Utils.isMobileDevice() && !window.navigator.standalone; +}; + +WebAudio._resetVolume = function() { + if (this._masterGainNode) { + const gain = this._masterGainNode.gain; + const volume = this._masterVolume; + const currentTime = this._currentTime(); + gain.setValueAtTime(volume, currentTime); + } +}; + +WebAudio._fadeIn = function(duration) { + if (this._masterGainNode) { + const gain = this._masterGainNode.gain; + const volume = this._masterVolume; + const currentTime = this._currentTime(); + gain.setValueAtTime(0, currentTime); + gain.linearRampToValueAtTime(volume, currentTime + duration); + } +}; + +WebAudio._fadeOut = function(duration) { + if (this._masterGainNode) { + const gain = this._masterGainNode.gain; + const volume = this._masterVolume; + const currentTime = this._currentTime(); + gain.setValueAtTime(volume, currentTime); + gain.linearRampToValueAtTime(0, currentTime + duration); + } +}; + +/** + * Clears the audio data. + */ +WebAudio.prototype.clear = function() { + this.stop(); + this._data = null; + this._fetchedSize = 0; + this._fetchedData = []; + this._buffers = []; + this._sourceNodes = []; + this._gainNode = null; + this._pannerNode = null; + this._totalTime = 0; + this._sampleRate = 0; + this._loop = 0; + this._loopStart = 0; + this._loopLength = 0; + this._loopStartTime = 0; + this._loopLengthTime = 0; + this._startTime = 0; + this._volume = 1; + this._pitch = 1; + this._pan = 0; + this._endTimer = null; + this._loadListeners = []; + this._stopListeners = []; + this._lastUpdateTime = 0; + this._isLoaded = false; + this._isError = false; + this._isPlaying = false; + this._decoder = null; +}; + +/** + * The url of the audio file. + * + * @readonly + * @type string + * @name WebAudio#url + */ +Object.defineProperty(WebAudio.prototype, "url", { + get: function() { + return this._url; + }, + configurable: true +}); + +/** + * The volume of the audio. + * + * @type number + * @name WebAudio#volume + */ +Object.defineProperty(WebAudio.prototype, "volume", { + get: function() { + return this._volume; + }, + set: function(value) { + this._volume = value; + if (this._gainNode) { + this._gainNode.gain.setValueAtTime( + this._volume, + WebAudio._currentTime() + ); + } + }, + configurable: true +}); + +/** + * The pitch of the audio. + * + * @type number + * @name WebAudio#pitch + */ +Object.defineProperty(WebAudio.prototype, "pitch", { + get: function() { + return this._pitch; + }, + set: function(value) { + if (this._pitch !== value) { + this._pitch = value; + if (this.isPlaying()) { + this.play(this._loop, 0); + } + } + }, + configurable: true +}); + +/** + * The pan of the audio. + * + * @type number + * @name WebAudio#pan + */ +Object.defineProperty(WebAudio.prototype, "pan", { + get: function() { + return this._pan; + }, + set: function(value) { + this._pan = value; + this._updatePanner(); + }, + configurable: true +}); + +/** + * Checks whether the audio data is ready to play. + * + * @returns {boolean} True if the audio data is ready to play. + */ +WebAudio.prototype.isReady = function() { + return this._buffers && this._buffers.length > 0; +}; + +/** + * Checks whether a loading error has occurred. + * + * @returns {boolean} True if a loading error has occurred. + */ +WebAudio.prototype.isError = function() { + return this._isError; +}; + +/** + * Checks whether the audio is playing. + * + * @returns {boolean} True if the audio is playing. + */ +WebAudio.prototype.isPlaying = function() { + return this._isPlaying; +}; + +/** + * Plays the audio. + * + * @param {boolean} loop - Whether the audio data play in a loop. + * @param {number} offset - The start position to play in seconds. + */ +WebAudio.prototype.play = function(loop, offset) { + this._loop = loop; + if (this.isReady()) { + offset = offset || 0; + this._startPlaying(offset); + } else if (WebAudio._context) { + this.addLoadListener(() => this.play(loop, offset)); + } + this._isPlaying = true; +}; + +/** + * Stops the audio. + */ +WebAudio.prototype.stop = function() { + this._isPlaying = false; + this._removeEndTimer(); + this._removeNodes(); + this._loadListeners = []; + if (this._stopListeners) { + while (this._stopListeners.length > 0) { + const listner = this._stopListeners.shift(); + listner(); + } + } +}; + +/** + * Destroys the audio. + */ +WebAudio.prototype.destroy = function() { + this._destroyDecoder(); + this.clear(); +}; + +/** + * Performs the audio fade-in. + * + * @param {number} duration - Fade-in time in seconds. + */ +WebAudio.prototype.fadeIn = function(duration) { + if (this.isReady()) { + if (this._gainNode) { + const gain = this._gainNode.gain; + const currentTime = WebAudio._currentTime(); + gain.setValueAtTime(0, currentTime); + gain.linearRampToValueAtTime(this._volume, currentTime + duration); + } + } else { + this.addLoadListener(() => this.fadeIn(duration)); + } +}; + +/** + * Performs the audio fade-out. + * + * @param {number} duration - Fade-out time in seconds. + */ +WebAudio.prototype.fadeOut = function(duration) { + if (this._gainNode) { + const gain = this._gainNode.gain; + const currentTime = WebAudio._currentTime(); + gain.setValueAtTime(this._volume, currentTime); + gain.linearRampToValueAtTime(0, currentTime + duration); + } + this._isPlaying = false; + this._loadListeners = []; +}; + +/** + * Gets the seek position of the audio. + */ +WebAudio.prototype.seek = function() { + if (WebAudio._context) { + let pos = (WebAudio._currentTime() - this._startTime) * this._pitch; + if (this._loopLengthTime > 0) { + while (pos >= this._loopStartTime + this._loopLengthTime) { + pos -= this._loopLengthTime; + } + } + return pos; + } else { + return 0; + } +}; + +/** + * Adds a callback function that will be called when the audio data is loaded. + * + * @param {function} listner - The callback function. + */ +WebAudio.prototype.addLoadListener = function(listner) { + this._loadListeners.push(listner); +}; + +/** + * Adds a callback function that will be called when the playback is stopped. + * + * @param {function} listner - The callback function. + */ +WebAudio.prototype.addStopListener = function(listner) { + this._stopListeners.push(listner); +}; + +/** + * Tries to load the audio again. + */ +WebAudio.prototype.retry = function() { + this._startLoading(); + if (this._isPlaying) { + this.play(this._loop, 0); + } +}; + +WebAudio.prototype._startLoading = function() { + if (WebAudio._context) { + const url = this._realUrl(); + if (Utils.isLocal()) { + this._startXhrLoading(url); + } else { + this._startFetching(url); + } + const currentTime = WebAudio._currentTime(); + this._lastUpdateTime = currentTime - 0.5; + this._isError = false; + this._isLoaded = false; + this._destroyDecoder(); + if (this._shouldUseDecoder()) { + this._createDecoder(); + } + } +}; + +WebAudio.prototype._shouldUseDecoder = function() { + return !Utils.canPlayOgg() && typeof VorbisDecoder === "function"; +}; + +WebAudio.prototype._createDecoder = function() { + this._decoder = new VorbisDecoder( + WebAudio._context, + this._onDecode.bind(this), + this._onError.bind(this) + ); +}; + +WebAudio.prototype._destroyDecoder = function() { + if (this._decoder) { + this._decoder.destroy(); + this._decoder = null; + } +}; + +WebAudio.prototype._realUrl = function() { + return this._url + (Utils.hasEncryptedAudio() ? "_" : ""); +}; + +WebAudio.prototype._startXhrLoading = function(url) { + const xhr = new XMLHttpRequest(); + xhr.open("GET", url); + xhr.responseType = "arraybuffer"; + xhr.onload = () => this._onXhrLoad(xhr); + xhr.onerror = this._onError.bind(this); + xhr.send(); +}; + +WebAudio.prototype._startFetching = function(url) { + const options = { credentials: "same-origin" }; + fetch(url, options) + .then(response => this._onFetch(response)) + .catch(() => this._onError()); +}; + +WebAudio.prototype._onXhrLoad = function(xhr) { + if (xhr.status < 400) { + this._data = new Uint8Array(xhr.response); + this._isLoaded = true; + this._updateBuffer(); + } else { + this._onError(); + } +}; + +WebAudio.prototype._onFetch = function(response) { + if (response.ok) { + const reader = response.body.getReader(); + const readChunk = ({ done, value }) => { + if (done) { + this._isLoaded = true; + if (this._fetchedSize > 0) { + this._concatenateFetchedData(); + this._updateBuffer(); + this._data = null; + } + return 0; + } else { + this._onFetchProcess(value); + return reader.read().then(readChunk); + } + }; + reader + .read() + .then(readChunk) + .catch(() => this._onError()); + } else { + this._onError(); + } +}; + +WebAudio.prototype._onError = function() { + if (this._sourceNodes.length > 0) { + this._stopSourceNode(); + } + this._data = null; + this._isError = true; +}; + +WebAudio.prototype._onFetchProcess = function(value) { + this._fetchedSize += value.length; + this._fetchedData.push(value); + this._updateBufferOnFetch(); +}; + +WebAudio.prototype._updateBufferOnFetch = function() { + const currentTime = WebAudio._currentTime(); + const deltaTime = currentTime - this._lastUpdateTime; + const currentData = this._data; + const currentSize = currentData ? currentData.length : 0; + if (deltaTime >= 1 && currentSize + this._fetchedSize >= 200000) { + this._concatenateFetchedData(); + this._updateBuffer(); + this._lastUpdateTime = currentTime; + } +}; + +WebAudio.prototype._concatenateFetchedData = function() { + const currentData = this._data; + const currentSize = currentData ? currentData.length : 0; + const newData = new Uint8Array(currentSize + this._fetchedSize); + let pos = 0; + if (currentData) { + newData.set(currentData); + pos += currentSize; + } + for (const value of this._fetchedData) { + newData.set(value, pos); + pos += value.length; + } + this._data = newData; + this._fetchedData = []; + this._fetchedSize = 0; +}; + +WebAudio.prototype._updateBuffer = function() { + const arrayBuffer = this._readableBuffer(); + this._readLoopComments(arrayBuffer); + this._decodeAudioData(arrayBuffer); +}; + +WebAudio.prototype._readableBuffer = function() { + if (Utils.hasEncryptedAudio()) { + return Utils.decryptArrayBuffer(this._data.buffer); + } else { + return this._data.buffer; + } +}; + +WebAudio.prototype._decodeAudioData = function(arrayBuffer) { + if (this._shouldUseDecoder()) { + if (this._decoder) { + this._decoder.send(arrayBuffer, this._isLoaded); + } + } else { + // [Note] Make a temporary copy of arrayBuffer because + // decodeAudioData() detaches it. + WebAudio._context + .decodeAudioData(arrayBuffer.slice()) + .then(buffer => this._onDecode(buffer)) + .catch(() => this._onError()); + } +}; + +WebAudio.prototype._onDecode = function(buffer) { + if (!this._shouldUseDecoder()) { + this._buffers = []; + this._totalTime = 0; + } + this._buffers.push(buffer); + this._totalTime += buffer.duration; + if (this._loopLength > 0 && this._sampleRate > 0) { + this._loopStartTime = this._loopStart / this._sampleRate; + this._loopLengthTime = this._loopLength / this._sampleRate; + } else { + this._loopStartTime = 0; + this._loopLengthTime = this._totalTime; + } + if (this._sourceNodes.length > 0) { + this._refreshSourceNode(); + } + this._onLoad(); +}; + +WebAudio.prototype._refreshSourceNode = function() { + if (this._shouldUseDecoder()) { + const index = this._buffers.length - 1; + this._createSourceNode(index); + if (this._isPlaying) { + this._startSourceNode(index); + } + } else { + this._stopSourceNode(); + this._createAllSourceNodes(); + if (this._isPlaying) { + this._startAllSourceNodes(); + } + } + if (this._isPlaying) { + this._removeEndTimer(); + this._createEndTimer(); + } +}; + +WebAudio.prototype._startPlaying = function(offset) { + if (this._loopLengthTime > 0) { + while (offset >= this._loopStartTime + this._loopLengthTime) { + offset -= this._loopLengthTime; + } + } + this._startTime = WebAudio._currentTime() - offset / this._pitch; + this._removeEndTimer(); + this._removeNodes(); + this._createPannerNode(); + this._createGainNode(); + this._createAllSourceNodes(); + this._startAllSourceNodes(); + this._createEndTimer(); +}; + +WebAudio.prototype._startAllSourceNodes = function() { + for (let i = 0; i < this._sourceNodes.length; i++) { + this._startSourceNode(i); + } +}; + +WebAudio.prototype._startSourceNode = function(index) { + const sourceNode = this._sourceNodes[index]; + const seekPos = this.seek(); + const currentTime = WebAudio._currentTime(); + const loop = this._loop; + const loopStart = this._loopStartTime; + const loopLength = this._loopLengthTime; + const loopEnd = loopStart + loopLength; + const pitch = this._pitch; + let chunkStart = 0; + for (let i = 0; i < index; i++) { + chunkStart += this._buffers[i].duration; + } + const chunkEnd = chunkStart + sourceNode.buffer.duration; + let when = 0; + let offset = 0; + let duration = sourceNode.buffer.duration; + if (seekPos >= chunkStart && seekPos < chunkEnd - 0.01) { + when = currentTime; + offset = seekPos - chunkStart; + } else { + when = currentTime + (chunkStart - seekPos) / pitch; + offset = 0; + if (loop) { + if (when < currentTime - 0.01) { + when += loopLength / pitch; + } + if (seekPos >= loopStart && chunkStart < loopStart) { + when += (loopStart - chunkStart) / pitch; + offset = loopStart - chunkStart; + } + } + } + if (loop && loopEnd < chunkEnd) { + duration = loopEnd - chunkStart - offset; + } + if (this._shouldUseDecoder()) { + if (when >= currentTime && offset < duration) { + sourceNode.loop = false; + sourceNode.start(when, offset, duration); + if (loop && chunkEnd > loopStart) { + sourceNode.onended = () => { + this._createSourceNode(index); + this._startSourceNode(index); + }; + } + } + } else { + if (when >= currentTime && offset < sourceNode.buffer.duration) { + sourceNode.start(when, offset); + } + } + chunkStart += sourceNode.buffer.duration; +}; + +WebAudio.prototype._stopSourceNode = function() { + for (const sourceNode of this._sourceNodes) { + try { + sourceNode.onended = null; + sourceNode.stop(); + } catch (e) { + // Ignore InvalidStateError + } + } +}; + +WebAudio.prototype._createPannerNode = function() { + this._pannerNode = WebAudio._context.createPanner(); + this._pannerNode.panningModel = "equalpower"; + this._pannerNode.connect(WebAudio._masterGainNode); + this._updatePanner(); +}; + +WebAudio.prototype._createGainNode = function() { + const currentTime = WebAudio._currentTime(); + this._gainNode = WebAudio._context.createGain(); + this._gainNode.gain.setValueAtTime(this._volume, currentTime); + this._gainNode.connect(this._pannerNode); +}; + +WebAudio.prototype._createAllSourceNodes = function() { + for (let i = 0; i < this._buffers.length; i++) { + this._createSourceNode(i); + } +}; + +WebAudio.prototype._createSourceNode = function(index) { + const sourceNode = WebAudio._context.createBufferSource(); + const currentTime = WebAudio._currentTime(); + sourceNode.buffer = this._buffers[index]; + sourceNode.loop = this._loop && this._isLoaded; + sourceNode.loopStart = this._loopStartTime; + sourceNode.loopEnd = this._loopStartTime + this._loopLengthTime; + sourceNode.playbackRate.setValueAtTime(this._pitch, currentTime); + sourceNode.connect(this._gainNode); + this._sourceNodes[index] = sourceNode; +}; + +WebAudio.prototype._removeNodes = function() { + if (this._sourceNodes && this._sourceNodes.length > 0) { + this._stopSourceNode(); + this._sourceNodes = []; + this._gainNode = null; + this._pannerNode = null; + } +}; + +WebAudio.prototype._createEndTimer = function() { + if (this._sourceNodes.length > 0 && !this._loop) { + const endTime = this._startTime + this._totalTime / this._pitch; + const delay = endTime - WebAudio._currentTime(); + this._endTimer = setTimeout(this.stop.bind(this), delay * 1000); + } +}; + +WebAudio.prototype._removeEndTimer = function() { + if (this._endTimer) { + clearTimeout(this._endTimer); + this._endTimer = null; + } +}; + +WebAudio.prototype._updatePanner = function() { + if (this._pannerNode) { + const x = this._pan; + const z = 1 - Math.abs(x); + this._pannerNode.setPosition(x, 0, z); + } +}; + +WebAudio.prototype._onLoad = function() { + while (this._loadListeners.length > 0) { + const listner = this._loadListeners.shift(); + listner(); + } +}; + +WebAudio.prototype._readLoopComments = function(arrayBuffer) { + const view = new DataView(arrayBuffer); + let index = 0; + while (index < view.byteLength - 30) { + if (this._readFourCharacters(view, index) !== "OggS") { + break; + } + index += 26; + const numSegments = view.getUint8(index++); + const segments = []; + for (let i = 0; i < numSegments; i++) { + segments.push(view.getUint8(index++)); + } + const packets = []; + while (segments.length > 0) { + let packetSize = 0; + while (segments[0] === 255) { + packetSize += segments.shift(); + } + if (segments.length > 0) { + packetSize += segments.shift(); + } + packets.push(packetSize); + } + let vorbisHeaderFound = false; + for (const size of packets) { + if (this._readFourCharacters(view, index + 1) === "vorb") { + const headerType = view.getUint8(index); + if (headerType === 1) { + this._sampleRate = view.getUint32(index + 12, true); + } else if (headerType === 3) { + this._readMetaData(view, index, size); + } + vorbisHeaderFound = true; + } + index += size; + } + if (!vorbisHeaderFound) { + break; + } + } +}; + +WebAudio.prototype._readMetaData = function(view, index, size) { + for (let i = index; i < index + size - 10; i++) { + if (this._readFourCharacters(view, i) === "LOOP") { + let text = ""; + while (view.getUint8(i) > 0) { + text += String.fromCharCode(view.getUint8(i++)); + } + if (text.match(/LOOPSTART=([0-9]+)/)) { + this._loopStart = parseInt(RegExp.$1); + } + if (text.match(/LOOPLENGTH=([0-9]+)/)) { + this._loopLength = parseInt(RegExp.$1); + } + if (text === "LOOPSTART" || text === "LOOPLENGTH") { + let text2 = ""; + i += 16; + while (view.getUint8(i) > 0) { + text2 += String.fromCharCode(view.getUint8(i++)); + } + if (text === "LOOPSTART") { + this._loopStart = parseInt(text2); + } else { + this._loopLength = parseInt(text2); + } + } + } + } +}; + +WebAudio.prototype._readFourCharacters = function(view, index) { + let string = ""; + if (index <= view.byteLength - 4) { + for (let i = 0; i < 4; i++) { + string += String.fromCharCode(view.getUint8(index + i)); + } + } + return string; +}; + +//----------------------------------------------------------------------------- +/** + * The static class that handles video playback. + * + * @namespace + */ +function Video() { + throw new Error("This is a static class"); +} + +/** + * Initializes the video system. + * + * @param {number} width - The width of the video. + * @param {number} height - The height of the video. + */ +Video.initialize = function(width, height) { + this._element = null; + this._loading = false; + this._volume = 1; + this._createElement(); + this._setupEventHandlers(); + this.resize(width, height); +}; + +/** + * Changes the display size of the video. + * + * @param {number} width - The width of the video. + * @param {number} height - The height of the video. + */ +Video.resize = function(width, height) { + if (this._element) { + this._element.style.width = width + "px"; + this._element.style.height = height + "px"; + } +}; + +/** + * Starts playback of a video. + * + * @param {string} src - The url of the video. + */ +Video.play = function(src) { + this._element.src = src; + this._element.onloadeddata = this._onLoad.bind(this); + this._element.onerror = this._onError.bind(this); + this._element.onended = this._onEnd.bind(this); + this._element.load(); + this._loading = true; +}; + +/** + * Checks whether the video is playing. + * + * @returns {boolean} True if the video is playing. + */ +Video.isPlaying = function() { + return this._loading || this._isVisible(); +}; + +/** + * Sets the volume for videos. + * + * @param {number} volume - The volume for videos (0 to 1). + */ +Video.setVolume = function(volume) { + this._volume = volume; + if (this._element) { + this._element.volume = this._volume; + } +}; + +Video._createElement = function() { + this._element = document.createElement("video"); + this._element.id = "gameVideo"; + this._element.style.position = "absolute"; + this._element.style.margin = "auto"; + this._element.style.top = 0; + this._element.style.left = 0; + this._element.style.right = 0; + this._element.style.bottom = 0; + this._element.style.opacity = 0; + this._element.style.zIndex = 2; + this._element.setAttribute("playsinline", ""); + this._element.oncontextmenu = () => false; + document.body.appendChild(this._element); +}; + +Video._onLoad = function() { + this._element.volume = this._volume; + this._element.play(); + this._updateVisibility(true); + this._loading = false; +}; + +Video._onError = function() { + this._updateVisibility(false); + const retry = () => { + this._element.load(); + }; + throw ["LoadError", this._element.src, retry]; +}; + +Video._onEnd = function() { + this._updateVisibility(false); +}; + +Video._updateVisibility = function(videoVisible) { + if (videoVisible) { + Graphics.hideScreen(); + } else { + Graphics.showScreen(); + } + this._element.style.opacity = videoVisible ? 1 : 0; +}; + +Video._isVisible = function() { + return this._element.style.opacity > 0; +}; + +Video._setupEventHandlers = function() { + const onUserGesture = this._onUserGesture.bind(this); + document.addEventListener("keydown", onUserGesture); + document.addEventListener("mousedown", onUserGesture); + document.addEventListener("touchend", onUserGesture); +}; + +Video._onUserGesture = function() { + if (!this._element.src && this._element.paused) { + this._element.play().catch(() => 0); + } +}; + +//----------------------------------------------------------------------------- +/** + * The static class that handles input data from the keyboard and gamepads. + * + * @namespace + */ +function Input() { + throw new Error("This is a static class"); +} + +/** + * Initializes the input system. + */ +Input.initialize = function() { + this.clear(); + this._setupEventHandlers(); +}; + +/** + * The wait time of the key repeat in frames. + * + * @type number + */ +Input.keyRepeatWait = 24; + +/** + * The interval of the key repeat in frames. + * + * @type number + */ +Input.keyRepeatInterval = 6; + +/** + * A hash table to convert from a virtual key code to a mapped key name. + * + * @type Object + */ +Input.keyMapper = { + 9: "tab", // tab + 13: "ok", // enter + 16: "shift", // shift + 17: "control", // control + 18: "control", // alt + 27: "escape", // escape + 32: "ok", // space + 33: "pageup", // pageup + 34: "pagedown", // pagedown + 37: "left", // left arrow + 38: "up", // up arrow + 39: "right", // right arrow + 40: "down", // down arrow + 45: "escape", // insert + 81: "pageup", // Q + 87: "pagedown", // W + 88: "escape", // X + 90: "ok", // Z + 96: "escape", // numpad 0 + 98: "down", // numpad 2 + 100: "left", // numpad 4 + 102: "right", // numpad 6 + 104: "up", // numpad 8 + 120: "debug" // F9 +}; + +/** + * A hash table to convert from a gamepad button to a mapped key name. + * + * @type Object + */ +Input.gamepadMapper = { + 0: "ok", // A + 1: "cancel", // B + 2: "shift", // X + 3: "menu", // Y + 4: "pageup", // LB + 5: "pagedown", // RB + 12: "up", // D-pad up + 13: "down", // D-pad down + 14: "left", // D-pad left + 15: "right" // D-pad right +}; + +/** + * Clears all the input data. + */ +Input.clear = function() { + this._currentState = {}; + this._previousState = {}; + this._gamepadStates = []; + this._latestButton = null; + this._pressedTime = 0; + this._dir4 = 0; + this._dir8 = 0; + this._preferredAxis = ""; + this._date = 0; + this._virtualButton = null; +}; + +/** + * Updates the input data. + */ +Input.update = function() { + this._pollGamepads(); + if (this._currentState[this._latestButton]) { + this._pressedTime++; + } else { + this._latestButton = null; + } + for (const name in this._currentState) { + if (this._currentState[name] && !this._previousState[name]) { + this._latestButton = name; + this._pressedTime = 0; + this._date = Date.now(); + } + this._previousState[name] = this._currentState[name]; + } + if (this._virtualButton) { + this._latestButton = this._virtualButton; + this._pressedTime = 0; + this._virtualButton = null; + } + this._updateDirection(); +}; + +/** + * Checks whether a key is currently pressed down. + * + * @param {string} keyName - The mapped name of the key. + * @returns {boolean} True if the key is pressed. + */ +Input.isPressed = function(keyName) { + if (this._isEscapeCompatible(keyName) && this.isPressed("escape")) { + return true; + } else { + return !!this._currentState[keyName]; + } +}; + +/** + * Checks whether a key is just pressed. + * + * @param {string} keyName - The mapped name of the key. + * @returns {boolean} True if the key is triggered. + */ +Input.isTriggered = function(keyName) { + if (this._isEscapeCompatible(keyName) && this.isTriggered("escape")) { + return true; + } else { + return this._latestButton === keyName && this._pressedTime === 0; + } +}; + +/** + * Checks whether a key is just pressed or a key repeat occurred. + * + * @param {string} keyName - The mapped name of the key. + * @returns {boolean} True if the key is repeated. + */ +Input.isRepeated = function(keyName) { + if (this._isEscapeCompatible(keyName) && this.isRepeated("escape")) { + return true; + } else { + return ( + this._latestButton === keyName && + (this._pressedTime === 0 || + (this._pressedTime >= this.keyRepeatWait && + this._pressedTime % this.keyRepeatInterval === 0)) + ); + } +}; + +/** + * Checks whether a key is kept depressed. + * + * @param {string} keyName - The mapped name of the key. + * @returns {boolean} True if the key is long-pressed. + */ +Input.isLongPressed = function(keyName) { + if (this._isEscapeCompatible(keyName) && this.isLongPressed("escape")) { + return true; + } else { + return ( + this._latestButton === keyName && + this._pressedTime >= this.keyRepeatWait + ); + } +}; + +/** + * The four direction value as a number of the numpad, or 0 for neutral. + * + * @readonly + * @type number + * @name Input.dir4 + */ +Object.defineProperty(Input, "dir4", { + get: function() { + return this._dir4; + }, + configurable: true +}); + +/** + * The eight direction value as a number of the numpad, or 0 for neutral. + * + * @readonly + * @type number + * @name Input.dir8 + */ +Object.defineProperty(Input, "dir8", { + get: function() { + return this._dir8; + }, + configurable: true +}); + +/** + * The time of the last input in milliseconds. + * + * @readonly + * @type number + * @name Input.date + */ +Object.defineProperty(Input, "date", { + get: function() { + return this._date; + }, + configurable: true +}); + +Input.virtualClick = function(buttonName) { + this._virtualButton = buttonName; +}; + +Input._setupEventHandlers = function() { + document.addEventListener("keydown", this._onKeyDown.bind(this)); + document.addEventListener("keyup", this._onKeyUp.bind(this)); + window.addEventListener("blur", this._onLostFocus.bind(this)); +}; + +Input._onKeyDown = function(event) { + if (this._shouldPreventDefault(event.keyCode)) { + event.preventDefault(); + } + if (event.keyCode === 144) { + // Numlock + this.clear(); + } + const buttonName = this.keyMapper[event.keyCode]; + if (buttonName) { + this._currentState[buttonName] = true; + } +}; + +Input._shouldPreventDefault = function(keyCode) { + switch (keyCode) { + case 8: // backspace + case 9: // tab + case 33: // pageup + case 34: // pagedown + case 37: // left arrow + case 38: // up arrow + case 39: // right arrow + case 40: // down arrow + return true; + } + return false; +}; + +Input._onKeyUp = function(event) { + const buttonName = this.keyMapper[event.keyCode]; + if (buttonName) { + this._currentState[buttonName] = false; + } +}; + +Input._onLostFocus = function() { + this.clear(); +}; + +Input._pollGamepads = function() { + if (navigator.getGamepads) { + const gamepads = navigator.getGamepads(); + if (gamepads) { + for (const gamepad of gamepads) { + if (gamepad && gamepad.connected) { + this._updateGamepadState(gamepad); + } + } + } + } +}; + +Input._updateGamepadState = function(gamepad) { + const lastState = this._gamepadStates[gamepad.index] || []; + const newState = []; + const buttons = gamepad.buttons; + const axes = gamepad.axes; + const threshold = 0.5; + newState[12] = false; + newState[13] = false; + newState[14] = false; + newState[15] = false; + for (let i = 0; i < buttons.length; i++) { + newState[i] = buttons[i].pressed; + } + if (axes[1] < -threshold) { + newState[12] = true; // up + } else if (axes[1] > threshold) { + newState[13] = true; // down + } + if (axes[0] < -threshold) { + newState[14] = true; // left + } else if (axes[0] > threshold) { + newState[15] = true; // right + } + for (let j = 0; j < newState.length; j++) { + if (newState[j] !== lastState[j]) { + const buttonName = this.gamepadMapper[j]; + if (buttonName) { + this._currentState[buttonName] = newState[j]; + } + } + } + this._gamepadStates[gamepad.index] = newState; +}; + +Input._updateDirection = function() { + let x = this._signX(); + let y = this._signY(); + this._dir8 = this._makeNumpadDirection(x, y); + if (x !== 0 && y !== 0) { + if (this._preferredAxis === "x") { + y = 0; + } else { + x = 0; + } + } else if (x !== 0) { + this._preferredAxis = "y"; + } else if (y !== 0) { + this._preferredAxis = "x"; + } + this._dir4 = this._makeNumpadDirection(x, y); +}; + +Input._signX = function() { + const left = this.isPressed("left") ? 1 : 0; + const right = this.isPressed("right") ? 1 : 0; + return right - left; +}; + +Input._signY = function() { + const up = this.isPressed("up") ? 1 : 0; + const down = this.isPressed("down") ? 1 : 0; + return down - up; +}; + +Input._makeNumpadDirection = function(x, y) { + if (x === 0 && y === 0) { + return 0; + } else { + return 5 - y * 3 + x; + } +}; + +Input._isEscapeCompatible = function(keyName) { + return keyName === "cancel" || keyName === "menu"; +}; + +//----------------------------------------------------------------------------- +/** + * The static class that handles input data from the mouse and touchscreen. + * + * @namespace + */ +function TouchInput() { + throw new Error("This is a static class"); +} + +/** + * Initializes the touch system. + */ +TouchInput.initialize = function() { + this.clear(); + this._setupEventHandlers(); +}; + +/** + * The wait time of the pseudo key repeat in frames. + * + * @type number + */ +TouchInput.keyRepeatWait = 24; + +/** + * The interval of the pseudo key repeat in frames. + * + * @type number + */ +TouchInput.keyRepeatInterval = 6; + +/** + * The threshold number of pixels to treat as moved. + * + * @type number + */ +TouchInput.moveThreshold = 10; + +/** + * Clears all the touch data. + */ +TouchInput.clear = function() { + this._mousePressed = false; + this._screenPressed = false; + this._pressedTime = 0; + this._clicked = false; + this._newState = this._createNewState(); + this._currentState = this._createNewState(); + this._x = 0; + this._y = 0; + this._triggerX = 0; + this._triggerY = 0; + this._moved = false; + this._date = 0; +}; + +/** + * Updates the touch data. + */ +TouchInput.update = function() { + this._currentState = this._newState; + this._newState = this._createNewState(); + this._clicked = this._currentState.released && !this._moved; + if (this.isPressed()) { + this._pressedTime++; + } +}; + +/** + * Checks whether the mouse button or touchscreen has been pressed and + * released at the same position. + * + * @returns {boolean} True if the mouse button or touchscreen is clicked. + */ +TouchInput.isClicked = function() { + return this._clicked; +}; + +/** + * Checks whether the mouse button or touchscreen is currently pressed down. + * + * @returns {boolean} True if the mouse button or touchscreen is pressed. + */ +TouchInput.isPressed = function() { + return this._mousePressed || this._screenPressed; +}; + +/** + * Checks whether the left mouse button or touchscreen is just pressed. + * + * @returns {boolean} True if the mouse button or touchscreen is triggered. + */ +TouchInput.isTriggered = function() { + return this._currentState.triggered; +}; + +/** + * Checks whether the left mouse button or touchscreen is just pressed + * or a pseudo key repeat occurred. + * + * @returns {boolean} True if the mouse button or touchscreen is repeated. + */ +TouchInput.isRepeated = function() { + return ( + this.isPressed() && + (this._currentState.triggered || + (this._pressedTime >= this.keyRepeatWait && + this._pressedTime % this.keyRepeatInterval === 0)) + ); +}; + +/** + * Checks whether the left mouse button or touchscreen is kept depressed. + * + * @returns {boolean} True if the left mouse button or touchscreen is long-pressed. + */ +TouchInput.isLongPressed = function() { + return this.isPressed() && this._pressedTime >= this.keyRepeatWait; +}; + +/** + * Checks whether the right mouse button is just pressed. + * + * @returns {boolean} True if the right mouse button is just pressed. + */ +TouchInput.isCancelled = function() { + return this._currentState.cancelled; +}; + +/** + * Checks whether the mouse or a finger on the touchscreen is moved. + * + * @returns {boolean} True if the mouse or a finger on the touchscreen is moved. + */ +TouchInput.isMoved = function() { + return this._currentState.moved; +}; + +/** + * Checks whether the mouse is moved without pressing a button. + * + * @returns {boolean} True if the mouse is hovered. + */ +TouchInput.isHovered = function() { + return this._currentState.hovered; +}; + +/** + * Checks whether the left mouse button or touchscreen is released. + * + * @returns {boolean} True if the mouse button or touchscreen is released. + */ +TouchInput.isReleased = function() { + return this._currentState.released; +}; + +/** + * The horizontal scroll amount. + * + * @readonly + * @type number + * @name TouchInput.wheelX + */ +Object.defineProperty(TouchInput, "wheelX", { + get: function() { + return this._currentState.wheelX; + }, + configurable: true +}); + +/** + * The vertical scroll amount. + * + * @readonly + * @type number + * @name TouchInput.wheelY + */ +Object.defineProperty(TouchInput, "wheelY", { + get: function() { + return this._currentState.wheelY; + }, + configurable: true +}); + +/** + * The x coordinate on the canvas area of the latest touch event. + * + * @readonly + * @type number + * @name TouchInput.x + */ +Object.defineProperty(TouchInput, "x", { + get: function() { + return this._x; + }, + configurable: true +}); + +/** + * The y coordinate on the canvas area of the latest touch event. + * + * @readonly + * @type number + * @name TouchInput.y + */ +Object.defineProperty(TouchInput, "y", { + get: function() { + return this._y; + }, + configurable: true +}); + +/** + * The time of the last input in milliseconds. + * + * @readonly + * @type number + * @name TouchInput.date + */ +Object.defineProperty(TouchInput, "date", { + get: function() { + return this._date; + }, + configurable: true +}); + +TouchInput._createNewState = function() { + return { + triggered: false, + cancelled: false, + moved: false, + hovered: false, + released: false, + wheelX: 0, + wheelY: 0 + }; +}; + +TouchInput._setupEventHandlers = function() { + const pf = { passive: false }; + document.addEventListener("mousedown", this._onMouseDown.bind(this)); + document.addEventListener("mousemove", this._onMouseMove.bind(this)); + document.addEventListener("mouseup", this._onMouseUp.bind(this)); + document.addEventListener("wheel", this._onWheel.bind(this), pf); + document.addEventListener("touchstart", this._onTouchStart.bind(this), pf); + document.addEventListener("touchmove", this._onTouchMove.bind(this), pf); + document.addEventListener("touchend", this._onTouchEnd.bind(this)); + document.addEventListener("touchcancel", this._onTouchCancel.bind(this)); + window.addEventListener("blur", this._onLostFocus.bind(this)); +}; + +TouchInput._onMouseDown = function(event) { + if (event.button === 0) { + this._onLeftButtonDown(event); + } else if (event.button === 1) { + this._onMiddleButtonDown(event); + } else if (event.button === 2) { + this._onRightButtonDown(event); + } +}; + +TouchInput._onLeftButtonDown = function(event) { + const x = Graphics.pageToCanvasX(event.pageX); + const y = Graphics.pageToCanvasY(event.pageY); + if (Graphics.isInsideCanvas(x, y)) { + this._mousePressed = true; + this._pressedTime = 0; + this._onTrigger(x, y); + } +}; + +TouchInput._onMiddleButtonDown = function(/*event*/) { + // +}; + +TouchInput._onRightButtonDown = function(event) { + const x = Graphics.pageToCanvasX(event.pageX); + const y = Graphics.pageToCanvasY(event.pageY); + if (Graphics.isInsideCanvas(x, y)) { + this._onCancel(x, y); + } +}; + +TouchInput._onMouseMove = function(event) { + const x = Graphics.pageToCanvasX(event.pageX); + const y = Graphics.pageToCanvasY(event.pageY); + if (this._mousePressed) { + this._onMove(x, y); + } else if (Graphics.isInsideCanvas(x, y)) { + this._onHover(x, y); + } +}; + +TouchInput._onMouseUp = function(event) { + if (event.button === 0) { + const x = Graphics.pageToCanvasX(event.pageX); + const y = Graphics.pageToCanvasY(event.pageY); + this._mousePressed = false; + this._onRelease(x, y); + } +}; + +TouchInput._onWheel = function(event) { + this._newState.wheelX += event.deltaX; + this._newState.wheelY += event.deltaY; + event.preventDefault(); +}; + +TouchInput._onTouchStart = function(event) { + for (const touch of event.changedTouches) { + const x = Graphics.pageToCanvasX(touch.pageX); + const y = Graphics.pageToCanvasY(touch.pageY); + if (Graphics.isInsideCanvas(x, y)) { + this._screenPressed = true; + this._pressedTime = 0; + if (event.touches.length >= 2) { + this._onCancel(x, y); + } else { + this._onTrigger(x, y); + } + event.preventDefault(); + } + } + if (window.cordova || window.navigator.standalone) { + event.preventDefault(); + } +}; + +TouchInput._onTouchMove = function(event) { + for (const touch of event.changedTouches) { + const x = Graphics.pageToCanvasX(touch.pageX); + const y = Graphics.pageToCanvasY(touch.pageY); + this._onMove(x, y); + } +}; + +TouchInput._onTouchEnd = function(event) { + for (const touch of event.changedTouches) { + const x = Graphics.pageToCanvasX(touch.pageX); + const y = Graphics.pageToCanvasY(touch.pageY); + this._screenPressed = false; + this._onRelease(x, y); + } +}; + +TouchInput._onTouchCancel = function(/*event*/) { + this._screenPressed = false; +}; + +TouchInput._onLostFocus = function() { + this.clear(); +}; + +TouchInput._onTrigger = function(x, y) { + this._newState.triggered = true; + this._x = x; + this._y = y; + this._triggerX = x; + this._triggerY = y; + this._moved = false; + this._date = Date.now(); +}; + +TouchInput._onCancel = function(x, y) { + this._newState.cancelled = true; + this._x = x; + this._y = y; +}; + +TouchInput._onMove = function(x, y) { + const dx = Math.abs(x - this._triggerX); + const dy = Math.abs(y - this._triggerY); + if (dx > this.moveThreshold || dy > this.moveThreshold) { + this._moved = true; + } + if (this._moved) { + this._newState.moved = true; + this._x = x; + this._y = y; + } +}; + +TouchInput._onHover = function(x, y) { + this._newState.hovered = true; + this._x = x; + this._y = y; +}; + +TouchInput._onRelease = function(x, y) { + this._newState.released = true; + this._x = x; + this._y = y; +}; + +//----------------------------------------------------------------------------- +/** + * The static class that handles JSON with object information. + * + * @namespace + */ +function JsonEx() { + throw new Error("This is a static class"); +} + +/** + * The maximum depth of objects. + * + * @type number + * @default 100 + */ +JsonEx.maxDepth = 100; + +/** + * Converts an object to a JSON string with object information. + * + * @param {object} object - The object to be converted. + * @returns {string} The JSON string. + */ +JsonEx.stringify = function(object) { + return JSON.stringify(this._encode(object, 0)); +}; + +/** + * Parses a JSON string and reconstructs the corresponding object. + * + * @param {string} json - The JSON string. + * @returns {object} The reconstructed object. + */ +JsonEx.parse = function(json) { + return this._decode(JSON.parse(json)); +}; + +/** + * Makes a deep copy of the specified object. + * + * @param {object} object - The object to be copied. + * @returns {object} The copied object. + */ +JsonEx.makeDeepCopy = function(object) { + return this.parse(this.stringify(object)); +}; + +JsonEx._encode = function(value, depth) { + // [Note] The handling code for circular references in certain versions of + // MV has been removed because it was too complicated and expensive. + if (depth >= this.maxDepth) { + throw new Error("Object too deep"); + } + const type = Object.prototype.toString.call(value); + if (type === "[object Object]" || type === "[object Array]") { + const constructorName = value.constructor.name; + if (constructorName !== "Object" && constructorName !== "Array") { + value["@"] = constructorName; + } + for (const key of Object.keys(value)) { + value[key] = this._encode(value[key], depth + 1); + } + } + return value; +}; + +JsonEx._decode = function(value) { + const type = Object.prototype.toString.call(value); + if (type === "[object Object]" || type === "[object Array]") { + if (value["@"]) { + const constructor = window[value["@"]]; + if (constructor) { + Object.setPrototypeOf(value, constructor.prototype); + } + } + for (const key of Object.keys(value)) { + value[key] = this._decode(value[key]); + } + } + return value; +}; + +//----------------------------------------------------------------------------- diff --git a/js/rmmz_managers.js b/js/rmmz_managers.js new file mode 100644 index 0000000..eafd88a --- /dev/null +++ b/js/rmmz_managers.js @@ -0,0 +1,3128 @@ +//============================================================================= +// rmmz_managers.js v1.8.1 +//============================================================================= + +//----------------------------------------------------------------------------- +// DataManager +// +// The static class that manages the database and game objects. + +function DataManager() { + throw new Error("This is a static class"); +} + +$dataActors = null; +$dataClasses = null; +$dataSkills = null; +$dataItems = null; +$dataWeapons = null; +$dataArmors = null; +$dataEnemies = null; +$dataTroops = null; +$dataStates = null; +$dataAnimations = null; +$dataTilesets = null; +$dataCommonEvents = null; +$dataSystem = null; +$dataMapInfos = null; +$dataMap = null; +$gameTemp = null; +$gameSystem = null; +$gameScreen = null; +$gameTimer = null; +$gameMessage = null; +$gameSwitches = null; +$gameVariables = null; +$gameSelfSwitches = null; +$gameActors = null; +$gameParty = null; +$gameTroop = null; +$gameMap = null; +$gamePlayer = null; +$testEvent = null; + +DataManager._globalInfo = null; +DataManager._errors = []; + +DataManager._databaseFiles = [ + { name: "$dataActors", src: "Actors.json" }, + { name: "$dataClasses", src: "Classes.json" }, + { name: "$dataSkills", src: "Skills.json" }, + { name: "$dataItems", src: "Items.json" }, + { name: "$dataWeapons", src: "Weapons.json" }, + { name: "$dataArmors", src: "Armors.json" }, + { name: "$dataEnemies", src: "Enemies.json" }, + { name: "$dataTroops", src: "Troops.json" }, + { name: "$dataStates", src: "States.json" }, + { name: "$dataAnimations", src: "Animations.json" }, + { name: "$dataTilesets", src: "Tilesets.json" }, + { name: "$dataCommonEvents", src: "CommonEvents.json" }, + { name: "$dataSystem", src: "System.json" }, + { name: "$dataMapInfos", src: "MapInfos.json" } +]; + +DataManager.loadGlobalInfo = function() { + StorageManager.loadObject("global") + .then(globalInfo => { + this._globalInfo = globalInfo; + this.removeInvalidGlobalInfo(); + return 0; + }) + .catch(() => { + this._globalInfo = []; + }); +}; + +DataManager.removeInvalidGlobalInfo = function() { + const globalInfo = this._globalInfo; + for (const info of globalInfo) { + const savefileId = globalInfo.indexOf(info); + if (!this.savefileExists(savefileId)) { + delete globalInfo[savefileId]; + } + } +}; + +DataManager.saveGlobalInfo = function() { + StorageManager.saveObject("global", this._globalInfo); +}; + +DataManager.isGlobalInfoLoaded = function() { + return !!this._globalInfo; +}; + +DataManager.loadDatabase = function() { + const test = this.isBattleTest() || this.isEventTest(); + const prefix = test ? "Test_" : ""; + for (const databaseFile of this._databaseFiles) { + this.loadDataFile(databaseFile.name, prefix + databaseFile.src); + } + if (this.isEventTest()) { + this.loadDataFile("$testEvent", prefix + "Event.json"); + } +}; + +DataManager.loadDataFile = function(name, src) { + const xhr = new XMLHttpRequest(); + const url = "data/" + src; + window[name] = null; + xhr.open("GET", url); + xhr.overrideMimeType("application/json"); + xhr.onload = () => this.onXhrLoad(xhr, name, src, url); + xhr.onerror = () => this.onXhrError(name, src, url); + xhr.send(); +}; + +DataManager.onXhrLoad = function(xhr, name, src, url) { + if (xhr.status < 400) { + window[name] = JSON.parse(xhr.responseText); + this.onLoad(window[name]); + } else { + this.onXhrError(name, src, url); + } +}; + +DataManager.onXhrError = function(name, src, url) { + const error = { name: name, src: src, url: url }; + this._errors.push(error); +}; + +DataManager.isDatabaseLoaded = function() { + this.checkError(); + for (const databaseFile of this._databaseFiles) { + if (!window[databaseFile.name]) { + return false; + } + } + return true; +}; + +DataManager.loadMapData = function(mapId) { + if (mapId > 0) { + const filename = "Map%1.json".format(mapId.padZero(3)); + this.loadDataFile("$dataMap", filename); + } else { + this.makeEmptyMap(); + } +}; + +DataManager.makeEmptyMap = function() { + $dataMap = {}; + $dataMap.data = []; + $dataMap.events = []; + $dataMap.width = 100; + $dataMap.height = 100; + $dataMap.scrollType = 3; +}; + +DataManager.isMapLoaded = function() { + this.checkError(); + return !!$dataMap; +}; + +DataManager.onLoad = function(object) { + if (this.isMapObject(object)) { + this.extractMetadata(object); + this.extractArrayMetadata(object.events); + } else { + this.extractArrayMetadata(object); + } +}; + +DataManager.isMapObject = function(object) { + return !!(object.data && object.events); +}; + +DataManager.extractArrayMetadata = function(array) { + if (Array.isArray(array)) { + for (const data of array) { + if (data && "note" in data) { + this.extractMetadata(data); + } + } + } +}; + +DataManager.extractMetadata = function(data) { + const regExp = /<([^<>:]+)(:?)([^>]*)>/g; + data.meta = {}; + for (;;) { + const match = regExp.exec(data.note); + if (match) { + if (match[2] === ":") { + data.meta[match[1]] = match[3]; + } else { + data.meta[match[1]] = true; + } + } else { + break; + } + } +}; + +DataManager.checkError = function() { + if (this._errors.length > 0) { + const error = this._errors.shift(); + const retry = () => { + this.loadDataFile(error.name, error.src); + }; + throw ["LoadError", error.url, retry]; + } +}; + +DataManager.isBattleTest = function() { + return Utils.isOptionValid("btest"); +}; + +DataManager.isEventTest = function() { + return Utils.isOptionValid("etest"); +}; + +DataManager.isTitleSkip = function() { + return Utils.isOptionValid("tskip"); +}; + +DataManager.isSkill = function(item) { + return item && $dataSkills.includes(item); +}; + +DataManager.isItem = function(item) { + return item && $dataItems.includes(item); +}; + +DataManager.isWeapon = function(item) { + return item && $dataWeapons.includes(item); +}; + +DataManager.isArmor = function(item) { + return item && $dataArmors.includes(item); +}; + +DataManager.createGameObjects = function() { + $gameTemp = new Game_Temp(); + $gameSystem = new Game_System(); + $gameScreen = new Game_Screen(); + $gameTimer = new Game_Timer(); + $gameMessage = new Game_Message(); + $gameSwitches = new Game_Switches(); + $gameVariables = new Game_Variables(); + $gameSelfSwitches = new Game_SelfSwitches(); + $gameActors = new Game_Actors(); + $gameParty = new Game_Party(); + $gameTroop = new Game_Troop(); + $gameMap = new Game_Map(); + $gamePlayer = new Game_Player(); +}; + +DataManager.setupNewGame = function() { + this.createGameObjects(); + this.selectSavefileForNewGame(); + $gameParty.setupStartingMembers(); + $gamePlayer.setupForNewGame(); + Graphics.frameCount = 0; +}; + +DataManager.setupBattleTest = function() { + this.createGameObjects(); + $gameParty.setupBattleTest(); + BattleManager.setup($dataSystem.testTroopId, true, false); + BattleManager.setBattleTest(true); + BattleManager.playBattleBgm(); +}; + +DataManager.setupEventTest = function() { + this.createGameObjects(); + this.selectSavefileForNewGame(); + $gameParty.setupStartingMembers(); + $gamePlayer.reserveTransfer(-1, 8, 6); + $gamePlayer.setTransparent(false); +}; + +DataManager.isAnySavefileExists = function() { + return this._globalInfo.some(x => x); +}; + +DataManager.latestSavefileId = function() { + const globalInfo = this._globalInfo; + const validInfo = globalInfo.slice(1).filter(x => x); + const latest = Math.max(...validInfo.map(x => x.timestamp)); + const index = globalInfo.findIndex(x => x && x.timestamp === latest); + return index > 0 ? index : 0; +}; + +DataManager.earliestSavefileId = function() { + const globalInfo = this._globalInfo; + const validInfo = globalInfo.slice(1).filter(x => x); + const earliest = Math.min(...validInfo.map(x => x.timestamp)); + const index = globalInfo.findIndex(x => x && x.timestamp === earliest); + return index > 0 ? index : 0; +}; + +DataManager.emptySavefileId = function() { + const globalInfo = this._globalInfo; + const maxSavefiles = this.maxSavefiles(); + if (globalInfo.length < maxSavefiles) { + return Math.max(1, globalInfo.length); + } else { + const index = globalInfo.slice(1).findIndex(x => !x); + return index >= 0 ? index + 1 : -1; + } +}; + +DataManager.loadAllSavefileImages = function() { + for (const info of this._globalInfo.filter(x => x)) { + this.loadSavefileImages(info); + } +}; + +DataManager.loadSavefileImages = function(info) { + if (info.characters && Symbol.iterator in info.characters) { + for (const character of info.characters) { + ImageManager.loadCharacter(character[0]); + } + } + if (info.faces && Symbol.iterator in info.faces) { + for (const face of info.faces) { + ImageManager.loadFace(face[0]); + } + } +}; + +DataManager.maxSavefiles = function() { + return 20; +}; + +DataManager.savefileInfo = function(savefileId) { + const globalInfo = this._globalInfo; + return globalInfo[savefileId] ? globalInfo[savefileId] : null; +}; + +DataManager.savefileExists = function(savefileId) { + const saveName = this.makeSavename(savefileId); + return StorageManager.exists(saveName); +}; + +DataManager.saveGame = function(savefileId) { + const contents = this.makeSaveContents(); + const saveName = this.makeSavename(savefileId); + return StorageManager.saveObject(saveName, contents).then(() => { + this._globalInfo[savefileId] = this.makeSavefileInfo(); + this.saveGlobalInfo(); + return 0; + }); +}; + +DataManager.loadGame = function(savefileId) { + const saveName = this.makeSavename(savefileId); + return StorageManager.loadObject(saveName).then(contents => { + this.createGameObjects(); + this.extractSaveContents(contents); + this.correctDataErrors(); + return 0; + }); +}; + +DataManager.makeSavename = function(savefileId) { + return "file%1".format(savefileId); +}; + +DataManager.selectSavefileForNewGame = function() { + const emptySavefileId = this.emptySavefileId(); + const earliestSavefileId = this.earliestSavefileId(); + if (emptySavefileId > 0) { + $gameSystem.setSavefileId(emptySavefileId); + } else { + $gameSystem.setSavefileId(earliestSavefileId); + } +}; + +DataManager.makeSavefileInfo = function() { + const info = {}; + info.title = $dataSystem.gameTitle; + info.characters = $gameParty.charactersForSavefile(); + info.faces = $gameParty.facesForSavefile(); + info.playtime = $gameSystem.playtimeText(); + info.timestamp = Date.now(); + return info; +}; + +DataManager.makeSaveContents = function() { + // A save data does not contain $gameTemp, $gameMessage, and $gameTroop. + const contents = {}; + contents.system = $gameSystem; + contents.screen = $gameScreen; + contents.timer = $gameTimer; + contents.switches = $gameSwitches; + contents.variables = $gameVariables; + contents.selfSwitches = $gameSelfSwitches; + contents.actors = $gameActors; + contents.party = $gameParty; + contents.map = $gameMap; + contents.player = $gamePlayer; + return contents; +}; + +DataManager.extractSaveContents = function(contents) { + $gameSystem = contents.system; + $gameScreen = contents.screen; + $gameTimer = contents.timer; + $gameSwitches = contents.switches; + $gameVariables = contents.variables; + $gameSelfSwitches = contents.selfSwitches; + $gameActors = contents.actors; + $gameParty = contents.party; + $gameMap = contents.map; + $gamePlayer = contents.player; +}; + +DataManager.correctDataErrors = function() { + $gameParty.removeInvalidMembers(); +}; + +//----------------------------------------------------------------------------- +// ConfigManager +// +// The static class that manages the configuration data. + +function ConfigManager() { + throw new Error("This is a static class"); +} + +ConfigManager.alwaysDash = false; +ConfigManager.commandRemember = false; +ConfigManager.touchUI = true; +ConfigManager._isLoaded = false; + +Object.defineProperty(ConfigManager, "bgmVolume", { + get: function() { + return AudioManager._bgmVolume; + }, + set: function(value) { + AudioManager.bgmVolume = value; + }, + configurable: true +}); + +Object.defineProperty(ConfigManager, "bgsVolume", { + get: function() { + return AudioManager.bgsVolume; + }, + set: function(value) { + AudioManager.bgsVolume = value; + }, + configurable: true +}); + +Object.defineProperty(ConfigManager, "meVolume", { + get: function() { + return AudioManager.meVolume; + }, + set: function(value) { + AudioManager.meVolume = value; + }, + configurable: true +}); + +Object.defineProperty(ConfigManager, "seVolume", { + get: function() { + return AudioManager.seVolume; + }, + set: function(value) { + AudioManager.seVolume = value; + }, + configurable: true +}); + +ConfigManager.load = function() { + StorageManager.loadObject("config") + .then(config => this.applyData(config || {})) + .catch(() => 0) + .then(() => { + this._isLoaded = true; + return 0; + }) + .catch(() => 0); +}; + +ConfigManager.save = function() { + StorageManager.saveObject("config", this.makeData()); +}; + +ConfigManager.isLoaded = function() { + return this._isLoaded; +}; + +ConfigManager.makeData = function() { + const config = {}; + config.alwaysDash = this.alwaysDash; + config.commandRemember = this.commandRemember; + config.touchUI = this.touchUI; + config.bgmVolume = this.bgmVolume; + config.bgsVolume = this.bgsVolume; + config.meVolume = this.meVolume; + config.seVolume = this.seVolume; + return config; +}; + +ConfigManager.applyData = function(config) { + this.alwaysDash = this.readFlag(config, "alwaysDash", false); + this.commandRemember = this.readFlag(config, "commandRemember", false); + this.touchUI = this.readFlag(config, "touchUI", true); + this.bgmVolume = this.readVolume(config, "bgmVolume"); + this.bgsVolume = this.readVolume(config, "bgsVolume"); + this.meVolume = this.readVolume(config, "meVolume"); + this.seVolume = this.readVolume(config, "seVolume"); +}; + +ConfigManager.readFlag = function(config, name, defaultValue) { + if (name in config) { + return !!config[name]; + } else { + return defaultValue; + } +}; + +ConfigManager.readVolume = function(config, name) { + if (name in config) { + return Number(config[name]).clamp(0, 100); + } else { + return 100; + } +}; + +//----------------------------------------------------------------------------- +// StorageManager +// +// The static class that manages storage for saving game data. + +function StorageManager() { + throw new Error("This is a static class"); +} + +StorageManager._forageKeys = []; +StorageManager._forageKeysUpdated = false; + +StorageManager.isLocalMode = function() { + return Utils.isNwjs(); +}; + +StorageManager.saveObject = function(saveName, object) { + return this.objectToJson(object) + .then(json => this.jsonToZip(json)) + .then(zip => this.saveZip(saveName, zip)); +}; + +StorageManager.loadObject = function(saveName) { + return this.loadZip(saveName) + .then(zip => this.zipToJson(zip)) + .then(json => this.jsonToObject(json)); +}; + +StorageManager.objectToJson = function(object) { + return new Promise((resolve, reject) => { + try { + const json = JsonEx.stringify(object); + resolve(json); + } catch (e) { + reject(e); + } + }); +}; + +StorageManager.jsonToObject = function(json) { + return new Promise((resolve, reject) => { + try { + const object = JsonEx.parse(json); + resolve(object); + } catch (e) { + reject(e); + } + }); +}; + +StorageManager.jsonToZip = function(json) { + return new Promise((resolve, reject) => { + try { + const zip = pako.deflate(json, { to: "string", level: 1 }); + if (zip.length >= 50000) { + console.warn("Save data is too big."); + } + resolve(zip); + } catch (e) { + reject(e); + } + }); +}; + +StorageManager.zipToJson = function(zip) { + return new Promise((resolve, reject) => { + try { + if (zip) { + const json = pako.inflate(zip, { to: "string" }); + resolve(json); + } else { + resolve("null"); + } + } catch (e) { + reject(e); + } + }); +}; + +StorageManager.saveZip = function(saveName, zip) { + if (this.isLocalMode()) { + return this.saveToLocalFile(saveName, zip); + } else { + return this.saveToForage(saveName, zip); + } +}; + +StorageManager.loadZip = function(saveName) { + if (this.isLocalMode()) { + return this.loadFromLocalFile(saveName); + } else { + return this.loadFromForage(saveName); + } +}; + +StorageManager.exists = function(saveName) { + if (this.isLocalMode()) { + return this.localFileExists(saveName); + } else { + return this.forageExists(saveName); + } +}; + +StorageManager.remove = function(saveName) { + if (this.isLocalMode()) { + return this.removeLocalFile(saveName); + } else { + return this.removeForage(saveName); + } +}; + +StorageManager.saveToLocalFile = function(saveName, zip) { + const dirPath = this.fileDirectoryPath(); + const filePath = this.filePath(saveName); + const backupFilePath = filePath + "_"; + return new Promise((resolve, reject) => { + this.fsMkdir(dirPath); + this.fsUnlink(backupFilePath); + this.fsRename(filePath, backupFilePath); + try { + this.fsWriteFile(filePath, zip); + this.fsUnlink(backupFilePath); + resolve(); + } catch (e) { + try { + this.fsUnlink(filePath); + this.fsRename(backupFilePath, filePath); + } catch (e2) { + // + } + reject(e); + } + }); +}; + +StorageManager.loadFromLocalFile = function(saveName) { + const filePath = this.filePath(saveName); + return new Promise((resolve, reject) => { + const data = this.fsReadFile(filePath); + if (data) { + resolve(data); + } else { + reject(new Error("Savefile not found")); + } + }); +}; + +StorageManager.localFileExists = function(saveName) { + const fs = require("fs"); + return fs.existsSync(this.filePath(saveName)); +}; + +StorageManager.removeLocalFile = function(saveName) { + this.fsUnlink(this.filePath(saveName)); +}; + +StorageManager.saveToForage = function(saveName, zip) { + const key = this.forageKey(saveName); + const testKey = this.forageTestKey(); + setTimeout(() => localforage.removeItem(testKey)); + return localforage + .setItem(testKey, zip) + .then(() => localforage.setItem(key, zip)) + .then(() => this.updateForageKeys()); +}; + +StorageManager.loadFromForage = function(saveName) { + const key = this.forageKey(saveName); + return localforage.getItem(key); +}; + +StorageManager.forageExists = function(saveName) { + const key = this.forageKey(saveName); + return this._forageKeys.includes(key); +}; + +StorageManager.removeForage = function(saveName) { + const key = this.forageKey(saveName); + return localforage.removeItem(key).then(() => this.updateForageKeys()); +}; + +StorageManager.updateForageKeys = function() { + this._forageKeysUpdated = false; + return localforage.keys().then(keys => { + this._forageKeys = keys; + this._forageKeysUpdated = true; + return 0; + }); +}; + +StorageManager.forageKeysUpdated = function() { + return this._forageKeysUpdated; +}; + +StorageManager.fsMkdir = function(path) { + const fs = require("fs"); + if (!fs.existsSync(path)) { + fs.mkdirSync(path); + } +}; + +StorageManager.fsRename = function(oldPath, newPath) { + const fs = require("fs"); + if (fs.existsSync(oldPath)) { + fs.renameSync(oldPath, newPath); + } +}; + +StorageManager.fsUnlink = function(path) { + const fs = require("fs"); + if (fs.existsSync(path)) { + fs.unlinkSync(path); + } +}; + +StorageManager.fsReadFile = function(path) { + const fs = require("fs"); + if (fs.existsSync(path)) { + return fs.readFileSync(path, { encoding: "utf8" }); + } else { + return null; + } +}; + +StorageManager.fsWriteFile = function(path, data) { + const fs = require("fs"); + fs.writeFileSync(path, data); +}; + +StorageManager.fileDirectoryPath = function() { + const path = require("path"); + const base = path.dirname(process.mainModule.filename); + return path.join(base, "save/"); +}; + +StorageManager.filePath = function(saveName) { + const dir = this.fileDirectoryPath(); + return dir + saveName + ".rmmzsave"; +}; + +StorageManager.forageKey = function(saveName) { + const gameId = $dataSystem.advanced.gameId; + return "rmmzsave." + gameId + "." + saveName; +}; + +StorageManager.forageTestKey = function() { + return "rmmzsave.test"; +}; + +//----------------------------------------------------------------------------- +// FontManager +// +// The static class that loads font files. + +function FontManager() { + throw new Error("This is a static class"); +} + +FontManager._urls = {}; +FontManager._states = {}; + +FontManager.load = function(family, filename) { + if (this._states[family] !== "loaded") { + if (filename) { + const url = this.makeUrl(filename); + this.startLoading(family, url); + } else { + this._urls[family] = ""; + this._states[family] = "loaded"; + } + } +}; + +FontManager.isReady = function() { + for (const family in this._states) { + const state = this._states[family]; + if (state === "loading") { + return false; + } + if (state === "error") { + this.throwLoadError(family); + } + } + return true; +}; + +FontManager.startLoading = function(family, url) { + const source = "url(" + url + ")"; + const font = new FontFace(family, source); + this._urls[family] = url; + this._states[family] = "loading"; + font.load() + .then(() => { + document.fonts.add(font); + this._states[family] = "loaded"; + return 0; + }) + .catch(() => { + this._states[family] = "error"; + }); +}; + +FontManager.throwLoadError = function(family) { + const url = this._urls[family]; + const retry = () => this.startLoading(family, url); + throw ["LoadError", url, retry]; +}; + +FontManager.makeUrl = function(filename) { + return "fonts/" + Utils.encodeURI(filename); +}; + +//----------------------------------------------------------------------------- +// ImageManager +// +// The static class that loads images, creates bitmap objects and retains them. + +function ImageManager() { + throw new Error("This is a static class"); +} + +ImageManager.iconWidth = 32; +ImageManager.iconHeight = 32; +ImageManager.faceWidth = 144; +ImageManager.faceHeight = 144; + +ImageManager._cache = {}; +ImageManager._system = {}; +ImageManager._emptyBitmap = new Bitmap(1, 1); + +ImageManager.loadAnimation = function(filename) { + return this.loadBitmap("img/animations/", filename); +}; + +ImageManager.loadBattleback1 = function(filename) { + return this.loadBitmap("img/battlebacks1/", filename); +}; + +ImageManager.loadBattleback2 = function(filename) { + return this.loadBitmap("img/battlebacks2/", filename); +}; + +ImageManager.loadEnemy = function(filename) { + return this.loadBitmap("img/enemies/", filename); +}; + +ImageManager.loadCharacter = function(filename) { + return this.loadBitmap("img/characters/", filename); +}; + +ImageManager.loadFace = function(filename) { + return this.loadBitmap("img/faces/", filename); +}; + +ImageManager.loadParallax = function(filename) { + return this.loadBitmap("img/parallaxes/", filename); +}; + +ImageManager.loadPicture = function(filename) { + return this.loadBitmap("img/pictures/", filename); +}; + +ImageManager.loadSvActor = function(filename) { + return this.loadBitmap("img/sv_actors/", filename); +}; + +ImageManager.loadSvEnemy = function(filename) { + return this.loadBitmap("img/sv_enemies/", filename); +}; + +ImageManager.loadSystem = function(filename) { + return this.loadBitmap("img/system/", filename); +}; + +ImageManager.loadTileset = function(filename) { + return this.loadBitmap("img/tilesets/", filename); +}; + +ImageManager.loadTitle1 = function(filename) { + return this.loadBitmap("img/titles1/", filename); +}; + +ImageManager.loadTitle2 = function(filename) { + return this.loadBitmap("img/titles2/", filename); +}; + +ImageManager.loadBitmap = function(folder, filename) { + if (filename) { + const url = folder + Utils.encodeURI(filename) + ".png"; + return this.loadBitmapFromUrl(url); + } else { + return this._emptyBitmap; + } +}; + +ImageManager.loadBitmapFromUrl = function(url) { + const cache = url.includes("/system/") ? this._system : this._cache; + if (!cache[url]) { + cache[url] = Bitmap.load(url); + } + return cache[url]; +}; + +ImageManager.clear = function() { + const cache = this._cache; + for (const url in cache) { + cache[url].destroy(); + } + this._cache = {}; +}; + +ImageManager.isReady = function() { + for (const cache of [this._cache, this._system]) { + for (const url in cache) { + const bitmap = cache[url]; + if (bitmap.isError()) { + this.throwLoadError(bitmap); + } + if (!bitmap.isReady()) { + return false; + } + } + } + return true; +}; + +ImageManager.throwLoadError = function(bitmap) { + const retry = bitmap.retry.bind(bitmap); + throw ["LoadError", bitmap.url, retry]; +}; + +ImageManager.isObjectCharacter = function(filename) { + const sign = Utils.extractFileName(filename).match(/^[!$]+/); + return sign && sign[0].includes("!"); +}; + +ImageManager.isBigCharacter = function(filename) { + const sign = Utils.extractFileName(filename).match(/^[!$]+/); + return sign && sign[0].includes("$"); +}; + +ImageManager.isZeroParallax = function(filename) { + return Utils.extractFileName(filename).charAt(0) === "!"; +}; + +//----------------------------------------------------------------------------- +// EffectManager +// +// The static class that loads Effekseer effects. + +function EffectManager() { + throw new Error("This is a static class"); +} + +EffectManager._cache = {}; +EffectManager._errorUrls = []; + +EffectManager.load = function(filename) { + if (filename) { + const url = this.makeUrl(filename); + const cache = this._cache; + if (!cache[url] && Graphics.effekseer) { + this.startLoading(url); + } + return cache[url]; + } else { + return null; + } +}; + +EffectManager.startLoading = function(url) { + const onLoad = () => this.onLoad(url); + const onError = (message, url) => this.onError(url); + const effect = Graphics.effekseer.loadEffect(url, 1, onLoad, onError); + this._cache[url] = effect; + return effect; +}; + +EffectManager.clear = function() { + for (const url in this._cache) { + const effect = this._cache[url]; + Graphics.effekseer.releaseEffect(effect); + } + this._cache = {}; +}; + +EffectManager.onLoad = function(/*url*/) { + // +}; + +EffectManager.onError = function(url) { + this._errorUrls.push(url); +}; + +EffectManager.makeUrl = function(filename) { + return "effects/" + Utils.encodeURI(filename) + ".efkefc"; +}; + +EffectManager.checkErrors = function() { + const url = this._errorUrls.shift(); + if (url) { + this.throwLoadError(url); + } +}; + +EffectManager.throwLoadError = function(url) { + const retry = () => this.startLoading(url); + throw ["LoadError", url, retry]; +}; + +EffectManager.isReady = function() { + this.checkErrors(); + for (const url in this._cache) { + const effect = this._cache[url]; + if (!effect.isLoaded) { + return false; + } + } + return true; +}; + +//----------------------------------------------------------------------------- +// AudioManager +// +// The static class that handles BGM, BGS, ME and SE. + +function AudioManager() { + throw new Error("This is a static class"); +} + +AudioManager._bgmVolume = 100; +AudioManager._bgsVolume = 100; +AudioManager._meVolume = 100; +AudioManager._seVolume = 100; +AudioManager._currentBgm = null; +AudioManager._currentBgs = null; +AudioManager._bgmBuffer = null; +AudioManager._bgsBuffer = null; +AudioManager._meBuffer = null; +AudioManager._seBuffers = []; +AudioManager._staticBuffers = []; +AudioManager._replayFadeTime = 0.5; +AudioManager._path = "audio/"; + +Object.defineProperty(AudioManager, "bgmVolume", { + get: function() { + return this._bgmVolume; + }, + set: function(value) { + this._bgmVolume = value; + this.updateBgmParameters(this._currentBgm); + }, + configurable: true +}); + +Object.defineProperty(AudioManager, "bgsVolume", { + get: function() { + return this._bgsVolume; + }, + set: function(value) { + this._bgsVolume = value; + this.updateBgsParameters(this._currentBgs); + }, + configurable: true +}); + +Object.defineProperty(AudioManager, "meVolume", { + get: function() { + return this._meVolume; + }, + set: function(value) { + this._meVolume = value; + this.updateMeParameters(this._currentMe); + }, + configurable: true +}); + +Object.defineProperty(AudioManager, "seVolume", { + get: function() { + return this._seVolume; + }, + set: function(value) { + this._seVolume = value; + }, + configurable: true +}); + +AudioManager.playBgm = function(bgm, pos) { + if (this.isCurrentBgm(bgm)) { + this.updateBgmParameters(bgm); + } else { + this.stopBgm(); + if (bgm.name) { + this._bgmBuffer = this.createBuffer("bgm/", bgm.name); + this.updateBgmParameters(bgm); + if (!this._meBuffer) { + this._bgmBuffer.play(true, pos || 0); + } + } + } + this.updateCurrentBgm(bgm, pos); +}; + +AudioManager.replayBgm = function(bgm) { + if (this.isCurrentBgm(bgm)) { + this.updateBgmParameters(bgm); + } else { + this.playBgm(bgm, bgm.pos); + if (this._bgmBuffer) { + this._bgmBuffer.fadeIn(this._replayFadeTime); + } + } +}; + +AudioManager.isCurrentBgm = function(bgm) { + return ( + this._currentBgm && + this._bgmBuffer && + this._currentBgm.name === bgm.name + ); +}; + +AudioManager.updateBgmParameters = function(bgm) { + this.updateBufferParameters(this._bgmBuffer, this._bgmVolume, bgm); +}; + +AudioManager.updateCurrentBgm = function(bgm, pos) { + this._currentBgm = { + name: bgm.name, + volume: bgm.volume, + pitch: bgm.pitch, + pan: bgm.pan, + pos: pos + }; +}; + +AudioManager.stopBgm = function() { + if (this._bgmBuffer) { + this._bgmBuffer.destroy(); + this._bgmBuffer = null; + this._currentBgm = null; + } +}; + +AudioManager.fadeOutBgm = function(duration) { + if (this._bgmBuffer && this._currentBgm) { + this._bgmBuffer.fadeOut(duration); + this._currentBgm = null; + } +}; + +AudioManager.fadeInBgm = function(duration) { + if (this._bgmBuffer && this._currentBgm) { + this._bgmBuffer.fadeIn(duration); + } +}; + +AudioManager.playBgs = function(bgs, pos) { + if (this.isCurrentBgs(bgs)) { + this.updateBgsParameters(bgs); + } else { + this.stopBgs(); + if (bgs.name) { + this._bgsBuffer = this.createBuffer("bgs/", bgs.name); + this.updateBgsParameters(bgs); + this._bgsBuffer.play(true, pos || 0); + } + } + this.updateCurrentBgs(bgs, pos); +}; + +AudioManager.replayBgs = function(bgs) { + if (this.isCurrentBgs(bgs)) { + this.updateBgsParameters(bgs); + } else { + this.playBgs(bgs, bgs.pos); + if (this._bgsBuffer) { + this._bgsBuffer.fadeIn(this._replayFadeTime); + } + } +}; + +AudioManager.isCurrentBgs = function(bgs) { + return ( + this._currentBgs && + this._bgsBuffer && + this._currentBgs.name === bgs.name + ); +}; + +AudioManager.updateBgsParameters = function(bgs) { + this.updateBufferParameters(this._bgsBuffer, this._bgsVolume, bgs); +}; + +AudioManager.updateCurrentBgs = function(bgs, pos) { + this._currentBgs = { + name: bgs.name, + volume: bgs.volume, + pitch: bgs.pitch, + pan: bgs.pan, + pos: pos + }; +}; + +AudioManager.stopBgs = function() { + if (this._bgsBuffer) { + this._bgsBuffer.destroy(); + this._bgsBuffer = null; + this._currentBgs = null; + } +}; + +AudioManager.fadeOutBgs = function(duration) { + if (this._bgsBuffer && this._currentBgs) { + this._bgsBuffer.fadeOut(duration); + this._currentBgs = null; + } +}; + +AudioManager.fadeInBgs = function(duration) { + if (this._bgsBuffer && this._currentBgs) { + this._bgsBuffer.fadeIn(duration); + } +}; + +AudioManager.playMe = function(me) { + this.stopMe(); + if (me.name) { + if (this._bgmBuffer && this._currentBgm) { + this._currentBgm.pos = this._bgmBuffer.seek(); + this._bgmBuffer.stop(); + } + this._meBuffer = this.createBuffer("me/", me.name); + this.updateMeParameters(me); + this._meBuffer.play(false); + this._meBuffer.addStopListener(this.stopMe.bind(this)); + } +}; + +AudioManager.updateMeParameters = function(me) { + this.updateBufferParameters(this._meBuffer, this._meVolume, me); +}; + +AudioManager.fadeOutMe = function(duration) { + if (this._meBuffer) { + this._meBuffer.fadeOut(duration); + } +}; + +AudioManager.stopMe = function() { + if (this._meBuffer) { + this._meBuffer.destroy(); + this._meBuffer = null; + if ( + this._bgmBuffer && + this._currentBgm && + !this._bgmBuffer.isPlaying() + ) { + this._bgmBuffer.play(true, this._currentBgm.pos); + this._bgmBuffer.fadeIn(this._replayFadeTime); + } + } +}; + +AudioManager.playSe = function(se) { + if (se.name) { + // [Note] Do not play the same sound in the same frame. + const latestBuffers = this._seBuffers.filter( + buffer => buffer.frameCount === Graphics.frameCount + ); + if (latestBuffers.find(buffer => buffer.name === se.name)) { + return; + } + const buffer = this.createBuffer("se/", se.name); + this.updateSeParameters(buffer, se); + buffer.play(false); + this._seBuffers.push(buffer); + this.cleanupSe(); + } +}; + +AudioManager.updateSeParameters = function(buffer, se) { + this.updateBufferParameters(buffer, this._seVolume, se); +}; + +AudioManager.cleanupSe = function() { + for (const buffer of this._seBuffers) { + if (!buffer.isPlaying()) { + buffer.destroy(); + } + } + this._seBuffers = this._seBuffers.filter(buffer => buffer.isPlaying()); +}; + +AudioManager.stopSe = function() { + for (const buffer of this._seBuffers) { + buffer.destroy(); + } + this._seBuffers = []; +}; + +AudioManager.playStaticSe = function(se) { + if (se.name) { + this.loadStaticSe(se); + for (const buffer of this._staticBuffers) { + if (buffer.name === se.name) { + buffer.stop(); + this.updateSeParameters(buffer, se); + buffer.play(false); + break; + } + } + } +}; + +AudioManager.loadStaticSe = function(se) { + if (se.name && !this.isStaticSe(se)) { + const buffer = this.createBuffer("se/", se.name); + this._staticBuffers.push(buffer); + } +}; + +AudioManager.isStaticSe = function(se) { + for (const buffer of this._staticBuffers) { + if (buffer.name === se.name) { + return true; + } + } + return false; +}; + +AudioManager.stopAll = function() { + this.stopMe(); + this.stopBgm(); + this.stopBgs(); + this.stopSe(); +}; + +AudioManager.saveBgm = function() { + if (this._currentBgm) { + const bgm = this._currentBgm; + return { + name: bgm.name, + volume: bgm.volume, + pitch: bgm.pitch, + pan: bgm.pan, + pos: this._bgmBuffer ? this._bgmBuffer.seek() : 0 + }; + } else { + return this.makeEmptyAudioObject(); + } +}; + +AudioManager.saveBgs = function() { + if (this._currentBgs) { + const bgs = this._currentBgs; + return { + name: bgs.name, + volume: bgs.volume, + pitch: bgs.pitch, + pan: bgs.pan, + pos: this._bgsBuffer ? this._bgsBuffer.seek() : 0 + }; + } else { + return this.makeEmptyAudioObject(); + } +}; + +AudioManager.makeEmptyAudioObject = function() { + return { name: "", volume: 0, pitch: 0 }; +}; + +AudioManager.createBuffer = function(folder, name) { + const ext = this.audioFileExt(); + const url = this._path + folder + Utils.encodeURI(name) + ext; + const buffer = new WebAudio(url); + buffer.name = name; + buffer.frameCount = Graphics.frameCount; + return buffer; +}; + +AudioManager.updateBufferParameters = function(buffer, configVolume, audio) { + if (buffer && audio) { + buffer.volume = (configVolume * (audio.volume || 0)) / 10000; + buffer.pitch = (audio.pitch || 0) / 100; + buffer.pan = (audio.pan || 0) / 100; + } +}; + +AudioManager.audioFileExt = function() { + return ".ogg"; +}; + +AudioManager.checkErrors = function() { + const buffers = [this._bgmBuffer, this._bgsBuffer, this._meBuffer]; + buffers.push(...this._seBuffers); + buffers.push(...this._staticBuffers); + for (const buffer of buffers) { + if (buffer && buffer.isError()) { + this.throwLoadError(buffer); + } + } +}; + +AudioManager.throwLoadError = function(webAudio) { + const retry = webAudio.retry.bind(webAudio); + throw ["LoadError", webAudio.url, retry]; +}; + +//----------------------------------------------------------------------------- +// SoundManager +// +// The static class that plays sound effects defined in the database. + +function SoundManager() { + throw new Error("This is a static class"); +} + +SoundManager.preloadImportantSounds = function() { + this.loadSystemSound(0); + this.loadSystemSound(1); + this.loadSystemSound(2); + this.loadSystemSound(3); +}; + +SoundManager.loadSystemSound = function(n) { + if ($dataSystem) { + AudioManager.loadStaticSe($dataSystem.sounds[n]); + } +}; + +SoundManager.playSystemSound = function(n) { + if ($dataSystem) { + AudioManager.playStaticSe($dataSystem.sounds[n]); + } +}; + +SoundManager.playCursor = function() { + this.playSystemSound(0); +}; + +SoundManager.playOk = function() { + this.playSystemSound(1); +}; + +SoundManager.playCancel = function() { + this.playSystemSound(2); +}; + +SoundManager.playBuzzer = function() { + this.playSystemSound(3); +}; + +SoundManager.playEquip = function() { + this.playSystemSound(4); +}; + +SoundManager.playSave = function() { + this.playSystemSound(5); +}; + +SoundManager.playLoad = function() { + this.playSystemSound(6); +}; + +SoundManager.playBattleStart = function() { + this.playSystemSound(7); +}; + +SoundManager.playEscape = function() { + this.playSystemSound(8); +}; + +SoundManager.playEnemyAttack = function() { + this.playSystemSound(9); +}; + +SoundManager.playEnemyDamage = function() { + this.playSystemSound(10); +}; + +SoundManager.playEnemyCollapse = function() { + this.playSystemSound(11); +}; + +SoundManager.playBossCollapse1 = function() { + this.playSystemSound(12); +}; + +SoundManager.playBossCollapse2 = function() { + this.playSystemSound(13); +}; + +SoundManager.playActorDamage = function() { + this.playSystemSound(14); +}; + +SoundManager.playActorCollapse = function() { + this.playSystemSound(15); +}; + +SoundManager.playRecovery = function() { + this.playSystemSound(16); +}; + +SoundManager.playMiss = function() { + this.playSystemSound(17); +}; + +SoundManager.playEvasion = function() { + this.playSystemSound(18); +}; + +SoundManager.playMagicEvasion = function() { + this.playSystemSound(19); +}; + +SoundManager.playReflection = function() { + this.playSystemSound(20); +}; + +SoundManager.playShop = function() { + this.playSystemSound(21); +}; + +SoundManager.playUseItem = function() { + this.playSystemSound(22); +}; + +SoundManager.playUseSkill = function() { + this.playSystemSound(23); +}; + +//----------------------------------------------------------------------------- +// TextManager +// +// The static class that handles terms and messages. + +function TextManager() { + throw new Error("This is a static class"); +} + +TextManager.basic = function(basicId) { + return $dataSystem.terms.basic[basicId] || ""; +}; + +TextManager.param = function(paramId) { + return $dataSystem.terms.params[paramId] || ""; +}; + +TextManager.command = function(commandId) { + return $dataSystem.terms.commands[commandId] || ""; +}; + +TextManager.message = function(messageId) { + return $dataSystem.terms.messages[messageId] || ""; +}; + +TextManager.getter = function(method, param) { + return { + get: function() { + return this[method](param); + }, + configurable: true + }; +}; + +Object.defineProperty(TextManager, "currencyUnit", { + get: function() { + return $dataSystem.currencyUnit; + }, + configurable: true +}); + +Object.defineProperties(TextManager, { + level: TextManager.getter("basic", 0), + levelA: TextManager.getter("basic", 1), + hp: TextManager.getter("basic", 2), + hpA: TextManager.getter("basic", 3), + mp: TextManager.getter("basic", 4), + mpA: TextManager.getter("basic", 5), + tp: TextManager.getter("basic", 6), + tpA: TextManager.getter("basic", 7), + exp: TextManager.getter("basic", 8), + expA: TextManager.getter("basic", 9), + fight: TextManager.getter("command", 0), + escape: TextManager.getter("command", 1), + attack: TextManager.getter("command", 2), + guard: TextManager.getter("command", 3), + item: TextManager.getter("command", 4), + skill: TextManager.getter("command", 5), + equip: TextManager.getter("command", 6), + status: TextManager.getter("command", 7), + formation: TextManager.getter("command", 8), + save: TextManager.getter("command", 9), + gameEnd: TextManager.getter("command", 10), + options: TextManager.getter("command", 11), + weapon: TextManager.getter("command", 12), + armor: TextManager.getter("command", 13), + keyItem: TextManager.getter("command", 14), + equip2: TextManager.getter("command", 15), + optimize: TextManager.getter("command", 16), + clear: TextManager.getter("command", 17), + newGame: TextManager.getter("command", 18), + continue_: TextManager.getter("command", 19), + toTitle: TextManager.getter("command", 21), + cancel: TextManager.getter("command", 22), + buy: TextManager.getter("command", 24), + sell: TextManager.getter("command", 25), + alwaysDash: TextManager.getter("message", "alwaysDash"), + commandRemember: TextManager.getter("message", "commandRemember"), + touchUI: TextManager.getter("message", "touchUI"), + bgmVolume: TextManager.getter("message", "bgmVolume"), + bgsVolume: TextManager.getter("message", "bgsVolume"), + meVolume: TextManager.getter("message", "meVolume"), + seVolume: TextManager.getter("message", "seVolume"), + possession: TextManager.getter("message", "possession"), + expTotal: TextManager.getter("message", "expTotal"), + expNext: TextManager.getter("message", "expNext"), + saveMessage: TextManager.getter("message", "saveMessage"), + loadMessage: TextManager.getter("message", "loadMessage"), + file: TextManager.getter("message", "file"), + autosave: TextManager.getter("message", "autosave"), + partyName: TextManager.getter("message", "partyName"), + emerge: TextManager.getter("message", "emerge"), + preemptive: TextManager.getter("message", "preemptive"), + surprise: TextManager.getter("message", "surprise"), + escapeStart: TextManager.getter("message", "escapeStart"), + escapeFailure: TextManager.getter("message", "escapeFailure"), + victory: TextManager.getter("message", "victory"), + defeat: TextManager.getter("message", "defeat"), + obtainExp: TextManager.getter("message", "obtainExp"), + obtainGold: TextManager.getter("message", "obtainGold"), + obtainItem: TextManager.getter("message", "obtainItem"), + levelUp: TextManager.getter("message", "levelUp"), + obtainSkill: TextManager.getter("message", "obtainSkill"), + useItem: TextManager.getter("message", "useItem"), + criticalToEnemy: TextManager.getter("message", "criticalToEnemy"), + criticalToActor: TextManager.getter("message", "criticalToActor"), + actorDamage: TextManager.getter("message", "actorDamage"), + actorRecovery: TextManager.getter("message", "actorRecovery"), + actorGain: TextManager.getter("message", "actorGain"), + actorLoss: TextManager.getter("message", "actorLoss"), + actorDrain: TextManager.getter("message", "actorDrain"), + actorNoDamage: TextManager.getter("message", "actorNoDamage"), + actorNoHit: TextManager.getter("message", "actorNoHit"), + enemyDamage: TextManager.getter("message", "enemyDamage"), + enemyRecovery: TextManager.getter("message", "enemyRecovery"), + enemyGain: TextManager.getter("message", "enemyGain"), + enemyLoss: TextManager.getter("message", "enemyLoss"), + enemyDrain: TextManager.getter("message", "enemyDrain"), + enemyNoDamage: TextManager.getter("message", "enemyNoDamage"), + enemyNoHit: TextManager.getter("message", "enemyNoHit"), + evasion: TextManager.getter("message", "evasion"), + magicEvasion: TextManager.getter("message", "magicEvasion"), + magicReflection: TextManager.getter("message", "magicReflection"), + counterAttack: TextManager.getter("message", "counterAttack"), + substitute: TextManager.getter("message", "substitute"), + buffAdd: TextManager.getter("message", "buffAdd"), + debuffAdd: TextManager.getter("message", "debuffAdd"), + buffRemove: TextManager.getter("message", "buffRemove"), + actionFailure: TextManager.getter("message", "actionFailure") +}); + +//----------------------------------------------------------------------------- +// ColorManager +// +// The static class that handles the window colors. + +function ColorManager() { + throw new Error("This is a static class"); +} + +ColorManager.loadWindowskin = function() { + this._windowskin = ImageManager.loadSystem("Window"); +}; + +ColorManager.textColor = function(n) { + const px = 96 + (n % 8) * 12 + 6; + const py = 144 + Math.floor(n / 8) * 12 + 6; + return this._windowskin.getPixel(px, py); +}; + +ColorManager.normalColor = function() { + return this.textColor(0); +}; + +ColorManager.systemColor = function() { + return this.textColor(16); +}; + +ColorManager.crisisColor = function() { + return this.textColor(17); +}; + +ColorManager.deathColor = function() { + return this.textColor(18); +}; + +ColorManager.gaugeBackColor = function() { + return this.textColor(19); +}; + +ColorManager.hpGaugeColor1 = function() { + return this.textColor(20); +}; + +ColorManager.hpGaugeColor2 = function() { + return this.textColor(21); +}; + +ColorManager.mpGaugeColor1 = function() { + return this.textColor(22); +}; + +ColorManager.mpGaugeColor2 = function() { + return this.textColor(23); +}; + +ColorManager.mpCostColor = function() { + return this.textColor(23); +}; + +ColorManager.powerUpColor = function() { + return this.textColor(24); +}; + +ColorManager.powerDownColor = function() { + return this.textColor(25); +}; + +ColorManager.ctGaugeColor1 = function() { + return this.textColor(26); +}; + +ColorManager.ctGaugeColor2 = function() { + return this.textColor(27); +}; + +ColorManager.tpGaugeColor1 = function() { + return this.textColor(28); +}; + +ColorManager.tpGaugeColor2 = function() { + return this.textColor(29); +}; + +ColorManager.tpCostColor = function() { + return this.textColor(29); +}; + +ColorManager.pendingColor = function() { + return this._windowskin.getPixel(120, 120); +}; + +ColorManager.hpColor = function(actor) { + if (!actor) { + return this.normalColor(); + } else if (actor.isDead()) { + return this.deathColor(); + } else if (actor.isDying()) { + return this.crisisColor(); + } else { + return this.normalColor(); + } +}; + +ColorManager.mpColor = function(/*actor*/) { + return this.normalColor(); +}; + +ColorManager.tpColor = function(/*actor*/) { + return this.normalColor(); +}; + +ColorManager.paramchangeTextColor = function(change) { + if (change > 0) { + return this.powerUpColor(); + } else if (change < 0) { + return this.powerDownColor(); + } else { + return this.normalColor(); + } +}; + +ColorManager.damageColor = function(colorType) { + switch (colorType) { + case 0: // HP damage + return "#ffffff"; + case 1: // HP recover + return "#b9ffb5"; + case 2: // MP damage + return "#ffff90"; + case 3: // MP recover + return "#80b0ff"; + default: + return "#808080"; + } +}; + +ColorManager.outlineColor = function() { + return "rgba(0, 0, 0, 0.6)"; +}; + +ColorManager.dimColor1 = function() { + return "rgba(0, 0, 0, 0.6)"; +}; + +ColorManager.dimColor2 = function() { + return "rgba(0, 0, 0, 0)"; +}; + +ColorManager.itemBackColor1 = function() { + return "rgba(32, 32, 32, 0.5)"; +}; + +ColorManager.itemBackColor2 = function() { + return "rgba(0, 0, 0, 0.5)"; +}; + +//----------------------------------------------------------------------------- +// SceneManager +// +// The static class that manages scene transitions. + +function SceneManager() { + throw new Error("This is a static class"); +} + +SceneManager._scene = null; +SceneManager._nextScene = null; +SceneManager._stack = []; +SceneManager._exiting = false; +SceneManager._previousScene = null; +SceneManager._previousClass = null; +SceneManager._backgroundBitmap = null; +SceneManager._smoothDeltaTime = 1; +SceneManager._elapsedTime = 0; + +SceneManager.run = function(sceneClass) { + try { + this.initialize(); + this.goto(sceneClass); + Graphics.startGameLoop(); + } catch (e) { + this.catchException(e); + } +}; + +SceneManager.initialize = function() { + this.checkBrowser(); + this.checkPluginErrors(); + this.initGraphics(); + this.initAudio(); + this.initVideo(); + this.initInput(); + this.setupEventHandlers(); +}; + +SceneManager.checkBrowser = function() { + if (!Utils.canUseWebGL()) { + throw new Error("Your browser does not support WebGL."); + } + if (!Utils.canUseWebAudioAPI()) { + throw new Error("Your browser does not support Web Audio API."); + } + if (!Utils.canUseCssFontLoading()) { + throw new Error("Your browser does not support CSS Font Loading."); + } + if (!Utils.canUseIndexedDB()) { + throw new Error("Your browser does not support IndexedDB."); + } +}; + +SceneManager.checkPluginErrors = function() { + PluginManager.checkErrors(); +}; + +SceneManager.initGraphics = function() { + if (!Graphics.initialize()) { + throw new Error("Failed to initialize graphics."); + } + Graphics.setTickHandler(this.update.bind(this)); +}; + +SceneManager.initAudio = function() { + WebAudio.initialize(); +}; + +SceneManager.initVideo = function() { + Video.initialize(Graphics.width, Graphics.height); +}; + +SceneManager.initInput = function() { + Input.initialize(); + TouchInput.initialize(); +}; + +SceneManager.setupEventHandlers = function() { + window.addEventListener("error", this.onError.bind(this)); + window.addEventListener("unhandledrejection", this.onReject.bind(this)); + window.addEventListener("unload", this.onUnload.bind(this)); + document.addEventListener("keydown", this.onKeyDown.bind(this)); +}; + +SceneManager.update = function(deltaTime) { + try { + const n = this.determineRepeatNumber(deltaTime); + for (let i = 0; i < n; i++) { + this.updateMain(); + } + } catch (e) { + this.catchException(e); + } +}; + +SceneManager.determineRepeatNumber = function(deltaTime) { + // [Note] We consider environments where the refresh rate is higher than + // 60Hz, but ignore sudden irregular deltaTime. + this._smoothDeltaTime *= 0.8; + this._smoothDeltaTime += Math.min(deltaTime, 2) * 0.2; + if (this._smoothDeltaTime >= 0.9) { + this._elapsedTime = 0; + return Math.round(this._smoothDeltaTime); + } else { + this._elapsedTime += deltaTime; + if (this._elapsedTime >= 1) { + this._elapsedTime -= 1; + return 1; + } + return 0; + } +}; + +SceneManager.terminate = function() { + if (Utils.isNwjs()) { + nw.App.quit(); + } +}; + +SceneManager.onError = function(event) { + console.error(event.message); + console.error(event.filename, event.lineno); + try { + this.stop(); + Graphics.printError("Error", event.message, event); + AudioManager.stopAll(); + } catch (e) { + // + } +}; + +SceneManager.onReject = function(event) { + // Catch uncaught exception in Promise + event.message = event.reason; + this.onError(event); +}; + +SceneManager.onUnload = function() { + ImageManager.clear(); + EffectManager.clear(); + AudioManager.stopAll(); +}; + +SceneManager.onKeyDown = function(event) { + if (!event.ctrlKey && !event.altKey) { + switch (event.keyCode) { + case 116: // F5 + this.reloadGame(); + break; + case 119: // F8 + this.showDevTools(); + break; + } + } +}; + +SceneManager.reloadGame = function() { + if (Utils.isNwjs()) { + chrome.runtime.reload(); + } +}; + +SceneManager.showDevTools = function() { + if (Utils.isNwjs() && Utils.isOptionValid("test")) { + nw.Window.get().showDevTools(); + } +}; + +SceneManager.catchException = function(e) { + if (e instanceof Error) { + this.catchNormalError(e); + } else if (e instanceof Array && e[0] === "LoadError") { + this.catchLoadError(e); + } else { + this.catchUnknownError(e); + } + this.stop(); +}; + +SceneManager.catchNormalError = function(e) { + Graphics.printError(e.name, e.message, e); + AudioManager.stopAll(); + console.error(e.stack); +}; + +SceneManager.catchLoadError = function(e) { + const url = e[1]; + const retry = e[2]; + Graphics.printError("Failed to load", url); + if (retry) { + Graphics.showRetryButton(() => { + retry(); + SceneManager.resume(); + }); + } else { + AudioManager.stopAll(); + } +}; + +SceneManager.catchUnknownError = function(e) { + Graphics.printError("UnknownError", String(e)); + AudioManager.stopAll(); +}; + +SceneManager.updateMain = function() { + this.updateFrameCount(); + this.updateInputData(); + this.updateEffekseer(); + this.changeScene(); + this.updateScene(); +}; + +SceneManager.updateFrameCount = function() { + Graphics.frameCount++; +}; + +SceneManager.updateInputData = function() { + Input.update(); + TouchInput.update(); +}; + +SceneManager.updateEffekseer = function() { + if (Graphics.effekseer && this.isGameActive()) { + Graphics.effekseer.update(); + } +}; + +SceneManager.changeScene = function() { + if (this.isSceneChanging() && !this.isCurrentSceneBusy()) { + if (this._scene) { + this._scene.terminate(); + this.onSceneTerminate(); + } + this._scene = this._nextScene; + this._nextScene = null; + if (this._scene) { + this._scene.create(); + this.onSceneCreate(); + } + if (this._exiting) { + this.terminate(); + } + } +}; + +SceneManager.updateScene = function() { + if (this._scene) { + if (this._scene.isStarted()) { + if (this.isGameActive()) { + this._scene.update(); + } + } else if (this._scene.isReady()) { + this.onBeforeSceneStart(); + this._scene.start(); + this.onSceneStart(); + } + } +}; + +SceneManager.isGameActive = function() { + // [Note] We use "window.top" to support an iframe. + try { + return window.top.document.hasFocus(); + } catch (e) { + // SecurityError + return true; + } +}; + +SceneManager.onSceneTerminate = function() { + this._previousScene = this._scene; + this._previousClass = this._scene.constructor; + Graphics.setStage(null); +}; + +SceneManager.onSceneCreate = function() { + Graphics.startLoading(); +}; + +SceneManager.onBeforeSceneStart = function() { + if (this._previousScene) { + this._previousScene.destroy(); + this._previousScene = null; + } + if (Graphics.effekseer) { + Graphics.effekseer.stopAll(); + } +}; + +SceneManager.onSceneStart = function() { + Graphics.endLoading(); + Graphics.setStage(this._scene); +}; + +SceneManager.isSceneChanging = function() { + return this._exiting || !!this._nextScene; +}; + +SceneManager.isCurrentSceneBusy = function() { + return this._scene && this._scene.isBusy(); +}; + +SceneManager.isNextScene = function(sceneClass) { + return this._nextScene && this._nextScene.constructor === sceneClass; +}; + +SceneManager.isPreviousScene = function(sceneClass) { + return this._previousClass === sceneClass; +}; + +SceneManager.goto = function(sceneClass) { + if (sceneClass) { + this._nextScene = new sceneClass(); + } + if (this._scene) { + this._scene.stop(); + } +}; + +SceneManager.push = function(sceneClass) { + this._stack.push(this._scene.constructor); + this.goto(sceneClass); +}; + +SceneManager.pop = function() { + if (this._stack.length > 0) { + this.goto(this._stack.pop()); + } else { + this.exit(); + } +}; + +SceneManager.exit = function() { + this.goto(null); + this._exiting = true; +}; + +SceneManager.clearStack = function() { + this._stack = []; +}; + +SceneManager.stop = function() { + Graphics.stopGameLoop(); +}; + +SceneManager.prepareNextScene = function() { + this._nextScene.prepare(...arguments); +}; + +SceneManager.snap = function() { + return Bitmap.snap(this._scene); +}; + +SceneManager.snapForBackground = function() { + if (this._backgroundBitmap) { + this._backgroundBitmap.destroy(); + } + this._backgroundBitmap = this.snap(); +}; + +SceneManager.backgroundBitmap = function() { + return this._backgroundBitmap; +}; + +SceneManager.resume = function() { + TouchInput.update(); + Graphics.startGameLoop(); +}; + +//----------------------------------------------------------------------------- +// BattleManager +// +// The static class that manages battle progress. + +function BattleManager() { + throw new Error("This is a static class"); +} + +BattleManager.setup = function(troopId, canEscape, canLose) { + this.initMembers(); + this._canEscape = canEscape; + this._canLose = canLose; + $gameTroop.setup(troopId); + $gameScreen.onBattleStart(); + this.makeEscapeRatio(); +}; + +BattleManager.initMembers = function() { + this._phase = ""; + this._inputting = false; + this._canEscape = false; + this._canLose = false; + this._battleTest = false; + this._eventCallback = null; + this._preemptive = false; + this._surprise = false; + this._currentActor = null; + this._actionForcedBattler = null; + this._mapBgm = null; + this._mapBgs = null; + this._actionBattlers = []; + this._subject = null; + this._action = null; + this._targets = []; + this._logWindow = null; + this._spriteset = null; + this._escapeRatio = 0; + this._escaped = false; + this._rewards = {}; + this._tpbNeedsPartyCommand = true; +}; + +BattleManager.isTpb = function() { + return $dataSystem.battleSystem >= 1; +}; + +BattleManager.isActiveTpb = function() { + return $dataSystem.battleSystem === 1; +}; + +BattleManager.isBattleTest = function() { + return this._battleTest; +}; + +BattleManager.setBattleTest = function(battleTest) { + this._battleTest = battleTest; +}; + +BattleManager.setEventCallback = function(callback) { + this._eventCallback = callback; +}; + +BattleManager.setLogWindow = function(logWindow) { + this._logWindow = logWindow; +}; + +BattleManager.setSpriteset = function(spriteset) { + this._spriteset = spriteset; +}; + +BattleManager.onEncounter = function() { + this._preemptive = Math.random() < this.ratePreemptive(); + this._surprise = Math.random() < this.rateSurprise() && !this._preemptive; +}; + +BattleManager.ratePreemptive = function() { + return $gameParty.ratePreemptive($gameTroop.agility()); +}; + +BattleManager.rateSurprise = function() { + return $gameParty.rateSurprise($gameTroop.agility()); +}; + +BattleManager.saveBgmAndBgs = function() { + this._mapBgm = AudioManager.saveBgm(); + this._mapBgs = AudioManager.saveBgs(); +}; + +BattleManager.playBattleBgm = function() { + AudioManager.playBgm($gameSystem.battleBgm()); + AudioManager.stopBgs(); +}; + +BattleManager.playVictoryMe = function() { + AudioManager.playMe($gameSystem.victoryMe()); +}; + +BattleManager.playDefeatMe = function() { + AudioManager.playMe($gameSystem.defeatMe()); +}; + +BattleManager.replayBgmAndBgs = function() { + if (this._mapBgm) { + AudioManager.replayBgm(this._mapBgm); + } else { + AudioManager.stopBgm(); + } + if (this._mapBgs) { + AudioManager.replayBgs(this._mapBgs); + } +}; + +BattleManager.makeEscapeRatio = function() { + this._escapeRatio = (0.5 * $gameParty.agility()) / $gameTroop.agility(); +}; + +BattleManager.update = function(timeActive) { + if (!this.isBusy() && !this.updateEvent()) { + this.updatePhase(timeActive); + } + if (this.isTpb()) { + this.updateTpbInput(); + } +}; + +BattleManager.updatePhase = function(timeActive) { + switch (this._phase) { + case "start": + this.updateStart(); + break; + case "turn": + this.updateTurn(timeActive); + break; + case "action": + this.updateAction(); + break; + case "turnEnd": + this.updateTurnEnd(); + break; + case "battleEnd": + this.updateBattleEnd(); + break; + } +}; + +BattleManager.updateEvent = function() { + switch (this._phase) { + case "start": + case "turn": + case "turnEnd": + if (this.isActionForced()) { + this.processForcedAction(); + return true; + } else { + return this.updateEventMain(); + } + } + return this.checkAbort(); +}; + +BattleManager.updateEventMain = function() { + $gameTroop.updateInterpreter(); + $gameParty.requestMotionRefresh(); + if ($gameTroop.isEventRunning() || this.checkBattleEnd()) { + return true; + } + $gameTroop.setupBattleEvent(); + if ($gameTroop.isEventRunning() || SceneManager.isSceneChanging()) { + return true; + } + return false; +}; + +BattleManager.isBusy = function() { + return ( + $gameMessage.isBusy() || + this._spriteset.isBusy() || + this._logWindow.isBusy() + ); +}; + +BattleManager.updateTpbInput = function() { + if (this._inputting) { + this.checkTpbInputClose(); + } else { + this.checkTpbInputOpen(); + } +}; + +BattleManager.checkTpbInputClose = function() { + if (!this.isPartyTpbInputtable() || this.needsActorInputCancel()) { + this.cancelActorInput(); + this._currentActor = null; + this._inputting = false; + } +}; + +BattleManager.checkTpbInputOpen = function() { + if (this.isPartyTpbInputtable()) { + if (this._tpbNeedsPartyCommand) { + this._inputting = true; + this._tpbNeedsPartyCommand = false; + } else { + this.selectNextCommand(); + } + } +}; + +BattleManager.isPartyTpbInputtable = function() { + return $gameParty.canInput() && this.isTpbMainPhase(); +}; + +BattleManager.needsActorInputCancel = function() { + return this._currentActor && !this._currentActor.canInput(); +}; + +BattleManager.isTpbMainPhase = function() { + return ["turn", "turnEnd", "action"].includes(this._phase); +}; + +BattleManager.isInputting = function() { + return this._inputting; +}; + +BattleManager.isInTurn = function() { + return this._phase === "turn"; +}; + +BattleManager.isTurnEnd = function() { + return this._phase === "turnEnd"; +}; + +BattleManager.isAborting = function() { + return this._phase === "aborting"; +}; + +BattleManager.isBattleEnd = function() { + return this._phase === "battleEnd"; +}; + +BattleManager.canEscape = function() { + return this._canEscape; +}; + +BattleManager.canLose = function() { + return this._canLose; +}; + +BattleManager.isEscaped = function() { + return this._escaped; +}; + +BattleManager.actor = function() { + return this._currentActor; +}; + +BattleManager.startBattle = function() { + this._phase = "start"; + $gameSystem.onBattleStart(); + $gameParty.onBattleStart(this._preemptive); + $gameTroop.onBattleStart(this._surprise); + this.displayStartMessages(); +}; + +BattleManager.displayStartMessages = function() { + for (const name of $gameTroop.enemyNames()) { + $gameMessage.add(TextManager.emerge.format(name)); + } + if (this._preemptive) { + $gameMessage.add(TextManager.preemptive.format($gameParty.name())); + } else if (this._surprise) { + $gameMessage.add(TextManager.surprise.format($gameParty.name())); + } +}; + +BattleManager.startInput = function() { + this._phase = "input"; + this._inputting = true; + $gameParty.makeActions(); + $gameTroop.makeActions(); + this._currentActor = null; + if (this._surprise || !$gameParty.canInput()) { + this.startTurn(); + } +}; + +BattleManager.inputtingAction = function() { + return this._currentActor ? this._currentActor.inputtingAction() : null; +}; + +BattleManager.selectNextCommand = function() { + if (this._currentActor) { + if (this._currentActor.selectNextCommand()) { + return; + } + this.finishActorInput(); + } + this.selectNextActor(); +}; + +BattleManager.selectNextActor = function() { + this.changeCurrentActor(true); + if (!this._currentActor) { + if (this.isTpb()) { + this.changeCurrentActor(true); + } else { + this.startTurn(); + } + } +}; + +BattleManager.selectPreviousCommand = function() { + if (this._currentActor) { + if (this._currentActor.selectPreviousCommand()) { + return; + } + this.cancelActorInput(); + } + this.selectPreviousActor(); +}; + +BattleManager.selectPreviousActor = function() { + if (this.isTpb()) { + this.changeCurrentActor(true); + if (!this._currentActor) { + this._inputting = $gameParty.canInput(); + } + } else { + this.changeCurrentActor(false); + } +}; + +BattleManager.changeCurrentActor = function(forward) { + const members = $gameParty.battleMembers(); + let actor = this._currentActor; + for (;;) { + const currentIndex = members.indexOf(actor); + actor = members[currentIndex + (forward ? 1 : -1)]; + if (!actor || actor.canInput()) { + break; + } + } + this._currentActor = actor ? actor : null; + this.startActorInput(); +}; + +BattleManager.startActorInput = function() { + if (this._currentActor) { + this._currentActor.setActionState("inputting"); + this._inputting = true; + } +}; + +BattleManager.finishActorInput = function() { + if (this._currentActor) { + if (this.isTpb()) { + this._currentActor.startTpbCasting(); + } + this._currentActor.setActionState("waiting"); + } +}; + +BattleManager.cancelActorInput = function() { + if (this._currentActor) { + this._currentActor.setActionState("undecided"); + } +}; + +BattleManager.updateStart = function() { + if (this.isTpb()) { + this._phase = "turn"; + } else { + this.startInput(); + } +}; + +BattleManager.startTurn = function() { + this._phase = "turn"; + $gameTroop.increaseTurn(); + $gameParty.requestMotionRefresh(); + if (!this.isTpb()) { + this.makeActionOrders(); + this._logWindow.startTurn(); + this._inputting = false; + } +}; + +BattleManager.updateTurn = function(timeActive) { + $gameParty.requestMotionRefresh(); + if (this.isTpb() && timeActive) { + this.updateTpb(); + } + if (!this._subject) { + this._subject = this.getNextSubject(); + } + if (this._subject) { + this.processTurn(); + } else if (!this.isTpb()) { + this.endTurn(); + } +}; + +BattleManager.updateTpb = function() { + $gameParty.updateTpb(); + $gameTroop.updateTpb(); + this.updateAllTpbBattlers(); + this.checkTpbTurnEnd(); +}; + +BattleManager.updateAllTpbBattlers = function() { + for (const battler of this.allBattleMembers()) { + this.updateTpbBattler(battler); + } +}; + +BattleManager.updateTpbBattler = function(battler) { + if (battler.isTpbTurnEnd()) { + battler.onTurnEnd(); + battler.startTpbTurn(); + this.displayBattlerStatus(battler, false); + } else if (battler.isTpbReady()) { + battler.startTpbAction(); + this._actionBattlers.push(battler); + } else if (battler.isTpbTimeout()) { + battler.onTpbTimeout(); + this.displayBattlerStatus(battler, true); + } +}; + +BattleManager.checkTpbTurnEnd = function() { + if ($gameTroop.isTpbTurnEnd()) { + this.endTurn(); + } +}; + +BattleManager.processTurn = function() { + const subject = this._subject; + const action = subject.currentAction(); + if (action) { + action.prepare(); + if (action.isValid()) { + this.startAction(); + } + subject.removeCurrentAction(); + } else { + this.endAction(); + this._subject = null; + } +}; + +BattleManager.endBattlerActions = function(battler) { + battler.setActionState(this.isTpb() ? "undecided" : "done"); + battler.onAllActionsEnd(); + battler.clearTpbChargeTime(); + this.displayBattlerStatus(battler, true); +}; + +BattleManager.endTurn = function() { + this._phase = "turnEnd"; + this._preemptive = false; + this._surprise = false; +}; + +BattleManager.updateTurnEnd = function() { + if (this.isTpb()) { + this.startTurn(); + } else { + this.endAllBattlersTurn(); + this._phase = "start"; + } +}; + +BattleManager.endAllBattlersTurn = function() { + for (const battler of this.allBattleMembers()) { + battler.onTurnEnd(); + this.displayBattlerStatus(battler, false); + } +}; + +BattleManager.displayBattlerStatus = function(battler, current) { + this._logWindow.displayAutoAffectedStatus(battler); + if (current) { + this._logWindow.displayCurrentState(battler); + } + this._logWindow.displayRegeneration(battler); +}; + +BattleManager.getNextSubject = function() { + for (;;) { + const battler = this._actionBattlers.shift(); + if (!battler) { + return null; + } + if (battler.isBattleMember() && battler.isAlive()) { + return battler; + } + } +}; + +BattleManager.allBattleMembers = function() { + return $gameParty.battleMembers().concat($gameTroop.members()); +}; + +BattleManager.makeActionOrders = function() { + const battlers = []; + if (!this._surprise) { + battlers.push(...$gameParty.battleMembers()); + } + if (!this._preemptive) { + battlers.push(...$gameTroop.members()); + } + for (const battler of battlers) { + battler.makeSpeed(); + } + battlers.sort((a, b) => b.speed() - a.speed()); + this._actionBattlers = battlers; +}; + +BattleManager.startAction = function() { + const subject = this._subject; + const action = subject.currentAction(); + const targets = action.makeTargets(); + this._phase = "action"; + this._action = action; + this._targets = targets; + subject.cancelMotionRefresh(); + subject.useItem(action.item()); + this._action.applyGlobal(); + this._logWindow.startAction(subject, action, targets); +}; + +BattleManager.updateAction = function() { + const target = this._targets.shift(); + if (target) { + this.invokeAction(this._subject, target); + } else { + this.endAction(); + } +}; + +BattleManager.endAction = function() { + this._logWindow.endAction(this._subject); + this._phase = "turn"; + if (this._subject.numActions() === 0) { + this.endBattlerActions(this._subject); + this._subject = null; + } +}; + +BattleManager.invokeAction = function(subject, target) { + this._logWindow.push("pushBaseLine"); + if (Math.random() < this._action.itemCnt(target)) { + this.invokeCounterAttack(subject, target); + } else if (Math.random() < this._action.itemMrf(target)) { + this.invokeMagicReflection(subject, target); + } else { + this.invokeNormalAction(subject, target); + } + subject.setLastTarget(target); + this._logWindow.push("popBaseLine"); +}; + +BattleManager.invokeNormalAction = function(subject, target) { + const realTarget = this.applySubstitute(target); + this._action.apply(realTarget); + this._logWindow.displayActionResults(subject, realTarget); +}; + +BattleManager.invokeCounterAttack = function(subject, target) { + const action = new Game_Action(target); + action.setAttack(); + action.apply(subject); + this._logWindow.displayCounter(target); + this._logWindow.displayActionResults(target, subject); +}; + +BattleManager.invokeMagicReflection = function(subject, target) { + this._action._reflectionTarget = target; + this._logWindow.displayReflection(target); + this._action.apply(subject); + this._logWindow.displayActionResults(target, subject); +}; + +BattleManager.applySubstitute = function(target) { + if (this.checkSubstitute(target)) { + const substitute = target.friendsUnit().substituteBattler(target); + if (substitute) { + this._logWindow.displaySubstitute(substitute, target); + return substitute; + } + } + return target; +}; + +BattleManager.checkSubstitute = function(target) { + return target.isDying() && !this._action.isCertainHit(); +}; + +BattleManager.isActionForced = function() { + return ( + !!this._actionForcedBattler && + !$gameParty.isAllDead() && + !$gameTroop.isAllDead() + ); +}; + +BattleManager.forceAction = function(battler) { + if (battler.numActions() > 0) { + this._actionForcedBattler = battler; + this._actionBattlers.remove(battler); + } +}; + +BattleManager.processForcedAction = function() { + if (this._actionForcedBattler) { + if (this._subject) { + this.endBattlerActions(this._subject); + } + this._subject = this._actionForcedBattler; + this._actionForcedBattler = null; + this.startAction(); + this._subject.removeCurrentAction(); + } +}; + +BattleManager.abort = function() { + this._phase = "aborting"; +}; + +BattleManager.checkBattleEnd = function() { + if (this._phase) { + if ($gameParty.isEscaped()) { + this.processPartyEscape(); + return true; + } else if ($gameParty.isAllDead()) { + this.processDefeat(); + return true; + } else if ($gameTroop.isAllDead()) { + this.processVictory(); + return true; + } + } + return false; +}; + +BattleManager.checkAbort = function() { + if (this.isAborting()) { + this.processAbort(); + return true; + } + return false; +}; + +BattleManager.processVictory = function() { + $gameParty.removeBattleStates(); + $gameParty.performVictory(); + this.playVictoryMe(); + this.replayBgmAndBgs(); + this.makeRewards(); + this.displayVictoryMessage(); + this.displayRewards(); + this.gainRewards(); + this.endBattle(0); +}; + +BattleManager.processEscape = function() { + $gameParty.performEscape(); + SoundManager.playEscape(); + const success = this._preemptive || Math.random() < this._escapeRatio; + if (success) { + this.onEscapeSuccess(); + } else { + this.onEscapeFailure(); + } + return success; +}; + +BattleManager.onEscapeSuccess = function() { + this.displayEscapeSuccessMessage(); + this._escaped = true; + this.processAbort(); +}; + +BattleManager.onEscapeFailure = function() { + $gameParty.onEscapeFailure(); + this.displayEscapeFailureMessage(); + this._escapeRatio += 0.1; + if (!this.isTpb()) { + this.startTurn(); + } +}; + +BattleManager.processPartyEscape = function() { + this._escaped = true; + this.processAbort(); +}; + +BattleManager.processAbort = function() { + $gameParty.removeBattleStates(); + this._logWindow.clear(); + this.replayBgmAndBgs(); + this.endBattle(1); +}; + +BattleManager.processDefeat = function() { + this.displayDefeatMessage(); + this.playDefeatMe(); + if (this._canLose) { + this.replayBgmAndBgs(); + } else { + AudioManager.stopBgm(); + } + this.endBattle(2); +}; + +BattleManager.endBattle = function(result) { + this._phase = "battleEnd"; + this.cancelActorInput(); + this._inputting = false; + if (this._eventCallback) { + this._eventCallback(result); + } + if (result === 0) { + $gameSystem.onBattleWin(); + } else if (this._escaped) { + $gameSystem.onBattleEscape(); + } + $gameTemp.clearCommonEventReservation(); +}; + +BattleManager.updateBattleEnd = function() { + if (this.isBattleTest()) { + AudioManager.stopBgm(); + SceneManager.exit(); + } else if (!this._escaped && $gameParty.isAllDead()) { + if (this._canLose) { + $gameParty.reviveBattleMembers(); + SceneManager.pop(); + } else { + SceneManager.goto(Scene_Gameover); + } + } else { + SceneManager.pop(); + } + this._phase = ""; +}; + +BattleManager.makeRewards = function() { + this._rewards = { + gold: $gameTroop.goldTotal(), + exp: $gameTroop.expTotal(), + items: $gameTroop.makeDropItems() + }; +}; + +BattleManager.displayVictoryMessage = function() { + $gameMessage.add(TextManager.victory.format($gameParty.name())); +}; + +BattleManager.displayDefeatMessage = function() { + $gameMessage.add(TextManager.defeat.format($gameParty.name())); +}; + +BattleManager.displayEscapeSuccessMessage = function() { + $gameMessage.add(TextManager.escapeStart.format($gameParty.name())); +}; + +BattleManager.displayEscapeFailureMessage = function() { + $gameMessage.add(TextManager.escapeStart.format($gameParty.name())); + $gameMessage.add("\\." + TextManager.escapeFailure); +}; + +BattleManager.displayRewards = function() { + this.displayExp(); + this.displayGold(); + this.displayDropItems(); +}; + +BattleManager.displayExp = function() { + const exp = this._rewards.exp; + if (exp > 0) { + const text = TextManager.obtainExp.format(exp, TextManager.exp); + $gameMessage.add("\\." + text); + } +}; + +BattleManager.displayGold = function() { + const gold = this._rewards.gold; + if (gold > 0) { + $gameMessage.add("\\." + TextManager.obtainGold.format(gold)); + } +}; + +BattleManager.displayDropItems = function() { + const items = this._rewards.items; + if (items.length > 0) { + $gameMessage.newPage(); + for (const item of items) { + $gameMessage.add(TextManager.obtainItem.format(item.name)); + } + } +}; + +BattleManager.gainRewards = function() { + this.gainExp(); + this.gainGold(); + this.gainDropItems(); +}; + +BattleManager.gainExp = function() { + const exp = this._rewards.exp; + for (const actor of $gameParty.allMembers()) { + actor.gainExp(exp); + } +}; + +BattleManager.gainGold = function() { + $gameParty.gainGold(this._rewards.gold); +}; + +BattleManager.gainDropItems = function() { + const items = this._rewards.items; + for (const item of items) { + $gameParty.gainItem(item, 1); + } +}; + +//----------------------------------------------------------------------------- +// PluginManager +// +// The static class that manages the plugins. + +function PluginManager() { + throw new Error("This is a static class"); +} + +PluginManager._scripts = []; +PluginManager._errorUrls = []; +PluginManager._parameters = {}; +PluginManager._commands = {}; + +PluginManager.setup = function(plugins) { + for (const plugin of plugins) { + const pluginName = Utils.extractFileName(plugin.name); + if (plugin.status && !this._scripts.includes(pluginName)) { + this.setParameters(pluginName, plugin.parameters); + this.loadScript(plugin.name); + this._scripts.push(pluginName); + } + } +}; + +PluginManager.parameters = function(name) { + return this._parameters[name.toLowerCase()] || {}; +}; + +PluginManager.setParameters = function(name, parameters) { + this._parameters[name.toLowerCase()] = parameters; +}; + +PluginManager.loadScript = function(filename) { + const url = this.makeUrl(filename); + const script = document.createElement("script"); + script.type = "text/javascript"; + script.src = url; + script.async = false; + script.defer = true; + script.onerror = this.onError.bind(this); + script._url = url; + document.body.appendChild(script); +}; + +PluginManager.onError = function(e) { + this._errorUrls.push(e.target._url); +}; + +PluginManager.makeUrl = function(filename) { + return "js/plugins/" + Utils.encodeURI(filename) + ".js"; +}; + +PluginManager.checkErrors = function() { + const url = this._errorUrls.shift(); + if (url) { + this.throwLoadError(url); + } +}; + +PluginManager.throwLoadError = function(url) { + throw new Error("Failed to load: " + url); +}; + +PluginManager.registerCommand = function(pluginName, commandName, func) { + const key = pluginName + ":" + commandName; + this._commands[key] = func; +}; + +PluginManager.callCommand = function(self, pluginName, commandName, args) { + const key = pluginName + ":" + commandName; + const func = this._commands[key]; + if (typeof func === "function") { + func.bind(self)(args); + } +}; + +//----------------------------------------------------------------------------- diff --git a/js/rmmz_objects.js b/js/rmmz_objects.js new file mode 100644 index 0000000..764ac10 --- /dev/null +++ b/js/rmmz_objects.js @@ -0,0 +1,11323 @@ +//============================================================================= +// rmmz_objects.js v1.8.1 +//============================================================================= + +//----------------------------------------------------------------------------- +// Game_Temp +// +// The game object class for temporary data that is not included in save data. + +function Game_Temp() { + this.initialize(...arguments); +} + +Game_Temp.prototype.initialize = function() { + this._isPlaytest = Utils.isOptionValid("test"); + this._destinationX = null; + this._destinationY = null; + this._touchTarget = null; + this._touchState = ""; + this._needsBattleRefresh = false; + this._commonEventQueue = []; + this._animationQueue = []; + this._balloonQueue = []; + this._lastActionData = [0, 0, 0, 0, 0, 0]; +}; + +Game_Temp.prototype.isPlaytest = function() { + return this._isPlaytest; +}; + +Game_Temp.prototype.setDestination = function(x, y) { + this._destinationX = x; + this._destinationY = y; +}; + +Game_Temp.prototype.clearDestination = function() { + this._destinationX = null; + this._destinationY = null; +}; + +Game_Temp.prototype.isDestinationValid = function() { + return this._destinationX !== null; +}; + +Game_Temp.prototype.destinationX = function() { + return this._destinationX; +}; + +Game_Temp.prototype.destinationY = function() { + return this._destinationY; +}; + +Game_Temp.prototype.setTouchState = function(target, state) { + this._touchTarget = target; + this._touchState = state; +}; + +Game_Temp.prototype.clearTouchState = function() { + this._touchTarget = null; + this._touchState = ""; +}; + +Game_Temp.prototype.touchTarget = function() { + return this._touchTarget; +}; + +Game_Temp.prototype.touchState = function() { + return this._touchState; +}; + +Game_Temp.prototype.requestBattleRefresh = function() { + if ($gameParty.inBattle()) { + this._needsBattleRefresh = true; + } +}; + +Game_Temp.prototype.clearBattleRefreshRequest = function() { + this._needsBattleRefresh = false; +}; + +Game_Temp.prototype.isBattleRefreshRequested = function() { + return this._needsBattleRefresh; +}; + +Game_Temp.prototype.reserveCommonEvent = function(commonEventId) { + this._commonEventQueue.push(commonEventId); +}; + +Game_Temp.prototype.retrieveCommonEvent = function() { + return $dataCommonEvents[this._commonEventQueue.shift()]; +}; + +Game_Temp.prototype.clearCommonEventReservation = function() { + this._commonEventQueue.length = 0; +}; + +Game_Temp.prototype.isCommonEventReserved = function() { + return this._commonEventQueue.length > 0; +}; + +// prettier-ignore +Game_Temp.prototype.requestAnimation = function( + targets, animationId, mirror = false +) { + if ($dataAnimations[animationId]) { + const request = { + targets: targets, + animationId: animationId, + mirror: mirror + }; + this._animationQueue.push(request); + for (const target of targets) { + if (target.startAnimation) { + target.startAnimation(); + } + } + } +}; + +Game_Temp.prototype.retrieveAnimation = function() { + return this._animationQueue.shift(); +}; + +Game_Temp.prototype.requestBalloon = function(target, balloonId) { + const request = { target: target, balloonId: balloonId }; + this._balloonQueue.push(request); + if (target.startBalloon) { + target.startBalloon(); + } +}; + +Game_Temp.prototype.retrieveBalloon = function() { + return this._balloonQueue.shift(); +}; + +Game_Temp.prototype.lastActionData = function(type) { + return this._lastActionData[type] || 0; +}; + +Game_Temp.prototype.setLastActionData = function(type, value) { + this._lastActionData[type] = value; +}; + +Game_Temp.prototype.setLastUsedSkillId = function(skillID) { + this.setLastActionData(0, skillID); +}; + +Game_Temp.prototype.setLastUsedItemId = function(itemID) { + this.setLastActionData(1, itemID); +}; + +Game_Temp.prototype.setLastSubjectActorId = function(actorID) { + this.setLastActionData(2, actorID); +}; + +Game_Temp.prototype.setLastSubjectEnemyIndex = function(enemyIndex) { + this.setLastActionData(3, enemyIndex); +}; + +Game_Temp.prototype.setLastTargetActorId = function(actorID) { + this.setLastActionData(4, actorID); +}; + +Game_Temp.prototype.setLastTargetEnemyIndex = function(enemyIndex) { + this.setLastActionData(5, enemyIndex); +}; + +//----------------------------------------------------------------------------- +// Game_System +// +// The game object class for the system data. + +function Game_System() { + this.initialize(...arguments); +} + +Game_System.prototype.initialize = function() { + this._saveEnabled = true; + this._menuEnabled = true; + this._encounterEnabled = true; + this._formationEnabled = true; + this._battleCount = 0; + this._winCount = 0; + this._escapeCount = 0; + this._saveCount = 0; + this._versionId = 0; + this._savefileId = 0; + this._framesOnSave = 0; + this._bgmOnSave = null; + this._bgsOnSave = null; + this._windowTone = null; + this._battleBgm = null; + this._victoryMe = null; + this._defeatMe = null; + this._savedBgm = null; + this._walkingBgm = null; +}; + +Game_System.prototype.isJapanese = function() { + return $dataSystem.locale.match(/^ja/); +}; + +Game_System.prototype.isChinese = function() { + return $dataSystem.locale.match(/^zh/); +}; + +Game_System.prototype.isKorean = function() { + return $dataSystem.locale.match(/^ko/); +}; + +Game_System.prototype.isCJK = function() { + return $dataSystem.locale.match(/^(ja|zh|ko)/); +}; + +Game_System.prototype.isRussian = function() { + return $dataSystem.locale.match(/^ru/); +}; + +Game_System.prototype.isSideView = function() { + return $dataSystem.optSideView; +}; + +Game_System.prototype.isAutosaveEnabled = function() { + return $dataSystem.optAutosave; +}; + +Game_System.prototype.isMessageSkipEnabled = function() { + return $dataSystem.optMessageSkip; +}; + +Game_System.prototype.isSaveEnabled = function() { + return this._saveEnabled; +}; + +Game_System.prototype.disableSave = function() { + this._saveEnabled = false; +}; + +Game_System.prototype.enableSave = function() { + this._saveEnabled = true; +}; + +Game_System.prototype.isMenuEnabled = function() { + return this._menuEnabled; +}; + +Game_System.prototype.disableMenu = function() { + this._menuEnabled = false; +}; + +Game_System.prototype.enableMenu = function() { + this._menuEnabled = true; +}; + +Game_System.prototype.isEncounterEnabled = function() { + return this._encounterEnabled; +}; + +Game_System.prototype.disableEncounter = function() { + this._encounterEnabled = false; +}; + +Game_System.prototype.enableEncounter = function() { + this._encounterEnabled = true; +}; + +Game_System.prototype.isFormationEnabled = function() { + return this._formationEnabled; +}; + +Game_System.prototype.disableFormation = function() { + this._formationEnabled = false; +}; + +Game_System.prototype.enableFormation = function() { + this._formationEnabled = true; +}; + +Game_System.prototype.battleCount = function() { + return this._battleCount; +}; + +Game_System.prototype.winCount = function() { + return this._winCount; +}; + +Game_System.prototype.escapeCount = function() { + return this._escapeCount; +}; + +Game_System.prototype.saveCount = function() { + return this._saveCount; +}; + +Game_System.prototype.versionId = function() { + return this._versionId; +}; + +Game_System.prototype.savefileId = function() { + return this._savefileId || 0; +}; + +Game_System.prototype.setSavefileId = function(savefileId) { + this._savefileId = savefileId; +}; + +Game_System.prototype.windowTone = function() { + return this._windowTone || $dataSystem.windowTone; +}; + +Game_System.prototype.setWindowTone = function(value) { + this._windowTone = value; +}; + +Game_System.prototype.battleBgm = function() { + return this._battleBgm || $dataSystem.battleBgm; +}; + +Game_System.prototype.setBattleBgm = function(value) { + this._battleBgm = value; +}; + +Game_System.prototype.victoryMe = function() { + return this._victoryMe || $dataSystem.victoryMe; +}; + +Game_System.prototype.setVictoryMe = function(value) { + this._victoryMe = value; +}; + +Game_System.prototype.defeatMe = function() { + return this._defeatMe || $dataSystem.defeatMe; +}; + +Game_System.prototype.setDefeatMe = function(value) { + this._defeatMe = value; +}; + +Game_System.prototype.onBattleStart = function() { + this._battleCount++; +}; + +Game_System.prototype.onBattleWin = function() { + this._winCount++; +}; + +Game_System.prototype.onBattleEscape = function() { + this._escapeCount++; +}; + +Game_System.prototype.onBeforeSave = function() { + this._saveCount++; + this._versionId = $dataSystem.versionId; + this._framesOnSave = Graphics.frameCount; + this._bgmOnSave = AudioManager.saveBgm(); + this._bgsOnSave = AudioManager.saveBgs(); +}; + +Game_System.prototype.onAfterLoad = function() { + Graphics.frameCount = this._framesOnSave; + AudioManager.playBgm(this._bgmOnSave); + AudioManager.playBgs(this._bgsOnSave); +}; + +Game_System.prototype.playtime = function() { + return Math.floor(Graphics.frameCount / 60); +}; + +Game_System.prototype.playtimeText = function() { + const hour = Math.floor(this.playtime() / 60 / 60); + const min = Math.floor(this.playtime() / 60) % 60; + const sec = this.playtime() % 60; + return hour.padZero(2) + ":" + min.padZero(2) + ":" + sec.padZero(2); +}; + +Game_System.prototype.saveBgm = function() { + this._savedBgm = AudioManager.saveBgm(); +}; + +Game_System.prototype.replayBgm = function() { + if (this._savedBgm) { + AudioManager.replayBgm(this._savedBgm); + } +}; + +Game_System.prototype.saveWalkingBgm = function() { + this._walkingBgm = AudioManager.saveBgm(); +}; + +Game_System.prototype.replayWalkingBgm = function() { + if (this._walkingBgm) { + AudioManager.playBgm(this._walkingBgm); + } +}; + +Game_System.prototype.saveWalkingBgm2 = function() { + this._walkingBgm = $dataMap.bgm; +}; + +Game_System.prototype.mainFontFace = function() { + return "rmmz-mainfont, " + $dataSystem.advanced.fallbackFonts; +}; + +Game_System.prototype.numberFontFace = function() { + return "rmmz-numberfont, " + this.mainFontFace(); +}; + +Game_System.prototype.mainFontSize = function() { + return $dataSystem.advanced.fontSize; +}; + +Game_System.prototype.windowPadding = function() { + return 12; +}; + +Game_System.prototype.windowOpacity = function() { + return $dataSystem.advanced.windowOpacity; +}; + +//----------------------------------------------------------------------------- +// Game_Timer +// +// The game object class for the timer. + +function Game_Timer() { + this.initialize(...arguments); +} + +Game_Timer.prototype.initialize = function() { + this._frames = 0; + this._working = false; +}; + +Game_Timer.prototype.update = function(sceneActive) { + if (sceneActive && this._working && this._frames > 0) { + this._frames--; + if (this._frames === 0) { + this.onExpire(); + } + } +}; + +Game_Timer.prototype.start = function(count) { + this._frames = count; + this._working = true; +}; + +Game_Timer.prototype.stop = function() { + this._working = false; +}; + +Game_Timer.prototype.isWorking = function() { + return this._working; +}; + +Game_Timer.prototype.seconds = function() { + return Math.floor(this._frames / 60); +}; + +Game_Timer.prototype.frames = function() { + return this._frames; +}; + +Game_Timer.prototype.onExpire = function() { + BattleManager.abort(); +}; + +//----------------------------------------------------------------------------- +// Game_Message +// +// The game object class for the state of the message window that displays text +// or selections, etc. + +function Game_Message() { + this.initialize(...arguments); +} + +Game_Message.prototype.initialize = function() { + this.clear(); +}; + +Game_Message.prototype.clear = function() { + this._texts = []; + this._choices = []; + this._speakerName = ""; + this._faceName = ""; + this._faceIndex = 0; + this._background = 0; + this._positionType = 2; + this._choiceDefaultType = 0; + this._choiceCancelType = 0; + this._choiceBackground = 0; + this._choicePositionType = 2; + this._numInputVariableId = 0; + this._numInputMaxDigits = 0; + this._itemChoiceVariableId = 0; + this._itemChoiceItypeId = 0; + this._scrollMode = false; + this._scrollSpeed = 2; + this._scrollNoFast = false; + this._choiceCallback = null; +}; + +Game_Message.prototype.choices = function() { + return this._choices; +}; + +Game_Message.prototype.speakerName = function() { + return this._speakerName; +}; + +Game_Message.prototype.faceName = function() { + return this._faceName; +}; + +Game_Message.prototype.faceIndex = function() { + return this._faceIndex; +}; + +Game_Message.prototype.background = function() { + return this._background; +}; + +Game_Message.prototype.positionType = function() { + return this._positionType; +}; + +Game_Message.prototype.choiceDefaultType = function() { + return this._choiceDefaultType; +}; + +Game_Message.prototype.choiceCancelType = function() { + return this._choiceCancelType; +}; + +Game_Message.prototype.choiceBackground = function() { + return this._choiceBackground; +}; + +Game_Message.prototype.choicePositionType = function() { + return this._choicePositionType; +}; + +Game_Message.prototype.numInputVariableId = function() { + return this._numInputVariableId; +}; + +Game_Message.prototype.numInputMaxDigits = function() { + return this._numInputMaxDigits; +}; + +Game_Message.prototype.itemChoiceVariableId = function() { + return this._itemChoiceVariableId; +}; + +Game_Message.prototype.itemChoiceItypeId = function() { + return this._itemChoiceItypeId; +}; + +Game_Message.prototype.scrollMode = function() { + return this._scrollMode; +}; + +Game_Message.prototype.scrollSpeed = function() { + return this._scrollSpeed; +}; + +Game_Message.prototype.scrollNoFast = function() { + return this._scrollNoFast; +}; + +Game_Message.prototype.add = function(text) { + this._texts.push(text); +}; + +Game_Message.prototype.setSpeakerName = function(speakerName) { + this._speakerName = speakerName ? speakerName : ""; +}; + +Game_Message.prototype.setFaceImage = function(faceName, faceIndex) { + this._faceName = faceName; + this._faceIndex = faceIndex; +}; + +Game_Message.prototype.setBackground = function(background) { + this._background = background; +}; + +Game_Message.prototype.setPositionType = function(positionType) { + this._positionType = positionType; +}; + +Game_Message.prototype.setChoices = function(choices, defaultType, cancelType) { + this._choices = choices; + this._choiceDefaultType = defaultType; + this._choiceCancelType = cancelType; +}; + +Game_Message.prototype.setChoiceBackground = function(background) { + this._choiceBackground = background; +}; + +Game_Message.prototype.setChoicePositionType = function(positionType) { + this._choicePositionType = positionType; +}; + +Game_Message.prototype.setNumberInput = function(variableId, maxDigits) { + this._numInputVariableId = variableId; + this._numInputMaxDigits = maxDigits; +}; + +Game_Message.prototype.setItemChoice = function(variableId, itemType) { + this._itemChoiceVariableId = variableId; + this._itemChoiceItypeId = itemType; +}; + +Game_Message.prototype.setScroll = function(speed, noFast) { + this._scrollMode = true; + this._scrollSpeed = speed; + this._scrollNoFast = noFast; +}; + +Game_Message.prototype.setChoiceCallback = function(callback) { + this._choiceCallback = callback; +}; + +Game_Message.prototype.onChoice = function(n) { + if (this._choiceCallback) { + this._choiceCallback(n); + this._choiceCallback = null; + } +}; + +Game_Message.prototype.hasText = function() { + return this._texts.length > 0; +}; + +Game_Message.prototype.isChoice = function() { + return this._choices.length > 0; +}; + +Game_Message.prototype.isNumberInput = function() { + return this._numInputVariableId > 0; +}; + +Game_Message.prototype.isItemChoice = function() { + return this._itemChoiceVariableId > 0; +}; + +Game_Message.prototype.isBusy = function() { + return ( + this.hasText() || + this.isChoice() || + this.isNumberInput() || + this.isItemChoice() + ); +}; + +Game_Message.prototype.newPage = function() { + if (this._texts.length > 0) { + this._texts[this._texts.length - 1] += "\f"; + } +}; + +Game_Message.prototype.allText = function() { + return this._texts.join("\n"); +}; + +Game_Message.prototype.isRTL = function() { + return Utils.containsArabic(this.allText()); +}; + +//----------------------------------------------------------------------------- +// Game_Switches +// +// The game object class for switches. + +function Game_Switches() { + this.initialize(...arguments); +} + +Game_Switches.prototype.initialize = function() { + this.clear(); +}; + +Game_Switches.prototype.clear = function() { + this._data = []; +}; + +Game_Switches.prototype.value = function(switchId) { + return !!this._data[switchId]; +}; + +Game_Switches.prototype.setValue = function(switchId, value) { + if (switchId > 0 && switchId < $dataSystem.switches.length) { + this._data[switchId] = value; + this.onChange(); + } +}; + +Game_Switches.prototype.onChange = function() { + $gameMap.requestRefresh(); +}; + +//----------------------------------------------------------------------------- +// Game_Variables +// +// The game object class for variables. + +function Game_Variables() { + this.initialize(...arguments); +} + +Game_Variables.prototype.initialize = function() { + this.clear(); +}; + +Game_Variables.prototype.clear = function() { + this._data = []; +}; + +Game_Variables.prototype.value = function(variableId) { + return this._data[variableId] || 0; +}; + +Game_Variables.prototype.setValue = function(variableId, value) { + if (variableId > 0 && variableId < $dataSystem.variables.length) { + if (typeof value === "number") { + value = Math.floor(value); + } + this._data[variableId] = value; + this.onChange(); + } +}; + +Game_Variables.prototype.onChange = function() { + $gameMap.requestRefresh(); +}; + +//----------------------------------------------------------------------------- +// Game_SelfSwitches +// +// The game object class for self switches. + +function Game_SelfSwitches() { + this.initialize(...arguments); +} + +Game_SelfSwitches.prototype.initialize = function() { + this.clear(); +}; + +Game_SelfSwitches.prototype.clear = function() { + this._data = {}; +}; + +Game_SelfSwitches.prototype.value = function(key) { + return !!this._data[key]; +}; + +Game_SelfSwitches.prototype.setValue = function(key, value) { + if (value) { + this._data[key] = true; + } else { + delete this._data[key]; + } + this.onChange(); +}; + +Game_SelfSwitches.prototype.onChange = function() { + $gameMap.requestRefresh(); +}; + +//----------------------------------------------------------------------------- +// Game_Screen +// +// The game object class for screen effect data, such as changes in color tone +// and flashes. + +function Game_Screen() { + this.initialize(...arguments); +} + +Game_Screen.prototype.initialize = function() { + this.clear(); +}; + +Game_Screen.prototype.clear = function() { + this.clearFade(); + this.clearTone(); + this.clearFlash(); + this.clearShake(); + this.clearZoom(); + this.clearWeather(); + this.clearPictures(); +}; + +Game_Screen.prototype.onBattleStart = function() { + this.clearFade(); + this.clearFlash(); + this.clearShake(); + this.clearZoom(); + this.eraseBattlePictures(); +}; + +Game_Screen.prototype.brightness = function() { + return this._brightness; +}; + +Game_Screen.prototype.tone = function() { + return this._tone; +}; + +Game_Screen.prototype.flashColor = function() { + return this._flashColor; +}; + +Game_Screen.prototype.shake = function() { + return this._shake; +}; + +Game_Screen.prototype.zoomX = function() { + return this._zoomX; +}; + +Game_Screen.prototype.zoomY = function() { + return this._zoomY; +}; + +Game_Screen.prototype.zoomScale = function() { + return this._zoomScale; +}; + +Game_Screen.prototype.weatherType = function() { + return this._weatherType; +}; + +Game_Screen.prototype.weatherPower = function() { + return this._weatherPower; +}; + +Game_Screen.prototype.picture = function(pictureId) { + const realPictureId = this.realPictureId(pictureId); + return this._pictures[realPictureId]; +}; + +Game_Screen.prototype.realPictureId = function(pictureId) { + if ($gameParty.inBattle()) { + return pictureId + this.maxPictures(); + } else { + return pictureId; + } +}; + +Game_Screen.prototype.clearFade = function() { + this._brightness = 255; + this._fadeOutDuration = 0; + this._fadeInDuration = 0; +}; + +Game_Screen.prototype.clearTone = function() { + this._tone = [0, 0, 0, 0]; + this._toneTarget = [0, 0, 0, 0]; + this._toneDuration = 0; +}; + +Game_Screen.prototype.clearFlash = function() { + this._flashColor = [0, 0, 0, 0]; + this._flashDuration = 0; +}; + +Game_Screen.prototype.clearShake = function() { + this._shakePower = 0; + this._shakeSpeed = 0; + this._shakeDuration = 0; + this._shakeDirection = 1; + this._shake = 0; +}; + +Game_Screen.prototype.clearZoom = function() { + this._zoomX = 0; + this._zoomY = 0; + this._zoomScale = 1; + this._zoomScaleTarget = 1; + this._zoomDuration = 0; +}; + +Game_Screen.prototype.clearWeather = function() { + this._weatherType = "none"; + this._weatherPower = 0; + this._weatherPowerTarget = 0; + this._weatherDuration = 0; +}; + +Game_Screen.prototype.clearPictures = function() { + this._pictures = []; +}; + +Game_Screen.prototype.eraseBattlePictures = function() { + this._pictures = this._pictures.slice(0, this.maxPictures() + 1); +}; + +Game_Screen.prototype.maxPictures = function() { + return 100; +}; + +Game_Screen.prototype.startFadeOut = function(duration) { + this._fadeOutDuration = duration; + this._fadeInDuration = 0; +}; + +Game_Screen.prototype.startFadeIn = function(duration) { + this._fadeInDuration = duration; + this._fadeOutDuration = 0; +}; + +Game_Screen.prototype.startTint = function(tone, duration) { + this._toneTarget = tone.clone(); + this._toneDuration = duration; + if (this._toneDuration === 0) { + this._tone = this._toneTarget.clone(); + } +}; + +Game_Screen.prototype.startFlash = function(color, duration) { + this._flashColor = color.clone(); + this._flashDuration = duration; +}; + +Game_Screen.prototype.startShake = function(power, speed, duration) { + this._shakePower = power; + this._shakeSpeed = speed; + this._shakeDuration = duration; +}; + +Game_Screen.prototype.startZoom = function(x, y, scale, duration) { + this._zoomX = x; + this._zoomY = y; + this._zoomScaleTarget = scale; + this._zoomDuration = duration; +}; + +Game_Screen.prototype.setZoom = function(x, y, scale) { + this._zoomX = x; + this._zoomY = y; + this._zoomScale = scale; +}; + +Game_Screen.prototype.changeWeather = function(type, power, duration) { + if (type !== "none" || duration === 0) { + this._weatherType = type; + } + this._weatherPowerTarget = type === "none" ? 0 : power; + this._weatherDuration = duration; + if (duration === 0) { + this._weatherPower = this._weatherPowerTarget; + } +}; + +Game_Screen.prototype.update = function() { + this.updateFadeOut(); + this.updateFadeIn(); + this.updateTone(); + this.updateFlash(); + this.updateShake(); + this.updateZoom(); + this.updateWeather(); + this.updatePictures(); +}; + +Game_Screen.prototype.updateFadeOut = function() { + if (this._fadeOutDuration > 0) { + const d = this._fadeOutDuration; + this._brightness = (this._brightness * (d - 1)) / d; + this._fadeOutDuration--; + } +}; + +Game_Screen.prototype.updateFadeIn = function() { + if (this._fadeInDuration > 0) { + const d = this._fadeInDuration; + this._brightness = (this._brightness * (d - 1) + 255) / d; + this._fadeInDuration--; + } +}; + +Game_Screen.prototype.updateTone = function() { + if (this._toneDuration > 0) { + const d = this._toneDuration; + for (let i = 0; i < 4; i++) { + this._tone[i] = (this._tone[i] * (d - 1) + this._toneTarget[i]) / d; + } + this._toneDuration--; + } +}; + +Game_Screen.prototype.updateFlash = function() { + if (this._flashDuration > 0) { + const d = this._flashDuration; + this._flashColor[3] *= (d - 1) / d; + this._flashDuration--; + } +}; + +Game_Screen.prototype.updateShake = function() { + if (this._shakeDuration > 0 || this._shake !== 0) { + const delta = + (this._shakePower * this._shakeSpeed * this._shakeDirection) / 10; + if ( + this._shakeDuration <= 1 && + this._shake * (this._shake + delta) < 0 + ) { + this._shake = 0; + } else { + this._shake += delta; + } + if (this._shake > this._shakePower * 2) { + this._shakeDirection = -1; + } + if (this._shake < -this._shakePower * 2) { + this._shakeDirection = 1; + } + this._shakeDuration--; + } +}; + +Game_Screen.prototype.updateZoom = function() { + if (this._zoomDuration > 0) { + const d = this._zoomDuration; + const t = this._zoomScaleTarget; + this._zoomScale = (this._zoomScale * (d - 1) + t) / d; + this._zoomDuration--; + } +}; + +Game_Screen.prototype.updateWeather = function() { + if (this._weatherDuration > 0) { + const d = this._weatherDuration; + const t = this._weatherPowerTarget; + this._weatherPower = (this._weatherPower * (d - 1) + t) / d; + this._weatherDuration--; + if (this._weatherDuration === 0 && this._weatherPowerTarget === 0) { + this._weatherType = "none"; + } + } +}; + +Game_Screen.prototype.updatePictures = function() { + for (const picture of this._pictures) { + if (picture) { + picture.update(); + } + } +}; + +Game_Screen.prototype.startFlashForDamage = function() { + this.startFlash([255, 0, 0, 128], 8); +}; + +// prettier-ignore +Game_Screen.prototype.showPicture = function( + pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode +) { + const realPictureId = this.realPictureId(pictureId); + const picture = new Game_Picture(); + picture.show(name, origin, x, y, scaleX, scaleY, opacity, blendMode); + this._pictures[realPictureId] = picture; +}; + +// prettier-ignore +Game_Screen.prototype.movePicture = function( + pictureId, origin, x, y, scaleX, scaleY, opacity, blendMode, duration, + easingType +) { + const picture = this.picture(pictureId); + if (picture) { + // prettier-ignore + picture.move(origin, x, y, scaleX, scaleY, opacity, blendMode, + duration, easingType); + } +}; + +Game_Screen.prototype.rotatePicture = function(pictureId, speed) { + const picture = this.picture(pictureId); + if (picture) { + picture.rotate(speed); + } +}; + +Game_Screen.prototype.tintPicture = function(pictureId, tone, duration) { + const picture = this.picture(pictureId); + if (picture) { + picture.tint(tone, duration); + } +}; + +Game_Screen.prototype.erasePicture = function(pictureId) { + const realPictureId = this.realPictureId(pictureId); + this._pictures[realPictureId] = null; +}; + +//----------------------------------------------------------------------------- +// Game_Picture +// +// The game object class for a picture. + +function Game_Picture() { + this.initialize(...arguments); +} + +Game_Picture.prototype.initialize = function() { + this.initBasic(); + this.initTarget(); + this.initTone(); + this.initRotation(); +}; + +Game_Picture.prototype.name = function() { + return this._name; +}; + +Game_Picture.prototype.origin = function() { + return this._origin; +}; + +Game_Picture.prototype.x = function() { + return this._x; +}; + +Game_Picture.prototype.y = function() { + return this._y; +}; + +Game_Picture.prototype.scaleX = function() { + return this._scaleX; +}; + +Game_Picture.prototype.scaleY = function() { + return this._scaleY; +}; + +Game_Picture.prototype.opacity = function() { + return this._opacity; +}; + +Game_Picture.prototype.blendMode = function() { + return this._blendMode; +}; + +Game_Picture.prototype.tone = function() { + return this._tone; +}; + +Game_Picture.prototype.angle = function() { + return this._angle; +}; + +Game_Picture.prototype.initBasic = function() { + this._name = ""; + this._origin = 0; + this._x = 0; + this._y = 0; + this._scaleX = 100; + this._scaleY = 100; + this._opacity = 255; + this._blendMode = 0; +}; + +Game_Picture.prototype.initTarget = function() { + this._targetX = this._x; + this._targetY = this._y; + this._targetScaleX = this._scaleX; + this._targetScaleY = this._scaleY; + this._targetOpacity = this._opacity; + this._duration = 0; + this._wholeDuration = 0; + this._easingType = 0; + this._easingExponent = 0; +}; + +Game_Picture.prototype.initTone = function() { + this._tone = null; + this._toneTarget = null; + this._toneDuration = 0; +}; + +Game_Picture.prototype.initRotation = function() { + this._angle = 0; + this._rotationSpeed = 0; +}; + +// prettier-ignore +Game_Picture.prototype.show = function( + name, origin, x, y, scaleX, scaleY, opacity, blendMode +) { + this._name = name; + this._origin = origin; + this._x = x; + this._y = y; + this._scaleX = scaleX; + this._scaleY = scaleY; + this._opacity = opacity; + this._blendMode = blendMode; + this.initTarget(); + this.initTone(); + this.initRotation(); +}; + +// prettier-ignore +Game_Picture.prototype.move = function( + origin, x, y, scaleX, scaleY, opacity, blendMode, duration, easingType +) { + this._origin = origin; + this._targetX = x; + this._targetY = y; + this._targetScaleX = scaleX; + this._targetScaleY = scaleY; + this._targetOpacity = opacity; + this._blendMode = blendMode; + this._duration = duration; + this._wholeDuration = duration; + this._easingType = easingType; + this._easingExponent = 2; +}; + +Game_Picture.prototype.rotate = function(speed) { + this._rotationSpeed = speed; +}; + +Game_Picture.prototype.tint = function(tone, duration) { + if (!this._tone) { + this._tone = [0, 0, 0, 0]; + } + this._toneTarget = tone.clone(); + this._toneDuration = duration; + if (this._toneDuration === 0) { + this._tone = this._toneTarget.clone(); + } +}; + +Game_Picture.prototype.update = function() { + this.updateMove(); + this.updateTone(); + this.updateRotation(); +}; + +Game_Picture.prototype.updateMove = function() { + if (this._duration > 0) { + this._x = this.applyEasing(this._x, this._targetX); + this._y = this.applyEasing(this._y, this._targetY); + this._scaleX = this.applyEasing(this._scaleX, this._targetScaleX); + this._scaleY = this.applyEasing(this._scaleY, this._targetScaleY); + this._opacity = this.applyEasing(this._opacity, this._targetOpacity); + this._duration--; + } +}; + +Game_Picture.prototype.updateTone = function() { + if (this._toneDuration > 0) { + const d = this._toneDuration; + for (let i = 0; i < 4; i++) { + this._tone[i] = (this._tone[i] * (d - 1) + this._toneTarget[i]) / d; + } + this._toneDuration--; + } +}; + +Game_Picture.prototype.updateRotation = function() { + if (this._rotationSpeed !== 0) { + this._angle += this._rotationSpeed / 2; + } +}; + +Game_Picture.prototype.applyEasing = function(current, target) { + const d = this._duration; + const wd = this._wholeDuration; + const lt = this.calcEasing((wd - d) / wd); + const t = this.calcEasing((wd - d + 1) / wd); + const start = (current - target * lt) / (1 - lt); + return start + (target - start) * t; +}; + +Game_Picture.prototype.calcEasing = function(t) { + const exponent = this._easingExponent; + switch (this._easingType) { + case 1: // Slow start + return this.easeIn(t, exponent); + case 2: // Slow end + return this.easeOut(t, exponent); + case 3: // Slow start and end + return this.easeInOut(t, exponent); + default: + return t; + } +}; + +Game_Picture.prototype.easeIn = function(t, exponent) { + return Math.pow(t, exponent); +}; + +Game_Picture.prototype.easeOut = function(t, exponent) { + return 1 - Math.pow(1 - t, exponent); +}; + +Game_Picture.prototype.easeInOut = function(t, exponent) { + if (t < 0.5) { + return this.easeIn(t * 2, exponent) / 2; + } else { + return this.easeOut(t * 2 - 1, exponent) / 2 + 0.5; + } +}; + +//----------------------------------------------------------------------------- +// Game_Item +// +// The game object class for handling skills, items, weapons, and armor. It is +// required because save data should not include the database object itself. + +function Game_Item() { + this.initialize(...arguments); +} + +Game_Item.prototype.initialize = function(item) { + this._dataClass = ""; + this._itemId = 0; + if (item) { + this.setObject(item); + } +}; + +Game_Item.prototype.isSkill = function() { + return this._dataClass === "skill"; +}; + +Game_Item.prototype.isItem = function() { + return this._dataClass === "item"; +}; + +Game_Item.prototype.isUsableItem = function() { + return this.isSkill() || this.isItem(); +}; + +Game_Item.prototype.isWeapon = function() { + return this._dataClass === "weapon"; +}; + +Game_Item.prototype.isArmor = function() { + return this._dataClass === "armor"; +}; + +Game_Item.prototype.isEquipItem = function() { + return this.isWeapon() || this.isArmor(); +}; + +Game_Item.prototype.isNull = function() { + return this._dataClass === ""; +}; + +Game_Item.prototype.itemId = function() { + return this._itemId; +}; + +Game_Item.prototype.object = function() { + if (this.isSkill()) { + return $dataSkills[this._itemId]; + } else if (this.isItem()) { + return $dataItems[this._itemId]; + } else if (this.isWeapon()) { + return $dataWeapons[this._itemId]; + } else if (this.isArmor()) { + return $dataArmors[this._itemId]; + } else { + return null; + } +}; + +Game_Item.prototype.setObject = function(item) { + if (DataManager.isSkill(item)) { + this._dataClass = "skill"; + } else if (DataManager.isItem(item)) { + this._dataClass = "item"; + } else if (DataManager.isWeapon(item)) { + this._dataClass = "weapon"; + } else if (DataManager.isArmor(item)) { + this._dataClass = "armor"; + } else { + this._dataClass = ""; + } + this._itemId = item ? item.id : 0; +}; + +Game_Item.prototype.setEquip = function(isWeapon, itemId) { + this._dataClass = isWeapon ? "weapon" : "armor"; + this._itemId = itemId; +}; + +//----------------------------------------------------------------------------- +// Game_Action +// +// The game object class for a battle action. + +function Game_Action() { + this.initialize(...arguments); +} + +Game_Action.EFFECT_RECOVER_HP = 11; +Game_Action.EFFECT_RECOVER_MP = 12; +Game_Action.EFFECT_GAIN_TP = 13; +Game_Action.EFFECT_ADD_STATE = 21; +Game_Action.EFFECT_REMOVE_STATE = 22; +Game_Action.EFFECT_ADD_BUFF = 31; +Game_Action.EFFECT_ADD_DEBUFF = 32; +Game_Action.EFFECT_REMOVE_BUFF = 33; +Game_Action.EFFECT_REMOVE_DEBUFF = 34; +Game_Action.EFFECT_SPECIAL = 41; +Game_Action.EFFECT_GROW = 42; +Game_Action.EFFECT_LEARN_SKILL = 43; +Game_Action.EFFECT_COMMON_EVENT = 44; +Game_Action.SPECIAL_EFFECT_ESCAPE = 0; +Game_Action.HITTYPE_CERTAIN = 0; +Game_Action.HITTYPE_PHYSICAL = 1; +Game_Action.HITTYPE_MAGICAL = 2; + +Game_Action.prototype.initialize = function(subject, forcing) { + this._subjectActorId = 0; + this._subjectEnemyIndex = -1; + this._forcing = forcing || false; + this.setSubject(subject); + this.clear(); +}; + +Game_Action.prototype.clear = function() { + this._item = new Game_Item(); + this._targetIndex = -1; +}; + +Game_Action.prototype.setSubject = function(subject) { + if (subject.isActor()) { + this._subjectActorId = subject.actorId(); + this._subjectEnemyIndex = -1; + } else { + this._subjectEnemyIndex = subject.index(); + this._subjectActorId = 0; + } +}; + +Game_Action.prototype.subject = function() { + if (this._subjectActorId > 0) { + return $gameActors.actor(this._subjectActorId); + } else { + return $gameTroop.members()[this._subjectEnemyIndex]; + } +}; + +Game_Action.prototype.friendsUnit = function() { + return this.subject().friendsUnit(); +}; + +Game_Action.prototype.opponentsUnit = function() { + return this.subject().opponentsUnit(); +}; + +Game_Action.prototype.setEnemyAction = function(action) { + if (action) { + this.setSkill(action.skillId); + } else { + this.clear(); + } +}; + +Game_Action.prototype.setAttack = function() { + this.setSkill(this.subject().attackSkillId()); +}; + +Game_Action.prototype.setGuard = function() { + this.setSkill(this.subject().guardSkillId()); +}; + +Game_Action.prototype.setSkill = function(skillId) { + this._item.setObject($dataSkills[skillId]); +}; + +Game_Action.prototype.setItem = function(itemId) { + this._item.setObject($dataItems[itemId]); +}; + +Game_Action.prototype.setItemObject = function(object) { + this._item.setObject(object); +}; + +Game_Action.prototype.setTarget = function(targetIndex) { + this._targetIndex = targetIndex; +}; + +Game_Action.prototype.item = function() { + return this._item.object(); +}; + +Game_Action.prototype.isSkill = function() { + return this._item.isSkill(); +}; + +Game_Action.prototype.isItem = function() { + return this._item.isItem(); +}; + +Game_Action.prototype.numRepeats = function() { + let repeats = this.item().repeats; + if (this.isAttack()) { + repeats += this.subject().attackTimesAdd(); + } + return Math.floor(repeats); +}; + +Game_Action.prototype.checkItemScope = function(list) { + return list.includes(this.item().scope); +}; + +Game_Action.prototype.isForOpponent = function() { + return this.checkItemScope([1, 2, 3, 4, 5, 6, 14]); +}; + +Game_Action.prototype.isForFriend = function() { + return this.checkItemScope([7, 8, 9, 10, 11, 12, 13, 14]); +}; + +Game_Action.prototype.isForEveryone = function() { + return this.checkItemScope([14]); +}; + +Game_Action.prototype.isForAliveFriend = function() { + return this.checkItemScope([7, 8, 11, 14]); +}; + +Game_Action.prototype.isForDeadFriend = function() { + return this.checkItemScope([9, 10]); +}; + +Game_Action.prototype.isForUser = function() { + return this.checkItemScope([11]); +}; + +Game_Action.prototype.isForOne = function() { + return this.checkItemScope([1, 3, 7, 9, 11, 12]); +}; + +Game_Action.prototype.isForRandom = function() { + return this.checkItemScope([3, 4, 5, 6]); +}; + +Game_Action.prototype.isForAll = function() { + return this.checkItemScope([2, 8, 10, 13, 14]); +}; + +Game_Action.prototype.needsSelection = function() { + return this.checkItemScope([1, 7, 9, 12]); +}; + +Game_Action.prototype.numTargets = function() { + return this.isForRandom() ? this.item().scope - 2 : 0; +}; + +Game_Action.prototype.checkDamageType = function(list) { + return list.includes(this.item().damage.type); +}; + +Game_Action.prototype.isHpEffect = function() { + return this.checkDamageType([1, 3, 5]); +}; + +Game_Action.prototype.isMpEffect = function() { + return this.checkDamageType([2, 4, 6]); +}; + +Game_Action.prototype.isDamage = function() { + return this.checkDamageType([1, 2]); +}; + +Game_Action.prototype.isRecover = function() { + return this.checkDamageType([3, 4]); +}; + +Game_Action.prototype.isDrain = function() { + return this.checkDamageType([5, 6]); +}; + +Game_Action.prototype.isHpRecover = function() { + return this.checkDamageType([3]); +}; + +Game_Action.prototype.isMpRecover = function() { + return this.checkDamageType([4]); +}; + +Game_Action.prototype.isCertainHit = function() { + return this.item().hitType === Game_Action.HITTYPE_CERTAIN; +}; + +Game_Action.prototype.isPhysical = function() { + return this.item().hitType === Game_Action.HITTYPE_PHYSICAL; +}; + +Game_Action.prototype.isMagical = function() { + return this.item().hitType === Game_Action.HITTYPE_MAGICAL; +}; + +Game_Action.prototype.isAttack = function() { + return this.item() === $dataSkills[this.subject().attackSkillId()]; +}; + +Game_Action.prototype.isGuard = function() { + return this.item() === $dataSkills[this.subject().guardSkillId()]; +}; + +Game_Action.prototype.isMagicSkill = function() { + if (this.isSkill()) { + return $dataSystem.magicSkills.includes(this.item().stypeId); + } else { + return false; + } +}; + +Game_Action.prototype.decideRandomTarget = function() { + let target; + if (this.isForDeadFriend()) { + target = this.friendsUnit().randomDeadTarget(); + } else if (this.isForFriend()) { + target = this.friendsUnit().randomTarget(); + } else { + target = this.opponentsUnit().randomTarget(); + } + if (target) { + this._targetIndex = target.index(); + } else { + this.clear(); + } +}; + +Game_Action.prototype.setConfusion = function() { + this.setAttack(); +}; + +Game_Action.prototype.prepare = function() { + if (this.subject().isConfused() && !this._forcing) { + this.setConfusion(); + } +}; + +Game_Action.prototype.isValid = function() { + return (this._forcing && this.item()) || this.subject().canUse(this.item()); +}; + +Game_Action.prototype.speed = function() { + const agi = this.subject().agi; + let speed = agi + Math.randomInt(Math.floor(5 + agi / 4)); + if (this.item()) { + speed += this.item().speed; + } + if (this.isAttack()) { + speed += this.subject().attackSpeed(); + } + return speed; +}; + +Game_Action.prototype.makeTargets = function() { + const targets = []; + if (!this._forcing && this.subject().isConfused()) { + targets.push(this.confusionTarget()); + } else if (this.isForEveryone()) { + targets.push(...this.targetsForEveryone()); + } else if (this.isForOpponent()) { + targets.push(...this.targetsForOpponents()); + } else if (this.isForFriend()) { + targets.push(...this.targetsForFriends()); + } + return this.repeatTargets(targets); +}; + +Game_Action.prototype.repeatTargets = function(targets) { + const repeatedTargets = []; + const repeats = this.numRepeats(); + for (const target of targets) { + if (target) { + for (let i = 0; i < repeats; i++) { + repeatedTargets.push(target); + } + } + } + return repeatedTargets; +}; + +Game_Action.prototype.confusionTarget = function() { + switch (this.subject().confusionLevel()) { + case 1: + return this.opponentsUnit().randomTarget(); + case 2: + if (Math.randomInt(2) === 0) { + return this.opponentsUnit().randomTarget(); + } + return this.friendsUnit().randomTarget(); + default: + return this.friendsUnit().randomTarget(); + } +}; + +Game_Action.prototype.targetsForEveryone = function() { + const opponentMembers = this.opponentsUnit().aliveMembers(); + const friendMembers = this.friendsUnit().aliveMembers(); + return opponentMembers.concat(friendMembers); +}; + +Game_Action.prototype.targetsForOpponents = function() { + const unit = this.opponentsUnit(); + if (this.isForRandom()) { + return this.randomTargets(unit); + } else { + return this.targetsForAlive(unit); + } +}; + +Game_Action.prototype.targetsForFriends = function() { + const unit = this.friendsUnit(); + if (this.isForUser()) { + return [this.subject()]; + } else if (this.isForDeadFriend()) { + return this.targetsForDead(unit); + } else if (this.isForAliveFriend()) { + return this.targetsForAlive(unit); + } else { + return this.targetsForDeadAndAlive(unit); + } +}; + +Game_Action.prototype.randomTargets = function(unit) { + const targets = []; + for (let i = 0; i < this.numTargets(); i++) { + targets.push(unit.randomTarget()); + } + return targets; +}; + +Game_Action.prototype.targetsForDead = function(unit) { + if (this.isForOne()) { + return [unit.smoothDeadTarget(this._targetIndex)]; + } else { + return unit.deadMembers(); + } +}; + +Game_Action.prototype.targetsForAlive = function(unit) { + if (this.isForOne()) { + if (this._targetIndex < 0) { + return [unit.randomTarget()]; + } else { + return [unit.smoothTarget(this._targetIndex)]; + } + } else { + return unit.aliveMembers(); + } +}; + +Game_Action.prototype.targetsForDeadAndAlive = function(unit) { + if (this.isForOne()) { + return [unit.members()[this._targetIndex]]; + } else { + return unit.members(); + } +}; + +Game_Action.prototype.evaluate = function() { + let value = 0; + for (const target of this.itemTargetCandidates()) { + const targetValue = this.evaluateWithTarget(target); + if (this.isForAll()) { + value += targetValue; + } else if (targetValue > value) { + value = targetValue; + this._targetIndex = target.index(); + } + } + value *= this.numRepeats(); + if (value > 0) { + value += Math.random(); + } + return value; +}; + +Game_Action.prototype.itemTargetCandidates = function() { + if (!this.isValid()) { + return []; + } else if (this.isForOpponent()) { + return this.opponentsUnit().aliveMembers(); + } else if (this.isForUser()) { + return [this.subject()]; + } else if (this.isForDeadFriend()) { + return this.friendsUnit().deadMembers(); + } else { + return this.friendsUnit().aliveMembers(); + } +}; + +Game_Action.prototype.evaluateWithTarget = function(target) { + if (this.isHpEffect()) { + const value = this.makeDamageValue(target, false); + if (this.isForOpponent()) { + return value / Math.max(target.hp, 1); + } else { + const recovery = Math.min(-value, target.mhp - target.hp); + return recovery / target.mhp; + } + } +}; + +Game_Action.prototype.testApply = function(target) { + return ( + this.testLifeAndDeath(target) && + ($gameParty.inBattle() || + (this.isHpRecover() && target.hp < target.mhp) || + (this.isMpRecover() && target.mp < target.mmp) || + this.hasItemAnyValidEffects(target)) + ); +}; + +Game_Action.prototype.testLifeAndDeath = function(target) { + if (this.isForOpponent() || this.isForAliveFriend()) { + return target.isAlive(); + } else if (this.isForDeadFriend()) { + return target.isDead(); + } else { + return true; + } +}; + +Game_Action.prototype.hasItemAnyValidEffects = function(target) { + return this.item().effects.some(effect => + this.testItemEffect(target, effect) + ); +}; + +Game_Action.prototype.testItemEffect = function(target, effect) { + switch (effect.code) { + case Game_Action.EFFECT_RECOVER_HP: + return ( + target.hp < target.mhp || effect.value1 < 0 || effect.value2 < 0 + ); + case Game_Action.EFFECT_RECOVER_MP: + return ( + target.mp < target.mmp || effect.value1 < 0 || effect.value2 < 0 + ); + case Game_Action.EFFECT_ADD_STATE: + return !target.isStateAffected(effect.dataId); + case Game_Action.EFFECT_REMOVE_STATE: + return target.isStateAffected(effect.dataId); + case Game_Action.EFFECT_ADD_BUFF: + return !target.isMaxBuffAffected(effect.dataId); + case Game_Action.EFFECT_ADD_DEBUFF: + return !target.isMaxDebuffAffected(effect.dataId); + case Game_Action.EFFECT_REMOVE_BUFF: + return target.isBuffAffected(effect.dataId); + case Game_Action.EFFECT_REMOVE_DEBUFF: + return target.isDebuffAffected(effect.dataId); + case Game_Action.EFFECT_LEARN_SKILL: + return target.isActor() && !target.isLearnedSkill(effect.dataId); + default: + return true; + } +}; + +Game_Action.prototype.itemCnt = function(target) { + if (this.isPhysical() && target.canMove()) { + return target.cnt; + } else { + return 0; + } +}; + +Game_Action.prototype.itemMrf = function(target) { + if (this.isMagical()) { + return target.mrf; + } else { + return 0; + } +}; + +Game_Action.prototype.itemHit = function(/*target*/) { + const successRate = this.item().successRate; + if (this.isPhysical()) { + return successRate * 0.01 * this.subject().hit; + } else { + return successRate * 0.01; + } +}; + +Game_Action.prototype.itemEva = function(target) { + if (this.isPhysical()) { + return target.eva; + } else if (this.isMagical()) { + return target.mev; + } else { + return 0; + } +}; + +Game_Action.prototype.itemCri = function(target) { + return this.item().damage.critical + ? this.subject().cri * (1 - target.cev) + : 0; +}; + +Game_Action.prototype.apply = function(target) { + const result = target.result(); + this.subject().clearResult(); + result.clear(); + result.used = this.testApply(target); + result.missed = result.used && Math.random() >= this.itemHit(target); + result.evaded = !result.missed && Math.random() < this.itemEva(target); + result.physical = this.isPhysical(); + result.drain = this.isDrain(); + if (result.isHit()) { + if (this.item().damage.type > 0) { + result.critical = Math.random() < this.itemCri(target); + const value = this.makeDamageValue(target, result.critical); + this.executeDamage(target, value); + } + for (const effect of this.item().effects) { + this.applyItemEffect(target, effect); + } + this.applyItemUserEffect(target); + } + this.updateLastTarget(target); +}; + +Game_Action.prototype.makeDamageValue = function(target, critical) { + const item = this.item(); + const baseValue = this.evalDamageFormula(target); + let value = baseValue * this.calcElementRate(target); + if (this.isPhysical()) { + value *= target.pdr; + } + if (this.isMagical()) { + value *= target.mdr; + } + if (baseValue < 0) { + value *= target.rec; + } + if (critical) { + value = this.applyCritical(value); + } + value = this.applyVariance(value, item.damage.variance); + value = this.applyGuard(value, target); + value = Math.round(value); + return value; +}; + +Game_Action.prototype.evalDamageFormula = function(target) { + try { + const item = this.item(); + const a = this.subject(); // eslint-disable-line no-unused-vars + const b = target; // eslint-disable-line no-unused-vars + const v = $gameVariables._data; // eslint-disable-line no-unused-vars + const sign = [3, 4].includes(item.damage.type) ? -1 : 1; + const value = Math.max(eval(item.damage.formula), 0) * sign; + return isNaN(value) ? 0 : value; + } catch (e) { + return 0; + } +}; + +Game_Action.prototype.calcElementRate = function(target) { + if (this.item().damage.elementId < 0) { + return this.elementsMaxRate(target, this.subject().attackElements()); + } else { + return target.elementRate(this.item().damage.elementId); + } +}; + +Game_Action.prototype.elementsMaxRate = function(target, elements) { + if (elements.length > 0) { + const rates = elements.map(elementId => target.elementRate(elementId)); + return Math.max(...rates); + } else { + return 1; + } +}; + +Game_Action.prototype.applyCritical = function(damage) { + return damage * 3; +}; + +Game_Action.prototype.applyVariance = function(damage, variance) { + const amp = Math.floor(Math.max((Math.abs(damage) * variance) / 100, 0)); + const v = Math.randomInt(amp + 1) + Math.randomInt(amp + 1) - amp; + return damage >= 0 ? damage + v : damage - v; +}; + +Game_Action.prototype.applyGuard = function(damage, target) { + return damage / (damage > 0 && target.isGuard() ? 2 * target.grd : 1); +}; + +Game_Action.prototype.executeDamage = function(target, value) { + const result = target.result(); + if (value === 0) { + result.critical = false; + } + if (this.isHpEffect()) { + this.executeHpDamage(target, value); + } + if (this.isMpEffect()) { + this.executeMpDamage(target, value); + } +}; + +Game_Action.prototype.executeHpDamage = function(target, value) { + if (this.isDrain()) { + value = Math.min(target.hp, value); + } + this.makeSuccess(target); + target.gainHp(-value); + if (value > 0) { + target.onDamage(value); + } + this.gainDrainedHp(value); +}; + +Game_Action.prototype.executeMpDamage = function(target, value) { + if (!this.isMpRecover()) { + value = Math.min(target.mp, value); + } + if (value !== 0) { + this.makeSuccess(target); + } + target.gainMp(-value); + this.gainDrainedMp(value); +}; + +Game_Action.prototype.gainDrainedHp = function(value) { + if (this.isDrain()) { + let gainTarget = this.subject(); + if (this._reflectionTarget) { + gainTarget = this._reflectionTarget; + } + gainTarget.gainHp(value); + } +}; + +Game_Action.prototype.gainDrainedMp = function(value) { + if (this.isDrain()) { + let gainTarget = this.subject(); + if (this._reflectionTarget) { + gainTarget = this._reflectionTarget; + } + gainTarget.gainMp(value); + } +}; + +Game_Action.prototype.applyItemEffect = function(target, effect) { + switch (effect.code) { + case Game_Action.EFFECT_RECOVER_HP: + this.itemEffectRecoverHp(target, effect); + break; + case Game_Action.EFFECT_RECOVER_MP: + this.itemEffectRecoverMp(target, effect); + break; + case Game_Action.EFFECT_GAIN_TP: + this.itemEffectGainTp(target, effect); + break; + case Game_Action.EFFECT_ADD_STATE: + this.itemEffectAddState(target, effect); + break; + case Game_Action.EFFECT_REMOVE_STATE: + this.itemEffectRemoveState(target, effect); + break; + case Game_Action.EFFECT_ADD_BUFF: + this.itemEffectAddBuff(target, effect); + break; + case Game_Action.EFFECT_ADD_DEBUFF: + this.itemEffectAddDebuff(target, effect); + break; + case Game_Action.EFFECT_REMOVE_BUFF: + this.itemEffectRemoveBuff(target, effect); + break; + case Game_Action.EFFECT_REMOVE_DEBUFF: + this.itemEffectRemoveDebuff(target, effect); + break; + case Game_Action.EFFECT_SPECIAL: + this.itemEffectSpecial(target, effect); + break; + case Game_Action.EFFECT_GROW: + this.itemEffectGrow(target, effect); + break; + case Game_Action.EFFECT_LEARN_SKILL: + this.itemEffectLearnSkill(target, effect); + break; + case Game_Action.EFFECT_COMMON_EVENT: + this.itemEffectCommonEvent(target, effect); + break; + } +}; + +Game_Action.prototype.itemEffectRecoverHp = function(target, effect) { + let value = (target.mhp * effect.value1 + effect.value2) * target.rec; + if (this.isItem()) { + value *= this.subject().pha; + } + value = Math.floor(value); + if (value !== 0) { + target.gainHp(value); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectRecoverMp = function(target, effect) { + let value = (target.mmp * effect.value1 + effect.value2) * target.rec; + if (this.isItem()) { + value *= this.subject().pha; + } + value = Math.floor(value); + if (value !== 0) { + target.gainMp(value); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectGainTp = function(target, effect) { + let value = Math.floor(effect.value1); + if (value !== 0) { + target.gainTp(value); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectAddState = function(target, effect) { + if (effect.dataId === 0) { + this.itemEffectAddAttackState(target, effect); + } else { + this.itemEffectAddNormalState(target, effect); + } +}; + +Game_Action.prototype.itemEffectAddAttackState = function(target, effect) { + for (const stateId of this.subject().attackStates()) { + let chance = effect.value1; + chance *= target.stateRate(stateId); + chance *= this.subject().attackStatesRate(stateId); + chance *= this.lukEffectRate(target); + if (Math.random() < chance) { + target.addState(stateId); + this.makeSuccess(target); + } + } +}; + +Game_Action.prototype.itemEffectAddNormalState = function(target, effect) { + let chance = effect.value1; + if (!this.isCertainHit()) { + chance *= target.stateRate(effect.dataId); + chance *= this.lukEffectRate(target); + } + if (Math.random() < chance) { + target.addState(effect.dataId); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectRemoveState = function(target, effect) { + let chance = effect.value1; + if (Math.random() < chance) { + target.removeState(effect.dataId); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectAddBuff = function(target, effect) { + target.addBuff(effect.dataId, effect.value1); + this.makeSuccess(target); +}; + +Game_Action.prototype.itemEffectAddDebuff = function(target, effect) { + let chance = target.debuffRate(effect.dataId) * this.lukEffectRate(target); + if (Math.random() < chance) { + target.addDebuff(effect.dataId, effect.value1); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectRemoveBuff = function(target, effect) { + if (target.isBuffAffected(effect.dataId)) { + target.removeBuff(effect.dataId); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectRemoveDebuff = function(target, effect) { + if (target.isDebuffAffected(effect.dataId)) { + target.removeBuff(effect.dataId); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectSpecial = function(target, effect) { + if (effect.dataId === Game_Action.SPECIAL_EFFECT_ESCAPE) { + target.escape(); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectGrow = function(target, effect) { + target.addParam(effect.dataId, Math.floor(effect.value1)); + this.makeSuccess(target); +}; + +Game_Action.prototype.itemEffectLearnSkill = function(target, effect) { + if (target.isActor()) { + target.learnSkill(effect.dataId); + this.makeSuccess(target); + } +}; + +Game_Action.prototype.itemEffectCommonEvent = function(/*target, effect*/) { + // +}; + +Game_Action.prototype.makeSuccess = function(target) { + target.result().success = true; +}; + +Game_Action.prototype.applyItemUserEffect = function(/*target*/) { + const value = Math.floor(this.item().tpGain * this.subject().tcr); + this.subject().gainSilentTp(value); +}; + +Game_Action.prototype.lukEffectRate = function(target) { + return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0); +}; + +Game_Action.prototype.applyGlobal = function() { + for (const effect of this.item().effects) { + if (effect.code === Game_Action.EFFECT_COMMON_EVENT) { + $gameTemp.reserveCommonEvent(effect.dataId); + } + } + this.updateLastUsed(); + this.updateLastSubject(); +}; + +Game_Action.prototype.updateLastUsed = function() { + const item = this.item(); + if (DataManager.isSkill(item)) { + $gameTemp.setLastUsedSkillId(item.id); + } else if (DataManager.isItem(item)) { + $gameTemp.setLastUsedItemId(item.id); + } +}; + +Game_Action.prototype.updateLastSubject = function() { + const subject = this.subject(); + if (subject.isActor()) { + $gameTemp.setLastSubjectActorId(subject.actorId()); + } else { + $gameTemp.setLastSubjectEnemyIndex(subject.index() + 1); + } +}; + +Game_Action.prototype.updateLastTarget = function(target) { + if (target.isActor()) { + $gameTemp.setLastTargetActorId(target.actorId()); + } else { + $gameTemp.setLastTargetEnemyIndex(target.index() + 1); + } +}; + +//----------------------------------------------------------------------------- +// Game_ActionResult +// +// The game object class for a result of a battle action. For convinience, all +// member variables in this class are public. + +function Game_ActionResult() { + this.initialize(...arguments); +} + +Game_ActionResult.prototype.initialize = function() { + this.clear(); +}; + +Game_ActionResult.prototype.clear = function() { + this.used = false; + this.missed = false; + this.evaded = false; + this.physical = false; + this.drain = false; + this.critical = false; + this.success = false; + this.hpAffected = false; + this.hpDamage = 0; + this.mpDamage = 0; + this.tpDamage = 0; + this.addedStates = []; + this.removedStates = []; + this.addedBuffs = []; + this.addedDebuffs = []; + this.removedBuffs = []; +}; + +Game_ActionResult.prototype.addedStateObjects = function() { + return this.addedStates.map(id => $dataStates[id]); +}; + +Game_ActionResult.prototype.removedStateObjects = function() { + return this.removedStates.map(id => $dataStates[id]); +}; + +Game_ActionResult.prototype.isStatusAffected = function() { + return ( + this.addedStates.length > 0 || + this.removedStates.length > 0 || + this.addedBuffs.length > 0 || + this.addedDebuffs.length > 0 || + this.removedBuffs.length > 0 + ); +}; + +Game_ActionResult.prototype.isHit = function() { + return this.used && !this.missed && !this.evaded; +}; + +Game_ActionResult.prototype.isStateAdded = function(stateId) { + return this.addedStates.includes(stateId); +}; + +Game_ActionResult.prototype.pushAddedState = function(stateId) { + if (!this.isStateAdded(stateId)) { + this.addedStates.push(stateId); + } +}; + +Game_ActionResult.prototype.isStateRemoved = function(stateId) { + return this.removedStates.includes(stateId); +}; + +Game_ActionResult.prototype.pushRemovedState = function(stateId) { + if (!this.isStateRemoved(stateId)) { + this.removedStates.push(stateId); + } +}; + +Game_ActionResult.prototype.isBuffAdded = function(paramId) { + return this.addedBuffs.includes(paramId); +}; + +Game_ActionResult.prototype.pushAddedBuff = function(paramId) { + if (!this.isBuffAdded(paramId)) { + this.addedBuffs.push(paramId); + } +}; + +Game_ActionResult.prototype.isDebuffAdded = function(paramId) { + return this.addedDebuffs.includes(paramId); +}; + +Game_ActionResult.prototype.pushAddedDebuff = function(paramId) { + if (!this.isDebuffAdded(paramId)) { + this.addedDebuffs.push(paramId); + } +}; + +Game_ActionResult.prototype.isBuffRemoved = function(paramId) { + return this.removedBuffs.includes(paramId); +}; + +Game_ActionResult.prototype.pushRemovedBuff = function(paramId) { + if (!this.isBuffRemoved(paramId)) { + this.removedBuffs.push(paramId); + } +}; + +//----------------------------------------------------------------------------- +// Game_BattlerBase +// +// The superclass of Game_Battler. It mainly contains parameters calculation. + +function Game_BattlerBase() { + this.initialize(...arguments); +} + +Game_BattlerBase.TRAIT_ELEMENT_RATE = 11; +Game_BattlerBase.TRAIT_DEBUFF_RATE = 12; +Game_BattlerBase.TRAIT_STATE_RATE = 13; +Game_BattlerBase.TRAIT_STATE_RESIST = 14; +Game_BattlerBase.TRAIT_PARAM = 21; +Game_BattlerBase.TRAIT_XPARAM = 22; +Game_BattlerBase.TRAIT_SPARAM = 23; +Game_BattlerBase.TRAIT_ATTACK_ELEMENT = 31; +Game_BattlerBase.TRAIT_ATTACK_STATE = 32; +Game_BattlerBase.TRAIT_ATTACK_SPEED = 33; +Game_BattlerBase.TRAIT_ATTACK_TIMES = 34; +Game_BattlerBase.TRAIT_ATTACK_SKILL = 35; +Game_BattlerBase.TRAIT_STYPE_ADD = 41; +Game_BattlerBase.TRAIT_STYPE_SEAL = 42; +Game_BattlerBase.TRAIT_SKILL_ADD = 43; +Game_BattlerBase.TRAIT_SKILL_SEAL = 44; +Game_BattlerBase.TRAIT_EQUIP_WTYPE = 51; +Game_BattlerBase.TRAIT_EQUIP_ATYPE = 52; +Game_BattlerBase.TRAIT_EQUIP_LOCK = 53; +Game_BattlerBase.TRAIT_EQUIP_SEAL = 54; +Game_BattlerBase.TRAIT_SLOT_TYPE = 55; +Game_BattlerBase.TRAIT_ACTION_PLUS = 61; +Game_BattlerBase.TRAIT_SPECIAL_FLAG = 62; +Game_BattlerBase.TRAIT_COLLAPSE_TYPE = 63; +Game_BattlerBase.TRAIT_PARTY_ABILITY = 64; +Game_BattlerBase.FLAG_ID_AUTO_BATTLE = 0; +Game_BattlerBase.FLAG_ID_GUARD = 1; +Game_BattlerBase.FLAG_ID_SUBSTITUTE = 2; +Game_BattlerBase.FLAG_ID_PRESERVE_TP = 3; +Game_BattlerBase.ICON_BUFF_START = 32; +Game_BattlerBase.ICON_DEBUFF_START = 48; + +Object.defineProperties(Game_BattlerBase.prototype, { + // Hit Points + hp: { + get: function() { + return this._hp; + }, + configurable: true + }, + // Magic Points + mp: { + get: function() { + return this._mp; + }, + configurable: true + }, + // Tactical Points + tp: { + get: function() { + return this._tp; + }, + configurable: true + }, + // Maximum Hit Points + mhp: { + get: function() { + return this.param(0); + }, + configurable: true + }, + // Maximum Magic Points + mmp: { + get: function() { + return this.param(1); + }, + configurable: true + }, + // ATtacK power + atk: { + get: function() { + return this.param(2); + }, + configurable: true + }, + // DEFense power + def: { + get: function() { + return this.param(3); + }, + configurable: true + }, + // Magic ATtack power + mat: { + get: function() { + return this.param(4); + }, + configurable: true + }, + // Magic DeFense power + mdf: { + get: function() { + return this.param(5); + }, + configurable: true + }, + // AGIlity + agi: { + get: function() { + return this.param(6); + }, + configurable: true + }, + // LUcK + luk: { + get: function() { + return this.param(7); + }, + configurable: true + }, + // HIT rate + hit: { + get: function() { + return this.xparam(0); + }, + configurable: true + }, + // EVAsion rate + eva: { + get: function() { + return this.xparam(1); + }, + configurable: true + }, + // CRItical rate + cri: { + get: function() { + return this.xparam(2); + }, + configurable: true + }, + // Critical EVasion rate + cev: { + get: function() { + return this.xparam(3); + }, + configurable: true + }, + // Magic EVasion rate + mev: { + get: function() { + return this.xparam(4); + }, + configurable: true + }, + // Magic ReFlection rate + mrf: { + get: function() { + return this.xparam(5); + }, + configurable: true + }, + // CouNTer attack rate + cnt: { + get: function() { + return this.xparam(6); + }, + configurable: true + }, + // Hp ReGeneration rate + hrg: { + get: function() { + return this.xparam(7); + }, + configurable: true + }, + // Mp ReGeneration rate + mrg: { + get: function() { + return this.xparam(8); + }, + configurable: true + }, + // Tp ReGeneration rate + trg: { + get: function() { + return this.xparam(9); + }, + configurable: true + }, + // TarGet Rate + tgr: { + get: function() { + return this.sparam(0); + }, + configurable: true + }, + // GuaRD effect rate + grd: { + get: function() { + return this.sparam(1); + }, + configurable: true + }, + // RECovery effect rate + rec: { + get: function() { + return this.sparam(2); + }, + configurable: true + }, + // PHArmacology + pha: { + get: function() { + return this.sparam(3); + }, + configurable: true + }, + // Mp Cost Rate + mcr: { + get: function() { + return this.sparam(4); + }, + configurable: true + }, + // Tp Charge Rate + tcr: { + get: function() { + return this.sparam(5); + }, + configurable: true + }, + // Physical Damage Rate + pdr: { + get: function() { + return this.sparam(6); + }, + configurable: true + }, + // Magic Damage Rate + mdr: { + get: function() { + return this.sparam(7); + }, + configurable: true + }, + // Floor Damage Rate + fdr: { + get: function() { + return this.sparam(8); + }, + configurable: true + }, + // EXperience Rate + exr: { + get: function() { + return this.sparam(9); + }, + configurable: true + } +}); + +Game_BattlerBase.prototype.initialize = function() { + this.initMembers(); +}; + +Game_BattlerBase.prototype.initMembers = function() { + this._hp = 1; + this._mp = 0; + this._tp = 0; + this._hidden = false; + this.clearParamPlus(); + this.clearStates(); + this.clearBuffs(); +}; + +Game_BattlerBase.prototype.clearParamPlus = function() { + this._paramPlus = [0, 0, 0, 0, 0, 0, 0, 0]; +}; + +Game_BattlerBase.prototype.clearStates = function() { + this._states = []; + this._stateTurns = {}; +}; + +Game_BattlerBase.prototype.eraseState = function(stateId) { + this._states.remove(stateId); + delete this._stateTurns[stateId]; +}; + +Game_BattlerBase.prototype.isStateAffected = function(stateId) { + return this._states.includes(stateId); +}; + +Game_BattlerBase.prototype.isDeathStateAffected = function() { + return this.isStateAffected(this.deathStateId()); +}; + +Game_BattlerBase.prototype.deathStateId = function() { + return 1; +}; + +Game_BattlerBase.prototype.resetStateCounts = function(stateId) { + const state = $dataStates[stateId]; + const variance = 1 + Math.max(state.maxTurns - state.minTurns, 0); + this._stateTurns[stateId] = state.minTurns + Math.randomInt(variance); +}; + +Game_BattlerBase.prototype.isStateExpired = function(stateId) { + return this._stateTurns[stateId] === 0; +}; + +Game_BattlerBase.prototype.updateStateTurns = function() { + for (const stateId of this._states) { + if (this._stateTurns[stateId] > 0) { + this._stateTurns[stateId]--; + } + } +}; + +Game_BattlerBase.prototype.clearBuffs = function() { + this._buffs = [0, 0, 0, 0, 0, 0, 0, 0]; + this._buffTurns = [0, 0, 0, 0, 0, 0, 0, 0]; +}; + +Game_BattlerBase.prototype.eraseBuff = function(paramId) { + this._buffs[paramId] = 0; + this._buffTurns[paramId] = 0; +}; + +Game_BattlerBase.prototype.buffLength = function() { + return this._buffs.length; +}; + +Game_BattlerBase.prototype.buff = function(paramId) { + return this._buffs[paramId]; +}; + +Game_BattlerBase.prototype.isBuffAffected = function(paramId) { + return this._buffs[paramId] > 0; +}; + +Game_BattlerBase.prototype.isDebuffAffected = function(paramId) { + return this._buffs[paramId] < 0; +}; + +Game_BattlerBase.prototype.isBuffOrDebuffAffected = function(paramId) { + return this._buffs[paramId] !== 0; +}; + +Game_BattlerBase.prototype.isMaxBuffAffected = function(paramId) { + return this._buffs[paramId] === 2; +}; + +Game_BattlerBase.prototype.isMaxDebuffAffected = function(paramId) { + return this._buffs[paramId] === -2; +}; + +Game_BattlerBase.prototype.increaseBuff = function(paramId) { + if (!this.isMaxBuffAffected(paramId)) { + this._buffs[paramId]++; + } +}; + +Game_BattlerBase.prototype.decreaseBuff = function(paramId) { + if (!this.isMaxDebuffAffected(paramId)) { + this._buffs[paramId]--; + } +}; + +Game_BattlerBase.prototype.overwriteBuffTurns = function(paramId, turns) { + if (this._buffTurns[paramId] < turns) { + this._buffTurns[paramId] = turns; + } +}; + +Game_BattlerBase.prototype.isBuffExpired = function(paramId) { + return this._buffTurns[paramId] === 0; +}; + +Game_BattlerBase.prototype.updateBuffTurns = function() { + for (let i = 0; i < this._buffTurns.length; i++) { + if (this._buffTurns[i] > 0) { + this._buffTurns[i]--; + } + } +}; + +Game_BattlerBase.prototype.die = function() { + this._hp = 0; + this.clearStates(); + this.clearBuffs(); +}; + +Game_BattlerBase.prototype.revive = function() { + if (this._hp === 0) { + this._hp = 1; + } +}; + +Game_BattlerBase.prototype.states = function() { + return this._states.map(id => $dataStates[id]); +}; + +Game_BattlerBase.prototype.stateIcons = function() { + return this.states() + .map(state => state.iconIndex) + .filter(iconIndex => iconIndex > 0); +}; + +Game_BattlerBase.prototype.buffIcons = function() { + const icons = []; + for (let i = 0; i < this._buffs.length; i++) { + if (this._buffs[i] !== 0) { + icons.push(this.buffIconIndex(this._buffs[i], i)); + } + } + return icons; +}; + +Game_BattlerBase.prototype.buffIconIndex = function(buffLevel, paramId) { + if (buffLevel > 0) { + return Game_BattlerBase.ICON_BUFF_START + (buffLevel - 1) * 8 + paramId; + } else if (buffLevel < 0) { + return ( + Game_BattlerBase.ICON_DEBUFF_START + (-buffLevel - 1) * 8 + paramId + ); + } else { + return 0; + } +}; + +Game_BattlerBase.prototype.allIcons = function() { + return this.stateIcons().concat(this.buffIcons()); +}; + +Game_BattlerBase.prototype.traitObjects = function() { + // Returns an array of the all objects having traits. States only here. + return this.states(); +}; + +Game_BattlerBase.prototype.allTraits = function() { + return this.traitObjects().reduce((r, obj) => r.concat(obj.traits), []); +}; + +Game_BattlerBase.prototype.traits = function(code) { + return this.allTraits().filter(trait => trait.code === code); +}; + +Game_BattlerBase.prototype.traitsWithId = function(code, id) { + return this.allTraits().filter( + trait => trait.code === code && trait.dataId === id + ); +}; + +Game_BattlerBase.prototype.traitsPi = function(code, id) { + return this.traitsWithId(code, id).reduce((r, trait) => r * trait.value, 1); +}; + +Game_BattlerBase.prototype.traitsSum = function(code, id) { + return this.traitsWithId(code, id).reduce((r, trait) => r + trait.value, 0); +}; + +Game_BattlerBase.prototype.traitsSumAll = function(code) { + return this.traits(code).reduce((r, trait) => r + trait.value, 0); +}; + +Game_BattlerBase.prototype.traitsSet = function(code) { + return this.traits(code).reduce((r, trait) => r.concat(trait.dataId), []); +}; + +Game_BattlerBase.prototype.paramBase = function(/*paramId*/) { + return 0; +}; + +Game_BattlerBase.prototype.paramPlus = function(paramId) { + return this._paramPlus[paramId]; +}; + +Game_BattlerBase.prototype.paramBasePlus = function(paramId) { + return Math.max(0, this.paramBase(paramId) + this.paramPlus(paramId)); +}; + +Game_BattlerBase.prototype.paramMin = function(paramId) { + if (paramId === 0) { + return 1; // MHP + } else { + return 0; + } +}; + +Game_BattlerBase.prototype.paramMax = function(/*paramId*/) { + return Infinity; +}; + +Game_BattlerBase.prototype.paramRate = function(paramId) { + return this.traitsPi(Game_BattlerBase.TRAIT_PARAM, paramId); +}; + +Game_BattlerBase.prototype.paramBuffRate = function(paramId) { + return this._buffs[paramId] * 0.25 + 1.0; +}; + +Game_BattlerBase.prototype.param = function(paramId) { + const value = + this.paramBasePlus(paramId) * + this.paramRate(paramId) * + this.paramBuffRate(paramId); + const maxValue = this.paramMax(paramId); + const minValue = this.paramMin(paramId); + return Math.round(value.clamp(minValue, maxValue)); +}; + +Game_BattlerBase.prototype.xparam = function(xparamId) { + return this.traitsSum(Game_BattlerBase.TRAIT_XPARAM, xparamId); +}; + +Game_BattlerBase.prototype.sparam = function(sparamId) { + return this.traitsPi(Game_BattlerBase.TRAIT_SPARAM, sparamId); +}; + +Game_BattlerBase.prototype.elementRate = function(elementId) { + return this.traitsPi(Game_BattlerBase.TRAIT_ELEMENT_RATE, elementId); +}; + +Game_BattlerBase.prototype.debuffRate = function(paramId) { + return this.traitsPi(Game_BattlerBase.TRAIT_DEBUFF_RATE, paramId); +}; + +Game_BattlerBase.prototype.stateRate = function(stateId) { + return this.traitsPi(Game_BattlerBase.TRAIT_STATE_RATE, stateId); +}; + +Game_BattlerBase.prototype.stateResistSet = function() { + return this.traitsSet(Game_BattlerBase.TRAIT_STATE_RESIST); +}; + +Game_BattlerBase.prototype.isStateResist = function(stateId) { + return this.stateResistSet().includes(stateId); +}; + +Game_BattlerBase.prototype.attackElements = function() { + return this.traitsSet(Game_BattlerBase.TRAIT_ATTACK_ELEMENT); +}; + +Game_BattlerBase.prototype.attackStates = function() { + return this.traitsSet(Game_BattlerBase.TRAIT_ATTACK_STATE); +}; + +Game_BattlerBase.prototype.attackStatesRate = function(stateId) { + return this.traitsSum(Game_BattlerBase.TRAIT_ATTACK_STATE, stateId); +}; + +Game_BattlerBase.prototype.attackSpeed = function() { + return this.traitsSumAll(Game_BattlerBase.TRAIT_ATTACK_SPEED); +}; + +Game_BattlerBase.prototype.attackTimesAdd = function() { + return Math.max(this.traitsSumAll(Game_BattlerBase.TRAIT_ATTACK_TIMES), 0); +}; + +Game_BattlerBase.prototype.attackSkillId = function() { + const set = this.traitsSet(Game_BattlerBase.TRAIT_ATTACK_SKILL); + return set.length > 0 ? Math.max(...set) : 1; +}; + +Game_BattlerBase.prototype.addedSkillTypes = function() { + return this.traitsSet(Game_BattlerBase.TRAIT_STYPE_ADD); +}; + +Game_BattlerBase.prototype.isSkillTypeSealed = function(stypeId) { + return this.traitsSet(Game_BattlerBase.TRAIT_STYPE_SEAL).includes(stypeId); +}; + +Game_BattlerBase.prototype.addedSkills = function() { + return this.traitsSet(Game_BattlerBase.TRAIT_SKILL_ADD); +}; + +Game_BattlerBase.prototype.isSkillSealed = function(skillId) { + return this.traitsSet(Game_BattlerBase.TRAIT_SKILL_SEAL).includes(skillId); +}; + +Game_BattlerBase.prototype.isEquipWtypeOk = function(wtypeId) { + return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_WTYPE).includes(wtypeId); +}; + +Game_BattlerBase.prototype.isEquipAtypeOk = function(atypeId) { + return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_ATYPE).includes(atypeId); +}; + +Game_BattlerBase.prototype.isEquipTypeLocked = function(etypeId) { + return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_LOCK).includes(etypeId); +}; + +Game_BattlerBase.prototype.isEquipTypeSealed = function(etypeId) { + return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_SEAL).includes(etypeId); +}; + +Game_BattlerBase.prototype.slotType = function() { + const set = this.traitsSet(Game_BattlerBase.TRAIT_SLOT_TYPE); + return set.length > 0 ? Math.max(...set) : 0; +}; + +Game_BattlerBase.prototype.isDualWield = function() { + return this.slotType() === 1; +}; + +Game_BattlerBase.prototype.actionPlusSet = function() { + return this.traits(Game_BattlerBase.TRAIT_ACTION_PLUS).map( + trait => trait.value + ); +}; + +Game_BattlerBase.prototype.specialFlag = function(flagId) { + return this.traits(Game_BattlerBase.TRAIT_SPECIAL_FLAG).some( + trait => trait.dataId === flagId + ); +}; + +Game_BattlerBase.prototype.collapseType = function() { + const set = this.traitsSet(Game_BattlerBase.TRAIT_COLLAPSE_TYPE); + return set.length > 0 ? Math.max(...set) : 0; +}; + +Game_BattlerBase.prototype.partyAbility = function(abilityId) { + return this.traits(Game_BattlerBase.TRAIT_PARTY_ABILITY).some( + trait => trait.dataId === abilityId + ); +}; + +Game_BattlerBase.prototype.isAutoBattle = function() { + return this.specialFlag(Game_BattlerBase.FLAG_ID_AUTO_BATTLE); +}; + +Game_BattlerBase.prototype.isGuard = function() { + return this.specialFlag(Game_BattlerBase.FLAG_ID_GUARD) && this.canMove(); +}; + +Game_BattlerBase.prototype.isSubstitute = function() { + return ( + this.specialFlag(Game_BattlerBase.FLAG_ID_SUBSTITUTE) && this.canMove() + ); +}; + +Game_BattlerBase.prototype.isPreserveTp = function() { + return this.specialFlag(Game_BattlerBase.FLAG_ID_PRESERVE_TP); +}; + +Game_BattlerBase.prototype.addParam = function(paramId, value) { + this._paramPlus[paramId] += value; + this.refresh(); +}; + +Game_BattlerBase.prototype.setHp = function(hp) { + this._hp = hp; + this.refresh(); +}; + +Game_BattlerBase.prototype.setMp = function(mp) { + this._mp = mp; + this.refresh(); +}; + +Game_BattlerBase.prototype.setTp = function(tp) { + this._tp = tp; + this.refresh(); +}; + +Game_BattlerBase.prototype.maxTp = function() { + return 100; +}; + +Game_BattlerBase.prototype.refresh = function() { + for (const stateId of this.stateResistSet()) { + this.eraseState(stateId); + } + this._hp = this._hp.clamp(0, this.mhp); + this._mp = this._mp.clamp(0, this.mmp); + this._tp = this._tp.clamp(0, this.maxTp()); +}; + +Game_BattlerBase.prototype.recoverAll = function() { + this.clearStates(); + this._hp = this.mhp; + this._mp = this.mmp; +}; + +Game_BattlerBase.prototype.hpRate = function() { + return this.hp / this.mhp; +}; + +Game_BattlerBase.prototype.mpRate = function() { + return this.mmp > 0 ? this.mp / this.mmp : 0; +}; + +Game_BattlerBase.prototype.tpRate = function() { + return this.tp / this.maxTp(); +}; + +Game_BattlerBase.prototype.hide = function() { + this._hidden = true; +}; + +Game_BattlerBase.prototype.appear = function() { + this._hidden = false; +}; + +Game_BattlerBase.prototype.isHidden = function() { + return this._hidden; +}; + +Game_BattlerBase.prototype.isAppeared = function() { + return !this.isHidden(); +}; + +Game_BattlerBase.prototype.isDead = function() { + return this.isAppeared() && this.isDeathStateAffected(); +}; + +Game_BattlerBase.prototype.isAlive = function() { + return this.isAppeared() && !this.isDeathStateAffected(); +}; + +Game_BattlerBase.prototype.isDying = function() { + return this.isAlive() && this._hp < this.mhp / 4; +}; + +Game_BattlerBase.prototype.isRestricted = function() { + return this.isAppeared() && this.restriction() > 0; +}; + +Game_BattlerBase.prototype.canInput = function() { + // prettier-ignore + return this.isAppeared() && this.isActor() && + !this.isRestricted() && !this.isAutoBattle(); +}; + +Game_BattlerBase.prototype.canMove = function() { + return this.isAppeared() && this.restriction() < 4; +}; + +Game_BattlerBase.prototype.isConfused = function() { + return ( + this.isAppeared() && this.restriction() >= 1 && this.restriction() <= 3 + ); +}; + +Game_BattlerBase.prototype.confusionLevel = function() { + return this.isConfused() ? this.restriction() : 0; +}; + +Game_BattlerBase.prototype.isActor = function() { + return false; +}; + +Game_BattlerBase.prototype.isEnemy = function() { + return false; +}; + +Game_BattlerBase.prototype.sortStates = function() { + this._states.sort((a, b) => { + const p1 = $dataStates[a].priority; + const p2 = $dataStates[b].priority; + if (p1 !== p2) { + return p2 - p1; + } + return a - b; + }); +}; + +Game_BattlerBase.prototype.restriction = function() { + const restrictions = this.states().map(state => state.restriction); + return Math.max(0, ...restrictions); +}; + +Game_BattlerBase.prototype.addNewState = function(stateId) { + if (stateId === this.deathStateId()) { + this.die(); + } + const restricted = this.isRestricted(); + this._states.push(stateId); + this.sortStates(); + if (!restricted && this.isRestricted()) { + this.onRestrict(); + } +}; + +Game_BattlerBase.prototype.onRestrict = function() { + // +}; + +Game_BattlerBase.prototype.mostImportantStateText = function() { + for (const state of this.states()) { + if (state.message3) { + return state.message3; + } + } + return ""; +}; + +Game_BattlerBase.prototype.stateMotionIndex = function() { + const states = this.states(); + if (states.length > 0) { + return states[0].motion; + } else { + return 0; + } +}; + +Game_BattlerBase.prototype.stateOverlayIndex = function() { + const states = this.states(); + if (states.length > 0) { + return states[0].overlay; + } else { + return 0; + } +}; + +Game_BattlerBase.prototype.isSkillWtypeOk = function(/*skill*/) { + return true; +}; + +Game_BattlerBase.prototype.skillMpCost = function(skill) { + return Math.floor(skill.mpCost * this.mcr); +}; + +Game_BattlerBase.prototype.skillTpCost = function(skill) { + return skill.tpCost; +}; + +Game_BattlerBase.prototype.canPaySkillCost = function(skill) { + return ( + this._tp >= this.skillTpCost(skill) && + this._mp >= this.skillMpCost(skill) + ); +}; + +Game_BattlerBase.prototype.paySkillCost = function(skill) { + this._mp -= this.skillMpCost(skill); + this._tp -= this.skillTpCost(skill); +}; + +Game_BattlerBase.prototype.isOccasionOk = function(item) { + if ($gameParty.inBattle()) { + return item.occasion === 0 || item.occasion === 1; + } else { + return item.occasion === 0 || item.occasion === 2; + } +}; + +Game_BattlerBase.prototype.meetsUsableItemConditions = function(item) { + return this.canMove() && this.isOccasionOk(item); +}; + +Game_BattlerBase.prototype.meetsSkillConditions = function(skill) { + return ( + this.meetsUsableItemConditions(skill) && + this.isSkillWtypeOk(skill) && + this.canPaySkillCost(skill) && + !this.isSkillSealed(skill.id) && + !this.isSkillTypeSealed(skill.stypeId) + ); +}; + +Game_BattlerBase.prototype.meetsItemConditions = function(item) { + return this.meetsUsableItemConditions(item) && $gameParty.hasItem(item); +}; + +Game_BattlerBase.prototype.canUse = function(item) { + if (!item) { + return false; + } else if (DataManager.isSkill(item)) { + return this.meetsSkillConditions(item); + } else if (DataManager.isItem(item)) { + return this.meetsItemConditions(item); + } else { + return false; + } +}; + +Game_BattlerBase.prototype.canEquip = function(item) { + if (!item) { + return false; + } else if (DataManager.isWeapon(item)) { + return this.canEquipWeapon(item); + } else if (DataManager.isArmor(item)) { + return this.canEquipArmor(item); + } else { + return false; + } +}; + +Game_BattlerBase.prototype.canEquipWeapon = function(item) { + return ( + this.isEquipWtypeOk(item.wtypeId) && + !this.isEquipTypeSealed(item.etypeId) + ); +}; + +Game_BattlerBase.prototype.canEquipArmor = function(item) { + return ( + this.isEquipAtypeOk(item.atypeId) && + !this.isEquipTypeSealed(item.etypeId) + ); +}; + +Game_BattlerBase.prototype.guardSkillId = function() { + return 2; +}; + +Game_BattlerBase.prototype.canAttack = function() { + return this.canUse($dataSkills[this.attackSkillId()]); +}; + +Game_BattlerBase.prototype.canGuard = function() { + return this.canUse($dataSkills[this.guardSkillId()]); +}; + +//----------------------------------------------------------------------------- +// Game_Battler +// +// The superclass of Game_Actor and Game_Enemy. It contains methods for sprites +// and actions. + +function Game_Battler() { + this.initialize(...arguments); +} + +Game_Battler.prototype = Object.create(Game_BattlerBase.prototype); +Game_Battler.prototype.constructor = Game_Battler; + +Game_Battler.prototype.initialize = function() { + Game_BattlerBase.prototype.initialize.call(this); +}; + +Game_Battler.prototype.initMembers = function() { + Game_BattlerBase.prototype.initMembers.call(this); + this._actions = []; + this._speed = 0; + this._result = new Game_ActionResult(); + this._actionState = ""; + this._lastTargetIndex = 0; + this._damagePopup = false; + this._effectType = null; + this._motionType = null; + this._weaponImageId = 0; + this._motionRefresh = false; + this._selected = false; + this._tpbState = ""; + this._tpbChargeTime = 0; + this._tpbCastTime = 0; + this._tpbIdleTime = 0; + this._tpbTurnCount = 0; + this._tpbTurnEnd = false; +}; + +Game_Battler.prototype.clearDamagePopup = function() { + this._damagePopup = false; +}; + +Game_Battler.prototype.clearWeaponAnimation = function() { + this._weaponImageId = 0; +}; + +Game_Battler.prototype.clearEffect = function() { + this._effectType = null; +}; + +Game_Battler.prototype.clearMotion = function() { + this._motionType = null; + this._motionRefresh = false; +}; + +Game_Battler.prototype.requestEffect = function(effectType) { + this._effectType = effectType; +}; + +Game_Battler.prototype.requestMotion = function(motionType) { + this._motionType = motionType; +}; + +Game_Battler.prototype.requestMotionRefresh = function() { + this._motionRefresh = true; +}; + +Game_Battler.prototype.cancelMotionRefresh = function() { + this._motionRefresh = false; +}; + +Game_Battler.prototype.select = function() { + this._selected = true; +}; + +Game_Battler.prototype.deselect = function() { + this._selected = false; +}; + +Game_Battler.prototype.isDamagePopupRequested = function() { + return this._damagePopup; +}; + +Game_Battler.prototype.isEffectRequested = function() { + return !!this._effectType; +}; + +Game_Battler.prototype.isMotionRequested = function() { + return !!this._motionType; +}; + +Game_Battler.prototype.isWeaponAnimationRequested = function() { + return this._weaponImageId > 0; +}; + +Game_Battler.prototype.isMotionRefreshRequested = function() { + return this._motionRefresh; +}; + +Game_Battler.prototype.isSelected = function() { + return this._selected; +}; + +Game_Battler.prototype.effectType = function() { + return this._effectType; +}; + +Game_Battler.prototype.motionType = function() { + return this._motionType; +}; + +Game_Battler.prototype.weaponImageId = function() { + return this._weaponImageId; +}; + +Game_Battler.prototype.startDamagePopup = function() { + this._damagePopup = true; +}; + +Game_Battler.prototype.shouldPopupDamage = function() { + const result = this._result; + return ( + result.missed || + result.evaded || + result.hpAffected || + result.mpDamage !== 0 + ); +}; + +Game_Battler.prototype.startWeaponAnimation = function(weaponImageId) { + this._weaponImageId = weaponImageId; +}; + +Game_Battler.prototype.action = function(index) { + return this._actions[index]; +}; + +Game_Battler.prototype.setAction = function(index, action) { + this._actions[index] = action; +}; + +Game_Battler.prototype.numActions = function() { + return this._actions.length; +}; + +Game_Battler.prototype.clearActions = function() { + this._actions = []; +}; + +Game_Battler.prototype.result = function() { + return this._result; +}; + +Game_Battler.prototype.clearResult = function() { + this._result.clear(); +}; + +Game_Battler.prototype.clearTpbChargeTime = function() { + this._tpbState = "charging"; + this._tpbChargeTime = 0; +}; + +Game_Battler.prototype.applyTpbPenalty = function() { + this._tpbState = "charging"; + this._tpbChargeTime -= 1; +}; + +Game_Battler.prototype.initTpbChargeTime = function(advantageous) { + const speed = this.tpbRelativeSpeed(); + this._tpbState = "charging"; + this._tpbChargeTime = advantageous ? 1 : speed * Math.random() * 0.5; + if (this.isRestricted()) { + this._tpbChargeTime = 0; + } +}; + +Game_Battler.prototype.tpbChargeTime = function() { + return this._tpbChargeTime; +}; + +Game_Battler.prototype.startTpbCasting = function() { + this._tpbState = "casting"; + this._tpbCastTime = 0; +}; + +Game_Battler.prototype.startTpbAction = function() { + this._tpbState = "acting"; +}; + +Game_Battler.prototype.isTpbCharged = function() { + return this._tpbState === "charged"; +}; + +Game_Battler.prototype.isTpbReady = function() { + return this._tpbState === "ready"; +}; + +Game_Battler.prototype.isTpbTimeout = function() { + return this._tpbIdleTime >= 1; +}; + +Game_Battler.prototype.updateTpb = function() { + if (this.canMove()) { + this.updateTpbChargeTime(); + this.updateTpbCastTime(); + this.updateTpbAutoBattle(); + } + if (this.isAlive()) { + this.updateTpbIdleTime(); + } +}; + +Game_Battler.prototype.updateTpbChargeTime = function() { + if (this._tpbState === "charging") { + this._tpbChargeTime += this.tpbAcceleration(); + if (this._tpbChargeTime >= 1) { + this._tpbChargeTime = 1; + this.onTpbCharged(); + } + } +}; + +Game_Battler.prototype.updateTpbCastTime = function() { + if (this._tpbState === "casting") { + this._tpbCastTime += this.tpbAcceleration(); + if (this._tpbCastTime >= this.tpbRequiredCastTime()) { + this._tpbCastTime = this.tpbRequiredCastTime(); + this._tpbState = "ready"; + } + } +}; + +Game_Battler.prototype.updateTpbAutoBattle = function() { + if (this.isTpbCharged() && !this.isTpbTurnEnd() && this.isAutoBattle()) { + this.makeTpbActions(); + } +}; + +Game_Battler.prototype.updateTpbIdleTime = function() { + if (!this.canMove() || this.isTpbCharged()) { + this._tpbIdleTime += this.tpbAcceleration(); + } +}; + +Game_Battler.prototype.tpbAcceleration = function() { + const speed = this.tpbRelativeSpeed(); + const referenceTime = $gameParty.tpbReferenceTime(); + return speed / referenceTime; +}; + +Game_Battler.prototype.tpbRelativeSpeed = function() { + return this.tpbSpeed() / $gameParty.tpbBaseSpeed(); +}; + +Game_Battler.prototype.tpbSpeed = function() { + return Math.sqrt(this.agi) + 1; +}; + +Game_Battler.prototype.tpbBaseSpeed = function() { + const baseAgility = this.paramBasePlus(6); + return Math.sqrt(baseAgility) + 1; +}; + +Game_Battler.prototype.tpbRequiredCastTime = function() { + const actions = this._actions.filter(action => action.isValid()); + const items = actions.map(action => action.item()); + const delay = items.reduce((r, item) => r + Math.max(0, -item.speed), 0); + return Math.sqrt(delay) / this.tpbSpeed(); +}; + +Game_Battler.prototype.onTpbCharged = function() { + if (!this.shouldDelayTpbCharge()) { + this.finishTpbCharge(); + } +}; + +Game_Battler.prototype.shouldDelayTpbCharge = function() { + return !BattleManager.isActiveTpb() && $gameParty.canInput(); +}; + +Game_Battler.prototype.finishTpbCharge = function() { + this._tpbState = "charged"; + this._tpbTurnEnd = true; + this._tpbIdleTime = 0; +}; + +Game_Battler.prototype.isTpbTurnEnd = function() { + return this._tpbTurnEnd; +}; + +Game_Battler.prototype.initTpbTurn = function() { + this._tpbTurnEnd = false; + this._tpbTurnCount = 0; + this._tpbIdleTime = 0; +}; + +Game_Battler.prototype.startTpbTurn = function() { + this._tpbTurnEnd = false; + this._tpbTurnCount++; + this._tpbIdleTime = 0; + if (this.numActions() === 0) { + this.makeTpbActions(); + } +}; + +Game_Battler.prototype.makeTpbActions = function() { + this.makeActions(); + if (this.canInput()) { + this.setActionState("undecided"); + } else { + this.startTpbCasting(); + this.setActionState("waiting"); + } +}; + +Game_Battler.prototype.onTpbTimeout = function() { + this.onAllActionsEnd(); + this._tpbTurnEnd = true; + this._tpbIdleTime = 0; +}; + +Game_Battler.prototype.turnCount = function() { + if (BattleManager.isTpb()) { + return this._tpbTurnCount; + } else { + return $gameTroop.turnCount() + 1; + } +}; + +Game_Battler.prototype.canInput = function() { + if (BattleManager.isTpb() && !this.isTpbCharged()) { + return false; + } + return Game_BattlerBase.prototype.canInput.call(this); +}; + +Game_Battler.prototype.refresh = function() { + Game_BattlerBase.prototype.refresh.call(this); + if (this.hp === 0) { + this.addState(this.deathStateId()); + } else { + this.removeState(this.deathStateId()); + } +}; + +Game_Battler.prototype.addState = function(stateId) { + if (this.isStateAddable(stateId)) { + if (!this.isStateAffected(stateId)) { + this.addNewState(stateId); + this.refresh(); + } + this.resetStateCounts(stateId); + this._result.pushAddedState(stateId); + } +}; + +Game_Battler.prototype.isStateAddable = function(stateId) { + return ( + this.isAlive() && + $dataStates[stateId] && + !this.isStateResist(stateId) && + !this.isStateRestrict(stateId) + ); +}; + +Game_Battler.prototype.isStateRestrict = function(stateId) { + return $dataStates[stateId].removeByRestriction && this.isRestricted(); +}; + +Game_Battler.prototype.onRestrict = function() { + Game_BattlerBase.prototype.onRestrict.call(this); + this.clearTpbChargeTime(); + this.clearActions(); + for (const state of this.states()) { + if (state.removeByRestriction) { + this.removeState(state.id); + } + } +}; + +Game_Battler.prototype.removeState = function(stateId) { + if (this.isStateAffected(stateId)) { + if (stateId === this.deathStateId()) { + this.revive(); + } + this.eraseState(stateId); + this.refresh(); + this._result.pushRemovedState(stateId); + } +}; + +Game_Battler.prototype.escape = function() { + if ($gameParty.inBattle()) { + this.hide(); + } + this.clearActions(); + this.clearStates(); + SoundManager.playEscape(); +}; + +Game_Battler.prototype.addBuff = function(paramId, turns) { + if (this.isAlive()) { + this.increaseBuff(paramId); + if (this.isBuffAffected(paramId)) { + this.overwriteBuffTurns(paramId, turns); + } + this._result.pushAddedBuff(paramId); + this.refresh(); + } +}; + +Game_Battler.prototype.addDebuff = function(paramId, turns) { + if (this.isAlive()) { + this.decreaseBuff(paramId); + if (this.isDebuffAffected(paramId)) { + this.overwriteBuffTurns(paramId, turns); + } + this._result.pushAddedDebuff(paramId); + this.refresh(); + } +}; + +Game_Battler.prototype.removeBuff = function(paramId) { + if (this.isAlive() && this.isBuffOrDebuffAffected(paramId)) { + this.eraseBuff(paramId); + this._result.pushRemovedBuff(paramId); + this.refresh(); + } +}; + +Game_Battler.prototype.removeBattleStates = function() { + for (const state of this.states()) { + if (state.removeAtBattleEnd) { + this.removeState(state.id); + } + } +}; + +Game_Battler.prototype.removeAllBuffs = function() { + for (let i = 0; i < this.buffLength(); i++) { + this.removeBuff(i); + } +}; + +Game_Battler.prototype.removeStatesAuto = function(timing) { + for (const state of this.states()) { + if ( + this.isStateExpired(state.id) && + state.autoRemovalTiming === timing + ) { + this.removeState(state.id); + } + } +}; + +Game_Battler.prototype.removeBuffsAuto = function() { + for (let i = 0; i < this.buffLength(); i++) { + if (this.isBuffExpired(i)) { + this.removeBuff(i); + } + } +}; + +Game_Battler.prototype.removeStatesByDamage = function() { + for (const state of this.states()) { + if ( + state.removeByDamage && + Math.randomInt(100) < state.chanceByDamage + ) { + this.removeState(state.id); + } + } +}; + +Game_Battler.prototype.makeActionTimes = function() { + const actionPlusSet = this.actionPlusSet(); + return actionPlusSet.reduce((r, p) => (Math.random() < p ? r + 1 : r), 1); +}; + +Game_Battler.prototype.makeActions = function() { + this.clearActions(); + if (this.canMove()) { + const actionTimes = this.makeActionTimes(); + this._actions = []; + for (let i = 0; i < actionTimes; i++) { + this._actions.push(new Game_Action(this)); + } + } +}; + +Game_Battler.prototype.speed = function() { + return this._speed; +}; + +Game_Battler.prototype.makeSpeed = function() { + this._speed = Math.min(...this._actions.map(action => action.speed())) || 0; +}; + +Game_Battler.prototype.currentAction = function() { + return this._actions[0]; +}; + +Game_Battler.prototype.removeCurrentAction = function() { + this._actions.shift(); +}; + +Game_Battler.prototype.setLastTarget = function(target) { + this._lastTargetIndex = target ? target.index() : 0; +}; + +Game_Battler.prototype.forceAction = function(skillId, targetIndex) { + this.clearActions(); + const action = new Game_Action(this, true); + action.setSkill(skillId); + if (targetIndex === -2) { + action.setTarget(this._lastTargetIndex); + } else if (targetIndex === -1) { + action.decideRandomTarget(); + } else { + action.setTarget(targetIndex); + } + if (action.item()) { + this._actions.push(action); + } +}; + +Game_Battler.prototype.useItem = function(item) { + if (DataManager.isSkill(item)) { + this.paySkillCost(item); + } else if (DataManager.isItem(item)) { + this.consumeItem(item); + } +}; + +Game_Battler.prototype.consumeItem = function(item) { + $gameParty.consumeItem(item); +}; + +Game_Battler.prototype.gainHp = function(value) { + this._result.hpDamage = -value; + this._result.hpAffected = true; + this.setHp(this.hp + value); +}; + +Game_Battler.prototype.gainMp = function(value) { + this._result.mpDamage = -value; + this.setMp(this.mp + value); +}; + +Game_Battler.prototype.gainTp = function(value) { + this._result.tpDamage = -value; + this.setTp(this.tp + value); +}; + +Game_Battler.prototype.gainSilentTp = function(value) { + this.setTp(this.tp + value); +}; + +Game_Battler.prototype.initTp = function() { + this.setTp(Math.randomInt(25)); +}; + +Game_Battler.prototype.clearTp = function() { + this.setTp(0); +}; + +Game_Battler.prototype.chargeTpByDamage = function(damageRate) { + const value = Math.floor(50 * damageRate * this.tcr); + this.gainSilentTp(value); +}; + +Game_Battler.prototype.regenerateHp = function() { + const minRecover = -this.maxSlipDamage(); + const value = Math.max(Math.floor(this.mhp * this.hrg), minRecover); + if (value !== 0) { + this.gainHp(value); + } +}; + +Game_Battler.prototype.maxSlipDamage = function() { + return $dataSystem.optSlipDeath ? this.hp : Math.max(this.hp - 1, 0); +}; + +Game_Battler.prototype.regenerateMp = function() { + const value = Math.floor(this.mmp * this.mrg); + if (value !== 0) { + this.gainMp(value); + } +}; + +Game_Battler.prototype.regenerateTp = function() { + const value = Math.floor(100 * this.trg); + this.gainSilentTp(value); +}; + +Game_Battler.prototype.regenerateAll = function() { + if (this.isAlive()) { + this.regenerateHp(); + this.regenerateMp(); + this.regenerateTp(); + } +}; + +Game_Battler.prototype.onBattleStart = function(advantageous) { + this.setActionState("undecided"); + this.clearMotion(); + this.initTpbChargeTime(advantageous); + this.initTpbTurn(); + if (!this.isPreserveTp()) { + this.initTp(); + } +}; + +Game_Battler.prototype.onAllActionsEnd = function() { + this.clearResult(); + this.removeStatesAuto(1); + this.removeBuffsAuto(); +}; + +Game_Battler.prototype.onTurnEnd = function() { + this.clearResult(); + this.regenerateAll(); + this.updateStateTurns(); + this.updateBuffTurns(); + this.removeStatesAuto(2); +}; + +Game_Battler.prototype.onBattleEnd = function() { + this.clearResult(); + this.removeBattleStates(); + this.removeAllBuffs(); + this.clearActions(); + if (!this.isPreserveTp()) { + this.clearTp(); + } + this.appear(); +}; + +Game_Battler.prototype.onDamage = function(value) { + this.removeStatesByDamage(); + this.chargeTpByDamage(value / this.mhp); +}; + +Game_Battler.prototype.setActionState = function(actionState) { + this._actionState = actionState; + this.requestMotionRefresh(); +}; + +Game_Battler.prototype.isUndecided = function() { + return this._actionState === "undecided"; +}; + +Game_Battler.prototype.isInputting = function() { + return this._actionState === "inputting"; +}; + +Game_Battler.prototype.isWaiting = function() { + return this._actionState === "waiting"; +}; + +Game_Battler.prototype.isActing = function() { + return this._actionState === "acting"; +}; + +Game_Battler.prototype.isChanting = function() { + if (this.isWaiting()) { + return this._actions.some(action => action.isMagicSkill()); + } + return false; +}; + +Game_Battler.prototype.isGuardWaiting = function() { + if (this.isWaiting()) { + return this._actions.some(action => action.isGuard()); + } + return false; +}; + +Game_Battler.prototype.performActionStart = function(action) { + if (!action.isGuard()) { + this.setActionState("acting"); + } +}; + +Game_Battler.prototype.performAction = function(/*action*/) { + // +}; + +Game_Battler.prototype.performActionEnd = function() { + // +}; + +Game_Battler.prototype.performDamage = function() { + // +}; + +Game_Battler.prototype.performMiss = function() { + SoundManager.playMiss(); +}; + +Game_Battler.prototype.performRecovery = function() { + SoundManager.playRecovery(); +}; + +Game_Battler.prototype.performEvasion = function() { + SoundManager.playEvasion(); +}; + +Game_Battler.prototype.performMagicEvasion = function() { + SoundManager.playMagicEvasion(); +}; + +Game_Battler.prototype.performCounter = function() { + SoundManager.playEvasion(); +}; + +Game_Battler.prototype.performReflection = function() { + SoundManager.playReflection(); +}; + +Game_Battler.prototype.performSubstitute = function(/*target*/) { + // +}; + +Game_Battler.prototype.performCollapse = function() { + // +}; + +//----------------------------------------------------------------------------- +// Game_Actor +// +// The game object class for an actor. + +function Game_Actor() { + this.initialize(...arguments); +} + +Game_Actor.prototype = Object.create(Game_Battler.prototype); +Game_Actor.prototype.constructor = Game_Actor; + +Object.defineProperty(Game_Actor.prototype, "level", { + get: function() { + return this._level; + }, + configurable: true +}); + +Game_Actor.prototype.initialize = function(actorId) { + Game_Battler.prototype.initialize.call(this); + this.setup(actorId); +}; + +Game_Actor.prototype.initMembers = function() { + Game_Battler.prototype.initMembers.call(this); + this._actorId = 0; + this._name = ""; + this._nickname = ""; + this._classId = 0; + this._level = 0; + this._characterName = ""; + this._characterIndex = 0; + this._faceName = ""; + this._faceIndex = 0; + this._battlerName = ""; + this._exp = {}; + this._skills = []; + this._equips = []; + this._actionInputIndex = 0; + this._lastMenuSkill = new Game_Item(); + this._lastBattleSkill = new Game_Item(); + this._lastCommandSymbol = ""; +}; + +Game_Actor.prototype.setup = function(actorId) { + const actor = $dataActors[actorId]; + this._actorId = actorId; + this._name = actor.name; + this._nickname = actor.nickname; + this._profile = actor.profile; + this._classId = actor.classId; + this._level = actor.initialLevel; + this.initImages(); + this.initExp(); + this.initSkills(); + this.initEquips(actor.equips); + this.clearParamPlus(); + this.recoverAll(); +}; + +Game_Actor.prototype.actorId = function() { + return this._actorId; +}; + +Game_Actor.prototype.actor = function() { + return $dataActors[this._actorId]; +}; + +Game_Actor.prototype.name = function() { + return this._name; +}; + +Game_Actor.prototype.setName = function(name) { + this._name = name; +}; + +Game_Actor.prototype.nickname = function() { + return this._nickname; +}; + +Game_Actor.prototype.setNickname = function(nickname) { + this._nickname = nickname; +}; + +Game_Actor.prototype.profile = function() { + return this._profile; +}; + +Game_Actor.prototype.setProfile = function(profile) { + this._profile = profile; +}; + +Game_Actor.prototype.characterName = function() { + return this._characterName; +}; + +Game_Actor.prototype.characterIndex = function() { + return this._characterIndex; +}; + +Game_Actor.prototype.faceName = function() { + return this._faceName; +}; + +Game_Actor.prototype.faceIndex = function() { + return this._faceIndex; +}; + +Game_Actor.prototype.battlerName = function() { + return this._battlerName; +}; + +Game_Actor.prototype.clearStates = function() { + Game_Battler.prototype.clearStates.call(this); + this._stateSteps = {}; +}; + +Game_Actor.prototype.eraseState = function(stateId) { + Game_Battler.prototype.eraseState.call(this, stateId); + delete this._stateSteps[stateId]; +}; + +Game_Actor.prototype.resetStateCounts = function(stateId) { + Game_Battler.prototype.resetStateCounts.call(this, stateId); + this._stateSteps[stateId] = $dataStates[stateId].stepsToRemove; +}; + +Game_Actor.prototype.initImages = function() { + const actor = this.actor(); + this._characterName = actor.characterName; + this._characterIndex = actor.characterIndex; + this._faceName = actor.faceName; + this._faceIndex = actor.faceIndex; + this._battlerName = actor.battlerName; +}; + +Game_Actor.prototype.expForLevel = function(level) { + const c = this.currentClass(); + const basis = c.expParams[0]; + const extra = c.expParams[1]; + const acc_a = c.expParams[2]; + const acc_b = c.expParams[3]; + return Math.round( + (basis * Math.pow(level - 1, 0.9 + acc_a / 250) * level * (level + 1)) / + (6 + Math.pow(level, 2) / 50 / acc_b) + + (level - 1) * extra + ); +}; + +Game_Actor.prototype.initExp = function() { + this._exp[this._classId] = this.currentLevelExp(); +}; + +Game_Actor.prototype.currentExp = function() { + return this._exp[this._classId]; +}; + +Game_Actor.prototype.currentLevelExp = function() { + return this.expForLevel(this._level); +}; + +Game_Actor.prototype.nextLevelExp = function() { + return this.expForLevel(this._level + 1); +}; + +Game_Actor.prototype.nextRequiredExp = function() { + return this.nextLevelExp() - this.currentExp(); +}; + +Game_Actor.prototype.maxLevel = function() { + return this.actor().maxLevel; +}; + +Game_Actor.prototype.isMaxLevel = function() { + return this._level >= this.maxLevel(); +}; + +Game_Actor.prototype.initSkills = function() { + this._skills = []; + for (const learning of this.currentClass().learnings) { + if (learning.level <= this._level) { + this.learnSkill(learning.skillId); + } + } +}; + +Game_Actor.prototype.initEquips = function(equips) { + const slots = this.equipSlots(); + const maxSlots = slots.length; + this._equips = []; + for (let i = 0; i < maxSlots; i++) { + this._equips[i] = new Game_Item(); + } + for (let j = 0; j < equips.length; j++) { + if (j < maxSlots) { + this._equips[j].setEquip(slots[j] === 1, equips[j]); + } + } + this.releaseUnequippableItems(true); + this.refresh(); +}; + +Game_Actor.prototype.equipSlots = function() { + const slots = []; + for (let i = 1; i < $dataSystem.equipTypes.length; i++) { + slots.push(i); + } + if (slots.length >= 2 && this.isDualWield()) { + slots[1] = 1; + } + return slots; +}; + +Game_Actor.prototype.equips = function() { + return this._equips.map(item => item.object()); +}; + +Game_Actor.prototype.weapons = function() { + return this.equips().filter(item => item && DataManager.isWeapon(item)); +}; + +Game_Actor.prototype.armors = function() { + return this.equips().filter(item => item && DataManager.isArmor(item)); +}; + +Game_Actor.prototype.hasWeapon = function(weapon) { + return this.weapons().includes(weapon); +}; + +Game_Actor.prototype.hasArmor = function(armor) { + return this.armors().includes(armor); +}; + +Game_Actor.prototype.isEquipChangeOk = function(slotId) { + return ( + !this.isEquipTypeLocked(this.equipSlots()[slotId]) && + !this.isEquipTypeSealed(this.equipSlots()[slotId]) + ); +}; + +Game_Actor.prototype.changeEquip = function(slotId, item) { + if ( + this.tradeItemWithParty(item, this.equips()[slotId]) && + (!item || this.equipSlots()[slotId] === item.etypeId) + ) { + this._equips[slotId].setObject(item); + this.refresh(); + } +}; + +Game_Actor.prototype.forceChangeEquip = function(slotId, item) { + this._equips[slotId].setObject(item); + this.releaseUnequippableItems(true); + this.refresh(); +}; + +Game_Actor.prototype.tradeItemWithParty = function(newItem, oldItem) { + if (newItem && !$gameParty.hasItem(newItem)) { + return false; + } else { + $gameParty.gainItem(oldItem, 1); + $gameParty.loseItem(newItem, 1); + return true; + } +}; + +Game_Actor.prototype.changeEquipById = function(etypeId, itemId) { + const slotId = etypeId - 1; + if (this.equipSlots()[slotId] === 1) { + this.changeEquip(slotId, $dataWeapons[itemId]); + } else { + this.changeEquip(slotId, $dataArmors[itemId]); + } +}; + +Game_Actor.prototype.isEquipped = function(item) { + return this.equips().includes(item); +}; + +Game_Actor.prototype.discardEquip = function(item) { + const slotId = this.equips().indexOf(item); + if (slotId >= 0) { + this._equips[slotId].setObject(null); + } +}; + +Game_Actor.prototype.releaseUnequippableItems = function(forcing) { + for (;;) { + const slots = this.equipSlots(); + const equips = this.equips(); + let changed = false; + for (let i = 0; i < equips.length; i++) { + const item = equips[i]; + if (item && (!this.canEquip(item) || item.etypeId !== slots[i])) { + if (!forcing) { + this.tradeItemWithParty(null, item); + } + this._equips[i].setObject(null); + changed = true; + } + } + if (!changed) { + break; + } + } +}; + +Game_Actor.prototype.clearEquipments = function() { + const maxSlots = this.equipSlots().length; + for (let i = 0; i < maxSlots; i++) { + if (this.isEquipChangeOk(i)) { + this.changeEquip(i, null); + } + } +}; + +Game_Actor.prototype.optimizeEquipments = function() { + const maxSlots = this.equipSlots().length; + this.clearEquipments(); + for (let i = 0; i < maxSlots; i++) { + if (this.isEquipChangeOk(i)) { + this.changeEquip(i, this.bestEquipItem(i)); + } + } +}; + +Game_Actor.prototype.bestEquipItem = function(slotId) { + const etypeId = this.equipSlots()[slotId]; + const items = $gameParty + .equipItems() + .filter(item => item.etypeId === etypeId && this.canEquip(item)); + let bestItem = null; + let bestPerformance = -1000; + for (let i = 0; i < items.length; i++) { + const performance = this.calcEquipItemPerformance(items[i]); + if (performance > bestPerformance) { + bestPerformance = performance; + bestItem = items[i]; + } + } + return bestItem; +}; + +Game_Actor.prototype.calcEquipItemPerformance = function(item) { + return item.params.reduce((a, b) => a + b); +}; + +Game_Actor.prototype.isSkillWtypeOk = function(skill) { + const wtypeId1 = skill.requiredWtypeId1; + const wtypeId2 = skill.requiredWtypeId2; + if ( + (wtypeId1 === 0 && wtypeId2 === 0) || + (wtypeId1 > 0 && this.isWtypeEquipped(wtypeId1)) || + (wtypeId2 > 0 && this.isWtypeEquipped(wtypeId2)) + ) { + return true; + } else { + return false; + } +}; + +Game_Actor.prototype.isWtypeEquipped = function(wtypeId) { + return this.weapons().some(weapon => weapon.wtypeId === wtypeId); +}; + +Game_Actor.prototype.refresh = function() { + this.releaseUnequippableItems(false); + Game_Battler.prototype.refresh.call(this); +}; + +Game_Actor.prototype.hide = function() { + Game_Battler.prototype.hide.call(this); + $gameTemp.requestBattleRefresh(); +}; + +Game_Actor.prototype.isActor = function() { + return true; +}; + +Game_Actor.prototype.friendsUnit = function() { + return $gameParty; +}; + +Game_Actor.prototype.opponentsUnit = function() { + return $gameTroop; +}; + +Game_Actor.prototype.index = function() { + return $gameParty.members().indexOf(this); +}; + +Game_Actor.prototype.isBattleMember = function() { + return $gameParty.battleMembers().includes(this); +}; + +Game_Actor.prototype.isFormationChangeOk = function() { + return true; +}; + +Game_Actor.prototype.currentClass = function() { + return $dataClasses[this._classId]; +}; + +Game_Actor.prototype.isClass = function(gameClass) { + return gameClass && this._classId === gameClass.id; +}; + +Game_Actor.prototype.skillTypes = function() { + const skillTypes = this.addedSkillTypes().sort((a, b) => a - b); + return skillTypes.filter((x, i, self) => self.indexOf(x) === i); +}; + +Game_Actor.prototype.skills = function() { + const list = []; + for (const id of this._skills.concat(this.addedSkills())) { + if (!list.includes($dataSkills[id])) { + list.push($dataSkills[id]); + } + } + return list; +}; + +Game_Actor.prototype.usableSkills = function() { + return this.skills().filter(skill => this.canUse(skill)); +}; + +Game_Actor.prototype.traitObjects = function() { + const objects = Game_Battler.prototype.traitObjects.call(this); + objects.push(this.actor(), this.currentClass()); + for (const item of this.equips()) { + if (item) { + objects.push(item); + } + } + return objects; +}; + +Game_Actor.prototype.attackElements = function() { + const set = Game_Battler.prototype.attackElements.call(this); + if (this.hasNoWeapons() && !set.includes(this.bareHandsElementId())) { + set.push(this.bareHandsElementId()); + } + return set; +}; + +Game_Actor.prototype.hasNoWeapons = function() { + return this.weapons().length === 0; +}; + +Game_Actor.prototype.bareHandsElementId = function() { + return 1; +}; + +Game_Actor.prototype.paramBase = function(paramId) { + return this.currentClass().params[paramId][this._level]; +}; + +Game_Actor.prototype.paramPlus = function(paramId) { + let value = Game_Battler.prototype.paramPlus.call(this, paramId); + for (const item of this.equips()) { + if (item) { + value += item.params[paramId]; + } + } + return value; +}; + +Game_Actor.prototype.attackAnimationId1 = function() { + if (this.hasNoWeapons()) { + return this.bareHandsAnimationId(); + } else { + const weapons = this.weapons(); + return weapons[0] ? weapons[0].animationId : 0; + } +}; + +Game_Actor.prototype.attackAnimationId2 = function() { + const weapons = this.weapons(); + return weapons[1] ? weapons[1].animationId : 0; +}; + +Game_Actor.prototype.bareHandsAnimationId = function() { + return 1; +}; + +Game_Actor.prototype.changeExp = function(exp, show) { + this._exp[this._classId] = Math.max(exp, 0); + const lastLevel = this._level; + const lastSkills = this.skills(); + while (!this.isMaxLevel() && this.currentExp() >= this.nextLevelExp()) { + this.levelUp(); + } + while (this.currentExp() < this.currentLevelExp()) { + this.levelDown(); + } + if (show && this._level > lastLevel) { + this.displayLevelUp(this.findNewSkills(lastSkills)); + } + this.refresh(); +}; + +Game_Actor.prototype.levelUp = function() { + this._level++; + for (const learning of this.currentClass().learnings) { + if (learning.level === this._level) { + this.learnSkill(learning.skillId); + } + } +}; + +Game_Actor.prototype.levelDown = function() { + this._level--; +}; + +Game_Actor.prototype.findNewSkills = function(lastSkills) { + const newSkills = this.skills(); + for (const lastSkill of lastSkills) { + newSkills.remove(lastSkill); + } + return newSkills; +}; + +Game_Actor.prototype.displayLevelUp = function(newSkills) { + const text = TextManager.levelUp.format( + this._name, + TextManager.level, + this._level + ); + $gameMessage.newPage(); + $gameMessage.add(text); + for (const skill of newSkills) { + $gameMessage.add(TextManager.obtainSkill.format(skill.name)); + } +}; + +Game_Actor.prototype.gainExp = function(exp) { + const newExp = this.currentExp() + Math.round(exp * this.finalExpRate()); + this.changeExp(newExp, this.shouldDisplayLevelUp()); +}; + +Game_Actor.prototype.finalExpRate = function() { + return this.exr * (this.isBattleMember() ? 1 : this.benchMembersExpRate()); +}; + +Game_Actor.prototype.benchMembersExpRate = function() { + return $dataSystem.optExtraExp ? 1 : 0; +}; + +Game_Actor.prototype.shouldDisplayLevelUp = function() { + return true; +}; + +Game_Actor.prototype.changeLevel = function(level, show) { + level = level.clamp(1, this.maxLevel()); + this.changeExp(this.expForLevel(level), show); +}; + +Game_Actor.prototype.learnSkill = function(skillId) { + if (!this.isLearnedSkill(skillId)) { + this._skills.push(skillId); + this._skills.sort((a, b) => a - b); + } +}; + +Game_Actor.prototype.forgetSkill = function(skillId) { + this._skills.remove(skillId); +}; + +Game_Actor.prototype.isLearnedSkill = function(skillId) { + return this._skills.includes(skillId); +}; + +Game_Actor.prototype.hasSkill = function(skillId) { + return this.skills().includes($dataSkills[skillId]); +}; + +Game_Actor.prototype.changeClass = function(classId, keepExp) { + if (keepExp) { + this._exp[classId] = this.currentExp(); + } + this._classId = classId; + this._level = 0; + this.changeExp(this._exp[this._classId] || 0, false); + this.refresh(); +}; + +Game_Actor.prototype.setCharacterImage = function( + characterName, + characterIndex +) { + this._characterName = characterName; + this._characterIndex = characterIndex; +}; + +Game_Actor.prototype.setFaceImage = function(faceName, faceIndex) { + this._faceName = faceName; + this._faceIndex = faceIndex; + $gameTemp.requestBattleRefresh(); +}; + +Game_Actor.prototype.setBattlerImage = function(battlerName) { + this._battlerName = battlerName; +}; + +Game_Actor.prototype.isSpriteVisible = function() { + return $gameSystem.isSideView(); +}; + +Game_Actor.prototype.performActionStart = function(action) { + Game_Battler.prototype.performActionStart.call(this, action); +}; + +Game_Actor.prototype.performAction = function(action) { + Game_Battler.prototype.performAction.call(this, action); + if (action.isAttack()) { + this.performAttack(); + } else if (action.isGuard()) { + this.requestMotion("guard"); + } else if (action.isMagicSkill()) { + this.requestMotion("spell"); + } else if (action.isSkill()) { + this.requestMotion("skill"); + } else if (action.isItem()) { + this.requestMotion("item"); + } +}; + +Game_Actor.prototype.performActionEnd = function() { + Game_Battler.prototype.performActionEnd.call(this); +}; + +Game_Actor.prototype.performAttack = function() { + const weapons = this.weapons(); + const wtypeId = weapons[0] ? weapons[0].wtypeId : 0; + const attackMotion = $dataSystem.attackMotions[wtypeId]; + if (attackMotion) { + if (attackMotion.type === 0) { + this.requestMotion("thrust"); + } else if (attackMotion.type === 1) { + this.requestMotion("swing"); + } else if (attackMotion.type === 2) { + this.requestMotion("missile"); + } + this.startWeaponAnimation(attackMotion.weaponImageId); + } +}; + +Game_Actor.prototype.performDamage = function() { + Game_Battler.prototype.performDamage.call(this); + if (this.isSpriteVisible()) { + this.requestMotion("damage"); + } else { + $gameScreen.startShake(5, 5, 10); + } + SoundManager.playActorDamage(); +}; + +Game_Actor.prototype.performEvasion = function() { + Game_Battler.prototype.performEvasion.call(this); + this.requestMotion("evade"); +}; + +Game_Actor.prototype.performMagicEvasion = function() { + Game_Battler.prototype.performMagicEvasion.call(this); + this.requestMotion("evade"); +}; + +Game_Actor.prototype.performCounter = function() { + Game_Battler.prototype.performCounter.call(this); + this.performAttack(); +}; + +Game_Actor.prototype.performCollapse = function() { + Game_Battler.prototype.performCollapse.call(this); + if ($gameParty.inBattle()) { + SoundManager.playActorCollapse(); + } +}; + +Game_Actor.prototype.performVictory = function() { + this.setActionState("done"); + if (this.canMove()) { + this.requestMotion("victory"); + } +}; + +Game_Actor.prototype.performEscape = function() { + if (this.canMove()) { + this.requestMotion("escape"); + } +}; + +Game_Actor.prototype.makeActionList = function() { + const list = []; + const attackAction = new Game_Action(this); + attackAction.setAttack(); + list.push(attackAction); + for (const skill of this.usableSkills()) { + const skillAction = new Game_Action(this); + skillAction.setSkill(skill.id); + list.push(skillAction); + } + return list; +}; + +Game_Actor.prototype.makeAutoBattleActions = function() { + for (let i = 0; i < this.numActions(); i++) { + const list = this.makeActionList(); + let maxValue = -Number.MAX_VALUE; + for (const action of list) { + const value = action.evaluate(); + if (value > maxValue) { + maxValue = value; + this.setAction(i, action); + } + } + } + this.setActionState("waiting"); +}; + +Game_Actor.prototype.makeConfusionActions = function() { + for (let i = 0; i < this.numActions(); i++) { + this.action(i).setConfusion(); + } + this.setActionState("waiting"); +}; + +Game_Actor.prototype.makeActions = function() { + Game_Battler.prototype.makeActions.call(this); + if (this.numActions() > 0) { + this.setActionState("undecided"); + } else { + this.setActionState("waiting"); + } + if (this.isAutoBattle()) { + this.makeAutoBattleActions(); + } else if (this.isConfused()) { + this.makeConfusionActions(); + } +}; + +Game_Actor.prototype.onPlayerWalk = function() { + this.clearResult(); + this.checkFloorEffect(); + if ($gamePlayer.isNormal()) { + this.turnEndOnMap(); + for (const state of this.states()) { + this.updateStateSteps(state); + } + this.showAddedStates(); + this.showRemovedStates(); + } +}; + +Game_Actor.prototype.updateStateSteps = function(state) { + if (state.removeByWalking) { + if (this._stateSteps[state.id] > 0) { + if (--this._stateSteps[state.id] === 0) { + this.removeState(state.id); + } + } + } +}; + +Game_Actor.prototype.showAddedStates = function() { + for (const state of this.result().addedStateObjects()) { + if (state.message1) { + $gameMessage.add(state.message1.format(this._name)); + } + } +}; + +Game_Actor.prototype.showRemovedStates = function() { + for (const state of this.result().removedStateObjects()) { + if (state.message4) { + $gameMessage.add(state.message4.format(this._name)); + } + } +}; + +Game_Actor.prototype.stepsForTurn = function() { + return 20; +}; + +Game_Actor.prototype.turnEndOnMap = function() { + if ($gameParty.steps() % this.stepsForTurn() === 0) { + this.onTurnEnd(); + if (this.result().hpDamage > 0) { + this.performMapDamage(); + } + } +}; + +Game_Actor.prototype.checkFloorEffect = function() { + if ($gamePlayer.isOnDamageFloor()) { + this.executeFloorDamage(); + } +}; + +Game_Actor.prototype.executeFloorDamage = function() { + const floorDamage = Math.floor(this.basicFloorDamage() * this.fdr); + const realDamage = Math.min(floorDamage, this.maxFloorDamage()); + this.gainHp(-realDamage); + if (realDamage > 0) { + this.performMapDamage(); + } +}; + +Game_Actor.prototype.basicFloorDamage = function() { + return 10; +}; + +Game_Actor.prototype.maxFloorDamage = function() { + return $dataSystem.optFloorDeath ? this.hp : Math.max(this.hp - 1, 0); +}; + +Game_Actor.prototype.performMapDamage = function() { + if (!$gameParty.inBattle()) { + $gameScreen.startFlashForDamage(); + } +}; + +Game_Actor.prototype.clearActions = function() { + Game_Battler.prototype.clearActions.call(this); + this._actionInputIndex = 0; +}; + +Game_Actor.prototype.inputtingAction = function() { + return this.action(this._actionInputIndex); +}; + +Game_Actor.prototype.selectNextCommand = function() { + if (this._actionInputIndex < this.numActions() - 1) { + this._actionInputIndex++; + return true; + } else { + return false; + } +}; + +Game_Actor.prototype.selectPreviousCommand = function() { + if (this._actionInputIndex > 0) { + this._actionInputIndex--; + return true; + } else { + return false; + } +}; + +Game_Actor.prototype.lastSkill = function() { + if ($gameParty.inBattle()) { + return this.lastBattleSkill(); + } else { + return this.lastMenuSkill(); + } +}; + +Game_Actor.prototype.lastMenuSkill = function() { + return this._lastMenuSkill.object(); +}; + +Game_Actor.prototype.setLastMenuSkill = function(skill) { + this._lastMenuSkill.setObject(skill); +}; + +Game_Actor.prototype.lastBattleSkill = function() { + return this._lastBattleSkill.object(); +}; + +Game_Actor.prototype.setLastBattleSkill = function(skill) { + this._lastBattleSkill.setObject(skill); +}; + +Game_Actor.prototype.lastCommandSymbol = function() { + return this._lastCommandSymbol; +}; + +Game_Actor.prototype.setLastCommandSymbol = function(symbol) { + this._lastCommandSymbol = symbol; +}; + +Game_Actor.prototype.testEscape = function(item) { + return item.effects.some( + effect => effect && effect.code === Game_Action.EFFECT_SPECIAL + ); +}; + +Game_Actor.prototype.meetsUsableItemConditions = function(item) { + if ($gameParty.inBattle()) { + if (!BattleManager.canEscape() && this.testEscape(item)) { + return false; + } + } + return Game_BattlerBase.prototype.meetsUsableItemConditions.call( + this, + item + ); +}; + +Game_Actor.prototype.onEscapeFailure = function() { + if (BattleManager.isTpb()) { + this.applyTpbPenalty(); + } + this.clearActions(); + this.requestMotionRefresh(); +}; + +//----------------------------------------------------------------------------- +// Game_Enemy +// +// The game object class for an enemy. + +function Game_Enemy() { + this.initialize(...arguments); +} + +Game_Enemy.prototype = Object.create(Game_Battler.prototype); +Game_Enemy.prototype.constructor = Game_Enemy; + +Game_Enemy.prototype.initialize = function(enemyId, x, y) { + Game_Battler.prototype.initialize.call(this); + this.setup(enemyId, x, y); +}; + +Game_Enemy.prototype.initMembers = function() { + Game_Battler.prototype.initMembers.call(this); + this._enemyId = 0; + this._letter = ""; + this._plural = false; + this._screenX = 0; + this._screenY = 0; +}; + +Game_Enemy.prototype.setup = function(enemyId, x, y) { + this._enemyId = enemyId; + this._screenX = x; + this._screenY = y; + this.recoverAll(); +}; + +Game_Enemy.prototype.isEnemy = function() { + return true; +}; + +Game_Enemy.prototype.friendsUnit = function() { + return $gameTroop; +}; + +Game_Enemy.prototype.opponentsUnit = function() { + return $gameParty; +}; + +Game_Enemy.prototype.index = function() { + return $gameTroop.members().indexOf(this); +}; + +Game_Enemy.prototype.isBattleMember = function() { + return this.index() >= 0; +}; + +Game_Enemy.prototype.enemyId = function() { + return this._enemyId; +}; + +Game_Enemy.prototype.enemy = function() { + return $dataEnemies[this._enemyId]; +}; + +Game_Enemy.prototype.traitObjects = function() { + return Game_Battler.prototype.traitObjects.call(this).concat(this.enemy()); +}; + +Game_Enemy.prototype.paramBase = function(paramId) { + return this.enemy().params[paramId]; +}; + +Game_Enemy.prototype.exp = function() { + return this.enemy().exp; +}; + +Game_Enemy.prototype.gold = function() { + return this.enemy().gold; +}; + +Game_Enemy.prototype.makeDropItems = function() { + const rate = this.dropItemRate(); + return this.enemy().dropItems.reduce((r, di) => { + if (di.kind > 0 && Math.random() * di.denominator < rate) { + return r.concat(this.itemObject(di.kind, di.dataId)); + } else { + return r; + } + }, []); +}; + +Game_Enemy.prototype.dropItemRate = function() { + return $gameParty.hasDropItemDouble() ? 2 : 1; +}; + +Game_Enemy.prototype.itemObject = function(kind, dataId) { + if (kind === 1) { + return $dataItems[dataId]; + } else if (kind === 2) { + return $dataWeapons[dataId]; + } else if (kind === 3) { + return $dataArmors[dataId]; + } else { + return null; + } +}; + +Game_Enemy.prototype.isSpriteVisible = function() { + return true; +}; + +Game_Enemy.prototype.screenX = function() { + return this._screenX; +}; + +Game_Enemy.prototype.screenY = function() { + return this._screenY; +}; + +Game_Enemy.prototype.battlerName = function() { + return this.enemy().battlerName; +}; + +Game_Enemy.prototype.battlerHue = function() { + return this.enemy().battlerHue; +}; + +Game_Enemy.prototype.originalName = function() { + return this.enemy().name; +}; + +Game_Enemy.prototype.name = function() { + return this.originalName() + (this._plural ? this._letter : ""); +}; + +Game_Enemy.prototype.isLetterEmpty = function() { + return this._letter === ""; +}; + +Game_Enemy.prototype.setLetter = function(letter) { + this._letter = letter; +}; + +Game_Enemy.prototype.setPlural = function(plural) { + this._plural = plural; +}; + +Game_Enemy.prototype.performActionStart = function(action) { + Game_Battler.prototype.performActionStart.call(this, action); + this.requestEffect("whiten"); +}; + +Game_Enemy.prototype.performAction = function(action) { + Game_Battler.prototype.performAction.call(this, action); +}; + +Game_Enemy.prototype.performActionEnd = function() { + Game_Battler.prototype.performActionEnd.call(this); +}; + +Game_Enemy.prototype.performDamage = function() { + Game_Battler.prototype.performDamage.call(this); + SoundManager.playEnemyDamage(); + this.requestEffect("blink"); +}; + +Game_Enemy.prototype.performCollapse = function() { + Game_Battler.prototype.performCollapse.call(this); + switch (this.collapseType()) { + case 0: + this.requestEffect("collapse"); + SoundManager.playEnemyCollapse(); + break; + case 1: + this.requestEffect("bossCollapse"); + SoundManager.playBossCollapse1(); + break; + case 2: + this.requestEffect("instantCollapse"); + break; + } +}; + +Game_Enemy.prototype.transform = function(enemyId) { + const name = this.originalName(); + this._enemyId = enemyId; + if (this.originalName() !== name) { + this._letter = ""; + this._plural = false; + } + this.refresh(); + if (this.numActions() > 0) { + this.makeActions(); + } +}; + +Game_Enemy.prototype.meetsCondition = function(action) { + const param1 = action.conditionParam1; + const param2 = action.conditionParam2; + switch (action.conditionType) { + case 1: + return this.meetsTurnCondition(param1, param2); + case 2: + return this.meetsHpCondition(param1, param2); + case 3: + return this.meetsMpCondition(param1, param2); + case 4: + return this.meetsStateCondition(param1); + case 5: + return this.meetsPartyLevelCondition(param1); + case 6: + return this.meetsSwitchCondition(param1); + default: + return true; + } +}; + +Game_Enemy.prototype.meetsTurnCondition = function(param1, param2) { + const n = this.turnCount(); + if (param2 === 0) { + return n === param1; + } else { + return n > 0 && n >= param1 && n % param2 === param1 % param2; + } +}; + +Game_Enemy.prototype.meetsHpCondition = function(param1, param2) { + return this.hpRate() >= param1 && this.hpRate() <= param2; +}; + +Game_Enemy.prototype.meetsMpCondition = function(param1, param2) { + return this.mpRate() >= param1 && this.mpRate() <= param2; +}; + +Game_Enemy.prototype.meetsStateCondition = function(param) { + return this.isStateAffected(param); +}; + +Game_Enemy.prototype.meetsPartyLevelCondition = function(param) { + return $gameParty.highestLevel() >= param; +}; + +Game_Enemy.prototype.meetsSwitchCondition = function(param) { + return $gameSwitches.value(param); +}; + +Game_Enemy.prototype.isActionValid = function(action) { + return ( + this.meetsCondition(action) && this.canUse($dataSkills[action.skillId]) + ); +}; + +Game_Enemy.prototype.selectAction = function(actionList, ratingZero) { + const sum = actionList.reduce((r, a) => r + a.rating - ratingZero, 0); + if (sum > 0) { + let value = Math.randomInt(sum); + for (const action of actionList) { + value -= action.rating - ratingZero; + if (value < 0) { + return action; + } + } + } else { + return null; + } +}; + +Game_Enemy.prototype.selectAllActions = function(actionList) { + const ratingMax = Math.max(...actionList.map(a => a.rating)); + const ratingZero = ratingMax - 3; + actionList = actionList.filter(a => a.rating > ratingZero); + for (let i = 0; i < this.numActions(); i++) { + this.action(i).setEnemyAction( + this.selectAction(actionList, ratingZero) + ); + } +}; + +Game_Enemy.prototype.makeActions = function() { + Game_Battler.prototype.makeActions.call(this); + if (this.numActions() > 0) { + const actionList = this.enemy().actions.filter(a => + this.isActionValid(a) + ); + if (actionList.length > 0) { + this.selectAllActions(actionList); + } + } + this.setActionState("waiting"); +}; + +//----------------------------------------------------------------------------- +// Game_Actors +// +// The wrapper class for an actor array. + +function Game_Actors() { + this.initialize(...arguments); +} + +Game_Actors.prototype.initialize = function() { + this._data = []; +}; + +Game_Actors.prototype.actor = function(actorId) { + if ($dataActors[actorId]) { + if (!this._data[actorId]) { + this._data[actorId] = new Game_Actor(actorId); + } + return this._data[actorId]; + } + return null; +}; + +//----------------------------------------------------------------------------- +// Game_Unit +// +// The superclass of Game_Party and Game_Troop. + +function Game_Unit() { + this.initialize(...arguments); +} + +Game_Unit.prototype.initialize = function() { + this._inBattle = false; +}; + +Game_Unit.prototype.inBattle = function() { + return this._inBattle; +}; + +Game_Unit.prototype.members = function() { + return []; +}; + +Game_Unit.prototype.aliveMembers = function() { + return this.members().filter(member => member.isAlive()); +}; + +Game_Unit.prototype.deadMembers = function() { + return this.members().filter(member => member.isDead()); +}; + +Game_Unit.prototype.movableMembers = function() { + return this.members().filter(member => member.canMove()); +}; + +Game_Unit.prototype.clearActions = function() { + for (const member of this.members()) { + member.clearActions(); + } +}; + +Game_Unit.prototype.agility = function() { + const members = this.members(); + const sum = members.reduce((r, member) => r + member.agi, 0); + return Math.max(1, sum / Math.max(1, members.length)); +}; + +Game_Unit.prototype.tgrSum = function() { + return this.aliveMembers().reduce((r, member) => r + member.tgr, 0); +}; + +Game_Unit.prototype.randomTarget = function() { + let tgrRand = Math.random() * this.tgrSum(); + let target = null; + for (const member of this.aliveMembers()) { + tgrRand -= member.tgr; + if (tgrRand <= 0 && !target) { + target = member; + } + } + return target; +}; + +Game_Unit.prototype.randomDeadTarget = function() { + const members = this.deadMembers(); + return members.length ? members[Math.randomInt(members.length)] : null; +}; + +Game_Unit.prototype.smoothTarget = function(index) { + const member = this.members()[Math.max(0, index)]; + return member && member.isAlive() ? member : this.aliveMembers()[0]; +}; + +Game_Unit.prototype.smoothDeadTarget = function(index) { + const member = this.members()[Math.max(0, index)]; + return member && member.isDead() ? member : this.deadMembers()[0]; +}; + +Game_Unit.prototype.clearResults = function() { + for (const member of this.members()) { + member.clearResult(); + } +}; + +Game_Unit.prototype.onBattleStart = function(advantageous) { + for (const member of this.members()) { + member.onBattleStart(advantageous); + } + this._inBattle = true; +}; + +Game_Unit.prototype.onBattleEnd = function() { + this._inBattle = false; + for (const member of this.members()) { + member.onBattleEnd(); + } +}; + +Game_Unit.prototype.makeActions = function() { + for (const member of this.members()) { + member.makeActions(); + } +}; + +Game_Unit.prototype.select = function(activeMember) { + for (const member of this.members()) { + if (member === activeMember) { + member.select(); + } else { + member.deselect(); + } + } +}; + +Game_Unit.prototype.isAllDead = function() { + return this.aliveMembers().length === 0; +}; + +Game_Unit.prototype.substituteBattler = function(target) { + for (const member of this.members()) { + if (member.isSubstitute() && member !== target) { + return member; + } + } + return null; +}; + +Game_Unit.prototype.tpbBaseSpeed = function() { + const members = this.members(); + return Math.max(...members.map(member => member.tpbBaseSpeed())); +}; + +Game_Unit.prototype.tpbReferenceTime = function() { + return BattleManager.isActiveTpb() ? 240 : 60; +}; + +Game_Unit.prototype.updateTpb = function() { + for (const member of this.members()) { + member.updateTpb(); + } +}; + +//----------------------------------------------------------------------------- +// Game_Party +// +// The game object class for the party. Information such as gold and items is +// included. + +function Game_Party() { + this.initialize(...arguments); +} + +Game_Party.prototype = Object.create(Game_Unit.prototype); +Game_Party.prototype.constructor = Game_Party; + +Game_Party.ABILITY_ENCOUNTER_HALF = 0; +Game_Party.ABILITY_ENCOUNTER_NONE = 1; +Game_Party.ABILITY_CANCEL_SURPRISE = 2; +Game_Party.ABILITY_RAISE_PREEMPTIVE = 3; +Game_Party.ABILITY_GOLD_DOUBLE = 4; +Game_Party.ABILITY_DROP_ITEM_DOUBLE = 5; + +Game_Party.prototype.initialize = function() { + Game_Unit.prototype.initialize.call(this); + this._gold = 0; + this._steps = 0; + this._lastItem = new Game_Item(); + this._menuActorId = 0; + this._targetActorId = 0; + this._actors = []; + this.initAllItems(); +}; + +Game_Party.prototype.initAllItems = function() { + this._items = {}; + this._weapons = {}; + this._armors = {}; +}; + +Game_Party.prototype.exists = function() { + return this._actors.length > 0; +}; + +Game_Party.prototype.size = function() { + return this.members().length; +}; + +Game_Party.prototype.isEmpty = function() { + return this.size() === 0; +}; + +Game_Party.prototype.members = function() { + return this.inBattle() ? this.battleMembers() : this.allMembers(); +}; + +Game_Party.prototype.allMembers = function() { + return this._actors.map(id => $gameActors.actor(id)); +}; + +Game_Party.prototype.battleMembers = function() { + return this.allBattleMembers().filter(actor => actor.isAppeared()); +}; + +Game_Party.prototype.hiddenBattleMembers = function() { + return this.allBattleMembers().filter(actor => actor.isHidden()); +}; + +Game_Party.prototype.allBattleMembers = function() { + return this.allMembers().slice(0, this.maxBattleMembers()); +}; + +Game_Party.prototype.maxBattleMembers = function() { + return 4; +}; + +Game_Party.prototype.leader = function() { + return this.battleMembers()[0]; +}; + +Game_Party.prototype.removeInvalidMembers = function() { + for (const actorId of this._actors) { + if (!$dataActors[actorId]) { + this._actors.remove(actorId); + } + } +}; + +Game_Party.prototype.reviveBattleMembers = function() { + for (const actor of this.battleMembers()) { + if (actor.isDead()) { + actor.setHp(1); + } + } +}; + +Game_Party.prototype.items = function() { + return Object.keys(this._items).map(id => $dataItems[id]); +}; + +Game_Party.prototype.weapons = function() { + return Object.keys(this._weapons).map(id => $dataWeapons[id]); +}; + +Game_Party.prototype.armors = function() { + return Object.keys(this._armors).map(id => $dataArmors[id]); +}; + +Game_Party.prototype.equipItems = function() { + return this.weapons().concat(this.armors()); +}; + +Game_Party.prototype.allItems = function() { + return this.items().concat(this.equipItems()); +}; + +Game_Party.prototype.itemContainer = function(item) { + if (!item) { + return null; + } else if (DataManager.isItem(item)) { + return this._items; + } else if (DataManager.isWeapon(item)) { + return this._weapons; + } else if (DataManager.isArmor(item)) { + return this._armors; + } else { + return null; + } +}; + +Game_Party.prototype.setupStartingMembers = function() { + this._actors = []; + for (const actorId of $dataSystem.partyMembers) { + if ($gameActors.actor(actorId)) { + this._actors.push(actorId); + } + } +}; + +Game_Party.prototype.name = function() { + const numBattleMembers = this.battleMembers().length; + if (numBattleMembers === 0) { + return ""; + } else if (numBattleMembers === 1) { + return this.leader().name(); + } else { + return TextManager.partyName.format(this.leader().name()); + } +}; + +Game_Party.prototype.setupBattleTest = function() { + this.setupBattleTestMembers(); + this.setupBattleTestItems(); +}; + +Game_Party.prototype.setupBattleTestMembers = function() { + for (const battler of $dataSystem.testBattlers) { + const actor = $gameActors.actor(battler.actorId); + if (actor) { + actor.changeLevel(battler.level, false); + actor.initEquips(battler.equips); + actor.recoverAll(); + this.addActor(battler.actorId); + } + } +}; + +Game_Party.prototype.setupBattleTestItems = function() { + for (const item of $dataItems) { + if (item && item.name.length > 0) { + this.gainItem(item, this.maxItems(item)); + } + } +}; + +Game_Party.prototype.highestLevel = function() { + return Math.max(...this.members().map(actor => actor.level)); +}; + +Game_Party.prototype.addActor = function(actorId) { + if (!this._actors.includes(actorId)) { + this._actors.push(actorId); + $gamePlayer.refresh(); + $gameMap.requestRefresh(); + $gameTemp.requestBattleRefresh(); + if (this.inBattle()) { + const actor = $gameActors.actor(actorId); + if (this.battleMembers().includes(actor)) { + actor.onBattleStart(); + } + } + } +}; + +Game_Party.prototype.removeActor = function(actorId) { + if (this._actors.includes(actorId)) { + const actor = $gameActors.actor(actorId); + const wasBattleMember = this.battleMembers().includes(actor); + this._actors.remove(actorId); + $gamePlayer.refresh(); + $gameMap.requestRefresh(); + $gameTemp.requestBattleRefresh(); + if (this.inBattle() && wasBattleMember) { + actor.onBattleEnd(); + } + } +}; + +Game_Party.prototype.gold = function() { + return this._gold; +}; + +Game_Party.prototype.gainGold = function(amount) { + this._gold = (this._gold + amount).clamp(0, this.maxGold()); +}; + +Game_Party.prototype.loseGold = function(amount) { + this.gainGold(-amount); +}; + +Game_Party.prototype.maxGold = function() { + return 99999999; +}; + +Game_Party.prototype.steps = function() { + return this._steps; +}; + +Game_Party.prototype.increaseSteps = function() { + this._steps++; +}; + +Game_Party.prototype.numItems = function(item) { + const container = this.itemContainer(item); + return container ? container[item.id] || 0 : 0; +}; + +Game_Party.prototype.maxItems = function(/*item*/) { + return 99; +}; + +Game_Party.prototype.hasMaxItems = function(item) { + return this.numItems(item) >= this.maxItems(item); +}; + +Game_Party.prototype.hasItem = function(item, includeEquip) { + if (this.numItems(item) > 0) { + return true; + } else if (includeEquip && this.isAnyMemberEquipped(item)) { + return true; + } else { + return false; + } +}; + +Game_Party.prototype.isAnyMemberEquipped = function(item) { + return this.members().some(actor => actor.equips().includes(item)); +}; + +Game_Party.prototype.gainItem = function(item, amount, includeEquip) { + const container = this.itemContainer(item); + if (container) { + const lastNumber = this.numItems(item); + const newNumber = lastNumber + amount; + container[item.id] = newNumber.clamp(0, this.maxItems(item)); + if (container[item.id] === 0) { + delete container[item.id]; + } + if (includeEquip && newNumber < 0) { + this.discardMembersEquip(item, -newNumber); + } + $gameMap.requestRefresh(); + } +}; + +Game_Party.prototype.discardMembersEquip = function(item, amount) { + let n = amount; + for (const actor of this.members()) { + while (n > 0 && actor.isEquipped(item)) { + actor.discardEquip(item); + n--; + } + } +}; + +Game_Party.prototype.loseItem = function(item, amount, includeEquip) { + this.gainItem(item, -amount, includeEquip); +}; + +Game_Party.prototype.consumeItem = function(item) { + if (DataManager.isItem(item) && item.consumable) { + this.loseItem(item, 1); + } +}; + +Game_Party.prototype.canUse = function(item) { + return this.members().some(actor => actor.canUse(item)); +}; + +Game_Party.prototype.canInput = function() { + return this.members().some(actor => actor.canInput()); +}; + +Game_Party.prototype.isAllDead = function() { + if (Game_Unit.prototype.isAllDead.call(this)) { + return this.inBattle() || !this.isEmpty(); + } else { + return false; + } +}; + +Game_Party.prototype.isEscaped = function() { + return this.isAllDead() && this.hiddenBattleMembers().length > 0; +}; + +Game_Party.prototype.onPlayerWalk = function() { + for (const actor of this.members()) { + actor.onPlayerWalk(); + } +}; + +Game_Party.prototype.menuActor = function() { + let actor = $gameActors.actor(this._menuActorId); + if (!this.members().includes(actor)) { + actor = this.members()[0]; + } + return actor; +}; + +Game_Party.prototype.setMenuActor = function(actor) { + this._menuActorId = actor.actorId(); +}; + +Game_Party.prototype.makeMenuActorNext = function() { + let index = this.members().indexOf(this.menuActor()); + if (index >= 0) { + index = (index + 1) % this.members().length; + this.setMenuActor(this.members()[index]); + } else { + this.setMenuActor(this.members()[0]); + } +}; + +Game_Party.prototype.makeMenuActorPrevious = function() { + let index = this.members().indexOf(this.menuActor()); + if (index >= 0) { + index = (index + this.members().length - 1) % this.members().length; + this.setMenuActor(this.members()[index]); + } else { + this.setMenuActor(this.members()[0]); + } +}; + +Game_Party.prototype.targetActor = function() { + let actor = $gameActors.actor(this._targetActorId); + if (!this.members().includes(actor)) { + actor = this.members()[0]; + } + return actor; +}; + +Game_Party.prototype.setTargetActor = function(actor) { + this._targetActorId = actor.actorId(); +}; + +Game_Party.prototype.lastItem = function() { + return this._lastItem.object(); +}; + +Game_Party.prototype.setLastItem = function(item) { + this._lastItem.setObject(item); +}; + +Game_Party.prototype.swapOrder = function(index1, index2) { + const temp = this._actors[index1]; + this._actors[index1] = this._actors[index2]; + this._actors[index2] = temp; + $gamePlayer.refresh(); +}; + +Game_Party.prototype.charactersForSavefile = function() { + return this.battleMembers().map(actor => [ + actor.characterName(), + actor.characterIndex() + ]); +}; + +Game_Party.prototype.facesForSavefile = function() { + return this.battleMembers().map(actor => [ + actor.faceName(), + actor.faceIndex() + ]); +}; + +Game_Party.prototype.partyAbility = function(abilityId) { + return this.battleMembers().some(actor => actor.partyAbility(abilityId)); +}; + +Game_Party.prototype.hasEncounterHalf = function() { + return this.partyAbility(Game_Party.ABILITY_ENCOUNTER_HALF); +}; + +Game_Party.prototype.hasEncounterNone = function() { + return this.partyAbility(Game_Party.ABILITY_ENCOUNTER_NONE); +}; + +Game_Party.prototype.hasCancelSurprise = function() { + return this.partyAbility(Game_Party.ABILITY_CANCEL_SURPRISE); +}; + +Game_Party.prototype.hasRaisePreemptive = function() { + return this.partyAbility(Game_Party.ABILITY_RAISE_PREEMPTIVE); +}; + +Game_Party.prototype.hasGoldDouble = function() { + return this.partyAbility(Game_Party.ABILITY_GOLD_DOUBLE); +}; + +Game_Party.prototype.hasDropItemDouble = function() { + return this.partyAbility(Game_Party.ABILITY_DROP_ITEM_DOUBLE); +}; + +Game_Party.prototype.ratePreemptive = function(troopAgi) { + let rate = this.agility() >= troopAgi ? 0.05 : 0.03; + if (this.hasRaisePreemptive()) { + rate *= 4; + } + return rate; +}; + +Game_Party.prototype.rateSurprise = function(troopAgi) { + let rate = this.agility() >= troopAgi ? 0.03 : 0.05; + if (this.hasCancelSurprise()) { + rate = 0; + } + return rate; +}; + +Game_Party.prototype.performVictory = function() { + for (const actor of this.members()) { + actor.performVictory(); + } +}; + +Game_Party.prototype.performEscape = function() { + for (const actor of this.members()) { + actor.performEscape(); + } +}; + +Game_Party.prototype.removeBattleStates = function() { + for (const actor of this.members()) { + actor.removeBattleStates(); + } +}; + +Game_Party.prototype.requestMotionRefresh = function() { + for (const actor of this.members()) { + actor.requestMotionRefresh(); + } +}; + +Game_Party.prototype.onEscapeFailure = function() { + for (const actor of this.members()) { + actor.onEscapeFailure(); + } +}; + +//----------------------------------------------------------------------------- +// Game_Troop +// +// The game object class for a troop and the battle-related data. + +function Game_Troop() { + this.initialize(...arguments); +} + +Game_Troop.prototype = Object.create(Game_Unit.prototype); +Game_Troop.prototype.constructor = Game_Troop; + +// prettier-ignore +Game_Troop.LETTER_TABLE_HALF = [ + " A"," B"," C"," D"," E"," F"," G"," H"," I"," J"," K"," L"," M", + " N"," O"," P"," Q"," R"," S"," T"," U"," V"," W"," X"," Y"," Z" +]; +// prettier-ignore +Game_Troop.LETTER_TABLE_FULL = [ + "A","B","C","D","E","F","G","H","I","J","K","L","M", + "N","O","P","Q","R","S","T","U","V","W","X","Y","Z" +]; + +Game_Troop.prototype.initialize = function() { + Game_Unit.prototype.initialize.call(this); + this._interpreter = new Game_Interpreter(); + this.clear(); +}; + +Game_Troop.prototype.isEventRunning = function() { + return this._interpreter.isRunning(); +}; + +Game_Troop.prototype.updateInterpreter = function() { + this._interpreter.update(); +}; + +Game_Troop.prototype.turnCount = function() { + return this._turnCount; +}; + +Game_Troop.prototype.members = function() { + return this._enemies; +}; + +Game_Troop.prototype.clear = function() { + this._interpreter.clear(); + this._troopId = 0; + this._eventFlags = {}; + this._enemies = []; + this._turnCount = 0; + this._namesCount = {}; +}; + +Game_Troop.prototype.troop = function() { + return $dataTroops[this._troopId]; +}; + +Game_Troop.prototype.setup = function(troopId) { + this.clear(); + this._troopId = troopId; + this._enemies = []; + for (const member of this.troop().members) { + if ($dataEnemies[member.enemyId]) { + const enemyId = member.enemyId; + const x = member.x; + const y = member.y; + const enemy = new Game_Enemy(enemyId, x, y); + if (member.hidden) { + enemy.hide(); + } + this._enemies.push(enemy); + } + } + this.makeUniqueNames(); +}; + +Game_Troop.prototype.makeUniqueNames = function() { + const table = this.letterTable(); + for (const enemy of this.members()) { + if (enemy.isAlive() && enemy.isLetterEmpty()) { + const name = enemy.originalName(); + const n = this._namesCount[name] || 0; + enemy.setLetter(table[n % table.length]); + this._namesCount[name] = n + 1; + } + } + this.updatePluralFlags(); +}; + +Game_Troop.prototype.updatePluralFlags = function() { + for (const enemy of this.members()) { + const name = enemy.originalName(); + if (this._namesCount[name] >= 2) { + enemy.setPlural(true); + } + } +}; + +Game_Troop.prototype.letterTable = function() { + return $gameSystem.isCJK() + ? Game_Troop.LETTER_TABLE_FULL + : Game_Troop.LETTER_TABLE_HALF; +}; + +Game_Troop.prototype.enemyNames = function() { + const names = []; + for (const enemy of this.members()) { + const name = enemy.originalName(); + if (enemy.isAlive() && !names.includes(name)) { + names.push(name); + } + } + return names; +}; + +Game_Troop.prototype.meetsConditions = function(page) { + const c = page.conditions; + if ( + !c.turnEnding && + !c.turnValid && + !c.enemyValid && + !c.actorValid && + !c.switchValid + ) { + return false; // Conditions not set + } + if (c.turnEnding) { + if (!BattleManager.isTurnEnd()) { + return false; + } + } + if (c.turnValid) { + const n = this._turnCount; + const a = c.turnA; + const b = c.turnB; + if (b === 0 && n !== a) { + return false; + } + if (b > 0 && (n < 1 || n < a || n % b !== a % b)) { + return false; + } + } + if (c.enemyValid) { + const enemy = $gameTroop.members()[c.enemyIndex]; + if (!enemy || enemy.hpRate() * 100 > c.enemyHp) { + return false; + } + } + if (c.actorValid) { + const actor = $gameActors.actor(c.actorId); + if (!actor || actor.hpRate() * 100 > c.actorHp) { + return false; + } + } + if (c.switchValid) { + if (!$gameSwitches.value(c.switchId)) { + return false; + } + } + return true; +}; + +Game_Troop.prototype.setupBattleEvent = function() { + if (!this._interpreter.isRunning()) { + if (this._interpreter.setupReservedCommonEvent()) { + return; + } + const pages = this.troop().pages; + for (let i = 0; i < pages.length; i++) { + const page = pages[i]; + if (this.meetsConditions(page) && !this._eventFlags[i]) { + this._interpreter.setup(page.list); + if (page.span <= 1) { + this._eventFlags[i] = true; + } + break; + } + } + } +}; + +Game_Troop.prototype.increaseTurn = function() { + const pages = this.troop().pages; + for (let i = 0; i < pages.length; i++) { + const page = pages[i]; + if (page.span === 1) { + this._eventFlags[i] = false; + } + } + this._turnCount++; +}; + +Game_Troop.prototype.expTotal = function() { + return this.deadMembers().reduce((r, enemy) => r + enemy.exp(), 0); +}; + +Game_Troop.prototype.goldTotal = function() { + const members = this.deadMembers(); + return members.reduce((r, enemy) => r + enemy.gold(), 0) * this.goldRate(); +}; + +Game_Troop.prototype.goldRate = function() { + return $gameParty.hasGoldDouble() ? 2 : 1; +}; + +Game_Troop.prototype.makeDropItems = function() { + const members = this.deadMembers(); + return members.reduce((r, enemy) => r.concat(enemy.makeDropItems()), []); +}; + +Game_Troop.prototype.isTpbTurnEnd = function() { + const members = this.members(); + const turnMax = Math.max(...members.map(member => member.turnCount())); + return turnMax > this._turnCount; +}; + +//----------------------------------------------------------------------------- +// Game_Map +// +// The game object class for a map. It contains scrolling and passage +// determination functions. + +function Game_Map() { + this.initialize(...arguments); +} + +Game_Map.prototype.initialize = function() { + this._interpreter = new Game_Interpreter(); + this._mapId = 0; + this._tilesetId = 0; + this._events = []; + this._commonEvents = []; + this._vehicles = []; + this._displayX = 0; + this._displayY = 0; + this._nameDisplay = true; + this._scrollDirection = 2; + this._scrollRest = 0; + this._scrollSpeed = 4; + this._parallaxName = ""; + this._parallaxZero = false; + this._parallaxLoopX = false; + this._parallaxLoopY = false; + this._parallaxSx = 0; + this._parallaxSy = 0; + this._parallaxX = 0; + this._parallaxY = 0; + this._battleback1Name = null; + this._battleback2Name = null; + this.createVehicles(); +}; + +Game_Map.prototype.setup = function(mapId) { + if (!$dataMap) { + throw new Error("The map data is not available"); + } + this._mapId = mapId; + this._tilesetId = $dataMap.tilesetId; + this._displayX = 0; + this._displayY = 0; + this.refereshVehicles(); + this.setupEvents(); + this.setupScroll(); + this.setupParallax(); + this.setupBattleback(); + this._needsRefresh = false; +}; + +Game_Map.prototype.isEventRunning = function() { + return this._interpreter.isRunning() || this.isAnyEventStarting(); +}; + +Game_Map.prototype.tileWidth = function() { + if ("tileSize" in $dataSystem) { + return $dataSystem.tileSize; + } else { + return 48; + } +}; + +Game_Map.prototype.tileHeight = function() { + return this.tileWidth(); +}; + +Game_Map.prototype.bushDepth = function() { + return this.tileHeight() / 4; +}; + +Game_Map.prototype.mapId = function() { + return this._mapId; +}; + +Game_Map.prototype.tilesetId = function() { + return this._tilesetId; +}; + +Game_Map.prototype.displayX = function() { + return this._displayX; +}; + +Game_Map.prototype.displayY = function() { + return this._displayY; +}; + +Game_Map.prototype.parallaxName = function() { + return this._parallaxName; +}; + +Game_Map.prototype.battleback1Name = function() { + return this._battleback1Name; +}; + +Game_Map.prototype.battleback2Name = function() { + return this._battleback2Name; +}; + +Game_Map.prototype.requestRefresh = function() { + this._needsRefresh = true; +}; + +Game_Map.prototype.isNameDisplayEnabled = function() { + return this._nameDisplay; +}; + +Game_Map.prototype.disableNameDisplay = function() { + this._nameDisplay = false; +}; + +Game_Map.prototype.enableNameDisplay = function() { + this._nameDisplay = true; +}; + +Game_Map.prototype.createVehicles = function() { + this._vehicles = []; + this._vehicles[0] = new Game_Vehicle("boat"); + this._vehicles[1] = new Game_Vehicle("ship"); + this._vehicles[2] = new Game_Vehicle("airship"); +}; + +Game_Map.prototype.refereshVehicles = function() { + for (const vehicle of this._vehicles) { + vehicle.refresh(); + } +}; + +Game_Map.prototype.vehicles = function() { + return this._vehicles; +}; + +Game_Map.prototype.vehicle = function(type) { + if (type === 0 || type === "boat") { + return this.boat(); + } else if (type === 1 || type === "ship") { + return this.ship(); + } else if (type === 2 || type === "airship") { + return this.airship(); + } else { + return null; + } +}; + +Game_Map.prototype.boat = function() { + return this._vehicles[0]; +}; + +Game_Map.prototype.ship = function() { + return this._vehicles[1]; +}; + +Game_Map.prototype.airship = function() { + return this._vehicles[2]; +}; + +Game_Map.prototype.setupEvents = function() { + this._events = []; + this._commonEvents = []; + for (const event of $dataMap.events.filter(event => !!event)) { + this._events[event.id] = new Game_Event(this._mapId, event.id); + } + for (const commonEvent of this.parallelCommonEvents()) { + this._commonEvents.push(new Game_CommonEvent(commonEvent.id)); + } + this.refreshTileEvents(); +}; + +Game_Map.prototype.events = function() { + return this._events.filter(event => !!event); +}; + +Game_Map.prototype.event = function(eventId) { + return this._events[eventId]; +}; + +Game_Map.prototype.eraseEvent = function(eventId) { + this._events[eventId].erase(); +}; + +Game_Map.prototype.autorunCommonEvents = function() { + return $dataCommonEvents.filter( + commonEvent => commonEvent && commonEvent.trigger === 1 + ); +}; + +Game_Map.prototype.parallelCommonEvents = function() { + return $dataCommonEvents.filter( + commonEvent => commonEvent && commonEvent.trigger === 2 + ); +}; + +Game_Map.prototype.setupScroll = function() { + this._scrollDirection = 2; + this._scrollRest = 0; + this._scrollSpeed = 4; +}; + +Game_Map.prototype.setupParallax = function() { + this._parallaxName = $dataMap.parallaxName || ""; + this._parallaxZero = ImageManager.isZeroParallax(this._parallaxName); + this._parallaxLoopX = $dataMap.parallaxLoopX; + this._parallaxLoopY = $dataMap.parallaxLoopY; + this._parallaxSx = $dataMap.parallaxSx; + this._parallaxSy = $dataMap.parallaxSy; + this._parallaxX = 0; + this._parallaxY = 0; +}; + +Game_Map.prototype.setupBattleback = function() { + if ($dataMap.specifyBattleback) { + this._battleback1Name = $dataMap.battleback1Name; + this._battleback2Name = $dataMap.battleback2Name; + } else { + this._battleback1Name = null; + this._battleback2Name = null; + } +}; + +Game_Map.prototype.setDisplayPos = function(x, y) { + if (this.isLoopHorizontal()) { + this._displayX = x.mod(this.width()); + this._parallaxX = x; + } else { + const endX = this.width() - this.screenTileX(); + this._displayX = endX < 0 ? endX / 2 : x.clamp(0, endX); + this._parallaxX = this._displayX; + } + if (this.isLoopVertical()) { + this._displayY = y.mod(this.height()); + this._parallaxY = y; + } else { + const endY = this.height() - this.screenTileY(); + this._displayY = endY < 0 ? endY / 2 : y.clamp(0, endY); + this._parallaxY = this._displayY; + } +}; + +Game_Map.prototype.parallaxOx = function() { + if (this._parallaxZero) { + return this._parallaxX * this.tileWidth(); + } else if (this._parallaxLoopX) { + return (this._parallaxX * this.tileWidth()) / 2; + } else { + return 0; + } +}; + +Game_Map.prototype.parallaxOy = function() { + if (this._parallaxZero) { + return this._parallaxY * this.tileHeight(); + } else if (this._parallaxLoopY) { + return (this._parallaxY * this.tileHeight()) / 2; + } else { + return 0; + } +}; + +Game_Map.prototype.tileset = function() { + return $dataTilesets[this._tilesetId]; +}; + +Game_Map.prototype.tilesetFlags = function() { + const tileset = this.tileset(); + if (tileset) { + return tileset.flags; + } else { + return []; + } +}; + +Game_Map.prototype.displayName = function() { + return $dataMap.displayName; +}; + +Game_Map.prototype.width = function() { + return $dataMap.width; +}; + +Game_Map.prototype.height = function() { + return $dataMap.height; +}; + +Game_Map.prototype.data = function() { + return $dataMap.data; +}; + +Game_Map.prototype.isLoopHorizontal = function() { + return $dataMap.scrollType === 2 || $dataMap.scrollType === 3; +}; + +Game_Map.prototype.isLoopVertical = function() { + return $dataMap.scrollType === 1 || $dataMap.scrollType === 3; +}; + +Game_Map.prototype.isDashDisabled = function() { + return $dataMap.disableDashing; +}; + +Game_Map.prototype.encounterList = function() { + return $dataMap.encounterList; +}; + +Game_Map.prototype.encounterStep = function() { + return $dataMap.encounterStep; +}; + +Game_Map.prototype.isOverworld = function() { + return this.tileset() && this.tileset().mode === 0; +}; + +Game_Map.prototype.screenTileX = function() { + return Math.round((Graphics.width / this.tileWidth()) * 16) / 16; +}; + +Game_Map.prototype.screenTileY = function() { + return Math.round((Graphics.height / this.tileHeight()) * 16) / 16; +}; + +Game_Map.prototype.adjustX = function(x) { + if ( + this.isLoopHorizontal() && + x < this._displayX - (this.width() - this.screenTileX()) / 2 + ) { + return x - this._displayX + $dataMap.width; + } else { + return x - this._displayX; + } +}; + +Game_Map.prototype.adjustY = function(y) { + if ( + this.isLoopVertical() && + y < this._displayY - (this.height() - this.screenTileY()) / 2 + ) { + return y - this._displayY + $dataMap.height; + } else { + return y - this._displayY; + } +}; + +Game_Map.prototype.roundX = function(x) { + return this.isLoopHorizontal() ? x.mod(this.width()) : x; +}; + +Game_Map.prototype.roundY = function(y) { + return this.isLoopVertical() ? y.mod(this.height()) : y; +}; + +Game_Map.prototype.xWithDirection = function(x, d) { + return x + (d === 6 ? 1 : d === 4 ? -1 : 0); +}; + +Game_Map.prototype.yWithDirection = function(y, d) { + return y + (d === 2 ? 1 : d === 8 ? -1 : 0); +}; + +Game_Map.prototype.roundXWithDirection = function(x, d) { + return this.roundX(x + (d === 6 ? 1 : d === 4 ? -1 : 0)); +}; + +Game_Map.prototype.roundYWithDirection = function(y, d) { + return this.roundY(y + (d === 2 ? 1 : d === 8 ? -1 : 0)); +}; + +Game_Map.prototype.deltaX = function(x1, x2) { + let result = x1 - x2; + if (this.isLoopHorizontal() && Math.abs(result) > this.width() / 2) { + if (result < 0) { + result += this.width(); + } else { + result -= this.width(); + } + } + return result; +}; + +Game_Map.prototype.deltaY = function(y1, y2) { + let result = y1 - y2; + if (this.isLoopVertical() && Math.abs(result) > this.height() / 2) { + if (result < 0) { + result += this.height(); + } else { + result -= this.height(); + } + } + return result; +}; + +Game_Map.prototype.distance = function(x1, y1, x2, y2) { + return Math.abs(this.deltaX(x1, x2)) + Math.abs(this.deltaY(y1, y2)); +}; + +Game_Map.prototype.canvasToMapX = function(x) { + const tileWidth = this.tileWidth(); + const originX = this._displayX * tileWidth; + const mapX = Math.floor((originX + x) / tileWidth); + return this.roundX(mapX); +}; + +Game_Map.prototype.canvasToMapY = function(y) { + const tileHeight = this.tileHeight(); + const originY = this._displayY * tileHeight; + const mapY = Math.floor((originY + y) / tileHeight); + return this.roundY(mapY); +}; + +Game_Map.prototype.autoplay = function() { + if ($dataMap.autoplayBgm) { + if ($gamePlayer.isInVehicle()) { + $gameSystem.saveWalkingBgm2(); + } else { + AudioManager.playBgm($dataMap.bgm); + } + } + if ($dataMap.autoplayBgs) { + AudioManager.playBgs($dataMap.bgs); + } +}; + +Game_Map.prototype.refreshIfNeeded = function() { + if (this._needsRefresh) { + this.refresh(); + } +}; + +Game_Map.prototype.refresh = function() { + for (const event of this.events()) { + event.refresh(); + } + for (const commonEvent of this._commonEvents) { + commonEvent.refresh(); + } + this.refreshTileEvents(); + this._needsRefresh = false; +}; + +Game_Map.prototype.refreshTileEvents = function() { + this._tileEvents = this.events().filter(event => event.isTile()); +}; + +Game_Map.prototype.eventsXy = function(x, y) { + return this.events().filter(event => event.pos(x, y)); +}; + +Game_Map.prototype.eventsXyNt = function(x, y) { + return this.events().filter(event => event.posNt(x, y)); +}; + +Game_Map.prototype.tileEventsXy = function(x, y) { + return this._tileEvents.filter(event => event.posNt(x, y)); +}; + +Game_Map.prototype.eventIdXy = function(x, y) { + const list = this.eventsXy(x, y); + return list.length === 0 ? 0 : list[0].eventId(); +}; + +Game_Map.prototype.scrollDown = function(distance) { + if (this.isLoopVertical()) { + this._displayY += distance; + this._displayY %= $dataMap.height; + if (this._parallaxLoopY) { + this._parallaxY += distance; + } + } else if (this.height() >= this.screenTileY()) { + const lastY = this._displayY; + this._displayY = Math.min( + this._displayY + distance, + this.height() - this.screenTileY() + ); + this._parallaxY += this._displayY - lastY; + } +}; + +Game_Map.prototype.scrollLeft = function(distance) { + if (this.isLoopHorizontal()) { + this._displayX += $dataMap.width - distance; + this._displayX %= $dataMap.width; + if (this._parallaxLoopX) { + this._parallaxX -= distance; + } + } else if (this.width() >= this.screenTileX()) { + const lastX = this._displayX; + this._displayX = Math.max(this._displayX - distance, 0); + this._parallaxX += this._displayX - lastX; + } +}; + +Game_Map.prototype.scrollRight = function(distance) { + if (this.isLoopHorizontal()) { + this._displayX += distance; + this._displayX %= $dataMap.width; + if (this._parallaxLoopX) { + this._parallaxX += distance; + } + } else if (this.width() >= this.screenTileX()) { + const lastX = this._displayX; + this._displayX = Math.min( + this._displayX + distance, + this.width() - this.screenTileX() + ); + this._parallaxX += this._displayX - lastX; + } +}; + +Game_Map.prototype.scrollUp = function(distance) { + if (this.isLoopVertical()) { + this._displayY += $dataMap.height - distance; + this._displayY %= $dataMap.height; + if (this._parallaxLoopY) { + this._parallaxY -= distance; + } + } else if (this.height() >= this.screenTileY()) { + const lastY = this._displayY; + this._displayY = Math.max(this._displayY - distance, 0); + this._parallaxY += this._displayY - lastY; + } +}; + +Game_Map.prototype.isValid = function(x, y) { + return x >= 0 && x < this.width() && y >= 0 && y < this.height(); +}; + +Game_Map.prototype.checkPassage = function(x, y, bit) { + const flags = this.tilesetFlags(); + const tiles = this.allTiles(x, y); + for (const tile of tiles) { + const flag = flags[tile]; + if ((flag & 0x10) !== 0) { + // [*] No effect on passage + continue; + } + if ((flag & bit) === 0) { + // [o] Passable + return true; + } + if ((flag & bit) === bit) { + // [x] Impassable + return false; + } + } + return false; +}; + +Game_Map.prototype.tileId = function(x, y, z) { + const width = $dataMap.width; + const height = $dataMap.height; + return $dataMap.data[(z * height + y) * width + x] || 0; +}; + +Game_Map.prototype.layeredTiles = function(x, y) { + const tiles = []; + for (let i = 0; i < 4; i++) { + tiles.push(this.tileId(x, y, 3 - i)); + } + return tiles; +}; + +Game_Map.prototype.allTiles = function(x, y) { + const tiles = this.tileEventsXy(x, y).map(event => event.tileId()); + return tiles.concat(this.layeredTiles(x, y)); +}; + +Game_Map.prototype.autotileType = function(x, y, z) { + const tileId = this.tileId(x, y, z); + return tileId >= 2048 ? Math.floor((tileId - 2048) / 48) : -1; +}; + +Game_Map.prototype.isPassable = function(x, y, d) { + return this.checkPassage(x, y, (1 << (d / 2 - 1)) & 0x0f); +}; + +Game_Map.prototype.isBoatPassable = function(x, y) { + return this.checkPassage(x, y, 0x0200); +}; + +Game_Map.prototype.isShipPassable = function(x, y) { + return this.checkPassage(x, y, 0x0400); +}; + +Game_Map.prototype.isAirshipLandOk = function(x, y) { + return this.checkPassage(x, y, 0x0800) && this.checkPassage(x, y, 0x0f); +}; + +Game_Map.prototype.checkLayeredTilesFlags = function(x, y, bit) { + const flags = this.tilesetFlags(); + return this.layeredTiles(x, y).some(tileId => (flags[tileId] & bit) !== 0); +}; + +Game_Map.prototype.isLadder = function(x, y) { + return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x20); +}; + +Game_Map.prototype.isBush = function(x, y) { + return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x40); +}; + +Game_Map.prototype.isCounter = function(x, y) { + return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x80); +}; + +Game_Map.prototype.isDamageFloor = function(x, y) { + return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x100); +}; + +Game_Map.prototype.terrainTag = function(x, y) { + if (this.isValid(x, y)) { + const flags = this.tilesetFlags(); + const tiles = this.layeredTiles(x, y); + for (const tile of tiles) { + const tag = flags[tile] >> 12; + if (tag > 0) { + return tag; + } + } + } + return 0; +}; + +Game_Map.prototype.regionId = function(x, y) { + return this.isValid(x, y) ? this.tileId(x, y, 5) : 0; +}; + +Game_Map.prototype.startScroll = function(direction, distance, speed) { + this._scrollDirection = direction; + this._scrollRest = distance; + this._scrollSpeed = speed; +}; + +Game_Map.prototype.isScrolling = function() { + return this._scrollRest > 0; +}; + +Game_Map.prototype.update = function(sceneActive) { + this.refreshIfNeeded(); + if (sceneActive) { + this.updateInterpreter(); + } + this.updateScroll(); + this.updateEvents(); + this.updateVehicles(); + this.updateParallax(); +}; + +Game_Map.prototype.updateScroll = function() { + if (this.isScrolling()) { + const lastX = this._displayX; + const lastY = this._displayY; + this.doScroll(this._scrollDirection, this.scrollDistance()); + if (this._displayX === lastX && this._displayY === lastY) { + this._scrollRest = 0; + } else { + this._scrollRest -= this.scrollDistance(); + } + } +}; + +Game_Map.prototype.scrollDistance = function() { + return Math.pow(2, this._scrollSpeed) / 256; +}; + +Game_Map.prototype.doScroll = function(direction, distance) { + switch (direction) { + case 2: + this.scrollDown(distance); + break; + case 4: + this.scrollLeft(distance); + break; + case 6: + this.scrollRight(distance); + break; + case 8: + this.scrollUp(distance); + break; + } +}; + +Game_Map.prototype.updateEvents = function() { + for (const event of this.events()) { + event.update(); + } + for (const commonEvent of this._commonEvents) { + commonEvent.update(); + } +}; + +Game_Map.prototype.updateVehicles = function() { + for (const vehicle of this._vehicles) { + vehicle.update(); + } +}; + +Game_Map.prototype.updateParallax = function() { + if (this._parallaxLoopX) { + this._parallaxX += this._parallaxSx / this.tileWidth() / 2; + } + if (this._parallaxLoopY) { + this._parallaxY += this._parallaxSy / this.tileHeight() / 2; + } +}; + +Game_Map.prototype.changeTileset = function(tilesetId) { + this._tilesetId = tilesetId; + this.refresh(); +}; + +Game_Map.prototype.changeBattleback = function( + battleback1Name, + battleback2Name +) { + this._battleback1Name = battleback1Name; + this._battleback2Name = battleback2Name; +}; + +Game_Map.prototype.changeParallax = function(name, loopX, loopY, sx, sy) { + this._parallaxName = name; + this._parallaxZero = ImageManager.isZeroParallax(this._parallaxName); + if (this._parallaxLoopX && !loopX) { + this._parallaxX = 0; + } + if (this._parallaxLoopY && !loopY) { + this._parallaxY = 0; + } + this._parallaxLoopX = loopX; + this._parallaxLoopY = loopY; + this._parallaxSx = sx; + this._parallaxSy = sy; +}; + +Game_Map.prototype.updateInterpreter = function() { + for (;;) { + this._interpreter.update(); + if (this._interpreter.isRunning()) { + return; + } + if (this._interpreter.eventId() > 0) { + this.unlockEvent(this._interpreter.eventId()); + this._interpreter.clear(); + } + if (!this.setupStartingEvent()) { + return; + } + } +}; + +Game_Map.prototype.unlockEvent = function(eventId) { + if (this._events[eventId]) { + this._events[eventId].unlock(); + } +}; + +Game_Map.prototype.setupStartingEvent = function() { + this.refreshIfNeeded(); + if (this._interpreter.setupReservedCommonEvent()) { + return true; + } + if (this.setupTestEvent()) { + return true; + } + if (this.setupStartingMapEvent()) { + return true; + } + if (this.setupAutorunCommonEvent()) { + return true; + } + return false; +}; + +Game_Map.prototype.setupTestEvent = function() { + if (window.$testEvent) { + this._interpreter.setup($testEvent, 0); + $testEvent = null; + return true; + } + return false; +}; + +Game_Map.prototype.setupStartingMapEvent = function() { + for (const event of this.events()) { + if (event.isStarting()) { + event.clearStartingFlag(); + this._interpreter.setup(event.list(), event.eventId()); + return true; + } + } + return false; +}; + +Game_Map.prototype.setupAutorunCommonEvent = function() { + for (const commonEvent of this.autorunCommonEvents()) { + if ($gameSwitches.value(commonEvent.switchId)) { + this._interpreter.setup(commonEvent.list); + return true; + } + } + return false; +}; + +Game_Map.prototype.isAnyEventStarting = function() { + return this.events().some(event => event.isStarting()); +}; + +//----------------------------------------------------------------------------- +// Game_CommonEvent +// +// The game object class for a common event. It contains functionality for +// running parallel process events. + +function Game_CommonEvent() { + this.initialize(...arguments); +} + +Game_CommonEvent.prototype.initialize = function(commonEventId) { + this._commonEventId = commonEventId; + this.refresh(); +}; + +Game_CommonEvent.prototype.event = function() { + return $dataCommonEvents[this._commonEventId]; +}; + +Game_CommonEvent.prototype.list = function() { + return this.event().list; +}; + +Game_CommonEvent.prototype.refresh = function() { + if (this.isActive()) { + if (!this._interpreter) { + this._interpreter = new Game_Interpreter(); + } + } else { + this._interpreter = null; + } +}; + +Game_CommonEvent.prototype.isActive = function() { + const event = this.event(); + return event.trigger === 2 && $gameSwitches.value(event.switchId); +}; + +Game_CommonEvent.prototype.update = function() { + if (this._interpreter) { + if (!this._interpreter.isRunning()) { + this._interpreter.setup(this.list()); + } + this._interpreter.update(); + } +}; + +//----------------------------------------------------------------------------- +// Game_CharacterBase +// +// The superclass of Game_Character. It handles basic information, such as +// coordinates and images, shared by all characters. + +function Game_CharacterBase() { + this.initialize(...arguments); +} + +Object.defineProperties(Game_CharacterBase.prototype, { + x: { + get: function() { + return this._x; + }, + configurable: true + }, + y: { + get: function() { + return this._y; + }, + configurable: true + } +}); + +Game_CharacterBase.prototype.initialize = function() { + this.initMembers(); +}; + +Game_CharacterBase.prototype.initMembers = function() { + this._x = 0; + this._y = 0; + this._realX = 0; + this._realY = 0; + this._moveSpeed = 4; + this._moveFrequency = 6; + this._opacity = 255; + this._blendMode = 0; + this._direction = 2; + this._pattern = 1; + this._priorityType = 1; + this._tileId = 0; + this._characterName = ""; + this._characterIndex = 0; + this._isObjectCharacter = false; + this._walkAnime = true; + this._stepAnime = false; + this._directionFix = false; + this._through = false; + this._transparent = false; + this._bushDepth = 0; + this._animationId = 0; + this._balloonId = 0; + this._animationPlaying = false; + this._balloonPlaying = false; + this._animationCount = 0; + this._stopCount = 0; + this._jumpCount = 0; + this._jumpPeak = 0; + this._movementSuccess = true; +}; + +Game_CharacterBase.prototype.pos = function(x, y) { + return this._x === x && this._y === y; +}; + +Game_CharacterBase.prototype.posNt = function(x, y) { + // No through + return this.pos(x, y) && !this.isThrough(); +}; + +Game_CharacterBase.prototype.moveSpeed = function() { + return this._moveSpeed; +}; + +Game_CharacterBase.prototype.setMoveSpeed = function(moveSpeed) { + this._moveSpeed = moveSpeed; +}; + +Game_CharacterBase.prototype.moveFrequency = function() { + return this._moveFrequency; +}; + +Game_CharacterBase.prototype.setMoveFrequency = function(moveFrequency) { + this._moveFrequency = moveFrequency; +}; + +Game_CharacterBase.prototype.opacity = function() { + return this._opacity; +}; + +Game_CharacterBase.prototype.setOpacity = function(opacity) { + this._opacity = opacity; +}; + +Game_CharacterBase.prototype.blendMode = function() { + return this._blendMode; +}; + +Game_CharacterBase.prototype.setBlendMode = function(blendMode) { + this._blendMode = blendMode; +}; + +Game_CharacterBase.prototype.isNormalPriority = function() { + return this._priorityType === 1; +}; + +Game_CharacterBase.prototype.setPriorityType = function(priorityType) { + this._priorityType = priorityType; +}; + +Game_CharacterBase.prototype.isMoving = function() { + return this._realX !== this._x || this._realY !== this._y; +}; + +Game_CharacterBase.prototype.isJumping = function() { + return this._jumpCount > 0; +}; + +Game_CharacterBase.prototype.jumpHeight = function() { + return ( + (this._jumpPeak * this._jumpPeak - + Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / + 2 + ); +}; + +Game_CharacterBase.prototype.isStopping = function() { + return !this.isMoving() && !this.isJumping(); +}; + +Game_CharacterBase.prototype.checkStop = function(threshold) { + return this._stopCount > threshold; +}; + +Game_CharacterBase.prototype.resetStopCount = function() { + this._stopCount = 0; +}; + +Game_CharacterBase.prototype.realMoveSpeed = function() { + return this._moveSpeed + (this.isDashing() ? 1 : 0); +}; + +Game_CharacterBase.prototype.distancePerFrame = function() { + return Math.pow(2, this.realMoveSpeed()) / 256; +}; + +Game_CharacterBase.prototype.isDashing = function() { + return false; +}; + +Game_CharacterBase.prototype.isDebugThrough = function() { + return false; +}; + +Game_CharacterBase.prototype.straighten = function() { + if (this.hasWalkAnime() || this.hasStepAnime()) { + this._pattern = 1; + } + this._animationCount = 0; +}; + +Game_CharacterBase.prototype.reverseDir = function(d) { + return 10 - d; +}; + +Game_CharacterBase.prototype.canPass = function(x, y, d) { + const x2 = $gameMap.roundXWithDirection(x, d); + const y2 = $gameMap.roundYWithDirection(y, d); + if (!$gameMap.isValid(x2, y2)) { + return false; + } + if (this.isThrough() || this.isDebugThrough()) { + return true; + } + if (!this.isMapPassable(x, y, d)) { + return false; + } + if (this.isCollidedWithCharacters(x2, y2)) { + return false; + } + return true; +}; + +Game_CharacterBase.prototype.canPassDiagonally = function(x, y, horz, vert) { + const x2 = $gameMap.roundXWithDirection(x, horz); + const y2 = $gameMap.roundYWithDirection(y, vert); + if (this.canPass(x, y, vert) && this.canPass(x, y2, horz)) { + return true; + } + if (this.canPass(x, y, horz) && this.canPass(x2, y, vert)) { + return true; + } + return false; +}; + +Game_CharacterBase.prototype.isMapPassable = function(x, y, d) { + const x2 = $gameMap.roundXWithDirection(x, d); + const y2 = $gameMap.roundYWithDirection(y, d); + const d2 = this.reverseDir(d); + return $gameMap.isPassable(x, y, d) && $gameMap.isPassable(x2, y2, d2); +}; + +Game_CharacterBase.prototype.isCollidedWithCharacters = function(x, y) { + return this.isCollidedWithEvents(x, y) || this.isCollidedWithVehicles(x, y); +}; + +Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) { + const events = $gameMap.eventsXyNt(x, y); + return events.some(event => event.isNormalPriority()); +}; + +Game_CharacterBase.prototype.isCollidedWithVehicles = function(x, y) { + return $gameMap.boat().posNt(x, y) || $gameMap.ship().posNt(x, y); +}; + +Game_CharacterBase.prototype.setPosition = function(x, y) { + this._x = Math.round(x); + this._y = Math.round(y); + this._realX = x; + this._realY = y; +}; + +Game_CharacterBase.prototype.copyPosition = function(character) { + this._x = character._x; + this._y = character._y; + this._realX = character._realX; + this._realY = character._realY; + this._direction = character._direction; +}; + +Game_CharacterBase.prototype.locate = function(x, y) { + this.setPosition(x, y); + this.straighten(); + this.refreshBushDepth(); +}; + +Game_CharacterBase.prototype.direction = function() { + return this._direction; +}; + +Game_CharacterBase.prototype.setDirection = function(d) { + if (!this.isDirectionFixed() && d) { + this._direction = d; + } + this.resetStopCount(); +}; + +Game_CharacterBase.prototype.isTile = function() { + return this._tileId > 0 && this._priorityType === 0; +}; + +Game_CharacterBase.prototype.isObjectCharacter = function() { + return this._isObjectCharacter; +}; + +Game_CharacterBase.prototype.shiftY = function() { + return this.isObjectCharacter() ? 0 : 6; +}; + +Game_CharacterBase.prototype.scrolledX = function() { + return $gameMap.adjustX(this._realX); +}; + +Game_CharacterBase.prototype.scrolledY = function() { + return $gameMap.adjustY(this._realY); +}; + +Game_CharacterBase.prototype.screenX = function() { + const tw = $gameMap.tileWidth(); + return Math.floor(this.scrolledX() * tw + tw / 2); +}; + +Game_CharacterBase.prototype.screenY = function() { + const th = $gameMap.tileHeight(); + return Math.floor( + this.scrolledY() * th + th - this.shiftY() - this.jumpHeight() + ); +}; + +Game_CharacterBase.prototype.screenZ = function() { + return this._priorityType * 2 + 1; +}; + +Game_CharacterBase.prototype.isNearTheScreen = function() { + const gw = Graphics.width; + const gh = Graphics.height; + const tw = $gameMap.tileWidth(); + const th = $gameMap.tileHeight(); + const px = this.scrolledX() * tw + tw / 2 - gw / 2; + const py = this.scrolledY() * th + th / 2 - gh / 2; + return px >= -gw && px <= gw && py >= -gh && py <= gh; +}; + +Game_CharacterBase.prototype.update = function() { + if (this.isStopping()) { + this.updateStop(); + } + if (this.isJumping()) { + this.updateJump(); + } else if (this.isMoving()) { + this.updateMove(); + } + this.updateAnimation(); +}; + +Game_CharacterBase.prototype.updateStop = function() { + this._stopCount++; +}; + +Game_CharacterBase.prototype.updateJump = function() { + this._jumpCount--; + this._realX = + (this._realX * this._jumpCount + this._x) / (this._jumpCount + 1.0); + this._realY = + (this._realY * this._jumpCount + this._y) / (this._jumpCount + 1.0); + this.refreshBushDepth(); + if (this._jumpCount === 0) { + this._realX = this._x = $gameMap.roundX(this._x); + this._realY = this._y = $gameMap.roundY(this._y); + } +}; + +Game_CharacterBase.prototype.updateMove = function() { + if (this._x < this._realX) { + this._realX = Math.max(this._realX - this.distancePerFrame(), this._x); + } + if (this._x > this._realX) { + this._realX = Math.min(this._realX + this.distancePerFrame(), this._x); + } + if (this._y < this._realY) { + this._realY = Math.max(this._realY - this.distancePerFrame(), this._y); + } + if (this._y > this._realY) { + this._realY = Math.min(this._realY + this.distancePerFrame(), this._y); + } + if (!this.isMoving()) { + this.refreshBushDepth(); + } +}; + +Game_CharacterBase.prototype.updateAnimation = function() { + this.updateAnimationCount(); + if (this._animationCount >= this.animationWait()) { + this.updatePattern(); + this._animationCount = 0; + } +}; + +Game_CharacterBase.prototype.animationWait = function() { + return (9 - this.realMoveSpeed()) * 3; +}; + +Game_CharacterBase.prototype.updateAnimationCount = function() { + if (this.isMoving() && this.hasWalkAnime()) { + this._animationCount += 1.5; + } else if (this.hasStepAnime() || !this.isOriginalPattern()) { + this._animationCount++; + } +}; + +Game_CharacterBase.prototype.updatePattern = function() { + if (!this.hasStepAnime() && this._stopCount > 0) { + this.resetPattern(); + } else { + this._pattern = (this._pattern + 1) % this.maxPattern(); + } +}; + +Game_CharacterBase.prototype.maxPattern = function() { + return 4; +}; + +Game_CharacterBase.prototype.pattern = function() { + return this._pattern < 3 ? this._pattern : 1; +}; + +Game_CharacterBase.prototype.setPattern = function(pattern) { + this._pattern = pattern; +}; + +Game_CharacterBase.prototype.isOriginalPattern = function() { + return this.pattern() === 1; +}; + +Game_CharacterBase.prototype.resetPattern = function() { + this.setPattern(1); +}; + +Game_CharacterBase.prototype.refreshBushDepth = function() { + if ( + this.isNormalPriority() && + !this.isObjectCharacter() && + this.isOnBush() && + !this.isJumping() + ) { + if (!this.isMoving()) { + this._bushDepth = $gameMap.bushDepth(); + } + } else { + this._bushDepth = 0; + } +}; + +Game_CharacterBase.prototype.isOnLadder = function() { + return $gameMap.isLadder(this._x, this._y); +}; + +Game_CharacterBase.prototype.isOnBush = function() { + return $gameMap.isBush(this._x, this._y); +}; + +Game_CharacterBase.prototype.terrainTag = function() { + return $gameMap.terrainTag(this._x, this._y); +}; + +Game_CharacterBase.prototype.regionId = function() { + return $gameMap.regionId(this._x, this._y); +}; + +Game_CharacterBase.prototype.increaseSteps = function() { + if (this.isOnLadder()) { + this.setDirection(8); + } + this.resetStopCount(); + this.refreshBushDepth(); +}; + +Game_CharacterBase.prototype.tileId = function() { + return this._tileId; +}; + +Game_CharacterBase.prototype.characterName = function() { + return this._characterName; +}; + +Game_CharacterBase.prototype.characterIndex = function() { + return this._characterIndex; +}; + +Game_CharacterBase.prototype.setImage = function( + characterName, + characterIndex +) { + this._tileId = 0; + this._characterName = characterName; + this._characterIndex = characterIndex; + this._isObjectCharacter = ImageManager.isObjectCharacter(characterName); +}; + +Game_CharacterBase.prototype.setTileImage = function(tileId) { + this._tileId = tileId; + this._characterName = ""; + this._characterIndex = 0; + this._isObjectCharacter = true; +}; + +Game_CharacterBase.prototype.checkEventTriggerTouchFront = function(d) { + const x2 = $gameMap.roundXWithDirection(this._x, d); + const y2 = $gameMap.roundYWithDirection(this._y, d); + this.checkEventTriggerTouch(x2, y2); +}; + +Game_CharacterBase.prototype.checkEventTriggerTouch = function(/*x, y*/) { + return false; +}; + +Game_CharacterBase.prototype.isMovementSucceeded = function(/*x, y*/) { + return this._movementSuccess; +}; + +Game_CharacterBase.prototype.setMovementSuccess = function(success) { + this._movementSuccess = success; +}; + +Game_CharacterBase.prototype.moveStraight = function(d) { + this.setMovementSuccess(this.canPass(this._x, this._y, d)); + if (this.isMovementSucceeded()) { + this.setDirection(d); + this._x = $gameMap.roundXWithDirection(this._x, d); + this._y = $gameMap.roundYWithDirection(this._y, d); + this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(d)); + this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(d)); + this.increaseSteps(); + } else { + this.setDirection(d); + this.checkEventTriggerTouchFront(d); + } +}; + +Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) { + this.setMovementSuccess( + this.canPassDiagonally(this._x, this._y, horz, vert) + ); + if (this.isMovementSucceeded()) { + this._x = $gameMap.roundXWithDirection(this._x, horz); + this._y = $gameMap.roundYWithDirection(this._y, vert); + this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz)); + this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert)); + this.increaseSteps(); + } + if (this._direction === this.reverseDir(horz)) { + this.setDirection(horz); + } + if (this._direction === this.reverseDir(vert)) { + this.setDirection(vert); + } +}; + +Game_CharacterBase.prototype.jump = function(xPlus, yPlus) { + if (Math.abs(xPlus) > Math.abs(yPlus)) { + if (xPlus !== 0) { + this.setDirection(xPlus < 0 ? 4 : 6); + } + } else { + if (yPlus !== 0) { + this.setDirection(yPlus < 0 ? 8 : 2); + } + } + this._x += xPlus; + this._y += yPlus; + const distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus)); + this._jumpPeak = 10 + distance - this._moveSpeed; + this._jumpCount = this._jumpPeak * 2; + this.resetStopCount(); + this.straighten(); +}; + +Game_CharacterBase.prototype.hasWalkAnime = function() { + return this._walkAnime; +}; + +Game_CharacterBase.prototype.setWalkAnime = function(walkAnime) { + this._walkAnime = walkAnime; +}; + +Game_CharacterBase.prototype.hasStepAnime = function() { + return this._stepAnime; +}; + +Game_CharacterBase.prototype.setStepAnime = function(stepAnime) { + this._stepAnime = stepAnime; +}; + +Game_CharacterBase.prototype.isDirectionFixed = function() { + return this._directionFix; +}; + +Game_CharacterBase.prototype.setDirectionFix = function(directionFix) { + this._directionFix = directionFix; +}; + +Game_CharacterBase.prototype.isThrough = function() { + return this._through; +}; + +Game_CharacterBase.prototype.setThrough = function(through) { + this._through = through; +}; + +Game_CharacterBase.prototype.isTransparent = function() { + return this._transparent; +}; + +Game_CharacterBase.prototype.bushDepth = function() { + return this._bushDepth; +}; + +Game_CharacterBase.prototype.setTransparent = function(transparent) { + this._transparent = transparent; +}; + +Game_CharacterBase.prototype.startAnimation = function() { + this._animationPlaying = true; +}; + +Game_CharacterBase.prototype.startBalloon = function() { + this._balloonPlaying = true; +}; + +Game_CharacterBase.prototype.isAnimationPlaying = function() { + return this._animationPlaying; +}; + +Game_CharacterBase.prototype.isBalloonPlaying = function() { + return this._balloonPlaying; +}; + +Game_CharacterBase.prototype.endAnimation = function() { + this._animationPlaying = false; +}; + +Game_CharacterBase.prototype.endBalloon = function() { + this._balloonPlaying = false; +}; + +//----------------------------------------------------------------------------- +// Game_Character +// +// The superclass of Game_Player, Game_Follower, GameVehicle, and Game_Event. + +function Game_Character() { + this.initialize(...arguments); +} + +Game_Character.prototype = Object.create(Game_CharacterBase.prototype); +Game_Character.prototype.constructor = Game_Character; + +Game_Character.ROUTE_END = 0; +Game_Character.ROUTE_MOVE_DOWN = 1; +Game_Character.ROUTE_MOVE_LEFT = 2; +Game_Character.ROUTE_MOVE_RIGHT = 3; +Game_Character.ROUTE_MOVE_UP = 4; +Game_Character.ROUTE_MOVE_LOWER_L = 5; +Game_Character.ROUTE_MOVE_LOWER_R = 6; +Game_Character.ROUTE_MOVE_UPPER_L = 7; +Game_Character.ROUTE_MOVE_UPPER_R = 8; +Game_Character.ROUTE_MOVE_RANDOM = 9; +Game_Character.ROUTE_MOVE_TOWARD = 10; +Game_Character.ROUTE_MOVE_AWAY = 11; +Game_Character.ROUTE_MOVE_FORWARD = 12; +Game_Character.ROUTE_MOVE_BACKWARD = 13; +Game_Character.ROUTE_JUMP = 14; +Game_Character.ROUTE_WAIT = 15; +Game_Character.ROUTE_TURN_DOWN = 16; +Game_Character.ROUTE_TURN_LEFT = 17; +Game_Character.ROUTE_TURN_RIGHT = 18; +Game_Character.ROUTE_TURN_UP = 19; +Game_Character.ROUTE_TURN_90D_R = 20; +Game_Character.ROUTE_TURN_90D_L = 21; +Game_Character.ROUTE_TURN_180D = 22; +Game_Character.ROUTE_TURN_90D_R_L = 23; +Game_Character.ROUTE_TURN_RANDOM = 24; +Game_Character.ROUTE_TURN_TOWARD = 25; +Game_Character.ROUTE_TURN_AWAY = 26; +Game_Character.ROUTE_SWITCH_ON = 27; +Game_Character.ROUTE_SWITCH_OFF = 28; +Game_Character.ROUTE_CHANGE_SPEED = 29; +Game_Character.ROUTE_CHANGE_FREQ = 30; +Game_Character.ROUTE_WALK_ANIME_ON = 31; +Game_Character.ROUTE_WALK_ANIME_OFF = 32; +Game_Character.ROUTE_STEP_ANIME_ON = 33; +Game_Character.ROUTE_STEP_ANIME_OFF = 34; +Game_Character.ROUTE_DIR_FIX_ON = 35; +Game_Character.ROUTE_DIR_FIX_OFF = 36; +Game_Character.ROUTE_THROUGH_ON = 37; +Game_Character.ROUTE_THROUGH_OFF = 38; +Game_Character.ROUTE_TRANSPARENT_ON = 39; +Game_Character.ROUTE_TRANSPARENT_OFF = 40; +Game_Character.ROUTE_CHANGE_IMAGE = 41; +Game_Character.ROUTE_CHANGE_OPACITY = 42; +Game_Character.ROUTE_CHANGE_BLEND_MODE = 43; +Game_Character.ROUTE_PLAY_SE = 44; +Game_Character.ROUTE_SCRIPT = 45; + +Game_Character.prototype.initialize = function() { + Game_CharacterBase.prototype.initialize.call(this); +}; + +Game_Character.prototype.initMembers = function() { + Game_CharacterBase.prototype.initMembers.call(this); + this._moveRouteForcing = false; + this._moveRoute = null; + this._moveRouteIndex = 0; + this._originalMoveRoute = null; + this._originalMoveRouteIndex = 0; + this._waitCount = 0; +}; + +Game_Character.prototype.memorizeMoveRoute = function() { + this._originalMoveRoute = this._moveRoute; + this._originalMoveRouteIndex = this._moveRouteIndex; +}; + +Game_Character.prototype.restoreMoveRoute = function() { + this._moveRoute = this._originalMoveRoute; + this._moveRouteIndex = this._originalMoveRouteIndex; + this._originalMoveRoute = null; +}; + +Game_Character.prototype.isMoveRouteForcing = function() { + return this._moveRouteForcing; +}; + +Game_Character.prototype.setMoveRoute = function(moveRoute) { + if (this._moveRouteForcing) { + this._originalMoveRoute = moveRoute; + this._originalMoveRouteIndex = 0; + } else { + this._moveRoute = moveRoute; + this._moveRouteIndex = 0; + } +}; + +Game_Character.prototype.forceMoveRoute = function(moveRoute) { + if (!this._originalMoveRoute) { + this.memorizeMoveRoute(); + } + this._moveRoute = moveRoute; + this._moveRouteIndex = 0; + this._moveRouteForcing = true; + this._waitCount = 0; +}; + +Game_Character.prototype.updateStop = function() { + Game_CharacterBase.prototype.updateStop.call(this); + if (this._moveRouteForcing) { + this.updateRoutineMove(); + } +}; + +Game_Character.prototype.updateRoutineMove = function() { + if (this._waitCount > 0) { + this._waitCount--; + } else { + this.setMovementSuccess(true); + const command = this._moveRoute.list[this._moveRouteIndex]; + if (command) { + this.processMoveCommand(command); + this.advanceMoveRouteIndex(); + } + } +}; + +Game_Character.prototype.processMoveCommand = function(command) { + const gc = Game_Character; + const params = command.parameters; + switch (command.code) { + case gc.ROUTE_END: + this.processRouteEnd(); + break; + case gc.ROUTE_MOVE_DOWN: + this.moveStraight(2); + break; + case gc.ROUTE_MOVE_LEFT: + this.moveStraight(4); + break; + case gc.ROUTE_MOVE_RIGHT: + this.moveStraight(6); + break; + case gc.ROUTE_MOVE_UP: + this.moveStraight(8); + break; + case gc.ROUTE_MOVE_LOWER_L: + this.moveDiagonally(4, 2); + break; + case gc.ROUTE_MOVE_LOWER_R: + this.moveDiagonally(6, 2); + break; + case gc.ROUTE_MOVE_UPPER_L: + this.moveDiagonally(4, 8); + break; + case gc.ROUTE_MOVE_UPPER_R: + this.moveDiagonally(6, 8); + break; + case gc.ROUTE_MOVE_RANDOM: + this.moveRandom(); + break; + case gc.ROUTE_MOVE_TOWARD: + this.moveTowardPlayer(); + break; + case gc.ROUTE_MOVE_AWAY: + this.moveAwayFromPlayer(); + break; + case gc.ROUTE_MOVE_FORWARD: + this.moveForward(); + break; + case gc.ROUTE_MOVE_BACKWARD: + this.moveBackward(); + break; + case gc.ROUTE_JUMP: + this.jump(params[0], params[1]); + break; + case gc.ROUTE_WAIT: + this._waitCount = params[0] - 1; + break; + case gc.ROUTE_TURN_DOWN: + this.setDirection(2); + break; + case gc.ROUTE_TURN_LEFT: + this.setDirection(4); + break; + case gc.ROUTE_TURN_RIGHT: + this.setDirection(6); + break; + case gc.ROUTE_TURN_UP: + this.setDirection(8); + break; + case gc.ROUTE_TURN_90D_R: + this.turnRight90(); + break; + case gc.ROUTE_TURN_90D_L: + this.turnLeft90(); + break; + case gc.ROUTE_TURN_180D: + this.turn180(); + break; + case gc.ROUTE_TURN_90D_R_L: + this.turnRightOrLeft90(); + break; + case gc.ROUTE_TURN_RANDOM: + this.turnRandom(); + break; + case gc.ROUTE_TURN_TOWARD: + this.turnTowardPlayer(); + break; + case gc.ROUTE_TURN_AWAY: + this.turnAwayFromPlayer(); + break; + case gc.ROUTE_SWITCH_ON: + $gameSwitches.setValue(params[0], true); + break; + case gc.ROUTE_SWITCH_OFF: + $gameSwitches.setValue(params[0], false); + break; + case gc.ROUTE_CHANGE_SPEED: + this.setMoveSpeed(params[0]); + break; + case gc.ROUTE_CHANGE_FREQ: + this.setMoveFrequency(params[0]); + break; + case gc.ROUTE_WALK_ANIME_ON: + this.setWalkAnime(true); + break; + case gc.ROUTE_WALK_ANIME_OFF: + this.setWalkAnime(false); + break; + case gc.ROUTE_STEP_ANIME_ON: + this.setStepAnime(true); + break; + case gc.ROUTE_STEP_ANIME_OFF: + this.setStepAnime(false); + break; + case gc.ROUTE_DIR_FIX_ON: + this.setDirectionFix(true); + break; + case gc.ROUTE_DIR_FIX_OFF: + this.setDirectionFix(false); + break; + case gc.ROUTE_THROUGH_ON: + this.setThrough(true); + break; + case gc.ROUTE_THROUGH_OFF: + this.setThrough(false); + break; + case gc.ROUTE_TRANSPARENT_ON: + this.setTransparent(true); + break; + case gc.ROUTE_TRANSPARENT_OFF: + this.setTransparent(false); + break; + case gc.ROUTE_CHANGE_IMAGE: + this.setImage(params[0], params[1]); + break; + case gc.ROUTE_CHANGE_OPACITY: + this.setOpacity(params[0]); + break; + case gc.ROUTE_CHANGE_BLEND_MODE: + this.setBlendMode(params[0]); + break; + case gc.ROUTE_PLAY_SE: + AudioManager.playSe(params[0]); + break; + case gc.ROUTE_SCRIPT: + eval(params[0]); + break; + } +}; + +Game_Character.prototype.deltaXFrom = function(x) { + return $gameMap.deltaX(this.x, x); +}; + +Game_Character.prototype.deltaYFrom = function(y) { + return $gameMap.deltaY(this.y, y); +}; + +Game_Character.prototype.moveRandom = function() { + const d = 2 + Math.randomInt(4) * 2; + if (this.canPass(this.x, this.y, d)) { + this.moveStraight(d); + } +}; + +Game_Character.prototype.moveTowardCharacter = function(character) { + const sx = this.deltaXFrom(character.x); + const sy = this.deltaYFrom(character.y); + if (Math.abs(sx) > Math.abs(sy)) { + this.moveStraight(sx > 0 ? 4 : 6); + if (!this.isMovementSucceeded() && sy !== 0) { + this.moveStraight(sy > 0 ? 8 : 2); + } + } else if (sy !== 0) { + this.moveStraight(sy > 0 ? 8 : 2); + if (!this.isMovementSucceeded() && sx !== 0) { + this.moveStraight(sx > 0 ? 4 : 6); + } + } +}; + +Game_Character.prototype.moveAwayFromCharacter = function(character) { + const sx = this.deltaXFrom(character.x); + const sy = this.deltaYFrom(character.y); + if (Math.abs(sx) > Math.abs(sy)) { + this.moveStraight(sx > 0 ? 6 : 4); + if (!this.isMovementSucceeded() && sy !== 0) { + this.moveStraight(sy > 0 ? 2 : 8); + } + } else if (sy !== 0) { + this.moveStraight(sy > 0 ? 2 : 8); + if (!this.isMovementSucceeded() && sx !== 0) { + this.moveStraight(sx > 0 ? 6 : 4); + } + } +}; + +Game_Character.prototype.turnTowardCharacter = function(character) { + const sx = this.deltaXFrom(character.x); + const sy = this.deltaYFrom(character.y); + if (Math.abs(sx) > Math.abs(sy)) { + this.setDirection(sx > 0 ? 4 : 6); + } else if (sy !== 0) { + this.setDirection(sy > 0 ? 8 : 2); + } +}; + +Game_Character.prototype.turnAwayFromCharacter = function(character) { + const sx = this.deltaXFrom(character.x); + const sy = this.deltaYFrom(character.y); + if (Math.abs(sx) > Math.abs(sy)) { + this.setDirection(sx > 0 ? 6 : 4); + } else if (sy !== 0) { + this.setDirection(sy > 0 ? 2 : 8); + } +}; + +Game_Character.prototype.turnTowardPlayer = function() { + this.turnTowardCharacter($gamePlayer); +}; + +Game_Character.prototype.turnAwayFromPlayer = function() { + this.turnAwayFromCharacter($gamePlayer); +}; + +Game_Character.prototype.moveTowardPlayer = function() { + this.moveTowardCharacter($gamePlayer); +}; + +Game_Character.prototype.moveAwayFromPlayer = function() { + this.moveAwayFromCharacter($gamePlayer); +}; + +Game_Character.prototype.moveForward = function() { + this.moveStraight(this.direction()); +}; + +Game_Character.prototype.moveBackward = function() { + const lastDirectionFix = this.isDirectionFixed(); + this.setDirectionFix(true); + this.moveStraight(this.reverseDir(this.direction())); + this.setDirectionFix(lastDirectionFix); +}; + +Game_Character.prototype.processRouteEnd = function() { + if (this._moveRoute.repeat) { + this._moveRouteIndex = -1; + } else if (this._moveRouteForcing) { + this._moveRouteForcing = false; + this.restoreMoveRoute(); + this.setMovementSuccess(false); + } +}; + +Game_Character.prototype.advanceMoveRouteIndex = function() { + const moveRoute = this._moveRoute; + if (moveRoute && (this.isMovementSucceeded() || moveRoute.skippable)) { + let numCommands = moveRoute.list.length - 1; + this._moveRouteIndex++; + if (moveRoute.repeat && this._moveRouteIndex >= numCommands) { + this._moveRouteIndex = 0; + } + } +}; + +Game_Character.prototype.turnRight90 = function() { + switch (this.direction()) { + case 2: + this.setDirection(4); + break; + case 4: + this.setDirection(8); + break; + case 6: + this.setDirection(2); + break; + case 8: + this.setDirection(6); + break; + } +}; + +Game_Character.prototype.turnLeft90 = function() { + switch (this.direction()) { + case 2: + this.setDirection(6); + break; + case 4: + this.setDirection(2); + break; + case 6: + this.setDirection(8); + break; + case 8: + this.setDirection(4); + break; + } +}; + +Game_Character.prototype.turn180 = function() { + this.setDirection(this.reverseDir(this.direction())); +}; + +Game_Character.prototype.turnRightOrLeft90 = function() { + switch (Math.randomInt(2)) { + case 0: + this.turnRight90(); + break; + case 1: + this.turnLeft90(); + break; + } +}; + +Game_Character.prototype.turnRandom = function() { + this.setDirection(2 + Math.randomInt(4) * 2); +}; + +Game_Character.prototype.swap = function(character) { + const newX = character.x; + const newY = character.y; + character.locate(this.x, this.y); + this.locate(newX, newY); +}; + +Game_Character.prototype.findDirectionTo = function(goalX, goalY) { + const searchLimit = this.searchLimit(); + const mapWidth = $gameMap.width(); + const nodeList = []; + const openList = []; + const closedList = []; + const start = {}; + let best = start; + + if (this.x === goalX && this.y === goalY) { + return 0; + } + + start.parent = null; + start.x = this.x; + start.y = this.y; + start.g = 0; + start.f = $gameMap.distance(start.x, start.y, goalX, goalY); + nodeList.push(start); + openList.push(start.y * mapWidth + start.x); + + while (nodeList.length > 0) { + let bestIndex = 0; + for (let i = 0; i < nodeList.length; i++) { + if (nodeList[i].f < nodeList[bestIndex].f) { + bestIndex = i; + } + } + + const current = nodeList[bestIndex]; + const x1 = current.x; + const y1 = current.y; + const pos1 = y1 * mapWidth + x1; + const g1 = current.g; + + nodeList.splice(bestIndex, 1); + openList.splice(openList.indexOf(pos1), 1); + closedList.push(pos1); + + if (current.x === goalX && current.y === goalY) { + best = current; + break; + } + + if (g1 >= searchLimit) { + continue; + } + + for (let j = 0; j < 4; j++) { + const direction = 2 + j * 2; + const x2 = $gameMap.roundXWithDirection(x1, direction); + const y2 = $gameMap.roundYWithDirection(y1, direction); + const pos2 = y2 * mapWidth + x2; + + if (closedList.includes(pos2)) { + continue; + } + if (!this.canPass(x1, y1, direction)) { + continue; + } + + const g2 = g1 + 1; + const index2 = openList.indexOf(pos2); + + if (index2 < 0 || g2 < nodeList[index2].g) { + let neighbor = {}; + if (index2 >= 0) { + neighbor = nodeList[index2]; + } else { + nodeList.push(neighbor); + openList.push(pos2); + } + neighbor.parent = current; + neighbor.x = x2; + neighbor.y = y2; + neighbor.g = g2; + neighbor.f = g2 + $gameMap.distance(x2, y2, goalX, goalY); + if (!best || neighbor.f - neighbor.g < best.f - best.g) { + best = neighbor; + } + } + } + } + + let node = best; + while (node.parent && node.parent !== start) { + node = node.parent; + } + + const deltaX1 = $gameMap.deltaX(node.x, start.x); + const deltaY1 = $gameMap.deltaY(node.y, start.y); + if (deltaY1 > 0) { + return 2; + } else if (deltaX1 < 0) { + return 4; + } else if (deltaX1 > 0) { + return 6; + } else if (deltaY1 < 0) { + return 8; + } + + const deltaX2 = this.deltaXFrom(goalX); + const deltaY2 = this.deltaYFrom(goalY); + if (Math.abs(deltaX2) > Math.abs(deltaY2)) { + return deltaX2 > 0 ? 4 : 6; + } else if (deltaY2 !== 0) { + return deltaY2 > 0 ? 8 : 2; + } + + return 0; +}; + +Game_Character.prototype.searchLimit = function() { + return 12; +}; + +//----------------------------------------------------------------------------- +// Game_Player +// +// The game object class for the player. It contains event starting +// determinants and map scrolling functions. + +function Game_Player() { + this.initialize(...arguments); +} + +Game_Player.prototype = Object.create(Game_Character.prototype); +Game_Player.prototype.constructor = Game_Player; + +Game_Player.prototype.initialize = function() { + Game_Character.prototype.initialize.call(this); + this.setTransparent($dataSystem.optTransparent); +}; + +Game_Player.prototype.initMembers = function() { + Game_Character.prototype.initMembers.call(this); + this._vehicleType = "walk"; + this._vehicleGettingOn = false; + this._vehicleGettingOff = false; + this._dashing = false; + this._needsMapReload = false; + this._transferring = false; + this._newMapId = 0; + this._newX = 0; + this._newY = 0; + this._newDirection = 0; + this._fadeType = 0; + this._followers = new Game_Followers(); + this._encounterCount = 0; +}; + +Game_Player.prototype.clearTransferInfo = function() { + this._transferring = false; + this._newMapId = 0; + this._newX = 0; + this._newY = 0; + this._newDirection = 0; +}; + +Game_Player.prototype.followers = function() { + return this._followers; +}; + +Game_Player.prototype.refresh = function() { + const actor = $gameParty.leader(); + const characterName = actor ? actor.characterName() : ""; + const characterIndex = actor ? actor.characterIndex() : 0; + this.setImage(characterName, characterIndex); + this._followers.refresh(); +}; + +Game_Player.prototype.isStopping = function() { + if (this._vehicleGettingOn || this._vehicleGettingOff) { + return false; + } + return Game_Character.prototype.isStopping.call(this); +}; + +Game_Player.prototype.reserveTransfer = function(mapId, x, y, d, fadeType) { + this._transferring = true; + this._newMapId = mapId; + this._newX = x; + this._newY = y; + this._newDirection = d; + this._fadeType = fadeType; +}; + +Game_Player.prototype.setupForNewGame = function() { + const mapId = $dataSystem.startMapId; + const x = $dataSystem.startX; + const y = $dataSystem.startY; + this.reserveTransfer(mapId, x, y, 2, 0); +}; + +Game_Player.prototype.requestMapReload = function() { + this._needsMapReload = true; +}; + +Game_Player.prototype.isTransferring = function() { + return this._transferring; +}; + +Game_Player.prototype.newMapId = function() { + return this._newMapId; +}; + +Game_Player.prototype.fadeType = function() { + return this._fadeType; +}; + +Game_Player.prototype.performTransfer = function() { + if (this.isTransferring()) { + this.setDirection(this._newDirection); + if (this._newMapId !== $gameMap.mapId() || this._needsMapReload) { + $gameMap.setup(this._newMapId); + this._needsMapReload = false; + } + this.locate(this._newX, this._newY); + this.refresh(); + this.clearTransferInfo(); + } +}; + +Game_Player.prototype.isMapPassable = function(x, y, d) { + const vehicle = this.vehicle(); + if (vehicle) { + return vehicle.isMapPassable(x, y, d); + } else { + return Game_Character.prototype.isMapPassable.call(this, x, y, d); + } +}; + +Game_Player.prototype.vehicle = function() { + return $gameMap.vehicle(this._vehicleType); +}; + +Game_Player.prototype.isInBoat = function() { + return this._vehicleType === "boat"; +}; + +Game_Player.prototype.isInShip = function() { + return this._vehicleType === "ship"; +}; + +Game_Player.prototype.isInAirship = function() { + return this._vehicleType === "airship"; +}; + +Game_Player.prototype.isInVehicle = function() { + return this.isInBoat() || this.isInShip() || this.isInAirship(); +}; + +Game_Player.prototype.isNormal = function() { + return this._vehicleType === "walk" && !this.isMoveRouteForcing(); +}; + +Game_Player.prototype.isDashing = function() { + return this._dashing; +}; + +Game_Player.prototype.isDebugThrough = function() { + return Input.isPressed("control") && $gameTemp.isPlaytest(); +}; + +Game_Player.prototype.isCollided = function(x, y) { + if (this.isThrough()) { + return false; + } else { + return this.pos(x, y) || this._followers.isSomeoneCollided(x, y); + } +}; + +Game_Player.prototype.centerX = function() { + return ($gameMap.screenTileX() - 1) / 2; +}; + +Game_Player.prototype.centerY = function() { + return ($gameMap.screenTileY() - 1) / 2; +}; + +Game_Player.prototype.center = function(x, y) { + return $gameMap.setDisplayPos(x - this.centerX(), y - this.centerY()); +}; + +Game_Player.prototype.locate = function(x, y) { + Game_Character.prototype.locate.call(this, x, y); + this.center(x, y); + this.makeEncounterCount(); + if (this.isInVehicle()) { + this.vehicle().refresh(); + } + this._followers.synchronize(x, y, this.direction()); +}; + +Game_Player.prototype.increaseSteps = function() { + Game_Character.prototype.increaseSteps.call(this); + if (this.isNormal()) { + $gameParty.increaseSteps(); + } +}; + +Game_Player.prototype.makeEncounterCount = function() { + const n = $gameMap.encounterStep(); + this._encounterCount = Math.randomInt(n) + Math.randomInt(n) + 1; +}; + +Game_Player.prototype.makeEncounterTroopId = function() { + const encounterList = []; + let weightSum = 0; + for (const encounter of $gameMap.encounterList()) { + if (this.meetsEncounterConditions(encounter)) { + encounterList.push(encounter); + weightSum += encounter.weight; + } + } + if (weightSum > 0) { + let value = Math.randomInt(weightSum); + for (const encounter of encounterList) { + value -= encounter.weight; + if (value < 0) { + return encounter.troopId; + } + } + } + return 0; +}; + +Game_Player.prototype.meetsEncounterConditions = function(encounter) { + return ( + encounter.regionSet.length === 0 || + encounter.regionSet.includes(this.regionId()) + ); +}; + +Game_Player.prototype.executeEncounter = function() { + if (!$gameMap.isEventRunning() && this._encounterCount <= 0) { + this.makeEncounterCount(); + const troopId = this.makeEncounterTroopId(); + if ($dataTroops[troopId]) { + BattleManager.setup(troopId, true, false); + BattleManager.onEncounter(); + return true; + } else { + return false; + } + } else { + return false; + } +}; + +Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) { + if (!$gameMap.isEventRunning()) { + for (const event of $gameMap.eventsXy(x, y)) { + if ( + event.isTriggerIn(triggers) && + event.isNormalPriority() === normal + ) { + event.start(); + } + } + } +}; + +Game_Player.prototype.moveByInput = function() { + if (!this.isMoving() && this.canMove()) { + let direction = this.getInputDirection(); + if (direction > 0) { + $gameTemp.clearDestination(); + } else if ($gameTemp.isDestinationValid()) { + const x = $gameTemp.destinationX(); + const y = $gameTemp.destinationY(); + direction = this.findDirectionTo(x, y); + } + if (direction > 0) { + this.executeMove(direction); + } + } +}; + +Game_Player.prototype.canMove = function() { + if ($gameMap.isEventRunning() || $gameMessage.isBusy()) { + return false; + } + if (this.isMoveRouteForcing() || this.areFollowersGathering()) { + return false; + } + if (this._vehicleGettingOn || this._vehicleGettingOff) { + return false; + } + if (this.isInVehicle() && !this.vehicle().canMove()) { + return false; + } + return true; +}; + +Game_Player.prototype.getInputDirection = function() { + return Input.dir4; +}; + +Game_Player.prototype.executeMove = function(direction) { + this.moveStraight(direction); +}; + +Game_Player.prototype.update = function(sceneActive) { + const lastScrolledX = this.scrolledX(); + const lastScrolledY = this.scrolledY(); + const wasMoving = this.isMoving(); + this.updateDashing(); + if (sceneActive) { + this.moveByInput(); + } + Game_Character.prototype.update.call(this); + this.updateScroll(lastScrolledX, lastScrolledY); + this.updateVehicle(); + if (!this.isMoving()) { + this.updateNonmoving(wasMoving, sceneActive); + } + this._followers.update(); +}; + +Game_Player.prototype.updateDashing = function() { + if (this.isMoving()) { + return; + } + if (this.canMove() && !this.isInVehicle() && !$gameMap.isDashDisabled()) { + this._dashing = + this.isDashButtonPressed() || $gameTemp.isDestinationValid(); + } else { + this._dashing = false; + } +}; + +Game_Player.prototype.isDashButtonPressed = function() { + const shift = Input.isPressed("shift"); + if (ConfigManager.alwaysDash) { + return !shift; + } else { + return shift; + } +}; + +Game_Player.prototype.updateScroll = function(lastScrolledX, lastScrolledY) { + const x1 = lastScrolledX; + const y1 = lastScrolledY; + const x2 = this.scrolledX(); + const y2 = this.scrolledY(); + if (y2 > y1 && y2 > this.centerY()) { + $gameMap.scrollDown(y2 - y1); + } + if (x2 < x1 && x2 < this.centerX()) { + $gameMap.scrollLeft(x1 - x2); + } + if (x2 > x1 && x2 > this.centerX()) { + $gameMap.scrollRight(x2 - x1); + } + if (y2 < y1 && y2 < this.centerY()) { + $gameMap.scrollUp(y1 - y2); + } +}; + +Game_Player.prototype.updateVehicle = function() { + if (this.isInVehicle() && !this.areFollowersGathering()) { + if (this._vehicleGettingOn) { + this.updateVehicleGetOn(); + } else if (this._vehicleGettingOff) { + this.updateVehicleGetOff(); + } else { + this.vehicle().syncWithPlayer(); + } + } +}; + +Game_Player.prototype.updateVehicleGetOn = function() { + if (!this.areFollowersGathering() && !this.isMoving()) { + this.setDirection(this.vehicle().direction()); + this.setMoveSpeed(this.vehicle().moveSpeed()); + this._vehicleGettingOn = false; + this.setTransparent(true); + if (this.isInAirship()) { + this.setThrough(true); + } + this.vehicle().getOn(); + } +}; + +Game_Player.prototype.updateVehicleGetOff = function() { + if (!this.areFollowersGathering() && this.vehicle().isLowest()) { + this._vehicleGettingOff = false; + this._vehicleType = "walk"; + this.setTransparent(false); + } +}; + +Game_Player.prototype.updateNonmoving = function(wasMoving, sceneActive) { + if (!$gameMap.isEventRunning()) { + if (wasMoving) { + $gameParty.onPlayerWalk(); + this.checkEventTriggerHere([1, 2]); + if ($gameMap.setupStartingEvent()) { + return; + } + } + if (sceneActive && this.triggerAction()) { + return; + } + if (wasMoving) { + this.updateEncounterCount(); + } else { + $gameTemp.clearDestination(); + } + } +}; + +Game_Player.prototype.triggerAction = function() { + if (this.canMove()) { + if (this.triggerButtonAction()) { + return true; + } + if (this.triggerTouchAction()) { + return true; + } + } + return false; +}; + +Game_Player.prototype.triggerButtonAction = function() { + if (Input.isTriggered("ok")) { + if (this.getOnOffVehicle()) { + return true; + } + this.checkEventTriggerHere([0]); + if ($gameMap.setupStartingEvent()) { + return true; + } + this.checkEventTriggerThere([0, 1, 2]); + if ($gameMap.setupStartingEvent()) { + return true; + } + } + return false; +}; + +Game_Player.prototype.triggerTouchAction = function() { + if ($gameTemp.isDestinationValid()) { + const direction = this.direction(); + const x1 = this.x; + const y1 = this.y; + const x2 = $gameMap.roundXWithDirection(x1, direction); + const y2 = $gameMap.roundYWithDirection(y1, direction); + const x3 = $gameMap.roundXWithDirection(x2, direction); + const y3 = $gameMap.roundYWithDirection(y2, direction); + const destX = $gameTemp.destinationX(); + const destY = $gameTemp.destinationY(); + if (destX === x1 && destY === y1) { + return this.triggerTouchActionD1(x1, y1); + } else if (destX === x2 && destY === y2) { + return this.triggerTouchActionD2(x2, y2); + } else if (destX === x3 && destY === y3) { + return this.triggerTouchActionD3(x2, y2); + } + } + return false; +}; + +Game_Player.prototype.triggerTouchActionD1 = function(x1, y1) { + if ($gameMap.airship().pos(x1, y1)) { + if (TouchInput.isTriggered() && this.getOnOffVehicle()) { + return true; + } + } + this.checkEventTriggerHere([0]); + return $gameMap.setupStartingEvent(); +}; + +Game_Player.prototype.triggerTouchActionD2 = function(x2, y2) { + if ($gameMap.boat().pos(x2, y2) || $gameMap.ship().pos(x2, y2)) { + if (TouchInput.isTriggered() && this.getOnVehicle()) { + return true; + } + } + if (this.isInBoat() || this.isInShip()) { + if (TouchInput.isTriggered() && this.getOffVehicle()) { + return true; + } + } + this.checkEventTriggerThere([0, 1, 2]); + return $gameMap.setupStartingEvent(); +}; + +Game_Player.prototype.triggerTouchActionD3 = function(x2, y2) { + if ($gameMap.isCounter(x2, y2)) { + this.checkEventTriggerThere([0, 1, 2]); + } + return $gameMap.setupStartingEvent(); +}; + +Game_Player.prototype.updateEncounterCount = function() { + if (this.canEncounter()) { + this._encounterCount -= this.encounterProgressValue(); + } +}; + +Game_Player.prototype.canEncounter = function() { + return ( + !$gameParty.hasEncounterNone() && + $gameSystem.isEncounterEnabled() && + !this.isInAirship() && + !this.isMoveRouteForcing() && + !this.isDebugThrough() + ); +}; + +Game_Player.prototype.encounterProgressValue = function() { + let value = $gameMap.isBush(this.x, this.y) ? 2 : 1; + if ($gameParty.hasEncounterHalf()) { + value *= 0.5; + } + if (this.isInShip()) { + value *= 0.5; + } + return value; +}; + +Game_Player.prototype.checkEventTriggerHere = function(triggers) { + if (this.canStartLocalEvents()) { + this.startMapEvent(this.x, this.y, triggers, false); + } +}; + +Game_Player.prototype.checkEventTriggerThere = function(triggers) { + if (this.canStartLocalEvents()) { + const direction = this.direction(); + const x1 = this.x; + const y1 = this.y; + const x2 = $gameMap.roundXWithDirection(x1, direction); + const y2 = $gameMap.roundYWithDirection(y1, direction); + this.startMapEvent(x2, y2, triggers, true); + if (!$gameMap.isAnyEventStarting() && $gameMap.isCounter(x2, y2)) { + const x3 = $gameMap.roundXWithDirection(x2, direction); + const y3 = $gameMap.roundYWithDirection(y2, direction); + this.startMapEvent(x3, y3, triggers, true); + } + } +}; + +Game_Player.prototype.checkEventTriggerTouch = function(x, y) { + if (this.canStartLocalEvents()) { + this.startMapEvent(x, y, [1, 2], true); + } +}; + +Game_Player.prototype.canStartLocalEvents = function() { + return !this.isInAirship(); +}; + +Game_Player.prototype.getOnOffVehicle = function() { + if (this.isInVehicle()) { + return this.getOffVehicle(); + } else { + return this.getOnVehicle(); + } +}; + +Game_Player.prototype.getOnVehicle = function() { + const direction = this.direction(); + const x1 = this.x; + const y1 = this.y; + const x2 = $gameMap.roundXWithDirection(x1, direction); + const y2 = $gameMap.roundYWithDirection(y1, direction); + if ($gameMap.airship().pos(x1, y1)) { + this._vehicleType = "airship"; + } else if ($gameMap.ship().pos(x2, y2)) { + this._vehicleType = "ship"; + } else if ($gameMap.boat().pos(x2, y2)) { + this._vehicleType = "boat"; + } + if (this.isInVehicle()) { + this._vehicleGettingOn = true; + if (!this.isInAirship()) { + this.forceMoveForward(); + } + this.gatherFollowers(); + } + return this._vehicleGettingOn; +}; + +Game_Player.prototype.getOffVehicle = function() { + if (this.vehicle().isLandOk(this.x, this.y, this.direction())) { + if (this.isInAirship()) { + this.setDirection(2); + } + this._followers.synchronize(this.x, this.y, this.direction()); + this.vehicle().getOff(); + if (!this.isInAirship()) { + this.forceMoveForward(); + this.setTransparent(false); + } + this._vehicleGettingOff = true; + this.setMoveSpeed(4); + this.setThrough(false); + this.makeEncounterCount(); + this.gatherFollowers(); + } + return this._vehicleGettingOff; +}; + +Game_Player.prototype.forceMoveForward = function() { + this.setThrough(true); + this.moveForward(); + this.setThrough(false); +}; + +Game_Player.prototype.isOnDamageFloor = function() { + return $gameMap.isDamageFloor(this.x, this.y) && !this.isInAirship(); +}; + +Game_Player.prototype.moveStraight = function(d) { + if (this.canPass(this.x, this.y, d)) { + this._followers.updateMove(); + } + Game_Character.prototype.moveStraight.call(this, d); +}; + +Game_Player.prototype.moveDiagonally = function(horz, vert) { + if (this.canPassDiagonally(this.x, this.y, horz, vert)) { + this._followers.updateMove(); + } + Game_Character.prototype.moveDiagonally.call(this, horz, vert); +}; + +Game_Player.prototype.jump = function(xPlus, yPlus) { + Game_Character.prototype.jump.call(this, xPlus, yPlus); + this._followers.jumpAll(); +}; + +Game_Player.prototype.showFollowers = function() { + this._followers.show(); +}; + +Game_Player.prototype.hideFollowers = function() { + this._followers.hide(); +}; + +Game_Player.prototype.gatherFollowers = function() { + this._followers.gather(); +}; + +Game_Player.prototype.areFollowersGathering = function() { + return this._followers.areGathering(); +}; + +Game_Player.prototype.areFollowersGathered = function() { + return this._followers.areGathered(); +}; + +//----------------------------------------------------------------------------- +// Game_Follower +// +// The game object class for a follower. A follower is an allied character, +// other than the front character, displayed in the party. + +function Game_Follower() { + this.initialize(...arguments); +} + +Game_Follower.prototype = Object.create(Game_Character.prototype); +Game_Follower.prototype.constructor = Game_Follower; + +Game_Follower.prototype.initialize = function(memberIndex) { + Game_Character.prototype.initialize.call(this); + this._memberIndex = memberIndex; + this.setTransparent($dataSystem.optTransparent); + this.setThrough(true); +}; + +Game_Follower.prototype.refresh = function() { + const characterName = this.isVisible() ? this.actor().characterName() : ""; + const characterIndex = this.isVisible() ? this.actor().characterIndex() : 0; + this.setImage(characterName, characterIndex); +}; + +Game_Follower.prototype.actor = function() { + return $gameParty.battleMembers()[this._memberIndex]; +}; + +Game_Follower.prototype.isVisible = function() { + return this.actor() && $gamePlayer.followers().isVisible(); +}; + +Game_Follower.prototype.isGathered = function() { + return !this.isMoving() && this.pos($gamePlayer.x, $gamePlayer.y); +}; + +Game_Follower.prototype.update = function() { + Game_Character.prototype.update.call(this); + this.setMoveSpeed($gamePlayer.realMoveSpeed()); + this.setOpacity($gamePlayer.opacity()); + this.setBlendMode($gamePlayer.blendMode()); + this.setWalkAnime($gamePlayer.hasWalkAnime()); + this.setStepAnime($gamePlayer.hasStepAnime()); + this.setDirectionFix($gamePlayer.isDirectionFixed()); + this.setTransparent($gamePlayer.isTransparent()); +}; + +Game_Follower.prototype.chaseCharacter = function(character) { + const sx = this.deltaXFrom(character.x); + const sy = this.deltaYFrom(character.y); + if (sx !== 0 && sy !== 0) { + this.moveDiagonally(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2); + } else if (sx !== 0) { + this.moveStraight(sx > 0 ? 4 : 6); + } else if (sy !== 0) { + this.moveStraight(sy > 0 ? 8 : 2); + } + this.setMoveSpeed($gamePlayer.realMoveSpeed()); +}; + +//----------------------------------------------------------------------------- +// Game_Followers +// +// The wrapper class for a follower array. + +function Game_Followers() { + this.initialize(...arguments); +} + +Game_Followers.prototype.initialize = function() { + this._visible = $dataSystem.optFollowers; + this._gathering = false; + this._data = []; + this.setup(); +}; + +Game_Followers.prototype.setup = function() { + this._data = []; + for (let i = 1; i < $gameParty.maxBattleMembers(); i++) { + this._data.push(new Game_Follower(i)); + } +}; + +Game_Followers.prototype.isVisible = function() { + return this._visible; +}; + +Game_Followers.prototype.show = function() { + this._visible = true; +}; + +Game_Followers.prototype.hide = function() { + this._visible = false; +}; + +Game_Followers.prototype.data = function() { + return this._data.clone(); +}; + +Game_Followers.prototype.reverseData = function() { + return this._data.clone().reverse(); +}; + +Game_Followers.prototype.follower = function(index) { + return this._data[index]; +}; + +Game_Followers.prototype.refresh = function() { + for (const follower of this._data) { + follower.refresh(); + } +}; + +Game_Followers.prototype.update = function() { + if (this.areGathering()) { + if (!this.areMoving()) { + this.updateMove(); + } + if (this.areGathered()) { + this._gathering = false; + } + } + for (const follower of this._data) { + follower.update(); + } +}; + +Game_Followers.prototype.updateMove = function() { + for (let i = this._data.length - 1; i >= 0; i--) { + const precedingCharacter = i > 0 ? this._data[i - 1] : $gamePlayer; + this._data[i].chaseCharacter(precedingCharacter); + } +}; + +Game_Followers.prototype.jumpAll = function() { + if ($gamePlayer.isJumping()) { + for (const follower of this._data) { + const sx = $gamePlayer.deltaXFrom(follower.x); + const sy = $gamePlayer.deltaYFrom(follower.y); + follower.jump(sx, sy); + } + } +}; + +Game_Followers.prototype.synchronize = function(x, y, d) { + for (const follower of this._data) { + follower.locate(x, y); + follower.setDirection(d); + } +}; + +Game_Followers.prototype.gather = function() { + this._gathering = true; +}; + +Game_Followers.prototype.areGathering = function() { + return this._gathering; +}; + +Game_Followers.prototype.visibleFollowers = function() { + return this._data.filter(follower => follower.isVisible()); +}; + +Game_Followers.prototype.areMoving = function() { + return this.visibleFollowers().some(follower => follower.isMoving()); +}; + +Game_Followers.prototype.areGathered = function() { + return this.visibleFollowers().every(follower => follower.isGathered()); +}; + +Game_Followers.prototype.isSomeoneCollided = function(x, y) { + return this.visibleFollowers().some(follower => follower.pos(x, y)); +}; + +//----------------------------------------------------------------------------- +// Game_Vehicle +// +// The game object class for a vehicle. + +function Game_Vehicle() { + this.initialize(...arguments); +} + +Game_Vehicle.prototype = Object.create(Game_Character.prototype); +Game_Vehicle.prototype.constructor = Game_Vehicle; + +Game_Vehicle.prototype.initialize = function(type) { + Game_Character.prototype.initialize.call(this); + this._type = type; + this.resetDirection(); + this.initMoveSpeed(); + this.loadSystemSettings(); +}; + +Game_Vehicle.prototype.initMembers = function() { + Game_Character.prototype.initMembers.call(this); + this._type = ""; + this._mapId = 0; + this._altitude = 0; + this._driving = false; + this._bgm = null; +}; + +Game_Vehicle.prototype.isBoat = function() { + return this._type === "boat"; +}; + +Game_Vehicle.prototype.isShip = function() { + return this._type === "ship"; +}; + +Game_Vehicle.prototype.isAirship = function() { + return this._type === "airship"; +}; + +Game_Vehicle.prototype.resetDirection = function() { + this.setDirection(4); +}; + +Game_Vehicle.prototype.initMoveSpeed = function() { + if (this.isBoat()) { + this.setMoveSpeed(4); + } else if (this.isShip()) { + this.setMoveSpeed(5); + } else if (this.isAirship()) { + this.setMoveSpeed(6); + } +}; + +Game_Vehicle.prototype.vehicle = function() { + if (this.isBoat()) { + return $dataSystem.boat; + } else if (this.isShip()) { + return $dataSystem.ship; + } else if (this.isAirship()) { + return $dataSystem.airship; + } else { + return null; + } +}; + +Game_Vehicle.prototype.loadSystemSettings = function() { + const vehicle = this.vehicle(); + this._mapId = vehicle.startMapId; + this.setPosition(vehicle.startX, vehicle.startY); + this.setImage(vehicle.characterName, vehicle.characterIndex); +}; + +Game_Vehicle.prototype.refresh = function() { + if (this._driving) { + this._mapId = $gameMap.mapId(); + this.syncWithPlayer(); + } else if (this._mapId === $gameMap.mapId()) { + this.locate(this.x, this.y); + } + if (this.isAirship()) { + this.setPriorityType(this._driving ? 2 : 0); + } else { + this.setPriorityType(1); + } + this.setWalkAnime(this._driving); + this.setStepAnime(this._driving); + this.setTransparent(this._mapId !== $gameMap.mapId()); +}; + +Game_Vehicle.prototype.setLocation = function(mapId, x, y) { + this._mapId = mapId; + this.setPosition(x, y); + this.refresh(); +}; + +Game_Vehicle.prototype.pos = function(x, y) { + if (this._mapId === $gameMap.mapId()) { + return Game_Character.prototype.pos.call(this, x, y); + } else { + return false; + } +}; + +Game_Vehicle.prototype.isMapPassable = function(x, y, d) { + const x2 = $gameMap.roundXWithDirection(x, d); + const y2 = $gameMap.roundYWithDirection(y, d); + if (this.isBoat()) { + return $gameMap.isBoatPassable(x2, y2); + } else if (this.isShip()) { + return $gameMap.isShipPassable(x2, y2); + } else if (this.isAirship()) { + return true; + } else { + return false; + } +}; + +Game_Vehicle.prototype.getOn = function() { + this._driving = true; + this.setWalkAnime(true); + this.setStepAnime(true); + $gameSystem.saveWalkingBgm(); + this.playBgm(); +}; + +Game_Vehicle.prototype.getOff = function() { + this._driving = false; + this.setWalkAnime(false); + this.setStepAnime(false); + this.resetDirection(); + $gameSystem.replayWalkingBgm(); +}; + +Game_Vehicle.prototype.setBgm = function(bgm) { + this._bgm = bgm; +}; + +Game_Vehicle.prototype.playBgm = function() { + AudioManager.playBgm(this._bgm || this.vehicle().bgm); +}; + +Game_Vehicle.prototype.syncWithPlayer = function() { + this.copyPosition($gamePlayer); + this.refreshBushDepth(); +}; + +Game_Vehicle.prototype.screenY = function() { + return Game_Character.prototype.screenY.call(this) - this._altitude; +}; + +Game_Vehicle.prototype.shadowX = function() { + return this.screenX(); +}; + +Game_Vehicle.prototype.shadowY = function() { + return this.screenY() + this._altitude; +}; + +Game_Vehicle.prototype.shadowOpacity = function() { + return (255 * this._altitude) / this.maxAltitude(); +}; + +Game_Vehicle.prototype.canMove = function() { + if (this.isAirship()) { + return this.isHighest(); + } else { + return true; + } +}; + +Game_Vehicle.prototype.update = function() { + Game_Character.prototype.update.call(this); + if (this.isAirship()) { + this.updateAirship(); + } +}; + +Game_Vehicle.prototype.updateAirship = function() { + this.updateAirshipAltitude(); + this.setStepAnime(this.isHighest()); + this.setPriorityType(this.isLowest() ? 0 : 2); +}; + +Game_Vehicle.prototype.updateAirshipAltitude = function() { + if (this._driving && !this.isHighest()) { + this._altitude++; + } + if (!this._driving && !this.isLowest()) { + this._altitude--; + } +}; + +Game_Vehicle.prototype.maxAltitude = function() { + return 48; +}; + +Game_Vehicle.prototype.isLowest = function() { + return this._altitude <= 0; +}; + +Game_Vehicle.prototype.isHighest = function() { + return this._altitude >= this.maxAltitude(); +}; + +Game_Vehicle.prototype.isTakeoffOk = function() { + return $gamePlayer.areFollowersGathered(); +}; + +Game_Vehicle.prototype.isLandOk = function(x, y, d) { + if (this.isAirship()) { + if (!$gameMap.isAirshipLandOk(x, y)) { + return false; + } + if ($gameMap.eventsXy(x, y).length > 0) { + return false; + } + } else { + const x2 = $gameMap.roundXWithDirection(x, d); + const y2 = $gameMap.roundYWithDirection(y, d); + if (!$gameMap.isValid(x2, y2)) { + return false; + } + if (!$gameMap.isPassable(x2, y2, this.reverseDir(d))) { + return false; + } + if (this.isCollidedWithCharacters(x2, y2)) { + return false; + } + } + return true; +}; + +//----------------------------------------------------------------------------- +// Game_Event +// +// The game object class for an event. It contains functionality for event page +// switching and running parallel process events. + +function Game_Event() { + this.initialize(...arguments); +} + +Game_Event.prototype = Object.create(Game_Character.prototype); +Game_Event.prototype.constructor = Game_Event; + +Game_Event.prototype.initialize = function(mapId, eventId) { + Game_Character.prototype.initialize.call(this); + this._mapId = mapId; + this._eventId = eventId; + this.locate(this.event().x, this.event().y); + this.refresh(); +}; + +Game_Event.prototype.initMembers = function() { + Game_Character.prototype.initMembers.call(this); + this._moveType = 0; + this._trigger = 0; + this._starting = false; + this._erased = false; + this._pageIndex = -2; + this._originalPattern = 1; + this._originalDirection = 2; + this._prelockDirection = 0; + this._locked = false; +}; + +Game_Event.prototype.eventId = function() { + return this._eventId; +}; + +Game_Event.prototype.event = function() { + return $dataMap.events[this._eventId]; +}; + +Game_Event.prototype.page = function() { + return this.event().pages[this._pageIndex]; +}; + +Game_Event.prototype.list = function() { + return this.page().list; +}; + +Game_Event.prototype.isCollidedWithCharacters = function(x, y) { + return ( + Game_Character.prototype.isCollidedWithCharacters.call(this, x, y) || + this.isCollidedWithPlayerCharacters(x, y) + ); +}; + +Game_Event.prototype.isCollidedWithEvents = function(x, y) { + const events = $gameMap.eventsXyNt(x, y); + return events.length > 0; +}; + +Game_Event.prototype.isCollidedWithPlayerCharacters = function(x, y) { + return this.isNormalPriority() && $gamePlayer.isCollided(x, y); +}; + +Game_Event.prototype.lock = function() { + if (!this._locked) { + this._prelockDirection = this.direction(); + this.turnTowardPlayer(); + this._locked = true; + } +}; + +Game_Event.prototype.unlock = function() { + if (this._locked) { + this._locked = false; + this.setDirection(this._prelockDirection); + } +}; + +Game_Event.prototype.updateStop = function() { + if (this._locked) { + this.resetStopCount(); + } + Game_Character.prototype.updateStop.call(this); + if (!this.isMoveRouteForcing()) { + this.updateSelfMovement(); + } +}; + +Game_Event.prototype.updateSelfMovement = function() { + if ( + !this._locked && + this.isNearTheScreen() && + this.checkStop(this.stopCountThreshold()) + ) { + switch (this._moveType) { + case 1: + this.moveTypeRandom(); + break; + case 2: + this.moveTypeTowardPlayer(); + break; + case 3: + this.moveTypeCustom(); + break; + } + } +}; + +Game_Event.prototype.stopCountThreshold = function() { + return 30 * (5 - this.moveFrequency()); +}; + +Game_Event.prototype.moveTypeRandom = function() { + switch (Math.randomInt(6)) { + case 0: + case 1: + this.moveRandom(); + break; + case 2: + case 3: + case 4: + this.moveForward(); + break; + case 5: + this.resetStopCount(); + break; + } +}; + +Game_Event.prototype.moveTypeTowardPlayer = function() { + if (this.isNearThePlayer()) { + switch (Math.randomInt(6)) { + case 0: + case 1: + case 2: + case 3: + this.moveTowardPlayer(); + break; + case 4: + this.moveRandom(); + break; + case 5: + this.moveForward(); + break; + } + } else { + this.moveRandom(); + } +}; + +Game_Event.prototype.isNearThePlayer = function() { + const sx = Math.abs(this.deltaXFrom($gamePlayer.x)); + const sy = Math.abs(this.deltaYFrom($gamePlayer.y)); + return sx + sy < 20; +}; + +Game_Event.prototype.moveTypeCustom = function() { + this.updateRoutineMove(); +}; + +Game_Event.prototype.isStarting = function() { + return this._starting; +}; + +Game_Event.prototype.clearStartingFlag = function() { + this._starting = false; +}; + +Game_Event.prototype.isTriggerIn = function(triggers) { + return triggers.includes(this._trigger); +}; + +Game_Event.prototype.start = function() { + const list = this.list(); + if (list && list.length > 1) { + this._starting = true; + if (this.isTriggerIn([0, 1, 2])) { + this.lock(); + } + } +}; + +Game_Event.prototype.erase = function() { + this._erased = true; + this.refresh(); +}; + +Game_Event.prototype.refresh = function() { + const newPageIndex = this._erased ? -1 : this.findProperPageIndex(); + if (this._pageIndex !== newPageIndex) { + this._pageIndex = newPageIndex; + this.setupPage(); + } +}; + +Game_Event.prototype.findProperPageIndex = function() { + const pages = this.event().pages; + for (let i = pages.length - 1; i >= 0; i--) { + const page = pages[i]; + if (this.meetsConditions(page)) { + return i; + } + } + return -1; +}; + +Game_Event.prototype.meetsConditions = function(page) { + const c = page.conditions; + if (c.switch1Valid) { + if (!$gameSwitches.value(c.switch1Id)) { + return false; + } + } + if (c.switch2Valid) { + if (!$gameSwitches.value(c.switch2Id)) { + return false; + } + } + if (c.variableValid) { + if ($gameVariables.value(c.variableId) < c.variableValue) { + return false; + } + } + if (c.selfSwitchValid) { + const key = [this._mapId, this._eventId, c.selfSwitchCh]; + if ($gameSelfSwitches.value(key) !== true) { + return false; + } + } + if (c.itemValid) { + const item = $dataItems[c.itemId]; + if (!$gameParty.hasItem(item)) { + return false; + } + } + if (c.actorValid) { + const actor = $gameActors.actor(c.actorId); + if (!$gameParty.members().includes(actor)) { + return false; + } + } + return true; +}; + +Game_Event.prototype.setupPage = function() { + if (this._pageIndex >= 0) { + this.setupPageSettings(); + } else { + this.clearPageSettings(); + } + this.refreshBushDepth(); + this.clearStartingFlag(); + this.checkEventTriggerAuto(); +}; + +Game_Event.prototype.clearPageSettings = function() { + this.setImage("", 0); + this._moveType = 0; + this._trigger = null; + this._interpreter = null; + this.setThrough(true); +}; + +Game_Event.prototype.setupPageSettings = function() { + const page = this.page(); + const image = page.image; + if (image.tileId > 0) { + this.setTileImage(image.tileId); + } else { + this.setImage(image.characterName, image.characterIndex); + } + if (this._originalDirection !== image.direction) { + this._originalDirection = image.direction; + this._prelockDirection = 0; + this.setDirectionFix(false); + this.setDirection(image.direction); + } + if (this._originalPattern !== image.pattern) { + this._originalPattern = image.pattern; + this.setPattern(image.pattern); + } + this.setMoveSpeed(page.moveSpeed); + this.setMoveFrequency(page.moveFrequency); + this.setPriorityType(page.priorityType); + this.setWalkAnime(page.walkAnime); + this.setStepAnime(page.stepAnime); + this.setDirectionFix(page.directionFix); + this.setThrough(page.through); + this.setMoveRoute(page.moveRoute); + this._moveType = page.moveType; + this._trigger = page.trigger; + if (this._trigger === 4) { + this._interpreter = new Game_Interpreter(); + } else { + this._interpreter = null; + } +}; + +Game_Event.prototype.isOriginalPattern = function() { + return this.pattern() === this._originalPattern; +}; + +Game_Event.prototype.resetPattern = function() { + this.setPattern(this._originalPattern); +}; + +Game_Event.prototype.checkEventTriggerTouch = function(x, y) { + if (!$gameMap.isEventRunning()) { + if (this._trigger === 2 && $gamePlayer.pos(x, y)) { + if (!this.isJumping() && this.isNormalPriority()) { + this.start(); + } + } + } +}; + +Game_Event.prototype.checkEventTriggerAuto = function() { + if (this._trigger === 3) { + this.start(); + } +}; + +Game_Event.prototype.update = function() { + Game_Character.prototype.update.call(this); + this.checkEventTriggerAuto(); + this.updateParallel(); +}; + +Game_Event.prototype.updateParallel = function() { + if (this._interpreter) { + if (!this._interpreter.isRunning()) { + this._interpreter.setup(this.list(), this._eventId); + } + this._interpreter.update(); + } +}; + +Game_Event.prototype.locate = function(x, y) { + Game_Character.prototype.locate.call(this, x, y); + this._prelockDirection = 0; +}; + +Game_Event.prototype.forceMoveRoute = function(moveRoute) { + Game_Character.prototype.forceMoveRoute.call(this, moveRoute); + this._prelockDirection = 0; +}; + +//----------------------------------------------------------------------------- +// Game_Interpreter +// +// The interpreter for running event commands. + +function Game_Interpreter() { + this.initialize(...arguments); +} + +Game_Interpreter.prototype.initialize = function(depth) { + this._depth = depth || 0; + this.checkOverflow(); + this.clear(); + this._branch = {}; + this._indent = 0; + this._frameCount = 0; + this._freezeChecker = 0; +}; + +Game_Interpreter.prototype.checkOverflow = function() { + if (this._depth >= 100) { + throw new Error("Common event calls exceeded the limit"); + } +}; + +Game_Interpreter.prototype.clear = function() { + this._mapId = 0; + this._eventId = 0; + this._list = null; + this._index = 0; + this._waitCount = 0; + this._waitMode = ""; + this._comments = ""; + this._characterId = 0; + this._childInterpreter = null; +}; + +Game_Interpreter.prototype.setup = function(list, eventId) { + this.clear(); + this._mapId = $gameMap.mapId(); + this._eventId = eventId || 0; + this._list = list; + this.loadImages(); +}; + +Game_Interpreter.prototype.loadImages = function() { + // [Note] The certain versions of MV had a more complicated preload scheme. + // However it is usually sufficient to preload face and picture images. + const list = this._list.slice(0, 200); + for (const command of list) { + switch (command.code) { + case 101: // Show Text + ImageManager.loadFace(command.parameters[0]); + break; + case 231: // Show Picture + ImageManager.loadPicture(command.parameters[1]); + break; + } + } +}; + +Game_Interpreter.prototype.eventId = function() { + return this._eventId; +}; + +Game_Interpreter.prototype.isOnCurrentMap = function() { + return this._mapId === $gameMap.mapId(); +}; + +Game_Interpreter.prototype.setupReservedCommonEvent = function() { + if ($gameTemp.isCommonEventReserved()) { + const commonEvent = $gameTemp.retrieveCommonEvent(); + if (commonEvent) { + this.setup(commonEvent.list); + return true; + } + } + return false; +}; + +Game_Interpreter.prototype.isRunning = function() { + return !!this._list; +}; + +Game_Interpreter.prototype.update = function() { + while (this.isRunning()) { + if (this.updateChild() || this.updateWait()) { + break; + } + if (SceneManager.isSceneChanging()) { + break; + } + if (!this.executeCommand()) { + break; + } + if (this.checkFreeze()) { + break; + } + } +}; + +Game_Interpreter.prototype.updateChild = function() { + if (this._childInterpreter) { + this._childInterpreter.update(); + if (this._childInterpreter.isRunning()) { + return true; + } else { + this._childInterpreter = null; + } + } + return false; +}; + +Game_Interpreter.prototype.updateWait = function() { + return this.updateWaitCount() || this.updateWaitMode(); +}; + +Game_Interpreter.prototype.updateWaitCount = function() { + if (this._waitCount > 0) { + this._waitCount--; + return true; + } + return false; +}; + +Game_Interpreter.prototype.updateWaitMode = function() { + let character = null; + let waiting = false; + switch (this._waitMode) { + case "message": + waiting = $gameMessage.isBusy(); + break; + case "transfer": + waiting = $gamePlayer.isTransferring(); + break; + case "scroll": + waiting = $gameMap.isScrolling(); + break; + case "route": + character = this.character(this._characterId); + waiting = character && character.isMoveRouteForcing(); + break; + case "animation": + character = this.character(this._characterId); + waiting = character && character.isAnimationPlaying(); + break; + case "balloon": + character = this.character(this._characterId); + waiting = character && character.isBalloonPlaying(); + break; + case "gather": + waiting = $gamePlayer.areFollowersGathering(); + break; + case "action": + waiting = BattleManager.isActionForced(); + break; + case "video": + waiting = Video.isPlaying(); + break; + case "image": + waiting = !ImageManager.isReady(); + break; + } + if (!waiting) { + this._waitMode = ""; + } + return waiting; +}; + +Game_Interpreter.prototype.setWaitMode = function(waitMode) { + this._waitMode = waitMode; +}; + +Game_Interpreter.prototype.wait = function(duration) { + this._waitCount = duration; +}; + +Game_Interpreter.prototype.fadeSpeed = function() { + return 24; +}; + +Game_Interpreter.prototype.executeCommand = function() { + const command = this.currentCommand(); + if (command) { + this._indent = command.indent; + const methodName = "command" + command.code; + if (typeof this[methodName] === "function") { + if (!this[methodName](command.parameters)) { + return false; + } + } + this._index++; + } else { + this.terminate(); + } + return true; +}; + +Game_Interpreter.prototype.checkFreeze = function() { + if (this._frameCount !== Graphics.frameCount) { + this._frameCount = Graphics.frameCount; + this._freezeChecker = 0; + } + if (this._freezeChecker++ >= 100000) { + return true; + } else { + return false; + } +}; + +Game_Interpreter.prototype.terminate = function() { + this._list = null; + this._comments = ""; +}; + +Game_Interpreter.prototype.skipBranch = function() { + while (this._list[this._index + 1].indent > this._indent) { + this._index++; + } +}; + +Game_Interpreter.prototype.currentCommand = function() { + return this._list[this._index]; +}; + +Game_Interpreter.prototype.nextEventCode = function() { + const command = this._list[this._index + 1]; + if (command) { + return command.code; + } else { + return 0; + } +}; + +Game_Interpreter.prototype.iterateActorId = function(param, callback) { + if (param === 0) { + $gameParty.members().forEach(callback); + } else { + const actor = $gameActors.actor(param); + if (actor) { + callback(actor); + } + } +}; + +Game_Interpreter.prototype.iterateActorEx = function(param1, param2, callback) { + if (param1 === 0) { + this.iterateActorId(param2, callback); + } else { + this.iterateActorId($gameVariables.value(param2), callback); + } +}; + +Game_Interpreter.prototype.iterateActorIndex = function(param, callback) { + if (param < 0) { + $gameParty.members().forEach(callback); + } else { + const actor = $gameParty.members()[param]; + if (actor) { + callback(actor); + } + } +}; + +Game_Interpreter.prototype.iterateEnemyIndex = function(param, callback) { + if (param < 0) { + $gameTroop.members().forEach(callback); + } else { + const enemy = $gameTroop.members()[param]; + if (enemy) { + callback(enemy); + } + } +}; + +Game_Interpreter.prototype.iterateBattler = function(param1, param2, callback) { + if ($gameParty.inBattle()) { + if (param1 === 0) { + this.iterateEnemyIndex(param2, callback); + } else { + this.iterateActorId(param2, callback); + } + } +}; + +Game_Interpreter.prototype.character = function(param) { + if ($gameParty.inBattle()) { + return null; + } else if (param < 0) { + return $gamePlayer; + } else if (this.isOnCurrentMap()) { + return $gameMap.event(param > 0 ? param : this._eventId); + } else { + return null; + } +}; + +// prettier-ignore +Game_Interpreter.prototype.operateValue = function( + operation, operandType, operand +) { + const value = operandType === 0 ? operand : $gameVariables.value(operand); + return operation === 0 ? value : -value; +}; + +Game_Interpreter.prototype.changeHp = function(target, value, allowDeath) { + if (target.isAlive()) { + if (!allowDeath && target.hp <= -value) { + value = 1 - target.hp; + } + target.gainHp(value); + if (target.isDead()) { + target.performCollapse(); + } + } +}; + +// Show Text +Game_Interpreter.prototype.command101 = function(params) { + if ($gameMessage.isBusy()) { + return false; + } + $gameMessage.setFaceImage(params[0], params[1]); + $gameMessage.setBackground(params[2]); + $gameMessage.setPositionType(params[3]); + $gameMessage.setSpeakerName(params[4]); + while (this.nextEventCode() === 401) { + // Text data + this._index++; + $gameMessage.add(this.currentCommand().parameters[0]); + } + switch (this.nextEventCode()) { + case 102: // Show Choices + this._index++; + this.setupChoices(this.currentCommand().parameters); + break; + case 103: // Input Number + this._index++; + this.setupNumInput(this.currentCommand().parameters); + break; + case 104: // Select Item + this._index++; + this.setupItemChoice(this.currentCommand().parameters); + break; + } + this.setWaitMode("message"); + return true; +}; + +// Show Choices +Game_Interpreter.prototype.command102 = function(params) { + if ($gameMessage.isBusy()) { + return false; + } + this.setupChoices(params); + this.setWaitMode("message"); + return true; +}; + +Game_Interpreter.prototype.setupChoices = function(params) { + const choices = params[0].clone(); + const cancelType = params[1] < choices.length ? params[1] : -2; + const defaultType = params.length > 2 ? params[2] : 0; + const positionType = params.length > 3 ? params[3] : 2; + const background = params.length > 4 ? params[4] : 0; + $gameMessage.setChoices(choices, defaultType, cancelType); + $gameMessage.setChoiceBackground(background); + $gameMessage.setChoicePositionType(positionType); + $gameMessage.setChoiceCallback(n => { + this._branch[this._indent] = n; + }); +}; + +// When [**] +Game_Interpreter.prototype.command402 = function(params) { + if (this._branch[this._indent] !== params[0]) { + this.skipBranch(); + } + return true; +}; + +// When Cancel +Game_Interpreter.prototype.command403 = function() { + if (this._branch[this._indent] >= 0) { + this.skipBranch(); + } + return true; +}; + +// Input Number +Game_Interpreter.prototype.command103 = function(params) { + if ($gameMessage.isBusy()) { + return false; + } + this.setupNumInput(params); + this.setWaitMode("message"); + return true; +}; + +Game_Interpreter.prototype.setupNumInput = function(params) { + $gameMessage.setNumberInput(params[0], params[1]); +}; + +// Select Item +Game_Interpreter.prototype.command104 = function(params) { + if ($gameMessage.isBusy()) { + return false; + } + this.setupItemChoice(params); + this.setWaitMode("message"); + return true; +}; + +Game_Interpreter.prototype.setupItemChoice = function(params) { + $gameMessage.setItemChoice(params[0], params[1] || 2); +}; + +// Show Scrolling Text +Game_Interpreter.prototype.command105 = function(params) { + if ($gameMessage.isBusy()) { + return false; + } + $gameMessage.setScroll(params[0], params[1]); + while (this.nextEventCode() === 405) { + this._index++; + $gameMessage.add(this.currentCommand().parameters[0]); + } + this.setWaitMode("message"); + return true; +}; + +// Comment +Game_Interpreter.prototype.command108 = function(params) { + this._comments = [params[0]]; + while (this.nextEventCode() === 408) { + this._index++; + this._comments.push(this.currentCommand().parameters[0]); + } + return true; +}; + +// Skip +Game_Interpreter.prototype.command109 = function() { + this.skipBranch(); + return true; +}; + +// Conditional Branch +Game_Interpreter.prototype.command111 = function(params) { + let result = false; + let value1, value2; + let actor, enemy, character; + switch (params[0]) { + case 0: // Switch + result = $gameSwitches.value(params[1]) === (params[2] === 0); + break; + case 1: // Variable + value1 = $gameVariables.value(params[1]); + if (params[2] === 0) { + value2 = params[3]; + } else { + value2 = $gameVariables.value(params[3]); + } + switch (params[4]) { + case 0: // Equal to + result = value1 === value2; + break; + case 1: // Greater than or Equal to + result = value1 >= value2; + break; + case 2: // Less than or Equal to + result = value1 <= value2; + break; + case 3: // Greater than + result = value1 > value2; + break; + case 4: // Less than + result = value1 < value2; + break; + case 5: // Not Equal to + result = value1 !== value2; + break; + } + break; + case 2: // Self Switch + if (this._eventId > 0) { + const key = [this._mapId, this._eventId, params[1]]; + result = $gameSelfSwitches.value(key) === (params[2] === 0); + } + break; + case 3: // Timer + if ($gameTimer.isWorking()) { + const sec = $gameTimer.frames() / 60; + if (params[2] === 0) { + result = sec >= params[1]; + } else { + result = sec <= params[1]; + } + } + break; + case 4: // Actor + actor = $gameActors.actor(params[1]); + if (actor) { + const n = params[3]; + switch (params[2]) { + case 0: // In the Party + result = $gameParty.members().includes(actor); + break; + case 1: // Name + result = actor.name() === n; + break; + case 2: // Class + result = actor.isClass($dataClasses[n]); + break; + case 3: // Skill + result = actor.hasSkill(n); + break; + case 4: // Weapon + result = actor.hasWeapon($dataWeapons[n]); + break; + case 5: // Armor + result = actor.hasArmor($dataArmors[n]); + break; + case 6: // State + result = actor.isStateAffected(n); + break; + } + } + break; + case 5: // Enemy + enemy = $gameTroop.members()[params[1]]; + if (enemy) { + switch (params[2]) { + case 0: // Appeared + result = enemy.isAlive(); + break; + case 1: // State + result = enemy.isStateAffected(params[3]); + break; + } + } + break; + case 6: // Character + character = this.character(params[1]); + if (character) { + result = character.direction() === params[2]; + } + break; + case 7: // Gold + switch (params[2]) { + case 0: // Greater than or equal to + result = $gameParty.gold() >= params[1]; + break; + case 1: // Less than or equal to + result = $gameParty.gold() <= params[1]; + break; + case 2: // Less than + result = $gameParty.gold() < params[1]; + break; + } + break; + case 8: // Item + result = $gameParty.hasItem($dataItems[params[1]]); + break; + case 9: // Weapon + result = $gameParty.hasItem($dataWeapons[params[1]], params[2]); + break; + case 10: // Armor + result = $gameParty.hasItem($dataArmors[params[1]], params[2]); + break; + case 11: // Button + switch (params[2] || 0) { + case 0: + result = Input.isPressed(params[1]); + break; + case 1: + result = Input.isTriggered(params[1]); + break; + case 2: + result = Input.isRepeated(params[1]); + break; + } + break; + case 12: // Script + result = !!eval(params[1]); + break; + case 13: // Vehicle + result = $gamePlayer.vehicle() === $gameMap.vehicle(params[1]); + break; + } + this._branch[this._indent] = result; + if (this._branch[this._indent] === false) { + this.skipBranch(); + } + return true; +}; + +// Else +Game_Interpreter.prototype.command411 = function() { + if (this._branch[this._indent] !== false) { + this.skipBranch(); + } + return true; +}; + +// Loop +Game_Interpreter.prototype.command112 = function() { + return true; +}; + +// Repeat Above +Game_Interpreter.prototype.command413 = function() { + do { + this._index--; + } while (this.currentCommand().indent !== this._indent); + return true; +}; + +// Break Loop +Game_Interpreter.prototype.command113 = function() { + let depth = 0; + while (this._index < this._list.length - 1) { + this._index++; + const command = this.currentCommand(); + if (command.code === 112) { + depth++; + } + if (command.code === 413) { + if (depth > 0) { + depth--; + } else { + break; + } + } + } + return true; +}; + +// Exit Event Processing +Game_Interpreter.prototype.command115 = function() { + this._index = this._list.length; + return true; +}; + +// Common Event +Game_Interpreter.prototype.command117 = function(params) { + const commonEvent = $dataCommonEvents[params[0]]; + if (commonEvent) { + const eventId = this.isOnCurrentMap() ? this._eventId : 0; + this.setupChild(commonEvent.list, eventId); + } + return true; +}; + +Game_Interpreter.prototype.setupChild = function(list, eventId) { + this._childInterpreter = new Game_Interpreter(this._depth + 1); + this._childInterpreter.setup(list, eventId); +}; + +// Label +Game_Interpreter.prototype.command118 = function() { + return true; +}; + +// Jump to Label +Game_Interpreter.prototype.command119 = function(params) { + const labelName = params[0]; + for (let i = 0; i < this._list.length; i++) { + const command = this._list[i]; + if (command.code === 118 && command.parameters[0] === labelName) { + this.jumpTo(i); + break; + } + } + return true; +}; + +Game_Interpreter.prototype.jumpTo = function(index) { + const lastIndex = this._index; + const startIndex = Math.min(index, lastIndex); + const endIndex = Math.max(index, lastIndex); + let indent = this._indent; + for (let i = startIndex; i <= endIndex; i++) { + const newIndent = this._list[i].indent; + if (newIndent !== indent) { + this._branch[indent] = null; + indent = newIndent; + } + } + this._index = index; +}; + +// Control Switches +Game_Interpreter.prototype.command121 = function(params) { + for (let i = params[0]; i <= params[1]; i++) { + $gameSwitches.setValue(i, params[2] === 0); + } + return true; +}; + +// Control Variables +Game_Interpreter.prototype.command122 = function(params) { + const startId = params[0]; + const endId = params[1]; + const operationType = params[2]; + const operand = params[3]; + let value = 0; + let randomMax = 1; + switch (operand) { + case 0: // Constant + value = params[4]; + break; + case 1: // Variable + value = $gameVariables.value(params[4]); + break; + case 2: // Random + value = params[4]; + randomMax = params[5] - params[4] + 1; + randomMax = Math.max(randomMax, 1); + break; + case 3: // Game Data + value = this.gameDataOperand(params[4], params[5], params[6]); + break; + case 4: // Script + value = eval(params[4]); + break; + } + for (let i = startId; i <= endId; i++) { + if (typeof value === "number") { + const realValue = value + Math.randomInt(randomMax); + this.operateVariable(i, operationType, realValue); + } else { + this.operateVariable(i, operationType, value); + } + } + return true; +}; + +Game_Interpreter.prototype.gameDataOperand = function(type, param1, param2) { + let actor, enemy, character; + switch (type) { + case 0: // Item + return $gameParty.numItems($dataItems[param1]); + case 1: // Weapon + return $gameParty.numItems($dataWeapons[param1]); + case 2: // Armor + return $gameParty.numItems($dataArmors[param1]); + case 3: // Actor + actor = $gameActors.actor(param1); + if (actor) { + switch (param2) { + case 0: // Level + return actor.level; + case 1: // EXP + return actor.currentExp(); + case 2: // HP + return actor.hp; + case 3: // MP + return actor.mp; + case 12: // TP + return actor.tp; + default: + // Parameter + if (param2 >= 4 && param2 <= 11) { + return actor.param(param2 - 4); + } + } + } + break; + case 4: // Enemy + enemy = $gameTroop.members()[param1]; + if (enemy) { + switch (param2) { + case 0: // HP + return enemy.hp; + case 1: // MP + return enemy.mp; + case 10: // TP + return enemy.tp; + default: + // Parameter + if (param2 >= 2 && param2 <= 9) { + return enemy.param(param2 - 2); + } + } + } + break; + case 5: // Character + character = this.character(param1); + if (character) { + switch (param2) { + case 0: // Map X + return character.x; + case 1: // Map Y + return character.y; + case 2: // Direction + return character.direction(); + case 3: // Screen X + return character.screenX(); + case 4: // Screen Y + return character.screenY(); + } + } + break; + case 6: // Party + actor = $gameParty.members()[param1]; + return actor ? actor.actorId() : 0; + case 8: // Last + return $gameTemp.lastActionData(param1); + case 7: // Other + switch (param1) { + case 0: // Map ID + return $gameMap.mapId(); + case 1: // Party Members + return $gameParty.size(); + case 2: // Gold + return $gameParty.gold(); + case 3: // Steps + return $gameParty.steps(); + case 4: // Play Time + return $gameSystem.playtime(); + case 5: // Timer + return $gameTimer.seconds(); + case 6: // Save Count + return $gameSystem.saveCount(); + case 7: // Battle Count + return $gameSystem.battleCount(); + case 8: // Win Count + return $gameSystem.winCount(); + case 9: // Escape Count + return $gameSystem.escapeCount(); + } + break; + } + return 0; +}; + +Game_Interpreter.prototype.operateVariable = function( + variableId, + operationType, + value +) { + try { + const oldValue = $gameVariables.value(variableId); + switch (operationType) { + case 0: // Set + $gameVariables.setValue(variableId, value); + break; + case 1: // Add + $gameVariables.setValue(variableId, oldValue + value); + break; + case 2: // Sub + $gameVariables.setValue(variableId, oldValue - value); + break; + case 3: // Mul + $gameVariables.setValue(variableId, oldValue * value); + break; + case 4: // Div + $gameVariables.setValue(variableId, oldValue / value); + break; + case 5: // Mod + $gameVariables.setValue(variableId, oldValue % value); + break; + } + } catch (e) { + $gameVariables.setValue(variableId, 0); + } +}; + +// Control Self Switch +Game_Interpreter.prototype.command123 = function(params) { + if (this._eventId > 0) { + const key = [this._mapId, this._eventId, params[0]]; + $gameSelfSwitches.setValue(key, params[1] === 0); + } + return true; +}; + +// Control Timer +Game_Interpreter.prototype.command124 = function(params) { + if (params[0] === 0) { + // Start + $gameTimer.start(params[1] * 60); + } else { + // Stop + $gameTimer.stop(); + } + return true; +}; + +// Change Gold +Game_Interpreter.prototype.command125 = function(params) { + const value = this.operateValue(params[0], params[1], params[2]); + $gameParty.gainGold(value); + return true; +}; + +// Change Items +Game_Interpreter.prototype.command126 = function(params) { + const value = this.operateValue(params[1], params[2], params[3]); + $gameParty.gainItem($dataItems[params[0]], value); + return true; +}; + +// Change Weapons +Game_Interpreter.prototype.command127 = function(params) { + const value = this.operateValue(params[1], params[2], params[3]); + $gameParty.gainItem($dataWeapons[params[0]], value, params[4]); + return true; +}; + +// Change Armors +Game_Interpreter.prototype.command128 = function(params) { + const value = this.operateValue(params[1], params[2], params[3]); + $gameParty.gainItem($dataArmors[params[0]], value, params[4]); + return true; +}; + +// Change Party Member +Game_Interpreter.prototype.command129 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor) { + if (params[1] === 0) { + // Add + if (params[2]) { + // Initialize + $gameActors.actor(params[0]).setup(params[0]); + } + $gameParty.addActor(params[0]); + } else { + // Remove + $gameParty.removeActor(params[0]); + } + } + return true; +}; + +// Change Battle BGM +Game_Interpreter.prototype.command132 = function(params) { + $gameSystem.setBattleBgm(params[0]); + return true; +}; + +// Change Victory ME +Game_Interpreter.prototype.command133 = function(params) { + $gameSystem.setVictoryMe(params[0]); + return true; +}; + +// Change Save Access +Game_Interpreter.prototype.command134 = function(params) { + if (params[0] === 0) { + $gameSystem.disableSave(); + } else { + $gameSystem.enableSave(); + } + return true; +}; + +// Change Menu Access +Game_Interpreter.prototype.command135 = function(params) { + if (params[0] === 0) { + $gameSystem.disableMenu(); + } else { + $gameSystem.enableMenu(); + } + return true; +}; + +// Change Encounter +Game_Interpreter.prototype.command136 = function(params) { + if (params[0] === 0) { + $gameSystem.disableEncounter(); + } else { + $gameSystem.enableEncounter(); + } + $gamePlayer.makeEncounterCount(); + return true; +}; + +// Change Formation Access +Game_Interpreter.prototype.command137 = function(params) { + if (params[0] === 0) { + $gameSystem.disableFormation(); + } else { + $gameSystem.enableFormation(); + } + return true; +}; + +// Change Window Color +Game_Interpreter.prototype.command138 = function(params) { + $gameSystem.setWindowTone(params[0]); + return true; +}; + +// Change Defeat ME +Game_Interpreter.prototype.command139 = function(params) { + $gameSystem.setDefeatMe(params[0]); + return true; +}; + +// Change Vehicle BGM +Game_Interpreter.prototype.command140 = function(params) { + const vehicle = $gameMap.vehicle(params[0]); + if (vehicle) { + vehicle.setBgm(params[1]); + } + return true; +}; + +// Transfer Player +Game_Interpreter.prototype.command201 = function(params) { + if ($gameParty.inBattle() || $gameMessage.isBusy()) { + return false; + } + let mapId, x, y; + if (params[0] === 0) { + // Direct designation + mapId = params[1]; + x = params[2]; + y = params[3]; + } else { + // Designation with variables + mapId = $gameVariables.value(params[1]); + x = $gameVariables.value(params[2]); + y = $gameVariables.value(params[3]); + } + $gamePlayer.reserveTransfer(mapId, x, y, params[4], params[5]); + this.setWaitMode("transfer"); + return true; +}; + +// Set Vehicle Location +Game_Interpreter.prototype.command202 = function(params) { + let mapId, x, y; + if (params[1] === 0) { + // Direct designation + mapId = params[2]; + x = params[3]; + y = params[4]; + } else { + // Designation with variables + mapId = $gameVariables.value(params[2]); + x = $gameVariables.value(params[3]); + y = $gameVariables.value(params[4]); + } + const vehicle = $gameMap.vehicle(params[0]); + if (vehicle) { + vehicle.setLocation(mapId, x, y); + } + return true; +}; + +// Set Event Location +Game_Interpreter.prototype.command203 = function(params) { + const character = this.character(params[0]); + if (character) { + if (params[1] === 0) { + // Direct designation + character.locate(params[2], params[3]); + } else if (params[1] === 1) { + // Designation with variables + const x = $gameVariables.value(params[2]); + const y = $gameVariables.value(params[3]); + character.locate(x, y); + } else { + // Exchange with another event + const character2 = this.character(params[2]); + if (character2) { + character.swap(character2); + } + } + if (params[4] > 0) { + character.setDirection(params[4]); + } + } + return true; +}; + +// Scroll Map +Game_Interpreter.prototype.command204 = function(params) { + if (!$gameParty.inBattle()) { + if ($gameMap.isScrolling()) { + this.setWaitMode("scroll"); + return false; + } + $gameMap.startScroll(params[0], params[1], params[2]); + if (params[3]) { + this.setWaitMode("scroll"); + } + } + return true; +}; + +// Set Movement Route +Game_Interpreter.prototype.command205 = function(params) { + $gameMap.refreshIfNeeded(); + this._characterId = params[0]; + const character = this.character(this._characterId); + if (character) { + character.forceMoveRoute(params[1]); + if (params[1].wait) { + this.setWaitMode("route"); + } + } + return true; +}; + +// Get on/off Vehicle +Game_Interpreter.prototype.command206 = function() { + $gamePlayer.getOnOffVehicle(); + return true; +}; + +// Change Transparency +Game_Interpreter.prototype.command211 = function(params) { + $gamePlayer.setTransparent(params[0] === 0); + return true; +}; + +// Show Animation +Game_Interpreter.prototype.command212 = function(params) { + this._characterId = params[0]; + const character = this.character(this._characterId); + if (character) { + $gameTemp.requestAnimation([character], params[1]); + if (params[2]) { + this.setWaitMode("animation"); + } + } + return true; +}; + +// Show Balloon Icon +Game_Interpreter.prototype.command213 = function(params) { + this._characterId = params[0]; + const character = this.character(this._characterId); + if (character) { + $gameTemp.requestBalloon(character, params[1]); + if (params[2]) { + this.setWaitMode("balloon"); + } + } + return true; +}; + +// Erase Event +Game_Interpreter.prototype.command214 = function() { + if (this.isOnCurrentMap() && this._eventId > 0) { + $gameMap.eraseEvent(this._eventId); + } + return true; +}; + +// Change Player Followers +Game_Interpreter.prototype.command216 = function(params) { + if (params[0] === 0) { + $gamePlayer.showFollowers(); + } else { + $gamePlayer.hideFollowers(); + } + $gamePlayer.refresh(); + return true; +}; + +// Gather Followers +Game_Interpreter.prototype.command217 = function() { + if (!$gameParty.inBattle()) { + $gamePlayer.gatherFollowers(); + this.setWaitMode("gather"); + } + return true; +}; + +// Fadeout Screen +Game_Interpreter.prototype.command221 = function() { + if ($gameMessage.isBusy()) { + return false; + } + $gameScreen.startFadeOut(this.fadeSpeed()); + this.wait(this.fadeSpeed()); + return true; +}; + +// Fadein Screen +Game_Interpreter.prototype.command222 = function() { + if ($gameMessage.isBusy()) { + return false; + } + $gameScreen.startFadeIn(this.fadeSpeed()); + this.wait(this.fadeSpeed()); + return true; +}; + +// Tint Screen +Game_Interpreter.prototype.command223 = function(params) { + $gameScreen.startTint(params[0], params[1]); + if (params[2]) { + this.wait(params[1]); + } + return true; +}; + +// Flash Screen +Game_Interpreter.prototype.command224 = function(params) { + $gameScreen.startFlash(params[0], params[1]); + if (params[2]) { + this.wait(params[1]); + } + return true; +}; + +// Shake Screen +Game_Interpreter.prototype.command225 = function(params) { + $gameScreen.startShake(params[0], params[1], params[2]); + if (params[3]) { + this.wait(params[2]); + } + return true; +}; + +// Wait +Game_Interpreter.prototype.command230 = function(params) { + this.wait(params[0]); + return true; +}; + +// Show Picture +Game_Interpreter.prototype.command231 = function(params) { + const point = this.picturePoint(params); + // prettier-ignore + $gameScreen.showPicture( + params[0], params[1], params[2], point.x, point.y, + params[6], params[7], params[8], params[9] + ); + return true; +}; + +// Move Picture +Game_Interpreter.prototype.command232 = function(params) { + const point = this.picturePoint(params); + // prettier-ignore + $gameScreen.movePicture( + params[0], params[2], point.x, point.y, params[6], params[7], + params[8], params[9], params[10], params[12] || 0 + ); + if (params[11]) { + this.wait(params[10]); + } + return true; +}; + +Game_Interpreter.prototype.picturePoint = function(params) { + const point = new Point(); + if (params[3] === 0) { + // Direct designation + point.x = params[4]; + point.y = params[5]; + } else { + // Designation with variables + point.x = $gameVariables.value(params[4]); + point.y = $gameVariables.value(params[5]); + } + return point; +}; + +// Rotate Picture +Game_Interpreter.prototype.command233 = function(params) { + $gameScreen.rotatePicture(params[0], params[1]); + return true; +}; + +// Tint Picture +Game_Interpreter.prototype.command234 = function(params) { + $gameScreen.tintPicture(params[0], params[1], params[2]); + if (params[3]) { + this.wait(params[2]); + } + return true; +}; + +// Erase Picture +Game_Interpreter.prototype.command235 = function(params) { + $gameScreen.erasePicture(params[0]); + return true; +}; + +// Set Weather Effect +Game_Interpreter.prototype.command236 = function(params) { + if (!$gameParty.inBattle()) { + $gameScreen.changeWeather(params[0], params[1], params[2]); + if (params[3]) { + this.wait(params[2]); + } + } + return true; +}; + +// Play BGM +Game_Interpreter.prototype.command241 = function(params) { + AudioManager.playBgm(params[0]); + return true; +}; + +// Fadeout BGM +Game_Interpreter.prototype.command242 = function(params) { + AudioManager.fadeOutBgm(params[0]); + return true; +}; + +// Save BGM +Game_Interpreter.prototype.command243 = function() { + $gameSystem.saveBgm(); + return true; +}; + +// Resume BGM +Game_Interpreter.prototype.command244 = function() { + $gameSystem.replayBgm(); + return true; +}; + +// Play BGS +Game_Interpreter.prototype.command245 = function(params) { + AudioManager.playBgs(params[0]); + return true; +}; + +// Fadeout BGS +Game_Interpreter.prototype.command246 = function(params) { + AudioManager.fadeOutBgs(params[0]); + return true; +}; + +// Play ME +Game_Interpreter.prototype.command249 = function(params) { + AudioManager.playMe(params[0]); + return true; +}; + +// Play SE +Game_Interpreter.prototype.command250 = function(params) { + AudioManager.playSe(params[0]); + return true; +}; + +// Stop SE +Game_Interpreter.prototype.command251 = function() { + AudioManager.stopSe(); + return true; +}; + +// Play Movie +Game_Interpreter.prototype.command261 = function(params) { + if ($gameMessage.isBusy()) { + return false; + } + const name = params[0]; + if (name.length > 0) { + const ext = this.videoFileExt(); + Video.play("movies/" + name + ext); + this.setWaitMode("video"); + } + return true; +}; + +Game_Interpreter.prototype.videoFileExt = function() { + if (Utils.canPlayWebm()) { + return ".webm"; + } else { + return ".mp4"; + } +}; + +// Change Map Name Display +Game_Interpreter.prototype.command281 = function(params) { + if (params[0] === 0) { + $gameMap.enableNameDisplay(); + } else { + $gameMap.disableNameDisplay(); + } + return true; +}; + +// Change Tileset +Game_Interpreter.prototype.command282 = function(params) { + const tileset = $dataTilesets[params[0]]; + const allReady = tileset.tilesetNames + .map(tilesetName => ImageManager.loadTileset(tilesetName)) + .every(bitmap => bitmap.isReady()); + if (allReady) { + $gameMap.changeTileset(params[0]); + return true; + } else { + return false; + } +}; + +// Change Battle Background +Game_Interpreter.prototype.command283 = function(params) { + $gameMap.changeBattleback(params[0], params[1]); + return true; +}; + +// Change Parallax +Game_Interpreter.prototype.command284 = function(params) { + // prettier-ignore + $gameMap.changeParallax( + params[0], params[1], params[2], params[3], params[4] + ); + return true; +}; + +// Get Location Info +Game_Interpreter.prototype.command285 = function(params) { + let x, y, value; + if (params[2] === 0) { + // Direct designation + x = params[3]; + y = params[4]; + } else if (params[2] === 1) { + // Designation with variables + x = $gameVariables.value(params[3]); + y = $gameVariables.value(params[4]); + } else { + // Designation by a character + const character = this.character(params[3]); + x = character.x; + y = character.y; + } + switch (params[1]) { + case 0: // Terrain Tag + value = $gameMap.terrainTag(x, y); + break; + case 1: // Event ID + value = $gameMap.eventIdXy(x, y); + break; + case 2: // Tile ID (Layer 1) + case 3: // Tile ID (Layer 2) + case 4: // Tile ID (Layer 3) + case 5: // Tile ID (Layer 4) + value = $gameMap.tileId(x, y, params[1] - 2); + break; + default: + // Region ID + value = $gameMap.regionId(x, y); + break; + } + $gameVariables.setValue(params[0], value); + return true; +}; + +// Battle Processing +Game_Interpreter.prototype.command301 = function(params) { + if (!$gameParty.inBattle()) { + let troopId; + if (params[0] === 0) { + // Direct designation + troopId = params[1]; + } else if (params[0] === 1) { + // Designation with a variable + troopId = $gameVariables.value(params[1]); + } else { + // Same as Random Encounters + troopId = $gamePlayer.makeEncounterTroopId(); + } + if ($dataTroops[troopId]) { + BattleManager.setup(troopId, params[2], params[3]); + BattleManager.setEventCallback(n => { + this._branch[this._indent] = n; + }); + $gamePlayer.makeEncounterCount(); + SceneManager.push(Scene_Battle); + } + } + return true; +}; + +// If Win +Game_Interpreter.prototype.command601 = function() { + if (this._branch[this._indent] !== 0) { + this.skipBranch(); + } + return true; +}; + +// If Escape +Game_Interpreter.prototype.command602 = function() { + if (this._branch[this._indent] !== 1) { + this.skipBranch(); + } + return true; +}; + +// If Lose +Game_Interpreter.prototype.command603 = function() { + if (this._branch[this._indent] !== 2) { + this.skipBranch(); + } + return true; +}; + +// Shop Processing +Game_Interpreter.prototype.command302 = function(params) { + if (!$gameParty.inBattle()) { + const goods = [params]; + while (this.nextEventCode() === 605) { + this._index++; + goods.push(this.currentCommand().parameters); + } + SceneManager.push(Scene_Shop); + SceneManager.prepareNextScene(goods, params[4]); + } + return true; +}; + +// Name Input Processing +Game_Interpreter.prototype.command303 = function(params) { + if (!$gameParty.inBattle()) { + if ($dataActors[params[0]]) { + SceneManager.push(Scene_Name); + SceneManager.prepareNextScene(params[0], params[1]); + } + } + return true; +}; + +// Change HP +Game_Interpreter.prototype.command311 = function(params) { + const value = this.operateValue(params[2], params[3], params[4]); + this.iterateActorEx(params[0], params[1], actor => { + this.changeHp(actor, value, params[5]); + }); + return true; +}; + +// Change MP +Game_Interpreter.prototype.command312 = function(params) { + const value = this.operateValue(params[2], params[3], params[4]); + this.iterateActorEx(params[0], params[1], actor => { + actor.gainMp(value); + }); + return true; +}; + +// Change TP +Game_Interpreter.prototype.command326 = function(params) { + const value = this.operateValue(params[2], params[3], params[4]); + this.iterateActorEx(params[0], params[1], actor => { + actor.gainTp(value); + }); + return true; +}; + +// Change State +Game_Interpreter.prototype.command313 = function(params) { + this.iterateActorEx(params[0], params[1], actor => { + const alreadyDead = actor.isDead(); + if (params[2] === 0) { + actor.addState(params[3]); + } else { + actor.removeState(params[3]); + } + if (actor.isDead() && !alreadyDead) { + actor.performCollapse(); + } + actor.clearResult(); + }); + return true; +}; + +// Recover All +Game_Interpreter.prototype.command314 = function(params) { + this.iterateActorEx(params[0], params[1], actor => { + actor.recoverAll(); + }); + return true; +}; + +// Change EXP +Game_Interpreter.prototype.command315 = function(params) { + const value = this.operateValue(params[2], params[3], params[4]); + this.iterateActorEx(params[0], params[1], actor => { + actor.changeExp(actor.currentExp() + value, params[5]); + }); + return true; +}; + +// Change Level +Game_Interpreter.prototype.command316 = function(params) { + const value = this.operateValue(params[2], params[3], params[4]); + this.iterateActorEx(params[0], params[1], actor => { + actor.changeLevel(actor.level + value, params[5]); + }); + return true; +}; + +// Change Parameter +Game_Interpreter.prototype.command317 = function(params) { + const value = this.operateValue(params[3], params[4], params[5]); + this.iterateActorEx(params[0], params[1], actor => { + actor.addParam(params[2], value); + }); + return true; +}; + +// Change Skill +Game_Interpreter.prototype.command318 = function(params) { + this.iterateActorEx(params[0], params[1], actor => { + if (params[2] === 0) { + actor.learnSkill(params[3]); + } else { + actor.forgetSkill(params[3]); + } + }); + return true; +}; + +// Change Equipment +Game_Interpreter.prototype.command319 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor) { + actor.changeEquipById(params[1], params[2]); + } + return true; +}; + +// Change Name +Game_Interpreter.prototype.command320 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor) { + actor.setName(params[1]); + } + return true; +}; + +// Change Class +Game_Interpreter.prototype.command321 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor && $dataClasses[params[1]]) { + actor.changeClass(params[1], params[2]); + } + return true; +}; + +// Change Actor Images +Game_Interpreter.prototype.command322 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor) { + actor.setCharacterImage(params[1], params[2]); + actor.setFaceImage(params[3], params[4]); + actor.setBattlerImage(params[5]); + } + $gamePlayer.refresh(); + return true; +}; + +// Change Vehicle Image +Game_Interpreter.prototype.command323 = function(params) { + const vehicle = $gameMap.vehicle(params[0]); + if (vehicle) { + vehicle.setImage(params[1], params[2]); + } + return true; +}; + +// Change Nickname +Game_Interpreter.prototype.command324 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor) { + actor.setNickname(params[1]); + } + return true; +}; + +// Change Profile +Game_Interpreter.prototype.command325 = function(params) { + const actor = $gameActors.actor(params[0]); + if (actor) { + actor.setProfile(params[1]); + } + return true; +}; + +// Change Enemy HP +Game_Interpreter.prototype.command331 = function(params) { + const value = this.operateValue(params[1], params[2], params[3]); + this.iterateEnemyIndex(params[0], enemy => { + this.changeHp(enemy, value, params[4]); + }); + return true; +}; + +// Change Enemy MP +Game_Interpreter.prototype.command332 = function(params) { + const value = this.operateValue(params[1], params[2], params[3]); + this.iterateEnemyIndex(params[0], enemy => { + enemy.gainMp(value); + }); + return true; +}; + +// Change Enemy TP +Game_Interpreter.prototype.command342 = function(params) { + const value = this.operateValue(params[1], params[2], params[3]); + this.iterateEnemyIndex(params[0], enemy => { + enemy.gainTp(value); + }); + return true; +}; + +// Change Enemy State +Game_Interpreter.prototype.command333 = function(params) { + this.iterateEnemyIndex(params[0], enemy => { + const alreadyDead = enemy.isDead(); + if (params[1] === 0) { + enemy.addState(params[2]); + } else { + enemy.removeState(params[2]); + } + if (enemy.isDead() && !alreadyDead) { + enemy.performCollapse(); + } + enemy.clearResult(); + }); + return true; +}; + +// Enemy Recover All +Game_Interpreter.prototype.command334 = function(params) { + this.iterateEnemyIndex(params[0], enemy => { + enemy.recoverAll(); + }); + return true; +}; + +// Enemy Appear +Game_Interpreter.prototype.command335 = function(params) { + this.iterateEnemyIndex(params[0], enemy => { + enemy.appear(); + $gameTroop.makeUniqueNames(); + }); + return true; +}; + +// Enemy Transform +Game_Interpreter.prototype.command336 = function(params) { + this.iterateEnemyIndex(params[0], enemy => { + enemy.transform(params[1]); + $gameTroop.makeUniqueNames(); + }); + return true; +}; + +// Show Battle Animation +Game_Interpreter.prototype.command337 = function(params) { + let param = params[0]; + if (params[2]) { + param = -1; + } + const targets = []; + this.iterateEnemyIndex(param, enemy => { + if (enemy.isAlive()) { + targets.push(enemy); + } + }); + $gameTemp.requestAnimation(targets, params[1]); + return true; +}; + +// Force Action +Game_Interpreter.prototype.command339 = function(params) { + this.iterateBattler(params[0], params[1], battler => { + if (!battler.isDeathStateAffected()) { + battler.forceAction(params[2], params[3]); + BattleManager.forceAction(battler); + this.setWaitMode("action"); + } + }); + return true; +}; + +// Abort Battle +Game_Interpreter.prototype.command340 = function() { + BattleManager.abort(); + return true; +}; + +// Open Menu Screen +Game_Interpreter.prototype.command351 = function() { + if (!$gameParty.inBattle()) { + SceneManager.push(Scene_Menu); + Window_MenuCommand.initCommandPosition(); + } + return true; +}; + +// Open Save Screen +Game_Interpreter.prototype.command352 = function() { + if (!$gameParty.inBattle()) { + SceneManager.push(Scene_Save); + } + return true; +}; + +// Game Over +Game_Interpreter.prototype.command353 = function() { + SceneManager.goto(Scene_Gameover); + return true; +}; + +// Return to Title Screen +Game_Interpreter.prototype.command354 = function() { + SceneManager.goto(Scene_Title); + return true; +}; + +// Script +Game_Interpreter.prototype.command355 = function() { + let script = this.currentCommand().parameters[0] + "\n"; + while (this.nextEventCode() === 655) { + this._index++; + script += this.currentCommand().parameters[0] + "\n"; + } + eval(script); + return true; +}; + +// Plugin Command MV (deprecated) +Game_Interpreter.prototype.command356 = function(params) { + const args = params[0].split(" "); + const command = args.shift(); + this.pluginCommand(command, args); + return true; +}; + +Game_Interpreter.prototype.pluginCommand = function() { + // deprecated +}; + +// Plugin Command +Game_Interpreter.prototype.command357 = function(params) { + const pluginName = Utils.extractFileName(params[0]); + PluginManager.callCommand(this, pluginName, params[1], params[3]); + return true; +}; + +//----------------------------------------------------------------------------- diff --git a/js/rmmz_scenes.js b/js/rmmz_scenes.js new file mode 100644 index 0000000..fb0eb81 --- /dev/null +++ b/js/rmmz_scenes.js @@ -0,0 +1,3692 @@ +//============================================================================= +// rmmz_scenes.js v1.8.1 +//============================================================================= + +//----------------------------------------------------------------------------- +// Scene_Base +// +// The superclass of all scenes within the game. + +function Scene_Base() { + this.initialize(...arguments); +} + +Scene_Base.prototype = Object.create(Stage.prototype); +Scene_Base.prototype.constructor = Scene_Base; + +Scene_Base.prototype.initialize = function() { + Stage.prototype.initialize.call(this); + this._started = false; + this._active = false; + this._fadeSign = 0; + this._fadeDuration = 0; + this._fadeWhite = 0; + this._fadeOpacity = 0; + this.createColorFilter(); +}; + +Scene_Base.prototype.create = function() { + // +}; + +Scene_Base.prototype.isActive = function() { + return this._active; +}; + +Scene_Base.prototype.isReady = function() { + return ( + ImageManager.isReady() && + EffectManager.isReady() && + FontManager.isReady() + ); +}; + +Scene_Base.prototype.start = function() { + this._started = true; + this._active = true; +}; + +Scene_Base.prototype.update = function() { + this.updateFade(); + this.updateColorFilter(); + this.updateChildren(); + AudioManager.checkErrors(); +}; + +Scene_Base.prototype.stop = function() { + this._active = false; +}; + +Scene_Base.prototype.isStarted = function() { + return this._started; +}; + +Scene_Base.prototype.isBusy = function() { + return this.isFading(); +}; + +Scene_Base.prototype.isFading = function() { + return this._fadeDuration > 0; +}; + +Scene_Base.prototype.terminate = function() { + // +}; + +Scene_Base.prototype.createWindowLayer = function() { + this._windowLayer = new WindowLayer(); + this._windowLayer.x = (Graphics.width - Graphics.boxWidth) / 2; + this._windowLayer.y = (Graphics.height - Graphics.boxHeight) / 2; + this.addChild(this._windowLayer); +}; + +Scene_Base.prototype.addWindow = function(window) { + this._windowLayer.addChild(window); +}; + +Scene_Base.prototype.startFadeIn = function(duration, white) { + this._fadeSign = 1; + this._fadeDuration = duration || 30; + this._fadeWhite = white; + this._fadeOpacity = 255; + this.updateColorFilter(); +}; + +Scene_Base.prototype.startFadeOut = function(duration, white) { + this._fadeSign = -1; + this._fadeDuration = duration || 30; + this._fadeWhite = white; + this._fadeOpacity = 0; + this.updateColorFilter(); +}; + +Scene_Base.prototype.createColorFilter = function() { + this._colorFilter = new ColorFilter(); + this.filters = [this._colorFilter]; +}; + +Scene_Base.prototype.updateColorFilter = function() { + const c = this._fadeWhite ? 255 : 0; + const blendColor = [c, c, c, this._fadeOpacity]; + this._colorFilter.setBlendColor(blendColor); +}; + +Scene_Base.prototype.updateFade = function() { + if (this._fadeDuration > 0) { + const d = this._fadeDuration; + if (this._fadeSign > 0) { + this._fadeOpacity -= this._fadeOpacity / d; + } else { + this._fadeOpacity += (255 - this._fadeOpacity) / d; + } + this._fadeDuration--; + } +}; + +Scene_Base.prototype.updateChildren = function() { + for (const child of this.children) { + if (child.update) { + child.update(); + } + } +}; + +Scene_Base.prototype.popScene = function() { + SceneManager.pop(); +}; + +Scene_Base.prototype.checkGameover = function() { + if ($gameParty.isAllDead()) { + SceneManager.goto(Scene_Gameover); + } +}; + +Scene_Base.prototype.fadeOutAll = function() { + const time = this.slowFadeSpeed() / 60; + AudioManager.fadeOutBgm(time); + AudioManager.fadeOutBgs(time); + AudioManager.fadeOutMe(time); + this.startFadeOut(this.slowFadeSpeed()); +}; + +Scene_Base.prototype.fadeSpeed = function() { + return 24; +}; + +Scene_Base.prototype.slowFadeSpeed = function() { + return this.fadeSpeed() * 2; +}; + +Scene_Base.prototype.scaleSprite = function(sprite) { + const ratioX = Graphics.width / sprite.bitmap.width; + const ratioY = Graphics.height / sprite.bitmap.height; + const scale = Math.max(ratioX, ratioY, 1.0); + sprite.scale.x = scale; + sprite.scale.y = scale; +}; + +Scene_Base.prototype.centerSprite = function(sprite) { + sprite.x = Graphics.width / 2; + sprite.y = Graphics.height / 2; + sprite.anchor.x = 0.5; + sprite.anchor.y = 0.5; +}; + +Scene_Base.prototype.isBottomHelpMode = function() { + return true; +}; + +Scene_Base.prototype.isBottomButtonMode = function() { + return false; +}; + +Scene_Base.prototype.isRightInputMode = function() { + return true; +}; + +Scene_Base.prototype.mainCommandWidth = function() { + return 240; +}; + +Scene_Base.prototype.buttonAreaTop = function() { + if (this.isBottomButtonMode()) { + return Graphics.boxHeight - this.buttonAreaHeight(); + } else { + return 0; + } +}; + +Scene_Base.prototype.buttonAreaBottom = function() { + return this.buttonAreaTop() + this.buttonAreaHeight(); +}; + +Scene_Base.prototype.buttonAreaHeight = function() { + return 52; +}; + +Scene_Base.prototype.buttonY = function() { + const offsetY = Math.floor((this.buttonAreaHeight() - 48) / 2); + return this.buttonAreaTop() + offsetY; +}; + +Scene_Base.prototype.calcWindowHeight = function(numLines, selectable) { + if (selectable) { + return Window_Selectable.prototype.fittingHeight(numLines); + } else { + return Window_Base.prototype.fittingHeight(numLines); + } +}; + +Scene_Base.prototype.requestAutosave = function() { + if (this.isAutosaveEnabled()) { + this.executeAutosave(); + } +}; + +Scene_Base.prototype.isAutosaveEnabled = function() { + return ( + !DataManager.isBattleTest() && + !DataManager.isEventTest() && + $gameSystem.isAutosaveEnabled() && + $gameSystem.isSaveEnabled() + ); +}; + +Scene_Base.prototype.executeAutosave = function() { + $gameSystem.onBeforeSave(); + DataManager.saveGame(0) + .then(() => this.onAutosaveSuccess()) + .catch(() => this.onAutosaveFailure()); +}; + +Scene_Base.prototype.onAutosaveSuccess = function() { + // +}; + +Scene_Base.prototype.onAutosaveFailure = function() { + // +}; + +//----------------------------------------------------------------------------- +// Scene_Boot +// +// The scene class for initializing the entire game. + +function Scene_Boot() { + this.initialize(...arguments); +} + +Scene_Boot.prototype = Object.create(Scene_Base.prototype); +Scene_Boot.prototype.constructor = Scene_Boot; + +Scene_Boot.prototype.initialize = function() { + Scene_Base.prototype.initialize.call(this); + this._databaseLoaded = false; +}; + +Scene_Boot.prototype.create = function() { + Scene_Base.prototype.create.call(this); + DataManager.loadDatabase(); + StorageManager.updateForageKeys(); +}; + +Scene_Boot.prototype.isReady = function() { + if (!this._databaseLoaded) { + if ( + DataManager.isDatabaseLoaded() && + StorageManager.forageKeysUpdated() + ) { + this._databaseLoaded = true; + this.onDatabaseLoaded(); + } + return false; + } + return Scene_Base.prototype.isReady.call(this) && this.isPlayerDataLoaded(); +}; + +Scene_Boot.prototype.onDatabaseLoaded = function() { + this.setEncryptionInfo(); + this.loadSystemImages(); + this.loadPlayerData(); + this.loadGameFonts(); +}; + +Scene_Boot.prototype.setEncryptionInfo = function() { + const hasImages = $dataSystem.hasEncryptedImages; + const hasAudio = $dataSystem.hasEncryptedAudio; + const key = $dataSystem.encryptionKey; + Utils.setEncryptionInfo(hasImages, hasAudio, key); +}; + +Scene_Boot.prototype.loadSystemImages = function() { + ColorManager.loadWindowskin(); + ImageManager.loadSystem("IconSet"); +}; + +Scene_Boot.prototype.loadPlayerData = function() { + DataManager.loadGlobalInfo(); + ConfigManager.load(); +}; + +Scene_Boot.prototype.loadGameFonts = function() { + const advanced = $dataSystem.advanced; + FontManager.load("rmmz-mainfont", advanced.mainFontFilename); + FontManager.load("rmmz-numberfont", advanced.numberFontFilename); +}; + +Scene_Boot.prototype.isPlayerDataLoaded = function() { + return DataManager.isGlobalInfoLoaded() && ConfigManager.isLoaded(); +}; + +Scene_Boot.prototype.start = function() { + Scene_Base.prototype.start.call(this); + SoundManager.preloadImportantSounds(); + if (DataManager.isBattleTest()) { + DataManager.setupBattleTest(); + SceneManager.goto(Scene_Battle); + } else if (DataManager.isEventTest()) { + DataManager.setupEventTest(); + SceneManager.goto(Scene_Map); + } else if (DataManager.isTitleSkip()) { + this.checkPlayerLocation(); + DataManager.setupNewGame(); + SceneManager.goto(Scene_Map); + } else { + this.startNormalGame(); + } + this.resizeScreen(); + this.updateDocumentTitle(); +}; + +Scene_Boot.prototype.startNormalGame = function() { + this.checkPlayerLocation(); + DataManager.setupNewGame(); + Window_TitleCommand.initCommandPosition(); + SceneManager.goto(Scene_Splash); +}; + +Scene_Boot.prototype.resizeScreen = function() { + const screenWidth = $dataSystem.advanced.screenWidth; + const screenHeight = $dataSystem.advanced.screenHeight; + Graphics.resize(screenWidth, screenHeight); + Graphics.defaultScale = this.screenScale(); + this.adjustBoxSize(); + this.adjustWindow(); +}; + +Scene_Boot.prototype.adjustBoxSize = function() { + const uiAreaWidth = $dataSystem.advanced.uiAreaWidth; + const uiAreaHeight = $dataSystem.advanced.uiAreaHeight; + const boxMargin = 4; + Graphics.boxWidth = uiAreaWidth - boxMargin * 2; + Graphics.boxHeight = uiAreaHeight - boxMargin * 2; +}; + +Scene_Boot.prototype.adjustWindow = function() { + if (Utils.isNwjs()) { + const scale = this.screenScale(); + const xDelta = Graphics.width * scale - window.innerWidth; + const yDelta = Graphics.height * scale - window.innerHeight; + window.moveBy(-xDelta / 2, -yDelta / 2); + window.resizeBy(xDelta, yDelta); + } +}; + +Scene_Boot.prototype.screenScale = function() { + if ("screenScale" in $dataSystem.advanced) { + return $dataSystem.advanced.screenScale; + } else { + return 1; + } +}; + +Scene_Boot.prototype.updateDocumentTitle = function() { + document.title = $dataSystem.gameTitle; +}; + +Scene_Boot.prototype.checkPlayerLocation = function() { + if ($dataSystem.startMapId === 0) { + throw new Error("Player's starting position is not set"); + } +}; + +//----------------------------------------------------------------------------- +// Scene_Splash +// +// The scene class of the splash screen. + +function Scene_Splash() { + this.initialize(...arguments); +} + +Scene_Splash.prototype = Object.create(Scene_Base.prototype); +Scene_Splash.prototype.constructor = Scene_Splash; + +Scene_Splash.prototype.initialize = function() { + Scene_Base.prototype.initialize.call(this); + this.initWaitCount(); +}; + +Scene_Splash.prototype.create = function() { + Scene_Base.prototype.create.call(this); + if (this.isEnabled()) { + this.createBackground(); + } +}; + +Scene_Splash.prototype.start = function() { + Scene_Base.prototype.start.call(this); + if (this.isEnabled()) { + this.adjustBackground(); + this.startFadeIn(this.fadeSpeed(), false); + } +}; + +Scene_Splash.prototype.update = function() { + Scene_Base.prototype.update.call(this); + if (this.isActive()) { + if (!this.updateWaitCount()) { + this.gotoTitle(); + } + this.checkSkip(); + } +}; + +Scene_Splash.prototype.stop = function() { + Scene_Base.prototype.stop.call(this); + if (this.isEnabled()) { + this.startFadeOut(this.fadeSpeed()); + } +}; + +Scene_Splash.prototype.createBackground = function() { + this._backSprite = new Sprite(); + this._backSprite.bitmap = ImageManager.loadSystem("Splash"); + this.addChild(this._backSprite); +}; + +Scene_Splash.prototype.adjustBackground = function() { + this.scaleSprite(this._backSprite); + this.centerSprite(this._backSprite); +}; + +Scene_Splash.prototype.isEnabled = function() { + return $dataSystem.optSplashScreen; +}; + +Scene_Splash.prototype.initWaitCount = function() { + if (this.isEnabled()) { + this._waitCount = 120; + } else { + this._waitCount = 0; + } +}; + +Scene_Splash.prototype.updateWaitCount = function() { + if (this._waitCount > 0) { + this._waitCount--; + return true; + } + return false; +}; + +Scene_Splash.prototype.checkSkip = function() { + if (Input.isTriggered("ok") || TouchInput.isTriggered()) { + this._waitCount = 0; + } +}; + +Scene_Splash.prototype.gotoTitle = function() { + SceneManager.goto(Scene_Title); +}; + +//----------------------------------------------------------------------------- +// Scene_Title +// +// The scene class of the title screen. + +function Scene_Title() { + this.initialize(...arguments); +} + +Scene_Title.prototype = Object.create(Scene_Base.prototype); +Scene_Title.prototype.constructor = Scene_Title; + +Scene_Title.prototype.initialize = function() { + Scene_Base.prototype.initialize.call(this); +}; + +Scene_Title.prototype.create = function() { + Scene_Base.prototype.create.call(this); + this.createBackground(); + this.createForeground(); + this.createWindowLayer(); + this.createCommandWindow(); +}; + +Scene_Title.prototype.start = function() { + Scene_Base.prototype.start.call(this); + SceneManager.clearStack(); + this.adjustBackground(); + this.playTitleMusic(); + this.startFadeIn(this.fadeSpeed(), false); +}; + +Scene_Title.prototype.update = function() { + if (!this.isBusy()) { + this._commandWindow.open(); + } + Scene_Base.prototype.update.call(this); +}; + +Scene_Title.prototype.isBusy = function() { + return ( + this._commandWindow.isClosing() || + Scene_Base.prototype.isBusy.call(this) + ); +}; + +Scene_Title.prototype.terminate = function() { + Scene_Base.prototype.terminate.call(this); + SceneManager.snapForBackground(); + if (this._gameTitleSprite) { + this._gameTitleSprite.bitmap.destroy(); + } +}; + +Scene_Title.prototype.createBackground = function() { + this._backSprite1 = new Sprite( + ImageManager.loadTitle1($dataSystem.title1Name) + ); + this._backSprite2 = new Sprite( + ImageManager.loadTitle2($dataSystem.title2Name) + ); + this.addChild(this._backSprite1); + this.addChild(this._backSprite2); +}; + +Scene_Title.prototype.createForeground = function() { + this._gameTitleSprite = new Sprite( + new Bitmap(Graphics.width, Graphics.height) + ); + this.addChild(this._gameTitleSprite); + if ($dataSystem.optDrawTitle) { + this.drawGameTitle(); + } +}; + +Scene_Title.prototype.drawGameTitle = function() { + const x = 20; + const y = Graphics.height / 4; + const maxWidth = Graphics.width - x * 2; + const text = $dataSystem.gameTitle; + const bitmap = this._gameTitleSprite.bitmap; + bitmap.fontFace = $gameSystem.mainFontFace(); + bitmap.outlineColor = "black"; + bitmap.outlineWidth = 8; + bitmap.fontSize = 72; + bitmap.drawText(text, x, y, maxWidth, 48, "center"); +}; + +Scene_Title.prototype.adjustBackground = function() { + this.scaleSprite(this._backSprite1); + this.scaleSprite(this._backSprite2); + this.centerSprite(this._backSprite1); + this.centerSprite(this._backSprite2); +}; + +Scene_Title.prototype.createCommandWindow = function() { + const background = $dataSystem.titleCommandWindow.background; + const rect = this.commandWindowRect(); + this._commandWindow = new Window_TitleCommand(rect); + this._commandWindow.setBackgroundType(background); + this._commandWindow.setHandler("newGame", this.commandNewGame.bind(this)); + this._commandWindow.setHandler("continue", this.commandContinue.bind(this)); + this._commandWindow.setHandler("options", this.commandOptions.bind(this)); + this.addWindow(this._commandWindow); +}; + +Scene_Title.prototype.commandWindowRect = function() { + const offsetX = $dataSystem.titleCommandWindow.offsetX; + const offsetY = $dataSystem.titleCommandWindow.offsetY; + const ww = this.mainCommandWidth(); + const wh = this.calcWindowHeight(3, true); + const wx = (Graphics.boxWidth - ww) / 2 + offsetX; + const wy = Graphics.boxHeight - wh - 96 + offsetY; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Title.prototype.commandNewGame = function() { + DataManager.setupNewGame(); + this._commandWindow.close(); + this.fadeOutAll(); + SceneManager.goto(Scene_Map); +}; + +Scene_Title.prototype.commandContinue = function() { + this._commandWindow.close(); + SceneManager.push(Scene_Load); +}; + +Scene_Title.prototype.commandOptions = function() { + this._commandWindow.close(); + SceneManager.push(Scene_Options); +}; + +Scene_Title.prototype.playTitleMusic = function() { + AudioManager.playBgm($dataSystem.titleBgm); + AudioManager.stopBgs(); + AudioManager.stopMe(); +}; + +//----------------------------------------------------------------------------- +// Scene_Message +// +// The superclass of Scene_Map and Scene_Battle. + +function Scene_Message() { + this.initialize(...arguments); +} + +Scene_Message.prototype = Object.create(Scene_Base.prototype); +Scene_Message.prototype.constructor = Scene_Message; + +Scene_Message.prototype.initialize = function() { + Scene_Base.prototype.initialize.call(this); +}; + +Scene_Message.prototype.isMessageWindowClosing = function() { + return this._messageWindow.isClosing(); +}; + +Scene_Message.prototype.createAllWindows = function() { + this.createMessageWindow(); + this.createScrollTextWindow(); + this.createGoldWindow(); + this.createNameBoxWindow(); + this.createChoiceListWindow(); + this.createNumberInputWindow(); + this.createEventItemWindow(); + this.associateWindows(); +}; + +Scene_Message.prototype.createMessageWindow = function() { + const rect = this.messageWindowRect(); + this._messageWindow = new Window_Message(rect); + this.addWindow(this._messageWindow); +}; + +Scene_Message.prototype.messageWindowRect = function() { + const ww = Graphics.boxWidth; + const wh = this.calcWindowHeight(4, false) + 8; + const wx = (Graphics.boxWidth - ww) / 2; + const wy = 0; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Message.prototype.createScrollTextWindow = function() { + const rect = this.scrollTextWindowRect(); + this._scrollTextWindow = new Window_ScrollText(rect); + this.addWindow(this._scrollTextWindow); +}; + +Scene_Message.prototype.scrollTextWindowRect = function() { + const wx = 0; + const wy = 0; + const ww = Graphics.boxWidth; + const wh = Graphics.boxHeight; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Message.prototype.createGoldWindow = function() { + const rect = this.goldWindowRect(); + this._goldWindow = new Window_Gold(rect); + this._goldWindow.openness = 0; + this.addWindow(this._goldWindow); +}; + +Scene_Message.prototype.goldWindowRect = function() { + const ww = this.mainCommandWidth(); + const wh = this.calcWindowHeight(1, true); + const wx = Graphics.boxWidth - ww; + const wy = 0; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Message.prototype.createNameBoxWindow = function() { + this._nameBoxWindow = new Window_NameBox(); + this.addWindow(this._nameBoxWindow); +}; + +Scene_Message.prototype.createChoiceListWindow = function() { + this._choiceListWindow = new Window_ChoiceList(); + this.addWindow(this._choiceListWindow); +}; + +Scene_Message.prototype.createNumberInputWindow = function() { + this._numberInputWindow = new Window_NumberInput(); + this.addWindow(this._numberInputWindow); +}; + +Scene_Message.prototype.createEventItemWindow = function() { + const rect = this.eventItemWindowRect(); + this._eventItemWindow = new Window_EventItem(rect); + this.addWindow(this._eventItemWindow); +}; + +Scene_Message.prototype.eventItemWindowRect = function() { + const wx = 0; + const wy = 0; + const ww = Graphics.boxWidth; + const wh = this.calcWindowHeight(4, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Message.prototype.associateWindows = function() { + const messageWindow = this._messageWindow; + messageWindow.setGoldWindow(this._goldWindow); + messageWindow.setNameBoxWindow(this._nameBoxWindow); + messageWindow.setChoiceListWindow(this._choiceListWindow); + messageWindow.setNumberInputWindow(this._numberInputWindow); + messageWindow.setEventItemWindow(this._eventItemWindow); + this._nameBoxWindow.setMessageWindow(messageWindow); + this._choiceListWindow.setMessageWindow(messageWindow); + this._numberInputWindow.setMessageWindow(messageWindow); + this._eventItemWindow.setMessageWindow(messageWindow); +}; + +Scene_Message.prototype.cancelMessageWait = function() { + this._messageWindow.cancelWait(); +}; + +//----------------------------------------------------------------------------- +// Scene_Map +// +// The scene class of the map screen. + +function Scene_Map() { + this.initialize(...arguments); +} + +Scene_Map.prototype = Object.create(Scene_Message.prototype); +Scene_Map.prototype.constructor = Scene_Map; + +Scene_Map.prototype.initialize = function() { + Scene_Message.prototype.initialize.call(this); + this._waitCount = 0; + this._encounterEffectDuration = 0; + this._mapLoaded = false; + this._touchCount = 0; + this._menuEnabled = false; +}; + +Scene_Map.prototype.create = function() { + Scene_Message.prototype.create.call(this); + this._transfer = $gamePlayer.isTransferring(); + this._lastMapWasNull = !$dataMap; + if (this._transfer) { + DataManager.loadMapData($gamePlayer.newMapId()); + this.onTransfer(); + } else { + DataManager.loadMapData($gameMap.mapId()); + } +}; + +Scene_Map.prototype.isReady = function() { + if (!this._mapLoaded && DataManager.isMapLoaded()) { + this.onMapLoaded(); + this._mapLoaded = true; + } + return this._mapLoaded && Scene_Message.prototype.isReady.call(this); +}; + +Scene_Map.prototype.onMapLoaded = function() { + if (this._transfer) { + $gamePlayer.performTransfer(); + } + this.createDisplayObjects(); +}; + +Scene_Map.prototype.onTransfer = function() { + ImageManager.clear(); + EffectManager.clear(); +}; + +Scene_Map.prototype.start = function() { + Scene_Message.prototype.start.call(this); + SceneManager.clearStack(); + if (this._transfer) { + this.fadeInForTransfer(); + this.onTransferEnd(); + } else if (this.needsFadeIn()) { + this.startFadeIn(this.fadeSpeed(), false); + } + this.menuCalling = false; +}; + +Scene_Map.prototype.onTransferEnd = function() { + this._mapNameWindow.open(); + $gameMap.autoplay(); + if (this.shouldAutosave()) { + this.requestAutosave(); + } +}; + +Scene_Map.prototype.shouldAutosave = function() { + return !this._lastMapWasNull; +}; + +Scene_Map.prototype.update = function() { + Scene_Message.prototype.update.call(this); + this.updateDestination(); + this.updateMenuButton(); + this.updateMapNameWindow(); + this.updateMainMultiply(); + if (this.isSceneChangeOk()) { + this.updateScene(); + } else if (SceneManager.isNextScene(Scene_Battle)) { + this.updateEncounterEffect(); + } + this.updateWaitCount(); +}; + +Scene_Map.prototype.updateMainMultiply = function() { + if (this.isFastForward()) { + this.cancelMessageWait(); + this.updateMain(); + } + this.updateMain(); +}; + +Scene_Map.prototype.updateMain = function() { + $gameMap.update(this.isActive()); + $gamePlayer.update(this.isPlayerActive()); + $gameTimer.update(this.isActive()); + $gameScreen.update(); +}; + +Scene_Map.prototype.isPlayerActive = function() { + return this.isActive() && !this.isFading(); +}; + +Scene_Map.prototype.isFastForward = function() { + return ( + $gameMap.isEventRunning() && + !SceneManager.isSceneChanging() && + (Input.isLongPressed("ok") || TouchInput.isLongPressed()) + ); +}; + +Scene_Map.prototype.stop = function() { + Scene_Message.prototype.stop.call(this); + $gamePlayer.straighten(); + this._mapNameWindow.close(); + if (this.needsSlowFadeOut()) { + this.startFadeOut(this.slowFadeSpeed(), false); + } else if (SceneManager.isNextScene(Scene_Map)) { + this.fadeOutForTransfer(); + } else if (SceneManager.isNextScene(Scene_Battle)) { + this.launchBattle(); + } +}; + +Scene_Map.prototype.isBusy = function() { + return ( + this.isMessageWindowClosing() || + this._waitCount > 0 || + this._encounterEffectDuration > 0 || + Scene_Message.prototype.isBusy.call(this) + ); +}; + +Scene_Map.prototype.terminate = function() { + Scene_Message.prototype.terminate.call(this); + if (!SceneManager.isNextScene(Scene_Battle)) { + this._spriteset.update(); + this._mapNameWindow.hide(); + this.hideMenuButton(); + SceneManager.snapForBackground(); + } + $gameScreen.clearZoom(); +}; + +Scene_Map.prototype.needsFadeIn = function() { + return ( + SceneManager.isPreviousScene(Scene_Battle) || + SceneManager.isPreviousScene(Scene_Load) + ); +}; + +Scene_Map.prototype.needsSlowFadeOut = function() { + return ( + SceneManager.isNextScene(Scene_Title) || + SceneManager.isNextScene(Scene_Gameover) + ); +}; + +Scene_Map.prototype.updateWaitCount = function() { + if (this._waitCount > 0) { + this._waitCount--; + return true; + } + return false; +}; + +Scene_Map.prototype.updateDestination = function() { + if (this.isMapTouchOk()) { + this.processMapTouch(); + } else { + $gameTemp.clearDestination(); + this._touchCount = 0; + } +}; + +Scene_Map.prototype.updateMenuButton = function() { + if (this._menuButton) { + const menuEnabled = this.isMenuEnabled(); + if (menuEnabled === this._menuEnabled) { + this._menuButton.visible = this._menuEnabled; + } else { + this._menuEnabled = menuEnabled; + } + } +}; + +Scene_Map.prototype.hideMenuButton = function() { + if (this._menuButton) { + this._menuButton.visible = false; + this._menuEnabled = false; + } +}; + +Scene_Map.prototype.updateMapNameWindow = function() { + if ($gameMessage.isBusy()) { + this._mapNameWindow.close(); + } +}; + +Scene_Map.prototype.isMenuEnabled = function() { + return $gameSystem.isMenuEnabled() && !$gameMap.isEventRunning(); +}; + +Scene_Map.prototype.isMapTouchOk = function() { + return this.isActive() && $gamePlayer.canMove(); +}; + +Scene_Map.prototype.processMapTouch = function() { + if (TouchInput.isTriggered() || this._touchCount > 0) { + if (TouchInput.isPressed() && !this.isAnyButtonPressed()) { + if (this._touchCount === 0 || this._touchCount >= 15) { + this.onMapTouch(); + } + this._touchCount++; + } else { + this._touchCount = 0; + } + } +}; + +Scene_Map.prototype.isAnyButtonPressed = function() { + return this._menuButton && this._menuButton.isPressed(); +}; + +Scene_Map.prototype.onMapTouch = function() { + const x = $gameMap.canvasToMapX(TouchInput.x); + const y = $gameMap.canvasToMapY(TouchInput.y); + $gameTemp.setDestination(x, y); +}; + +Scene_Map.prototype.isSceneChangeOk = function() { + return this.isActive() && !$gameMessage.isBusy(); +}; + +Scene_Map.prototype.updateScene = function() { + this.checkGameover(); + if (!SceneManager.isSceneChanging()) { + this.updateTransferPlayer(); + } + if (!SceneManager.isSceneChanging()) { + this.updateEncounter(); + } + if (!SceneManager.isSceneChanging()) { + this.updateCallMenu(); + } + if (!SceneManager.isSceneChanging()) { + this.updateCallDebug(); + } +}; + +Scene_Map.prototype.createDisplayObjects = function() { + this.createSpriteset(); + this.createWindowLayer(); + this.createAllWindows(); + this.createButtons(); +}; + +Scene_Map.prototype.createSpriteset = function() { + this._spriteset = new Spriteset_Map(); + this.addChild(this._spriteset); + this._spriteset.update(); +}; + +Scene_Map.prototype.createAllWindows = function() { + this.createMapNameWindow(); + Scene_Message.prototype.createAllWindows.call(this); +}; + +Scene_Map.prototype.createMapNameWindow = function() { + const rect = this.mapNameWindowRect(); + this._mapNameWindow = new Window_MapName(rect); + this.addWindow(this._mapNameWindow); +}; + +Scene_Map.prototype.mapNameWindowRect = function() { + const wx = 0; + const wy = 0; + const ww = 360; + const wh = this.calcWindowHeight(1, false); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Map.prototype.createButtons = function() { + if (ConfigManager.touchUI) { + this.createMenuButton(); + } +}; + +Scene_Map.prototype.createMenuButton = function() { + this._menuButton = new Sprite_Button("menu"); + this._menuButton.x = Graphics.boxWidth - this._menuButton.width - 4; + this._menuButton.y = this.buttonY(); + this._menuButton.visible = false; + this.addWindow(this._menuButton); +}; + +Scene_Map.prototype.updateTransferPlayer = function() { + if ($gamePlayer.isTransferring()) { + SceneManager.goto(Scene_Map); + } +}; + +Scene_Map.prototype.updateEncounter = function() { + if ($gamePlayer.executeEncounter()) { + SceneManager.push(Scene_Battle); + } +}; + +Scene_Map.prototype.updateCallMenu = function() { + if (this.isMenuEnabled()) { + if (this.isMenuCalled()) { + this.menuCalling = true; + } + if (this.menuCalling && !$gamePlayer.isMoving()) { + this.callMenu(); + } + } else { + this.menuCalling = false; + } +}; + +Scene_Map.prototype.isMenuCalled = function() { + return Input.isTriggered("menu") || TouchInput.isCancelled(); +}; + +Scene_Map.prototype.callMenu = function() { + SoundManager.playOk(); + SceneManager.push(Scene_Menu); + Window_MenuCommand.initCommandPosition(); + $gameTemp.clearDestination(); + this._mapNameWindow.hide(); + this._waitCount = 2; +}; + +Scene_Map.prototype.updateCallDebug = function() { + if (this.isDebugCalled()) { + SceneManager.push(Scene_Debug); + } +}; + +Scene_Map.prototype.isDebugCalled = function() { + return Input.isTriggered("debug") && $gameTemp.isPlaytest(); +}; + +Scene_Map.prototype.fadeInForTransfer = function() { + const fadeType = $gamePlayer.fadeType(); + switch (fadeType) { + case 0: + case 1: + this.startFadeIn(this.fadeSpeed(), fadeType === 1); + break; + } +}; + +Scene_Map.prototype.fadeOutForTransfer = function() { + const fadeType = $gamePlayer.fadeType(); + switch (fadeType) { + case 0: + case 1: + this.startFadeOut(this.fadeSpeed(), fadeType === 1); + break; + } +}; + +Scene_Map.prototype.launchBattle = function() { + BattleManager.saveBgmAndBgs(); + this.stopAudioOnBattleStart(); + SoundManager.playBattleStart(); + this.startEncounterEffect(); + this._mapNameWindow.hide(); +}; + +Scene_Map.prototype.stopAudioOnBattleStart = function() { + if (!AudioManager.isCurrentBgm($gameSystem.battleBgm())) { + AudioManager.stopBgm(); + } + AudioManager.stopBgs(); + AudioManager.stopMe(); + AudioManager.stopSe(); +}; + +Scene_Map.prototype.startEncounterEffect = function() { + this._spriteset.hideCharacters(); + this._encounterEffectDuration = this.encounterEffectSpeed(); +}; + +Scene_Map.prototype.updateEncounterEffect = function() { + if (this._encounterEffectDuration > 0) { + this._encounterEffectDuration--; + const speed = this.encounterEffectSpeed(); + const n = speed - this._encounterEffectDuration; + const p = n / speed; + const q = ((p - 1) * 20 * p + 5) * p + 1; + const zoomX = $gamePlayer.screenX(); + const zoomY = $gamePlayer.screenY() - 24; + if (n === 2) { + $gameScreen.setZoom(zoomX, zoomY, 1); + this.snapForBattleBackground(); + this.startFlashForEncounter(speed / 2); + } + $gameScreen.setZoom(zoomX, zoomY, q); + if (n === Math.floor(speed / 6)) { + this.startFlashForEncounter(speed / 2); + } + if (n === Math.floor(speed / 2)) { + BattleManager.playBattleBgm(); + this.startFadeOut(this.fadeSpeed()); + } + } +}; + +Scene_Map.prototype.snapForBattleBackground = function() { + this._windowLayer.visible = false; + SceneManager.snapForBackground(); + this._windowLayer.visible = true; +}; + +Scene_Map.prototype.startFlashForEncounter = function(duration) { + const color = [255, 255, 255, 255]; + $gameScreen.startFlash(color, duration); +}; + +Scene_Map.prototype.encounterEffectSpeed = function() { + return 60; +}; + +//----------------------------------------------------------------------------- +// Scene_MenuBase +// +// The superclass of all the menu-type scenes. + +function Scene_MenuBase() { + this.initialize(...arguments); +} + +Scene_MenuBase.prototype = Object.create(Scene_Base.prototype); +Scene_MenuBase.prototype.constructor = Scene_MenuBase; + +Scene_MenuBase.prototype.initialize = function() { + Scene_Base.prototype.initialize.call(this); +}; + +Scene_MenuBase.prototype.create = function() { + Scene_Base.prototype.create.call(this); + this.createBackground(); + this.updateActor(); + this.createWindowLayer(); + this.createButtons(); +}; + +Scene_MenuBase.prototype.update = function() { + Scene_Base.prototype.update.call(this); + this.updatePageButtons(); +}; + +Scene_MenuBase.prototype.helpAreaTop = function() { + if (this.isBottomHelpMode()) { + return this.mainAreaBottom(); + } else if (this.isBottomButtonMode()) { + return 0; + } else { + return this.buttonAreaBottom(); + } +}; + +Scene_MenuBase.prototype.helpAreaBottom = function() { + return this.helpAreaTop() + this.helpAreaHeight(); +}; + +Scene_MenuBase.prototype.helpAreaHeight = function() { + return this.calcWindowHeight(2, false); +}; + +Scene_MenuBase.prototype.mainAreaTop = function() { + if (!this.isBottomHelpMode()) { + return this.helpAreaBottom(); + } else if (this.isBottomButtonMode()) { + return 0; + } else { + return this.buttonAreaBottom(); + } +}; + +Scene_MenuBase.prototype.mainAreaBottom = function() { + return this.mainAreaTop() + this.mainAreaHeight(); +}; + +Scene_MenuBase.prototype.mainAreaHeight = function() { + return Graphics.boxHeight - this.buttonAreaHeight() - this.helpAreaHeight(); +}; + +Scene_MenuBase.prototype.actor = function() { + return this._actor; +}; + +Scene_MenuBase.prototype.updateActor = function() { + this._actor = $gameParty.menuActor(); +}; + +Scene_MenuBase.prototype.createBackground = function() { + this._backgroundFilter = new PIXI.filters.BlurFilter(); + this._backgroundSprite = new Sprite(); + this._backgroundSprite.bitmap = SceneManager.backgroundBitmap(); + this._backgroundSprite.filters = [this._backgroundFilter]; + this.addChild(this._backgroundSprite); + this.setBackgroundOpacity(192); +}; + +Scene_MenuBase.prototype.setBackgroundOpacity = function(opacity) { + this._backgroundSprite.opacity = opacity; +}; + +Scene_MenuBase.prototype.createHelpWindow = function() { + const rect = this.helpWindowRect(); + this._helpWindow = new Window_Help(rect); + this.addWindow(this._helpWindow); +}; + +Scene_MenuBase.prototype.helpWindowRect = function() { + const wx = 0; + const wy = this.helpAreaTop(); + const ww = Graphics.boxWidth; + const wh = this.helpAreaHeight(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_MenuBase.prototype.createButtons = function() { + if (ConfigManager.touchUI) { + if (this.needsCancelButton()) { + this.createCancelButton(); + } + if (this.needsPageButtons()) { + this.createPageButtons(); + } + } +}; + +Scene_MenuBase.prototype.needsCancelButton = function() { + return true; +}; + +Scene_MenuBase.prototype.createCancelButton = function() { + this._cancelButton = new Sprite_Button("cancel"); + this._cancelButton.x = Graphics.boxWidth - this._cancelButton.width - 4; + this._cancelButton.y = this.buttonY(); + this.addWindow(this._cancelButton); +}; + +Scene_MenuBase.prototype.needsPageButtons = function() { + return false; +}; + +Scene_MenuBase.prototype.createPageButtons = function() { + this._pageupButton = new Sprite_Button("pageup"); + this._pageupButton.x = 4; + this._pageupButton.y = this.buttonY(); + const pageupRight = this._pageupButton.x + this._pageupButton.width; + this._pagedownButton = new Sprite_Button("pagedown"); + this._pagedownButton.x = pageupRight + 4; + this._pagedownButton.y = this.buttonY(); + this.addWindow(this._pageupButton); + this.addWindow(this._pagedownButton); + this._pageupButton.setClickHandler(this.previousActor.bind(this)); + this._pagedownButton.setClickHandler(this.nextActor.bind(this)); +}; + +Scene_MenuBase.prototype.updatePageButtons = function() { + if (this._pageupButton && this._pagedownButton) { + const enabled = this.arePageButtonsEnabled(); + this._pageupButton.visible = enabled; + this._pagedownButton.visible = enabled; + } +}; + +Scene_MenuBase.prototype.arePageButtonsEnabled = function() { + return true; +}; + +Scene_MenuBase.prototype.nextActor = function() { + $gameParty.makeMenuActorNext(); + this.updateActor(); + this.onActorChange(); +}; + +Scene_MenuBase.prototype.previousActor = function() { + $gameParty.makeMenuActorPrevious(); + this.updateActor(); + this.onActorChange(); +}; + +Scene_MenuBase.prototype.onActorChange = function() { + SoundManager.playCursor(); +}; + +//----------------------------------------------------------------------------- +// Scene_Menu +// +// The scene class of the menu screen. + +function Scene_Menu() { + this.initialize(...arguments); +} + +Scene_Menu.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Menu.prototype.constructor = Scene_Menu; + +Scene_Menu.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Menu.prototype.helpAreaHeight = function() { + return 0; +}; + +Scene_Menu.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createCommandWindow(); + this.createGoldWindow(); + this.createStatusWindow(); +}; + +Scene_Menu.prototype.start = function() { + Scene_MenuBase.prototype.start.call(this); + this._statusWindow.refresh(); +}; + +Scene_Menu.prototype.createCommandWindow = function() { + const rect = this.commandWindowRect(); + const commandWindow = new Window_MenuCommand(rect); + commandWindow.setHandler("item", this.commandItem.bind(this)); + commandWindow.setHandler("skill", this.commandPersonal.bind(this)); + commandWindow.setHandler("equip", this.commandPersonal.bind(this)); + commandWindow.setHandler("status", this.commandPersonal.bind(this)); + commandWindow.setHandler("formation", this.commandFormation.bind(this)); + commandWindow.setHandler("options", this.commandOptions.bind(this)); + commandWindow.setHandler("save", this.commandSave.bind(this)); + commandWindow.setHandler("gameEnd", this.commandGameEnd.bind(this)); + commandWindow.setHandler("cancel", this.popScene.bind(this)); + this.addWindow(commandWindow); + this._commandWindow = commandWindow; +}; + +Scene_Menu.prototype.commandWindowRect = function() { + const ww = this.mainCommandWidth(); + const wh = this.mainAreaHeight() - this.goldWindowRect().height; + const wx = this.isRightInputMode() ? Graphics.boxWidth - ww : 0; + const wy = this.mainAreaTop(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Menu.prototype.createGoldWindow = function() { + const rect = this.goldWindowRect(); + this._goldWindow = new Window_Gold(rect); + this.addWindow(this._goldWindow); +}; + +Scene_Menu.prototype.goldWindowRect = function() { + const ww = this.mainCommandWidth(); + const wh = this.calcWindowHeight(1, true); + const wx = this.isRightInputMode() ? Graphics.boxWidth - ww : 0; + const wy = this.mainAreaBottom() - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Menu.prototype.createStatusWindow = function() { + const rect = this.statusWindowRect(); + this._statusWindow = new Window_MenuStatus(rect); + this.addWindow(this._statusWindow); +}; + +Scene_Menu.prototype.statusWindowRect = function() { + const ww = Graphics.boxWidth - this.mainCommandWidth(); + const wh = this.mainAreaHeight(); + const wx = this.isRightInputMode() ? 0 : Graphics.boxWidth - ww; + const wy = this.mainAreaTop(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Menu.prototype.commandItem = function() { + SceneManager.push(Scene_Item); +}; + +Scene_Menu.prototype.commandPersonal = function() { + this._statusWindow.setFormationMode(false); + this._statusWindow.selectLast(); + this._statusWindow.activate(); + this._statusWindow.setHandler("ok", this.onPersonalOk.bind(this)); + this._statusWindow.setHandler("cancel", this.onPersonalCancel.bind(this)); +}; + +Scene_Menu.prototype.commandFormation = function() { + this._statusWindow.setFormationMode(true); + this._statusWindow.selectLast(); + this._statusWindow.activate(); + this._statusWindow.setHandler("ok", this.onFormationOk.bind(this)); + this._statusWindow.setHandler("cancel", this.onFormationCancel.bind(this)); +}; + +Scene_Menu.prototype.commandOptions = function() { + SceneManager.push(Scene_Options); +}; + +Scene_Menu.prototype.commandSave = function() { + SceneManager.push(Scene_Save); +}; + +Scene_Menu.prototype.commandGameEnd = function() { + SceneManager.push(Scene_GameEnd); +}; + +Scene_Menu.prototype.onPersonalOk = function() { + switch (this._commandWindow.currentSymbol()) { + case "skill": + SceneManager.push(Scene_Skill); + break; + case "equip": + SceneManager.push(Scene_Equip); + break; + case "status": + SceneManager.push(Scene_Status); + break; + } +}; + +Scene_Menu.prototype.onPersonalCancel = function() { + this._statusWindow.deselect(); + this._commandWindow.activate(); +}; + +Scene_Menu.prototype.onFormationOk = function() { + const index = this._statusWindow.index(); + const pendingIndex = this._statusWindow.pendingIndex(); + if (pendingIndex >= 0) { + $gameParty.swapOrder(index, pendingIndex); + this._statusWindow.setPendingIndex(-1); + this._statusWindow.redrawItem(index); + } else { + this._statusWindow.setPendingIndex(index); + } + this._statusWindow.activate(); +}; + +Scene_Menu.prototype.onFormationCancel = function() { + if (this._statusWindow.pendingIndex() >= 0) { + this._statusWindow.setPendingIndex(-1); + this._statusWindow.activate(); + } else { + this._statusWindow.deselect(); + this._commandWindow.activate(); + } +}; + +//----------------------------------------------------------------------------- +// Scene_ItemBase +// +// The superclass of Scene_Item and Scene_Skill. + +function Scene_ItemBase() { + this.initialize(...arguments); +} + +Scene_ItemBase.prototype = Object.create(Scene_MenuBase.prototype); +Scene_ItemBase.prototype.constructor = Scene_ItemBase; + +Scene_ItemBase.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_ItemBase.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); +}; + +Scene_ItemBase.prototype.createActorWindow = function() { + const rect = this.actorWindowRect(); + this._actorWindow = new Window_MenuActor(rect); + this._actorWindow.setHandler("ok", this.onActorOk.bind(this)); + this._actorWindow.setHandler("cancel", this.onActorCancel.bind(this)); + this.addWindow(this._actorWindow); +}; + +Scene_ItemBase.prototype.actorWindowRect = function() { + const wx = 0; + const wy = Math.min(this.mainAreaTop(), this.helpAreaTop()); + const ww = Graphics.boxWidth - this.mainCommandWidth(); + const wh = this.mainAreaHeight() + this.helpAreaHeight(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_ItemBase.prototype.item = function() { + return this._itemWindow.item(); +}; + +Scene_ItemBase.prototype.user = function() { + return null; +}; + +Scene_ItemBase.prototype.isCursorLeft = function() { + return this._itemWindow.index() % 2 === 0; +}; + +Scene_ItemBase.prototype.showActorWindow = function() { + if (this.isCursorLeft()) { + this._actorWindow.x = Graphics.boxWidth - this._actorWindow.width; + } else { + this._actorWindow.x = 0; + } + this._actorWindow.show(); + this._actorWindow.activate(); +}; + +Scene_ItemBase.prototype.hideActorWindow = function() { + this._actorWindow.hide(); + this._actorWindow.deactivate(); +}; + +Scene_ItemBase.prototype.isActorWindowActive = function() { + return this._actorWindow && this._actorWindow.active; +}; + +Scene_ItemBase.prototype.onActorOk = function() { + if (this.canUse()) { + this.useItem(); + } else { + SoundManager.playBuzzer(); + } +}; + +Scene_ItemBase.prototype.onActorCancel = function() { + this.hideActorWindow(); + this.activateItemWindow(); +}; + +Scene_ItemBase.prototype.determineItem = function() { + const action = new Game_Action(this.user()); + const item = this.item(); + action.setItemObject(item); + if (action.isForFriend()) { + this.showActorWindow(); + this._actorWindow.selectForItem(this.item()); + } else { + this.useItem(); + this.activateItemWindow(); + } +}; + +Scene_ItemBase.prototype.useItem = function() { + this.playSeForItem(); + this.user().useItem(this.item()); + this.applyItem(); + this.checkCommonEvent(); + this.checkGameover(); + this._actorWindow.refresh(); +}; + +Scene_ItemBase.prototype.activateItemWindow = function() { + this._itemWindow.refresh(); + this._itemWindow.activate(); +}; + +Scene_ItemBase.prototype.itemTargetActors = function() { + const action = new Game_Action(this.user()); + action.setItemObject(this.item()); + if (!action.isForFriend()) { + return []; + } else if (action.isForAll()) { + return $gameParty.members(); + } else { + return [$gameParty.members()[this._actorWindow.index()]]; + } +}; + +Scene_ItemBase.prototype.canUse = function() { + const user = this.user(); + return user && user.canUse(this.item()) && this.isItemEffectsValid(); +}; + +Scene_ItemBase.prototype.isItemEffectsValid = function() { + const action = new Game_Action(this.user()); + action.setItemObject(this.item()); + return this.itemTargetActors().some(target => action.testApply(target)); +}; + +Scene_ItemBase.prototype.applyItem = function() { + const action = new Game_Action(this.user()); + action.setItemObject(this.item()); + for (const target of this.itemTargetActors()) { + for (let i = 0; i < action.numRepeats(); i++) { + action.apply(target); + } + } + action.applyGlobal(); +}; + +Scene_ItemBase.prototype.checkCommonEvent = function() { + if ($gameTemp.isCommonEventReserved()) { + SceneManager.goto(Scene_Map); + } +}; + +//----------------------------------------------------------------------------- +// Scene_Item +// +// The scene class of the item screen. + +function Scene_Item() { + this.initialize(...arguments); +} + +Scene_Item.prototype = Object.create(Scene_ItemBase.prototype); +Scene_Item.prototype.constructor = Scene_Item; + +Scene_Item.prototype.initialize = function() { + Scene_ItemBase.prototype.initialize.call(this); +}; + +Scene_Item.prototype.create = function() { + Scene_ItemBase.prototype.create.call(this); + this.createHelpWindow(); + this.createCategoryWindow(); + this.createItemWindow(); + this.createActorWindow(); +}; + +Scene_Item.prototype.createCategoryWindow = function() { + const rect = this.categoryWindowRect(); + this._categoryWindow = new Window_ItemCategory(rect); + this._categoryWindow.setHelpWindow(this._helpWindow); + this._categoryWindow.setHandler("ok", this.onCategoryOk.bind(this)); + this._categoryWindow.setHandler("cancel", this.popScene.bind(this)); + this.addWindow(this._categoryWindow); +}; + +Scene_Item.prototype.categoryWindowRect = function() { + const wx = 0; + const wy = this.mainAreaTop(); + const ww = Graphics.boxWidth; + const wh = this.calcWindowHeight(1, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Item.prototype.createItemWindow = function() { + const rect = this.itemWindowRect(); + this._itemWindow = new Window_ItemList(rect); + this._itemWindow.setHelpWindow(this._helpWindow); + this._itemWindow.setHandler("ok", this.onItemOk.bind(this)); + this._itemWindow.setHandler("cancel", this.onItemCancel.bind(this)); + this.addWindow(this._itemWindow); + this._categoryWindow.setItemWindow(this._itemWindow); + if (!this._categoryWindow.needsSelection()) { + this._itemWindow.y -= this._categoryWindow.height; + this._itemWindow.height += this._categoryWindow.height; + this._itemWindow.createContents(); + this._categoryWindow.update(); + this._categoryWindow.hide(); + this._categoryWindow.deactivate(); + this.onCategoryOk(); + } +}; + +Scene_Item.prototype.itemWindowRect = function() { + const wx = 0; + const wy = this._categoryWindow.y + this._categoryWindow.height; + const ww = Graphics.boxWidth; + const wh = this.mainAreaBottom() - wy; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Item.prototype.user = function() { + const members = $gameParty.movableMembers(); + const bestPha = Math.max(...members.map(member => member.pha)); + return members.find(member => member.pha === bestPha); +}; + +Scene_Item.prototype.onCategoryOk = function() { + this._itemWindow.activate(); + this._itemWindow.selectLast(); +}; + +Scene_Item.prototype.onItemOk = function() { + $gameParty.setLastItem(this.item()); + this.determineItem(); +}; + +Scene_Item.prototype.onItemCancel = function() { + if (this._categoryWindow.needsSelection()) { + this._itemWindow.deselect(); + this._categoryWindow.activate(); + } else { + this.popScene(); + } +}; + +Scene_Item.prototype.playSeForItem = function() { + SoundManager.playUseItem(); +}; + +Scene_Item.prototype.useItem = function() { + Scene_ItemBase.prototype.useItem.call(this); + this._itemWindow.redrawCurrentItem(); +}; + +//----------------------------------------------------------------------------- +// Scene_Skill +// +// The scene class of the skill screen. + +function Scene_Skill() { + this.initialize(...arguments); +} + +Scene_Skill.prototype = Object.create(Scene_ItemBase.prototype); +Scene_Skill.prototype.constructor = Scene_Skill; + +Scene_Skill.prototype.initialize = function() { + Scene_ItemBase.prototype.initialize.call(this); +}; + +Scene_Skill.prototype.create = function() { + Scene_ItemBase.prototype.create.call(this); + this.createHelpWindow(); + this.createSkillTypeWindow(); + this.createStatusWindow(); + this.createItemWindow(); + this.createActorWindow(); +}; + +Scene_Skill.prototype.start = function() { + Scene_ItemBase.prototype.start.call(this); + this.refreshActor(); +}; + +Scene_Skill.prototype.createSkillTypeWindow = function() { + const rect = this.skillTypeWindowRect(); + this._skillTypeWindow = new Window_SkillType(rect); + this._skillTypeWindow.setHelpWindow(this._helpWindow); + this._skillTypeWindow.setHandler("skill", this.commandSkill.bind(this)); + this._skillTypeWindow.setHandler("cancel", this.popScene.bind(this)); + this._skillTypeWindow.setHandler("pagedown", this.nextActor.bind(this)); + this._skillTypeWindow.setHandler("pageup", this.previousActor.bind(this)); + this.addWindow(this._skillTypeWindow); +}; + +Scene_Skill.prototype.skillTypeWindowRect = function() { + const ww = this.mainCommandWidth(); + const wh = this.calcWindowHeight(3, true); + const wx = this.isRightInputMode() ? Graphics.boxWidth - ww : 0; + const wy = this.mainAreaTop(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Skill.prototype.createStatusWindow = function() { + const rect = this.statusWindowRect(); + this._statusWindow = new Window_SkillStatus(rect); + this.addWindow(this._statusWindow); +}; + +Scene_Skill.prototype.statusWindowRect = function() { + const ww = Graphics.boxWidth - this.mainCommandWidth(); + const wh = this._skillTypeWindow.height; + const wx = this.isRightInputMode() ? 0 : Graphics.boxWidth - ww; + const wy = this.mainAreaTop(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Skill.prototype.createItemWindow = function() { + const rect = this.itemWindowRect(); + this._itemWindow = new Window_SkillList(rect); + this._itemWindow.setHelpWindow(this._helpWindow); + this._itemWindow.setHandler("ok", this.onItemOk.bind(this)); + this._itemWindow.setHandler("cancel", this.onItemCancel.bind(this)); + this._skillTypeWindow.setSkillWindow(this._itemWindow); + this.addWindow(this._itemWindow); +}; + +Scene_Skill.prototype.itemWindowRect = function() { + const wx = 0; + const wy = this._statusWindow.y + this._statusWindow.height; + const ww = Graphics.boxWidth; + const wh = this.mainAreaHeight() - this._statusWindow.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Skill.prototype.needsPageButtons = function() { + return true; +}; + +Scene_Skill.prototype.arePageButtonsEnabled = function() { + return !this.isActorWindowActive(); +}; + +Scene_Skill.prototype.refreshActor = function() { + const actor = this.actor(); + this._skillTypeWindow.setActor(actor); + this._statusWindow.setActor(actor); + this._itemWindow.setActor(actor); +}; + +Scene_Skill.prototype.user = function() { + return this.actor(); +}; + +Scene_Skill.prototype.commandSkill = function() { + this._itemWindow.activate(); + this._itemWindow.selectLast(); +}; + +Scene_Skill.prototype.onItemOk = function() { + this.actor().setLastMenuSkill(this.item()); + this.determineItem(); +}; + +Scene_Skill.prototype.onItemCancel = function() { + this._itemWindow.deselect(); + this._skillTypeWindow.activate(); +}; + +Scene_Skill.prototype.playSeForItem = function() { + SoundManager.playUseSkill(); +}; + +Scene_Skill.prototype.useItem = function() { + Scene_ItemBase.prototype.useItem.call(this); + this._statusWindow.refresh(); + this._itemWindow.refresh(); +}; + +Scene_Skill.prototype.onActorChange = function() { + Scene_MenuBase.prototype.onActorChange.call(this); + this.refreshActor(); + this._itemWindow.deselect(); + this._skillTypeWindow.activate(); +}; + +//----------------------------------------------------------------------------- +// Scene_Equip +// +// The scene class of the equipment screen. + +function Scene_Equip() { + this.initialize(...arguments); +} + +Scene_Equip.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Equip.prototype.constructor = Scene_Equip; + +Scene_Equip.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Equip.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createHelpWindow(); + this.createStatusWindow(); + this.createCommandWindow(); + this.createSlotWindow(); + this.createItemWindow(); + this.refreshActor(); +}; + +Scene_Equip.prototype.createStatusWindow = function() { + const rect = this.statusWindowRect(); + this._statusWindow = new Window_EquipStatus(rect); + this.addWindow(this._statusWindow); +}; + +Scene_Equip.prototype.statusWindowRect = function() { + const wx = 0; + const wy = this.mainAreaTop(); + const ww = this.statusWidth(); + const wh = this.mainAreaHeight(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Equip.prototype.createCommandWindow = function() { + const rect = this.commandWindowRect(); + this._commandWindow = new Window_EquipCommand(rect); + this._commandWindow.setHelpWindow(this._helpWindow); + this._commandWindow.setHandler("equip", this.commandEquip.bind(this)); + this._commandWindow.setHandler("optimize", this.commandOptimize.bind(this)); + this._commandWindow.setHandler("clear", this.commandClear.bind(this)); + this._commandWindow.setHandler("cancel", this.popScene.bind(this)); + this._commandWindow.setHandler("pagedown", this.nextActor.bind(this)); + this._commandWindow.setHandler("pageup", this.previousActor.bind(this)); + this.addWindow(this._commandWindow); +}; + +Scene_Equip.prototype.commandWindowRect = function() { + const wx = this.statusWidth(); + const wy = this.mainAreaTop(); + const ww = Graphics.boxWidth - this.statusWidth(); + const wh = this.calcWindowHeight(1, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Equip.prototype.createSlotWindow = function() { + const rect = this.slotWindowRect(); + this._slotWindow = new Window_EquipSlot(rect); + this._slotWindow.setHelpWindow(this._helpWindow); + this._slotWindow.setStatusWindow(this._statusWindow); + this._slotWindow.setHandler("ok", this.onSlotOk.bind(this)); + this._slotWindow.setHandler("cancel", this.onSlotCancel.bind(this)); + this.addWindow(this._slotWindow); +}; + +Scene_Equip.prototype.slotWindowRect = function() { + const commandWindowRect = this.commandWindowRect(); + const wx = this.statusWidth(); + const wy = commandWindowRect.y + commandWindowRect.height; + const ww = Graphics.boxWidth - this.statusWidth(); + const wh = this.mainAreaHeight() - commandWindowRect.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Equip.prototype.createItemWindow = function() { + const rect = this.itemWindowRect(); + this._itemWindow = new Window_EquipItem(rect); + this._itemWindow.setHelpWindow(this._helpWindow); + this._itemWindow.setStatusWindow(this._statusWindow); + this._itemWindow.setHandler("ok", this.onItemOk.bind(this)); + this._itemWindow.setHandler("cancel", this.onItemCancel.bind(this)); + this._itemWindow.hide(); + this._slotWindow.setItemWindow(this._itemWindow); + this.addWindow(this._itemWindow); +}; + +Scene_Equip.prototype.itemWindowRect = function() { + return this.slotWindowRect(); +}; + +Scene_Equip.prototype.statusWidth = function() { + return 312; +}; + +Scene_Equip.prototype.needsPageButtons = function() { + return true; +}; + +Scene_Equip.prototype.arePageButtonsEnabled = function() { + return !(this._itemWindow && this._itemWindow.active); +}; + +Scene_Equip.prototype.refreshActor = function() { + const actor = this.actor(); + this._statusWindow.setActor(actor); + this._slotWindow.setActor(actor); + this._itemWindow.setActor(actor); +}; + +Scene_Equip.prototype.commandEquip = function() { + this._slotWindow.activate(); + this._slotWindow.select(0); +}; + +Scene_Equip.prototype.commandOptimize = function() { + SoundManager.playEquip(); + this.actor().optimizeEquipments(); + this._statusWindow.refresh(); + this._slotWindow.refresh(); + this._commandWindow.activate(); +}; + +Scene_Equip.prototype.commandClear = function() { + SoundManager.playEquip(); + this.actor().clearEquipments(); + this._statusWindow.refresh(); + this._slotWindow.refresh(); + this._commandWindow.activate(); +}; + +Scene_Equip.prototype.onSlotOk = function() { + this._slotWindow.hide(); + this._itemWindow.show(); + this._itemWindow.activate(); + this._itemWindow.forceSelect(0); +}; + +Scene_Equip.prototype.onSlotCancel = function() { + this._slotWindow.deselect(); + this._commandWindow.activate(); +}; + +Scene_Equip.prototype.onItemOk = function() { + SoundManager.playEquip(); + this.executeEquipChange(); + this.hideItemWindow(); + this._slotWindow.refresh(); + this._itemWindow.refresh(); + this._statusWindow.refresh(); +}; + +Scene_Equip.prototype.executeEquipChange = function() { + const actor = this.actor(); + const slotId = this._slotWindow.index(); + const item = this._itemWindow.item(); + actor.changeEquip(slotId, item); +}; + +Scene_Equip.prototype.onItemCancel = function() { + this.hideItemWindow(); +}; + +Scene_Equip.prototype.onActorChange = function() { + Scene_MenuBase.prototype.onActorChange.call(this); + this.refreshActor(); + this.hideItemWindow(); + this._slotWindow.deselect(); + this._slotWindow.deactivate(); + this._commandWindow.activate(); +}; + +Scene_Equip.prototype.hideItemWindow = function() { + this._slotWindow.show(); + this._slotWindow.activate(); + this._itemWindow.hide(); + this._itemWindow.deselect(); +}; + +//----------------------------------------------------------------------------- +// Scene_Status +// +// The scene class of the status screen. + +function Scene_Status() { + this.initialize(...arguments); +} + +Scene_Status.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Status.prototype.constructor = Scene_Status; + +Scene_Status.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Status.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createProfileWindow(); + this.createStatusWindow(); + this.createStatusParamsWindow(); + this.createStatusEquipWindow(); +}; + +Scene_Status.prototype.helpAreaHeight = function() { + return 0; +}; + +Scene_Status.prototype.createProfileWindow = function() { + const rect = this.profileWindowRect(); + this._profileWindow = new Window_Help(rect); + this.addWindow(this._profileWindow); +}; + +Scene_Status.prototype.profileWindowRect = function() { + const ww = Graphics.boxWidth; + const wh = this.profileHeight(); + const wx = 0; + const wy = this.mainAreaBottom() - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Status.prototype.createStatusWindow = function() { + const rect = this.statusWindowRect(); + this._statusWindow = new Window_Status(rect); + this._statusWindow.setHandler("cancel", this.popScene.bind(this)); + this._statusWindow.setHandler("pagedown", this.nextActor.bind(this)); + this._statusWindow.setHandler("pageup", this.previousActor.bind(this)); + this.addWindow(this._statusWindow); +}; + +Scene_Status.prototype.statusWindowRect = function() { + const wx = 0; + const wy = this.mainAreaTop(); + const ww = Graphics.boxWidth; + const wh = this.statusParamsWindowRect().y - wy; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Status.prototype.createStatusParamsWindow = function() { + const rect = this.statusParamsWindowRect(); + this._statusParamsWindow = new Window_StatusParams(rect); + this.addWindow(this._statusParamsWindow); +}; + +Scene_Status.prototype.statusParamsWindowRect = function() { + const ww = this.statusParamsWidth(); + const wh = this.statusParamsHeight(); + const wx = 0; + const wy = this.mainAreaBottom() - this.profileHeight() - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Status.prototype.createStatusEquipWindow = function() { + const rect = this.statusEquipWindowRect(); + this._statusEquipWindow = new Window_StatusEquip(rect); + this.addWindow(this._statusEquipWindow); +}; + +Scene_Status.prototype.statusEquipWindowRect = function() { + const ww = Graphics.boxWidth - this.statusParamsWidth(); + const wh = this.statusParamsHeight(); + const wx = this.statusParamsWidth(); + const wy = this.mainAreaBottom() - this.profileHeight() - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Status.prototype.statusParamsWidth = function() { + return 300; +}; + +Scene_Status.prototype.statusParamsHeight = function() { + return this.calcWindowHeight(6, false); +}; + +Scene_Status.prototype.profileHeight = function() { + return this.calcWindowHeight(2, false); +}; + +Scene_Status.prototype.start = function() { + Scene_MenuBase.prototype.start.call(this); + this.refreshActor(); +}; + +Scene_Status.prototype.needsPageButtons = function() { + return true; +}; + +Scene_Status.prototype.refreshActor = function() { + const actor = this.actor(); + this._profileWindow.setText(actor.profile()); + this._statusWindow.setActor(actor); + this._statusParamsWindow.setActor(actor); + this._statusEquipWindow.setActor(actor); +}; + +Scene_Status.prototype.onActorChange = function() { + Scene_MenuBase.prototype.onActorChange.call(this); + this.refreshActor(); + this._statusWindow.activate(); +}; + +//----------------------------------------------------------------------------- +// Scene_Options +// +// The scene class of the options screen. + +function Scene_Options() { + this.initialize(...arguments); +} + +Scene_Options.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Options.prototype.constructor = Scene_Options; + +Scene_Options.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Options.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createOptionsWindow(); +}; + +Scene_Options.prototype.terminate = function() { + Scene_MenuBase.prototype.terminate.call(this); + ConfigManager.save(); +}; + +Scene_Options.prototype.createOptionsWindow = function() { + const rect = this.optionsWindowRect(); + this._optionsWindow = new Window_Options(rect); + this._optionsWindow.setHandler("cancel", this.popScene.bind(this)); + this.addWindow(this._optionsWindow); +}; + +Scene_Options.prototype.optionsWindowRect = function() { + const n = Math.min(this.maxCommands(), this.maxVisibleCommands()); + const ww = 400; + const wh = this.calcWindowHeight(n, true); + const wx = (Graphics.boxWidth - ww) / 2; + const wy = (Graphics.boxHeight - wh) / 2; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Options.prototype.maxCommands = function() { + // Increase this value when adding option items. + return 7; +}; + +Scene_Options.prototype.maxVisibleCommands = function() { + return 12; +}; + +//----------------------------------------------------------------------------- +// Scene_File +// +// The superclass of Scene_Save and Scene_Load. + +function Scene_File() { + this.initialize(...arguments); +} + +Scene_File.prototype = Object.create(Scene_MenuBase.prototype); +Scene_File.prototype.constructor = Scene_File; + +Scene_File.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_File.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + DataManager.loadAllSavefileImages(); + this.createHelpWindow(); + this.createListWindow(); + this._helpWindow.setText(this.helpWindowText()); +}; + +Scene_File.prototype.helpAreaHeight = function() { + return 0; +}; + +Scene_File.prototype.start = function() { + Scene_MenuBase.prototype.start.call(this); + this._listWindow.refresh(); +}; + +Scene_File.prototype.savefileId = function() { + return this._listWindow.savefileId(); +}; + +Scene_File.prototype.isSavefileEnabled = function(savefileId) { + return this._listWindow.isEnabled(savefileId); +}; + +Scene_File.prototype.createHelpWindow = function() { + const rect = this.helpWindowRect(); + this._helpWindow = new Window_Help(rect); + this.addWindow(this._helpWindow); +}; + +Scene_File.prototype.helpWindowRect = function() { + const wx = 0; + const wy = this.mainAreaTop(); + const ww = Graphics.boxWidth; + const wh = this.calcWindowHeight(1, false); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_File.prototype.createListWindow = function() { + const rect = this.listWindowRect(); + this._listWindow = new Window_SavefileList(rect); + this._listWindow.setHandler("ok", this.onSavefileOk.bind(this)); + this._listWindow.setHandler("cancel", this.popScene.bind(this)); + this._listWindow.setMode(this.mode(), this.needsAutosave()); + this._listWindow.selectSavefile(this.firstSavefileId()); + this._listWindow.refresh(); + this.addWindow(this._listWindow); +}; + +Scene_File.prototype.listWindowRect = function() { + const wx = 0; + const wy = this.mainAreaTop() + this._helpWindow.height; + const ww = Graphics.boxWidth; + const wh = this.mainAreaHeight() - this._helpWindow.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_File.prototype.mode = function() { + return null; +}; + +Scene_File.prototype.needsAutosave = function() { + return $gameSystem.isAutosaveEnabled(); +}; + +Scene_File.prototype.activateListWindow = function() { + this._listWindow.activate(); +}; + +Scene_File.prototype.helpWindowText = function() { + return ""; +}; + +Scene_File.prototype.firstSavefileId = function() { + return 0; +}; + +Scene_File.prototype.onSavefileOk = function() { + // +}; + +//----------------------------------------------------------------------------- +// Scene_Save +// +// The scene class of the save screen. + +function Scene_Save() { + this.initialize(...arguments); +} + +Scene_Save.prototype = Object.create(Scene_File.prototype); +Scene_Save.prototype.constructor = Scene_Save; + +Scene_Save.prototype.initialize = function() { + Scene_File.prototype.initialize.call(this); +}; + +Scene_Save.prototype.mode = function() { + return "save"; +}; + +Scene_Save.prototype.helpWindowText = function() { + return TextManager.saveMessage; +}; + +Scene_Save.prototype.firstSavefileId = function() { + return $gameSystem.savefileId(); +}; + +Scene_Save.prototype.onSavefileOk = function() { + Scene_File.prototype.onSavefileOk.call(this); + const savefileId = this.savefileId(); + if (this.isSavefileEnabled(savefileId)) { + this.executeSave(savefileId); + } else { + this.onSaveFailure(); + } +}; + +Scene_Save.prototype.executeSave = function(savefileId) { + $gameSystem.setSavefileId(savefileId); + $gameSystem.onBeforeSave(); + DataManager.saveGame(savefileId) + .then(() => this.onSaveSuccess()) + .catch(() => this.onSaveFailure()); +}; + +Scene_Save.prototype.onSaveSuccess = function() { + SoundManager.playSave(); + this.popScene(); +}; + +Scene_Save.prototype.onSaveFailure = function() { + SoundManager.playBuzzer(); + this.activateListWindow(); +}; + +//----------------------------------------------------------------------------- +// Scene_Load +// +// The scene class of the load screen. + +function Scene_Load() { + this.initialize(...arguments); +} + +Scene_Load.prototype = Object.create(Scene_File.prototype); +Scene_Load.prototype.constructor = Scene_Load; + +Scene_Load.prototype.initialize = function() { + Scene_File.prototype.initialize.call(this); + this._loadSuccess = false; +}; + +Scene_Load.prototype.terminate = function() { + Scene_File.prototype.terminate.call(this); + if (this._loadSuccess) { + $gameSystem.onAfterLoad(); + } +}; + +Scene_Load.prototype.mode = function() { + return "load"; +}; + +Scene_Load.prototype.helpWindowText = function() { + return TextManager.loadMessage; +}; + +Scene_Load.prototype.firstSavefileId = function() { + return DataManager.latestSavefileId(); +}; + +Scene_Load.prototype.onSavefileOk = function() { + Scene_File.prototype.onSavefileOk.call(this); + const savefileId = this.savefileId(); + if (this.isSavefileEnabled(savefileId)) { + this.executeLoad(savefileId); + } else { + this.onLoadFailure(); + } +}; + +Scene_Load.prototype.executeLoad = function(savefileId) { + DataManager.loadGame(savefileId) + .then(() => this.onLoadSuccess()) + .catch(() => this.onLoadFailure()); +}; + +Scene_Load.prototype.onLoadSuccess = function() { + SoundManager.playLoad(); + this.fadeOutAll(); + this.reloadMapIfUpdated(); + SceneManager.goto(Scene_Map); + this._loadSuccess = true; +}; + +Scene_Load.prototype.onLoadFailure = function() { + SoundManager.playBuzzer(); + this.activateListWindow(); +}; + +Scene_Load.prototype.reloadMapIfUpdated = function() { + if ($gameSystem.versionId() !== $dataSystem.versionId) { + const mapId = $gameMap.mapId(); + const x = $gamePlayer.x; + const y = $gamePlayer.y; + const d = $gamePlayer.direction(); + $gamePlayer.reserveTransfer(mapId, x, y, d, 0); + $gamePlayer.requestMapReload(); + } +}; + +//----------------------------------------------------------------------------- +// Scene_GameEnd +// +// The scene class of the game end screen. + +function Scene_GameEnd() { + this.initialize(...arguments); +} + +Scene_GameEnd.prototype = Object.create(Scene_MenuBase.prototype); +Scene_GameEnd.prototype.constructor = Scene_GameEnd; + +Scene_GameEnd.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_GameEnd.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createCommandWindow(); +}; + +Scene_GameEnd.prototype.stop = function() { + Scene_MenuBase.prototype.stop.call(this); + this._commandWindow.close(); +}; + +Scene_GameEnd.prototype.createBackground = function() { + Scene_MenuBase.prototype.createBackground.call(this); + this.setBackgroundOpacity(128); +}; + +Scene_GameEnd.prototype.createCommandWindow = function() { + const rect = this.commandWindowRect(); + this._commandWindow = new Window_GameEnd(rect); + this._commandWindow.setHandler("toTitle", this.commandToTitle.bind(this)); + this._commandWindow.setHandler("cancel", this.popScene.bind(this)); + this.addWindow(this._commandWindow); +}; + +Scene_GameEnd.prototype.commandWindowRect = function() { + const ww = this.mainCommandWidth(); + const wh = this.calcWindowHeight(2, true); + const wx = (Graphics.boxWidth - ww) / 2; + const wy = (Graphics.boxHeight - wh) / 2; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_GameEnd.prototype.commandToTitle = function() { + this.fadeOutAll(); + SceneManager.goto(Scene_Title); + Window_TitleCommand.initCommandPosition(); +}; + +//----------------------------------------------------------------------------- +// Scene_Shop +// +// The scene class of the shop screen. + +function Scene_Shop() { + this.initialize(...arguments); +} + +Scene_Shop.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Shop.prototype.constructor = Scene_Shop; + +Scene_Shop.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Shop.prototype.prepare = function(goods, purchaseOnly) { + this._goods = goods; + this._purchaseOnly = purchaseOnly; + this._item = null; +}; + +Scene_Shop.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createHelpWindow(); + this.createGoldWindow(); + this.createCommandWindow(); + this.createDummyWindow(); + this.createNumberWindow(); + this.createStatusWindow(); + this.createBuyWindow(); + this.createCategoryWindow(); + this.createSellWindow(); +}; + +Scene_Shop.prototype.createGoldWindow = function() { + const rect = this.goldWindowRect(); + this._goldWindow = new Window_Gold(rect); + this.addWindow(this._goldWindow); +}; + +Scene_Shop.prototype.goldWindowRect = function() { + const ww = this.mainCommandWidth(); + const wh = this.calcWindowHeight(1, true); + const wx = Graphics.boxWidth - ww; + const wy = this.mainAreaTop(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createCommandWindow = function() { + const rect = this.commandWindowRect(); + this._commandWindow = new Window_ShopCommand(rect); + this._commandWindow.setPurchaseOnly(this._purchaseOnly); + this._commandWindow.y = this.mainAreaTop(); + this._commandWindow.setHandler("buy", this.commandBuy.bind(this)); + this._commandWindow.setHandler("sell", this.commandSell.bind(this)); + this._commandWindow.setHandler("cancel", this.popScene.bind(this)); + this.addWindow(this._commandWindow); +}; + +Scene_Shop.prototype.commandWindowRect = function() { + const wx = 0; + const wy = this.mainAreaTop(); + const ww = this._goldWindow.x; + const wh = this.calcWindowHeight(1, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createDummyWindow = function() { + const rect = this.dummyWindowRect(); + this._dummyWindow = new Window_Base(rect); + this.addWindow(this._dummyWindow); +}; + +Scene_Shop.prototype.dummyWindowRect = function() { + const wx = 0; + const wy = this._commandWindow.y + this._commandWindow.height; + const ww = Graphics.boxWidth; + const wh = this.mainAreaHeight() - this._commandWindow.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createNumberWindow = function() { + const rect = this.numberWindowRect(); + this._numberWindow = new Window_ShopNumber(rect); + this._numberWindow.hide(); + this._numberWindow.setHandler("ok", this.onNumberOk.bind(this)); + this._numberWindow.setHandler("cancel", this.onNumberCancel.bind(this)); + this.addWindow(this._numberWindow); +}; + +Scene_Shop.prototype.numberWindowRect = function() { + const wx = 0; + const wy = this._dummyWindow.y; + const ww = Graphics.boxWidth - this.statusWidth(); + const wh = this._dummyWindow.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createStatusWindow = function() { + const rect = this.statusWindowRect(); + this._statusWindow = new Window_ShopStatus(rect); + this._statusWindow.hide(); + this.addWindow(this._statusWindow); +}; + +Scene_Shop.prototype.statusWindowRect = function() { + const ww = this.statusWidth(); + const wh = this._dummyWindow.height; + const wx = Graphics.boxWidth - ww; + const wy = this._dummyWindow.y; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createBuyWindow = function() { + const rect = this.buyWindowRect(); + this._buyWindow = new Window_ShopBuy(rect); + this._buyWindow.setupGoods(this._goods); + this._buyWindow.setHelpWindow(this._helpWindow); + this._buyWindow.setStatusWindow(this._statusWindow); + this._buyWindow.hide(); + this._buyWindow.setHandler("ok", this.onBuyOk.bind(this)); + this._buyWindow.setHandler("cancel", this.onBuyCancel.bind(this)); + this.addWindow(this._buyWindow); +}; + +Scene_Shop.prototype.buyWindowRect = function() { + const wx = 0; + const wy = this._dummyWindow.y; + const ww = Graphics.boxWidth - this.statusWidth(); + const wh = this._dummyWindow.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createCategoryWindow = function() { + const rect = this.categoryWindowRect(); + this._categoryWindow = new Window_ItemCategory(rect); + this._categoryWindow.setHelpWindow(this._helpWindow); + this._categoryWindow.hide(); + this._categoryWindow.deactivate(); + this._categoryWindow.setHandler("ok", this.onCategoryOk.bind(this)); + this._categoryWindow.setHandler("cancel", this.onCategoryCancel.bind(this)); + this.addWindow(this._categoryWindow); +}; + +Scene_Shop.prototype.categoryWindowRect = function() { + const wx = 0; + const wy = this._dummyWindow.y; + const ww = Graphics.boxWidth; + const wh = this.calcWindowHeight(1, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.createSellWindow = function() { + const rect = this.sellWindowRect(); + this._sellWindow = new Window_ShopSell(rect); + this._sellWindow.setHelpWindow(this._helpWindow); + this._sellWindow.hide(); + this._sellWindow.setHandler("ok", this.onSellOk.bind(this)); + this._sellWindow.setHandler("cancel", this.onSellCancel.bind(this)); + this._categoryWindow.setItemWindow(this._sellWindow); + this.addWindow(this._sellWindow); + if (!this._categoryWindow.needsSelection()) { + this._sellWindow.y -= this._categoryWindow.height; + this._sellWindow.height += this._categoryWindow.height; + } +}; + +Scene_Shop.prototype.sellWindowRect = function() { + const wx = 0; + const wy = this._categoryWindow.y + this._categoryWindow.height; + const ww = Graphics.boxWidth; + const wh = + this.mainAreaHeight() - + this._commandWindow.height - + this._categoryWindow.height; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Shop.prototype.statusWidth = function() { + return 352; +}; + +Scene_Shop.prototype.activateBuyWindow = function() { + this._buyWindow.setMoney(this.money()); + this._buyWindow.show(); + this._buyWindow.activate(); + this._statusWindow.show(); +}; + +Scene_Shop.prototype.activateSellWindow = function() { + if (this._categoryWindow.needsSelection()) { + this._categoryWindow.show(); + } + this._sellWindow.refresh(); + this._sellWindow.show(); + this._sellWindow.activate(); + this._statusWindow.hide(); +}; + +Scene_Shop.prototype.commandBuy = function() { + this._dummyWindow.hide(); + this.activateBuyWindow(); +}; + +Scene_Shop.prototype.commandSell = function() { + this._dummyWindow.hide(); + this._sellWindow.show(); + this._sellWindow.deselect(); + this._sellWindow.refresh(); + if (this._categoryWindow.needsSelection()) { + this._categoryWindow.show(); + this._categoryWindow.activate(); + } else { + this.onCategoryOk(); + } +}; + +Scene_Shop.prototype.onBuyOk = function() { + this._item = this._buyWindow.item(); + this._buyWindow.hide(); + this._numberWindow.setup(this._item, this.maxBuy(), this.buyingPrice()); + this._numberWindow.setCurrencyUnit(this.currencyUnit()); + this._numberWindow.show(); + this._numberWindow.activate(); +}; + +Scene_Shop.prototype.onBuyCancel = function() { + this._commandWindow.activate(); + this._dummyWindow.show(); + this._buyWindow.hide(); + this._statusWindow.hide(); + this._statusWindow.setItem(null); + this._helpWindow.clear(); +}; + +Scene_Shop.prototype.onCategoryOk = function() { + this.activateSellWindow(); + this._sellWindow.select(0); +}; + +Scene_Shop.prototype.onCategoryCancel = function() { + this._commandWindow.activate(); + this._dummyWindow.show(); + this._categoryWindow.hide(); + this._sellWindow.hide(); +}; + +Scene_Shop.prototype.onSellOk = function() { + this._item = this._sellWindow.item(); + this._categoryWindow.hide(); + this._sellWindow.hide(); + this._numberWindow.setup(this._item, this.maxSell(), this.sellingPrice()); + this._numberWindow.setCurrencyUnit(this.currencyUnit()); + this._numberWindow.show(); + this._numberWindow.activate(); + this._statusWindow.setItem(this._item); + this._statusWindow.show(); +}; + +Scene_Shop.prototype.onSellCancel = function() { + this._sellWindow.deselect(); + this._statusWindow.setItem(null); + this._helpWindow.clear(); + if (this._categoryWindow.needsSelection()) { + this._categoryWindow.activate(); + } else { + this.onCategoryCancel(); + } +}; + +Scene_Shop.prototype.onNumberOk = function() { + SoundManager.playShop(); + switch (this._commandWindow.currentSymbol()) { + case "buy": + this.doBuy(this._numberWindow.number()); + break; + case "sell": + this.doSell(this._numberWindow.number()); + break; + } + this.endNumberInput(); + this._goldWindow.refresh(); + this._statusWindow.refresh(); +}; + +Scene_Shop.prototype.onNumberCancel = function() { + SoundManager.playCancel(); + this.endNumberInput(); +}; + +Scene_Shop.prototype.doBuy = function(number) { + $gameParty.loseGold(number * this.buyingPrice()); + $gameParty.gainItem(this._item, number); +}; + +Scene_Shop.prototype.doSell = function(number) { + $gameParty.gainGold(number * this.sellingPrice()); + $gameParty.loseItem(this._item, number); +}; + +Scene_Shop.prototype.endNumberInput = function() { + this._numberWindow.hide(); + switch (this._commandWindow.currentSymbol()) { + case "buy": + this.activateBuyWindow(); + break; + case "sell": + this.activateSellWindow(); + break; + } +}; + +Scene_Shop.prototype.maxBuy = function() { + const num = $gameParty.numItems(this._item); + const max = $gameParty.maxItems(this._item) - num; + const price = this.buyingPrice(); + if (price > 0) { + return Math.min(max, Math.floor(this.money() / price)); + } else { + return max; + } +}; + +Scene_Shop.prototype.maxSell = function() { + return $gameParty.numItems(this._item); +}; + +Scene_Shop.prototype.money = function() { + return this._goldWindow.value(); +}; + +Scene_Shop.prototype.currencyUnit = function() { + return this._goldWindow.currencyUnit(); +}; + +Scene_Shop.prototype.buyingPrice = function() { + return this._buyWindow.price(this._item); +}; + +Scene_Shop.prototype.sellingPrice = function() { + return Math.floor(this._item.price / 2); +}; + +//----------------------------------------------------------------------------- +// Scene_Name +// +// The scene class of the name input screen. + +function Scene_Name() { + this.initialize(...arguments); +} + +Scene_Name.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Name.prototype.constructor = Scene_Name; + +Scene_Name.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Name.prototype.prepare = function(actorId, maxLength) { + this._actorId = actorId; + this._maxLength = maxLength; +}; + +Scene_Name.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this._actor = $gameActors.actor(this._actorId); + this.createEditWindow(); + this.createInputWindow(); +}; + +Scene_Name.prototype.start = function() { + Scene_MenuBase.prototype.start.call(this); + this._editWindow.refresh(); +}; + +Scene_Name.prototype.createEditWindow = function() { + const rect = this.editWindowRect(); + this._editWindow = new Window_NameEdit(rect); + this._editWindow.setup(this._actor, this._maxLength); + this.addWindow(this._editWindow); +}; + +Scene_Name.prototype.editWindowRect = function() { + const inputWindowHeight = this.calcWindowHeight(9, true); + const padding = $gameSystem.windowPadding(); + const ww = 600; + const wh = ImageManager.faceHeight + padding * 2; + const wx = (Graphics.boxWidth - ww) / 2; + const wy = (Graphics.boxHeight - (wh + inputWindowHeight + 8)) / 2; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Name.prototype.createInputWindow = function() { + const rect = this.inputWindowRect(); + this._inputWindow = new Window_NameInput(rect); + this._inputWindow.setEditWindow(this._editWindow); + this._inputWindow.setHandler("ok", this.onInputOk.bind(this)); + this.addWindow(this._inputWindow); +}; + +Scene_Name.prototype.inputWindowRect = function() { + const wx = this._editWindow.x; + const wy = this._editWindow.y + this._editWindow.height + 8; + const ww = this._editWindow.width; + const wh = this.calcWindowHeight(9, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Name.prototype.onInputOk = function() { + this._actor.setName(this._editWindow.name()); + this.popScene(); +}; + +//----------------------------------------------------------------------------- +// Scene_Debug +// +// The scene class of the debug screen. + +function Scene_Debug() { + this.initialize(...arguments); +} + +Scene_Debug.prototype = Object.create(Scene_MenuBase.prototype); +Scene_Debug.prototype.constructor = Scene_Debug; + +Scene_Debug.prototype.initialize = function() { + Scene_MenuBase.prototype.initialize.call(this); +}; + +Scene_Debug.prototype.create = function() { + Scene_MenuBase.prototype.create.call(this); + this.createRangeWindow(); + this.createEditWindow(); + this.createDebugHelpWindow(); +}; + +Scene_Debug.prototype.needsCancelButton = function() { + return false; +}; + +Scene_Debug.prototype.createRangeWindow = function() { + const rect = this.rangeWindowRect(); + this._rangeWindow = new Window_DebugRange(rect); + this._rangeWindow.setHandler("ok", this.onRangeOk.bind(this)); + this._rangeWindow.setHandler("cancel", this.popScene.bind(this)); + this.addWindow(this._rangeWindow); +}; + +Scene_Debug.prototype.rangeWindowRect = function() { + const wx = 0; + const wy = 0; + const ww = 246; + const wh = Graphics.boxHeight; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Debug.prototype.createEditWindow = function() { + const rect = this.editWindowRect(); + this._editWindow = new Window_DebugEdit(rect); + this._editWindow.setHandler("cancel", this.onEditCancel.bind(this)); + this._rangeWindow.setEditWindow(this._editWindow); + this.addWindow(this._editWindow); +}; + +Scene_Debug.prototype.editWindowRect = function() { + const wx = this._rangeWindow.width; + const wy = 0; + const ww = Graphics.boxWidth - wx; + const wh = this.calcWindowHeight(10, true); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Debug.prototype.createDebugHelpWindow = function() { + const rect = this.debugHelpWindowRect(); + this._debugHelpWindow = new Window_Base(rect); + this.addWindow(this._debugHelpWindow); +}; + +Scene_Debug.prototype.debugHelpWindowRect = function() { + const wx = this._editWindow.x; + const wy = this._editWindow.height; + const ww = this._editWindow.width; + const wh = Graphics.boxHeight - wy; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Debug.prototype.onRangeOk = function() { + this._editWindow.activate(); + this._editWindow.select(0); + this.refreshHelpWindow(); +}; + +Scene_Debug.prototype.onEditCancel = function() { + this._rangeWindow.activate(); + this._editWindow.deselect(); + this.refreshHelpWindow(); +}; + +Scene_Debug.prototype.refreshHelpWindow = function() { + const helpWindow = this._debugHelpWindow; + helpWindow.contents.clear(); + if (this._editWindow.active) { + const rect = helpWindow.baseTextRect(); + helpWindow.drawTextEx(this.helpText(), rect.x, rect.y, rect.width); + } +}; + +Scene_Debug.prototype.helpText = function() { + if (this._rangeWindow.mode() === "switch") { + return "Enter : ON / OFF"; + } else { + return ( + "Left : -1 Pageup : -10\n" + + "Right : +1 Pagedown : +10" + ); + } +}; + +//----------------------------------------------------------------------------- +// Scene_Battle +// +// The scene class of the battle screen. + +function Scene_Battle() { + this.initialize(...arguments); +} + +Scene_Battle.prototype = Object.create(Scene_Message.prototype); +Scene_Battle.prototype.constructor = Scene_Battle; + +Scene_Battle.prototype.initialize = function() { + Scene_Message.prototype.initialize.call(this); +}; + +Scene_Battle.prototype.create = function() { + Scene_Message.prototype.create.call(this); + this.createDisplayObjects(); +}; + +Scene_Battle.prototype.start = function() { + Scene_Message.prototype.start.call(this); + BattleManager.playBattleBgm(); + BattleManager.startBattle(); + this._statusWindow.refresh(); + this.startFadeIn(this.fadeSpeed(), false); +}; + +Scene_Battle.prototype.update = function() { + const active = this.isActive(); + $gameTimer.update(active); + $gameScreen.update(); + this.updateVisibility(); + if (active && !this.isBusy()) { + this.updateBattleProcess(); + } + Scene_Message.prototype.update.call(this); +}; + +Scene_Battle.prototype.updateVisibility = function() { + this.updateLogWindowVisibility(); + this.updateStatusWindowVisibility(); + this.updateInputWindowVisibility(); + this.updateCancelButton(); +}; + +Scene_Battle.prototype.updateBattleProcess = function() { + BattleManager.update(this.isTimeActive()); +}; + +Scene_Battle.prototype.isTimeActive = function() { + if (BattleManager.isActiveTpb()) { + return !this._skillWindow.active && !this._itemWindow.active; + } else { + return !this.isAnyInputWindowActive(); + } +}; + +Scene_Battle.prototype.isAnyInputWindowActive = function() { + return ( + this._partyCommandWindow.active || + this._actorCommandWindow.active || + this._skillWindow.active || + this._itemWindow.active || + this._actorWindow.active || + this._enemyWindow.active + ); +}; + +Scene_Battle.prototype.changeInputWindow = function() { + this.hideSubInputWindows(); + if (BattleManager.isInputting()) { + if (BattleManager.actor()) { + this.startActorCommandSelection(); + } else { + this.startPartyCommandSelection(); + } + } else { + this.endCommandSelection(); + } +}; + +Scene_Battle.prototype.stop = function() { + Scene_Message.prototype.stop.call(this); + if (this.needsSlowFadeOut()) { + this.startFadeOut(this.slowFadeSpeed(), false); + } else { + this.startFadeOut(this.fadeSpeed(), false); + } + this._statusWindow.close(); + this._partyCommandWindow.close(); + this._actorCommandWindow.close(); +}; + +Scene_Battle.prototype.terminate = function() { + Scene_Message.prototype.terminate.call(this); + $gameParty.onBattleEnd(); + $gameTroop.onBattleEnd(); + AudioManager.stopMe(); + if (this.shouldAutosave()) { + this.requestAutosave(); + } +}; + +Scene_Battle.prototype.shouldAutosave = function() { + return SceneManager.isNextScene(Scene_Map); +}; + +Scene_Battle.prototype.needsSlowFadeOut = function() { + return ( + SceneManager.isNextScene(Scene_Title) || + SceneManager.isNextScene(Scene_Gameover) + ); +}; + +Scene_Battle.prototype.updateLogWindowVisibility = function() { + this._logWindow.visible = !this._helpWindow.visible; +}; + +Scene_Battle.prototype.updateStatusWindowVisibility = function() { + if ($gameMessage.isBusy()) { + this._statusWindow.close(); + } else if (this.shouldOpenStatusWindow()) { + this._statusWindow.open(); + } + this.updateStatusWindowPosition(); +}; + +Scene_Battle.prototype.shouldOpenStatusWindow = function() { + return ( + this.isActive() && + !this.isMessageWindowClosing() && + !BattleManager.isBattleEnd() + ); +}; + +Scene_Battle.prototype.updateStatusWindowPosition = function() { + const statusWindow = this._statusWindow; + const targetX = this.statusWindowX(); + if (statusWindow.x < targetX) { + statusWindow.x = Math.min(statusWindow.x + 16, targetX); + } + if (statusWindow.x > targetX) { + statusWindow.x = Math.max(statusWindow.x - 16, targetX); + } +}; + +Scene_Battle.prototype.statusWindowX = function() { + if (this.isAnyInputWindowActive()) { + return this.statusWindowRect().x; + } else { + return this._partyCommandWindow.width / 2; + } +}; + +Scene_Battle.prototype.updateInputWindowVisibility = function() { + if ($gameMessage.isBusy()) { + this.closeCommandWindows(); + this.hideSubInputWindows(); + } else if (this.needsInputWindowChange()) { + this.changeInputWindow(); + } +}; + +Scene_Battle.prototype.needsInputWindowChange = function() { + const windowActive = this.isAnyInputWindowActive(); + const inputting = BattleManager.isInputting(); + if (windowActive && inputting) { + return this._actorCommandWindow.actor() !== BattleManager.actor(); + } + return windowActive !== inputting; +}; + +Scene_Battle.prototype.updateCancelButton = function() { + if (this._cancelButton) { + this._cancelButton.visible = + this.isAnyInputWindowActive() && !this._partyCommandWindow.active; + } +}; + +Scene_Battle.prototype.createDisplayObjects = function() { + this.createSpriteset(); + this.createWindowLayer(); + this.createAllWindows(); + this.createButtons(); + BattleManager.setLogWindow(this._logWindow); + BattleManager.setSpriteset(this._spriteset); + this._logWindow.setSpriteset(this._spriteset); +}; + +Scene_Battle.prototype.createSpriteset = function() { + this._spriteset = new Spriteset_Battle(); + this.addChild(this._spriteset); +}; + +Scene_Battle.prototype.createAllWindows = function() { + this.createLogWindow(); + this.createStatusWindow(); + this.createPartyCommandWindow(); + this.createActorCommandWindow(); + this.createHelpWindow(); + this.createSkillWindow(); + this.createItemWindow(); + this.createActorWindow(); + this.createEnemyWindow(); + Scene_Message.prototype.createAllWindows.call(this); +}; + +Scene_Battle.prototype.createLogWindow = function() { + const rect = this.logWindowRect(); + this._logWindow = new Window_BattleLog(rect); + this.addWindow(this._logWindow); +}; + +Scene_Battle.prototype.logWindowRect = function() { + const wx = 0; + const wy = 0; + const ww = Graphics.boxWidth; + const wh = this.calcWindowHeight(10, false); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.createStatusWindow = function() { + const rect = this.statusWindowRect(); + const statusWindow = new Window_BattleStatus(rect); + this.addWindow(statusWindow); + this._statusWindow = statusWindow; +}; + +Scene_Battle.prototype.statusWindowRect = function() { + const extra = 10; + const ww = Graphics.boxWidth - 192; + const wh = this.windowAreaHeight() + extra; + const wx = this.isRightInputMode() ? 0 : Graphics.boxWidth - ww; + const wy = Graphics.boxHeight - wh + extra - 4; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.createPartyCommandWindow = function() { + const rect = this.partyCommandWindowRect(); + const commandWindow = new Window_PartyCommand(rect); + commandWindow.setHandler("fight", this.commandFight.bind(this)); + commandWindow.setHandler("escape", this.commandEscape.bind(this)); + commandWindow.deselect(); + this.addWindow(commandWindow); + this._partyCommandWindow = commandWindow; +}; + +Scene_Battle.prototype.partyCommandWindowRect = function() { + const ww = 192; + const wh = this.windowAreaHeight(); + const wx = this.isRightInputMode() ? Graphics.boxWidth - ww : 0; + const wy = Graphics.boxHeight - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.createActorCommandWindow = function() { + const rect = this.actorCommandWindowRect(); + const commandWindow = new Window_ActorCommand(rect); + commandWindow.y = Graphics.boxHeight - commandWindow.height; + commandWindow.setHandler("attack", this.commandAttack.bind(this)); + commandWindow.setHandler("skill", this.commandSkill.bind(this)); + commandWindow.setHandler("guard", this.commandGuard.bind(this)); + commandWindow.setHandler("item", this.commandItem.bind(this)); + commandWindow.setHandler("cancel", this.commandCancel.bind(this)); + this.addWindow(commandWindow); + this._actorCommandWindow = commandWindow; +}; + +Scene_Battle.prototype.actorCommandWindowRect = function() { + const ww = 192; + const wh = this.windowAreaHeight(); + const wx = this.isRightInputMode() ? Graphics.boxWidth - ww : 0; + const wy = Graphics.boxHeight - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.createHelpWindow = function() { + const rect = this.helpWindowRect(); + this._helpWindow = new Window_Help(rect); + this._helpWindow.hide(); + this.addWindow(this._helpWindow); +}; + +Scene_Battle.prototype.helpWindowRect = function() { + const wx = 0; + const wy = this.helpAreaTop(); + const ww = Graphics.boxWidth; + const wh = this.helpAreaHeight(); + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.createSkillWindow = function() { + const rect = this.skillWindowRect(); + this._skillWindow = new Window_BattleSkill(rect); + this._skillWindow.setHelpWindow(this._helpWindow); + this._skillWindow.setHandler("ok", this.onSkillOk.bind(this)); + this._skillWindow.setHandler("cancel", this.onSkillCancel.bind(this)); + this.addWindow(this._skillWindow); +}; + +Scene_Battle.prototype.skillWindowRect = function() { + const ww = Graphics.boxWidth; + const wh = this.windowAreaHeight(); + const wx = 0; + const wy = Graphics.boxHeight - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.createItemWindow = function() { + const rect = this.itemWindowRect(); + this._itemWindow = new Window_BattleItem(rect); + this._itemWindow.setHelpWindow(this._helpWindow); + this._itemWindow.setHandler("ok", this.onItemOk.bind(this)); + this._itemWindow.setHandler("cancel", this.onItemCancel.bind(this)); + this.addWindow(this._itemWindow); +}; + +Scene_Battle.prototype.itemWindowRect = function() { + return this.skillWindowRect(); +}; + +Scene_Battle.prototype.createActorWindow = function() { + const rect = this.actorWindowRect(); + this._actorWindow = new Window_BattleActor(rect); + this._actorWindow.setHandler("ok", this.onActorOk.bind(this)); + this._actorWindow.setHandler("cancel", this.onActorCancel.bind(this)); + this.addWindow(this._actorWindow); +}; + +Scene_Battle.prototype.actorWindowRect = function() { + return this.statusWindowRect(); +}; + +Scene_Battle.prototype.createEnemyWindow = function() { + const rect = this.enemyWindowRect(); + this._enemyWindow = new Window_BattleEnemy(rect); + this._enemyWindow.setHandler("ok", this.onEnemyOk.bind(this)); + this._enemyWindow.setHandler("cancel", this.onEnemyCancel.bind(this)); + this.addWindow(this._enemyWindow); +}; + +Scene_Battle.prototype.enemyWindowRect = function() { + const wx = this._statusWindow.x; + const ww = this._statusWindow.width; + const wh = this.windowAreaHeight(); + const wy = Graphics.boxHeight - wh; + return new Rectangle(wx, wy, ww, wh); +}; + +Scene_Battle.prototype.helpAreaTop = function() { + return 0; +}; + +Scene_Battle.prototype.helpAreaBottom = function() { + return this.helpAreaTop() + this.helpAreaHeight(); +}; + +Scene_Battle.prototype.helpAreaHeight = function() { + return this.calcWindowHeight(2, false); +}; + +Scene_Battle.prototype.buttonAreaTop = function() { + return this.helpAreaBottom(); +}; + +Scene_Battle.prototype.windowAreaHeight = function() { + return this.calcWindowHeight(4, true); +}; + +Scene_Battle.prototype.createButtons = function() { + if (ConfigManager.touchUI) { + this.createCancelButton(); + } +}; + +Scene_Battle.prototype.createCancelButton = function() { + this._cancelButton = new Sprite_Button("cancel"); + this._cancelButton.x = Graphics.boxWidth - this._cancelButton.width - 4; + this._cancelButton.y = this.buttonY(); + this.addWindow(this._cancelButton); +}; + +Scene_Battle.prototype.closeCommandWindows = function() { + this._partyCommandWindow.deactivate(); + this._actorCommandWindow.deactivate(); + this._partyCommandWindow.close(); + this._actorCommandWindow.close(); +}; + +Scene_Battle.prototype.hideSubInputWindows = function() { + this._actorWindow.deactivate(); + this._enemyWindow.deactivate(); + this._skillWindow.deactivate(); + this._itemWindow.deactivate(); + this._actorWindow.hide(); + this._enemyWindow.hide(); + this._skillWindow.hide(); + this._itemWindow.hide(); +}; + +Scene_Battle.prototype.startPartyCommandSelection = function() { + this._statusWindow.deselect(); + this._statusWindow.show(); + this._statusWindow.open(); + this._actorCommandWindow.setup(null); + this._actorCommandWindow.close(); + this._partyCommandWindow.setup(); +}; + +Scene_Battle.prototype.commandFight = function() { + this.selectNextCommand(); +}; + +Scene_Battle.prototype.commandEscape = function() { + BattleManager.processEscape(); + this.changeInputWindow(); +}; + +Scene_Battle.prototype.startActorCommandSelection = function() { + this._statusWindow.show(); + this._statusWindow.selectActor(BattleManager.actor()); + this._partyCommandWindow.close(); + this._actorCommandWindow.show(); + this._actorCommandWindow.setup(BattleManager.actor()); +}; + +Scene_Battle.prototype.commandAttack = function() { + const action = BattleManager.inputtingAction(); + action.setAttack(); + this.onSelectAction(); +}; + +Scene_Battle.prototype.commandSkill = function() { + this._skillWindow.setActor(BattleManager.actor()); + this._skillWindow.setStypeId(this._actorCommandWindow.currentExt()); + this._skillWindow.refresh(); + this._skillWindow.show(); + this._skillWindow.activate(); + this._statusWindow.hide(); + this._actorCommandWindow.hide(); +}; + +Scene_Battle.prototype.commandGuard = function() { + const action = BattleManager.inputtingAction(); + action.setGuard(); + this.onSelectAction(); +}; + +Scene_Battle.prototype.commandItem = function() { + this._itemWindow.refresh(); + this._itemWindow.show(); + this._itemWindow.activate(); + this._statusWindow.hide(); + this._actorCommandWindow.hide(); +}; + +Scene_Battle.prototype.commandCancel = function() { + this.selectPreviousCommand(); +}; + +Scene_Battle.prototype.selectNextCommand = function() { + BattleManager.selectNextCommand(); + this.changeInputWindow(); +}; + +Scene_Battle.prototype.selectPreviousCommand = function() { + BattleManager.selectPreviousCommand(); + this.changeInputWindow(); +}; + +Scene_Battle.prototype.startActorSelection = function() { + this._actorWindow.refresh(); + this._actorWindow.show(); + this._actorWindow.activate(); +}; + +Scene_Battle.prototype.onActorOk = function() { + const action = BattleManager.inputtingAction(); + action.setTarget(this._actorWindow.index()); + this.hideSubInputWindows(); + this.selectNextCommand(); +}; + +Scene_Battle.prototype.onActorCancel = function() { + this._actorWindow.hide(); + switch (this._actorCommandWindow.currentSymbol()) { + case "skill": + this._skillWindow.show(); + this._skillWindow.activate(); + break; + case "item": + this._itemWindow.show(); + this._itemWindow.activate(); + break; + } +}; + +Scene_Battle.prototype.startEnemySelection = function() { + this._enemyWindow.refresh(); + this._enemyWindow.show(); + this._enemyWindow.select(0); + this._enemyWindow.activate(); + this._statusWindow.hide(); +}; + +Scene_Battle.prototype.onEnemyOk = function() { + const action = BattleManager.inputtingAction(); + action.setTarget(this._enemyWindow.enemyIndex()); + this.hideSubInputWindows(); + this.selectNextCommand(); +}; + +Scene_Battle.prototype.onEnemyCancel = function() { + this._enemyWindow.hide(); + switch (this._actorCommandWindow.currentSymbol()) { + case "attack": + this._statusWindow.show(); + this._actorCommandWindow.activate(); + break; + case "skill": + this._skillWindow.show(); + this._skillWindow.activate(); + break; + case "item": + this._itemWindow.show(); + this._itemWindow.activate(); + break; + } +}; + +Scene_Battle.prototype.onSkillOk = function() { + const skill = this._skillWindow.item(); + const action = BattleManager.inputtingAction(); + action.setSkill(skill.id); + BattleManager.actor().setLastBattleSkill(skill); + this.onSelectAction(); +}; + +Scene_Battle.prototype.onSkillCancel = function() { + this._skillWindow.hide(); + this._statusWindow.show(); + this._actorCommandWindow.show(); + this._actorCommandWindow.activate(); +}; + +Scene_Battle.prototype.onItemOk = function() { + const item = this._itemWindow.item(); + const action = BattleManager.inputtingAction(); + action.setItem(item.id); + $gameParty.setLastItem(item); + this.onSelectAction(); +}; + +Scene_Battle.prototype.onItemCancel = function() { + this._itemWindow.hide(); + this._statusWindow.show(); + this._actorCommandWindow.show(); + this._actorCommandWindow.activate(); +}; + +Scene_Battle.prototype.onSelectAction = function() { + const action = BattleManager.inputtingAction(); + if (!action.needsSelection()) { + this.selectNextCommand(); + } else if (action.isForOpponent()) { + this.startEnemySelection(); + } else { + this.startActorSelection(); + } +}; + +Scene_Battle.prototype.endCommandSelection = function() { + this.closeCommandWindows(); + this.hideSubInputWindows(); + this._statusWindow.deselect(); + this._statusWindow.show(); +}; + +//----------------------------------------------------------------------------- +// Scene_Gameover +// +// The scene class of the game over screen. + +function Scene_Gameover() { + this.initialize(...arguments); +} + +Scene_Gameover.prototype = Object.create(Scene_Base.prototype); +Scene_Gameover.prototype.constructor = Scene_Gameover; + +Scene_Gameover.prototype.initialize = function() { + Scene_Base.prototype.initialize.call(this); +}; + +Scene_Gameover.prototype.create = function() { + Scene_Base.prototype.create.call(this); + this.playGameoverMusic(); + this.createBackground(); +}; + +Scene_Gameover.prototype.start = function() { + Scene_Base.prototype.start.call(this); + this.adjustBackground(); + this.startFadeIn(this.slowFadeSpeed(), false); +}; + +Scene_Gameover.prototype.update = function() { + if (this.isActive() && !this.isBusy() && this.isTriggered()) { + this.gotoTitle(); + } + Scene_Base.prototype.update.call(this); +}; + +Scene_Gameover.prototype.stop = function() { + Scene_Base.prototype.stop.call(this); + this.fadeOutAll(); +}; + +Scene_Gameover.prototype.terminate = function() { + Scene_Base.prototype.terminate.call(this); + AudioManager.stopAll(); +}; + +Scene_Gameover.prototype.playGameoverMusic = function() { + AudioManager.stopBgm(); + AudioManager.stopBgs(); + AudioManager.playMe($dataSystem.gameoverMe); +}; + +Scene_Gameover.prototype.createBackground = function() { + this._backSprite = new Sprite(); + this._backSprite.bitmap = ImageManager.loadSystem("GameOver"); + this.addChild(this._backSprite); +}; + +Scene_Gameover.prototype.adjustBackground = function() { + this.scaleSprite(this._backSprite); + this.centerSprite(this._backSprite); +}; + +Scene_Gameover.prototype.isTriggered = function() { + return Input.isTriggered("ok") || TouchInput.isTriggered(); +}; + +Scene_Gameover.prototype.gotoTitle = function() { + SceneManager.goto(Scene_Title); +}; + +//----------------------------------------------------------------------------- diff --git a/js/rmmz_sprites.js b/js/rmmz_sprites.js new file mode 100644 index 0000000..1babb0e --- /dev/null +++ b/js/rmmz_sprites.js @@ -0,0 +1,3697 @@ +//============================================================================= +// rmmz_sprites.js v1.8.1 +//============================================================================= + +//----------------------------------------------------------------------------- +// Sprite_Clickable +// +// The sprite class with click handling functions. + +function Sprite_Clickable() { + this.initialize(...arguments); +} + +Sprite_Clickable.prototype = Object.create(Sprite.prototype); +Sprite_Clickable.prototype.constructor = Sprite_Clickable; + +Sprite_Clickable.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this._pressed = false; + this._hovered = false; +}; + +Sprite_Clickable.prototype.update = function() { + Sprite.prototype.update.call(this); + this.processTouch(); +}; + +Sprite_Clickable.prototype.processTouch = function() { + if (this.isClickEnabled()) { + if (this.isBeingTouched()) { + if (!this._hovered && TouchInput.isHovered()) { + this._hovered = true; + this.onMouseEnter(); + } + if (TouchInput.isTriggered()) { + this._pressed = true; + this.onPress(); + } + } else { + if (this._hovered) { + this.onMouseExit(); + } + this._pressed = false; + this._hovered = false; + } + if (this._pressed && TouchInput.isReleased()) { + this._pressed = false; + this.onClick(); + } + } else { + this._pressed = false; + this._hovered = false; + } +}; + +Sprite_Clickable.prototype.isPressed = function() { + return this._pressed; +}; + +Sprite_Clickable.prototype.isClickEnabled = function() { + return this.worldVisible; +}; + +Sprite_Clickable.prototype.isBeingTouched = function() { + const touchPos = new Point(TouchInput.x, TouchInput.y); + const localPos = this.worldTransform.applyInverse(touchPos); + return this.hitTest(localPos.x, localPos.y); +}; + +Sprite_Clickable.prototype.hitTest = function(x, y) { + const rect = new Rectangle( + -this.anchor.x * this.width, + -this.anchor.y * this.height, + this.width, + this.height + ); + return rect.contains(x, y); +}; + +Sprite_Clickable.prototype.onMouseEnter = function() { + // +}; + +Sprite_Clickable.prototype.onMouseExit = function() { + // +}; + +Sprite_Clickable.prototype.onPress = function() { + // +}; + +Sprite_Clickable.prototype.onClick = function() { + // +}; + +//----------------------------------------------------------------------------- +// Sprite_Button +// +// The sprite for displaying a button. + +function Sprite_Button() { + this.initialize(...arguments); +} + +Sprite_Button.prototype = Object.create(Sprite_Clickable.prototype); +Sprite_Button.prototype.constructor = Sprite_Button; + +Sprite_Button.prototype.initialize = function(buttonType) { + Sprite_Clickable.prototype.initialize.call(this); + this._buttonType = buttonType; + this._clickHandler = null; + this._coldFrame = null; + this._hotFrame = null; + this.setupFrames(); +}; + +Sprite_Button.prototype.setupFrames = function() { + const data = this.buttonData(); + const x = data.x * this.blockWidth(); + const width = data.w * this.blockWidth(); + const height = this.blockHeight(); + this.loadButtonImage(); + this.setColdFrame(x, 0, width, height); + this.setHotFrame(x, height, width, height); + this.updateFrame(); + this.updateOpacity(); +}; + +Sprite_Button.prototype.blockWidth = function() { + return 48; +}; + +Sprite_Button.prototype.blockHeight = function() { + return 48; +}; + +Sprite_Button.prototype.loadButtonImage = function() { + this.bitmap = ImageManager.loadSystem("ButtonSet"); +}; + +Sprite_Button.prototype.buttonData = function() { + const buttonTable = { + cancel: { x: 0, w: 2 }, + pageup: { x: 2, w: 1 }, + pagedown: { x: 3, w: 1 }, + down: { x: 4, w: 1 }, + up: { x: 5, w: 1 }, + down2: { x: 6, w: 1 }, + up2: { x: 7, w: 1 }, + ok: { x: 8, w: 2 }, + menu: { x: 10, w: 1 } + }; + return buttonTable[this._buttonType]; +}; + +Sprite_Button.prototype.update = function() { + Sprite_Clickable.prototype.update.call(this); + this.checkBitmap(); + this.updateFrame(); + this.updateOpacity(); + this.processTouch(); +}; + +Sprite_Button.prototype.checkBitmap = function() { + if (this.bitmap.isReady() && this.bitmap.width < this.blockWidth() * 11) { + // Probably MV image is used + throw new Error("ButtonSet image is too small"); + } +}; + +Sprite_Button.prototype.updateFrame = function() { + const frame = this.isPressed() ? this._hotFrame : this._coldFrame; + if (frame) { + this.setFrame(frame.x, frame.y, frame.width, frame.height); + } +}; + +Sprite_Button.prototype.updateOpacity = function() { + this.opacity = this._pressed ? 255 : 192; +}; + +Sprite_Button.prototype.setColdFrame = function(x, y, width, height) { + this._coldFrame = new Rectangle(x, y, width, height); +}; + +Sprite_Button.prototype.setHotFrame = function(x, y, width, height) { + this._hotFrame = new Rectangle(x, y, width, height); +}; + +Sprite_Button.prototype.setClickHandler = function(method) { + this._clickHandler = method; +}; + +Sprite_Button.prototype.onClick = function() { + if (this._clickHandler) { + this._clickHandler(); + } else { + Input.virtualClick(this._buttonType); + } +}; + +//----------------------------------------------------------------------------- +// Sprite_Character +// +// The sprite for displaying a character. + +function Sprite_Character() { + this.initialize(...arguments); +} + +Sprite_Character.prototype = Object.create(Sprite.prototype); +Sprite_Character.prototype.constructor = Sprite_Character; + +Sprite_Character.prototype.initialize = function(character) { + Sprite.prototype.initialize.call(this); + this.initMembers(); + this.setCharacter(character); +}; + +Sprite_Character.prototype.initMembers = function() { + this.anchor.x = 0.5; + this.anchor.y = 1; + this._character = null; + this._balloonDuration = 0; + this._tilesetId = 0; + this._upperBody = null; + this._lowerBody = null; +}; + +Sprite_Character.prototype.setCharacter = function(character) { + this._character = character; +}; + +Sprite_Character.prototype.checkCharacter = function(character) { + return this._character === character; +}; + +Sprite_Character.prototype.update = function() { + Sprite.prototype.update.call(this); + this.updateBitmap(); + this.updateFrame(); + this.updatePosition(); + this.updateOther(); + this.updateVisibility(); +}; + +Sprite_Character.prototype.updateVisibility = function() { + Sprite.prototype.updateVisibility.call(this); + if (this.isEmptyCharacter() || this._character.isTransparent()) { + this.visible = false; + } +}; + +Sprite_Character.prototype.isTile = function() { + return this._character.isTile(); +}; + +Sprite_Character.prototype.isObjectCharacter = function() { + return this._character.isObjectCharacter(); +}; + +Sprite_Character.prototype.isEmptyCharacter = function() { + return this._tileId === 0 && !this._characterName; +}; + +Sprite_Character.prototype.tilesetBitmap = function(tileId) { + const tileset = $gameMap.tileset(); + const setNumber = 5 + Math.floor(tileId / 256); + return ImageManager.loadTileset(tileset.tilesetNames[setNumber]); +}; + +Sprite_Character.prototype.updateBitmap = function() { + if (this.isImageChanged()) { + this._tilesetId = $gameMap.tilesetId(); + this._tileId = this._character.tileId(); + this._characterName = this._character.characterName(); + this._characterIndex = this._character.characterIndex(); + if (this._tileId > 0) { + this.setTileBitmap(); + } else { + this.setCharacterBitmap(); + } + } +}; + +Sprite_Character.prototype.isImageChanged = function() { + return ( + this._tilesetId !== $gameMap.tilesetId() || + this._tileId !== this._character.tileId() || + this._characterName !== this._character.characterName() || + this._characterIndex !== this._character.characterIndex() + ); +}; + +Sprite_Character.prototype.setTileBitmap = function() { + this.bitmap = this.tilesetBitmap(this._tileId); +}; + +Sprite_Character.prototype.setCharacterBitmap = function() { + this.bitmap = ImageManager.loadCharacter(this._characterName); + this._isBigCharacter = ImageManager.isBigCharacter(this._characterName); +}; + +Sprite_Character.prototype.updateFrame = function() { + if (this._tileId > 0) { + this.updateTileFrame(); + } else { + this.updateCharacterFrame(); + } +}; + +Sprite_Character.prototype.updateTileFrame = function() { + const tileId = this._tileId; + const pw = this.patternWidth(); + const ph = this.patternHeight(); + const sx = ((Math.floor(tileId / 128) % 2) * 8 + (tileId % 8)) * pw; + const sy = (Math.floor((tileId % 256) / 8) % 16) * ph; + this.setFrame(sx, sy, pw, ph); +}; + +Sprite_Character.prototype.updateCharacterFrame = function() { + const pw = this.patternWidth(); + const ph = this.patternHeight(); + const sx = (this.characterBlockX() + this.characterPatternX()) * pw; + const sy = (this.characterBlockY() + this.characterPatternY()) * ph; + this.updateHalfBodySprites(); + if (this._bushDepth > 0) { + const d = this._bushDepth; + this._upperBody.setFrame(sx, sy, pw, ph - d); + this._lowerBody.setFrame(sx, sy + ph - d, pw, d); + this.setFrame(sx, sy, 0, ph); + } else { + this.setFrame(sx, sy, pw, ph); + } +}; + +Sprite_Character.prototype.characterBlockX = function() { + if (this._isBigCharacter) { + return 0; + } else { + const index = this._character.characterIndex(); + return (index % 4) * 3; + } +}; + +Sprite_Character.prototype.characterBlockY = function() { + if (this._isBigCharacter) { + return 0; + } else { + const index = this._character.characterIndex(); + return Math.floor(index / 4) * 4; + } +}; + +Sprite_Character.prototype.characterPatternX = function() { + return this._character.pattern(); +}; + +Sprite_Character.prototype.characterPatternY = function() { + return (this._character.direction() - 2) / 2; +}; + +Sprite_Character.prototype.patternWidth = function() { + if (this._tileId > 0) { + return $gameMap.tileWidth(); + } else if (this._isBigCharacter) { + return this.bitmap.width / 3; + } else { + return this.bitmap.width / 12; + } +}; + +Sprite_Character.prototype.patternHeight = function() { + if (this._tileId > 0) { + return $gameMap.tileHeight(); + } else if (this._isBigCharacter) { + return this.bitmap.height / 4; + } else { + return this.bitmap.height / 8; + } +}; + +Sprite_Character.prototype.updateHalfBodySprites = function() { + if (this._bushDepth > 0) { + this.createHalfBodySprites(); + this._upperBody.bitmap = this.bitmap; + this._upperBody.visible = true; + this._upperBody.y = -this._bushDepth; + this._lowerBody.bitmap = this.bitmap; + this._lowerBody.visible = true; + this._upperBody.setBlendColor(this.getBlendColor()); + this._lowerBody.setBlendColor(this.getBlendColor()); + this._upperBody.setColorTone(this.getColorTone()); + this._lowerBody.setColorTone(this.getColorTone()); + this._upperBody.blendMode = this.blendMode; + this._lowerBody.blendMode = this.blendMode; + } else if (this._upperBody) { + this._upperBody.visible = false; + this._lowerBody.visible = false; + } +}; + +Sprite_Character.prototype.createHalfBodySprites = function() { + if (!this._upperBody) { + this._upperBody = new Sprite(); + this._upperBody.anchor.x = 0.5; + this._upperBody.anchor.y = 1; + this.addChild(this._upperBody); + } + if (!this._lowerBody) { + this._lowerBody = new Sprite(); + this._lowerBody.anchor.x = 0.5; + this._lowerBody.anchor.y = 1; + this._lowerBody.opacity = 128; + this.addChild(this._lowerBody); + } +}; + +Sprite_Character.prototype.updatePosition = function() { + this.x = this._character.screenX(); + this.y = this._character.screenY(); + this.z = this._character.screenZ(); +}; + +Sprite_Character.prototype.updateOther = function() { + this.opacity = this._character.opacity(); + this.blendMode = this._character.blendMode(); + this._bushDepth = this._character.bushDepth(); +}; + +//----------------------------------------------------------------------------- +// Sprite_Battler +// +// The superclass of Sprite_Actor and Sprite_Enemy. + +function Sprite_Battler() { + this.initialize(...arguments); +} + +Sprite_Battler.prototype = Object.create(Sprite_Clickable.prototype); +Sprite_Battler.prototype.constructor = Sprite_Battler; + +Sprite_Battler.prototype.initialize = function(battler) { + Sprite_Clickable.prototype.initialize.call(this); + this.initMembers(); + this.setBattler(battler); +}; + +Sprite_Battler.prototype.initMembers = function() { + this.anchor.x = 0.5; + this.anchor.y = 1; + this._battler = null; + this._damages = []; + this._homeX = 0; + this._homeY = 0; + this._offsetX = 0; + this._offsetY = 0; + this._targetOffsetX = NaN; + this._targetOffsetY = NaN; + this._movementDuration = 0; + this._selectionEffectCount = 0; +}; + +Sprite_Battler.prototype.setBattler = function(battler) { + this._battler = battler; +}; + +Sprite_Battler.prototype.checkBattler = function(battler) { + return this._battler === battler; +}; + +Sprite_Battler.prototype.mainSprite = function() { + return this; +}; + +Sprite_Battler.prototype.setHome = function(x, y) { + this._homeX = x; + this._homeY = y; + this.updatePosition(); +}; + +Sprite_Battler.prototype.update = function() { + Sprite_Clickable.prototype.update.call(this); + if (this._battler) { + this.updateMain(); + this.updateDamagePopup(); + this.updateSelectionEffect(); + this.updateVisibility(); + } else { + this.bitmap = null; + } +}; + +Sprite_Battler.prototype.updateVisibility = function() { + Sprite_Clickable.prototype.updateVisibility.call(this); + if (!this._battler || !this._battler.isSpriteVisible()) { + this.visible = false; + } +}; + +Sprite_Battler.prototype.updateMain = function() { + if (this._battler.isSpriteVisible()) { + this.updateBitmap(); + this.updateFrame(); + } + this.updateMove(); + this.updatePosition(); +}; + +Sprite_Battler.prototype.updateBitmap = function() { + // +}; + +Sprite_Battler.prototype.updateFrame = function() { + // +}; + +Sprite_Battler.prototype.updateMove = function() { + if (this._movementDuration > 0) { + const d = this._movementDuration; + this._offsetX = (this._offsetX * (d - 1) + this._targetOffsetX) / d; + this._offsetY = (this._offsetY * (d - 1) + this._targetOffsetY) / d; + this._movementDuration--; + if (this._movementDuration === 0) { + this.onMoveEnd(); + } + } +}; + +Sprite_Battler.prototype.updatePosition = function() { + this.x = this._homeX + this._offsetX; + this.y = this._homeY + this._offsetY; +}; + +Sprite_Battler.prototype.updateDamagePopup = function() { + this.setupDamagePopup(); + if (this._damages.length > 0) { + for (const damage of this._damages) { + damage.update(); + } + if (!this._damages[0].isPlaying()) { + this.destroyDamageSprite(this._damages[0]); + } + } +}; + +Sprite_Battler.prototype.updateSelectionEffect = function() { + const target = this.mainSprite(); + if (this._battler.isSelected()) { + this._selectionEffectCount++; + if (this._selectionEffectCount % 30 < 15) { + target.setBlendColor([255, 255, 255, 64]); + } else { + target.setBlendColor([0, 0, 0, 0]); + } + } else if (this._selectionEffectCount > 0) { + this._selectionEffectCount = 0; + target.setBlendColor([0, 0, 0, 0]); + } +}; + +Sprite_Battler.prototype.setupDamagePopup = function() { + if (this._battler.isDamagePopupRequested()) { + if (this._battler.isSpriteVisible()) { + this.createDamageSprite(); + } + this._battler.clearDamagePopup(); + this._battler.clearResult(); + } +}; + +Sprite_Battler.prototype.createDamageSprite = function() { + const last = this._damages[this._damages.length - 1]; + const sprite = new Sprite_Damage(); + if (last) { + sprite.x = last.x + 8; + sprite.y = last.y - 16; + } else { + sprite.x = this.x + this.damageOffsetX(); + sprite.y = this.y + this.damageOffsetY(); + } + sprite.setup(this._battler); + this._damages.push(sprite); + this.parent.addChild(sprite); +}; + +Sprite_Battler.prototype.destroyDamageSprite = function(sprite) { + this.parent.removeChild(sprite); + this._damages.remove(sprite); + sprite.destroy(); +}; + +Sprite_Battler.prototype.damageOffsetX = function() { + return 0; +}; + +Sprite_Battler.prototype.damageOffsetY = function() { + return 0; +}; + +Sprite_Battler.prototype.startMove = function(x, y, duration) { + if (this._targetOffsetX !== x || this._targetOffsetY !== y) { + this._targetOffsetX = x; + this._targetOffsetY = y; + this._movementDuration = duration; + if (duration === 0) { + this._offsetX = x; + this._offsetY = y; + } + } +}; + +Sprite_Battler.prototype.onMoveEnd = function() { + // +}; + +Sprite_Battler.prototype.isEffecting = function() { + return false; +}; + +Sprite_Battler.prototype.isMoving = function() { + return this._movementDuration > 0; +}; + +Sprite_Battler.prototype.inHomePosition = function() { + return this._offsetX === 0 && this._offsetY === 0; +}; + +Sprite_Battler.prototype.onMouseEnter = function() { + $gameTemp.setTouchState(this._battler, "select"); +}; + +Sprite_Battler.prototype.onPress = function() { + $gameTemp.setTouchState(this._battler, "select"); +}; + +Sprite_Battler.prototype.onClick = function() { + $gameTemp.setTouchState(this._battler, "click"); +}; + +//----------------------------------------------------------------------------- +// Sprite_Actor +// +// The sprite for displaying an actor. + +function Sprite_Actor() { + this.initialize(...arguments); +} + +Sprite_Actor.prototype = Object.create(Sprite_Battler.prototype); +Sprite_Actor.prototype.constructor = Sprite_Actor; + +Sprite_Actor.MOTIONS = { + walk: { index: 0, loop: true }, + wait: { index: 1, loop: true }, + chant: { index: 2, loop: true }, + guard: { index: 3, loop: true }, + damage: { index: 4, loop: false }, + evade: { index: 5, loop: false }, + thrust: { index: 6, loop: false }, + swing: { index: 7, loop: false }, + missile: { index: 8, loop: false }, + skill: { index: 9, loop: false }, + spell: { index: 10, loop: false }, + item: { index: 11, loop: false }, + escape: { index: 12, loop: true }, + victory: { index: 13, loop: true }, + dying: { index: 14, loop: true }, + abnormal: { index: 15, loop: true }, + sleep: { index: 16, loop: true }, + dead: { index: 17, loop: true } +}; + +Sprite_Actor.prototype.initialize = function(battler) { + Sprite_Battler.prototype.initialize.call(this, battler); + this.moveToStartPosition(); +}; + +Sprite_Actor.prototype.initMembers = function() { + Sprite_Battler.prototype.initMembers.call(this); + this._battlerName = ""; + this._motion = null; + this._motionCount = 0; + this._pattern = 0; + this.createShadowSprite(); + this.createWeaponSprite(); + this.createMainSprite(); + this.createStateSprite(); +}; + +Sprite_Actor.prototype.mainSprite = function() { + return this._mainSprite; +}; + +Sprite_Actor.prototype.createMainSprite = function() { + this._mainSprite = new Sprite(); + this._mainSprite.anchor.x = 0.5; + this._mainSprite.anchor.y = 1; + this.addChild(this._mainSprite); +}; + +Sprite_Actor.prototype.createShadowSprite = function() { + this._shadowSprite = new Sprite(); + this._shadowSprite.bitmap = ImageManager.loadSystem("Shadow2"); + this._shadowSprite.anchor.x = 0.5; + this._shadowSprite.anchor.y = 0.5; + this._shadowSprite.y = -2; + this.addChild(this._shadowSprite); +}; + +Sprite_Actor.prototype.createWeaponSprite = function() { + this._weaponSprite = new Sprite_Weapon(); + this.addChild(this._weaponSprite); +}; + +Sprite_Actor.prototype.createStateSprite = function() { + this._stateSprite = new Sprite_StateOverlay(); + this.addChild(this._stateSprite); +}; + +Sprite_Actor.prototype.setBattler = function(battler) { + Sprite_Battler.prototype.setBattler.call(this, battler); + if (battler !== this._actor) { + this._actor = battler; + if (battler) { + this.setActorHome(battler.index()); + } else { + this._mainSprite.bitmap = null; + this._battlerName = ""; + } + this.startEntryMotion(); + this._stateSprite.setup(battler); + } +}; + +Sprite_Actor.prototype.moveToStartPosition = function() { + this.startMove(300, 0, 0); +}; + +Sprite_Actor.prototype.setActorHome = function(index) { + this.setHome(600 + index * 32, 280 + index * 48); +}; + +Sprite_Actor.prototype.update = function() { + Sprite_Battler.prototype.update.call(this); + this.updateShadow(); + if (this._actor) { + this.updateMotion(); + } +}; + +Sprite_Actor.prototype.updateShadow = function() { + this._shadowSprite.visible = !!this._actor; +}; + +Sprite_Actor.prototype.updateMain = function() { + Sprite_Battler.prototype.updateMain.call(this); + if (this._actor.isSpriteVisible() && !this.isMoving()) { + this.updateTargetPosition(); + } +}; + +Sprite_Actor.prototype.setupMotion = function() { + if (this._actor.isMotionRequested()) { + this.startMotion(this._actor.motionType()); + this._actor.clearMotion(); + } +}; + +Sprite_Actor.prototype.setupWeaponAnimation = function() { + if (this._actor.isWeaponAnimationRequested()) { + this._weaponSprite.setup(this._actor.weaponImageId()); + this._actor.clearWeaponAnimation(); + } +}; + +Sprite_Actor.prototype.startMotion = function(motionType) { + const newMotion = Sprite_Actor.MOTIONS[motionType]; + if (this._motion !== newMotion) { + this._motion = newMotion; + this._motionCount = 0; + this._pattern = 0; + } +}; + +Sprite_Actor.prototype.updateTargetPosition = function() { + if (this._actor.canMove() && BattleManager.isEscaped()) { + this.retreat(); + } else if (this.shouldStepForward()) { + this.stepForward(); + } else if (!this.inHomePosition()) { + this.stepBack(); + } +}; + +Sprite_Actor.prototype.shouldStepForward = function() { + return this._actor.isInputting() || this._actor.isActing(); +}; + +Sprite_Actor.prototype.updateBitmap = function() { + Sprite_Battler.prototype.updateBitmap.call(this); + const name = this._actor.battlerName(); + if (this._battlerName !== name) { + this._battlerName = name; + this._mainSprite.bitmap = ImageManager.loadSvActor(name); + } +}; + +Sprite_Actor.prototype.updateFrame = function() { + Sprite_Battler.prototype.updateFrame.call(this); + const bitmap = this._mainSprite.bitmap; + if (bitmap) { + const motionIndex = this._motion ? this._motion.index : 0; + const pattern = this._pattern < 3 ? this._pattern : 1; + const cw = bitmap.width / 9; + const ch = bitmap.height / 6; + const cx = Math.floor(motionIndex / 6) * 3 + pattern; + const cy = motionIndex % 6; + this._mainSprite.setFrame(cx * cw, cy * ch, cw, ch); + this.setFrame(0, 0, cw, ch); + } +}; + +Sprite_Actor.prototype.updateMove = function() { + const bitmap = this._mainSprite.bitmap; + if (!bitmap || bitmap.isReady()) { + Sprite_Battler.prototype.updateMove.call(this); + } +}; + +Sprite_Actor.prototype.updateMotion = function() { + this.setupMotion(); + this.setupWeaponAnimation(); + if (this._actor.isMotionRefreshRequested()) { + this.refreshMotion(); + this._actor.clearMotion(); + } + this.updateMotionCount(); +}; + +Sprite_Actor.prototype.updateMotionCount = function() { + if (this._motion && ++this._motionCount >= this.motionSpeed()) { + if (this._motion.loop) { + this._pattern = (this._pattern + 1) % 4; + } else if (this._pattern < 2) { + this._pattern++; + } else { + this.refreshMotion(); + } + this._motionCount = 0; + } +}; + +Sprite_Actor.prototype.motionSpeed = function() { + return 12; +}; + +Sprite_Actor.prototype.refreshMotion = function() { + const actor = this._actor; + if (actor) { + const stateMotion = actor.stateMotionIndex(); + if (actor.isInputting() || actor.isActing()) { + this.startMotion("walk"); + } else if (stateMotion === 3) { + this.startMotion("dead"); + } else if (stateMotion === 2) { + this.startMotion("sleep"); + } else if (actor.isChanting()) { + this.startMotion("chant"); + } else if (actor.isGuard() || actor.isGuardWaiting()) { + this.startMotion("guard"); + } else if (stateMotion === 1) { + this.startMotion("abnormal"); + } else if (actor.isDying()) { + this.startMotion("dying"); + } else if (actor.isUndecided()) { + this.startMotion("walk"); + } else { + this.startMotion("wait"); + } + } +}; + +Sprite_Actor.prototype.startEntryMotion = function() { + if (this._actor && this._actor.canMove()) { + this.startMotion("walk"); + this.startMove(0, 0, 30); + } else if (!this.isMoving()) { + this.refreshMotion(); + this.startMove(0, 0, 0); + } +}; + +Sprite_Actor.prototype.stepForward = function() { + this.startMove(-48, 0, 12); +}; + +Sprite_Actor.prototype.stepBack = function() { + this.startMove(0, 0, 12); +}; + +Sprite_Actor.prototype.retreat = function() { + this.startMove(300, 0, 30); +}; + +Sprite_Actor.prototype.onMoveEnd = function() { + Sprite_Battler.prototype.onMoveEnd.call(this); + if (!BattleManager.isBattleEnd()) { + this.refreshMotion(); + } +}; + +Sprite_Actor.prototype.damageOffsetX = function() { + return Sprite_Battler.prototype.damageOffsetX.call(this) - 32; +}; + +Sprite_Actor.prototype.damageOffsetY = function() { + return Sprite_Battler.prototype.damageOffsetY.call(this); +}; + +//----------------------------------------------------------------------------- +// Sprite_Enemy +// +// The sprite for displaying an enemy. + +function Sprite_Enemy() { + this.initialize(...arguments); +} + +Sprite_Enemy.prototype = Object.create(Sprite_Battler.prototype); +Sprite_Enemy.prototype.constructor = Sprite_Enemy; + +Sprite_Enemy.prototype.initialize = function(battler) { + Sprite_Battler.prototype.initialize.call(this, battler); +}; + +Sprite_Enemy.prototype.initMembers = function() { + Sprite_Battler.prototype.initMembers.call(this); + this._enemy = null; + this._appeared = false; + this._battlerName = null; + this._battlerHue = 0; + this._effectType = null; + this._effectDuration = 0; + this._shake = 0; + this.createStateIconSprite(); +}; + +Sprite_Enemy.prototype.createStateIconSprite = function() { + this._stateIconSprite = new Sprite_StateIcon(); + this.addChild(this._stateIconSprite); +}; + +Sprite_Enemy.prototype.setBattler = function(battler) { + Sprite_Battler.prototype.setBattler.call(this, battler); + this._enemy = battler; + this.setHome(battler.screenX(), battler.screenY()); + this._stateIconSprite.setup(battler); +}; + +Sprite_Enemy.prototype.update = function() { + Sprite_Battler.prototype.update.call(this); + if (this._enemy) { + this.updateEffect(); + this.updateStateSprite(); + } +}; + +Sprite_Enemy.prototype.updateBitmap = function() { + Sprite_Battler.prototype.updateBitmap.call(this); + const name = this._enemy.battlerName(); + const hue = this._enemy.battlerHue(); + if (this._battlerName !== name || this._battlerHue !== hue) { + this._battlerName = name; + this._battlerHue = hue; + this.loadBitmap(name); + this.setHue(hue); + this.initVisibility(); + } +}; + +Sprite_Enemy.prototype.loadBitmap = function(name) { + if ($gameSystem.isSideView()) { + this.bitmap = ImageManager.loadSvEnemy(name); + } else { + this.bitmap = ImageManager.loadEnemy(name); + } +}; + +Sprite_Enemy.prototype.setHue = function(hue) { + Sprite_Battler.prototype.setHue.call(this, hue); + for (const child of this.children) { + if (child.setHue) { + child.setHue(-hue); + } + } +}; + +Sprite_Enemy.prototype.updateFrame = function() { + Sprite_Battler.prototype.updateFrame.call(this); + if (this._effectType === "bossCollapse") { + this.setFrame(0, 0, this.bitmap.width, this._effectDuration); + } else { + this.setFrame(0, 0, this.bitmap.width, this.bitmap.height); + } +}; + +Sprite_Enemy.prototype.updatePosition = function() { + Sprite_Battler.prototype.updatePosition.call(this); + this.x += this._shake; +}; + +Sprite_Enemy.prototype.updateStateSprite = function() { + this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9); + if (this._stateIconSprite.y < 20 - this.y) { + this._stateIconSprite.y = 20 - this.y; + } +}; + +Sprite_Enemy.prototype.initVisibility = function() { + this._appeared = this._enemy.isAlive(); + if (!this._appeared) { + this.opacity = 0; + } +}; + +Sprite_Enemy.prototype.setupEffect = function() { + if (this._appeared && this._enemy.isEffectRequested()) { + this.startEffect(this._enemy.effectType()); + this._enemy.clearEffect(); + } + if (!this._appeared && this._enemy.isAlive()) { + this.startEffect("appear"); + } else if (this._appeared && this._enemy.isHidden()) { + this.startEffect("disappear"); + } +}; + +Sprite_Enemy.prototype.startEffect = function(effectType) { + this._effectType = effectType; + switch (this._effectType) { + case "appear": + this.startAppear(); + break; + case "disappear": + this.startDisappear(); + break; + case "whiten": + this.startWhiten(); + break; + case "blink": + this.startBlink(); + break; + case "collapse": + this.startCollapse(); + break; + case "bossCollapse": + this.startBossCollapse(); + break; + case "instantCollapse": + this.startInstantCollapse(); + break; + } + this.revertToNormal(); +}; + +Sprite_Enemy.prototype.startAppear = function() { + this._effectDuration = 16; + this._appeared = true; +}; + +Sprite_Enemy.prototype.startDisappear = function() { + this._effectDuration = 32; + this._appeared = false; +}; + +Sprite_Enemy.prototype.startWhiten = function() { + this._effectDuration = 16; +}; + +Sprite_Enemy.prototype.startBlink = function() { + this._effectDuration = 20; +}; + +Sprite_Enemy.prototype.startCollapse = function() { + this._effectDuration = 32; + this._appeared = false; +}; + +Sprite_Enemy.prototype.startBossCollapse = function() { + this._effectDuration = this.bitmap.height; + this._appeared = false; +}; + +Sprite_Enemy.prototype.startInstantCollapse = function() { + this._effectDuration = 16; + this._appeared = false; +}; + +Sprite_Enemy.prototype.updateEffect = function() { + this.setupEffect(); + if (this._effectDuration > 0) { + this._effectDuration--; + switch (this._effectType) { + case "whiten": + this.updateWhiten(); + break; + case "blink": + this.updateBlink(); + break; + case "appear": + this.updateAppear(); + break; + case "disappear": + this.updateDisappear(); + break; + case "collapse": + this.updateCollapse(); + break; + case "bossCollapse": + this.updateBossCollapse(); + break; + case "instantCollapse": + this.updateInstantCollapse(); + break; + } + if (this._effectDuration === 0) { + this._effectType = null; + } + } +}; + +Sprite_Enemy.prototype.isEffecting = function() { + return this._effectType !== null; +}; + +Sprite_Enemy.prototype.revertToNormal = function() { + this._shake = 0; + this.blendMode = 0; + this.opacity = 255; + this.setBlendColor([0, 0, 0, 0]); +}; + +Sprite_Enemy.prototype.updateWhiten = function() { + const alpha = 128 - (16 - this._effectDuration) * 8; + this.setBlendColor([255, 255, 255, alpha]); +}; + +Sprite_Enemy.prototype.updateBlink = function() { + this.opacity = this._effectDuration % 10 < 5 ? 255 : 0; +}; + +Sprite_Enemy.prototype.updateAppear = function() { + this.opacity = (16 - this._effectDuration) * 16; +}; + +Sprite_Enemy.prototype.updateDisappear = function() { + this.opacity = 256 - (32 - this._effectDuration) * 10; +}; + +Sprite_Enemy.prototype.updateCollapse = function() { + this.blendMode = 1; + this.setBlendColor([255, 128, 128, 128]); + this.opacity *= this._effectDuration / (this._effectDuration + 1); +}; + +Sprite_Enemy.prototype.updateBossCollapse = function() { + this._shake = (this._effectDuration % 2) * 4 - 2; + this.blendMode = 1; + this.opacity *= this._effectDuration / (this._effectDuration + 1); + this.setBlendColor([255, 255, 255, 255 - this.opacity]); + if (this._effectDuration % 20 === 19) { + SoundManager.playBossCollapse2(); + } +}; + +Sprite_Enemy.prototype.updateInstantCollapse = function() { + this.opacity = 0; +}; + +Sprite_Enemy.prototype.damageOffsetX = function() { + return Sprite_Battler.prototype.damageOffsetX.call(this); +}; + +Sprite_Enemy.prototype.damageOffsetY = function() { + return Sprite_Battler.prototype.damageOffsetY.call(this) - 8; +}; + +//----------------------------------------------------------------------------- +// Sprite_Animation +// +// The sprite for displaying an animation. + +function Sprite_Animation() { + this.initialize(...arguments); +} + +Sprite_Animation.prototype = Object.create(Sprite.prototype); +Sprite_Animation.prototype.constructor = Sprite_Animation; + +Sprite_Animation.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); +}; + +Sprite_Animation.prototype.initMembers = function() { + this._targets = []; + this._animation = null; + this._mirror = false; + this._delay = 0; + this._previous = null; + this._effect = null; + this._handle = null; + this._playing = false; + this._started = false; + this._frameIndex = 0; + this._maxTimingFrames = 0; + this._flashColor = [0, 0, 0, 0]; + this._flashDuration = 0; + this._viewportSize = 4096; + this.z = 8; +}; + +Sprite_Animation.prototype.destroy = function(options) { + Sprite.prototype.destroy.call(this, options); + if (this._handle) { + this._handle.stop(); + } + this._effect = null; + this._handle = null; + this._playing = false; + this._started = false; +}; + +// prettier-ignore +Sprite_Animation.prototype.setup = function( + targets, animation, mirror, delay, previous +) { + this._targets = targets; + this._animation = animation; + this._mirror = mirror; + this._delay = delay; + this._previous = previous; + this._effect = EffectManager.load(animation.effectName); + this._playing = true; + const timings = animation.soundTimings.concat(animation.flashTimings); + for (const timing of timings) { + if (timing.frame > this._maxTimingFrames) { + this._maxTimingFrames = timing.frame; + } + } +}; + +Sprite_Animation.prototype.update = function() { + Sprite.prototype.update.call(this); + if (this._delay > 0) { + this._delay--; + } else if (this._playing) { + if (!this._started && this.canStart()) { + if (this._effect) { + if (this._effect.isLoaded) { + this._handle = Graphics.effekseer.play(this._effect); + this._started = true; + } else { + EffectManager.checkErrors(); + } + } else { + this._started = true; + } + } + if (this._started) { + this.updateEffectGeometry(); + this.updateMain(); + this.updateFlash(); + } + } +}; + +Sprite_Animation.prototype.canStart = function() { + if (this._previous && this.shouldWaitForPrevious()) { + return !this._previous.isPlaying(); + } else { + return true; + } +}; + +Sprite_Animation.prototype.shouldWaitForPrevious = function() { + // [Note] Older versions of Effekseer were very heavy on some mobile + // devices. We don't need this anymore. + return false; +}; + +Sprite_Animation.prototype.updateEffectGeometry = function() { + const scale = this._animation.scale / 100; + const r = Math.PI / 180; + const rx = this._animation.rotation.x * r; + const ry = this._animation.rotation.y * r; + const rz = this._animation.rotation.z * r; + if (this._handle) { + this._handle.setLocation(0, 0, 0); + this._handle.setRotation(rx, ry, rz); + this._handle.setScale(scale, scale, scale); + this._handle.setSpeed(this._animation.speed / 100); + } +}; + +Sprite_Animation.prototype.updateMain = function() { + this.processSoundTimings(); + this.processFlashTimings(); + this._frameIndex++; + this.checkEnd(); +}; + +Sprite_Animation.prototype.processSoundTimings = function() { + for (const timing of this._animation.soundTimings) { + if (timing.frame === this._frameIndex) { + AudioManager.playSe(timing.se); + } + } +}; + +Sprite_Animation.prototype.processFlashTimings = function() { + for (const timing of this._animation.flashTimings) { + if (timing.frame === this._frameIndex) { + this._flashColor = timing.color.clone(); + this._flashDuration = timing.duration; + } + } +}; + +Sprite_Animation.prototype.checkEnd = function() { + if ( + this._frameIndex > this._maxTimingFrames && + this._flashDuration === 0 && + !(this._handle && this._handle.exists) + ) { + this._playing = false; + } +}; + +Sprite_Animation.prototype.updateFlash = function() { + if (this._flashDuration > 0) { + const d = this._flashDuration--; + this._flashColor[3] *= (d - 1) / d; + for (const target of this._targets) { + target.setBlendColor(this._flashColor); + } + } +}; + +Sprite_Animation.prototype.isPlaying = function() { + return this._playing; +}; + +Sprite_Animation.prototype.setRotation = function(x, y, z) { + if (this._handle) { + this._handle.setRotation(x, y, z); + } +}; + +Sprite_Animation.prototype._render = function(renderer) { + if (this._targets.length > 0 && this._handle && this._handle.exists) { + this.onBeforeRender(renderer); + this.setProjectionMatrix(renderer); + this.setCameraMatrix(renderer); + this.setViewport(renderer); + Graphics.effekseer.beginDraw(); + Graphics.effekseer.drawHandle(this._handle); + Graphics.effekseer.endDraw(); + this.resetViewport(renderer); + this.onAfterRender(renderer); + } +}; + +Sprite_Animation.prototype.setProjectionMatrix = function(renderer) { + const x = this._mirror ? -1 : 1; + const y = -1; + const p = -(this._viewportSize / renderer.view.height); + // prettier-ignore + Graphics.effekseer.setProjectionMatrix([ + x, 0, 0, 0, + 0, y, 0, 0, + 0, 0, 1, p, + 0, 0, 0, 1, + ]); +}; + +Sprite_Animation.prototype.setCameraMatrix = function(/*renderer*/) { + // prettier-ignore + Graphics.effekseer.setCameraMatrix([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, -10, 1 + ]); +}; + +Sprite_Animation.prototype.setViewport = function(renderer) { + const vw = this._viewportSize; + const vh = this._viewportSize; + const vx = this._animation.offsetX - vw / 2; + const vy = this._animation.offsetY - vh / 2; + const pos = this.targetPosition(renderer); + renderer.gl.viewport(vx + pos.x, vy + pos.y, vw, vh); +}; + +Sprite_Animation.prototype.targetPosition = function(renderer) { + const pos = new Point(); + if (this._animation.displayType === 2) { + pos.x = renderer.view.width / 2; + pos.y = renderer.view.height / 2; + } else { + for (const target of this._targets) { + const tpos = this.targetSpritePosition(target); + pos.x += tpos.x; + pos.y += tpos.y; + } + pos.x /= this._targets.length; + pos.y /= this._targets.length; + } + return pos; +}; + +Sprite_Animation.prototype.targetSpritePosition = function(sprite) { + const point = new Point(0, -sprite.height / 2); + if (this._animation.alignBottom) { + point.y = 0; + } + sprite.updateTransform(); + return sprite.worldTransform.apply(point); +}; + +Sprite_Animation.prototype.resetViewport = function(renderer) { + renderer.gl.viewport(0, 0, renderer.view.width, renderer.view.height); +}; + +Sprite_Animation.prototype.onBeforeRender = function(renderer) { + renderer.batch.flush(); + renderer.geometry.reset(); +}; + +Sprite_Animation.prototype.onAfterRender = function(renderer) { + renderer.texture.reset(); + renderer.geometry.reset(); + renderer.state.reset(); + renderer.shader.reset(); + renderer.framebuffer.reset(); +}; + +//----------------------------------------------------------------------------- +// Sprite_AnimationMV +// +// The sprite for displaying an old format animation. + +function Sprite_AnimationMV() { + this.initialize(...arguments); +} + +Sprite_AnimationMV.prototype = Object.create(Sprite.prototype); +Sprite_AnimationMV.prototype.constructor = Sprite_AnimationMV; + +Sprite_AnimationMV.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); +}; + +Sprite_AnimationMV.prototype.initMembers = function() { + this._targets = []; + this._animation = null; + this._mirror = false; + this._delay = 0; + this._rate = 4; + this._duration = 0; + this._flashColor = [0, 0, 0, 0]; + this._flashDuration = 0; + this._screenFlashDuration = 0; + this._hidingDuration = 0; + this._hue1 = 0; + this._hue2 = 0; + this._bitmap1 = null; + this._bitmap2 = null; + this._cellSprites = []; + this._screenFlashSprite = null; + this.z = 8; +}; + +// prettier-ignore +Sprite_AnimationMV.prototype.setup = function( + targets, animation, mirror, delay +) { + this._targets = targets; + this._animation = animation; + this._mirror = mirror; + this._delay = delay; + if (this._animation) { + this.setupRate(); + this.setupDuration(); + this.loadBitmaps(); + this.createCellSprites(); + this.createScreenFlashSprite(); + } +}; + +Sprite_AnimationMV.prototype.setupRate = function() { + this._rate = 4; +}; + +Sprite_AnimationMV.prototype.setupDuration = function() { + this._duration = this._animation.frames.length * this._rate + 1; +}; + +Sprite_AnimationMV.prototype.update = function() { + Sprite.prototype.update.call(this); + this.updateMain(); + this.updateFlash(); + this.updateScreenFlash(); + this.updateHiding(); +}; + +Sprite_AnimationMV.prototype.updateFlash = function() { + if (this._flashDuration > 0) { + const d = this._flashDuration--; + this._flashColor[3] *= (d - 1) / d; + for (const target of this._targets) { + target.setBlendColor(this._flashColor); + } + } +}; + +Sprite_AnimationMV.prototype.updateScreenFlash = function() { + if (this._screenFlashDuration > 0) { + const d = this._screenFlashDuration--; + if (this._screenFlashSprite) { + this._screenFlashSprite.x = -this.absoluteX(); + this._screenFlashSprite.y = -this.absoluteY(); + this._screenFlashSprite.opacity *= (d - 1) / d; + this._screenFlashSprite.visible = this._screenFlashDuration > 0; + } + } +}; + +Sprite_AnimationMV.prototype.absoluteX = function() { + let x = 0; + let object = this; + while (object) { + x += object.x; + object = object.parent; + } + return x; +}; + +Sprite_AnimationMV.prototype.absoluteY = function() { + let y = 0; + let object = this; + while (object) { + y += object.y; + object = object.parent; + } + return y; +}; + +Sprite_AnimationMV.prototype.updateHiding = function() { + if (this._hidingDuration > 0) { + this._hidingDuration--; + if (this._hidingDuration === 0) { + for (const target of this._targets) { + target.show(); + } + } + } +}; + +Sprite_AnimationMV.prototype.isPlaying = function() { + return this._duration > 0; +}; + +Sprite_AnimationMV.prototype.loadBitmaps = function() { + const name1 = this._animation.animation1Name; + const name2 = this._animation.animation2Name; + this._hue1 = this._animation.animation1Hue; + this._hue2 = this._animation.animation2Hue; + this._bitmap1 = ImageManager.loadAnimation(name1); + this._bitmap2 = ImageManager.loadAnimation(name2); +}; + +Sprite_AnimationMV.prototype.isReady = function() { + return ( + this._bitmap1 && + this._bitmap1.isReady() && + this._bitmap2 && + this._bitmap2.isReady() + ); +}; + +Sprite_AnimationMV.prototype.createCellSprites = function() { + this._cellSprites = []; + for (let i = 0; i < 16; i++) { + const sprite = new Sprite(); + sprite.anchor.x = 0.5; + sprite.anchor.y = 0.5; + this._cellSprites.push(sprite); + this.addChild(sprite); + } +}; + +Sprite_AnimationMV.prototype.createScreenFlashSprite = function() { + this._screenFlashSprite = new ScreenSprite(); + this.addChild(this._screenFlashSprite); +}; + +Sprite_AnimationMV.prototype.updateMain = function() { + if (this.isPlaying() && this.isReady()) { + if (this._delay > 0) { + this._delay--; + } else { + this._duration--; + this.updatePosition(); + if (this._duration % this._rate === 0) { + this.updateFrame(); + } + if (this._duration <= 0) { + this.onEnd(); + } + } + } +}; + +Sprite_AnimationMV.prototype.updatePosition = function() { + if (this._animation.position === 3) { + this.x = this.parent.width / 2; + this.y = this.parent.height / 2; + } else if (this._targets.length > 0) { + const target = this._targets[0]; + const parent = target.parent; + const grandparent = parent ? parent.parent : null; + this.x = target.x; + this.y = target.y; + if (this.parent === grandparent) { + this.x += parent.x; + this.y += parent.y; + } + if (this._animation.position === 0) { + this.y -= target.height; + } else if (this._animation.position === 1) { + this.y -= target.height / 2; + } + } +}; + +Sprite_AnimationMV.prototype.updateFrame = function() { + if (this._duration > 0) { + const frameIndex = this.currentFrameIndex(); + this.updateAllCellSprites(this._animation.frames[frameIndex]); + for (const timing of this._animation.timings) { + if (timing.frame === frameIndex) { + this.processTimingData(timing); + } + } + } +}; + +Sprite_AnimationMV.prototype.currentFrameIndex = function() { + return ( + this._animation.frames.length - + Math.floor((this._duration + this._rate - 1) / this._rate) + ); +}; + +Sprite_AnimationMV.prototype.updateAllCellSprites = function(frame) { + if (this._targets.length > 0) { + for (let i = 0; i < this._cellSprites.length; i++) { + const sprite = this._cellSprites[i]; + if (i < frame.length) { + this.updateCellSprite(sprite, frame[i]); + } else { + sprite.visible = false; + } + } + } +}; + +Sprite_AnimationMV.prototype.updateCellSprite = function(sprite, cell) { + const pattern = cell[0]; + if (pattern >= 0) { + const sx = (pattern % 5) * 192; + const sy = Math.floor((pattern % 100) / 5) * 192; + const mirror = this._mirror; + sprite.bitmap = pattern < 100 ? this._bitmap1 : this._bitmap2; + sprite.setHue(pattern < 100 ? this._hue1 : this._hue2); + sprite.setFrame(sx, sy, 192, 192); + sprite.x = cell[1]; + sprite.y = cell[2]; + sprite.rotation = (cell[4] * Math.PI) / 180; + sprite.scale.x = cell[3] / 100; + + if (cell[5]) { + sprite.scale.x *= -1; + } + if (mirror) { + sprite.x *= -1; + sprite.rotation *= -1; + sprite.scale.x *= -1; + } + + sprite.scale.y = cell[3] / 100; + sprite.opacity = cell[6]; + sprite.blendMode = cell[7]; + sprite.visible = true; + } else { + sprite.visible = false; + } +}; + +Sprite_AnimationMV.prototype.processTimingData = function(timing) { + const duration = timing.flashDuration * this._rate; + switch (timing.flashScope) { + case 1: + this.startFlash(timing.flashColor, duration); + break; + case 2: + this.startScreenFlash(timing.flashColor, duration); + break; + case 3: + this.startHiding(duration); + break; + } + if (timing.se) { + AudioManager.playSe(timing.se); + } +}; + +Sprite_AnimationMV.prototype.startFlash = function(color, duration) { + this._flashColor = color.clone(); + this._flashDuration = duration; +}; + +Sprite_AnimationMV.prototype.startScreenFlash = function(color, duration) { + this._screenFlashDuration = duration; + if (this._screenFlashSprite) { + this._screenFlashSprite.setColor(color[0], color[1], color[2]); + this._screenFlashSprite.opacity = color[3]; + } +}; + +Sprite_AnimationMV.prototype.startHiding = function(duration) { + this._hidingDuration = duration; + for (const target of this._targets) { + target.hide(); + } +}; + +Sprite_AnimationMV.prototype.onEnd = function() { + this._flashDuration = 0; + this._screenFlashDuration = 0; + this._hidingDuration = 0; + for (const target of this._targets) { + target.setBlendColor([0, 0, 0, 0]); + target.show(); + } +}; + +//----------------------------------------------------------------------------- +// Sprite_Battleback +// +// The sprite for displaying a background image in battle. + +function Sprite_Battleback() { + this.initialize(...arguments); +} + +Sprite_Battleback.prototype = Object.create(TilingSprite.prototype); +Sprite_Battleback.prototype.constructor = Sprite_Battleback; + +Sprite_Battleback.prototype.initialize = function(type) { + TilingSprite.prototype.initialize.call(this); + if (type === 0) { + this.bitmap = this.battleback1Bitmap(); + } else { + this.bitmap = this.battleback2Bitmap(); + } +}; + +Sprite_Battleback.prototype.adjustPosition = function() { + this.width = Math.floor((1000 * Graphics.width) / 816); + this.height = Math.floor((740 * Graphics.height) / 624); + this.x = (Graphics.width - this.width) / 2; + if ($gameSystem.isSideView()) { + this.y = Graphics.height - this.height; + } else { + this.y = 0; + } + const ratioX = this.width / this.bitmap.width; + const ratioY = this.height / this.bitmap.height; + const scale = Math.max(ratioX, ratioY, 1.0); + this.scale.x = scale; + this.scale.y = scale; +}; + +Sprite_Battleback.prototype.battleback1Bitmap = function() { + return ImageManager.loadBattleback1(this.battleback1Name()); +}; + +Sprite_Battleback.prototype.battleback2Bitmap = function() { + return ImageManager.loadBattleback2(this.battleback2Name()); +}; + +Sprite_Battleback.prototype.battleback1Name = function() { + if (BattleManager.isBattleTest()) { + return $dataSystem.battleback1Name; + } else if ($gameMap.battleback1Name() !== null) { + return $gameMap.battleback1Name(); + } else if ($gameMap.isOverworld()) { + return this.overworldBattleback1Name(); + } else { + return ""; + } +}; + +Sprite_Battleback.prototype.battleback2Name = function() { + if (BattleManager.isBattleTest()) { + return $dataSystem.battleback2Name; + } else if ($gameMap.battleback2Name() !== null) { + return $gameMap.battleback2Name(); + } else if ($gameMap.isOverworld()) { + return this.overworldBattleback2Name(); + } else { + return ""; + } +}; + +Sprite_Battleback.prototype.overworldBattleback1Name = function() { + if ($gamePlayer.isInVehicle()) { + return this.shipBattleback1Name(); + } else { + return this.normalBattleback1Name(); + } +}; + +Sprite_Battleback.prototype.overworldBattleback2Name = function() { + if ($gamePlayer.isInVehicle()) { + return this.shipBattleback2Name(); + } else { + return this.normalBattleback2Name(); + } +}; + +Sprite_Battleback.prototype.normalBattleback1Name = function() { + return ( + this.terrainBattleback1Name(this.autotileType(1)) || + this.terrainBattleback1Name(this.autotileType(0)) || + this.defaultBattleback1Name() + ); +}; + +Sprite_Battleback.prototype.normalBattleback2Name = function() { + return ( + this.terrainBattleback2Name(this.autotileType(1)) || + this.terrainBattleback2Name(this.autotileType(0)) || + this.defaultBattleback2Name() + ); +}; + +Sprite_Battleback.prototype.terrainBattleback1Name = function(type) { + switch (type) { + case 24: + case 25: + return "Wasteland"; + case 26: + case 27: + return "DirtField"; + case 32: + case 33: + return "Desert"; + case 34: + return "Lava1"; + case 35: + return "Lava2"; + case 40: + case 41: + return "Snowfield"; + case 42: + return "Clouds"; + case 4: + case 5: + return "PoisonSwamp"; + default: + return null; + } +}; + +Sprite_Battleback.prototype.terrainBattleback2Name = function(type) { + switch (type) { + case 20: + case 21: + return "Forest"; + case 22: + case 30: + case 38: + return "Cliff"; + case 24: + case 25: + case 26: + case 27: + return "Wasteland"; + case 32: + case 33: + return "Desert"; + case 34: + case 35: + return "Lava"; + case 40: + case 41: + return "Snowfield"; + case 42: + return "Clouds"; + case 4: + case 5: + return "PoisonSwamp"; + } +}; + +Sprite_Battleback.prototype.defaultBattleback1Name = function() { + return "Grassland"; +}; + +Sprite_Battleback.prototype.defaultBattleback2Name = function() { + return "Grassland"; +}; + +Sprite_Battleback.prototype.shipBattleback1Name = function() { + return "Ship"; +}; + +Sprite_Battleback.prototype.shipBattleback2Name = function() { + return "Ship"; +}; + +Sprite_Battleback.prototype.autotileType = function(z) { + return $gameMap.autotileType($gamePlayer.x, $gamePlayer.y, z); +}; + +//----------------------------------------------------------------------------- +// Sprite_Damage +// +// The sprite for displaying a popup damage. + +function Sprite_Damage() { + this.initialize(...arguments); +} + +Sprite_Damage.prototype = Object.create(Sprite.prototype); +Sprite_Damage.prototype.constructor = Sprite_Damage; + +Sprite_Damage.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this._duration = 90; + this._flashColor = [0, 0, 0, 0]; + this._flashDuration = 0; + this._colorType = 0; +}; + +Sprite_Damage.prototype.destroy = function(options) { + for (const child of this.children) { + if (child.bitmap) { + child.bitmap.destroy(); + } + } + Sprite.prototype.destroy.call(this, options); +}; + +Sprite_Damage.prototype.setup = function(target) { + const result = target.result(); + if (result.missed || result.evaded) { + this._colorType = 0; + this.createMiss(); + } else if (result.hpAffected) { + this._colorType = result.hpDamage >= 0 ? 0 : 1; + this.createDigits(result.hpDamage); + } else if (target.isAlive() && result.mpDamage !== 0) { + this._colorType = result.mpDamage >= 0 ? 2 : 3; + this.createDigits(result.mpDamage); + } + if (result.critical) { + this.setupCriticalEffect(); + } +}; + +Sprite_Damage.prototype.setupCriticalEffect = function() { + this._flashColor = [255, 0, 0, 160]; + this._flashDuration = 60; +}; + +Sprite_Damage.prototype.fontFace = function() { + return $gameSystem.numberFontFace(); +}; + +Sprite_Damage.prototype.fontSize = function() { + return $gameSystem.mainFontSize() + 4; +}; + +Sprite_Damage.prototype.damageColor = function() { + return ColorManager.damageColor(this._colorType); +}; + +Sprite_Damage.prototype.outlineColor = function() { + return "rgba(0, 0, 0, 0.7)"; +}; + +Sprite_Damage.prototype.outlineWidth = function() { + return 4; +}; + +Sprite_Damage.prototype.createMiss = function() { + const h = this.fontSize(); + const w = Math.floor(h * 3.0); + const sprite = this.createChildSprite(w, h); + sprite.bitmap.drawText("Miss", 0, 0, w, h, "center"); + sprite.dy = 0; +}; + +Sprite_Damage.prototype.createDigits = function(value) { + const string = Math.abs(value).toString(); + const h = this.fontSize(); + const w = Math.floor(h * 0.75); + for (let i = 0; i < string.length; i++) { + const sprite = this.createChildSprite(w, h); + sprite.bitmap.drawText(string[i], 0, 0, w, h, "center"); + sprite.x = (i - (string.length - 1) / 2) * w; + sprite.dy = -i; + } +}; + +Sprite_Damage.prototype.createChildSprite = function(width, height) { + const sprite = new Sprite(); + sprite.bitmap = this.createBitmap(width, height); + sprite.anchor.x = 0.5; + sprite.anchor.y = 1; + sprite.y = -40; + sprite.ry = sprite.y; + this.addChild(sprite); + return sprite; +}; + +Sprite_Damage.prototype.createBitmap = function(width, height) { + const bitmap = new Bitmap(width, height); + bitmap.fontFace = this.fontFace(); + bitmap.fontSize = this.fontSize(); + bitmap.textColor = this.damageColor(); + bitmap.outlineColor = this.outlineColor(); + bitmap.outlineWidth = this.outlineWidth(); + return bitmap; +}; + +Sprite_Damage.prototype.update = function() { + Sprite.prototype.update.call(this); + if (this._duration > 0) { + this._duration--; + for (const child of this.children) { + this.updateChild(child); + } + } + this.updateFlash(); + this.updateOpacity(); +}; + +Sprite_Damage.prototype.updateChild = function(sprite) { + sprite.dy += 0.5; + sprite.ry += sprite.dy; + if (sprite.ry >= 0) { + sprite.ry = 0; + sprite.dy *= -0.6; + } + sprite.y = Math.round(sprite.ry); + sprite.setBlendColor(this._flashColor); +}; + +Sprite_Damage.prototype.updateFlash = function() { + if (this._flashDuration > 0) { + const d = this._flashDuration--; + this._flashColor[3] *= (d - 1) / d; + } +}; + +Sprite_Damage.prototype.updateOpacity = function() { + if (this._duration < 10) { + this.opacity = (255 * this._duration) / 10; + } +}; + +Sprite_Damage.prototype.isPlaying = function() { + return this._duration > 0; +}; + +//----------------------------------------------------------------------------- +// Sprite_Gauge +// +// The sprite for displaying a status gauge. + +function Sprite_Gauge() { + this.initialize(...arguments); +} + +Sprite_Gauge.prototype = Object.create(Sprite.prototype); +Sprite_Gauge.prototype.constructor = Sprite_Gauge; + +Sprite_Gauge.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); + this.createBitmap(); +}; + +Sprite_Gauge.prototype.initMembers = function() { + this._battler = null; + this._statusType = ""; + this._value = NaN; + this._maxValue = NaN; + this._targetValue = NaN; + this._targetMaxValue = NaN; + this._duration = 0; + this._flashingCount = 0; +}; + +Sprite_Gauge.prototype.destroy = function(options) { + this.bitmap.destroy(); + Sprite.prototype.destroy.call(this, options); +}; + +Sprite_Gauge.prototype.createBitmap = function() { + const width = this.bitmapWidth(); + const height = this.bitmapHeight(); + this.bitmap = new Bitmap(width, height); +}; + +Sprite_Gauge.prototype.bitmapWidth = function() { + return 128; +}; + +Sprite_Gauge.prototype.bitmapHeight = function() { + return 32; +}; + +Sprite_Gauge.prototype.textHeight = function() { + return 24; +}; + +Sprite_Gauge.prototype.gaugeHeight = function() { + return 12; +}; + +Sprite_Gauge.prototype.gaugeX = function() { + if (this._statusType === "time") { + return 0; + } else { + return this.measureLabelWidth() + 6; + } +}; + +Sprite_Gauge.prototype.labelY = function() { + return 3; +}; + +Sprite_Gauge.prototype.labelFontFace = function() { + return $gameSystem.mainFontFace(); +}; + +Sprite_Gauge.prototype.labelFontSize = function() { + return $gameSystem.mainFontSize() - 2; +}; + +Sprite_Gauge.prototype.valueFontFace = function() { + return $gameSystem.numberFontFace(); +}; + +Sprite_Gauge.prototype.valueFontSize = function() { + return $gameSystem.mainFontSize() - 6; +}; + +Sprite_Gauge.prototype.setup = function(battler, statusType) { + this._battler = battler; + this._statusType = statusType; + this._value = this.currentValue(); + this._maxValue = this.currentMaxValue(); + this.updateBitmap(); +}; + +Sprite_Gauge.prototype.update = function() { + Sprite.prototype.update.call(this); + this.updateBitmap(); +}; + +Sprite_Gauge.prototype.updateBitmap = function() { + const value = this.currentValue(); + const maxValue = this.currentMaxValue(); + if (value !== this._targetValue || maxValue !== this._targetMaxValue) { + this.updateTargetValue(value, maxValue); + } + this.updateGaugeAnimation(); + this.updateFlashing(); +}; + +Sprite_Gauge.prototype.updateTargetValue = function(value, maxValue) { + this._targetValue = value; + this._targetMaxValue = maxValue; + if (isNaN(this._value)) { + this._value = value; + this._maxValue = maxValue; + this.redraw(); + } else { + this._duration = this.smoothness(); + } +}; + +Sprite_Gauge.prototype.smoothness = function() { + return this._statusType === "time" ? 5 : 20; +}; + +Sprite_Gauge.prototype.updateGaugeAnimation = function() { + if (this._duration > 0) { + const d = this._duration; + this._value = (this._value * (d - 1) + this._targetValue) / d; + this._maxValue = (this._maxValue * (d - 1) + this._targetMaxValue) / d; + this._duration--; + this.redraw(); + } +}; + +Sprite_Gauge.prototype.updateFlashing = function() { + if (this._statusType === "time") { + this._flashingCount++; + if (this._battler.isInputting()) { + if (this._flashingCount % 30 < 15) { + this.setBlendColor(this.flashingColor1()); + } else { + this.setBlendColor(this.flashingColor2()); + } + } else { + this.setBlendColor([0, 0, 0, 0]); + } + } +}; + +Sprite_Gauge.prototype.flashingColor1 = function() { + return [255, 255, 255, 64]; +}; + +Sprite_Gauge.prototype.flashingColor2 = function() { + return [0, 0, 255, 48]; +}; + +Sprite_Gauge.prototype.isValid = function() { + if (this._battler) { + if (this._statusType === "tp" && !this._battler.isPreserveTp()) { + return $gameParty.inBattle(); + } else { + return true; + } + } + return false; +}; + +Sprite_Gauge.prototype.currentValue = function() { + if (this._battler) { + switch (this._statusType) { + case "hp": + return this._battler.hp; + case "mp": + return this._battler.mp; + case "tp": + return this._battler.tp; + case "time": + return this._battler.tpbChargeTime(); + } + } + return NaN; +}; + +Sprite_Gauge.prototype.currentMaxValue = function() { + if (this._battler) { + switch (this._statusType) { + case "hp": + return this._battler.mhp; + case "mp": + return this._battler.mmp; + case "tp": + return this._battler.maxTp(); + case "time": + return 1; + } + } + return NaN; +}; + +Sprite_Gauge.prototype.label = function() { + switch (this._statusType) { + case "hp": + return TextManager.hpA; + case "mp": + return TextManager.mpA; + case "tp": + return TextManager.tpA; + default: + return ""; + } +}; + +Sprite_Gauge.prototype.gaugeBackColor = function() { + return ColorManager.gaugeBackColor(); +}; + +Sprite_Gauge.prototype.gaugeColor1 = function() { + switch (this._statusType) { + case "hp": + return ColorManager.hpGaugeColor1(); + case "mp": + return ColorManager.mpGaugeColor1(); + case "tp": + return ColorManager.tpGaugeColor1(); + case "time": + return ColorManager.ctGaugeColor1(); + default: + return ColorManager.normalColor(); + } +}; + +Sprite_Gauge.prototype.gaugeColor2 = function() { + switch (this._statusType) { + case "hp": + return ColorManager.hpGaugeColor2(); + case "mp": + return ColorManager.mpGaugeColor2(); + case "tp": + return ColorManager.tpGaugeColor2(); + case "time": + return ColorManager.ctGaugeColor2(); + default: + return ColorManager.normalColor(); + } +}; + +Sprite_Gauge.prototype.labelColor = function() { + return ColorManager.systemColor(); +}; + +Sprite_Gauge.prototype.labelOutlineColor = function() { + return ColorManager.outlineColor(); +}; + +Sprite_Gauge.prototype.labelOutlineWidth = function() { + return 3; +}; + +Sprite_Gauge.prototype.valueColor = function() { + switch (this._statusType) { + case "hp": + return ColorManager.hpColor(this._battler); + case "mp": + return ColorManager.mpColor(this._battler); + case "tp": + return ColorManager.tpColor(this._battler); + default: + return ColorManager.normalColor(); + } +}; + +Sprite_Gauge.prototype.valueOutlineColor = function() { + return "rgba(0, 0, 0, 1)"; +}; + +Sprite_Gauge.prototype.valueOutlineWidth = function() { + return 2; +}; + +Sprite_Gauge.prototype.redraw = function() { + this.bitmap.clear(); + const currentValue = this.currentValue(); + if (!isNaN(currentValue)) { + this.drawGauge(); + if (this._statusType !== "time") { + this.drawLabel(); + if (this.isValid()) { + this.drawValue(); + } + } + } +}; + +Sprite_Gauge.prototype.drawGauge = function() { + const gaugeX = this.gaugeX(); + const gaugeY = this.textHeight() - this.gaugeHeight(); + const gaugewidth = this.bitmapWidth() - gaugeX; + const gaugeHeight = this.gaugeHeight(); + this.drawGaugeRect(gaugeX, gaugeY, gaugewidth, gaugeHeight); +}; + +Sprite_Gauge.prototype.drawGaugeRect = function(x, y, width, height) { + const rate = this.gaugeRate(); + const fillW = Math.floor((width - 2) * rate); + const fillH = height - 2; + const color0 = this.gaugeBackColor(); + const color1 = this.gaugeColor1(); + const color2 = this.gaugeColor2(); + this.bitmap.fillRect(x, y, width, height, color0); + this.bitmap.gradientFillRect(x + 1, y + 1, fillW, fillH, color1, color2); +}; + +Sprite_Gauge.prototype.gaugeRate = function() { + if (this.isValid()) { + const value = this._value; + const maxValue = this._maxValue; + return maxValue > 0 ? value / maxValue : 0; + } else { + return 0; + } +}; + +Sprite_Gauge.prototype.drawLabel = function() { + const label = this.label(); + const x = this.labelOutlineWidth() / 2; + const y = this.labelY(); + const width = this.bitmapWidth(); + const height = this.textHeight(); + this.setupLabelFont(); + this.bitmap.paintOpacity = this.labelOpacity(); + this.bitmap.drawText(label, x, y, width, height, "left"); + this.bitmap.paintOpacity = 255; +}; + +Sprite_Gauge.prototype.setupLabelFont = function() { + this.bitmap.fontFace = this.labelFontFace(); + this.bitmap.fontSize = this.labelFontSize(); + this.bitmap.textColor = this.labelColor(); + this.bitmap.outlineColor = this.labelOutlineColor(); + this.bitmap.outlineWidth = this.labelOutlineWidth(); +}; + +Sprite_Gauge.prototype.measureLabelWidth = function() { + this.setupLabelFont(); + const labels = [TextManager.hpA, TextManager.mpA, TextManager.tpA]; + const widths = labels.map(str => this.bitmap.measureTextWidth(str)); + return Math.ceil(Math.max(...widths)); +}; + +Sprite_Gauge.prototype.labelOpacity = function() { + return this.isValid() ? 255 : 160; +}; + +Sprite_Gauge.prototype.drawValue = function() { + const currentValue = this.currentValue(); + const width = this.bitmapWidth(); + const height = this.textHeight(); + this.setupValueFont(); + this.bitmap.drawText(currentValue, 0, 0, width, height, "right"); +}; + +Sprite_Gauge.prototype.setupValueFont = function() { + this.bitmap.fontFace = this.valueFontFace(); + this.bitmap.fontSize = this.valueFontSize(); + this.bitmap.textColor = this.valueColor(); + this.bitmap.outlineColor = this.valueOutlineColor(); + this.bitmap.outlineWidth = this.valueOutlineWidth(); +}; + +//----------------------------------------------------------------------------- +// Sprite_Name +// +// The sprite for displaying a status gauge. + +function Sprite_Name() { + this.initialize(...arguments); +} + +Sprite_Name.prototype = Object.create(Sprite.prototype); +Sprite_Name.prototype.constructor = Sprite_Name; + +Sprite_Name.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); + this.createBitmap(); +}; + +Sprite_Name.prototype.initMembers = function() { + this._battler = null; + this._name = ""; + this._textColor = ""; +}; + +Sprite_Name.prototype.destroy = function(options) { + this.bitmap.destroy(); + Sprite.prototype.destroy.call(this, options); +}; + +Sprite_Name.prototype.createBitmap = function() { + const width = this.bitmapWidth(); + const height = this.bitmapHeight(); + this.bitmap = new Bitmap(width, height); +}; + +Sprite_Name.prototype.bitmapWidth = function() { + return 128; +}; + +Sprite_Name.prototype.bitmapHeight = function() { + return 24; +}; + +Sprite_Name.prototype.fontFace = function() { + return $gameSystem.mainFontFace(); +}; + +Sprite_Name.prototype.fontSize = function() { + return $gameSystem.mainFontSize(); +}; + +Sprite_Name.prototype.setup = function(battler) { + this._battler = battler; + this.updateBitmap(); +}; + +Sprite_Name.prototype.update = function() { + Sprite.prototype.update.call(this); + this.updateBitmap(); +}; + +Sprite_Name.prototype.updateBitmap = function() { + const name = this.name(); + const color = this.textColor(); + if (name !== this._name || color !== this._textColor) { + this._name = name; + this._textColor = color; + this.redraw(); + } +}; + +Sprite_Name.prototype.name = function() { + return this._battler ? this._battler.name() : ""; +}; + +Sprite_Name.prototype.textColor = function() { + return ColorManager.hpColor(this._battler); +}; + +Sprite_Name.prototype.outlineColor = function() { + return ColorManager.outlineColor(); +}; + +Sprite_Name.prototype.outlineWidth = function() { + return 3; +}; + +Sprite_Name.prototype.redraw = function() { + const name = this.name(); + const width = this.bitmapWidth(); + const height = this.bitmapHeight(); + this.setupFont(); + this.bitmap.clear(); + this.bitmap.drawText(name, 0, 0, width, height, "left"); +}; + +Sprite_Name.prototype.setupFont = function() { + this.bitmap.fontFace = this.fontFace(); + this.bitmap.fontSize = this.fontSize(); + this.bitmap.textColor = this.textColor(); + this.bitmap.outlineColor = this.outlineColor(); + this.bitmap.outlineWidth = this.outlineWidth(); +}; + +//----------------------------------------------------------------------------- +// Sprite_StateIcon +// +// The sprite for displaying state icons. + +function Sprite_StateIcon() { + this.initialize(...arguments); +} + +Sprite_StateIcon.prototype = Object.create(Sprite.prototype); +Sprite_StateIcon.prototype.constructor = Sprite_StateIcon; + +Sprite_StateIcon.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); + this.loadBitmap(); +}; + +Sprite_StateIcon.prototype.initMembers = function() { + this._battler = null; + this._iconIndex = 0; + this._animationCount = 0; + this._animationIndex = 0; + this.anchor.x = 0.5; + this.anchor.y = 0.5; +}; + +Sprite_StateIcon.prototype.loadBitmap = function() { + this.bitmap = ImageManager.loadSystem("IconSet"); + this.setFrame(0, 0, 0, 0); +}; + +Sprite_StateIcon.prototype.setup = function(battler) { + if (this._battler !== battler) { + this._battler = battler; + this._animationCount = this.animationWait(); + } +}; + +Sprite_StateIcon.prototype.update = function() { + Sprite.prototype.update.call(this); + this._animationCount++; + if (this._animationCount >= this.animationWait()) { + this.updateIcon(); + this.updateFrame(); + this._animationCount = 0; + } +}; + +Sprite_StateIcon.prototype.animationWait = function() { + return 40; +}; + +Sprite_StateIcon.prototype.updateIcon = function() { + const icons = []; + if (this.shouldDisplay()) { + icons.push(...this._battler.allIcons()); + } + if (icons.length > 0) { + this._animationIndex++; + if (this._animationIndex >= icons.length) { + this._animationIndex = 0; + } + this._iconIndex = icons[this._animationIndex]; + } else { + this._animationIndex = 0; + this._iconIndex = 0; + } +}; + +Sprite_StateIcon.prototype.shouldDisplay = function() { + const battler = this._battler; + return battler && (battler.isActor() || battler.isAlive()); +}; + +Sprite_StateIcon.prototype.updateFrame = function() { + const pw = ImageManager.iconWidth; + const ph = ImageManager.iconHeight; + const sx = (this._iconIndex % 16) * pw; + const sy = Math.floor(this._iconIndex / 16) * ph; + this.setFrame(sx, sy, pw, ph); +}; + +//----------------------------------------------------------------------------- +// Sprite_StateOverlay +// +// The sprite for displaying an overlay image for a state. + +function Sprite_StateOverlay() { + this.initialize(...arguments); +} + +Sprite_StateOverlay.prototype = Object.create(Sprite.prototype); +Sprite_StateOverlay.prototype.constructor = Sprite_StateOverlay; + +Sprite_StateOverlay.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); + this.loadBitmap(); +}; + +Sprite_StateOverlay.prototype.initMembers = function() { + this._battler = null; + this._overlayIndex = 0; + this._animationCount = 0; + this._pattern = 0; + this.anchor.x = 0.5; + this.anchor.y = 1; +}; + +Sprite_StateOverlay.prototype.loadBitmap = function() { + this.bitmap = ImageManager.loadSystem("States"); + this.setFrame(0, 0, 0, 0); +}; + +Sprite_StateOverlay.prototype.setup = function(battler) { + this._battler = battler; +}; + +Sprite_StateOverlay.prototype.update = function() { + Sprite.prototype.update.call(this); + this._animationCount++; + if (this._animationCount >= this.animationWait()) { + this.updatePattern(); + this.updateFrame(); + this._animationCount = 0; + } +}; + +Sprite_StateOverlay.prototype.animationWait = function() { + return 8; +}; + +Sprite_StateOverlay.prototype.updatePattern = function() { + this._pattern++; + this._pattern %= 8; + if (this._battler) { + this._overlayIndex = this._battler.stateOverlayIndex(); + } else { + this._overlayIndex = 0; + } +}; + +Sprite_StateOverlay.prototype.updateFrame = function() { + if (this._overlayIndex > 0) { + const w = 96; + const h = 96; + const sx = this._pattern * w; + const sy = (this._overlayIndex - 1) * h; + this.setFrame(sx, sy, w, h); + } else { + this.setFrame(0, 0, 0, 0); + } +}; + +//----------------------------------------------------------------------------- +// Sprite_Weapon +// +// The sprite for displaying a weapon image for attacking. + +function Sprite_Weapon() { + this.initialize(...arguments); +} + +Sprite_Weapon.prototype = Object.create(Sprite.prototype); +Sprite_Weapon.prototype.constructor = Sprite_Weapon; + +Sprite_Weapon.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); +}; + +Sprite_Weapon.prototype.initMembers = function() { + this._weaponImageId = 0; + this._animationCount = 0; + this._pattern = 0; + this.anchor.x = 0.5; + this.anchor.y = 1; + this.x = -16; +}; + +Sprite_Weapon.prototype.setup = function(weaponImageId) { + this._weaponImageId = weaponImageId; + this._animationCount = 0; + this._pattern = 0; + this.loadBitmap(); + this.updateFrame(); +}; + +Sprite_Weapon.prototype.update = function() { + Sprite.prototype.update.call(this); + this._animationCount++; + if (this._animationCount >= this.animationWait()) { + this.updatePattern(); + this.updateFrame(); + this._animationCount = 0; + } +}; + +Sprite_Weapon.prototype.animationWait = function() { + return 12; +}; + +Sprite_Weapon.prototype.updatePattern = function() { + this._pattern++; + if (this._pattern >= 3) { + this._weaponImageId = 0; + } +}; + +Sprite_Weapon.prototype.loadBitmap = function() { + const pageId = Math.floor((this._weaponImageId - 1) / 12) + 1; + if (pageId >= 1) { + this.bitmap = ImageManager.loadSystem("Weapons" + pageId); + } else { + this.bitmap = ImageManager.loadSystem(""); + } +}; + +Sprite_Weapon.prototype.updateFrame = function() { + if (this._weaponImageId > 0) { + const index = (this._weaponImageId - 1) % 12; + const w = 96; + const h = 64; + const sx = (Math.floor(index / 6) * 3 + this._pattern) * w; + const sy = Math.floor(index % 6) * h; + this.setFrame(sx, sy, w, h); + } else { + this.setFrame(0, 0, 0, 0); + } +}; + +Sprite_Weapon.prototype.isPlaying = function() { + return this._weaponImageId > 0; +}; + +//----------------------------------------------------------------------------- +// Sprite_Balloon +// +// The sprite for displaying a balloon icon. + +function Sprite_Balloon() { + this.initialize(...arguments); +} + +Sprite_Balloon.prototype = Object.create(Sprite.prototype); +Sprite_Balloon.prototype.constructor = Sprite_Balloon; + +Sprite_Balloon.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.initMembers(); + this.loadBitmap(); +}; + +Sprite_Balloon.prototype.initMembers = function() { + this._target = null; + this._balloonId = 0; + this._duration = 0; + this.anchor.x = 0.5; + this.anchor.y = 1; + this.z = 7; +}; + +Sprite_Balloon.prototype.loadBitmap = function() { + this.bitmap = ImageManager.loadSystem("Balloon"); + this.setFrame(0, 0, 0, 0); +}; + +Sprite_Balloon.prototype.setup = function(targetSprite, balloonId) { + this._target = targetSprite; + this._balloonId = balloonId; + this._duration = 8 * this.speed() + this.waitTime(); +}; + +Sprite_Balloon.prototype.update = function() { + Sprite.prototype.update.call(this); + if (this._duration > 0) { + this._duration--; + if (this._duration > 0) { + this.updatePosition(); + this.updateFrame(); + } + } +}; + +Sprite_Balloon.prototype.updatePosition = function() { + this.x = this._target.x; + this.y = this._target.y - this._target.height; +}; + +Sprite_Balloon.prototype.updateFrame = function() { + const w = 48; + const h = 48; + const sx = this.frameIndex() * w; + const sy = (this._balloonId - 1) * h; + this.setFrame(sx, sy, w, h); +}; + +Sprite_Balloon.prototype.speed = function() { + return 8; +}; + +Sprite_Balloon.prototype.waitTime = function() { + return 12; +}; + +Sprite_Balloon.prototype.frameIndex = function() { + const index = (this._duration - this.waitTime()) / this.speed(); + return 7 - Math.max(Math.floor(index), 0); +}; + +Sprite_Balloon.prototype.isPlaying = function() { + return this._duration > 0; +}; + +//----------------------------------------------------------------------------- +// Sprite_Picture +// +// The sprite for displaying a picture. + +function Sprite_Picture() { + this.initialize(...arguments); +} + +Sprite_Picture.prototype = Object.create(Sprite_Clickable.prototype); +Sprite_Picture.prototype.constructor = Sprite_Picture; + +Sprite_Picture.prototype.initialize = function(pictureId) { + Sprite_Clickable.prototype.initialize.call(this); + this._pictureId = pictureId; + this._pictureName = ""; + this.update(); +}; + +Sprite_Picture.prototype.picture = function() { + return $gameScreen.picture(this._pictureId); +}; + +Sprite_Picture.prototype.update = function() { + Sprite_Clickable.prototype.update.call(this); + this.updateBitmap(); + if (this.visible) { + this.updateOrigin(); + this.updatePosition(); + this.updateScale(); + this.updateTone(); + this.updateOther(); + } +}; + +Sprite_Picture.prototype.updateBitmap = function() { + const picture = this.picture(); + if (picture) { + const pictureName = picture.name(); + if (this._pictureName !== pictureName) { + this._pictureName = pictureName; + this.loadBitmap(); + } + this.visible = true; + } else { + this._pictureName = ""; + this.bitmap = null; + this.visible = false; + } +}; + +Sprite_Picture.prototype.updateOrigin = function() { + const picture = this.picture(); + if (picture.origin() === 0) { + this.anchor.x = 0; + this.anchor.y = 0; + } else { + this.anchor.x = 0.5; + this.anchor.y = 0.5; + } +}; + +Sprite_Picture.prototype.updatePosition = function() { + const picture = this.picture(); + this.x = Math.round(picture.x()); + this.y = Math.round(picture.y()); +}; + +Sprite_Picture.prototype.updateScale = function() { + const picture = this.picture(); + this.scale.x = picture.scaleX() / 100; + this.scale.y = picture.scaleY() / 100; +}; + +Sprite_Picture.prototype.updateTone = function() { + const picture = this.picture(); + if (picture.tone()) { + this.setColorTone(picture.tone()); + } else { + this.setColorTone([0, 0, 0, 0]); + } +}; + +Sprite_Picture.prototype.updateOther = function() { + const picture = this.picture(); + this.opacity = picture.opacity(); + this.blendMode = picture.blendMode(); + this.rotation = (picture.angle() * Math.PI) / 180; +}; + +Sprite_Picture.prototype.loadBitmap = function() { + this.bitmap = ImageManager.loadPicture(this._pictureName); +}; + +//----------------------------------------------------------------------------- +// Sprite_Timer +// +// The sprite for displaying the timer. + +function Sprite_Timer() { + this.initialize(...arguments); +} + +Sprite_Timer.prototype = Object.create(Sprite.prototype); +Sprite_Timer.prototype.constructor = Sprite_Timer; + +Sprite_Timer.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this._seconds = 0; + this.createBitmap(); + this.update(); +}; + +Sprite_Timer.prototype.destroy = function(options) { + this.bitmap.destroy(); + Sprite.prototype.destroy.call(this, options); +}; + +Sprite_Timer.prototype.createBitmap = function() { + this.bitmap = new Bitmap(96, 48); + this.bitmap.fontFace = this.fontFace(); + this.bitmap.fontSize = this.fontSize(); + this.bitmap.outlineColor = ColorManager.outlineColor(); +}; + +Sprite_Timer.prototype.fontFace = function() { + return $gameSystem.numberFontFace(); +}; + +Sprite_Timer.prototype.fontSize = function() { + return $gameSystem.mainFontSize() + 8; +}; + +Sprite_Timer.prototype.update = function() { + Sprite.prototype.update.call(this); + this.updateBitmap(); + this.updatePosition(); + this.updateVisibility(); +}; + +Sprite_Timer.prototype.updateBitmap = function() { + if (this._seconds !== $gameTimer.seconds()) { + this._seconds = $gameTimer.seconds(); + this.redraw(); + } +}; + +Sprite_Timer.prototype.redraw = function() { + const text = this.timerText(); + const width = this.bitmap.width; + const height = this.bitmap.height; + this.bitmap.clear(); + this.bitmap.drawText(text, 0, 0, width, height, "center"); +}; + +Sprite_Timer.prototype.timerText = function() { + const min = Math.floor(this._seconds / 60) % 60; + const sec = this._seconds % 60; + return min.padZero(2) + ":" + sec.padZero(2); +}; + +Sprite_Timer.prototype.updatePosition = function() { + this.x = (Graphics.width - this.bitmap.width) / 2; + this.y = 0; +}; + +Sprite_Timer.prototype.updateVisibility = function() { + this.visible = $gameTimer.isWorking(); +}; + +//----------------------------------------------------------------------------- +// Sprite_Destination +// +// The sprite for displaying the destination place of the touch input. + +function Sprite_Destination() { + this.initialize(...arguments); +} + +Sprite_Destination.prototype = Object.create(Sprite.prototype); +Sprite_Destination.prototype.constructor = Sprite_Destination; + +Sprite_Destination.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.createBitmap(); + this._frameCount = 0; +}; + +Sprite_Destination.prototype.destroy = function(options) { + if (this.bitmap) { + this.bitmap.destroy(); + } + Sprite.prototype.destroy.call(this, options); +}; + +Sprite_Destination.prototype.update = function() { + Sprite.prototype.update.call(this); + if ($gameTemp.isDestinationValid()) { + this.updatePosition(); + this.updateAnimation(); + this.visible = true; + } else { + this._frameCount = 0; + this.visible = false; + } +}; + +Sprite_Destination.prototype.createBitmap = function() { + const tileWidth = $gameMap.tileWidth(); + const tileHeight = $gameMap.tileHeight(); + this.bitmap = new Bitmap(tileWidth, tileHeight); + this.bitmap.fillAll("white"); + this.anchor.x = 0.5; + this.anchor.y = 0.5; + this.blendMode = 1; +}; + +Sprite_Destination.prototype.updatePosition = function() { + const tileWidth = $gameMap.tileWidth(); + const tileHeight = $gameMap.tileHeight(); + const x = $gameTemp.destinationX(); + const y = $gameTemp.destinationY(); + this.x = ($gameMap.adjustX(x) + 0.5) * tileWidth; + this.y = ($gameMap.adjustY(y) + 0.5) * tileHeight; +}; + +Sprite_Destination.prototype.updateAnimation = function() { + this._frameCount++; + this._frameCount %= 20; + this.opacity = (20 - this._frameCount) * 6; + this.scale.x = 1 + this._frameCount / 20; + this.scale.y = this.scale.x; +}; + +//----------------------------------------------------------------------------- +// Spriteset_Base +// +// The superclass of Spriteset_Map and Spriteset_Battle. + +function Spriteset_Base() { + this.initialize(...arguments); +} + +Spriteset_Base.prototype = Object.create(Sprite.prototype); +Spriteset_Base.prototype.constructor = Spriteset_Base; + +Spriteset_Base.prototype.initialize = function() { + Sprite.prototype.initialize.call(this); + this.setFrame(0, 0, Graphics.width, Graphics.height); + this.loadSystemImages(); + this.createLowerLayer(); + this.createUpperLayer(); + this._animationSprites = []; +}; + +Spriteset_Base.prototype.destroy = function(options) { + this.removeAllAnimations(); + Sprite.prototype.destroy.call(this, options); +}; + +Spriteset_Base.prototype.loadSystemImages = function() { + // +}; + +Spriteset_Base.prototype.createLowerLayer = function() { + this.createBaseSprite(); + this.createBaseFilters(); +}; + +Spriteset_Base.prototype.createUpperLayer = function() { + this.createPictures(); + this.createTimer(); + this.createOverallFilters(); +}; + +Spriteset_Base.prototype.update = function() { + Sprite.prototype.update.call(this); + this.updateBaseFilters(); + this.updateOverallFilters(); + this.updatePosition(); + this.updateAnimations(); +}; + +Spriteset_Base.prototype.createBaseSprite = function() { + this._baseSprite = new Sprite(); + this._blackScreen = new ScreenSprite(); + this._blackScreen.opacity = 255; + this.addChild(this._baseSprite); + this._baseSprite.addChild(this._blackScreen); +}; + +Spriteset_Base.prototype.createBaseFilters = function() { + this._baseSprite.filters = []; + this._baseColorFilter = new ColorFilter(); + this._baseSprite.filters.push(this._baseColorFilter); +}; + +Spriteset_Base.prototype.createPictures = function() { + const rect = this.pictureContainerRect(); + this._pictureContainer = new Sprite(); + this._pictureContainer.setFrame(rect.x, rect.y, rect.width, rect.height); + for (let i = 1; i <= $gameScreen.maxPictures(); i++) { + this._pictureContainer.addChild(new Sprite_Picture(i)); + } + this.addChild(this._pictureContainer); +}; + +Spriteset_Base.prototype.pictureContainerRect = function() { + return new Rectangle(0, 0, Graphics.width, Graphics.height); +}; + +Spriteset_Base.prototype.createTimer = function() { + this._timerSprite = new Sprite_Timer(); + this.addChild(this._timerSprite); +}; + +Spriteset_Base.prototype.createOverallFilters = function() { + this.filters = []; + this._overallColorFilter = new ColorFilter(); + this.filters.push(this._overallColorFilter); +}; + +Spriteset_Base.prototype.updateBaseFilters = function() { + const filter = this._baseColorFilter; + filter.setColorTone($gameScreen.tone()); +}; + +Spriteset_Base.prototype.updateOverallFilters = function() { + const filter = this._overallColorFilter; + filter.setBlendColor($gameScreen.flashColor()); + filter.setBrightness($gameScreen.brightness()); +}; + +Spriteset_Base.prototype.updatePosition = function() { + const screen = $gameScreen; + const scale = screen.zoomScale(); + this.scale.x = scale; + this.scale.y = scale; + this.x = Math.round(-screen.zoomX() * (scale - 1)); + this.y = Math.round(-screen.zoomY() * (scale - 1)); + this.x += Math.round(screen.shake()); +}; + +Spriteset_Base.prototype.findTargetSprite = function(/*target*/) { + return null; +}; + +Spriteset_Base.prototype.updateAnimations = function() { + for (const sprite of this._animationSprites) { + if (!sprite.isPlaying()) { + this.removeAnimation(sprite); + } + } + this.processAnimationRequests(); +}; + +Spriteset_Base.prototype.processAnimationRequests = function() { + for (;;) { + const request = $gameTemp.retrieveAnimation(); + if (request) { + this.createAnimation(request); + } else { + break; + } + } +}; + +Spriteset_Base.prototype.createAnimation = function(request) { + const animation = $dataAnimations[request.animationId]; + const targets = request.targets; + const mirror = request.mirror; + let delay = this.animationBaseDelay(); + const nextDelay = this.animationNextDelay(); + if (this.isAnimationForEach(animation)) { + for (const target of targets) { + this.createAnimationSprite([target], animation, mirror, delay); + delay += nextDelay; + } + } else { + this.createAnimationSprite(targets, animation, mirror, delay); + } +}; + +// prettier-ignore +Spriteset_Base.prototype.createAnimationSprite = function( + targets, animation, mirror, delay +) { + const mv = this.isMVAnimation(animation); + const sprite = new (mv ? Sprite_AnimationMV : Sprite_Animation)(); + const targetSprites = this.makeTargetSprites(targets); + const baseDelay = this.animationBaseDelay(); + const previous = delay > baseDelay ? this.lastAnimationSprite() : null; + if (this.animationShouldMirror(targets[0])) { + mirror = !mirror; + } + sprite.targetObjects = targets; + sprite.setup(targetSprites, animation, mirror, delay, previous); + this._effectsContainer.addChild(sprite); + this._animationSprites.push(sprite); +}; + +Spriteset_Base.prototype.isMVAnimation = function(animation) { + return !!animation.frames; +}; + +Spriteset_Base.prototype.makeTargetSprites = function(targets) { + const targetSprites = []; + for (const target of targets) { + const targetSprite = this.findTargetSprite(target); + if (targetSprite) { + targetSprites.push(targetSprite); + } + } + return targetSprites; +}; + +Spriteset_Base.prototype.lastAnimationSprite = function() { + return this._animationSprites[this._animationSprites.length - 1]; +}; + +Spriteset_Base.prototype.isAnimationForEach = function(animation) { + const mv = this.isMVAnimation(animation); + return mv ? animation.position !== 3 : animation.displayType === 0; +}; + +Spriteset_Base.prototype.animationBaseDelay = function() { + return 8; +}; + +Spriteset_Base.prototype.animationNextDelay = function() { + return 12; +}; + +Spriteset_Base.prototype.animationShouldMirror = function(target) { + return target && target.isActor && target.isActor(); +}; + +Spriteset_Base.prototype.removeAnimation = function(sprite) { + this._animationSprites.remove(sprite); + this._effectsContainer.removeChild(sprite); + for (const target of sprite.targetObjects) { + if (target.endAnimation) { + target.endAnimation(); + } + } + sprite.destroy(); +}; + +Spriteset_Base.prototype.removeAllAnimations = function() { + for (const sprite of this._animationSprites.clone()) { + this.removeAnimation(sprite); + } +}; + +Spriteset_Base.prototype.isAnimationPlaying = function() { + return this._animationSprites.length > 0; +}; + +//----------------------------------------------------------------------------- +// Spriteset_Map +// +// The set of sprites on the map screen. + +function Spriteset_Map() { + this.initialize(...arguments); +} + +Spriteset_Map.prototype = Object.create(Spriteset_Base.prototype); +Spriteset_Map.prototype.constructor = Spriteset_Map; + +Spriteset_Map.prototype.initialize = function() { + Spriteset_Base.prototype.initialize.call(this); + this._balloonSprites = []; +}; + +Spriteset_Map.prototype.destroy = function(options) { + this.removeAllBalloons(); + Spriteset_Base.prototype.destroy.call(this, options); +}; + +Spriteset_Map.prototype.loadSystemImages = function() { + Spriteset_Base.prototype.loadSystemImages.call(this); + ImageManager.loadSystem("Balloon"); + ImageManager.loadSystem("Shadow1"); +}; + +Spriteset_Map.prototype.createLowerLayer = function() { + Spriteset_Base.prototype.createLowerLayer.call(this); + this.createParallax(); + this.createTilemap(); + this.createCharacters(); + this.createShadow(); + this.createDestination(); + this.createWeather(); +}; + +Spriteset_Map.prototype.update = function() { + Spriteset_Base.prototype.update.call(this); + this.updateTileset(); + this.updateParallax(); + this.updateTilemap(); + this.updateShadow(); + this.updateWeather(); + this.updateAnimations(); + this.updateBalloons(); +}; + +Spriteset_Map.prototype.hideCharacters = function() { + for (const sprite of this._characterSprites) { + if (!sprite.isTile() && !sprite.isObjectCharacter()) { + sprite.hide(); + } + } +}; + +Spriteset_Map.prototype.createParallax = function() { + this._parallax = new TilingSprite(); + this._parallax.move(0, 0, Graphics.width, Graphics.height); + this._baseSprite.addChild(this._parallax); +}; + +Spriteset_Map.prototype.createTilemap = function() { + const tilemap = new Tilemap(); + tilemap.tileWidth = $gameMap.tileWidth(); + tilemap.tileHeight = $gameMap.tileHeight(); + tilemap.setData($gameMap.width(), $gameMap.height(), $gameMap.data()); + tilemap.horizontalWrap = $gameMap.isLoopHorizontal(); + tilemap.verticalWrap = $gameMap.isLoopVertical(); + this._baseSprite.addChild(tilemap); + this._effectsContainer = tilemap; + this._tilemap = tilemap; + this.loadTileset(); +}; + +Spriteset_Map.prototype.loadTileset = function() { + this._tileset = $gameMap.tileset(); + if (this._tileset) { + const bitmaps = []; + const tilesetNames = this._tileset.tilesetNames; + for (const name of tilesetNames) { + bitmaps.push(ImageManager.loadTileset(name)); + } + this._tilemap.setBitmaps(bitmaps); + this._tilemap.flags = $gameMap.tilesetFlags(); + } +}; + +Spriteset_Map.prototype.createCharacters = function() { + this._characterSprites = []; + for (const event of $gameMap.events()) { + this._characterSprites.push(new Sprite_Character(event)); + } + for (const vehicle of $gameMap.vehicles()) { + this._characterSprites.push(new Sprite_Character(vehicle)); + } + for (const follower of $gamePlayer.followers().reverseData()) { + this._characterSprites.push(new Sprite_Character(follower)); + } + this._characterSprites.push(new Sprite_Character($gamePlayer)); + for (const sprite of this._characterSprites) { + this._tilemap.addChild(sprite); + } +}; + +Spriteset_Map.prototype.createShadow = function() { + this._shadowSprite = new Sprite(); + this._shadowSprite.bitmap = ImageManager.loadSystem("Shadow1"); + this._shadowSprite.anchor.x = 0.5; + this._shadowSprite.anchor.y = 1; + this._shadowSprite.z = 6; + this._tilemap.addChild(this._shadowSprite); +}; + +Spriteset_Map.prototype.createDestination = function() { + this._destinationSprite = new Sprite_Destination(); + this._destinationSprite.z = 9; + this._tilemap.addChild(this._destinationSprite); +}; + +Spriteset_Map.prototype.createWeather = function() { + this._weather = new Weather(); + this.addChild(this._weather); +}; + +Spriteset_Map.prototype.updateTileset = function() { + if (this._tileset !== $gameMap.tileset()) { + this.loadTileset(); + } +}; + +Spriteset_Map.prototype.updateParallax = function() { + if (this._parallaxName !== $gameMap.parallaxName()) { + this._parallaxName = $gameMap.parallaxName(); + this._parallax.bitmap = ImageManager.loadParallax(this._parallaxName); + } + if (this._parallax.bitmap) { + const bitmap = this._parallax.bitmap; + this._parallax.origin.x = $gameMap.parallaxOx() % bitmap.width; + this._parallax.origin.y = $gameMap.parallaxOy() % bitmap.height; + } +}; + +Spriteset_Map.prototype.updateTilemap = function() { + this._tilemap.origin.x = $gameMap.displayX() * $gameMap.tileWidth(); + this._tilemap.origin.y = $gameMap.displayY() * $gameMap.tileHeight(); +}; + +Spriteset_Map.prototype.updateShadow = function() { + const airship = $gameMap.airship(); + this._shadowSprite.x = airship.shadowX(); + this._shadowSprite.y = airship.shadowY(); + this._shadowSprite.opacity = airship.shadowOpacity(); +}; + +Spriteset_Map.prototype.updateWeather = function() { + this._weather.type = $gameScreen.weatherType(); + this._weather.power = $gameScreen.weatherPower(); + this._weather.origin.x = $gameMap.displayX() * $gameMap.tileWidth(); + this._weather.origin.y = $gameMap.displayY() * $gameMap.tileHeight(); +}; + +Spriteset_Map.prototype.updateBalloons = function() { + for (const sprite of this._balloonSprites) { + if (!sprite.isPlaying()) { + this.removeBalloon(sprite); + } + } + this.processBalloonRequests(); +}; + +Spriteset_Map.prototype.processBalloonRequests = function() { + for (;;) { + const request = $gameTemp.retrieveBalloon(); + if (request) { + this.createBalloon(request); + } else { + break; + } + } +}; + +Spriteset_Map.prototype.createBalloon = function(request) { + const targetSprite = this.findTargetSprite(request.target); + if (targetSprite) { + const sprite = new Sprite_Balloon(); + sprite.targetObject = request.target; + sprite.setup(targetSprite, request.balloonId); + this._effectsContainer.addChild(sprite); + this._balloonSprites.push(sprite); + } +}; + +Spriteset_Map.prototype.removeBalloon = function(sprite) { + this._balloonSprites.remove(sprite); + this._effectsContainer.removeChild(sprite); + if (sprite.targetObject.endBalloon) { + sprite.targetObject.endBalloon(); + } + sprite.destroy(); +}; + +Spriteset_Map.prototype.removeAllBalloons = function() { + for (const sprite of this._balloonSprites.clone()) { + this.removeBalloon(sprite); + } +}; + +Spriteset_Map.prototype.findTargetSprite = function(target) { + return this._characterSprites.find(sprite => sprite.checkCharacter(target)); +}; + +Spriteset_Map.prototype.animationBaseDelay = function() { + return 0; +}; + +//----------------------------------------------------------------------------- +// Spriteset_Battle +// +// The set of sprites on the battle screen. + +function Spriteset_Battle() { + this.initialize(...arguments); +} + +Spriteset_Battle.prototype = Object.create(Spriteset_Base.prototype); +Spriteset_Battle.prototype.constructor = Spriteset_Battle; + +Spriteset_Battle.prototype.initialize = function() { + Spriteset_Base.prototype.initialize.call(this); + this._battlebackLocated = false; +}; + +Spriteset_Battle.prototype.loadSystemImages = function() { + Spriteset_Base.prototype.loadSystemImages.call(this); + ImageManager.loadSystem("Shadow2"); + ImageManager.loadSystem("Weapons1"); + ImageManager.loadSystem("Weapons2"); + ImageManager.loadSystem("Weapons3"); +}; + +Spriteset_Battle.prototype.createLowerLayer = function() { + Spriteset_Base.prototype.createLowerLayer.call(this); + this.createBackground(); + this.createBattleback(); + this.createBattleField(); + this.createEnemies(); + this.createActors(); +}; + +Spriteset_Battle.prototype.createBackground = function() { + this._backgroundFilter = new PIXI.filters.BlurFilter(); + this._backgroundSprite = new Sprite(); + this._backgroundSprite.bitmap = SceneManager.backgroundBitmap(); + this._backgroundSprite.filters = [this._backgroundFilter]; + this._baseSprite.addChild(this._backgroundSprite); +}; + +Spriteset_Battle.prototype.createBattleback = function() { + this._back1Sprite = new Sprite_Battleback(0); + this._back2Sprite = new Sprite_Battleback(1); + this._baseSprite.addChild(this._back1Sprite); + this._baseSprite.addChild(this._back2Sprite); +}; + +Spriteset_Battle.prototype.createBattleField = function() { + const width = Graphics.boxWidth; + const height = Graphics.boxHeight; + const x = (Graphics.width - width) / 2; + const y = (Graphics.height - height) / 2; + this._battleField = new Sprite(); + this._battleField.setFrame(0, 0, width, height); + this._battleField.x = x; + this._battleField.y = y - this.battleFieldOffsetY(); + this._baseSprite.addChild(this._battleField); + this._effectsContainer = this._battleField; +}; + +Spriteset_Battle.prototype.battleFieldOffsetY = function() { + return 24; +}; + +Spriteset_Battle.prototype.update = function() { + Spriteset_Base.prototype.update.call(this); + this.updateActors(); + this.updateBattleback(); + this.updateAnimations(); +}; + +Spriteset_Battle.prototype.updateBattleback = function() { + if (!this._battlebackLocated) { + this._back1Sprite.adjustPosition(); + this._back2Sprite.adjustPosition(); + this._battlebackLocated = true; + } +}; + +Spriteset_Battle.prototype.createEnemies = function() { + const enemies = $gameTroop.members(); + const sprites = []; + for (const enemy of enemies) { + sprites.push(new Sprite_Enemy(enemy)); + } + sprites.sort(this.compareEnemySprite.bind(this)); + for (const sprite of sprites) { + this._battleField.addChild(sprite); + } + this._enemySprites = sprites; +}; + +Spriteset_Battle.prototype.compareEnemySprite = function(a, b) { + if (a.y !== b.y) { + return a.y - b.y; + } else { + return b.spriteId - a.spriteId; + } +}; + +Spriteset_Battle.prototype.createActors = function() { + this._actorSprites = []; + if ($gameSystem.isSideView()) { + for (let i = 0; i < $gameParty.maxBattleMembers(); i++) { + const sprite = new Sprite_Actor(); + this._actorSprites.push(sprite); + this._battleField.addChild(sprite); + } + } +}; + +Spriteset_Battle.prototype.updateActors = function() { + const members = $gameParty.battleMembers(); + for (let i = 0; i < this._actorSprites.length; i++) { + this._actorSprites[i].setBattler(members[i]); + } +}; + +Spriteset_Battle.prototype.findTargetSprite = function(target) { + return this.battlerSprites().find(sprite => sprite.checkBattler(target)); +}; + +Spriteset_Battle.prototype.battlerSprites = function() { + return this._enemySprites.concat(this._actorSprites); +}; + +Spriteset_Battle.prototype.isEffecting = function() { + return this.battlerSprites().some(sprite => sprite.isEffecting()); +}; + +Spriteset_Battle.prototype.isAnyoneMoving = function() { + return this.battlerSprites().some(sprite => sprite.isMoving()); +}; + +Spriteset_Battle.prototype.isBusy = function() { + return this.isAnimationPlaying() || this.isAnyoneMoving(); +}; + +//----------------------------------------------------------------------------- diff --git a/js/rmmz_windows.js b/js/rmmz_windows.js new file mode 100644 index 0000000..ee03b24 --- /dev/null +++ b/js/rmmz_windows.js @@ -0,0 +1,6655 @@ +//============================================================================= +// rmmz_windows.js v1.8.1 +//============================================================================= + +//----------------------------------------------------------------------------- +// Window_Base +// +// The superclass of all windows within the game. + +function Window_Base() { + this.initialize(...arguments); +} + +Window_Base.prototype = Object.create(Window.prototype); +Window_Base.prototype.constructor = Window_Base; + +Window_Base.prototype.initialize = function(rect) { + Window.prototype.initialize.call(this); + this.loadWindowskin(); + this.checkRectObject(rect); + this.move(rect.x, rect.y, rect.width, rect.height); + this.updatePadding(); + this.updateBackOpacity(); + this.updateTone(); + this.createContents(); + this._opening = false; + this._closing = false; + this._dimmerSprite = null; +}; + +Window_Base.prototype.destroy = function(options) { + this.destroyContents(); + if (this._dimmerSprite) { + this._dimmerSprite.bitmap.destroy(); + } + Window.prototype.destroy.call(this, options); +}; + +Window_Base.prototype.checkRectObject = function(rect) { + if (typeof rect !== "object" || !("x" in rect)) { + // Probably MV plugin is used + throw new Error("Argument must be a Rectangle"); + } +}; + +Window_Base.prototype.lineHeight = function() { + return 36; +}; + +Window_Base.prototype.itemWidth = function() { + return this.innerWidth; +}; + +Window_Base.prototype.itemHeight = function() { + return this.lineHeight(); +}; + +Window_Base.prototype.itemPadding = function() { + return 8; +}; + +Window_Base.prototype.baseTextRect = function() { + const rect = new Rectangle(0, 0, this.innerWidth, this.innerHeight); + rect.pad(-this.itemPadding(), 0); + return rect; +}; + +Window_Base.prototype.loadWindowskin = function() { + this.windowskin = ImageManager.loadSystem("Window"); +}; + +Window_Base.prototype.updatePadding = function() { + this.padding = $gameSystem.windowPadding(); +}; + +Window_Base.prototype.updateBackOpacity = function() { + this.backOpacity = $gameSystem.windowOpacity(); +}; + +Window_Base.prototype.fittingHeight = function(numLines) { + return numLines * this.itemHeight() + $gameSystem.windowPadding() * 2; +}; + +Window_Base.prototype.updateTone = function() { + const tone = $gameSystem.windowTone(); + this.setTone(tone[0], tone[1], tone[2]); +}; + +Window_Base.prototype.createContents = function() { + const width = this.contentsWidth(); + const height = this.contentsHeight(); + this.destroyContents(); + this.contents = new Bitmap(width, height); + this.contentsBack = new Bitmap(width, height); + this.resetFontSettings(); +}; + +Window_Base.prototype.destroyContents = function() { + if (this.contents) { + this.contents.destroy(); + } + if (this.contentsBack) { + this.contentsBack.destroy(); + } +}; + +Window_Base.prototype.contentsWidth = function() { + return this.innerWidth; +}; + +Window_Base.prototype.contentsHeight = function() { + return this.innerHeight; +}; + +Window_Base.prototype.resetFontSettings = function() { + this.contents.fontFace = $gameSystem.mainFontFace(); + this.contents.fontSize = $gameSystem.mainFontSize(); + this.resetTextColor(); +}; + +Window_Base.prototype.resetTextColor = function() { + this.changeTextColor(ColorManager.normalColor()); + this.changeOutlineColor(ColorManager.outlineColor()); +}; + +Window_Base.prototype.update = function() { + Window.prototype.update.call(this); + this.updateTone(); + this.updateOpen(); + this.updateClose(); + this.updateBackgroundDimmer(); +}; + +Window_Base.prototype.updateOpen = function() { + if (this._opening) { + this.openness += 32; + if (this.isOpen()) { + this._opening = false; + } + } +}; + +Window_Base.prototype.updateClose = function() { + if (this._closing) { + this.openness -= 32; + if (this.isClosed()) { + this._closing = false; + } + } +}; + +Window_Base.prototype.open = function() { + if (!this.isOpen()) { + this._opening = true; + } + this._closing = false; +}; + +Window_Base.prototype.close = function() { + if (!this.isClosed()) { + this._closing = true; + } + this._opening = false; +}; + +Window_Base.prototype.isOpening = function() { + return this._opening; +}; + +Window_Base.prototype.isClosing = function() { + return this._closing; +}; + +Window_Base.prototype.show = function() { + this.visible = true; +}; + +Window_Base.prototype.hide = function() { + this.visible = false; +}; + +Window_Base.prototype.activate = function() { + this.active = true; +}; + +Window_Base.prototype.deactivate = function() { + this.active = false; +}; + +Window_Base.prototype.systemColor = function() { + return ColorManager.systemColor(); +}; + +Window_Base.prototype.translucentOpacity = function() { + return 160; +}; + +Window_Base.prototype.changeTextColor = function(color) { + this.contents.textColor = color; +}; + +Window_Base.prototype.changeOutlineColor = function(color) { + this.contents.outlineColor = color; +}; + +Window_Base.prototype.changePaintOpacity = function(enabled) { + this.contents.paintOpacity = enabled ? 255 : this.translucentOpacity(); +}; + +Window_Base.prototype.drawRect = function(x, y, width, height) { + const outlineColor = this.contents.outlineColor; + const mainColor = this.contents.textColor; + this.contents.fillRect(x, y, width, height, outlineColor); + this.contents.fillRect(x + 1, y + 1, width - 2, height - 2, mainColor); +}; + +Window_Base.prototype.drawText = function(text, x, y, maxWidth, align) { + this.contents.drawText(text, x, y, maxWidth, this.lineHeight(), align); +}; + +Window_Base.prototype.textWidth = function(text) { + return this.contents.measureTextWidth(text); +}; + +Window_Base.prototype.drawTextEx = function(text, x, y, width) { + this.resetFontSettings(); + const textState = this.createTextState(text, x, y, width); + this.processAllText(textState); + return textState.outputWidth; +}; + +Window_Base.prototype.textSizeEx = function(text) { + this.resetFontSettings(); + const textState = this.createTextState(text, 0, 0, 0); + textState.drawing = false; + this.processAllText(textState); + return { width: textState.outputWidth, height: textState.outputHeight }; +}; + +Window_Base.prototype.createTextState = function(text, x, y, width) { + const rtl = Utils.containsArabic(text); + const textState = {}; + textState.text = this.convertEscapeCharacters(text); + textState.index = 0; + textState.x = rtl ? x + width : x; + textState.y = y; + textState.width = width; + textState.height = this.calcTextHeight(textState); + textState.startX = textState.x; + textState.startY = textState.y; + textState.rtl = rtl; + textState.buffer = this.createTextBuffer(rtl); + textState.drawing = true; + textState.outputWidth = 0; + textState.outputHeight = 0; + return textState; +}; + +Window_Base.prototype.processAllText = function(textState) { + while (textState.index < textState.text.length) { + this.processCharacter(textState); + } + this.flushTextState(textState); +}; + +Window_Base.prototype.flushTextState = function(textState) { + const text = textState.buffer; + const rtl = textState.rtl; + const width = this.textWidth(text); + const height = textState.height; + const x = rtl ? textState.x - width : textState.x; + const y = textState.y; + if (textState.drawing) { + this.contents.drawText(text, x, y, width, height); + } + textState.x += rtl ? -width : width; + textState.buffer = this.createTextBuffer(rtl); + const outputWidth = Math.abs(textState.x - textState.startX); + if (textState.outputWidth < outputWidth) { + textState.outputWidth = outputWidth; + } + textState.outputHeight = y - textState.startY + height; +}; + +Window_Base.prototype.createTextBuffer = function(rtl) { + // U+202B: RIGHT-TO-LEFT EMBEDDING + return rtl ? "\u202B" : ""; +}; + +Window_Base.prototype.convertEscapeCharacters = function(text) { + /* eslint no-control-regex: 0 */ + text = text.replace(/\\/g, "\x1b"); + text = text.replace(/\x1b\x1b/g, "\\"); + while (text.match(/\x1bV\[(\d+)\]/gi)) { + text = text.replace(/\x1bV\[(\d+)\]/gi, (_, p1) => + $gameVariables.value(parseInt(p1)) + ); + } + text = text.replace(/\x1bN\[(\d+)\]/gi, (_, p1) => + this.actorName(parseInt(p1)) + ); + text = text.replace(/\x1bP\[(\d+)\]/gi, (_, p1) => + this.partyMemberName(parseInt(p1)) + ); + text = text.replace(/\x1bG/gi, TextManager.currencyUnit); + return text; +}; + +Window_Base.prototype.actorName = function(n) { + const actor = n >= 1 ? $gameActors.actor(n) : null; + return actor ? actor.name() : ""; +}; + +Window_Base.prototype.partyMemberName = function(n) { + const actor = n >= 1 ? $gameParty.members()[n - 1] : null; + return actor ? actor.name() : ""; +}; + +Window_Base.prototype.processCharacter = function(textState) { + const c = textState.text[textState.index++]; + if (c.charCodeAt(0) < 0x20) { + this.flushTextState(textState); + this.processControlCharacter(textState, c); + } else { + textState.buffer += c; + } +}; + +Window_Base.prototype.processControlCharacter = function(textState, c) { + if (c === "\n") { + this.processNewLine(textState); + } + if (c === "\x1b") { + const code = this.obtainEscapeCode(textState); + this.processEscapeCharacter(code, textState); + } +}; + +Window_Base.prototype.processNewLine = function(textState) { + textState.x = textState.startX; + textState.y += textState.height; + textState.height = this.calcTextHeight(textState); +}; + +Window_Base.prototype.obtainEscapeCode = function(textState) { + const regExp = /^[$.|^!><{}\\]|^[A-Z]+/i; + const arr = regExp.exec(textState.text.slice(textState.index)); + if (arr) { + textState.index += arr[0].length; + return arr[0].toUpperCase(); + } else { + return ""; + } +}; + +Window_Base.prototype.obtainEscapeParam = function(textState) { + const regExp = /^\[\d+\]/; + const arr = regExp.exec(textState.text.slice(textState.index)); + if (arr) { + textState.index += arr[0].length; + return parseInt(arr[0].slice(1)); + } else { + return ""; + } +}; + +Window_Base.prototype.processEscapeCharacter = function(code, textState) { + switch (code) { + case "C": + this.processColorChange(this.obtainEscapeParam(textState)); + break; + case "I": + this.processDrawIcon(this.obtainEscapeParam(textState), textState); + break; + case "PX": + textState.x = this.obtainEscapeParam(textState); + break; + case "PY": + textState.y = this.obtainEscapeParam(textState); + break; + case "FS": + this.contents.fontSize = this.obtainEscapeParam(textState); + break; + case "{": + this.makeFontBigger(); + break; + case "}": + this.makeFontSmaller(); + break; + } +}; + +Window_Base.prototype.processColorChange = function(colorIndex) { + this.changeTextColor(ColorManager.textColor(colorIndex)); +}; + +Window_Base.prototype.processDrawIcon = function(iconIndex, textState) { + if (textState.drawing) { + this.drawIcon(iconIndex, textState.x + 2, textState.y + 2); + } + textState.x += ImageManager.iconWidth + 4; +}; + +Window_Base.prototype.makeFontBigger = function() { + if (this.contents.fontSize <= 96) { + this.contents.fontSize += 12; + } +}; + +Window_Base.prototype.makeFontSmaller = function() { + if (this.contents.fontSize >= 24) { + this.contents.fontSize -= 12; + } +}; + +Window_Base.prototype.calcTextHeight = function(textState) { + const lineSpacing = this.lineHeight() - $gameSystem.mainFontSize(); + const lastFontSize = this.contents.fontSize; + const lines = textState.text.slice(textState.index).split("\n"); + const textHeight = this.maxFontSizeInLine(lines[0]) + lineSpacing; + this.contents.fontSize = lastFontSize; + return textHeight; +}; + +Window_Base.prototype.maxFontSizeInLine = function(line) { + let maxFontSize = this.contents.fontSize; + const regExp = /\x1b({|}|FS)(\[(\d+)])?/gi; + for (;;) { + const array = regExp.exec(line); + if (!array) { + break; + } + const code = String(array[1]).toUpperCase(); + if (code === "{") { + this.makeFontBigger(); + } else if (code === "}") { + this.makeFontSmaller(); + } else if (code === "FS") { + this.contents.fontSize = parseInt(array[3]); + } + if (this.contents.fontSize > maxFontSize) { + maxFontSize = this.contents.fontSize; + } + } + return maxFontSize; +}; + +Window_Base.prototype.drawIcon = function(iconIndex, x, y) { + const bitmap = ImageManager.loadSystem("IconSet"); + const pw = ImageManager.iconWidth; + const ph = ImageManager.iconHeight; + const sx = (iconIndex % 16) * pw; + const sy = Math.floor(iconIndex / 16) * ph; + this.contents.blt(bitmap, sx, sy, pw, ph, x, y); +}; + +// prettier-ignore +Window_Base.prototype.drawFace = function( + faceName, faceIndex, x, y, width, height +) { + width = width || ImageManager.faceWidth; + height = height || ImageManager.faceHeight; + const bitmap = ImageManager.loadFace(faceName); + const pw = ImageManager.faceWidth; + const ph = ImageManager.faceHeight; + const sw = Math.min(width, pw); + const sh = Math.min(height, ph); + const dx = Math.floor(x + Math.max(width - pw, 0) / 2); + const dy = Math.floor(y + Math.max(height - ph, 0) / 2); + const sx = Math.floor((faceIndex % 4) * pw + (pw - sw) / 2); + const sy = Math.floor(Math.floor(faceIndex / 4) * ph + (ph - sh) / 2); + this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy); +}; + +// prettier-ignore +Window_Base.prototype.drawCharacter = function( + characterName, characterIndex, x, y +) { + const bitmap = ImageManager.loadCharacter(characterName); + const big = ImageManager.isBigCharacter(characterName); + const pw = bitmap.width / (big ? 3 : 12); + const ph = bitmap.height / (big ? 4 : 8); + const n = big ? 0: characterIndex; + const sx = ((n % 4) * 3 + 1) * pw; + const sy = Math.floor(n / 4) * 4 * ph; + this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph); +}; + +Window_Base.prototype.drawItemName = function(item, x, y, width) { + if (item) { + const iconY = y + (this.lineHeight() - ImageManager.iconHeight) / 2; + const textMargin = ImageManager.iconWidth + 4; + const itemWidth = Math.max(0, width - textMargin); + this.resetTextColor(); + this.drawIcon(item.iconIndex, x, iconY); + this.drawText(item.name, x + textMargin, y, itemWidth); + } +}; + +Window_Base.prototype.drawCurrencyValue = function(value, unit, x, y, width) { + const unitWidth = Math.min(80, this.textWidth(unit)); + this.resetTextColor(); + this.drawText(value, x, y, width - unitWidth - 6, "right"); + this.changeTextColor(ColorManager.systemColor()); + this.drawText(unit, x + width - unitWidth, y, unitWidth, "right"); +}; + +Window_Base.prototype.setBackgroundType = function(type) { + if (type === 0) { + this.opacity = 255; + } else { + this.opacity = 0; + } + if (type === 1) { + this.showBackgroundDimmer(); + } else { + this.hideBackgroundDimmer(); + } +}; + +Window_Base.prototype.showBackgroundDimmer = function() { + if (!this._dimmerSprite) { + this.createDimmerSprite(); + } + const bitmap = this._dimmerSprite.bitmap; + if (bitmap.width !== this.width || bitmap.height !== this.height) { + this.refreshDimmerBitmap(); + } + this._dimmerSprite.visible = true; + this.updateBackgroundDimmer(); +}; + +Window_Base.prototype.createDimmerSprite = function() { + this._dimmerSprite = new Sprite(); + this._dimmerSprite.bitmap = new Bitmap(0, 0); + this._dimmerSprite.x = -4; + this.addChildToBack(this._dimmerSprite); +}; + +Window_Base.prototype.hideBackgroundDimmer = function() { + if (this._dimmerSprite) { + this._dimmerSprite.visible = false; + } +}; + +Window_Base.prototype.updateBackgroundDimmer = function() { + if (this._dimmerSprite) { + this._dimmerSprite.opacity = this.openness; + } +}; + +Window_Base.prototype.refreshDimmerBitmap = function() { + if (this._dimmerSprite) { + const bitmap = this._dimmerSprite.bitmap; + const w = this.width > 0 ? this.width + 8 : 0; + const h = this.height; + const m = this.padding; + const c1 = ColorManager.dimColor1(); + const c2 = ColorManager.dimColor2(); + bitmap.resize(w, h); + bitmap.gradientFillRect(0, 0, w, m, c2, c1, true); + bitmap.fillRect(0, m, w, h - m * 2, c1); + bitmap.gradientFillRect(0, h - m, w, m, c1, c2, true); + this._dimmerSprite.setFrame(0, 0, w, h); + } +}; + +Window_Base.prototype.playCursorSound = function() { + SoundManager.playCursor(); +}; + +Window_Base.prototype.playOkSound = function() { + SoundManager.playOk(); +}; + +Window_Base.prototype.playBuzzerSound = function() { + SoundManager.playBuzzer(); +}; + +//----------------------------------------------------------------------------- +// Window_Scrollable +// +// The window class with scroll functions. + +function Window_Scrollable() { + this.initialize(...arguments); +} + +Window_Scrollable.prototype = Object.create(Window_Base.prototype); +Window_Scrollable.prototype.constructor = Window_Scrollable; + +Window_Scrollable.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, rect); + this._scrollX = 0; + this._scrollY = 0; + this._scrollBaseX = 0; + this._scrollBaseY = 0; + this.clearScrollStatus(); +}; + +Window_Scrollable.prototype.clearScrollStatus = function() { + this._scrollTargetX = 0; + this._scrollTargetY = 0; + this._scrollDuration = 0; + this._scrollAccelX = 0; + this._scrollAccelY = 0; + this._scrollTouching = false; + this._scrollLastTouchX = 0; + this._scrollLastTouchY = 0; + this._scrollLastCursorVisible = false; +}; + +Window_Scrollable.prototype.scrollX = function() { + return this._scrollX; +}; + +Window_Scrollable.prototype.scrollY = function() { + return this._scrollY; +}; + +Window_Scrollable.prototype.scrollBaseX = function() { + return this._scrollBaseX; +}; + +Window_Scrollable.prototype.scrollBaseY = function() { + return this._scrollBaseY; +}; + +Window_Scrollable.prototype.scrollTo = function(x, y) { + const scrollX = x.clamp(0, this.maxScrollX()); + const scrollY = y.clamp(0, this.maxScrollY()); + if (this._scrollX !== scrollX || this._scrollY !== scrollY) { + this._scrollX = scrollX; + this._scrollY = scrollY; + this.updateOrigin(); + } +}; + +Window_Scrollable.prototype.scrollBy = function(x, y) { + this.scrollTo(this._scrollX + x, this._scrollY + y); +}; + +Window_Scrollable.prototype.smoothScrollTo = function(x, y) { + this._scrollTargetX = x.clamp(0, this.maxScrollX()); + this._scrollTargetY = y.clamp(0, this.maxScrollY()); + this._scrollDuration = Input.keyRepeatInterval; +}; + +Window_Scrollable.prototype.smoothScrollBy = function(x, y) { + if (this._scrollDuration === 0) { + this._scrollTargetX = this.scrollX(); + this._scrollTargetY = this.scrollY(); + } + this.smoothScrollTo(this._scrollTargetX + x, this._scrollTargetY + y); +}; + +Window_Scrollable.prototype.setScrollAccel = function(x, y) { + this._scrollAccelX = x; + this._scrollAccelY = y; +}; + +Window_Scrollable.prototype.overallWidth = function() { + return this.innerWidth; +}; + +Window_Scrollable.prototype.overallHeight = function() { + return this.innerHeight; +}; + +Window_Scrollable.prototype.maxScrollX = function() { + return Math.max(0, this.overallWidth() - this.innerWidth); +}; + +Window_Scrollable.prototype.maxScrollY = function() { + return Math.max(0, this.overallHeight() - this.innerHeight); +}; + +Window_Scrollable.prototype.scrollBlockWidth = function() { + return this.itemWidth(); +}; + +Window_Scrollable.prototype.scrollBlockHeight = function() { + return this.itemHeight(); +}; + +Window_Scrollable.prototype.smoothScrollDown = function(n) { + this.smoothScrollBy(0, this.itemHeight() * n); +}; + +Window_Scrollable.prototype.smoothScrollUp = function(n) { + this.smoothScrollBy(0, -this.itemHeight() * n); +}; + +Window_Scrollable.prototype.update = function() { + Window_Base.prototype.update.call(this); + this.processWheelScroll(); + this.processTouchScroll(); + this.updateSmoothScroll(); + this.updateScrollAccel(); + this.updateArrows(); + this.updateOrigin(); +}; + +Window_Scrollable.prototype.processWheelScroll = function() { + if (this.isWheelScrollEnabled() && this.isTouchedInsideFrame()) { + const threshold = 20; + if (TouchInput.wheelY >= threshold) { + this.smoothScrollDown(1); + } + if (TouchInput.wheelY <= -threshold) { + this.smoothScrollUp(1); + } + } +}; + +Window_Scrollable.prototype.processTouchScroll = function() { + if (this.isTouchScrollEnabled()) { + if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) { + this.onTouchScrollStart(); + } + if (this._scrollTouching) { + if (TouchInput.isReleased()) { + this.onTouchScrollEnd(); + } else if (TouchInput.isMoved()) { + this.onTouchScroll(); + } + } + } +}; + +Window_Scrollable.prototype.isWheelScrollEnabled = function() { + return this.isScrollEnabled(); +}; + +Window_Scrollable.prototype.isTouchScrollEnabled = function() { + return this.isScrollEnabled(); +}; + +Window_Scrollable.prototype.isScrollEnabled = function() { + return true; +}; + +Window_Scrollable.prototype.isTouchedInsideFrame = function() { + const touchPos = new Point(TouchInput.x, TouchInput.y); + const localPos = this.worldTransform.applyInverse(touchPos); + return this.innerRect.contains(localPos.x, localPos.y); +}; + +Window_Scrollable.prototype.onTouchScrollStart = function() { + this._scrollTouching = true; + this._scrollLastTouchX = TouchInput.x; + this._scrollLastTouchY = TouchInput.y; + this._scrollLastCursorVisible = this.cursorVisible; + this.setScrollAccel(0, 0); +}; + +Window_Scrollable.prototype.onTouchScroll = function() { + const accelX = this._scrollLastTouchX - TouchInput.x; + const accelY = this._scrollLastTouchY - TouchInput.y; + this.setScrollAccel(accelX, accelY); + this._scrollLastTouchX = TouchInput.x; + this._scrollLastTouchY = TouchInput.y; + this.cursorVisible = false; +}; + +Window_Scrollable.prototype.onTouchScrollEnd = function() { + this._scrollTouching = false; + this.cursorVisible = this._scrollLastCursorVisible; +}; + +Window_Scrollable.prototype.updateSmoothScroll = function() { + if (this._scrollDuration > 0) { + const d = this._scrollDuration; + const deltaX = (this._scrollTargetX - this._scrollX) / d; + const deltaY = (this._scrollTargetY - this._scrollY) / d; + this.scrollBy(deltaX, deltaY); + this._scrollDuration--; + } +}; + +Window_Scrollable.prototype.updateScrollAccel = function() { + if (this._scrollAccelX !== 0 || this._scrollAccelY !== 0) { + this.scrollBy(this._scrollAccelX, this._scrollAccelY); + this._scrollAccelX *= 0.92; + this._scrollAccelY *= 0.92; + if (Math.abs(this._scrollAccelX) < 1) { + this._scrollAccelX = 0; + } + if (Math.abs(this._scrollAccelY) < 1) { + this._scrollAccelY = 0; + } + } +}; + +Window_Scrollable.prototype.updateArrows = function() { + this.downArrowVisible = this._scrollY < this.maxScrollY(); + this.upArrowVisible = this._scrollY > 0; +}; + +Window_Scrollable.prototype.updateOrigin = function() { + const blockWidth = this.scrollBlockWidth() || 1; + const blockHeight = this.scrollBlockHeight() || 1; + const baseX = this._scrollX - (this._scrollX % blockWidth); + const baseY = this._scrollY - (this._scrollY % blockHeight); + if (baseX !== this._scrollBaseX || baseY !== this._scrollBaseY) { + this.updateScrollBase(baseX, baseY); + this.paint(); + } + this.origin.x = this._scrollX % blockWidth; + this.origin.y = this._scrollY % blockHeight; +}; + +Window_Scrollable.prototype.updateScrollBase = function(baseX, baseY) { + const deltaX = baseX - this._scrollBaseX; + const deltaY = baseY - this._scrollBaseY; + this._scrollBaseX = baseX; + this._scrollBaseY = baseY; + this.moveCursorBy(-deltaX, -deltaY); + this.moveInnerChildrenBy(-deltaX, -deltaY); +}; + +Window_Scrollable.prototype.paint = function() { + // to be overridden +}; + +//----------------------------------------------------------------------------- +// Window_Selectable +// +// The window class with cursor movement functions. + +function Window_Selectable() { + this.initialize(...arguments); +} + +Window_Selectable.prototype = Object.create(Window_Scrollable.prototype); +Window_Selectable.prototype.constructor = Window_Selectable; + +Window_Selectable.prototype.initialize = function(rect) { + Window_Scrollable.prototype.initialize.call(this, rect); + this._index = -1; + this._cursorFixed = false; + this._cursorAll = false; + this._helpWindow = null; + this._handlers = {}; + this._doubleTouch = false; + this._canRepeat = true; + this.deactivate(); +}; + +Window_Selectable.prototype.index = function() { + return this._index; +}; + +Window_Selectable.prototype.cursorFixed = function() { + return this._cursorFixed; +}; + +Window_Selectable.prototype.setCursorFixed = function(cursorFixed) { + this._cursorFixed = cursorFixed; +}; + +Window_Selectable.prototype.cursorAll = function() { + return this._cursorAll; +}; + +Window_Selectable.prototype.setCursorAll = function(cursorAll) { + this._cursorAll = cursorAll; +}; + +Window_Selectable.prototype.maxCols = function() { + return 1; +}; + +Window_Selectable.prototype.maxItems = function() { + return 0; +}; + +Window_Selectable.prototype.colSpacing = function() { + return 8; +}; + +Window_Selectable.prototype.rowSpacing = function() { + return 4; +}; + +Window_Selectable.prototype.itemWidth = function() { + return Math.floor(this.innerWidth / this.maxCols()); +}; + +Window_Selectable.prototype.itemHeight = function() { + return Window_Scrollable.prototype.itemHeight.call(this) + 8; +}; + +Window_Selectable.prototype.contentsHeight = function() { + return this.innerHeight + this.itemHeight(); +}; + +Window_Selectable.prototype.maxRows = function() { + return Math.max(Math.ceil(this.maxItems() / this.maxCols()), 1); +}; + +Window_Selectable.prototype.overallHeight = function() { + return this.maxRows() * this.itemHeight(); +}; + +Window_Selectable.prototype.activate = function() { + Window_Scrollable.prototype.activate.call(this); + this.reselect(); +}; + +Window_Selectable.prototype.deactivate = function() { + Window_Scrollable.prototype.deactivate.call(this); + this.reselect(); +}; + +Window_Selectable.prototype.select = function(index) { + this._index = index; + this.refreshCursor(); + this.callUpdateHelp(); +}; + +Window_Selectable.prototype.forceSelect = function(index) { + this.select(index); + this.ensureCursorVisible(false); +}; + +Window_Selectable.prototype.smoothSelect = function(index) { + this.select(index); + this.ensureCursorVisible(true); +}; + +Window_Selectable.prototype.deselect = function() { + this.select(-1); +}; + +Window_Selectable.prototype.reselect = function() { + this.select(this._index); + this.ensureCursorVisible(true); + this.cursorVisible = true; +}; + +Window_Selectable.prototype.row = function() { + return Math.floor(this.index() / this.maxCols()); +}; + +Window_Selectable.prototype.topRow = function() { + return Math.floor(this.scrollY() / this.itemHeight()); +}; + +Window_Selectable.prototype.maxTopRow = function() { + return Math.max(0, this.maxRows() - this.maxPageRows()); +}; + +Window_Selectable.prototype.setTopRow = function(row) { + this.scrollTo(this.scrollX(), row * this.itemHeight()); +}; + +Window_Selectable.prototype.maxPageRows = function() { + return Math.floor(this.innerHeight / this.itemHeight()); +}; + +Window_Selectable.prototype.maxPageItems = function() { + return this.maxPageRows() * this.maxCols(); +}; + +Window_Selectable.prototype.maxVisibleItems = function() { + const visibleRows = Math.ceil(this.contentsHeight() / this.itemHeight()); + return visibleRows * this.maxCols(); +}; + +Window_Selectable.prototype.isHorizontal = function() { + return this.maxPageRows() === 1; +}; + +Window_Selectable.prototype.topIndex = function() { + return this.topRow() * this.maxCols(); +}; + +Window_Selectable.prototype.itemRect = function(index) { + const maxCols = this.maxCols(); + const itemWidth = this.itemWidth(); + const itemHeight = this.itemHeight(); + const colSpacing = this.colSpacing(); + const rowSpacing = this.rowSpacing(); + const col = index % maxCols; + const row = Math.floor(index / maxCols); + const x = col * itemWidth + colSpacing / 2 - this.scrollBaseX(); + const y = row * itemHeight + rowSpacing / 2 - this.scrollBaseY(); + const width = itemWidth - colSpacing; + const height = itemHeight - rowSpacing; + return new Rectangle(x, y, width, height); +}; + +Window_Selectable.prototype.itemRectWithPadding = function(index) { + const rect = this.itemRect(index); + const padding = this.itemPadding(); + rect.x += padding; + rect.width -= padding * 2; + return rect; +}; + +Window_Selectable.prototype.itemLineRect = function(index) { + const rect = this.itemRectWithPadding(index); + const padding = (rect.height - this.lineHeight()) / 2; + rect.y += padding; + rect.height -= padding * 2; + return rect; +}; + +Window_Selectable.prototype.setHelpWindow = function(helpWindow) { + this._helpWindow = helpWindow; + this.callUpdateHelp(); +}; + +Window_Selectable.prototype.showHelpWindow = function() { + if (this._helpWindow) { + this._helpWindow.show(); + } +}; + +Window_Selectable.prototype.hideHelpWindow = function() { + if (this._helpWindow) { + this._helpWindow.hide(); + } +}; + +Window_Selectable.prototype.setHandler = function(symbol, method) { + this._handlers[symbol] = method; +}; + +Window_Selectable.prototype.isHandled = function(symbol) { + return !!this._handlers[symbol]; +}; + +Window_Selectable.prototype.callHandler = function(symbol) { + if (this.isHandled(symbol)) { + this._handlers[symbol](); + } +}; + +Window_Selectable.prototype.isOpenAndActive = function() { + return this.isOpen() && this.visible && this.active; +}; + +Window_Selectable.prototype.isCursorMovable = function() { + return ( + this.isOpenAndActive() && + !this._cursorFixed && + !this._cursorAll && + this.maxItems() > 0 + ); +}; + +Window_Selectable.prototype.cursorDown = function(wrap) { + const index = this.index(); + const maxItems = this.maxItems(); + const maxCols = this.maxCols(); + if (index < maxItems - maxCols || (wrap && maxCols === 1)) { + this.smoothSelect((index + maxCols) % maxItems); + } +}; + +Window_Selectable.prototype.cursorUp = function(wrap) { + const index = Math.max(0, this.index()); + const maxItems = this.maxItems(); + const maxCols = this.maxCols(); + if (index >= maxCols || (wrap && maxCols === 1)) { + this.smoothSelect((index - maxCols + maxItems) % maxItems); + } +}; + +Window_Selectable.prototype.cursorRight = function(wrap) { + const index = this.index(); + const maxItems = this.maxItems(); + const maxCols = this.maxCols(); + const horizontal = this.isHorizontal(); + if (maxCols >= 2 && (index < maxItems - 1 || (wrap && horizontal))) { + this.smoothSelect((index + 1) % maxItems); + } +}; + +Window_Selectable.prototype.cursorLeft = function(wrap) { + const index = Math.max(0, this.index()); + const maxItems = this.maxItems(); + const maxCols = this.maxCols(); + const horizontal = this.isHorizontal(); + if (maxCols >= 2 && (index > 0 || (wrap && horizontal))) { + this.smoothSelect((index - 1 + maxItems) % maxItems); + } +}; + +Window_Selectable.prototype.cursorPagedown = function() { + const index = this.index(); + const maxItems = this.maxItems(); + if (this.topRow() + this.maxPageRows() < this.maxRows()) { + this.smoothScrollDown(this.maxPageRows()); + this.select(Math.min(index + this.maxPageItems(), maxItems - 1)); + } +}; + +Window_Selectable.prototype.cursorPageup = function() { + const index = this.index(); + if (this.topRow() > 0) { + this.smoothScrollUp(this.maxPageRows()); + this.select(Math.max(index - this.maxPageItems(), 0)); + } +}; + +Window_Selectable.prototype.isScrollEnabled = function() { + return this.active || this.index() < 0; +}; + +Window_Selectable.prototype.update = function() { + this.processCursorMove(); + this.processHandling(); + this.processTouch(); + Window_Scrollable.prototype.update.call(this); +}; + +Window_Selectable.prototype.processCursorMove = function() { + if (this.isCursorMovable()) { + const lastIndex = this.index(); + if (Input.isRepeated("down")) { + this.cursorDown(Input.isTriggered("down")); + } + if (Input.isRepeated("up")) { + this.cursorUp(Input.isTriggered("up")); + } + if (Input.isRepeated("right")) { + this.cursorRight(Input.isTriggered("right")); + } + if (Input.isRepeated("left")) { + this.cursorLeft(Input.isTriggered("left")); + } + if (!this.isHandled("pagedown") && Input.isTriggered("pagedown")) { + this.cursorPagedown(); + } + if (!this.isHandled("pageup") && Input.isTriggered("pageup")) { + this.cursorPageup(); + } + if (this.index() !== lastIndex) { + this.playCursorSound(); + } + } +}; + +Window_Selectable.prototype.processHandling = function() { + if (this.isOpenAndActive()) { + if (this.isOkEnabled() && this.isOkTriggered()) { + return this.processOk(); + } + if (this.isCancelEnabled() && this.isCancelTriggered()) { + return this.processCancel(); + } + if (this.isHandled("pagedown") && Input.isTriggered("pagedown")) { + return this.processPagedown(); + } + if (this.isHandled("pageup") && Input.isTriggered("pageup")) { + return this.processPageup(); + } + } +}; + +Window_Selectable.prototype.processTouch = function() { + if (this.isOpenAndActive()) { + if (this.isHoverEnabled() && TouchInput.isHovered()) { + this.onTouchSelect(false); + } else if (TouchInput.isTriggered()) { + this.onTouchSelect(true); + } + if (TouchInput.isClicked()) { + this.onTouchOk(); + } else if (TouchInput.isCancelled()) { + this.onTouchCancel(); + } + } +}; + +Window_Selectable.prototype.isHoverEnabled = function() { + return true; +}; + +Window_Selectable.prototype.onTouchSelect = function(trigger) { + this._doubleTouch = false; + if (this.isCursorMovable()) { + const lastIndex = this.index(); + const hitIndex = this.hitIndex(); + if (hitIndex >= 0) { + if (hitIndex === this.index()) { + this._doubleTouch = true; + } + this.select(hitIndex); + } + if (trigger && this.index() !== lastIndex) { + this.playCursorSound(); + } + } +}; + +Window_Selectable.prototype.onTouchOk = function() { + if (this.isTouchOkEnabled()) { + const hitIndex = this.hitIndex(); + if (this._cursorFixed) { + if (hitIndex === this.index()) { + this.processOk(); + } + } else if (hitIndex >= 0) { + this.processOk(); + } + } +}; + +Window_Selectable.prototype.onTouchCancel = function() { + if (this.isCancelEnabled()) { + this.processCancel(); + } +}; + +Window_Selectable.prototype.hitIndex = function() { + const touchPos = new Point(TouchInput.x, TouchInput.y); + const localPos = this.worldTransform.applyInverse(touchPos); + return this.hitTest(localPos.x, localPos.y); +}; + +Window_Selectable.prototype.hitTest = function(x, y) { + if (this.innerRect.contains(x, y)) { + const cx = this.origin.x + x - this.padding; + const cy = this.origin.y + y - this.padding; + const topIndex = this.topIndex(); + for (let i = 0; i < this.maxVisibleItems(); i++) { + const index = topIndex + i; + if (index < this.maxItems()) { + const rect = this.itemRect(index); + if (rect.contains(cx, cy)) { + return index; + } + } + } + } + return -1; +}; + +Window_Selectable.prototype.isTouchOkEnabled = function() { + return ( + this.isOkEnabled() && + (this._cursorFixed || this._cursorAll || this._doubleTouch) + ); +}; + +Window_Selectable.prototype.isOkEnabled = function() { + return this.isHandled("ok"); +}; + +Window_Selectable.prototype.isCancelEnabled = function() { + return this.isHandled("cancel"); +}; + +Window_Selectable.prototype.isOkTriggered = function() { + return this._canRepeat ? Input.isRepeated("ok") : Input.isTriggered("ok"); +}; + +Window_Selectable.prototype.isCancelTriggered = function() { + return Input.isRepeated("cancel"); +}; + +Window_Selectable.prototype.processOk = function() { + if (this.isCurrentItemEnabled()) { + this.playOkSound(); + this.updateInputData(); + this.deactivate(); + this.callOkHandler(); + } else { + this.playBuzzerSound(); + } +}; + +Window_Selectable.prototype.callOkHandler = function() { + this.callHandler("ok"); +}; + +Window_Selectable.prototype.processCancel = function() { + SoundManager.playCancel(); + this.updateInputData(); + this.deactivate(); + this.callCancelHandler(); +}; + +Window_Selectable.prototype.callCancelHandler = function() { + this.callHandler("cancel"); +}; + +Window_Selectable.prototype.processPageup = function() { + this.updateInputData(); + this.deactivate(); + this.callHandler("pageup"); +}; + +Window_Selectable.prototype.processPagedown = function() { + this.updateInputData(); + this.deactivate(); + this.callHandler("pagedown"); +}; + +Window_Selectable.prototype.updateInputData = function() { + Input.update(); + TouchInput.update(); + this.clearScrollStatus(); +}; + +Window_Selectable.prototype.ensureCursorVisible = function(smooth) { + if (this._cursorAll) { + this.scrollTo(0, 0); + } else if (this.innerHeight > 0 && this.row() >= 0) { + const scrollY = this.scrollY(); + const itemTop = this.row() * this.itemHeight(); + const itemBottom = itemTop + this.itemHeight(); + const scrollMin = itemBottom - this.innerHeight; + if (scrollY > itemTop) { + if (smooth) { + this.smoothScrollTo(0, itemTop); + } else { + this.scrollTo(0, itemTop); + } + } else if (scrollY < scrollMin) { + if (smooth) { + this.smoothScrollTo(0, scrollMin); + } else { + this.scrollTo(0, scrollMin); + } + } + } +}; + +Window_Selectable.prototype.callUpdateHelp = function() { + if (this.active && this._helpWindow) { + this.updateHelp(); + } +}; + +Window_Selectable.prototype.updateHelp = function() { + this._helpWindow.clear(); +}; + +Window_Selectable.prototype.setHelpWindowItem = function(item) { + if (this._helpWindow) { + this._helpWindow.setItem(item); + } +}; + +Window_Selectable.prototype.isCurrentItemEnabled = function() { + return true; +}; + +Window_Selectable.prototype.drawAllItems = function() { + const topIndex = this.topIndex(); + for (let i = 0; i < this.maxVisibleItems(); i++) { + const index = topIndex + i; + if (index < this.maxItems()) { + this.drawItemBackground(index); + this.drawItem(index); + } + } +}; + +Window_Selectable.prototype.drawItem = function(/*index*/) { + // +}; + +Window_Selectable.prototype.clearItem = function(index) { + const rect = this.itemRect(index); + this.contents.clearRect(rect.x, rect.y, rect.width, rect.height); + this.contentsBack.clearRect(rect.x, rect.y, rect.width, rect.height); +}; + +Window_Selectable.prototype.drawItemBackground = function(index) { + const rect = this.itemRect(index); + this.drawBackgroundRect(rect); +}; + +Window_Selectable.prototype.drawBackgroundRect = function(rect) { + const c1 = ColorManager.itemBackColor1(); + const c2 = ColorManager.itemBackColor2(); + const x = rect.x; + const y = rect.y; + const w = rect.width; + const h = rect.height; + this.contentsBack.gradientFillRect(x, y, w, h, c1, c2, true); + this.contentsBack.strokeRect(x, y, w, h, c1); +}; + +Window_Selectable.prototype.redrawItem = function(index) { + if (index >= 0) { + this.clearItem(index); + this.drawItemBackground(index); + this.drawItem(index); + } +}; + +Window_Selectable.prototype.redrawCurrentItem = function() { + this.redrawItem(this.index()); +}; + +Window_Selectable.prototype.refresh = function() { + this.paint(); +}; + +Window_Selectable.prototype.paint = function() { + if (this.contents) { + this.contents.clear(); + this.contentsBack.clear(); + this.drawAllItems(); + } +}; + +Window_Selectable.prototype.refreshCursor = function() { + if (this._cursorAll) { + this.refreshCursorForAll(); + } else if (this.index() >= 0) { + const rect = this.itemRect(this.index()); + this.setCursorRect(rect.x, rect.y, rect.width, rect.height); + } else { + this.setCursorRect(0, 0, 0, 0); + } +}; + +Window_Selectable.prototype.refreshCursorForAll = function() { + const maxItems = this.maxItems(); + if (maxItems > 0) { + const rect = this.itemRect(0); + rect.enlarge(this.itemRect(maxItems - 1)); + this.setCursorRect(rect.x, rect.y, rect.width, rect.height); + } else { + this.setCursorRect(0, 0, 0, 0); + } +}; + +//----------------------------------------------------------------------------- +// Window_Command +// +// The superclass of windows for selecting a command. + +function Window_Command() { + this.initialize(...arguments); +} + +Window_Command.prototype = Object.create(Window_Selectable.prototype); +Window_Command.prototype.constructor = Window_Command; + +Window_Command.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this.refresh(); + this.select(0); + this.activate(); +}; + +Window_Command.prototype.maxItems = function() { + return this._list.length; +}; + +Window_Command.prototype.clearCommandList = function() { + this._list = []; +}; + +Window_Command.prototype.makeCommandList = function() { + // +}; + +// prettier-ignore +Window_Command.prototype.addCommand = function( + name, symbol, enabled = true, ext = null +) { + this._list.push({ name: name, symbol: symbol, enabled: enabled, ext: ext }); +}; + +Window_Command.prototype.commandName = function(index) { + return this._list[index].name; +}; + +Window_Command.prototype.commandSymbol = function(index) { + return this._list[index].symbol; +}; + +Window_Command.prototype.isCommandEnabled = function(index) { + return this._list[index].enabled; +}; + +Window_Command.prototype.currentData = function() { + return this.index() >= 0 ? this._list[this.index()] : null; +}; + +Window_Command.prototype.isCurrentItemEnabled = function() { + return this.currentData() ? this.currentData().enabled : false; +}; + +Window_Command.prototype.currentSymbol = function() { + return this.currentData() ? this.currentData().symbol : null; +}; + +Window_Command.prototype.currentExt = function() { + return this.currentData() ? this.currentData().ext : null; +}; + +Window_Command.prototype.findSymbol = function(symbol) { + return this._list.findIndex(item => item.symbol === symbol); +}; + +Window_Command.prototype.selectSymbol = function(symbol) { + const index = this.findSymbol(symbol); + if (index >= 0) { + this.forceSelect(index); + } else { + this.forceSelect(0); + } +}; + +Window_Command.prototype.findExt = function(ext) { + return this._list.findIndex(item => item.ext === ext); +}; + +Window_Command.prototype.selectExt = function(ext) { + const index = this.findExt(ext); + if (index >= 0) { + this.forceSelect(index); + } else { + this.forceSelect(0); + } +}; + +Window_Command.prototype.drawItem = function(index) { + const rect = this.itemLineRect(index); + const align = this.itemTextAlign(); + this.resetTextColor(); + this.changePaintOpacity(this.isCommandEnabled(index)); + this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align); +}; + +Window_Command.prototype.itemTextAlign = function() { + return "center"; +}; + +Window_Command.prototype.isOkEnabled = function() { + return true; +}; + +Window_Command.prototype.callOkHandler = function() { + const symbol = this.currentSymbol(); + if (this.isHandled(symbol)) { + this.callHandler(symbol); + } else if (this.isHandled("ok")) { + Window_Selectable.prototype.callOkHandler.call(this); + } else { + this.activate(); + } +}; + +Window_Command.prototype.refresh = function() { + this.clearCommandList(); + this.makeCommandList(); + Window_Selectable.prototype.refresh.call(this); +}; + +//----------------------------------------------------------------------------- +// Window_HorzCommand +// +// The command window for the horizontal selection format. + +function Window_HorzCommand() { + this.initialize(...arguments); +} + +Window_HorzCommand.prototype = Object.create(Window_Command.prototype); +Window_HorzCommand.prototype.constructor = Window_HorzCommand; + +Window_HorzCommand.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); +}; + +Window_HorzCommand.prototype.maxCols = function() { + return 4; +}; + +Window_HorzCommand.prototype.itemTextAlign = function() { + return "center"; +}; + +//----------------------------------------------------------------------------- +// Window_Help +// +// The window for displaying the description of the selected item. + +function Window_Help() { + this.initialize(...arguments); +} + +Window_Help.prototype = Object.create(Window_Base.prototype); +Window_Help.prototype.constructor = Window_Help; + +Window_Help.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, rect); + this._text = ""; +}; + +Window_Help.prototype.setText = function(text) { + if (this._text !== text) { + this._text = text; + this.refresh(); + } +}; + +Window_Help.prototype.clear = function() { + this.setText(""); +}; + +Window_Help.prototype.setItem = function(item) { + this.setText(item ? item.description : ""); +}; + +Window_Help.prototype.refresh = function() { + const rect = this.baseTextRect(); + this.contents.clear(); + this.drawTextEx(this._text, rect.x, rect.y, rect.width); +}; + +//----------------------------------------------------------------------------- +// Window_Gold +// +// The window for displaying the party's gold. + +function Window_Gold() { + this.initialize(...arguments); +} + +Window_Gold.prototype = Object.create(Window_Selectable.prototype); +Window_Gold.prototype.constructor = Window_Gold; + +Window_Gold.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this.refresh(); +}; + +Window_Gold.prototype.colSpacing = function() { + return 0; +}; + +Window_Gold.prototype.refresh = function() { + const rect = this.itemLineRect(0); + const x = rect.x; + const y = rect.y; + const width = rect.width; + this.contents.clear(); + this.drawCurrencyValue(this.value(), this.currencyUnit(), x, y, width); +}; + +Window_Gold.prototype.value = function() { + return $gameParty.gold(); +}; + +Window_Gold.prototype.currencyUnit = function() { + return TextManager.currencyUnit; +}; + +Window_Gold.prototype.open = function() { + this.refresh(); + Window_Selectable.prototype.open.call(this); +}; + +//----------------------------------------------------------------------------- +// Window_StatusBase +// +// The superclass of windows for displaying actor status. + +function Window_StatusBase() { + this.initialize(...arguments); +} + +Window_StatusBase.prototype = Object.create(Window_Selectable.prototype); +Window_StatusBase.prototype.constructor = Window_StatusBase; + +Window_StatusBase.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._additionalSprites = {}; + this.loadFaceImages(); +}; + +Window_StatusBase.prototype.loadFaceImages = function() { + for (const actor of $gameParty.members()) { + ImageManager.loadFace(actor.faceName()); + } +}; + +Window_StatusBase.prototype.refresh = function() { + this.hideAdditionalSprites(); + Window_Selectable.prototype.refresh.call(this); +}; + +Window_StatusBase.prototype.hideAdditionalSprites = function() { + for (const sprite of Object.values(this._additionalSprites)) { + sprite.hide(); + } +}; + +Window_StatusBase.prototype.placeActorName = function(actor, x, y) { + const key = "actor%1-name".format(actor.actorId()); + const sprite = this.createInnerSprite(key, Sprite_Name); + sprite.setup(actor); + sprite.move(x, y); + sprite.show(); +}; + +Window_StatusBase.prototype.placeStateIcon = function(actor, x, y) { + const key = "actor%1-stateIcon".format(actor.actorId()); + const sprite = this.createInnerSprite(key, Sprite_StateIcon); + sprite.setup(actor); + sprite.move(x, y); + sprite.show(); +}; + +Window_StatusBase.prototype.placeGauge = function(actor, type, x, y) { + const key = "actor%1-gauge-%2".format(actor.actorId(), type); + const sprite = this.createInnerSprite(key, Sprite_Gauge); + sprite.setup(actor, type); + sprite.move(x, y); + sprite.show(); +}; + +Window_StatusBase.prototype.createInnerSprite = function(key, spriteClass) { + const dict = this._additionalSprites; + if (dict[key]) { + return dict[key]; + } else { + const sprite = new spriteClass(); + dict[key] = sprite; + this.addInnerChild(sprite); + return sprite; + } +}; + +Window_StatusBase.prototype.placeTimeGauge = function(actor, x, y) { + if (BattleManager.isTpb()) { + this.placeGauge(actor, "time", x, y); + } +}; + +Window_StatusBase.prototype.placeBasicGauges = function(actor, x, y) { + this.placeGauge(actor, "hp", x, y); + this.placeGauge(actor, "mp", x, y + this.gaugeLineHeight()); + if ($dataSystem.optDisplayTp) { + this.placeGauge(actor, "tp", x, y + this.gaugeLineHeight() * 2); + } +}; + +Window_StatusBase.prototype.gaugeLineHeight = function() { + return 24; +}; + +Window_StatusBase.prototype.drawActorCharacter = function(actor, x, y) { + this.drawCharacter(actor.characterName(), actor.characterIndex(), x, y); +}; + +// prettier-ignore +Window_StatusBase.prototype.drawActorFace = function( + actor, x, y, width, height +) { + this.drawFace(actor.faceName(), actor.faceIndex(), x, y, width, height); +}; + +Window_StatusBase.prototype.drawActorName = function(actor, x, y, width) { + width = width || 168; + this.changeTextColor(ColorManager.hpColor(actor)); + this.drawText(actor.name(), x, y, width); +}; + +Window_StatusBase.prototype.drawActorClass = function(actor, x, y, width) { + width = width || 168; + this.resetTextColor(); + this.drawText(actor.currentClass().name, x, y, width); +}; + +Window_StatusBase.prototype.drawActorNickname = function(actor, x, y, width) { + width = width || 270; + this.resetTextColor(); + this.drawText(actor.nickname(), x, y, width); +}; + +Window_StatusBase.prototype.drawActorLevel = function(actor, x, y) { + this.changeTextColor(ColorManager.systemColor()); + this.drawText(TextManager.levelA, x, y, 48); + this.resetTextColor(); + this.drawText(actor.level, x + 84, y, 36, "right"); +}; + +Window_StatusBase.prototype.drawActorIcons = function(actor, x, y, width) { + width = width || 144; + const iconWidth = ImageManager.iconWidth; + const icons = actor.allIcons().slice(0, Math.floor(width / iconWidth)); + let iconX = x; + for (const icon of icons) { + this.drawIcon(icon, iconX, y + 2); + iconX += iconWidth; + } +}; + +Window_StatusBase.prototype.drawActorSimpleStatus = function(actor, x, y) { + const lineHeight = this.lineHeight(); + const x2 = x + 180; + this.drawActorName(actor, x, y); + this.drawActorLevel(actor, x, y + lineHeight * 1); + this.drawActorIcons(actor, x, y + lineHeight * 2); + this.drawActorClass(actor, x2, y); + this.placeBasicGauges(actor, x2, y + lineHeight); +}; + +Window_StatusBase.prototype.actorSlotName = function(actor, index) { + const slots = actor.equipSlots(); + return $dataSystem.equipTypes[slots[index]]; +}; + +//----------------------------------------------------------------------------- +// Window_MenuCommand +// +// The window for selecting a command on the menu screen. + +function Window_MenuCommand() { + this.initialize(...arguments); +} + +Window_MenuCommand.prototype = Object.create(Window_Command.prototype); +Window_MenuCommand.prototype.constructor = Window_MenuCommand; + +Window_MenuCommand.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); + this.selectLast(); + this._canRepeat = false; +}; + +Window_MenuCommand._lastCommandSymbol = null; + +Window_MenuCommand.initCommandPosition = function() { + this._lastCommandSymbol = null; +}; + +Window_MenuCommand.prototype.makeCommandList = function() { + this.addMainCommands(); + this.addFormationCommand(); + this.addOriginalCommands(); + this.addOptionsCommand(); + this.addSaveCommand(); + this.addGameEndCommand(); +}; + +Window_MenuCommand.prototype.addMainCommands = function() { + const enabled = this.areMainCommandsEnabled(); + if (this.needsCommand("item")) { + this.addCommand(TextManager.item, "item", enabled); + } + if (this.needsCommand("skill")) { + this.addCommand(TextManager.skill, "skill", enabled); + } + if (this.needsCommand("equip")) { + this.addCommand(TextManager.equip, "equip", enabled); + } + if (this.needsCommand("status")) { + this.addCommand(TextManager.status, "status", enabled); + } +}; + +Window_MenuCommand.prototype.addFormationCommand = function() { + if (this.needsCommand("formation")) { + const enabled = this.isFormationEnabled(); + this.addCommand(TextManager.formation, "formation", enabled); + } +}; + +Window_MenuCommand.prototype.addOriginalCommands = function() { + // +}; + +Window_MenuCommand.prototype.addOptionsCommand = function() { + if (this.needsCommand("options")) { + const enabled = this.isOptionsEnabled(); + this.addCommand(TextManager.options, "options", enabled); + } +}; + +Window_MenuCommand.prototype.addSaveCommand = function() { + if (this.needsCommand("save")) { + const enabled = this.isSaveEnabled(); + this.addCommand(TextManager.save, "save", enabled); + } +}; + +Window_MenuCommand.prototype.addGameEndCommand = function() { + const enabled = this.isGameEndEnabled(); + this.addCommand(TextManager.gameEnd, "gameEnd", enabled); +}; + +Window_MenuCommand.prototype.needsCommand = function(name) { + const table = ["item", "skill", "equip", "status", "formation", "save"]; + const index = table.indexOf(name); + if (index >= 0) { + return $dataSystem.menuCommands[index]; + } + return true; +}; + +Window_MenuCommand.prototype.areMainCommandsEnabled = function() { + return $gameParty.exists(); +}; + +Window_MenuCommand.prototype.isFormationEnabled = function() { + return $gameParty.size() >= 2 && $gameSystem.isFormationEnabled(); +}; + +Window_MenuCommand.prototype.isOptionsEnabled = function() { + return true; +}; + +Window_MenuCommand.prototype.isSaveEnabled = function() { + return !DataManager.isEventTest() && $gameSystem.isSaveEnabled(); +}; + +Window_MenuCommand.prototype.isGameEndEnabled = function() { + return true; +}; + +Window_MenuCommand.prototype.processOk = function() { + Window_MenuCommand._lastCommandSymbol = this.currentSymbol(); + Window_Command.prototype.processOk.call(this); +}; + +Window_MenuCommand.prototype.selectLast = function() { + this.selectSymbol(Window_MenuCommand._lastCommandSymbol); +}; + +//----------------------------------------------------------------------------- +// Window_MenuStatus +// +// The window for displaying party member status on the menu screen. + +function Window_MenuStatus() { + this.initialize(...arguments); +} + +Window_MenuStatus.prototype = Object.create(Window_StatusBase.prototype); +Window_MenuStatus.prototype.constructor = Window_MenuStatus; + +Window_MenuStatus.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._formationMode = false; + this._pendingIndex = -1; + this.refresh(); +}; + +Window_MenuStatus.prototype.maxItems = function() { + return $gameParty.size(); +}; + +Window_MenuStatus.prototype.numVisibleRows = function() { + return 4; +}; + +Window_MenuStatus.prototype.itemHeight = function() { + return Math.floor(this.innerHeight / this.numVisibleRows()); +}; + +Window_MenuStatus.prototype.actor = function(index) { + return $gameParty.members()[index]; +}; + +Window_MenuStatus.prototype.drawItem = function(index) { + this.drawPendingItemBackground(index); + this.drawItemImage(index); + this.drawItemStatus(index); +}; + +Window_MenuStatus.prototype.drawPendingItemBackground = function(index) { + if (index === this._pendingIndex) { + const rect = this.itemRect(index); + const color = ColorManager.pendingColor(); + this.changePaintOpacity(false); + this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color); + this.changePaintOpacity(true); + } +}; + +Window_MenuStatus.prototype.drawItemImage = function(index) { + const actor = this.actor(index); + const rect = this.itemRect(index); + const width = ImageManager.faceWidth; + const height = rect.height - 2; + this.changePaintOpacity(actor.isBattleMember()); + this.drawActorFace(actor, rect.x + 1, rect.y + 1, width, height); + this.changePaintOpacity(true); +}; + +Window_MenuStatus.prototype.drawItemStatus = function(index) { + const actor = this.actor(index); + const rect = this.itemRect(index); + const x = rect.x + 180; + const y = rect.y + Math.floor(rect.height / 2 - this.lineHeight() * 1.5); + this.drawActorSimpleStatus(actor, x, y); +}; + +Window_MenuStatus.prototype.processOk = function() { + Window_StatusBase.prototype.processOk.call(this); + const actor = this.actor(this.index()); + $gameParty.setMenuActor(actor); +}; + +Window_MenuStatus.prototype.isCurrentItemEnabled = function() { + if (this._formationMode) { + const actor = this.actor(this.index()); + return actor && actor.isFormationChangeOk(); + } else { + return true; + } +}; + +Window_MenuStatus.prototype.selectLast = function() { + this.smoothSelect($gameParty.menuActor().index() || 0); +}; + +Window_MenuStatus.prototype.formationMode = function() { + return this._formationMode; +}; + +Window_MenuStatus.prototype.setFormationMode = function(formationMode) { + this._formationMode = formationMode; +}; + +Window_MenuStatus.prototype.pendingIndex = function() { + return this._pendingIndex; +}; + +Window_MenuStatus.prototype.setPendingIndex = function(index) { + const lastPendingIndex = this._pendingIndex; + this._pendingIndex = index; + this.redrawItem(this._pendingIndex); + this.redrawItem(lastPendingIndex); +}; + +//----------------------------------------------------------------------------- +// Window_MenuActor +// +// The window for selecting a target actor on the item and skill screens. + +function Window_MenuActor() { + this.initialize(...arguments); +} + +Window_MenuActor.prototype = Object.create(Window_MenuStatus.prototype); +Window_MenuActor.prototype.constructor = Window_MenuActor; + +Window_MenuActor.prototype.initialize = function(rect) { + Window_MenuStatus.prototype.initialize.call(this, rect); + this.hide(); +}; + +Window_MenuActor.prototype.processOk = function() { + if (!this.cursorAll()) { + $gameParty.setTargetActor($gameParty.members()[this.index()]); + } + this.callOkHandler(); +}; + +Window_MenuActor.prototype.selectLast = function() { + this.forceSelect($gameParty.targetActor().index() || 0); +}; + +Window_MenuActor.prototype.selectForItem = function(item) { + const actor = $gameParty.menuActor(); + const action = new Game_Action(actor); + action.setItemObject(item); + this.setCursorFixed(false); + this.setCursorAll(false); + if (action.isForUser()) { + if (DataManager.isSkill(item)) { + this.setCursorFixed(true); + this.forceSelect(actor.index()); + } else { + this.selectLast(); + } + } else if (action.isForAll()) { + this.setCursorAll(true); + this.forceSelect(0); + } else { + this.selectLast(); + } +}; + +//----------------------------------------------------------------------------- +// Window_ItemCategory +// +// The window for selecting a category of items on the item and shop screens. + +function Window_ItemCategory() { + this.initialize(...arguments); +} + +Window_ItemCategory.prototype = Object.create(Window_HorzCommand.prototype); +Window_ItemCategory.prototype.constructor = Window_ItemCategory; + +Window_ItemCategory.prototype.initialize = function(rect) { + Window_HorzCommand.prototype.initialize.call(this, rect); +}; + +Window_ItemCategory.prototype.maxCols = function() { + return 4; +}; + +Window_ItemCategory.prototype.update = function() { + Window_HorzCommand.prototype.update.call(this); + if (this._itemWindow) { + this._itemWindow.setCategory(this.currentSymbol()); + } +}; + +Window_ItemCategory.prototype.makeCommandList = function() { + if (this.needsCommand("item")) { + this.addCommand(TextManager.item, "item"); + } + if (this.needsCommand("weapon")) { + this.addCommand(TextManager.weapon, "weapon"); + } + if (this.needsCommand("armor")) { + this.addCommand(TextManager.armor, "armor"); + } + if (this.needsCommand("keyItem")) { + this.addCommand(TextManager.keyItem, "keyItem"); + } +}; + +Window_ItemCategory.prototype.needsCommand = function(name) { + const table = ["item", "weapon", "armor", "keyItem"]; + const index = table.indexOf(name); + if (index >= 0) { + return $dataSystem.itemCategories[index]; + } + return true; +}; + +Window_ItemCategory.prototype.setItemWindow = function(itemWindow) { + this._itemWindow = itemWindow; +}; + +Window_ItemCategory.prototype.needsSelection = function() { + return this.maxItems() >= 2; +}; + +//----------------------------------------------------------------------------- +// Window_ItemList +// +// The window for selecting an item on the item screen. + +function Window_ItemList() { + this.initialize(...arguments); +} + +Window_ItemList.prototype = Object.create(Window_Selectable.prototype); +Window_ItemList.prototype.constructor = Window_ItemList; + +Window_ItemList.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._category = "none"; + this._data = []; +}; + +Window_ItemList.prototype.setCategory = function(category) { + if (this._category !== category) { + this._category = category; + this.refresh(); + this.scrollTo(0, 0); + } +}; + +Window_ItemList.prototype.maxCols = function() { + return 2; +}; + +Window_ItemList.prototype.colSpacing = function() { + return 16; +}; + +Window_ItemList.prototype.maxItems = function() { + return this._data ? this._data.length : 1; +}; + +Window_ItemList.prototype.item = function() { + return this.itemAt(this.index()); +}; + +Window_ItemList.prototype.itemAt = function(index) { + return this._data && index >= 0 ? this._data[index] : null; +}; + +Window_ItemList.prototype.isCurrentItemEnabled = function() { + return this.isEnabled(this.item()); +}; + +Window_ItemList.prototype.includes = function(item) { + switch (this._category) { + case "item": + return DataManager.isItem(item) && item.itypeId === 1; + case "weapon": + return DataManager.isWeapon(item); + case "armor": + return DataManager.isArmor(item); + case "keyItem": + return DataManager.isItem(item) && item.itypeId === 2; + default: + return false; + } +}; + +Window_ItemList.prototype.needsNumber = function() { + if (this._category === "keyItem") { + return $dataSystem.optKeyItemsNumber; + } else { + return true; + } +}; + +Window_ItemList.prototype.isEnabled = function(item) { + return $gameParty.canUse(item); +}; + +Window_ItemList.prototype.makeItemList = function() { + this._data = $gameParty.allItems().filter(item => this.includes(item)); + if (this.includes(null)) { + this._data.push(null); + } +}; + +Window_ItemList.prototype.selectLast = function() { + const index = this._data.indexOf($gameParty.lastItem()); + this.forceSelect(index >= 0 ? index : 0); +}; + +Window_ItemList.prototype.drawItem = function(index) { + const item = this.itemAt(index); + if (item) { + const numberWidth = this.numberWidth(); + const rect = this.itemLineRect(index); + this.changePaintOpacity(this.isEnabled(item)); + this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth); + this.drawItemNumber(item, rect.x, rect.y, rect.width); + this.changePaintOpacity(1); + } +}; + +Window_ItemList.prototype.numberWidth = function() { + return this.textWidth("000"); +}; + +Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) { + if (this.needsNumber()) { + this.drawText(":", x, y, width - this.textWidth("00"), "right"); + this.drawText($gameParty.numItems(item), x, y, width, "right"); + } +}; + +Window_ItemList.prototype.updateHelp = function() { + this.setHelpWindowItem(this.item()); +}; + +Window_ItemList.prototype.refresh = function() { + this.makeItemList(); + Window_Selectable.prototype.refresh.call(this); +}; + +//----------------------------------------------------------------------------- +// Window_SkillType +// +// The window for selecting a skill type on the skill screen. + +function Window_SkillType() { + this.initialize(...arguments); +} + +Window_SkillType.prototype = Object.create(Window_Command.prototype); +Window_SkillType.prototype.constructor = Window_SkillType; + +Window_SkillType.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); + this._actor = null; +}; + +Window_SkillType.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + this.selectLast(); + } +}; + +Window_SkillType.prototype.makeCommandList = function() { + if (this._actor) { + const skillTypes = this._actor.skillTypes(); + for (const stypeId of skillTypes) { + const name = $dataSystem.skillTypes[stypeId]; + this.addCommand(name, "skill", true, stypeId); + } + } +}; + +Window_SkillType.prototype.update = function() { + Window_Command.prototype.update.call(this); + if (this._skillWindow) { + this._skillWindow.setStypeId(this.currentExt()); + } +}; + +Window_SkillType.prototype.setSkillWindow = function(skillWindow) { + this._skillWindow = skillWindow; +}; + +Window_SkillType.prototype.selectLast = function() { + const skill = this._actor.lastMenuSkill(); + if (skill) { + this.selectExt(skill.stypeId); + } else { + this.forceSelect(0); + } +}; + +//----------------------------------------------------------------------------- +// Window_SkillStatus +// +// The window for displaying the skill user's status on the skill screen. + +function Window_SkillStatus() { + this.initialize(...arguments); +} + +Window_SkillStatus.prototype = Object.create(Window_StatusBase.prototype); +Window_SkillStatus.prototype.constructor = Window_SkillStatus; + +Window_SkillStatus.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; +}; + +Window_SkillStatus.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + } +}; + +Window_SkillStatus.prototype.refresh = function() { + Window_StatusBase.prototype.refresh.call(this); + if (this._actor) { + const x = this.colSpacing() / 2; + const h = this.innerHeight; + const y = h / 2 - this.lineHeight() * 1.5; + this.drawActorFace(this._actor, x + 1, 0, 144, h); + this.drawActorSimpleStatus(this._actor, x + 180, y); + } +}; + +//----------------------------------------------------------------------------- +// Window_SkillList +// +// The window for selecting a skill on the skill screen. + +function Window_SkillList() { + this.initialize(...arguments); +} + +Window_SkillList.prototype = Object.create(Window_Selectable.prototype); +Window_SkillList.prototype.constructor = Window_SkillList; + +Window_SkillList.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._actor = null; + this._stypeId = 0; + this._data = []; +}; + +Window_SkillList.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + this.scrollTo(0, 0); + } +}; + +Window_SkillList.prototype.setStypeId = function(stypeId) { + if (this._stypeId !== stypeId) { + this._stypeId = stypeId; + this.refresh(); + this.scrollTo(0, 0); + } +}; + +Window_SkillList.prototype.maxCols = function() { + return 2; +}; + +Window_SkillList.prototype.colSpacing = function() { + return 16; +}; + +Window_SkillList.prototype.maxItems = function() { + return this._data ? this._data.length : 1; +}; + +Window_SkillList.prototype.item = function() { + return this.itemAt(this.index()); +}; + +Window_SkillList.prototype.itemAt = function(index) { + return this._data && index >= 0 ? this._data[index] : null; +}; + +Window_SkillList.prototype.isCurrentItemEnabled = function() { + return this.isEnabled(this._data[this.index()]); +}; + +Window_SkillList.prototype.includes = function(item) { + return item && item.stypeId === this._stypeId; +}; + +Window_SkillList.prototype.isEnabled = function(item) { + return this._actor && this._actor.canUse(item); +}; + +Window_SkillList.prototype.makeItemList = function() { + if (this._actor) { + this._data = this._actor.skills().filter(item => this.includes(item)); + } else { + this._data = []; + } +}; + +Window_SkillList.prototype.selectLast = function() { + const index = this._data.indexOf(this._actor.lastSkill()); + this.forceSelect(index >= 0 ? index : 0); +}; + +Window_SkillList.prototype.drawItem = function(index) { + const skill = this.itemAt(index); + if (skill) { + const costWidth = this.costWidth(); + const rect = this.itemLineRect(index); + this.changePaintOpacity(this.isEnabled(skill)); + this.drawItemName(skill, rect.x, rect.y, rect.width - costWidth); + this.drawSkillCost(skill, rect.x, rect.y, rect.width); + this.changePaintOpacity(1); + } +}; + +Window_SkillList.prototype.costWidth = function() { + return this.textWidth("000"); +}; + +Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) { + if (this._actor.skillTpCost(skill) > 0) { + this.changeTextColor(ColorManager.tpCostColor()); + this.drawText(this._actor.skillTpCost(skill), x, y, width, "right"); + } else if (this._actor.skillMpCost(skill) > 0) { + this.changeTextColor(ColorManager.mpCostColor()); + this.drawText(this._actor.skillMpCost(skill), x, y, width, "right"); + } +}; + +Window_SkillList.prototype.updateHelp = function() { + this.setHelpWindowItem(this.item()); +}; + +Window_SkillList.prototype.refresh = function() { + this.makeItemList(); + Window_Selectable.prototype.refresh.call(this); +}; + +//----------------------------------------------------------------------------- +// Window_EquipStatus +// +// The window for displaying parameter changes on the equipment screen. + +function Window_EquipStatus() { + this.initialize(...arguments); +} + +Window_EquipStatus.prototype = Object.create(Window_StatusBase.prototype); +Window_EquipStatus.prototype.constructor = Window_EquipStatus; + +Window_EquipStatus.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; + this._tempActor = null; + this.refresh(); +}; + +Window_EquipStatus.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + } +}; + +Window_EquipStatus.prototype.colSpacing = function() { + return 0; +}; + +Window_EquipStatus.prototype.refresh = function() { + this.contents.clear(); + if (this._actor) { + const nameRect = this.itemLineRect(0); + this.drawActorName(this._actor, nameRect.x, 0, nameRect.width); + this.drawActorFace(this._actor, nameRect.x, nameRect.height); + this.drawAllParams(); + } +}; + +Window_EquipStatus.prototype.setTempActor = function(tempActor) { + if (this._tempActor !== tempActor) { + this._tempActor = tempActor; + this.refresh(); + } +}; + +Window_EquipStatus.prototype.drawAllParams = function() { + for (let i = 0; i < 6; i++) { + const x = this.itemPadding(); + const y = this.paramY(i); + this.drawItem(x, y, 2 + i); + } +}; + +Window_EquipStatus.prototype.drawItem = function(x, y, paramId) { + const paramX = this.paramX(); + const paramWidth = this.paramWidth(); + const rightArrowWidth = this.rightArrowWidth(); + this.drawParamName(x, y, paramId); + if (this._actor) { + this.drawCurrentParam(paramX, y, paramId); + } + this.drawRightArrow(paramX + paramWidth, y); + if (this._tempActor) { + this.drawNewParam(paramX + paramWidth + rightArrowWidth, y, paramId); + } +}; + +Window_EquipStatus.prototype.drawParamName = function(x, y, paramId) { + const width = this.paramX() - this.itemPadding() * 2; + this.changeTextColor(ColorManager.systemColor()); + this.drawText(TextManager.param(paramId), x, y, width); +}; + +Window_EquipStatus.prototype.drawCurrentParam = function(x, y, paramId) { + const paramWidth = this.paramWidth(); + this.resetTextColor(); + this.drawText(this._actor.param(paramId), x, y, paramWidth, "right"); +}; + +Window_EquipStatus.prototype.drawRightArrow = function(x, y) { + const rightArrowWidth = this.rightArrowWidth(); + this.changeTextColor(ColorManager.systemColor()); + this.drawText("\u2192", x, y, rightArrowWidth, "center"); +}; + +Window_EquipStatus.prototype.drawNewParam = function(x, y, paramId) { + const paramWidth = this.paramWidth(); + const newValue = this._tempActor.param(paramId); + const diffvalue = newValue - this._actor.param(paramId); + this.changeTextColor(ColorManager.paramchangeTextColor(diffvalue)); + this.drawText(newValue, x, y, paramWidth, "right"); +}; + +Window_EquipStatus.prototype.rightArrowWidth = function() { + return 32; +}; + +Window_EquipStatus.prototype.paramWidth = function() { + return 48; +}; + +Window_EquipStatus.prototype.paramX = function() { + const itemPadding = this.itemPadding(); + const rightArrowWidth = this.rightArrowWidth(); + const paramWidth = this.paramWidth(); + return this.innerWidth - itemPadding - paramWidth * 2 - rightArrowWidth; +}; + +Window_EquipStatus.prototype.paramY = function(index) { + const faceHeight = ImageManager.faceHeight; + return faceHeight + Math.floor(this.lineHeight() * (index + 1.5)); +}; + +//----------------------------------------------------------------------------- +// Window_EquipCommand +// +// The window for selecting a command on the equipment screen. + +function Window_EquipCommand() { + this.initialize(...arguments); +} + +Window_EquipCommand.prototype = Object.create(Window_HorzCommand.prototype); +Window_EquipCommand.prototype.constructor = Window_EquipCommand; + +Window_EquipCommand.prototype.initialize = function(rect) { + Window_HorzCommand.prototype.initialize.call(this, rect); +}; + +Window_EquipCommand.prototype.maxCols = function() { + return 3; +}; + +Window_EquipCommand.prototype.makeCommandList = function() { + this.addCommand(TextManager.equip2, "equip"); + this.addCommand(TextManager.optimize, "optimize"); + this.addCommand(TextManager.clear, "clear"); +}; + +//----------------------------------------------------------------------------- +// Window_EquipSlot +// +// The window for selecting an equipment slot on the equipment screen. + +function Window_EquipSlot() { + this.initialize(...arguments); +} + +Window_EquipSlot.prototype = Object.create(Window_StatusBase.prototype); +Window_EquipSlot.prototype.constructor = Window_EquipSlot; + +Window_EquipSlot.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; + this.refresh(); +}; + +Window_EquipSlot.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + } +}; + +Window_EquipSlot.prototype.update = function() { + Window_StatusBase.prototype.update.call(this); + if (this._itemWindow) { + this._itemWindow.setSlotId(this.index()); + } +}; + +Window_EquipSlot.prototype.maxItems = function() { + return this._actor ? this._actor.equipSlots().length : 0; +}; + +Window_EquipSlot.prototype.item = function() { + return this.itemAt(this.index()); +}; + +Window_EquipSlot.prototype.itemAt = function(index) { + return this._actor ? this._actor.equips()[index] : null; +}; + +Window_EquipSlot.prototype.drawItem = function(index) { + if (this._actor) { + const slotName = this.actorSlotName(this._actor, index); + const item = this.itemAt(index); + const slotNameWidth = this.slotNameWidth(); + const rect = this.itemLineRect(index); + const itemWidth = rect.width - slotNameWidth; + this.changeTextColor(ColorManager.systemColor()); + this.changePaintOpacity(this.isEnabled(index)); + this.drawText(slotName, rect.x, rect.y, slotNameWidth, rect.height); + this.drawItemName(item, rect.x + slotNameWidth, rect.y, itemWidth); + this.changePaintOpacity(true); + } +}; + +Window_EquipSlot.prototype.slotNameWidth = function() { + return 138; +}; + +Window_EquipSlot.prototype.isEnabled = function(index) { + return this._actor ? this._actor.isEquipChangeOk(index) : false; +}; + +Window_EquipSlot.prototype.isCurrentItemEnabled = function() { + return this.isEnabled(this.index()); +}; + +Window_EquipSlot.prototype.setStatusWindow = function(statusWindow) { + this._statusWindow = statusWindow; + this.callUpdateHelp(); +}; + +Window_EquipSlot.prototype.setItemWindow = function(itemWindow) { + this._itemWindow = itemWindow; +}; + +Window_EquipSlot.prototype.updateHelp = function() { + Window_StatusBase.prototype.updateHelp.call(this); + this.setHelpWindowItem(this.item()); + if (this._statusWindow) { + this._statusWindow.setTempActor(null); + } +}; + +//----------------------------------------------------------------------------- +// Window_EquipItem +// +// The window for selecting an equipment item on the equipment screen. + +function Window_EquipItem() { + this.initialize(...arguments); +} + +Window_EquipItem.prototype = Object.create(Window_ItemList.prototype); +Window_EquipItem.prototype.constructor = Window_EquipItem; + +Window_EquipItem.prototype.initialize = function(rect) { + Window_ItemList.prototype.initialize.call(this, rect); + this._actor = null; + this._slotId = 0; +}; + +Window_EquipItem.prototype.maxCols = function() { + return 1; +}; + +Window_EquipItem.prototype.colSpacing = function() { + return 8; +}; + +Window_EquipItem.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + this.scrollTo(0, 0); + } +}; + +Window_EquipItem.prototype.setSlotId = function(slotId) { + if (this._slotId !== slotId) { + this._slotId = slotId; + this.refresh(); + this.scrollTo(0, 0); + } +}; + +Window_EquipItem.prototype.includes = function(item) { + if (item === null) { + return true; + } + return ( + this._actor && + this._actor.canEquip(item) && + item.etypeId === this.etypeId() + ); +}; + +Window_EquipItem.prototype.etypeId = function() { + if (this._actor && this._slotId >= 0) { + return this._actor.equipSlots()[this._slotId]; + } else { + return 0; + } +}; + +Window_EquipItem.prototype.isEnabled = function(/*item*/) { + return true; +}; + +Window_EquipItem.prototype.selectLast = function() { + // +}; + +Window_EquipItem.prototype.setStatusWindow = function(statusWindow) { + this._statusWindow = statusWindow; + this.callUpdateHelp(); +}; + +Window_EquipItem.prototype.updateHelp = function() { + Window_ItemList.prototype.updateHelp.call(this); + if (this._actor && this._statusWindow && this._slotId >= 0) { + const actor = JsonEx.makeDeepCopy(this._actor); + actor.forceChangeEquip(this._slotId, this.item()); + this._statusWindow.setTempActor(actor); + } +}; + +Window_EquipItem.prototype.playOkSound = function() { + // +}; + +//----------------------------------------------------------------------------- +// Window_Status +// +// The window for displaying full status on the status screen. + +function Window_Status() { + this.initialize(...arguments); +} + +Window_Status.prototype = Object.create(Window_StatusBase.prototype); +Window_Status.prototype.constructor = Window_Status; + +Window_Status.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; + this.refresh(); + this.activate(); +}; + +Window_Status.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + } +}; + +Window_Status.prototype.refresh = function() { + Window_StatusBase.prototype.refresh.call(this); + if (this._actor) { + this.drawBlock1(); + this.drawBlock2(); + } +}; + +Window_Status.prototype.drawBlock1 = function() { + const y = this.block1Y(); + this.drawActorName(this._actor, 6, y, 168); + this.drawActorClass(this._actor, 192, y, 168); + this.drawActorNickname(this._actor, 432, y, 270); +}; + +Window_Status.prototype.block1Y = function() { + return 0; +}; + +Window_Status.prototype.drawBlock2 = function() { + const y = this.block2Y(); + this.drawActorFace(this._actor, 12, y); + this.drawBasicInfo(204, y); + this.drawExpInfo(456, y); +}; + +Window_Status.prototype.block2Y = function() { + const lineHeight = this.lineHeight(); + const min = lineHeight; + const max = this.innerHeight - lineHeight * 4; + return Math.floor((lineHeight * 1.4).clamp(min, max)); +}; + +Window_Status.prototype.drawBasicInfo = function(x, y) { + const lineHeight = this.lineHeight(); + this.drawActorLevel(this._actor, x, y + lineHeight * 0); + this.drawActorIcons(this._actor, x, y + lineHeight * 1); + this.placeBasicGauges(this._actor, x, y + lineHeight * 2); +}; + +Window_Status.prototype.drawExpInfo = function(x, y) { + const lineHeight = this.lineHeight(); + const expTotal = TextManager.expTotal.format(TextManager.exp); + const expNext = TextManager.expNext.format(TextManager.level); + this.changeTextColor(ColorManager.systemColor()); + this.drawText(expTotal, x, y + lineHeight * 0, 270); + this.drawText(expNext, x, y + lineHeight * 2, 270); + this.resetTextColor(); + this.drawText(this.expTotalValue(), x, y + lineHeight * 1, 270, "right"); + this.drawText(this.expNextValue(), x, y + lineHeight * 3, 270, "right"); +}; + +Window_Status.prototype.expTotalValue = function() { + if (this._actor.isMaxLevel()) { + return "-------"; + } else { + return this._actor.currentExp(); + } +}; + +Window_Status.prototype.expNextValue = function() { + if (this._actor.isMaxLevel()) { + return "-------"; + } else { + return this._actor.nextRequiredExp(); + } +}; + +//----------------------------------------------------------------------------- +// Window_StatusParams +// +// The window for displaying parameters on the status screen. + +function Window_StatusParams() { + this.initialize(...arguments); +} + +Window_StatusParams.prototype = Object.create(Window_StatusBase.prototype); +Window_StatusParams.prototype.constructor = Window_StatusParams; + +Window_StatusParams.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; +}; + +Window_StatusParams.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + } +}; + +Window_StatusParams.prototype.maxItems = function() { + return 6; +}; + +Window_StatusParams.prototype.itemHeight = function() { + return this.lineHeight(); +}; + +Window_StatusParams.prototype.drawItem = function(index) { + const rect = this.itemLineRect(index); + const paramId = index + 2; + const name = TextManager.param(paramId); + const value = this._actor.param(paramId); + this.changeTextColor(ColorManager.systemColor()); + this.drawText(name, rect.x, rect.y, 160); + this.resetTextColor(); + this.drawText(value, rect.x + 160, rect.y, 60, "right"); +}; + +Window_StatusParams.prototype.drawItemBackground = function(/*index*/) { + // +}; + +//----------------------------------------------------------------------------- +// Window_StatusEquip +// +// The window for displaying equipment items on the status screen. + +function Window_StatusEquip() { + this.initialize(...arguments); +} + +Window_StatusEquip.prototype = Object.create(Window_StatusBase.prototype); +Window_StatusEquip.prototype.constructor = Window_StatusEquip; + +Window_StatusEquip.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; +}; + +Window_StatusEquip.prototype.setActor = function(actor) { + if (this._actor !== actor) { + this._actor = actor; + this.refresh(); + } +}; + +Window_StatusEquip.prototype.maxItems = function() { + return this._actor ? this._actor.equipSlots().length : 0; +}; + +Window_StatusEquip.prototype.itemHeight = function() { + return this.lineHeight(); +}; + +Window_StatusEquip.prototype.drawItem = function(index) { + const rect = this.itemLineRect(index); + const equips = this._actor.equips(); + const item = equips[index]; + const slotName = this.actorSlotName(this._actor, index); + const sw = 138; + this.changeTextColor(ColorManager.systemColor()); + this.drawText(slotName, rect.x, rect.y, sw, rect.height); + this.drawItemName(item, rect.x + sw, rect.y, rect.width - sw); +}; + +Window_StatusEquip.prototype.drawItemBackground = function(/*index*/) { + // +}; + +//----------------------------------------------------------------------------- +// Window_Options +// +// The window for changing various settings on the options screen. + +function Window_Options() { + this.initialize(...arguments); +} + +Window_Options.prototype = Object.create(Window_Command.prototype); +Window_Options.prototype.constructor = Window_Options; + +Window_Options.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); +}; + +Window_Options.prototype.makeCommandList = function() { + this.addGeneralOptions(); + this.addVolumeOptions(); +}; + +Window_Options.prototype.addGeneralOptions = function() { + this.addCommand(TextManager.alwaysDash, "alwaysDash"); + this.addCommand(TextManager.commandRemember, "commandRemember"); + this.addCommand(TextManager.touchUI, "touchUI"); +}; + +Window_Options.prototype.addVolumeOptions = function() { + this.addCommand(TextManager.bgmVolume, "bgmVolume"); + this.addCommand(TextManager.bgsVolume, "bgsVolume"); + this.addCommand(TextManager.meVolume, "meVolume"); + this.addCommand(TextManager.seVolume, "seVolume"); +}; + +Window_Options.prototype.drawItem = function(index) { + const title = this.commandName(index); + const status = this.statusText(index); + const rect = this.itemLineRect(index); + const statusWidth = this.statusWidth(); + const titleWidth = rect.width - statusWidth; + this.resetTextColor(); + this.changePaintOpacity(this.isCommandEnabled(index)); + this.drawText(title, rect.x, rect.y, titleWidth, "left"); + this.drawText(status, rect.x + titleWidth, rect.y, statusWidth, "right"); +}; + +Window_Options.prototype.statusWidth = function() { + return 120; +}; + +Window_Options.prototype.statusText = function(index) { + const symbol = this.commandSymbol(index); + const value = this.getConfigValue(symbol); + if (this.isVolumeSymbol(symbol)) { + return this.volumeStatusText(value); + } else { + return this.booleanStatusText(value); + } +}; + +Window_Options.prototype.isVolumeSymbol = function(symbol) { + return symbol.includes("Volume"); +}; + +Window_Options.prototype.booleanStatusText = function(value) { + return value ? "ON" : "OFF"; +}; + +Window_Options.prototype.volumeStatusText = function(value) { + return value + "%"; +}; + +Window_Options.prototype.processOk = function() { + const index = this.index(); + const symbol = this.commandSymbol(index); + if (this.isVolumeSymbol(symbol)) { + this.changeVolume(symbol, true, true); + } else { + this.changeValue(symbol, !this.getConfigValue(symbol)); + } +}; + +Window_Options.prototype.cursorRight = function() { + const index = this.index(); + const symbol = this.commandSymbol(index); + if (this.isVolumeSymbol(symbol)) { + this.changeVolume(symbol, true, false); + } else { + this.changeValue(symbol, true); + } +}; + +Window_Options.prototype.cursorLeft = function() { + const index = this.index(); + const symbol = this.commandSymbol(index); + if (this.isVolumeSymbol(symbol)) { + this.changeVolume(symbol, false, false); + } else { + this.changeValue(symbol, false); + } +}; + +Window_Options.prototype.changeVolume = function(symbol, forward, wrap) { + const lastValue = this.getConfigValue(symbol); + const offset = this.volumeOffset(); + const value = lastValue + (forward ? offset : -offset); + if (value > 100 && wrap) { + this.changeValue(symbol, 0); + } else { + this.changeValue(symbol, value.clamp(0, 100)); + } +}; + +Window_Options.prototype.volumeOffset = function() { + return 20; +}; + +Window_Options.prototype.changeValue = function(symbol, value) { + const lastValue = this.getConfigValue(symbol); + if (lastValue !== value) { + this.setConfigValue(symbol, value); + this.redrawItem(this.findSymbol(symbol)); + this.playCursorSound(); + } +}; + +Window_Options.prototype.getConfigValue = function(symbol) { + return ConfigManager[symbol]; +}; + +Window_Options.prototype.setConfigValue = function(symbol, volume) { + ConfigManager[symbol] = volume; +}; + +//----------------------------------------------------------------------------- +// Window_SavefileList +// +// The window for selecting a save file on the save and load screens. + +function Window_SavefileList() { + this.initialize(...arguments); +} + +Window_SavefileList.prototype = Object.create(Window_Selectable.prototype); +Window_SavefileList.prototype.constructor = Window_SavefileList; + +Window_SavefileList.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this.activate(); + this._mode = null; + this._autosave = false; +}; + +Window_SavefileList.prototype.setMode = function(mode, autosave) { + this._mode = mode; + this._autosave = autosave; + this.refresh(); +}; + +Window_SavefileList.prototype.maxItems = function() { + return DataManager.maxSavefiles() - (this._autosave ? 0 : 1); +}; + +Window_SavefileList.prototype.numVisibleRows = function() { + return 5; +}; + +Window_SavefileList.prototype.itemHeight = function() { + return Math.floor(this.innerHeight / this.numVisibleRows()); +}; + +Window_SavefileList.prototype.drawItem = function(index) { + const savefileId = this.indexToSavefileId(index); + const info = DataManager.savefileInfo(savefileId); + const rect = this.itemRectWithPadding(index); + this.resetTextColor(); + this.changePaintOpacity(this.isEnabled(savefileId)); + this.drawTitle(savefileId, rect.x, rect.y + 4); + if (info) { + this.drawContents(info, rect); + } +}; + +Window_SavefileList.prototype.indexToSavefileId = function(index) { + return index + (this._autosave ? 0 : 1); +}; + +Window_SavefileList.prototype.savefileIdToIndex = function(savefileId) { + return savefileId - (this._autosave ? 0 : 1); +}; + +Window_SavefileList.prototype.isEnabled = function(savefileId) { + if (this._mode === "save") { + return savefileId > 0; + } else { + return !!DataManager.savefileInfo(savefileId); + } +}; + +Window_SavefileList.prototype.savefileId = function() { + return this.indexToSavefileId(this.index()); +}; + +Window_SavefileList.prototype.selectSavefile = function(savefileId) { + const index = Math.max(0, this.savefileIdToIndex(savefileId)); + this.select(index); + this.setTopRow(index - 2); +}; + +Window_SavefileList.prototype.drawTitle = function(savefileId, x, y) { + if (savefileId === 0) { + this.drawText(TextManager.autosave, x, y, 180); + } else { + this.drawText(TextManager.file + " " + savefileId, x, y, 180); + } +}; + +Window_SavefileList.prototype.drawContents = function(info, rect) { + const bottom = rect.y + rect.height; + if (rect.width >= 420) { + this.drawPartyCharacters(info, rect.x + 220, bottom - 8); + } + const lineHeight = this.lineHeight(); + const y2 = bottom - lineHeight - 4; + if (y2 >= lineHeight) { + this.drawPlaytime(info, rect.x, y2, rect.width); + } +}; + +Window_SavefileList.prototype.drawPartyCharacters = function(info, x, y) { + if (info.characters) { + let characterX = x; + for (const data of info.characters) { + this.drawCharacter(data[0], data[1], characterX, y); + characterX += 48; + } + } +}; + +Window_SavefileList.prototype.drawPlaytime = function(info, x, y, width) { + if (info.playtime) { + this.drawText(info.playtime, x, y, width, "right"); + } +}; + +Window_SavefileList.prototype.playOkSound = function() { + // +}; + +//----------------------------------------------------------------------------- +// Window_ShopCommand +// +// The window for selecting buy/sell on the shop screen. + +function Window_ShopCommand() { + this.initialize(...arguments); +} + +Window_ShopCommand.prototype = Object.create(Window_HorzCommand.prototype); +Window_ShopCommand.prototype.constructor = Window_ShopCommand; + +Window_ShopCommand.prototype.initialize = function(rect) { + Window_HorzCommand.prototype.initialize.call(this, rect); +}; + +Window_ShopCommand.prototype.setPurchaseOnly = function(purchaseOnly) { + this._purchaseOnly = purchaseOnly; + this.refresh(); +}; + +Window_ShopCommand.prototype.maxCols = function() { + return 3; +}; + +Window_ShopCommand.prototype.makeCommandList = function() { + this.addCommand(TextManager.buy, "buy"); + this.addCommand(TextManager.sell, "sell", !this._purchaseOnly); + this.addCommand(TextManager.cancel, "cancel"); +}; + +//----------------------------------------------------------------------------- +// Window_ShopBuy +// +// The window for selecting an item to buy on the shop screen. + +function Window_ShopBuy() { + this.initialize(...arguments); +} + +Window_ShopBuy.prototype = Object.create(Window_Selectable.prototype); +Window_ShopBuy.prototype.constructor = Window_ShopBuy; + +Window_ShopBuy.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._money = 0; +}; + +Window_ShopBuy.prototype.setupGoods = function(shopGoods) { + this._shopGoods = shopGoods; + this.refresh(); + this.select(0); +}; + +Window_ShopBuy.prototype.maxItems = function() { + return this._data ? this._data.length : 1; +}; + +Window_ShopBuy.prototype.item = function() { + return this.itemAt(this.index()); +}; + +Window_ShopBuy.prototype.itemAt = function(index) { + return this._data && index >= 0 ? this._data[index] : null; +}; + +Window_ShopBuy.prototype.setMoney = function(money) { + this._money = money; + this.refresh(); +}; + +Window_ShopBuy.prototype.isCurrentItemEnabled = function() { + return this.isEnabled(this._data[this.index()]); +}; + +Window_ShopBuy.prototype.price = function(item) { + return this._price[this._data.indexOf(item)] || 0; +}; + +Window_ShopBuy.prototype.isEnabled = function(item) { + return ( + item && this.price(item) <= this._money && !$gameParty.hasMaxItems(item) + ); +}; + +Window_ShopBuy.prototype.refresh = function() { + this.makeItemList(); + Window_Selectable.prototype.refresh.call(this); +}; + +Window_ShopBuy.prototype.makeItemList = function() { + this._data = []; + this._price = []; + for (const goods of this._shopGoods) { + const item = this.goodsToItem(goods); + if (item) { + this._data.push(item); + this._price.push(goods[2] === 0 ? item.price : goods[3]); + } + } +}; + +Window_ShopBuy.prototype.goodsToItem = function(goods) { + switch (goods[0]) { + case 0: + return $dataItems[goods[1]]; + case 1: + return $dataWeapons[goods[1]]; + case 2: + return $dataArmors[goods[1]]; + default: + return null; + } +}; + +Window_ShopBuy.prototype.drawItem = function(index) { + const item = this.itemAt(index); + const price = this.price(item); + const rect = this.itemLineRect(index); + const priceWidth = this.priceWidth(); + const priceX = rect.x + rect.width - priceWidth; + const nameWidth = rect.width - priceWidth; + this.changePaintOpacity(this.isEnabled(item)); + this.drawItemName(item, rect.x, rect.y, nameWidth); + this.drawText(price, priceX, rect.y, priceWidth, "right"); + this.changePaintOpacity(true); +}; + +Window_ShopBuy.prototype.priceWidth = function() { + return 96; +}; + +Window_ShopBuy.prototype.setStatusWindow = function(statusWindow) { + this._statusWindow = statusWindow; + this.callUpdateHelp(); +}; + +Window_ShopBuy.prototype.updateHelp = function() { + this.setHelpWindowItem(this.item()); + if (this._statusWindow) { + this._statusWindow.setItem(this.item()); + } +}; + +//----------------------------------------------------------------------------- +// Window_ShopSell +// +// The window for selecting an item to sell on the shop screen. + +function Window_ShopSell() { + this.initialize(...arguments); +} + +Window_ShopSell.prototype = Object.create(Window_ItemList.prototype); +Window_ShopSell.prototype.constructor = Window_ShopSell; + +Window_ShopSell.prototype.initialize = function(rect) { + Window_ItemList.prototype.initialize.call(this, rect); +}; + +Window_ShopSell.prototype.isEnabled = function(item) { + return item && item.price > 0; +}; + +//----------------------------------------------------------------------------- +// Window_ShopNumber +// +// The window for inputting quantity of items to buy or sell on the shop +// screen. + +function Window_ShopNumber() { + this.initialize(...arguments); +} + +Window_ShopNumber.prototype = Object.create(Window_Selectable.prototype); +Window_ShopNumber.prototype.constructor = Window_ShopNumber; + +Window_ShopNumber.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._item = null; + this._max = 1; + this._price = 0; + this._number = 1; + this._currencyUnit = TextManager.currencyUnit; + this.createButtons(); + this.select(0); + this._canRepeat = false; +}; + +Window_ShopNumber.prototype.isScrollEnabled = function() { + return false; +}; + +Window_ShopNumber.prototype.number = function() { + return this._number; +}; + +Window_ShopNumber.prototype.setup = function(item, max, price) { + this._item = item; + this._max = Math.floor(max); + this._price = price; + this._number = 1; + this.placeButtons(); + this.refresh(); +}; + +Window_ShopNumber.prototype.setCurrencyUnit = function(currencyUnit) { + this._currencyUnit = currencyUnit; + this.refresh(); +}; + +Window_ShopNumber.prototype.createButtons = function() { + this._buttons = []; + if (ConfigManager.touchUI) { + for (const type of ["down2", "down", "up", "up2", "ok"]) { + const button = new Sprite_Button(type); + this._buttons.push(button); + this.addInnerChild(button); + } + this._buttons[0].setClickHandler(this.onButtonDown2.bind(this)); + this._buttons[1].setClickHandler(this.onButtonDown.bind(this)); + this._buttons[2].setClickHandler(this.onButtonUp.bind(this)); + this._buttons[3].setClickHandler(this.onButtonUp2.bind(this)); + this._buttons[4].setClickHandler(this.onButtonOk.bind(this)); + } +}; + +Window_ShopNumber.prototype.placeButtons = function() { + const sp = this.buttonSpacing(); + const totalWidth = this.totalButtonWidth(); + let x = (this.innerWidth - totalWidth) / 2; + for (const button of this._buttons) { + button.x = x; + button.y = this.buttonY(); + x += button.width + sp; + } +}; + +Window_ShopNumber.prototype.totalButtonWidth = function() { + const sp = this.buttonSpacing(); + return this._buttons.reduce((r, button) => r + button.width + sp, -sp); +}; + +Window_ShopNumber.prototype.buttonSpacing = function() { + return 8; +}; + +Window_ShopNumber.prototype.refresh = function() { + Window_Selectable.prototype.refresh.call(this); + this.drawItemBackground(0); + this.drawCurrentItemName(); + this.drawMultiplicationSign(); + this.drawNumber(); + this.drawHorzLine(); + this.drawTotalPrice(); +}; + +Window_ShopNumber.prototype.drawCurrentItemName = function() { + const padding = this.itemPadding(); + const x = padding * 2; + const y = this.itemNameY(); + const width = this.multiplicationSignX() - padding * 3; + this.drawItemName(this._item, x, y, width); +}; + +Window_ShopNumber.prototype.drawMultiplicationSign = function() { + const sign = this.multiplicationSign(); + const width = this.textWidth(sign); + const x = this.multiplicationSignX(); + const y = this.itemNameY(); + this.resetTextColor(); + this.drawText(sign, x, y, width); +}; + +Window_ShopNumber.prototype.multiplicationSign = function() { + return "\u00d7"; +}; + +Window_ShopNumber.prototype.multiplicationSignX = function() { + const sign = this.multiplicationSign(); + const width = this.textWidth(sign); + return this.cursorX() - width * 2; +}; + +Window_ShopNumber.prototype.drawNumber = function() { + const x = this.cursorX(); + const y = this.itemNameY(); + const width = this.cursorWidth() - this.itemPadding(); + this.resetTextColor(); + this.drawText(this._number, x, y, width, "right"); +}; + +Window_ShopNumber.prototype.drawHorzLine = function() { + const padding = this.itemPadding(); + const lineHeight = this.lineHeight(); + const itemY = this.itemNameY(); + const totalY = this.totalPriceY(); + const x = padding; + const y = Math.floor((itemY + totalY + lineHeight) / 2); + const width = this.innerWidth - padding * 2; + this.drawRect(x, y, width, 5); +}; + +Window_ShopNumber.prototype.drawTotalPrice = function() { + const padding = this.itemPadding(); + const total = this._price * this._number; + const width = this.innerWidth - padding * 2; + const y = this.totalPriceY(); + this.drawCurrencyValue(total, this._currencyUnit, 0, y, width); +}; + +Window_ShopNumber.prototype.itemNameY = function() { + return Math.floor(this.innerHeight / 2 - this.lineHeight() * 1.5); +}; + +Window_ShopNumber.prototype.totalPriceY = function() { + return Math.floor(this.itemNameY() + this.lineHeight() * 2); +}; + +Window_ShopNumber.prototype.buttonY = function() { + return Math.floor(this.totalPriceY() + this.lineHeight() * 2); +}; + +Window_ShopNumber.prototype.cursorWidth = function() { + const padding = this.itemPadding(); + const digitWidth = this.textWidth("0"); + return this.maxDigits() * digitWidth + padding * 2; +}; + +Window_ShopNumber.prototype.cursorX = function() { + const padding = this.itemPadding(); + return this.innerWidth - this.cursorWidth() - padding * 2; +}; + +Window_ShopNumber.prototype.maxDigits = function() { + return 2; +}; + +Window_ShopNumber.prototype.update = function() { + Window_Selectable.prototype.update.call(this); + this.processNumberChange(); +}; + +Window_ShopNumber.prototype.playOkSound = function() { + // +}; + +Window_ShopNumber.prototype.processNumberChange = function() { + if (this.isOpenAndActive()) { + if (Input.isRepeated("right")) { + this.changeNumber(1); + } + if (Input.isRepeated("left")) { + this.changeNumber(-1); + } + if (Input.isRepeated("up")) { + this.changeNumber(10); + } + if (Input.isRepeated("down")) { + this.changeNumber(-10); + } + } +}; + +Window_ShopNumber.prototype.changeNumber = function(amount) { + const lastNumber = this._number; + this._number = (this._number + amount).clamp(1, this._max); + if (this._number !== lastNumber) { + this.playCursorSound(); + this.refresh(); + } +}; + +Window_ShopNumber.prototype.itemRect = function() { + const rect = new Rectangle(); + rect.x = this.cursorX(); + rect.y = this.itemNameY(); + rect.width = this.cursorWidth(); + rect.height = this.lineHeight(); + return rect; +}; + +Window_ShopNumber.prototype.isTouchOkEnabled = function() { + return false; +}; + +Window_ShopNumber.prototype.onButtonUp = function() { + this.changeNumber(1); +}; + +Window_ShopNumber.prototype.onButtonUp2 = function() { + this.changeNumber(10); +}; + +Window_ShopNumber.prototype.onButtonDown = function() { + this.changeNumber(-1); +}; + +Window_ShopNumber.prototype.onButtonDown2 = function() { + this.changeNumber(-10); +}; + +Window_ShopNumber.prototype.onButtonOk = function() { + this.processOk(); +}; + +//----------------------------------------------------------------------------- +// Window_ShopStatus +// +// The window for displaying number of items in possession and the actor's +// equipment on the shop screen. + +function Window_ShopStatus() { + this.initialize(...arguments); +} + +Window_ShopStatus.prototype = Object.create(Window_StatusBase.prototype); +Window_ShopStatus.prototype.constructor = Window_ShopStatus; + +Window_ShopStatus.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._item = null; + this._pageIndex = 0; + this.refresh(); +}; + +Window_ShopStatus.prototype.refresh = function() { + this.contents.clear(); + if (this._item) { + const x = this.itemPadding(); + this.drawPossession(x, 0); + if (this.isEquipItem()) { + const y = Math.floor(this.lineHeight() * 1.5); + this.drawEquipInfo(x, y); + } + } +}; + +Window_ShopStatus.prototype.setItem = function(item) { + this._item = item; + this.refresh(); +}; + +Window_ShopStatus.prototype.isEquipItem = function() { + return DataManager.isWeapon(this._item) || DataManager.isArmor(this._item); +}; + +Window_ShopStatus.prototype.drawPossession = function(x, y) { + const width = this.innerWidth - this.itemPadding() - x; + const possessionWidth = this.textWidth("0000"); + this.changeTextColor(ColorManager.systemColor()); + this.drawText(TextManager.possession, x, y, width - possessionWidth); + this.resetTextColor(); + this.drawText($gameParty.numItems(this._item), x, y, width, "right"); +}; + +Window_ShopStatus.prototype.drawEquipInfo = function(x, y) { + const members = this.statusMembers(); + for (let i = 0; i < members.length; i++) { + const actorY = y + Math.floor(this.lineHeight() * i * 2.2); + this.drawActorEquipInfo(x, actorY, members[i]); + } +}; + +Window_ShopStatus.prototype.statusMembers = function() { + const start = this._pageIndex * this.pageSize(); + const end = start + this.pageSize(); + return $gameParty.members().slice(start, end); +}; + +Window_ShopStatus.prototype.pageSize = function() { + return 4; +}; + +Window_ShopStatus.prototype.maxPages = function() { + return Math.floor( + ($gameParty.size() + this.pageSize() - 1) / this.pageSize() + ); +}; + +Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) { + const item1 = this.currentEquippedItem(actor, this._item.etypeId); + const width = this.innerWidth - x - this.itemPadding(); + const enabled = actor.canEquip(this._item); + this.changePaintOpacity(enabled); + this.resetTextColor(); + this.drawText(actor.name(), x, y, width); + if (enabled) { + this.drawActorParamChange(x, y, actor, item1); + } + this.drawItemName(item1, x, y + this.lineHeight(), width); + this.changePaintOpacity(true); +}; + +// prettier-ignore +Window_ShopStatus.prototype.drawActorParamChange = function( + x, y, actor, item1 +) { + const width = this.innerWidth - this.itemPadding() - x; + const paramId = this.paramId(); + const change = + this._item.params[paramId] - (item1 ? item1.params[paramId] : 0); + this.changeTextColor(ColorManager.paramchangeTextColor(change)); + this.drawText((change > 0 ? "+" : "") + change, x, y, width, "right"); +}; + +Window_ShopStatus.prototype.paramId = function() { + return DataManager.isWeapon(this._item) ? 2 : 3; +}; + +Window_ShopStatus.prototype.currentEquippedItem = function(actor, etypeId) { + const list = []; + const equips = actor.equips(); + const slots = actor.equipSlots(); + for (let i = 0; i < slots.length; i++) { + if (slots[i] === etypeId) { + list.push(equips[i]); + } + } + const paramId = this.paramId(); + let worstParam = Number.MAX_VALUE; + let worstItem = null; + for (const item of list) { + if (item && item.params[paramId] < worstParam) { + worstParam = item.params[paramId]; + worstItem = item; + } + } + return worstItem; +}; + +Window_ShopStatus.prototype.update = function() { + Window_StatusBase.prototype.update.call(this); + this.updatePage(); +}; + +Window_ShopStatus.prototype.updatePage = function() { + if (this.isPageChangeEnabled() && this.isPageChangeRequested()) { + this.changePage(); + } +}; + +Window_ShopStatus.prototype.isPageChangeEnabled = function() { + return this.visible && this.maxPages() >= 2; +}; + +Window_ShopStatus.prototype.isPageChangeRequested = function() { + if (Input.isTriggered("shift")) { + return true; + } + if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) { + return true; + } + return false; +}; + +Window_ShopStatus.prototype.changePage = function() { + this._pageIndex = (this._pageIndex + 1) % this.maxPages(); + this.refresh(); + this.playCursorSound(); +}; + +//----------------------------------------------------------------------------- +// Window_NameEdit +// +// The window for editing an actor's name on the name input screen. + +function Window_NameEdit() { + this.initialize(...arguments); +} + +Window_NameEdit.prototype = Object.create(Window_StatusBase.prototype); +Window_NameEdit.prototype.constructor = Window_NameEdit; + +Window_NameEdit.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this._actor = null; + this._maxLength = 0; + this._name = ""; + this._index = 0; + this._defaultName = 0; + this.deactivate(); +}; + +Window_NameEdit.prototype.setup = function(actor, maxLength) { + this._actor = actor; + this._maxLength = maxLength; + this._name = actor.name().slice(0, this._maxLength); + this._index = this._name.length; + this._defaultName = this._name; + ImageManager.loadFace(actor.faceName()); +}; + +Window_NameEdit.prototype.name = function() { + return this._name; +}; + +Window_NameEdit.prototype.restoreDefault = function() { + this._name = this._defaultName; + this._index = this._name.length; + this.refresh(); + return this._name.length > 0; +}; + +Window_NameEdit.prototype.add = function(ch) { + if (this._index < this._maxLength) { + this._name += ch; + this._index++; + this.refresh(); + return true; + } else { + return false; + } +}; + +Window_NameEdit.prototype.back = function() { + if (this._index > 0) { + this._index--; + this._name = this._name.slice(0, this._index); + this.refresh(); + return true; + } else { + return false; + } +}; + +Window_NameEdit.prototype.faceWidth = function() { + return 144; +}; + +Window_NameEdit.prototype.charWidth = function() { + const text = $gameSystem.isJapanese() ? "\uff21" : "A"; + return this.textWidth(text); +}; + +Window_NameEdit.prototype.left = function() { + const nameCenter = (this.innerWidth + this.faceWidth()) / 2; + const nameWidth = (this._maxLength + 1) * this.charWidth(); + return Math.min(nameCenter - nameWidth / 2, this.innerWidth - nameWidth); +}; + +Window_NameEdit.prototype.itemRect = function(index) { + const x = this.left() + index * this.charWidth(); + const y = 54; + const width = this.charWidth(); + const height = this.lineHeight(); + return new Rectangle(x, y, width, height); +}; + +Window_NameEdit.prototype.underlineRect = function(index) { + const rect = this.itemRect(index); + rect.x++; + rect.y += rect.height - 4; + rect.width -= 2; + rect.height = 2; + return rect; +}; + +Window_NameEdit.prototype.underlineColor = function() { + return ColorManager.normalColor(); +}; + +Window_NameEdit.prototype.drawUnderline = function(index) { + const rect = this.underlineRect(index); + const color = this.underlineColor(); + this.contents.paintOpacity = 48; + this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color); + this.contents.paintOpacity = 255; +}; + +Window_NameEdit.prototype.drawChar = function(index) { + const rect = this.itemRect(index); + this.resetTextColor(); + this.drawText(this._name[index] || "", rect.x, rect.y); +}; + +Window_NameEdit.prototype.refresh = function() { + this.contents.clear(); + this.drawActorFace(this._actor, 0, 0); + for (let i = 0; i < this._maxLength; i++) { + this.drawUnderline(i); + } + for (let j = 0; j < this._name.length; j++) { + this.drawChar(j); + } + const rect = this.itemRect(this._index); + this.setCursorRect(rect.x, rect.y, rect.width, rect.height); +}; + +//----------------------------------------------------------------------------- +// Window_NameInput +// +// The window for selecting text characters on the name input screen. + +function Window_NameInput() { + this.initialize(...arguments); +} + +Window_NameInput.prototype = Object.create(Window_Selectable.prototype); +Window_NameInput.prototype.constructor = Window_NameInput; + +// prettier-ignore +Window_NameInput.LATIN1 = + [ "A","B","C","D","E", "a","b","c","d","e", + "F","G","H","I","J", "f","g","h","i","j", + "K","L","M","N","O", "k","l","m","n","o", + "P","Q","R","S","T", "p","q","r","s","t", + "U","V","W","X","Y", "u","v","w","x","y", + "Z","[","]","^","_", "z","{","}","|","~", + "0","1","2","3","4", "!","#","$","%","&", + "5","6","7","8","9", "(",")","*","+","-", + "/","=","@","<",">", ":",";"," ","Page","OK" ]; +// prettier-ignore +Window_NameInput.LATIN2 = + [ "Á","É","Í","Ó","Ú", "á","é","í","ó","ú", + "À","È","Ì","Ò","Ù", "à","è","ì","ò","ù", + "Â","Ê","Î","Ô","Û", "â","ê","î","ô","û", + "Ä","Ë","Ï","Ö","Ü", "ä","ë","ï","ö","ü", + "Ā","Ē","Ī","Ō","Ū", "ā","ē","ī","ō","ū", + "Ã","Å","Æ","Ç","Ð", "ã","å","æ","ç","ð", + "Ñ","Õ","Ø","Š","Ŵ", "ñ","õ","ø","š","ŵ", + "Ý","Ŷ","Ÿ","Ž","Þ", "ý","ÿ","ŷ","ž","þ", + "IJ","Œ","ij","œ","ß", "«","»"," ","Page","OK" ]; +// prettier-ignore +Window_NameInput.RUSSIA = + [ "А","Б","В","Г","Д", "а","б","в","г","д", + "Е","Ё","Ж","З","И", "е","ё","ж","з","и", + "Й","К","Л","М","Н", "й","к","л","м","н", + "О","П","Р","С","Т", "о","п","р","с","т", + "У","Ф","Х","Ц","Ч", "у","ф","х","ц","ч", + "Ш","Щ","Ъ","Ы","Ь", "ш","щ","ъ","ы","ь", + "Э","Ю","Я","^","_", "э","ю","я","%","&", + "0","1","2","3","4", "(",")","*","+","-", + "5","6","7","8","9", ":",";"," ","","OK" ]; +// prettier-ignore +Window_NameInput.JAPAN1 = + [ "あ","い","う","え","お", "が","ぎ","ぐ","げ","ご", + "か","き","く","け","こ", "ざ","じ","ず","ぜ","ぞ", + "さ","し","す","せ","そ", "だ","ぢ","づ","で","ど", + "た","ち","つ","て","と", "ば","び","ぶ","べ","ぼ", + "な","に","ぬ","ね","の", "ぱ","ぴ","ぷ","ぺ","ぽ", + "は","ひ","ふ","へ","ほ", "ぁ","ぃ","ぅ","ぇ","ぉ", + "ま","み","む","め","も", "っ","ゃ","ゅ","ょ","ゎ", + "や","ゆ","よ","わ","ん", "ー","~","・","=","☆", + "ら","り","る","れ","ろ", "ゔ","を"," ","カナ","決定" ]; +// prettier-ignore +Window_NameInput.JAPAN2 = + [ "ア","イ","ウ","エ","オ", "ガ","ギ","グ","ゲ","ゴ", + "カ","キ","ク","ケ","コ", "ザ","ジ","ズ","ゼ","ゾ", + "サ","シ","ス","セ","ソ", "ダ","ヂ","ヅ","デ","ド", + "タ","チ","ツ","テ","ト", "バ","ビ","ブ","ベ","ボ", + "ナ","ニ","ヌ","ネ","ノ", "パ","ピ","プ","ペ","ポ", + "ハ","ヒ","フ","ヘ","ホ", "ァ","ィ","ゥ","ェ","ォ", + "マ","ミ","ム","メ","モ", "ッ","ャ","ュ","ョ","ヮ", + "ヤ","ユ","ヨ","ワ","ン", "ー","~","・","=","☆", + "ラ","リ","ル","レ","ロ", "ヴ","ヲ"," ","英数","決定" ]; +// prettier-ignore +Window_NameInput.JAPAN3 = + [ "A","B","C","D","E", "a","b","c","d","e", + "F","G","H","I","J", "f","g","h","i","j", + "K","L","M","N","O", "k","l","m","n","o", + "P","Q","R","S","T", "p","q","r","s","t", + "U","V","W","X","Y", "u","v","w","x","y", + "Z","[","]","^","_", "z","{","}","|","~", + "0","1","2","3","4", "!","#","$","%","&", + "5","6","7","8","9", "(",")","*","+","-", + "/","=","@","<",">", ":",";"," ","かな","決定" ]; + +Window_NameInput.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._editWindow = null; + this._page = 0; + this._index = 0; +}; + +Window_NameInput.prototype.setEditWindow = function(editWindow) { + this._editWindow = editWindow; + this.refresh(); + this.updateCursor(); + this.activate(); +}; + +Window_NameInput.prototype.table = function() { + if ($gameSystem.isJapanese()) { + return [ + Window_NameInput.JAPAN1, + Window_NameInput.JAPAN2, + Window_NameInput.JAPAN3 + ]; + } else if ($gameSystem.isRussian()) { + return [Window_NameInput.RUSSIA]; + } else { + return [Window_NameInput.LATIN1, Window_NameInput.LATIN2]; + } +}; + +Window_NameInput.prototype.maxCols = function() { + return 10; +}; + +Window_NameInput.prototype.maxItems = function() { + return 90; +}; + +Window_NameInput.prototype.itemWidth = function() { + return Math.floor((this.innerWidth - this.groupSpacing()) / 10); +}; + +Window_NameInput.prototype.groupSpacing = function() { + return 24; +}; + +Window_NameInput.prototype.character = function() { + return this._index < 88 ? this.table()[this._page][this._index] : ""; +}; + +Window_NameInput.prototype.isPageChange = function() { + return this._index === 88; +}; + +Window_NameInput.prototype.isOk = function() { + return this._index === 89; +}; + +Window_NameInput.prototype.itemRect = function(index) { + const itemWidth = this.itemWidth(); + const itemHeight = this.itemHeight(); + const colSpacing = this.colSpacing(); + const rowSpacing = this.rowSpacing(); + const groupSpacing = this.groupSpacing(); + const col = index % 10; + const group = Math.floor(col / 5); + const x = col * itemWidth + group * groupSpacing + colSpacing / 2; + const y = Math.floor(index / 10) * itemHeight + rowSpacing / 2; + const width = itemWidth - colSpacing; + const height = itemHeight - rowSpacing; + return new Rectangle(x, y, width, height); +}; + +Window_NameInput.prototype.drawItem = function(index) { + const table = this.table(); + const character = table[this._page][index]; + const rect = this.itemLineRect(index); + this.drawText(character, rect.x, rect.y, rect.width, "center"); +}; + +Window_NameInput.prototype.updateCursor = function() { + const rect = this.itemRect(this._index); + this.setCursorRect(rect.x, rect.y, rect.width, rect.height); +}; + +Window_NameInput.prototype.isCursorMovable = function() { + return this.active; +}; + +Window_NameInput.prototype.cursorDown = function(wrap) { + if (this._index < 80 || wrap) { + this._index = (this._index + 10) % 90; + } +}; + +Window_NameInput.prototype.cursorUp = function(wrap) { + if (this._index >= 10 || wrap) { + this._index = (this._index + 80) % 90; + } +}; + +Window_NameInput.prototype.cursorRight = function(wrap) { + if (this._index % 10 < 9) { + this._index++; + } else if (wrap) { + this._index -= 9; + } +}; + +Window_NameInput.prototype.cursorLeft = function(wrap) { + if (this._index % 10 > 0) { + this._index--; + } else if (wrap) { + this._index += 9; + } +}; + +Window_NameInput.prototype.cursorPagedown = function() { + this._page = (this._page + 1) % this.table().length; + this.refresh(); +}; + +Window_NameInput.prototype.cursorPageup = function() { + this._page = (this._page + this.table().length - 1) % this.table().length; + this.refresh(); +}; + +Window_NameInput.prototype.processCursorMove = function() { + const lastPage = this._page; + Window_Selectable.prototype.processCursorMove.call(this); + this.updateCursor(); + if (this._page !== lastPage) { + this.playCursorSound(); + } +}; + +Window_NameInput.prototype.processHandling = function() { + if (this.isOpen() && this.active) { + if (Input.isTriggered("shift")) { + this.processJump(); + } + if (Input.isRepeated("cancel")) { + this.processBack(); + } + if (Input.isRepeated("ok")) { + this.processOk(); + } + } +}; + +Window_NameInput.prototype.isCancelEnabled = function() { + return true; +}; + +Window_NameInput.prototype.processCancel = function() { + this.processBack(); +}; + +Window_NameInput.prototype.processJump = function() { + if (this._index !== 89) { + this._index = 89; + this.playCursorSound(); + } +}; + +Window_NameInput.prototype.processBack = function() { + if (this._editWindow.back()) { + SoundManager.playCancel(); + } +}; + +Window_NameInput.prototype.processOk = function() { + if (this.character()) { + this.onNameAdd(); + } else if (this.isPageChange()) { + this.playOkSound(); + this.cursorPagedown(); + } else if (this.isOk()) { + this.onNameOk(); + } +}; + +Window_NameInput.prototype.onNameAdd = function() { + if (this._editWindow.add(this.character())) { + this.playOkSound(); + } else { + this.playBuzzerSound(); + } +}; + +Window_NameInput.prototype.onNameOk = function() { + if (this._editWindow.name() === "") { + if (this._editWindow.restoreDefault()) { + this.playOkSound(); + } else { + this.playBuzzerSound(); + } + } else { + this.playOkSound(); + this.callOkHandler(); + } +}; + +//----------------------------------------------------------------------------- +// Window_NameBox +// +// The window for displaying a speaker name above the message window. + +function Window_NameBox() { + this.initialize(...arguments); +} + +Window_NameBox.prototype = Object.create(Window_Base.prototype); +Window_NameBox.prototype.constructor = Window_NameBox; + +Window_NameBox.prototype.initialize = function() { + Window_Base.prototype.initialize.call(this, new Rectangle()); + this.openness = 0; + this._name = ""; +}; + +Window_NameBox.prototype.setMessageWindow = function(messageWindow) { + this._messageWindow = messageWindow; +}; + +Window_NameBox.prototype.setName = function(name) { + if (this._name !== name) { + this._name = name; + this.refresh(); + } +}; + +Window_NameBox.prototype.clear = function() { + this.setName(""); +}; + +Window_NameBox.prototype.start = function() { + this.updatePlacement(); + this.updateBackground(); + this.createContents(); + this.refresh(); +}; + +Window_NameBox.prototype.updatePlacement = function() { + this.width = this.windowWidth(); + this.height = this.windowHeight(); + const messageWindow = this._messageWindow; + if ($gameMessage.isRTL()) { + this.x = messageWindow.x + messageWindow.width - this.width; + } else { + this.x = messageWindow.x; + } + if (messageWindow.y > 0) { + this.y = messageWindow.y - this.height; + } else { + this.y = messageWindow.y + messageWindow.height; + } +}; + +Window_NameBox.prototype.updateBackground = function() { + this.setBackgroundType($gameMessage.background()); +}; + +Window_NameBox.prototype.windowWidth = function() { + if (this._name) { + const textWidth = this.textSizeEx(this._name).width; + const padding = this.padding + this.itemPadding(); + const width = Math.ceil(textWidth) + padding * 2; + return Math.min(width, Graphics.boxWidth); + } else { + return 0; + } +}; + +Window_NameBox.prototype.windowHeight = function() { + return this.fittingHeight(1); +}; + +Window_NameBox.prototype.refresh = function() { + const rect = this.baseTextRect(); + this.contents.clear(); + this.drawTextEx(this._name, rect.x, rect.y, rect.width); +}; + +//----------------------------------------------------------------------------- +// Window_ChoiceList +// +// The window used for the event command [Show Choices]. + +function Window_ChoiceList() { + this.initialize(...arguments); +} + +Window_ChoiceList.prototype = Object.create(Window_Command.prototype); +Window_ChoiceList.prototype.constructor = Window_ChoiceList; + +Window_ChoiceList.prototype.initialize = function() { + Window_Command.prototype.initialize.call(this, new Rectangle()); + this.createCancelButton(); + this.openness = 0; + this.deactivate(); + this._background = 0; + this._canRepeat = false; +}; + +Window_ChoiceList.prototype.setMessageWindow = function(messageWindow) { + this._messageWindow = messageWindow; +}; + +Window_ChoiceList.prototype.createCancelButton = function() { + if (ConfigManager.touchUI) { + this._cancelButton = new Sprite_Button("cancel"); + this._cancelButton.visible = false; + this.addChild(this._cancelButton); + } +}; + +Window_ChoiceList.prototype.start = function() { + this.updatePlacement(); + this.updateBackground(); + this.placeCancelButton(); + this.createContents(); + this.refresh(); + this.scrollTo(0, 0); + this.selectDefault(); + this.open(); + this.activate(); +}; + +Window_ChoiceList.prototype.update = function() { + Window_Selectable.prototype.update.call(this); + this.updateCancelButton(); +}; + +Window_ChoiceList.prototype.updateCancelButton = function() { + if (this._cancelButton) { + this._cancelButton.visible = this.needsCancelButton() && this.isOpen(); + } +}; + +Window_ChoiceList.prototype.selectDefault = function() { + this.select($gameMessage.choiceDefaultType()); +}; + +Window_ChoiceList.prototype.updatePlacement = function() { + this.x = this.windowX(); + this.y = this.windowY(); + this.width = this.windowWidth(); + this.height = this.windowHeight(); +}; + +Window_ChoiceList.prototype.updateBackground = function() { + this._background = $gameMessage.choiceBackground(); + this.setBackgroundType(this._background); +}; + +Window_ChoiceList.prototype.placeCancelButton = function() { + if (this._cancelButton) { + const spacing = 8; + const button = this._cancelButton; + const right = this.x + this.width; + if (right < Graphics.boxWidth - button.width + spacing) { + button.x = this.width + spacing; + } else { + button.x = -button.width - spacing; + } + button.y = this.height / 2 - button.height / 2; + } +}; + +Window_ChoiceList.prototype.windowX = function() { + const positionType = $gameMessage.choicePositionType(); + if (positionType === 1) { + return (Graphics.boxWidth - this.windowWidth()) / 2; + } else if (positionType === 2) { + return Graphics.boxWidth - this.windowWidth(); + } else { + return 0; + } +}; + +Window_ChoiceList.prototype.windowY = function() { + const messageY = this._messageWindow.y; + if (messageY >= Graphics.boxHeight / 2) { + return messageY - this.windowHeight(); + } else { + return messageY + this._messageWindow.height; + } +}; + +Window_ChoiceList.prototype.windowWidth = function() { + const width = this.maxChoiceWidth() + this.colSpacing() + this.padding * 2; + return Math.min(width, Graphics.boxWidth); +}; + +Window_ChoiceList.prototype.windowHeight = function() { + return this.fittingHeight(this.numVisibleRows()); +}; + +Window_ChoiceList.prototype.numVisibleRows = function() { + const choices = $gameMessage.choices(); + return Math.min(choices.length, this.maxLines()); +}; + +Window_ChoiceList.prototype.maxLines = function() { + const messageWindow = this._messageWindow; + const messageY = messageWindow ? messageWindow.y : 0; + const messageHeight = messageWindow ? messageWindow.height : 0; + const centerY = Graphics.boxHeight / 2; + if (messageY < centerY && messageY + messageHeight > centerY) { + return 4; + } else { + return 8; + } +}; + +Window_ChoiceList.prototype.maxChoiceWidth = function() { + let maxWidth = 96; + const choices = $gameMessage.choices(); + for (const choice of choices) { + const textWidth = this.textSizeEx(choice).width; + const choiceWidth = Math.ceil(textWidth) + this.itemPadding() * 2; + if (maxWidth < choiceWidth) { + maxWidth = choiceWidth; + } + } + return maxWidth; +}; + +Window_ChoiceList.prototype.makeCommandList = function() { + const choices = $gameMessage.choices(); + for (const choice of choices) { + this.addCommand(choice, "choice"); + } +}; + +Window_ChoiceList.prototype.drawItem = function(index) { + const rect = this.itemLineRect(index); + this.drawTextEx(this.commandName(index), rect.x, rect.y, rect.width); +}; + +Window_ChoiceList.prototype.isCancelEnabled = function() { + return $gameMessage.choiceCancelType() !== -1; +}; + +Window_ChoiceList.prototype.needsCancelButton = function() { + return $gameMessage.choiceCancelType() === -2; +}; + +Window_ChoiceList.prototype.callOkHandler = function() { + $gameMessage.onChoice(this.index()); + this._messageWindow.terminateMessage(); + this.close(); +}; + +Window_ChoiceList.prototype.callCancelHandler = function() { + $gameMessage.onChoice($gameMessage.choiceCancelType()); + this._messageWindow.terminateMessage(); + this.close(); +}; + +//----------------------------------------------------------------------------- +// Window_NumberInput +// +// The window used for the event command [Input Number]. + +function Window_NumberInput() { + this.initialize(...arguments); +} + +Window_NumberInput.prototype = Object.create(Window_Selectable.prototype); +Window_NumberInput.prototype.constructor = Window_NumberInput; + +Window_NumberInput.prototype.initialize = function() { + Window_Selectable.prototype.initialize.call(this, new Rectangle()); + this._number = 0; + this._maxDigits = 1; + this.openness = 0; + this.createButtons(); + this.deactivate(); + this._canRepeat = false; +}; + +Window_NumberInput.prototype.setMessageWindow = function(messageWindow) { + this._messageWindow = messageWindow; +}; + +Window_NumberInput.prototype.start = function() { + this._maxDigits = $gameMessage.numInputMaxDigits(); + this._number = $gameVariables.value($gameMessage.numInputVariableId()); + this._number = this._number.clamp(0, Math.pow(10, this._maxDigits) - 1); + this.updatePlacement(); + this.placeButtons(); + this.createContents(); + this.refresh(); + this.open(); + this.activate(); + this.select(0); +}; + +Window_NumberInput.prototype.updatePlacement = function() { + const messageY = this._messageWindow.y; + const spacing = 8; + this.width = this.windowWidth(); + this.height = this.windowHeight(); + this.x = (Graphics.boxWidth - this.width) / 2; + if (messageY >= Graphics.boxHeight / 2) { + this.y = messageY - this.height - spacing; + } else { + this.y = messageY + this._messageWindow.height + spacing; + } +}; + +Window_NumberInput.prototype.windowWidth = function() { + const totalItemWidth = this.maxCols() * this.itemWidth(); + const totalButtonWidth = this.totalButtonWidth(); + return Math.max(totalItemWidth, totalButtonWidth) + this.padding * 2; +}; + +Window_NumberInput.prototype.windowHeight = function() { + if (ConfigManager.touchUI) { + return this.fittingHeight(1) + this.buttonSpacing() + 48; + } else { + return this.fittingHeight(1); + } +}; + +Window_NumberInput.prototype.maxCols = function() { + return this._maxDigits; +}; + +Window_NumberInput.prototype.maxItems = function() { + return this._maxDigits; +}; + +Window_NumberInput.prototype.itemWidth = function() { + return 48; +}; + +Window_NumberInput.prototype.itemRect = function(index) { + const rect = Window_Selectable.prototype.itemRect.call(this, index); + const innerMargin = this.innerWidth - this.maxCols() * this.itemWidth(); + rect.x += innerMargin / 2; + return rect; +}; + +Window_NumberInput.prototype.isScrollEnabled = function() { + return false; +}; + +Window_NumberInput.prototype.isHoverEnabled = function() { + return false; +}; + +Window_NumberInput.prototype.createButtons = function() { + this._buttons = []; + if (ConfigManager.touchUI) { + for (const type of ["down", "up", "ok"]) { + const button = new Sprite_Button(type); + this._buttons.push(button); + this.addInnerChild(button); + } + this._buttons[0].setClickHandler(this.onButtonDown.bind(this)); + this._buttons[1].setClickHandler(this.onButtonUp.bind(this)); + this._buttons[2].setClickHandler(this.onButtonOk.bind(this)); + } +}; + +Window_NumberInput.prototype.placeButtons = function() { + const sp = this.buttonSpacing(); + const totalWidth = this.totalButtonWidth(); + let x = (this.innerWidth - totalWidth) / 2; + for (const button of this._buttons) { + button.x = x; + button.y = this.buttonY(); + x += button.width + sp; + } +}; + +Window_NumberInput.prototype.totalButtonWidth = function() { + const sp = this.buttonSpacing(); + return this._buttons.reduce((r, button) => r + button.width + sp, -sp); +}; + +Window_NumberInput.prototype.buttonSpacing = function() { + return 8; +}; + +Window_NumberInput.prototype.buttonY = function() { + return this.itemHeight() + this.buttonSpacing(); +}; + +Window_NumberInput.prototype.update = function() { + Window_Selectable.prototype.update.call(this); + this.processDigitChange(); +}; + +Window_NumberInput.prototype.processDigitChange = function() { + if (this.isOpenAndActive()) { + if (Input.isRepeated("up")) { + this.changeDigit(true); + } else if (Input.isRepeated("down")) { + this.changeDigit(false); + } + } +}; + +Window_NumberInput.prototype.changeDigit = function(up) { + const index = this.index(); + const place = Math.pow(10, this._maxDigits - 1 - index); + let n = Math.floor(this._number / place) % 10; + this._number -= n * place; + if (up) { + n = (n + 1) % 10; + } else { + n = (n + 9) % 10; + } + this._number += n * place; + this.refresh(); + this.playCursorSound(); +}; + +Window_NumberInput.prototype.isTouchOkEnabled = function() { + return false; +}; + +Window_NumberInput.prototype.isOkEnabled = function() { + return true; +}; + +Window_NumberInput.prototype.isCancelEnabled = function() { + return false; +}; + +Window_NumberInput.prototype.processOk = function() { + this.playOkSound(); + $gameVariables.setValue($gameMessage.numInputVariableId(), this._number); + this._messageWindow.terminateMessage(); + this.updateInputData(); + this.deactivate(); + this.close(); +}; + +Window_NumberInput.prototype.drawItem = function(index) { + const rect = this.itemLineRect(index); + const align = "center"; + const s = this._number.padZero(this._maxDigits); + const c = s.slice(index, index + 1); + this.resetTextColor(); + this.drawText(c, rect.x, rect.y, rect.width, align); +}; + +Window_NumberInput.prototype.onButtonUp = function() { + this.changeDigit(true); +}; + +Window_NumberInput.prototype.onButtonDown = function() { + this.changeDigit(false); +}; + +Window_NumberInput.prototype.onButtonOk = function() { + this.processOk(); +}; + +//----------------------------------------------------------------------------- +// Window_EventItem +// +// The window used for the event command [Select Item]. + +function Window_EventItem() { + this.initialize(...arguments); +} + +Window_EventItem.prototype = Object.create(Window_ItemList.prototype); +Window_EventItem.prototype.constructor = Window_EventItem; + +Window_EventItem.prototype.initialize = function(rect) { + Window_ItemList.prototype.initialize.call(this, rect); + this.createCancelButton(); + this.openness = 0; + this.deactivate(); + this.setHandler("ok", this.onOk.bind(this)); + this.setHandler("cancel", this.onCancel.bind(this)); + this._canRepeat = false; +}; + +Window_EventItem.prototype.setMessageWindow = function(messageWindow) { + this._messageWindow = messageWindow; +}; + +Window_EventItem.prototype.createCancelButton = function() { + if (ConfigManager.touchUI) { + this._cancelButton = new Sprite_Button("cancel"); + this._cancelButton.visible = false; + this.addChild(this._cancelButton); + } +}; + +Window_EventItem.prototype.start = function() { + this.refresh(); + this.updatePlacement(); + this.placeCancelButton(); + this.forceSelect(0); + this.open(); + this.activate(); +}; + +Window_EventItem.prototype.update = function() { + Window_Selectable.prototype.update.call(this); + this.updateCancelButton(); +}; + +Window_EventItem.prototype.updateCancelButton = function() { + if (this._cancelButton) { + this._cancelButton.visible = this.isOpen(); + } +}; + +Window_EventItem.prototype.updatePlacement = function() { + if (this._messageWindow.y >= Graphics.boxHeight / 2) { + this.y = 0; + } else { + this.y = Graphics.boxHeight - this.height; + } +}; + +Window_EventItem.prototype.placeCancelButton = function() { + if (this._cancelButton) { + const spacing = 8; + const button = this._cancelButton; + if (this.y === 0) { + button.y = this.height + spacing; + } else if (this._messageWindow.y >= Graphics.boxHeight / 4) { + const distance = this.y - this._messageWindow.y; + button.y = -button.height - spacing - distance; + } else { + button.y = -button.height - spacing; + } + button.x = this.width - button.width - spacing; + } +}; + +Window_EventItem.prototype.includes = function(item) { + const itypeId = $gameMessage.itemChoiceItypeId(); + return DataManager.isItem(item) && item.itypeId === itypeId; +}; + +Window_EventItem.prototype.needsNumber = function() { + const itypeId = $gameMessage.itemChoiceItypeId(); + if (itypeId === 2) { + // Key Item + return $dataSystem.optKeyItemsNumber; + } else if (itypeId >= 3) { + // Hidden Item + return false; + } else { + // Normal Item + return true; + } +}; + +Window_EventItem.prototype.isEnabled = function(/*item*/) { + return true; +}; + +Window_EventItem.prototype.onOk = function() { + const item = this.item(); + const itemId = item ? item.id : 0; + $gameVariables.setValue($gameMessage.itemChoiceVariableId(), itemId); + this._messageWindow.terminateMessage(); + this.close(); +}; + +Window_EventItem.prototype.onCancel = function() { + $gameVariables.setValue($gameMessage.itemChoiceVariableId(), 0); + this._messageWindow.terminateMessage(); + this.close(); +}; + +//----------------------------------------------------------------------------- +// Window_Message +// +// The window for displaying text messages. + +function Window_Message() { + this.initialize(...arguments); +} + +Window_Message.prototype = Object.create(Window_Base.prototype); +Window_Message.prototype.constructor = Window_Message; + +Window_Message.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, rect); + this.openness = 0; + this.initMembers(); +}; + +Window_Message.prototype.initMembers = function() { + this._background = 0; + this._positionType = 2; + this._waitCount = 0; + this._faceBitmap = null; + this._textState = null; + this._goldWindow = null; + this._nameBoxWindow = null; + this._choiceListWindow = null; + this._numberInputWindow = null; + this._eventItemWindow = null; + this.clearFlags(); +}; + +Window_Message.prototype.setGoldWindow = function(goldWindow) { + this._goldWindow = goldWindow; +}; + +Window_Message.prototype.setNameBoxWindow = function(nameBoxWindow) { + this._nameBoxWindow = nameBoxWindow; +}; + +Window_Message.prototype.setChoiceListWindow = function(choiceListWindow) { + this._choiceListWindow = choiceListWindow; +}; + +Window_Message.prototype.setNumberInputWindow = function(numberInputWindow) { + this._numberInputWindow = numberInputWindow; +}; + +Window_Message.prototype.setEventItemWindow = function(eventItemWindow) { + this._eventItemWindow = eventItemWindow; +}; + +Window_Message.prototype.clearFlags = function() { + this._showFast = false; + this._lineShowFast = false; + this._pauseSkip = false; +}; + +Window_Message.prototype.update = function() { + this.checkToNotClose(); + Window_Base.prototype.update.call(this); + this.synchronizeNameBox(); + while (!this.isOpening() && !this.isClosing()) { + if (this.updateWait()) { + return; + } else if (this.updateLoading()) { + return; + } else if (this.updateInput()) { + return; + } else if (this.updateMessage()) { + return; + } else if (this.canStart()) { + this.startMessage(); + } else { + this.startInput(); + return; + } + } +}; + +Window_Message.prototype.checkToNotClose = function() { + if (this.isOpen() && this.isClosing() && this.doesContinue()) { + this.open(); + } +}; + +Window_Message.prototype.synchronizeNameBox = function() { + this._nameBoxWindow.openness = this.openness; +}; + +Window_Message.prototype.canStart = function() { + return $gameMessage.hasText() && !$gameMessage.scrollMode(); +}; + +Window_Message.prototype.startMessage = function() { + const text = $gameMessage.allText(); + const textState = this.createTextState(text, 0, 0, 0); + textState.x = this.newLineX(textState); + textState.startX = textState.x; + this._textState = textState; + this.newPage(this._textState); + this.updatePlacement(); + this.updateBackground(); + this.open(); + this._nameBoxWindow.start(); +}; + +Window_Message.prototype.newLineX = function(textState) { + const faceExists = $gameMessage.faceName() !== ""; + const faceWidth = ImageManager.faceWidth; + const spacing = 20; + const margin = faceExists ? faceWidth + spacing : 4; + return textState.rtl ? this.innerWidth - margin : margin; +}; + +Window_Message.prototype.updatePlacement = function() { + const goldWindow = this._goldWindow; + this._positionType = $gameMessage.positionType(); + this.y = (this._positionType * (Graphics.boxHeight - this.height)) / 2; + if (goldWindow) { + goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - goldWindow.height; + } +}; + +Window_Message.prototype.updateBackground = function() { + this._background = $gameMessage.background(); + this.setBackgroundType(this._background); +}; + +Window_Message.prototype.terminateMessage = function() { + this.close(); + this._goldWindow.close(); + $gameMessage.clear(); +}; + +Window_Message.prototype.updateWait = function() { + if (this._waitCount > 0) { + this._waitCount--; + return true; + } else { + return false; + } +}; + +Window_Message.prototype.cancelWait = function() { + if ($gameSystem.isMessageSkipEnabled()) { + this._waitCount = 0; + } +}; + +Window_Message.prototype.updateLoading = function() { + if (this._faceBitmap) { + if (this._faceBitmap.isReady()) { + this.drawMessageFace(); + this._faceBitmap = null; + return false; + } else { + return true; + } + } else { + return false; + } +}; + +Window_Message.prototype.updateInput = function() { + if (this.isAnySubWindowActive()) { + return true; + } + if (this.pause) { + if (this.isTriggered()) { + Input.update(); + this.pause = false; + if (!this._textState) { + this.terminateMessage(); + } + } + return true; + } + return false; +}; + +Window_Message.prototype.isAnySubWindowActive = function() { + return ( + this._choiceListWindow.active || + this._numberInputWindow.active || + this._eventItemWindow.active + ); +}; + +Window_Message.prototype.updateMessage = function() { + const textState = this._textState; + if (textState) { + while (!this.isEndOfText(textState)) { + if (this.needsNewPage(textState)) { + this.newPage(textState); + } + this.updateShowFast(); + this.processCharacter(textState); + if (this.shouldBreakHere(textState)) { + break; + } + } + this.flushTextState(textState); + if (this.isEndOfText(textState) && !this.isWaiting()) { + this.onEndOfText(); + } + return true; + } else { + return false; + } +}; + +Window_Message.prototype.shouldBreakHere = function(textState) { + if (this.canBreakHere(textState)) { + if (!this._showFast && !this._lineShowFast) { + return true; + } + if (this.isWaiting()) { + return true; + } + } + return false; +}; + +Window_Message.prototype.canBreakHere = function(textState) { + if (!this.isEndOfText(textState)) { + const c = textState.text[textState.index]; + if (c.charCodeAt(0) >= 0xdc00 && c.charCodeAt(0) <= 0xdfff) { + // surrogate pair + return false; + } + if (textState.rtl && c.charCodeAt(0) > 0x20) { + return false; + } + } + return true; +}; + +Window_Message.prototype.onEndOfText = function() { + if (!this.startInput()) { + if (!this._pauseSkip) { + this.startPause(); + } else { + this.terminateMessage(); + } + } + this._textState = null; +}; + +Window_Message.prototype.startInput = function() { + if ($gameMessage.isChoice()) { + this._choiceListWindow.start(); + return true; + } else if ($gameMessage.isNumberInput()) { + this._numberInputWindow.start(); + return true; + } else if ($gameMessage.isItemChoice()) { + this._eventItemWindow.start(); + return true; + } else { + return false; + } +}; + +Window_Message.prototype.isTriggered = function() { + return ( + Input.isRepeated("ok") || + Input.isRepeated("cancel") || + TouchInput.isRepeated() + ); +}; + +Window_Message.prototype.doesContinue = function() { + return ( + $gameMessage.hasText() && + !$gameMessage.scrollMode() && + !this.areSettingsChanged() + ); +}; + +Window_Message.prototype.areSettingsChanged = function() { + return ( + this._background !== $gameMessage.background() || + this._positionType !== $gameMessage.positionType() + ); +}; + +Window_Message.prototype.updateShowFast = function() { + if (this.isTriggered()) { + this._showFast = true; + } +}; + +Window_Message.prototype.newPage = function(textState) { + this.contents.clear(); + this.resetFontSettings(); + this.clearFlags(); + this.updateSpeakerName(); + this.loadMessageFace(); + textState.x = textState.startX; + textState.y = 0; + textState.height = this.calcTextHeight(textState); +}; + +Window_Message.prototype.updateSpeakerName = function() { + this._nameBoxWindow.setName($gameMessage.speakerName()); +}; + +Window_Message.prototype.loadMessageFace = function() { + this._faceBitmap = ImageManager.loadFace($gameMessage.faceName()); +}; + +Window_Message.prototype.drawMessageFace = function() { + const faceName = $gameMessage.faceName(); + const faceIndex = $gameMessage.faceIndex(); + const rtl = $gameMessage.isRTL(); + const width = ImageManager.faceWidth; + const height = this.innerHeight; + const x = rtl ? this.innerWidth - width - 4 : 4; + this.drawFace(faceName, faceIndex, x, 0, width, height); +}; + +Window_Message.prototype.processControlCharacter = function(textState, c) { + Window_Base.prototype.processControlCharacter.call(this, textState, c); + if (c === "\f") { + this.processNewPage(textState); + } +}; + +Window_Message.prototype.processNewLine = function(textState) { + this._lineShowFast = false; + Window_Base.prototype.processNewLine.call(this, textState); + if (this.needsNewPage(textState)) { + this.startPause(); + } +}; + +Window_Message.prototype.processNewPage = function(textState) { + if (textState.text[textState.index] === "\n") { + textState.index++; + } + textState.y = this.contents.height; + this.startPause(); +}; + +Window_Message.prototype.isEndOfText = function(textState) { + return textState.index >= textState.text.length; +}; + +Window_Message.prototype.needsNewPage = function(textState) { + return ( + !this.isEndOfText(textState) && + textState.y + textState.height > this.contents.height + ); +}; + +Window_Message.prototype.processEscapeCharacter = function(code, textState) { + switch (code) { + case "$": + this._goldWindow.open(); + break; + case ".": + this.startWait(15); + break; + case "|": + this.startWait(60); + break; + case "!": + this.startPause(); + break; + case ">": + this._lineShowFast = true; + break; + case "<": + this._lineShowFast = false; + break; + case "^": + this._pauseSkip = true; + break; + default: + Window_Base.prototype.processEscapeCharacter.call( + this, + code, + textState + ); + break; + } +}; + +Window_Message.prototype.startWait = function(count) { + this._waitCount = count; +}; + +Window_Message.prototype.startPause = function() { + this.startWait(10); + this.pause = true; +}; + +Window_Message.prototype.isWaiting = function() { + return this.pause || this._waitCount > 0; +}; + +//----------------------------------------------------------------------------- +// Window_ScrollText +// +// The window for displaying scrolling text. No frame is displayed, but it +// is handled as a window for convenience. + +function Window_ScrollText() { + this.initialize(...arguments); +} + +Window_ScrollText.prototype = Object.create(Window_Base.prototype); +Window_ScrollText.prototype.constructor = Window_ScrollText; + +Window_ScrollText.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, new Rectangle()); + this.opacity = 0; + this.hide(); + this._reservedRect = rect; + this._text = ""; + this._maxBitmapHeight = 2048; + this._allTextHeight = 0; + this._blockHeight = 0; + this._blockIndex = 0; + this._scrollY = 0; +}; + +Window_ScrollText.prototype.update = function() { + Window_Base.prototype.update.call(this); + if ($gameMessage.scrollMode()) { + if (this._text) { + this.updateMessage(); + } + if (!this._text && $gameMessage.hasText()) { + this.startMessage(); + } + } +}; + +Window_ScrollText.prototype.startMessage = function() { + this._text = $gameMessage.allText(); + if (this._text) { + this.updatePlacement(); + this._allTextHeight = this.textSizeEx(this._text).height; + this._blockHeight = this._maxBitmapHeight - this.height; + this._blockIndex = 0; + this.origin.y = this._scrollY = -this.height; + this.createContents(); + this.refresh(); + this.show(); + } else { + $gameMessage.clear(); + } +}; + +Window_ScrollText.prototype.refresh = function() { + const rect = this.baseTextRect(); + const y = rect.y - this._scrollY + (this._scrollY % this._blockHeight); + this.contents.clear(); + this.drawTextEx(this._text, rect.x, y, rect.width); +}; + +Window_ScrollText.prototype.updatePlacement = function() { + const rect = this._reservedRect; + this.move(rect.x, rect.y, rect.width, rect.height); +}; + +Window_ScrollText.prototype.contentsHeight = function() { + if (this._allTextHeight > 0) { + return Math.min(this._allTextHeight, this._maxBitmapHeight); + } else { + return 0; + } +}; + +Window_ScrollText.prototype.updateMessage = function() { + this._scrollY += this.scrollSpeed(); + if (this._scrollY >= this._allTextHeight) { + this.terminateMessage(); + } else { + const blockIndex = Math.floor(this._scrollY / this._blockHeight); + if (blockIndex > this._blockIndex) { + this._blockIndex = blockIndex; + this.refresh(); + } + this.origin.y = this._scrollY % this._blockHeight; + } +}; + +Window_ScrollText.prototype.scrollSpeed = function() { + let speed = $gameMessage.scrollSpeed() / 2; + if (this.isFastForward()) { + speed *= this.fastForwardRate(); + } + return speed; +}; + +Window_ScrollText.prototype.isFastForward = function() { + if ($gameMessage.scrollNoFast()) { + return false; + } else { + return ( + Input.isPressed("ok") || + Input.isPressed("shift") || + TouchInput.isPressed() + ); + } +}; + +Window_ScrollText.prototype.fastForwardRate = function() { + return 3; +}; + +Window_ScrollText.prototype.terminateMessage = function() { + this._text = null; + $gameMessage.clear(); + this.hide(); +}; + +//----------------------------------------------------------------------------- +// Window_MapName +// +// The window for displaying the map name on the map screen. + +function Window_MapName() { + this.initialize(...arguments); +} + +Window_MapName.prototype = Object.create(Window_Base.prototype); +Window_MapName.prototype.constructor = Window_MapName; + +Window_MapName.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, rect); + this.opacity = 0; + this.contentsOpacity = 0; + this._showCount = 0; + this.refresh(); +}; + +Window_MapName.prototype.update = function() { + Window_Base.prototype.update.call(this); + if (this._showCount > 0 && $gameMap.isNameDisplayEnabled()) { + this.updateFadeIn(); + this._showCount--; + } else { + this.updateFadeOut(); + } +}; + +Window_MapName.prototype.updateFadeIn = function() { + this.contentsOpacity += 16; +}; + +Window_MapName.prototype.updateFadeOut = function() { + this.contentsOpacity -= 16; +}; + +Window_MapName.prototype.open = function() { + this.refresh(); + this._showCount = 150; +}; + +Window_MapName.prototype.close = function() { + this._showCount = 0; +}; + +Window_MapName.prototype.refresh = function() { + this.contents.clear(); + if ($gameMap.displayName()) { + const width = this.innerWidth; + this.drawBackground(0, 0, width, this.lineHeight()); + this.drawText($gameMap.displayName(), 0, 0, width, "center"); + } +}; + +Window_MapName.prototype.drawBackground = function(x, y, width, height) { + const color1 = ColorManager.dimColor1(); + const color2 = ColorManager.dimColor2(); + const half = width / 2; + this.contents.gradientFillRect(x, y, half, height, color2, color1); + this.contents.gradientFillRect(x + half, y, half, height, color1, color2); +}; + +//----------------------------------------------------------------------------- +// Window_BattleLog +// +// The window for displaying battle progress. No frame is displayed, but it is +// handled as a window for convenience. + +function Window_BattleLog() { + this.initialize(...arguments); +} + +Window_BattleLog.prototype = Object.create(Window_Base.prototype); +Window_BattleLog.prototype.constructor = Window_BattleLog; + +Window_BattleLog.prototype.initialize = function(rect) { + Window_Base.prototype.initialize.call(this, rect); + this.opacity = 0; + this._lines = []; + this._methods = []; + this._waitCount = 0; + this._waitMode = ""; + this._baseLineStack = []; + this._spriteset = null; + this.refresh(); +}; + +Window_BattleLog.prototype.setSpriteset = function(spriteset) { + this._spriteset = spriteset; +}; + +Window_BattleLog.prototype.maxLines = function() { + return 10; +}; + +Window_BattleLog.prototype.numLines = function() { + return this._lines.length; +}; + +Window_BattleLog.prototype.messageSpeed = function() { + return 16; +}; + +Window_BattleLog.prototype.isBusy = function() { + return this._waitCount > 0 || this._waitMode || this._methods.length > 0; +}; + +Window_BattleLog.prototype.update = function() { + if (!this.updateWait()) { + this.callNextMethod(); + } +}; + +Window_BattleLog.prototype.updateWait = function() { + return this.updateWaitCount() || this.updateWaitMode(); +}; + +Window_BattleLog.prototype.updateWaitCount = function() { + if (this._waitCount > 0) { + this._waitCount -= this.isFastForward() ? 3 : 1; + if (this._waitCount < 0) { + this._waitCount = 0; + } + return true; + } + return false; +}; + +Window_BattleLog.prototype.updateWaitMode = function() { + let waiting = false; + switch (this._waitMode) { + case "effect": + waiting = this._spriteset.isEffecting(); + break; + case "movement": + waiting = this._spriteset.isAnyoneMoving(); + break; + } + if (!waiting) { + this._waitMode = ""; + } + return waiting; +}; + +Window_BattleLog.prototype.setWaitMode = function(waitMode) { + this._waitMode = waitMode; +}; + +Window_BattleLog.prototype.callNextMethod = function() { + if (this._methods.length > 0) { + const method = this._methods.shift(); + if (method.name && this[method.name]) { + this[method.name].apply(this, method.params); + } else { + throw new Error("Method not found: " + method.name); + } + } +}; + +Window_BattleLog.prototype.isFastForward = function() { + return ( + Input.isLongPressed("ok") || + Input.isPressed("shift") || + TouchInput.isLongPressed() + ); +}; + +Window_BattleLog.prototype.push = function(methodName) { + const methodArgs = Array.prototype.slice.call(arguments, 1); + this._methods.push({ name: methodName, params: methodArgs }); +}; + +Window_BattleLog.prototype.clear = function() { + this._lines = []; + this._baseLineStack = []; + this.refresh(); +}; + +Window_BattleLog.prototype.wait = function() { + this._waitCount = this.messageSpeed(); +}; + +Window_BattleLog.prototype.waitForEffect = function() { + this.setWaitMode("effect"); +}; + +Window_BattleLog.prototype.waitForMovement = function() { + this.setWaitMode("movement"); +}; + +Window_BattleLog.prototype.addText = function(text) { + this._lines.push(text); + this.refresh(); + this.wait(); +}; + +Window_BattleLog.prototype.pushBaseLine = function() { + this._baseLineStack.push(this._lines.length); +}; + +Window_BattleLog.prototype.popBaseLine = function() { + const baseLine = this._baseLineStack.pop(); + while (this._lines.length > baseLine) { + this._lines.pop(); + } +}; + +Window_BattleLog.prototype.waitForNewLine = function() { + let baseLine = 0; + if (this._baseLineStack.length > 0) { + baseLine = this._baseLineStack[this._baseLineStack.length - 1]; + } + if (this._lines.length > baseLine) { + this.wait(); + } +}; + +Window_BattleLog.prototype.popupDamage = function(target) { + if (target.shouldPopupDamage()) { + target.startDamagePopup(); + } +}; + +Window_BattleLog.prototype.performActionStart = function(subject, action) { + subject.performActionStart(action); +}; + +Window_BattleLog.prototype.performAction = function(subject, action) { + subject.performAction(action); +}; + +Window_BattleLog.prototype.performActionEnd = function(subject) { + subject.performActionEnd(); +}; + +Window_BattleLog.prototype.performDamage = function(target) { + target.performDamage(); +}; + +Window_BattleLog.prototype.performMiss = function(target) { + target.performMiss(); +}; + +Window_BattleLog.prototype.performRecovery = function(target) { + target.performRecovery(); +}; + +Window_BattleLog.prototype.performEvasion = function(target) { + target.performEvasion(); +}; + +Window_BattleLog.prototype.performMagicEvasion = function(target) { + target.performMagicEvasion(); +}; + +Window_BattleLog.prototype.performCounter = function(target) { + target.performCounter(); +}; + +Window_BattleLog.prototype.performReflection = function(target) { + target.performReflection(); +}; + +Window_BattleLog.prototype.performSubstitute = function(substitute, target) { + substitute.performSubstitute(target); +}; + +Window_BattleLog.prototype.performCollapse = function(target) { + target.performCollapse(); +}; + +// prettier-ignore +Window_BattleLog.prototype.showAnimation = function( + subject, targets, animationId +) { + if (animationId < 0) { + this.showAttackAnimation(subject, targets); + } else { + this.showNormalAnimation(targets, animationId); + } +}; + +Window_BattleLog.prototype.showAttackAnimation = function(subject, targets) { + if (subject.isActor()) { + this.showActorAttackAnimation(subject, targets); + } else { + this.showEnemyAttackAnimation(subject, targets); + } +}; + +// prettier-ignore +Window_BattleLog.prototype.showActorAttackAnimation = function( + subject, targets +) { + this.showNormalAnimation(targets, subject.attackAnimationId1(), false); + this.showNormalAnimation(targets, subject.attackAnimationId2(), true); +}; + +// prettier-ignore +Window_BattleLog.prototype.showEnemyAttackAnimation = function( + /* subject, targets */ +) { + SoundManager.playEnemyAttack(); +}; + +// prettier-ignore +Window_BattleLog.prototype.showNormalAnimation = function( + targets, animationId, mirror +) { + const animation = $dataAnimations[animationId]; + if (animation) { + $gameTemp.requestAnimation(targets, animationId, mirror); + } +}; + +Window_BattleLog.prototype.refresh = function() { + this.drawBackground(); + this.contents.clear(); + for (let i = 0; i < this._lines.length; i++) { + this.drawLineText(i); + } +}; + +Window_BattleLog.prototype.drawBackground = function() { + const rect = this.backRect(); + const color = this.backColor(); + this.contentsBack.clear(); + this.contentsBack.paintOpacity = this.backPaintOpacity(); + this.contentsBack.fillRect(rect.x, rect.y, rect.width, rect.height, color); + this.contentsBack.paintOpacity = 255; +}; + +Window_BattleLog.prototype.backRect = function() { + const height = this.numLines() * this.itemHeight(); + return new Rectangle(0, 0, this.innerWidth, height); +}; + +Window_BattleLog.prototype.lineRect = function(index) { + const itemHeight = this.itemHeight(); + const padding = this.itemPadding(); + const x = padding; + const y = index * itemHeight; + const width = this.innerWidth - padding * 2; + const height = itemHeight; + return new Rectangle(x, y, width, height); +}; + +Window_BattleLog.prototype.backColor = function() { + return "#000000"; +}; + +Window_BattleLog.prototype.backPaintOpacity = function() { + return 64; +}; + +Window_BattleLog.prototype.drawLineText = function(index) { + const rect = this.lineRect(index); + this.contents.clearRect(rect.x, rect.y, rect.width, rect.height); + this.drawTextEx(this._lines[index], rect.x, rect.y, rect.width); +}; + +Window_BattleLog.prototype.startTurn = function() { + this.push("wait"); +}; + +Window_BattleLog.prototype.startAction = function(subject, action, targets) { + const item = action.item(); + this.push("performActionStart", subject, action); + this.push("waitForMovement"); + this.push("performAction", subject, action); + this.push("showAnimation", subject, targets.clone(), item.animationId); + this.displayAction(subject, item); +}; + +Window_BattleLog.prototype.endAction = function(subject) { + this.push("waitForNewLine"); + this.push("clear"); + this.push("performActionEnd", subject); +}; + +Window_BattleLog.prototype.displayCurrentState = function(subject) { + const stateText = subject.mostImportantStateText(); + if (stateText) { + this.push("addText", stateText.format(subject.name())); + this.push("wait"); + this.push("clear"); + } +}; + +Window_BattleLog.prototype.displayRegeneration = function(subject) { + this.push("popupDamage", subject); +}; + +Window_BattleLog.prototype.displayAction = function(subject, item) { + const numMethods = this._methods.length; + if (DataManager.isSkill(item)) { + this.displayItemMessage(item.message1, subject, item); + this.displayItemMessage(item.message2, subject, item); + } else { + this.displayItemMessage(TextManager.useItem, subject, item); + } + if (this._methods.length === numMethods) { + this.push("wait"); + } +}; + +Window_BattleLog.prototype.displayItemMessage = function(fmt, subject, item) { + if (fmt) { + this.push("addText", fmt.format(subject.name(), item.name)); + } +}; + +Window_BattleLog.prototype.displayCounter = function(target) { + this.push("performCounter", target); + this.push("addText", TextManager.counterAttack.format(target.name())); +}; + +Window_BattleLog.prototype.displayReflection = function(target) { + this.push("performReflection", target); + this.push("addText", TextManager.magicReflection.format(target.name())); +}; + +Window_BattleLog.prototype.displaySubstitute = function(substitute, target) { + const substName = substitute.name(); + const text = TextManager.substitute.format(substName, target.name()); + this.push("performSubstitute", substitute, target); + this.push("addText", text); +}; + +Window_BattleLog.prototype.displayActionResults = function(subject, target) { + if (target.result().used) { + this.push("pushBaseLine"); + this.displayCritical(target); + this.push("popupDamage", target); + this.push("popupDamage", subject); + this.displayDamage(target); + this.displayAffectedStatus(target); + this.displayFailure(target); + this.push("waitForNewLine"); + this.push("popBaseLine"); + } +}; + +Window_BattleLog.prototype.displayFailure = function(target) { + if (target.result().isHit() && !target.result().success) { + this.push("addText", TextManager.actionFailure.format(target.name())); + } +}; + +Window_BattleLog.prototype.displayCritical = function(target) { + if (target.result().critical) { + if (target.isActor()) { + this.push("addText", TextManager.criticalToActor); + } else { + this.push("addText", TextManager.criticalToEnemy); + } + } +}; + +Window_BattleLog.prototype.displayDamage = function(target) { + if (target.result().missed) { + this.displayMiss(target); + } else if (target.result().evaded) { + this.displayEvasion(target); + } else { + this.displayHpDamage(target); + this.displayMpDamage(target); + this.displayTpDamage(target); + } +}; + +Window_BattleLog.prototype.displayMiss = function(target) { + let fmt; + if (target.result().physical) { + const isActor = target.isActor(); + fmt = isActor ? TextManager.actorNoHit : TextManager.enemyNoHit; + this.push("performMiss", target); + } else { + fmt = TextManager.actionFailure; + } + this.push("addText", fmt.format(target.name())); +}; + +Window_BattleLog.prototype.displayEvasion = function(target) { + let fmt; + if (target.result().physical) { + fmt = TextManager.evasion; + this.push("performEvasion", target); + } else { + fmt = TextManager.magicEvasion; + this.push("performMagicEvasion", target); + } + this.push("addText", fmt.format(target.name())); +}; + +Window_BattleLog.prototype.displayHpDamage = function(target) { + if (target.result().hpAffected) { + if (target.result().hpDamage > 0 && !target.result().drain) { + this.push("performDamage", target); + } + if (target.result().hpDamage < 0) { + this.push("performRecovery", target); + } + this.push("addText", this.makeHpDamageText(target)); + } +}; + +Window_BattleLog.prototype.displayMpDamage = function(target) { + if (target.isAlive() && target.result().mpDamage !== 0) { + if (target.result().mpDamage < 0) { + this.push("performRecovery", target); + } + this.push("addText", this.makeMpDamageText(target)); + } +}; + +Window_BattleLog.prototype.displayTpDamage = function(target) { + if (target.isAlive() && target.result().tpDamage !== 0) { + if (target.result().tpDamage < 0) { + this.push("performRecovery", target); + } + this.push("addText", this.makeTpDamageText(target)); + } +}; + +Window_BattleLog.prototype.displayAffectedStatus = function(target) { + if (target.result().isStatusAffected()) { + this.push("pushBaseLine"); + this.displayChangedStates(target); + this.displayChangedBuffs(target); + this.push("waitForNewLine"); + this.push("popBaseLine"); + } +}; + +Window_BattleLog.prototype.displayAutoAffectedStatus = function(target) { + if (target.result().isStatusAffected()) { + this.displayAffectedStatus(target, null); + this.push("clear"); + } +}; + +Window_BattleLog.prototype.displayChangedStates = function(target) { + this.displayAddedStates(target); + this.displayRemovedStates(target); +}; + +Window_BattleLog.prototype.displayAddedStates = function(target) { + const result = target.result(); + const states = result.addedStateObjects(); + for (const state of states) { + const stateText = target.isActor() ? state.message1 : state.message2; + if (state.id === target.deathStateId()) { + this.push("performCollapse", target); + } + if (stateText) { + this.push("popBaseLine"); + this.push("pushBaseLine"); + this.push("addText", stateText.format(target.name())); + this.push("waitForEffect"); + } + } +}; + +Window_BattleLog.prototype.displayRemovedStates = function(target) { + const result = target.result(); + const states = result.removedStateObjects(); + for (const state of states) { + if (state.message4) { + this.push("popBaseLine"); + this.push("pushBaseLine"); + this.push("addText", state.message4.format(target.name())); + } + } +}; + +Window_BattleLog.prototype.displayChangedBuffs = function(target) { + const result = target.result(); + this.displayBuffs(target, result.addedBuffs, TextManager.buffAdd); + this.displayBuffs(target, result.addedDebuffs, TextManager.debuffAdd); + this.displayBuffs(target, result.removedBuffs, TextManager.buffRemove); +}; + +Window_BattleLog.prototype.displayBuffs = function(target, buffs, fmt) { + for (const paramId of buffs) { + const text = fmt.format(target.name(), TextManager.param(paramId)); + this.push("popBaseLine"); + this.push("pushBaseLine"); + this.push("addText", text); + } +}; + +Window_BattleLog.prototype.makeHpDamageText = function(target) { + const result = target.result(); + const damage = result.hpDamage; + const isActor = target.isActor(); + let fmt; + if (damage > 0 && result.drain) { + fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain; + return fmt.format(target.name(), TextManager.hp, damage); + } else if (damage > 0) { + fmt = isActor ? TextManager.actorDamage : TextManager.enemyDamage; + return fmt.format(target.name(), damage); + } else if (damage < 0) { + fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery; + return fmt.format(target.name(), TextManager.hp, -damage); + } else { + fmt = isActor ? TextManager.actorNoDamage : TextManager.enemyNoDamage; + return fmt.format(target.name()); + } +}; + +Window_BattleLog.prototype.makeMpDamageText = function(target) { + const result = target.result(); + const damage = result.mpDamage; + const isActor = target.isActor(); + let fmt; + if (damage > 0 && result.drain) { + fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain; + return fmt.format(target.name(), TextManager.mp, damage); + } else if (damage > 0) { + fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss; + return fmt.format(target.name(), TextManager.mp, damage); + } else if (damage < 0) { + fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery; + return fmt.format(target.name(), TextManager.mp, -damage); + } else { + return ""; + } +}; + +Window_BattleLog.prototype.makeTpDamageText = function(target) { + const result = target.result(); + const damage = result.tpDamage; + const isActor = target.isActor(); + let fmt; + if (damage > 0) { + fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss; + return fmt.format(target.name(), TextManager.tp, damage); + } else if (damage < 0) { + fmt = isActor ? TextManager.actorGain : TextManager.enemyGain; + return fmt.format(target.name(), TextManager.tp, -damage); + } else { + return ""; + } +}; + +//----------------------------------------------------------------------------- +// Window_PartyCommand +// +// The window for selecting whether to fight or escape on the battle screen. + +function Window_PartyCommand() { + this.initialize(...arguments); +} + +Window_PartyCommand.prototype = Object.create(Window_Command.prototype); +Window_PartyCommand.prototype.constructor = Window_PartyCommand; + +Window_PartyCommand.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); + this.openness = 0; + this.deactivate(); +}; + +Window_PartyCommand.prototype.makeCommandList = function() { + this.addCommand(TextManager.fight, "fight"); + this.addCommand(TextManager.escape, "escape", BattleManager.canEscape()); +}; + +Window_PartyCommand.prototype.setup = function() { + this.refresh(); + this.forceSelect(0); + this.activate(); + this.open(); +}; + +//----------------------------------------------------------------------------- +// Window_ActorCommand +// +// The window for selecting an actor's action on the battle screen. + +function Window_ActorCommand() { + this.initialize(...arguments); +} + +Window_ActorCommand.prototype = Object.create(Window_Command.prototype); +Window_ActorCommand.prototype.constructor = Window_ActorCommand; + +Window_ActorCommand.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); + this.openness = 0; + this.deactivate(); + this._actor = null; +}; + +Window_ActorCommand.prototype.makeCommandList = function() { + if (this._actor) { + this.addAttackCommand(); + this.addSkillCommands(); + this.addGuardCommand(); + this.addItemCommand(); + } +}; + +Window_ActorCommand.prototype.addAttackCommand = function() { + this.addCommand(TextManager.attack, "attack", this._actor.canAttack()); +}; + +Window_ActorCommand.prototype.addSkillCommands = function() { + const skillTypes = this._actor.skillTypes(); + for (const stypeId of skillTypes) { + const name = $dataSystem.skillTypes[stypeId]; + this.addCommand(name, "skill", true, stypeId); + } +}; + +Window_ActorCommand.prototype.addGuardCommand = function() { + this.addCommand(TextManager.guard, "guard", this._actor.canGuard()); +}; + +Window_ActorCommand.prototype.addItemCommand = function() { + this.addCommand(TextManager.item, "item"); +}; + +Window_ActorCommand.prototype.setup = function(actor) { + this._actor = actor; + this.refresh(); + this.selectLast(); + this.activate(); + this.open(); +}; + +Window_ActorCommand.prototype.actor = function() { + return this._actor; +}; + +Window_ActorCommand.prototype.processOk = function() { + if (this._actor) { + if (ConfigManager.commandRemember) { + this._actor.setLastCommandSymbol(this.currentSymbol()); + } else { + this._actor.setLastCommandSymbol(""); + } + } + Window_Command.prototype.processOk.call(this); +}; + +Window_ActorCommand.prototype.selectLast = function() { + this.forceSelect(0); + if (this._actor && ConfigManager.commandRemember) { + const symbol = this._actor.lastCommandSymbol(); + this.selectSymbol(symbol); + if (symbol === "skill") { + const skill = this._actor.lastBattleSkill(); + if (skill) { + this.selectExt(skill.stypeId); + } + } + } +}; + +//----------------------------------------------------------------------------- +// Window_BattleStatus +// +// The window for displaying the status of party members on the battle screen. + +function Window_BattleStatus() { + this.initialize(...arguments); +} + +Window_BattleStatus.prototype = Object.create(Window_StatusBase.prototype); +Window_BattleStatus.prototype.constructor = Window_BattleStatus; + +Window_BattleStatus.prototype.initialize = function(rect) { + Window_StatusBase.prototype.initialize.call(this, rect); + this.frameVisible = false; + this.openness = 0; + this._bitmapsReady = 0; + this.preparePartyRefresh(); +}; + +Window_BattleStatus.prototype.extraHeight = function() { + return 10; +}; + +Window_BattleStatus.prototype.maxCols = function() { + return 4; +}; + +Window_BattleStatus.prototype.itemHeight = function() { + return this.innerHeight; +}; + +Window_BattleStatus.prototype.maxItems = function() { + return $gameParty.battleMembers().length; +}; + +Window_BattleStatus.prototype.rowSpacing = function() { + return 0; +}; + +Window_BattleStatus.prototype.updatePadding = function() { + this.padding = 8; +}; + +Window_BattleStatus.prototype.actor = function(index) { + return $gameParty.battleMembers()[index]; +}; + +Window_BattleStatus.prototype.selectActor = function(actor) { + const members = $gameParty.battleMembers(); + this.select(members.indexOf(actor)); +}; + +Window_BattleStatus.prototype.update = function() { + Window_StatusBase.prototype.update.call(this); + if ($gameTemp.isBattleRefreshRequested()) { + this.preparePartyRefresh(); + } +}; + +Window_BattleStatus.prototype.preparePartyRefresh = function() { + $gameTemp.clearBattleRefreshRequest(); + this._bitmapsReady = 0; + for (const actor of $gameParty.members()) { + const bitmap = ImageManager.loadFace(actor.faceName()); + bitmap.addLoadListener(this.performPartyRefresh.bind(this)); + } +}; + +Window_BattleStatus.prototype.performPartyRefresh = function() { + this._bitmapsReady++; + if (this._bitmapsReady >= $gameParty.members().length) { + this.refresh(); + } +}; + +Window_BattleStatus.prototype.drawItem = function(index) { + this.drawItemImage(index); + this.drawItemStatus(index); +}; + +Window_BattleStatus.prototype.drawItemImage = function(index) { + const actor = this.actor(index); + const rect = this.faceRect(index); + this.drawActorFace(actor, rect.x, rect.y, rect.width, rect.height); +}; + +Window_BattleStatus.prototype.drawItemStatus = function(index) { + const actor = this.actor(index); + const rect = this.itemRectWithPadding(index); + const nameX = this.nameX(rect); + const nameY = this.nameY(rect); + const stateIconX = this.stateIconX(rect); + const stateIconY = this.stateIconY(rect); + const basicGaugesX = this.basicGaugesX(rect); + const basicGaugesY = this.basicGaugesY(rect); + this.placeTimeGauge(actor, nameX, nameY); + this.placeActorName(actor, nameX, nameY); + this.placeStateIcon(actor, stateIconX, stateIconY); + this.placeBasicGauges(actor, basicGaugesX, basicGaugesY); +}; + +Window_BattleStatus.prototype.faceRect = function(index) { + const rect = this.itemRect(index); + rect.pad(-1); + rect.height = this.nameY(rect) + this.gaugeLineHeight() / 2 - rect.y; + return rect; +}; + +Window_BattleStatus.prototype.nameX = function(rect) { + return rect.x; +}; + +Window_BattleStatus.prototype.nameY = function(rect) { + return this.basicGaugesY(rect) - this.gaugeLineHeight(); +}; + +Window_BattleStatus.prototype.stateIconX = function(rect) { + return rect.x + rect.width - ImageManager.iconWidth / 2 + 4; +}; + +Window_BattleStatus.prototype.stateIconY = function(rect) { + return rect.y + ImageManager.iconHeight / 2 + 4; +}; + +Window_BattleStatus.prototype.basicGaugesX = function(rect) { + return rect.x; +}; + +Window_BattleStatus.prototype.basicGaugesY = function(rect) { + const bottom = rect.y + rect.height - this.extraHeight(); + const numGauges = $dataSystem.optDisplayTp ? 3 : 2; + return bottom - this.gaugeLineHeight() * numGauges; +}; + +//----------------------------------------------------------------------------- +// Window_BattleActor +// +// The window for selecting a target actor on the battle screen. + +function Window_BattleActor() { + this.initialize(...arguments); +} + +Window_BattleActor.prototype = Object.create(Window_BattleStatus.prototype); +Window_BattleActor.prototype.constructor = Window_BattleActor; + +Window_BattleActor.prototype.initialize = function(rect) { + Window_BattleStatus.prototype.initialize.call(this, rect); + this.openness = 255; + this.hide(); +}; + +Window_BattleActor.prototype.show = function() { + this.forceSelect(0); + $gameTemp.clearTouchState(); + Window_BattleStatus.prototype.show.call(this); +}; + +Window_BattleActor.prototype.hide = function() { + Window_BattleStatus.prototype.hide.call(this); + $gameParty.select(null); +}; + +Window_BattleActor.prototype.select = function(index) { + Window_BattleStatus.prototype.select.call(this, index); + $gameParty.select(this.actor(index)); +}; + +Window_BattleActor.prototype.processTouch = function() { + Window_BattleStatus.prototype.processTouch.call(this); + if (this.isOpenAndActive()) { + const target = $gameTemp.touchTarget(); + if (target) { + const members = $gameParty.battleMembers(); + if (members.includes(target)) { + this.select(members.indexOf(target)); + if ($gameTemp.touchState() === "click") { + this.processOk(); + } + } + $gameTemp.clearTouchState(); + } + } +}; + +//----------------------------------------------------------------------------- +// Window_BattleEnemy +// +// The window for selecting a target enemy on the battle screen. + +function Window_BattleEnemy() { + this.initialize(...arguments); +} + +Window_BattleEnemy.prototype = Object.create(Window_Selectable.prototype); +Window_BattleEnemy.prototype.constructor = Window_BattleEnemy; + +Window_BattleEnemy.prototype.initialize = function(rect) { + this._enemies = []; + Window_Selectable.prototype.initialize.call(this, rect); + this.refresh(); + this.hide(); +}; + +Window_BattleEnemy.prototype.maxCols = function() { + return 2; +}; + +Window_BattleEnemy.prototype.maxItems = function() { + return this._enemies.length; +}; + +Window_BattleEnemy.prototype.enemy = function() { + return this._enemies[this.index()]; +}; + +Window_BattleEnemy.prototype.enemyIndex = function() { + const enemy = this.enemy(); + return enemy ? enemy.index() : -1; +}; + +Window_BattleEnemy.prototype.drawItem = function(index) { + this.resetTextColor(); + const name = this._enemies[index].name(); + const rect = this.itemLineRect(index); + this.drawText(name, rect.x, rect.y, rect.width); +}; + +Window_BattleEnemy.prototype.show = function() { + this.refresh(); + this.forceSelect(0); + $gameTemp.clearTouchState(); + Window_Selectable.prototype.show.call(this); +}; + +Window_BattleEnemy.prototype.hide = function() { + Window_Selectable.prototype.hide.call(this); + $gameTroop.select(null); +}; + +Window_BattleEnemy.prototype.refresh = function() { + this._enemies = $gameTroop.aliveMembers(); + Window_Selectable.prototype.refresh.call(this); +}; + +Window_BattleEnemy.prototype.select = function(index) { + Window_Selectable.prototype.select.call(this, index); + $gameTroop.select(this.enemy()); +}; + +Window_BattleEnemy.prototype.processTouch = function() { + Window_Selectable.prototype.processTouch.call(this); + if (this.isOpenAndActive()) { + const target = $gameTemp.touchTarget(); + if (target) { + if (this._enemies.includes(target)) { + this.select(this._enemies.indexOf(target)); + if ($gameTemp.touchState() === "click") { + this.processOk(); + } + } + $gameTemp.clearTouchState(); + } + } +}; + +//----------------------------------------------------------------------------- +// Window_BattleSkill +// +// The window for selecting a skill to use on the battle screen. + +function Window_BattleSkill() { + this.initialize(...arguments); +} + +Window_BattleSkill.prototype = Object.create(Window_SkillList.prototype); +Window_BattleSkill.prototype.constructor = Window_BattleSkill; + +Window_BattleSkill.prototype.initialize = function(rect) { + Window_SkillList.prototype.initialize.call(this, rect); + this.hide(); +}; + +Window_BattleSkill.prototype.show = function() { + this.selectLast(); + this.showHelpWindow(); + Window_SkillList.prototype.show.call(this); +}; + +Window_BattleSkill.prototype.hide = function() { + this.hideHelpWindow(); + Window_SkillList.prototype.hide.call(this); +}; + +//----------------------------------------------------------------------------- +// Window_BattleItem +// +// The window for selecting an item to use on the battle screen. + +function Window_BattleItem() { + this.initialize(...arguments); +} + +Window_BattleItem.prototype = Object.create(Window_ItemList.prototype); +Window_BattleItem.prototype.constructor = Window_BattleItem; + +Window_BattleItem.prototype.initialize = function(rect) { + Window_ItemList.prototype.initialize.call(this, rect); + this.hide(); +}; + +Window_BattleItem.prototype.includes = function(item) { + return $gameParty.canUse(item); +}; + +Window_BattleItem.prototype.show = function() { + this.selectLast(); + this.showHelpWindow(); + Window_ItemList.prototype.show.call(this); +}; + +Window_BattleItem.prototype.hide = function() { + this.hideHelpWindow(); + Window_ItemList.prototype.hide.call(this); +}; + +//----------------------------------------------------------------------------- +// Window_TitleCommand +// +// The window for selecting New Game/Continue on the title screen. + +function Window_TitleCommand() { + this.initialize(...arguments); +} + +Window_TitleCommand.prototype = Object.create(Window_Command.prototype); +Window_TitleCommand.prototype.constructor = Window_TitleCommand; + +Window_TitleCommand.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); + this.openness = 0; + this.selectLast(); +}; + +Window_TitleCommand._lastCommandSymbol = null; + +Window_TitleCommand.initCommandPosition = function() { + this._lastCommandSymbol = null; +}; + +Window_TitleCommand.prototype.makeCommandList = function() { + const continueEnabled = this.isContinueEnabled(); + this.addCommand(TextManager.newGame, "newGame"); + this.addCommand(TextManager.continue_, "continue", continueEnabled); + this.addCommand(TextManager.options, "options"); +}; + +Window_TitleCommand.prototype.isContinueEnabled = function() { + return DataManager.isAnySavefileExists(); +}; + +Window_TitleCommand.prototype.processOk = function() { + Window_TitleCommand._lastCommandSymbol = this.currentSymbol(); + Window_Command.prototype.processOk.call(this); +}; + +Window_TitleCommand.prototype.selectLast = function() { + if (Window_TitleCommand._lastCommandSymbol) { + this.selectSymbol(Window_TitleCommand._lastCommandSymbol); + } else if (this.isContinueEnabled()) { + this.selectSymbol("continue"); + } +}; + +//----------------------------------------------------------------------------- +// Window_GameEnd +// +// The window for selecting "Go to Title" on the game end screen. + +function Window_GameEnd() { + this.initialize(...arguments); +} + +Window_GameEnd.prototype = Object.create(Window_Command.prototype); +Window_GameEnd.prototype.constructor = Window_GameEnd; + +Window_GameEnd.prototype.initialize = function(rect) { + Window_Command.prototype.initialize.call(this, rect); + this.openness = 0; + this.open(); +}; + +Window_GameEnd.prototype.makeCommandList = function() { + this.addCommand(TextManager.toTitle, "toTitle"); + this.addCommand(TextManager.cancel, "cancel"); +}; + +//----------------------------------------------------------------------------- +// Window_DebugRange +// +// The window for selecting a block of switches/variables on the debug screen. + +function Window_DebugRange() { + this.initialize(...arguments); +} + +Window_DebugRange.prototype = Object.create(Window_Selectable.prototype); +Window_DebugRange.prototype.constructor = Window_DebugRange; + +Window_DebugRange.lastTopRow = 0; +Window_DebugRange.lastIndex = 0; + +Window_DebugRange.prototype.initialize = function(rect) { + this._maxSwitches = Math.ceil(($dataSystem.switches.length - 1) / 10); + this._maxVariables = Math.ceil(($dataSystem.variables.length - 1) / 10); + Window_Selectable.prototype.initialize.call(this, rect); + this.refresh(); + this.setTopRow(Window_DebugRange.lastTopRow); + this.select(Window_DebugRange.lastIndex); + this.activate(); +}; + +Window_DebugRange.prototype.maxItems = function() { + return this._maxSwitches + this._maxVariables; +}; + +Window_DebugRange.prototype.update = function() { + Window_Selectable.prototype.update.call(this); + if (this._editWindow) { + const index = this.index(); + this._editWindow.setMode(this.mode(index)); + this._editWindow.setTopId(this.topId(index)); + } +}; + +Window_DebugRange.prototype.mode = function(index) { + return this.isSwitchMode(index) ? "switch" : "variable"; +}; + +Window_DebugRange.prototype.topId = function(index) { + if (this.isSwitchMode(index)) { + return index * 10 + 1; + } else { + return (index - this._maxSwitches) * 10 + 1; + } +}; + +Window_DebugRange.prototype.isSwitchMode = function(index) { + return index < this._maxSwitches; +}; + +Window_DebugRange.prototype.drawItem = function(index) { + const rect = this.itemLineRect(index); + const c = this.isSwitchMode(index) ? "S" : "V"; + const start = this.topId(index); + const end = start + 9; + const text = c + " [" + start.padZero(4) + "-" + end.padZero(4) + "]"; + this.drawText(text, rect.x, rect.y, rect.width); +}; + +Window_DebugRange.prototype.isCancelTriggered = function() { + return ( + Window_Selectable.prototype.isCancelTriggered() || + Input.isTriggered("debug") + ); +}; + +Window_DebugRange.prototype.processCancel = function() { + Window_Selectable.prototype.processCancel.call(this); + Window_DebugRange.lastTopRow = this.topRow(); + Window_DebugRange.lastIndex = this.index(); +}; + +Window_DebugRange.prototype.setEditWindow = function(editWindow) { + this._editWindow = editWindow; +}; + +//----------------------------------------------------------------------------- +// Window_DebugEdit +// +// The window for displaying switches and variables on the debug screen. + +function Window_DebugEdit() { + this.initialize(...arguments); +} + +Window_DebugEdit.prototype = Object.create(Window_Selectable.prototype); +Window_DebugEdit.prototype.constructor = Window_DebugEdit; + +Window_DebugEdit.prototype.initialize = function(rect) { + Window_Selectable.prototype.initialize.call(this, rect); + this._mode = "switch"; + this._topId = 1; + this.refresh(); +}; + +Window_DebugEdit.prototype.maxItems = function() { + return 10; +}; + +Window_DebugEdit.prototype.drawItem = function(index) { + const dataId = this._topId + index; + const idText = dataId.padZero(4) + ":"; + const idWidth = this.textWidth(idText); + const statusWidth = this.textWidth("-00000000"); + const name = this.itemName(dataId); + const status = this.itemStatus(dataId); + const rect = this.itemLineRect(index); + this.resetTextColor(); + this.drawText(idText, rect.x, rect.y, rect.width); + rect.x += idWidth; + rect.width -= idWidth + statusWidth; + this.drawText(name, rect.x, rect.y, rect.width); + this.drawText(status, rect.x + rect.width, rect.y, statusWidth, "right"); +}; + +Window_DebugEdit.prototype.itemName = function(dataId) { + if (this._mode === "switch") { + return $dataSystem.switches[dataId]; + } else { + return $dataSystem.variables[dataId]; + } +}; + +Window_DebugEdit.prototype.itemStatus = function(dataId) { + if (this._mode === "switch") { + return $gameSwitches.value(dataId) ? "[ON]" : "[OFF]"; + } else { + return String($gameVariables.value(dataId)); + } +}; + +Window_DebugEdit.prototype.setMode = function(mode) { + if (this._mode !== mode) { + this._mode = mode; + this.refresh(); + } +}; + +Window_DebugEdit.prototype.setTopId = function(id) { + if (this._topId !== id) { + this._topId = id; + this.refresh(); + } +}; + +Window_DebugEdit.prototype.currentId = function() { + return this._topId + this.index(); +}; + +Window_DebugEdit.prototype.update = function() { + Window_Selectable.prototype.update.call(this); + if (this.active) { + if (this._mode === "switch") { + this.updateSwitch(); + } else { + this.updateVariable(); + } + } +}; + +Window_DebugEdit.prototype.updateSwitch = function() { + if (Input.isRepeated("ok")) { + const switchId = this.currentId(); + this.playCursorSound(); + $gameSwitches.setValue(switchId, !$gameSwitches.value(switchId)); + this.redrawCurrentItem(); + } +}; + +Window_DebugEdit.prototype.updateVariable = function() { + const variableId = this.currentId(); + const value = $gameVariables.value(variableId); + if (typeof value === "number") { + const newValue = value + this.deltaForVariable(); + if (value !== newValue) { + $gameVariables.setValue(variableId, newValue); + this.playCursorSound(); + this.redrawCurrentItem(); + } + } +}; + +Window_DebugEdit.prototype.deltaForVariable = function() { + if (Input.isRepeated("right")) { + return 1; + } else if (Input.isRepeated("left")) { + return -1; + } else if (Input.isRepeated("pagedown")) { + return 10; + } else if (Input.isRepeated("pageup")) { + return -10; + } + return 0; +}; + +//----------------------------------------------------------------------------- diff --git a/package.json b/package.json new file mode 100644 index 0000000..70b2e7c --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "rmmz-game", + "main": "index.html", + "chromium-args": "--force-color-profile=srgb", + "window": { + "title": "Life of a Naomi", + "width": 816, + "height": 624, + "position": "center", + "icon": "icon/icon.png" + } +} \ No newline at end of file