diff --git a/.gitignore b/.gitignore index 9e895768..3a6bfb88 100644 --- a/.gitignore +++ b/.gitignore @@ -330,4 +330,6 @@ ASALocalRun/ .mfractor/ # Dev things -Dev/ \ No newline at end of file +Dev/ +Build/Server/Data/Accounts +Build/Server/Data/Characters.dat \ No newline at end of file diff --git a/Build/Client/Client.exe b/Build/Client/Client.exe index 07567d22..72383e0f 100644 Binary files a/Build/Client/Client.exe and b/Build/Client/Client.exe differ diff --git a/Build/Client/Data/Maps/1.dat b/Build/Client/Data/Maps/1.dat new file mode 100644 index 00000000..24311c3b Binary files /dev/null and b/Build/Client/Data/Maps/1.dat differ diff --git a/Build/Client/Data/Maps/2.dat b/Build/Client/Data/Maps/2.dat new file mode 100644 index 00000000..f7198a4d Binary files /dev/null and b/Build/Client/Data/Maps/2.dat differ diff --git a/Build/Client/Data/Options.dat b/Build/Client/Data/Options.dat new file mode 100644 index 00000000..4ca16d64 Binary files /dev/null and b/Build/Client/Data/Options.dat differ diff --git a/Build/Client/Data/Tools.dat b/Build/Client/Data/Tools.dat index a11ca37a..66cc55e0 100644 Binary files a/Build/Client/Data/Tools.dat and b/Build/Client/Data/Tools.dat differ diff --git a/Build/Client/Fonts/Georgia.ttf b/Build/Client/Graphics/Fonts/Georgia.ttf similarity index 100% rename from Build/Client/Fonts/Georgia.ttf rename to Build/Client/Graphics/Fonts/Georgia.ttf diff --git a/Build/Client/Graphics/Interface/1.png b/Build/Client/Graphics/Interface/1.png deleted file mode 100644 index 7acdd69c..00000000 Binary files a/Build/Client/Graphics/Interface/1.png and /dev/null differ diff --git a/Build/Client/Graphics/Interface/2.png b/Build/Client/Graphics/Interface/2.png deleted file mode 100644 index 9a2e03a7..00000000 Binary files a/Build/Client/Graphics/Interface/2.png and /dev/null differ diff --git a/Build/Client/Graphics/Interface/3.png b/Build/Client/Graphics/Interface/3.png deleted file mode 100644 index b70040da..00000000 Binary files a/Build/Client/Graphics/Interface/3.png and /dev/null differ diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/1.png b/Build/Client/Graphics/Interface/Buttons/1.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/1.png rename to Build/Client/Graphics/Interface/Buttons/1.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/10.png b/Build/Client/Graphics/Interface/Buttons/10.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/10.png rename to Build/Client/Graphics/Interface/Buttons/10.png diff --git a/Build/Client/Graphics/Interface/Buttons/11.png b/Build/Client/Graphics/Interface/Buttons/11.png new file mode 100644 index 00000000..b0dabb4a Binary files /dev/null and b/Build/Client/Graphics/Interface/Buttons/11.png differ diff --git a/Build/Client/Graphics/Interface/Buttons/12.png b/Build/Client/Graphics/Interface/Buttons/12.png new file mode 100644 index 00000000..5c604fc4 Binary files /dev/null and b/Build/Client/Graphics/Interface/Buttons/12.png differ diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/13.png b/Build/Client/Graphics/Interface/Buttons/13.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/13.png rename to Build/Client/Graphics/Interface/Buttons/13.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/14.png b/Build/Client/Graphics/Interface/Buttons/14.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/14.png rename to Build/Client/Graphics/Interface/Buttons/14.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/15.png b/Build/Client/Graphics/Interface/Buttons/15.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/15.png rename to Build/Client/Graphics/Interface/Buttons/15.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/16.png b/Build/Client/Graphics/Interface/Buttons/16.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/16.png rename to Build/Client/Graphics/Interface/Buttons/16.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/17.png b/Build/Client/Graphics/Interface/Buttons/17.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/17.png rename to Build/Client/Graphics/Interface/Buttons/17.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/18.png b/Build/Client/Graphics/Interface/Buttons/18.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/18.png rename to Build/Client/Graphics/Interface/Buttons/18.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/19.png b/Build/Client/Graphics/Interface/Buttons/19.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/19.png rename to Build/Client/Graphics/Interface/Buttons/19.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/2.png b/Build/Client/Graphics/Interface/Buttons/2.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/2.png rename to Build/Client/Graphics/Interface/Buttons/2.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/20.png b/Build/Client/Graphics/Interface/Buttons/20.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/20.png rename to Build/Client/Graphics/Interface/Buttons/20.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/21.png b/Build/Client/Graphics/Interface/Buttons/21.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/21.png rename to Build/Client/Graphics/Interface/Buttons/21.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/22.png b/Build/Client/Graphics/Interface/Buttons/22.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/22.png rename to Build/Client/Graphics/Interface/Buttons/22.png diff --git a/Build/Client/Graphics/Interface/Buttons/23.png b/Build/Client/Graphics/Interface/Buttons/23.png new file mode 100644 index 00000000..fb9114e7 Binary files /dev/null and b/Build/Client/Graphics/Interface/Buttons/23.png differ diff --git a/Build/Client/Graphics/Interface/Buttons/24.png b/Build/Client/Graphics/Interface/Buttons/24.png new file mode 100644 index 00000000..925df1e2 Binary files /dev/null and b/Build/Client/Graphics/Interface/Buttons/24.png differ diff --git a/Build/Client/Graphics/Interface/Buttons/25.png b/Build/Client/Graphics/Interface/Buttons/25.png new file mode 100644 index 00000000..76d90a7e Binary files /dev/null and b/Build/Client/Graphics/Interface/Buttons/25.png differ diff --git a/Build/Client/Graphics/Interface/Buttons/26.png b/Build/Client/Graphics/Interface/Buttons/26.png new file mode 100644 index 00000000..25dfc265 Binary files /dev/null and b/Build/Client/Graphics/Interface/Buttons/26.png differ diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/3.png b/Build/Client/Graphics/Interface/Buttons/3.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/3.png rename to Build/Client/Graphics/Interface/Buttons/3.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/4.png b/Build/Client/Graphics/Interface/Buttons/4.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/4.png rename to Build/Client/Graphics/Interface/Buttons/4.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/5.png b/Build/Client/Graphics/Interface/Buttons/5.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/5.png rename to Build/Client/Graphics/Interface/Buttons/5.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/6.png b/Build/Client/Graphics/Interface/Buttons/6.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/6.png rename to Build/Client/Graphics/Interface/Buttons/6.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/7.png b/Build/Client/Graphics/Interface/Buttons/7.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/7.png rename to Build/Client/Graphics/Interface/Buttons/7.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/8.png b/Build/Client/Graphics/Interface/Buttons/8.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/8.png rename to Build/Client/Graphics/Interface/Buttons/8.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/9.png b/Build/Client/Graphics/Interface/Buttons/9.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Buttons/9.png rename to Build/Client/Graphics/Interface/Buttons/9.png diff --git a/Build/Client/Graphics/Interface/Tools/CheckBox.png b/Build/Client/Graphics/Interface/CheckBox.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/CheckBox.png rename to Build/Client/Graphics/Interface/CheckBox.png diff --git a/Build/Client/Graphics/Interface/Intro.png b/Build/Client/Graphics/Interface/Intro.png new file mode 100644 index 00000000..3a876cdc Binary files /dev/null and b/Build/Client/Graphics/Interface/Intro.png differ diff --git a/Build/Client/Graphics/Interface/Tools/Panels/1.png b/Build/Client/Graphics/Interface/Panels/1.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/1.png rename to Build/Client/Graphics/Interface/Panels/1.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/10.png b/Build/Client/Graphics/Interface/Panels/10.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/10.png rename to Build/Client/Graphics/Interface/Panels/10.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/11.png b/Build/Client/Graphics/Interface/Panels/11.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/11.png rename to Build/Client/Graphics/Interface/Panels/11.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/12.png b/Build/Client/Graphics/Interface/Panels/12.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/12.png rename to Build/Client/Graphics/Interface/Panels/12.png diff --git a/Build/Client/Graphics/Interface/Panels/13.png b/Build/Client/Graphics/Interface/Panels/13.png new file mode 100644 index 00000000..faa66002 Binary files /dev/null and b/Build/Client/Graphics/Interface/Panels/13.png differ diff --git a/Build/Client/Graphics/Interface/Tools/Panels/14.png b/Build/Client/Graphics/Interface/Panels/14.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/14.png rename to Build/Client/Graphics/Interface/Panels/14.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/15.png b/Build/Client/Graphics/Interface/Panels/15.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/15.png rename to Build/Client/Graphics/Interface/Panels/15.png diff --git a/Build/Client/Graphics/Interface/Panels/16.png b/Build/Client/Graphics/Interface/Panels/16.png new file mode 100644 index 00000000..2601f28d Binary files /dev/null and b/Build/Client/Graphics/Interface/Panels/16.png differ diff --git a/Build/Client/Graphics/Interface/Panels/17.png b/Build/Client/Graphics/Interface/Panels/17.png new file mode 100644 index 00000000..c22ae973 Binary files /dev/null and b/Build/Client/Graphics/Interface/Panels/17.png differ diff --git a/Build/Client/Graphics/Interface/Tools/Panels/2.png b/Build/Client/Graphics/Interface/Panels/2.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/2.png rename to Build/Client/Graphics/Interface/Panels/2.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/3.png b/Build/Client/Graphics/Interface/Panels/3.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/3.png rename to Build/Client/Graphics/Interface/Panels/3.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/4.png b/Build/Client/Graphics/Interface/Panels/4.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/4.png rename to Build/Client/Graphics/Interface/Panels/4.png diff --git a/Build/Client/Graphics/Interface/Panels/5.png b/Build/Client/Graphics/Interface/Panels/5.png new file mode 100644 index 00000000..cbe0f8b1 Binary files /dev/null and b/Build/Client/Graphics/Interface/Panels/5.png differ diff --git a/Build/Client/Graphics/Interface/Tools/Panels/6.png b/Build/Client/Graphics/Interface/Panels/6.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/6.png rename to Build/Client/Graphics/Interface/Panels/6.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/7.png b/Build/Client/Graphics/Interface/Panels/7.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/7.png rename to Build/Client/Graphics/Interface/Panels/7.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/8.png b/Build/Client/Graphics/Interface/Panels/8.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/8.png rename to Build/Client/Graphics/Interface/Panels/8.png diff --git a/Build/Client/Graphics/Interface/Tools/Panels/9.png b/Build/Client/Graphics/Interface/Panels/9.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/Panels/9.png rename to Build/Client/Graphics/Interface/Panels/9.png diff --git a/Build/Client/Graphics/Interface/Tools/TextBox.png b/Build/Client/Graphics/Interface/TextBox.png similarity index 100% rename from Build/Client/Graphics/Interface/Tools/TextBox.png rename to Build/Client/Graphics/Interface/TextBox.png diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/11.png b/Build/Client/Graphics/Interface/Tools/Buttons/11.png deleted file mode 100644 index 7d0abdc2..00000000 Binary files a/Build/Client/Graphics/Interface/Tools/Buttons/11.png and /dev/null differ diff --git a/Build/Client/Graphics/Interface/Tools/Buttons/12.png b/Build/Client/Graphics/Interface/Tools/Buttons/12.png deleted file mode 100644 index cbc0474b..00000000 Binary files a/Build/Client/Graphics/Interface/Tools/Buttons/12.png and /dev/null differ diff --git a/Build/Client/Graphics/Interface/Tools/Panels/13.png b/Build/Client/Graphics/Interface/Tools/Panels/13.png deleted file mode 100644 index 1cb1ac36..00000000 Binary files a/Build/Client/Graphics/Interface/Tools/Panels/13.png and /dev/null differ diff --git a/Build/Client/Graphics/Interface/Tools/Panels/5.png b/Build/Client/Graphics/Interface/Tools/Panels/5.png deleted file mode 100644 index d0212c21..00000000 Binary files a/Build/Client/Graphics/Interface/Tools/Panels/5.png and /dev/null differ diff --git a/Build/Client/Graphics/Bars.png b/Build/Client/Graphics/Misc/Bars.png similarity index 100% rename from Build/Client/Graphics/Bars.png rename to Build/Client/Graphics/Misc/Bars.png diff --git a/Build/Client/Graphics/Bars_Panel.png b/Build/Client/Graphics/Misc/Bars_Panel.png similarity index 100% rename from Build/Client/Graphics/Bars_Panel.png rename to Build/Client/Graphics/Misc/Bars_Panel.png diff --git a/Build/Client/Graphics/Blank.png b/Build/Client/Graphics/Misc/Blank.png similarity index 100% rename from Build/Client/Graphics/Blank.png rename to Build/Client/Graphics/Misc/Blank.png diff --git a/Build/Client/Graphics/Misc/Blood.png b/Build/Client/Graphics/Misc/Blood.png new file mode 100644 index 00000000..bffbbffb Binary files /dev/null and b/Build/Client/Graphics/Misc/Blood.png differ diff --git a/Build/Client/Graphics/Directions.png b/Build/Client/Graphics/Misc/Directions.png similarity index 100% rename from Build/Client/Graphics/Directions.png rename to Build/Client/Graphics/Misc/Directions.png diff --git a/Build/Client/Graphics/Grid.png b/Build/Client/Graphics/Misc/Grid.png similarity index 100% rename from Build/Client/Graphics/Grid.png rename to Build/Client/Graphics/Misc/Grid.png diff --git a/Build/Client/Graphics/Lighting.png b/Build/Client/Graphics/Misc/Lighting.png similarity index 100% rename from Build/Client/Graphics/Lighting.png rename to Build/Client/Graphics/Misc/Lighting.png diff --git a/Build/Client/Graphics/Misc/Party_Bars.png b/Build/Client/Graphics/Misc/Party_Bars.png new file mode 100644 index 00000000..38356ab8 Binary files /dev/null and b/Build/Client/Graphics/Misc/Party_Bars.png differ diff --git a/Build/Client/Graphics/Shadow.png b/Build/Client/Graphics/Misc/Shadow.png similarity index 100% rename from Build/Client/Graphics/Shadow.png rename to Build/Client/Graphics/Misc/Shadow.png diff --git a/Build/Client/Graphics/Transparent.png b/Build/Client/Graphics/Misc/Transparent.png similarity index 100% rename from Build/Client/Graphics/Transparent.png rename to Build/Client/Graphics/Misc/Transparent.png diff --git a/Build/Client/Graphics/Weather.png b/Build/Client/Graphics/Misc/Weather.png similarity index 100% rename from Build/Client/Graphics/Weather.png rename to Build/Client/Graphics/Misc/Weather.png diff --git a/Build/Client/SFML.Audio.dll b/Build/Client/SFML.Audio.dll new file mode 100644 index 00000000..a93b12c6 Binary files /dev/null and b/Build/Client/SFML.Audio.dll differ diff --git a/Build/Client/SFML.Graphics.dll b/Build/Client/SFML.Graphics.dll new file mode 100644 index 00000000..927d8aab Binary files /dev/null and b/Build/Client/SFML.Graphics.dll differ diff --git a/Build/Client/SFML.System.dll b/Build/Client/SFML.System.dll new file mode 100644 index 00000000..1cd8ded8 Binary files /dev/null and b/Build/Client/SFML.System.dll differ diff --git a/Build/Client/SFML.Window.dll b/Build/Client/SFML.Window.dll new file mode 100644 index 00000000..ec4d631f Binary files /dev/null and b/Build/Client/SFML.Window.dll differ diff --git a/Build/Client/csfml-audio-2.dll b/Build/Client/csfml-audio-2.dll deleted file mode 100644 index 6ac8dbc5..00000000 Binary files a/Build/Client/csfml-audio-2.dll and /dev/null differ diff --git a/Build/Client/csfml-audio.dll b/Build/Client/csfml-audio.dll new file mode 100644 index 00000000..1c54231c Binary files /dev/null and b/Build/Client/csfml-audio.dll differ diff --git a/Build/Client/csfml-graphics-2.dll b/Build/Client/csfml-graphics-2.dll deleted file mode 100644 index 4f32048f..00000000 Binary files a/Build/Client/csfml-graphics-2.dll and /dev/null differ diff --git a/Build/Client/csfml-graphics.dll b/Build/Client/csfml-graphics.dll new file mode 100644 index 00000000..f55ca73f Binary files /dev/null and b/Build/Client/csfml-graphics.dll differ diff --git a/Build/Client/csfml-system.dll b/Build/Client/csfml-system.dll new file mode 100644 index 00000000..22f4e001 Binary files /dev/null and b/Build/Client/csfml-system.dll differ diff --git a/Build/Client/csfml-window-2.dll b/Build/Client/csfml-window-2.dll deleted file mode 100644 index 427c9679..00000000 Binary files a/Build/Client/csfml-window-2.dll and /dev/null differ diff --git a/Build/Client/csfml-window.dll b/Build/Client/csfml-window.dll new file mode 100644 index 00000000..3713c747 Binary files /dev/null and b/Build/Client/csfml-window.dll differ diff --git a/Build/Client/libsndfile-1.dll b/Build/Client/libsndfile-1.dll deleted file mode 100644 index 75acaa14..00000000 Binary files a/Build/Client/libsndfile-1.dll and /dev/null differ diff --git a/Build/Client/openal32.dll b/Build/Client/openal32.dll index 6a8990c0..40b2aa0f 100644 Binary files a/Build/Client/openal32.dll and b/Build/Client/openal32.dll differ diff --git a/Build/Client/sfmlnet-audio-2.dll b/Build/Client/sfmlnet-audio-2.dll deleted file mode 100644 index 2db98ee3..00000000 Binary files a/Build/Client/sfmlnet-audio-2.dll and /dev/null differ diff --git a/Build/Client/sfmlnet-graphics-2.dll b/Build/Client/sfmlnet-graphics-2.dll deleted file mode 100644 index 632b1dad..00000000 Binary files a/Build/Client/sfmlnet-graphics-2.dll and /dev/null differ diff --git a/Build/Client/sfmlnet-window-2.dll b/Build/Client/sfmlnet-window-2.dll deleted file mode 100644 index 9a26dcd1..00000000 Binary files a/Build/Client/sfmlnet-window-2.dll and /dev/null differ diff --git a/Build/Editors/Editors.exe b/Build/Editors/Editors.exe index d8418a42..792012e7 100644 Binary files a/Build/Editors/Editors.exe and b/Build/Editors/Editors.exe differ diff --git a/Build/Editors/Lidgren.Network.dll b/Build/Editors/Lidgren.Network.dll index 68fd1337..e253f4a0 100644 Binary files a/Build/Editors/Lidgren.Network.dll and b/Build/Editors/Lidgren.Network.dll differ diff --git a/Build/Editors/Options.dat b/Build/Editors/Options.dat new file mode 100644 index 00000000..f550eb70 Binary files /dev/null and b/Build/Editors/Options.dat differ diff --git a/Build/Editors/SFML.Audio.dll b/Build/Editors/SFML.Audio.dll new file mode 100644 index 00000000..a93b12c6 Binary files /dev/null and b/Build/Editors/SFML.Audio.dll differ diff --git a/Build/Editors/SFML.Graphics.dll b/Build/Editors/SFML.Graphics.dll new file mode 100644 index 00000000..927d8aab Binary files /dev/null and b/Build/Editors/SFML.Graphics.dll differ diff --git a/Build/Editors/SFML.System.dll b/Build/Editors/SFML.System.dll new file mode 100644 index 00000000..1cd8ded8 Binary files /dev/null and b/Build/Editors/SFML.System.dll differ diff --git a/Build/Editors/SFML.Window.dll b/Build/Editors/SFML.Window.dll new file mode 100644 index 00000000..ec4d631f Binary files /dev/null and b/Build/Editors/SFML.Window.dll differ diff --git a/Build/Editors/csfml-audio-2.dll b/Build/Editors/csfml-audio-2.dll deleted file mode 100644 index 6ac8dbc5..00000000 Binary files a/Build/Editors/csfml-audio-2.dll and /dev/null differ diff --git a/Build/Editors/csfml-audio.dll b/Build/Editors/csfml-audio.dll new file mode 100644 index 00000000..1c54231c Binary files /dev/null and b/Build/Editors/csfml-audio.dll differ diff --git a/Build/Editors/csfml-graphics-2.dll b/Build/Editors/csfml-graphics-2.dll deleted file mode 100644 index 4f32048f..00000000 Binary files a/Build/Editors/csfml-graphics-2.dll and /dev/null differ diff --git a/Build/Editors/csfml-graphics.dll b/Build/Editors/csfml-graphics.dll new file mode 100644 index 00000000..f55ca73f Binary files /dev/null and b/Build/Editors/csfml-graphics.dll differ diff --git a/Build/Editors/csfml-system.dll b/Build/Editors/csfml-system.dll new file mode 100644 index 00000000..22f4e001 Binary files /dev/null and b/Build/Editors/csfml-system.dll differ diff --git a/Build/Editors/csfml-window-2.dll b/Build/Editors/csfml-window-2.dll deleted file mode 100644 index 427c9679..00000000 Binary files a/Build/Editors/csfml-window-2.dll and /dev/null differ diff --git a/Build/Editors/csfml-window.dll b/Build/Editors/csfml-window.dll new file mode 100644 index 00000000..3713c747 Binary files /dev/null and b/Build/Editors/csfml-window.dll differ diff --git a/Build/Editors/libsndfile-1.dll b/Build/Editors/libsndfile-1.dll deleted file mode 100644 index 75acaa14..00000000 Binary files a/Build/Editors/libsndfile-1.dll and /dev/null differ diff --git a/Build/Editors/openal32.dll b/Build/Editors/openal32.dll index 6a8990c0..40b2aa0f 100644 Binary files a/Build/Editors/openal32.dll and b/Build/Editors/openal32.dll differ diff --git a/Build/Editors/sfmlnet-audio-2.dll b/Build/Editors/sfmlnet-audio-2.dll deleted file mode 100644 index 2db98ee3..00000000 Binary files a/Build/Editors/sfmlnet-audio-2.dll and /dev/null differ diff --git a/Build/Editors/sfmlnet-graphics-2.dll b/Build/Editors/sfmlnet-graphics-2.dll deleted file mode 100644 index 632b1dad..00000000 Binary files a/Build/Editors/sfmlnet-graphics-2.dll and /dev/null differ diff --git a/Build/Editors/sfmlnet-window-2.dll b/Build/Editors/sfmlnet-window-2.dll deleted file mode 100644 index 9a26dcd1..00000000 Binary files a/Build/Editors/sfmlnet-window-2.dll and /dev/null differ diff --git a/Build/Server/Data/Classes/1.dat b/Build/Server/Data/Classes/1.dat index 2fd1b6ea..de035930 100644 Binary files a/Build/Server/Data/Classes/1.dat and b/Build/Server/Data/Classes/1.dat differ diff --git a/Build/Server/Data/Classes/2.dat b/Build/Server/Data/Classes/2.dat index 849df1a8..52662414 100644 Binary files a/Build/Server/Data/Classes/2.dat and b/Build/Server/Data/Classes/2.dat differ diff --git a/Build/Server/Data/Classes/3.dat b/Build/Server/Data/Classes/3.dat new file mode 100644 index 00000000..fa2c44f1 Binary files /dev/null and b/Build/Server/Data/Classes/3.dat differ diff --git a/Build/Server/Data/General.dat b/Build/Server/Data/General.dat index fd7f01a6..e5a22d41 100644 Binary files a/Build/Server/Data/General.dat and b/Build/Server/Data/General.dat differ diff --git a/Build/Server/Data/Items/1.dat b/Build/Server/Data/Items/1.dat index 997cb214..6a0ee9b6 100644 Binary files a/Build/Server/Data/Items/1.dat and b/Build/Server/Data/Items/1.dat differ diff --git a/Build/Server/Data/Items/2.dat b/Build/Server/Data/Items/2.dat index 3397bff0..5a354625 100644 Binary files a/Build/Server/Data/Items/2.dat and b/Build/Server/Data/Items/2.dat differ diff --git a/Build/Server/Data/Items/3.dat b/Build/Server/Data/Items/3.dat index b10584aa..906fc78e 100644 Binary files a/Build/Server/Data/Items/3.dat and b/Build/Server/Data/Items/3.dat differ diff --git a/Build/Server/Data/Items/4.dat b/Build/Server/Data/Items/4.dat index 0c6e4468..e16938ef 100644 Binary files a/Build/Server/Data/Items/4.dat and b/Build/Server/Data/Items/4.dat differ diff --git a/Build/Server/Data/Items/5.dat b/Build/Server/Data/Items/5.dat index 1d7b984b..f2c4d0b6 100644 Binary files a/Build/Server/Data/Items/5.dat and b/Build/Server/Data/Items/5.dat differ diff --git a/Build/Server/Data/Items/6.dat b/Build/Server/Data/Items/6.dat index 11593ea9..f28cf23e 100644 Binary files a/Build/Server/Data/Items/6.dat and b/Build/Server/Data/Items/6.dat differ diff --git a/Build/Server/Data/Items/7.dat b/Build/Server/Data/Items/7.dat index 764f4b7e..967eec03 100644 Binary files a/Build/Server/Data/Items/7.dat and b/Build/Server/Data/Items/7.dat differ diff --git a/Build/Server/Data/Maps/1.dat b/Build/Server/Data/Maps/1.dat index 77256f93..9782e67f 100644 Binary files a/Build/Server/Data/Maps/1.dat and b/Build/Server/Data/Maps/1.dat differ diff --git a/Build/Server/Data/Maps/2.dat b/Build/Server/Data/Maps/2.dat new file mode 100644 index 00000000..bdae0588 Binary files /dev/null and b/Build/Server/Data/Maps/2.dat differ diff --git a/Build/Server/Data/NPCs/1.dat b/Build/Server/Data/NPCs/1.dat index 6c5b71a1..c971c13d 100644 Binary files a/Build/Server/Data/NPCs/1.dat and b/Build/Server/Data/NPCs/1.dat differ diff --git a/Build/Server/Data/NPCs/2.dat b/Build/Server/Data/NPCs/2.dat index ad82bad4..ab01708b 100644 Binary files a/Build/Server/Data/NPCs/2.dat and b/Build/Server/Data/NPCs/2.dat differ diff --git a/Build/Server/Data/NPCs/3.dat b/Build/Server/Data/NPCs/3.dat new file mode 100644 index 00000000..32452835 Binary files /dev/null and b/Build/Server/Data/NPCs/3.dat differ diff --git a/Build/Server/Data/NPCs/4.dat b/Build/Server/Data/NPCs/4.dat new file mode 100644 index 00000000..5e42793e Binary files /dev/null and b/Build/Server/Data/NPCs/4.dat differ diff --git a/Build/Server/Server.exe b/Build/Server/Server.exe index 1634f6d1..03d80a76 100644 Binary files a/Build/Server/Server.exe and b/Build/Server/Server.exe differ diff --git a/README.md b/README.md index 6ad7939e..8529e591 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@

- +

-CryBits is a completely open-source 2D ORPG game engine written in C#. +CryBits is a completely open-source 2D ORPG game engine written in C#. -## Images +[![GitHub version](https://badge.fury.io/gh/ricardodalarme%2FCryBits.svg)](https://travis-ci.org/ricardodalarme/CryBits) + +## Screenshots

- +

-## Development +## Contributing +Pull requests are very welcome. You can check the project [roadmap page](https://github.com/ricardodalarme/CryBits/projects/) to check the planned resources to try to implement them. For other changes, please open an issue first to discuss what you would like to change. Bug fixes are always welcome too. -You can monitor the roadmap for the next versions at https://github.com/ricardodalarme/CryBits/projects/ and the checkout in the Development branch +## Support +For help you can access the [official project page](https://www.ascensiongamedev.com/topic/2588-c-crybits-v060/), start a discussion or even send me an [email](ricardoweasley@hotmail.com), I am always able to help! \ No newline at end of file diff --git a/Source/Client/Client.csproj b/Source/Client/Client.csproj index e1f7b561..7d62ef41 100644 --- a/Source/Client/Client.csproj +++ b/Source/Client/Client.csproj @@ -8,7 +8,7 @@ WinExe Client Client - v4.6 + v4.8 512 true @@ -44,20 +44,29 @@ ..\..\Build\Client\Lidgren.Network.dll - - ..\..\Build\Client\sfmlnet-audio-2.dll + + False + ..\..\Dev\Referências\SFML.Audio.dll - - ..\..\Build\Client\sfmlnet-graphics-2.dll + + False + ..\..\Dev\Referências\SFML.Graphics.dll - - ..\..\Build\Client\sfmlnet-window-2.dll + + False + ..\..\Dev\Referências\SFML.System.dll + + + False + ..\..\Dev\Referências\SFML.Window.dll + + @@ -80,18 +89,6 @@ - - Form - - - Window.cs - - - - - - - \ No newline at end of file diff --git a/Source/Client/Interface/Buttons.cs b/Source/Client/Interface/Buttons.cs index c175de39..dbc6863b 100644 --- a/Source/Client/Interface/Buttons.cs +++ b/Source/Client/Interface/Buttons.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using SFML.Window; +using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; @@ -16,10 +17,8 @@ public class Structure : Tools.Structure public void MouseUp() { - SFML.Graphics.Texture Texture = Graphics.Tex_Button[Texture_Num]; - // Somente se necessário - if (!Tools.IsAbove(new Rectangle(Position, Graphics.TSize(Texture)))) return; + if (!Tools.IsAbove(new Rectangle(Position, Graphics.TSize(Graphics.Tex_Button[Texture_Num])))) return; // Altera o estado do botão Audio.Sound.Play(Audio.Sounds.Click); @@ -29,27 +28,20 @@ public void MouseUp() Execute(Name); } - public void MouseDown(MouseEventArgs e) + public void MouseDown(MouseButtonEventArgs e) { - SFML.Graphics.Texture Texture = Graphics.Tex_Button[Texture_Num]; - // Somente se necessário - if (e.Button == MouseButtons.Right) return; - if (!Tools.IsAbove(new Rectangle(Position, Graphics.TSize(Texture)))) return; + if (e.Button == Mouse.Button.Right) return; + if (!Tools.IsAbove(new Rectangle(Position, Graphics.TSize(Graphics.Tex_Button[Texture_Num])))) return; // Altera o estado do botão State = States.Click; } - public void MouseMove(MouseEventArgs e) + public void MouseMove() { - SFML.Graphics.Texture Texture = Graphics.Tex_Button[Texture_Num]; - - // Somente se necessário - if (e.Button == MouseButtons.Right) return; - // Se o mouse não estiver sobre a ferramenta, então não executar o evento - if (!Tools.IsAbove(new Rectangle(Position, Graphics.TSize(Texture)))) + if (!Tools.IsAbove(new Rectangle(Position, Graphics.TSize(Graphics.Tex_Button[Texture_Num])))) { State = States.Normal; return; @@ -74,15 +66,11 @@ public enum States public static Structure Get(string Name) { - // Lista os nomes das ferramentas - for (byte i = 0; i < List.Count; i++) - if (List[i].Name.Equals(Name)) - return List[i]; - - return null; + // Retorna o botão procurado + return List.Find(x => x.Name.Equals(Name)); } - public static void Execute(string Name) + private static void Execute(string Name) { // Executa o evento do botão switch (Name) @@ -94,8 +82,10 @@ public static void Execute(string Name) case "Connect_Confirm": Connect_Ok(); break; case "Register_Confirm": Register_Ok(); break; case "CreateCharacter": CreateCharacter(); break; - case "CreateCharacter_ChangeRight": CreateCharacter_Change_Right(); break; - case "CreateCharacter_ChangeLeft": CreateCharacter_Change_Left(); break; + case "CreateCharacter_ChangeRight": CreateCharacter_ChangeRight(); break; + case "CreateCharacter_ChangeLeft": CreateCharacter_ChangeLeft(); break; + case "CreateCharacter_Texture_ChangeLeft": CreateCharacter_Texture_ChangeLeft(); break; + case "CreateCharacter_Texture_ChangeRight": CreateCharacter_Texture_ChangeRight(); break; case "CreateCharacter_Back": CreateCharacter_Return(); break; case "Character_Use": Character_Use(); break; case "Character_Create": Character_Create(); break; @@ -112,24 +102,24 @@ public static void Execute(string Name) case "Attributes_Vitality": Attribute_Vitality(); break; case "Menu_Inventory": Menu_Inventory(); break; case "Menu_Options": Menu_Options(); break; + case "Drop_Confirm": Drop_Confirm(); break; + case "Drop_Cancel": Drop_Cancel(); break; + case "Party_Yes": Party_Yes(); break; + case "Party_No": Party_No(); break; } } public static bool Characters_Change_Buttons() { - bool Visibility = true; - - // Verifica apenas se o painel for visível - if (Lists.Characters == null || Lists.Characters[Game.SelectCharacter].Class == 0) Visibility = false; - // Altera os botões visíveis + bool Visibility = Lists.Characters != null && Lists.Characters[Game.SelectCharacter].Class > 0; Get("Character_Create").Visible = !Visibility; Get("Character_Delete").Visible = Visibility; Get("Character_Use").Visible = Visibility; return Visibility; } - public static void Connect() + private static void Connect() { // Termina a conexão Socket.Disconnect(); @@ -139,7 +129,7 @@ public static void Connect() Panels.Get("Connect").Visible = true; } - public static void Register() + private static void Register() { // Termina a conexão Socket.Disconnect(); @@ -149,17 +139,21 @@ public static void Register() Panels.Get("Register").Visible = true; } - public static void Options() + private static void Options() { // Termina a conexão Socket.Disconnect(); + // Define as marcações corretas + CheckBoxes.Get("Sounds").Checked = Lists.Options.Sounds; + CheckBoxes.Get("Musics").Checked = Lists.Options.Musics; + // Abre o painel Panels.Menu_Close(); Panels.Get("Options").Visible = true; } - public static void Menu_Return() + private static void Menu_Return() { // Termina a conexão Socket.Disconnect(); @@ -169,7 +163,7 @@ public static void Menu_Return() Panels.Get("Connect").Visible = true; } - public static void Connect_Ok() + private static void Connect_Ok() { // Salva o nome do usuário Lists.Options.Username = TextBoxes.Get("Connect_Username").Text; @@ -179,7 +173,7 @@ public static void Connect_Ok() Game.SetSituation(Game.Situations.Connect); } - public static void Register_Ok() + private static void Register_Ok() { // Regras de segurança if (TextBoxes.Get("Register_Password").Text != TextBoxes.Get("Register_Password2").Text) @@ -192,13 +186,13 @@ public static void Register_Ok() Game.SetSituation(Game.Situations.Registrar); } - public static void CreateCharacter() + private static void CreateCharacter() { // Abre a criação de personagem Game.SetSituation(Game.Situations.CreateCharacter); } - public static void CreateCharacter_Change_Right() + private static void CreateCharacter_ChangeRight() { // Altera a classe selecionada pelo jogador if (Game.CreateCharacter_Class == Lists.Class.GetUpperBound(0)) @@ -207,7 +201,7 @@ public static void CreateCharacter_Change_Right() Game.CreateCharacter_Class += 1; } - public static void CreateCharacter_Change_Left() + private static void CreateCharacter_ChangeLeft() { // Altera a classe selecionada pelo jogador if (Game.CreateCharacter_Class == 1) @@ -216,32 +210,64 @@ public static void CreateCharacter_Change_Left() Game.CreateCharacter_Class -= 1; } - public static void CreateCharacter_Return() + private static void CreateCharacter_Texture_ChangeRight() + { + // Lista de texturas + short[] Tex_List; + if (CheckBoxes.Get("GenderMale").Checked == true) + Tex_List = Lists.Class[Game.CreateCharacter_Class].Tex_Male; + else + Tex_List = Lists.Class[Game.CreateCharacter_Class].Tex_Female; + + // Altera a classe selecionada pelo jogador + if (Game.CreateCharacter_Tex == Tex_List.Length - 1) + Game.CreateCharacter_Tex = 0; + else + Game.CreateCharacter_Tex += 1; + } + + private static void CreateCharacter_Texture_ChangeLeft() + { + // Lista de texturas + short[] Tex_List; + if (CheckBoxes.Get("GenderMale").Checked == true) + Tex_List = Lists.Class[Game.CreateCharacter_Class].Tex_Male; + else + Tex_List = Lists.Class[Game.CreateCharacter_Class].Tex_Female; + + // Altera a classe selecionada pelo jogador + if (Game.CreateCharacter_Tex == 0) + Game.CreateCharacter_Tex = (byte)(Tex_List.Length - 1); + else + Game.CreateCharacter_Tex -= 1; + } + + private static void CreateCharacter_Return() { // Abre o painel de personagens Panels.Menu_Close(); Panels.Get("SelectCharacter").Visible = true; } - public static void Character_Use() + private static void Character_Use() { // Usa o personagem selecionado Send.Character_Use(); } - public static void Character_Delete() + private static void Character_Delete() { // Deleta o personagem selecionado Send.Character_Delete(); } - public static void Character_Create() + private static void Character_Create() { // Abre a criação de personagem Send.Character_Create(); } - public static void Character_Change_Right() + private static void Character_Change_Right() { // Altera o personagem selecionado pelo jogador if (Game.SelectCharacter == Lists.Server_Data.Max_Characters) @@ -250,7 +276,7 @@ public static void Character_Change_Right() Game.SelectCharacter += 1; } - public static void Character_Change_Left() + private static void Character_Change_Left() { // Altera o personagem selecionado pelo jogador if (Game.SelectCharacter == 1) @@ -259,21 +285,21 @@ public static void Character_Change_Left() Game.SelectCharacter -= 1; } - public static void Chat_Up() + private static void Chat_Up() { // Sobe as linhas do chat - if (Tools.Chat_Line > 0) - Tools.Chat_Line -= 1; + if (Chat.Lines_First > 0) + Chat.Lines_First -= 1; } - public static void Chat_Down() + private static void Chat_Down() { // Sobe as linhas do chat - if (Tools.Chat.Count - 1 - Tools.Chat_Line - Tools.Chat_Lines_Visible > 0) - Tools.Chat_Line += 1; + if (Chat.Order.Count - 1 - Chat.Lines_First - Chat.Lines_Visible > 0) + Chat.Lines_First += 1; } - public static void Menu_Character() + private static void Menu_Character() { // Altera a visibilidade do painel e fecha os outros Panels.Get("Menu_Character").Visible = !Panels.Get("Menu_Character").Visible; @@ -281,32 +307,32 @@ public static void Menu_Character() Panels.Get("Menu_Options").Visible = false; } - public static void Attribute_Strenght() + private static void Attribute_Strenght() { Send.AddPoint(Game.Attributes.Strength); } - public static void Attribute_Resistance() + private static void Attribute_Resistance() { Send.AddPoint(Game.Attributes.Resistance); } - public static void Attribute_Intelligence() + private static void Attribute_Intelligence() { Send.AddPoint(Game.Attributes.Intelligence); } - public static void Attribute_Agility() + private static void Attribute_Agility() { Send.AddPoint(Game.Attributes.Agility); } - public static void Attribute_Vitality() + private static void Attribute_Vitality() { Send.AddPoint(Game.Attributes.Vitality); } - public static void Menu_Inventory() + private static void Menu_Inventory() { // Altera a visibilidade do painel e fecha os outros Panels.Get("Menu_Inventory").Visible = !Panels.Get("Menu_Inventory").Visible; @@ -314,11 +340,48 @@ public static void Menu_Inventory() Panels.Get("Menu_Options").Visible = false; } - public static void Menu_Options() + private static void Menu_Options() { // Altera a visibilidade do painel e fecha os outros Panels.Get("Menu_Options").Visible = !Panels.Get("Menu_Options").Visible; Panels.Get("Menu_Character").Visible = false; Panels.Get("Menu_Inventory").Visible = false; } + + private static void Drop_Confirm() + { + // Quantidade + short.TryParse(TextBoxes.Get("Drop_Amount").Text, out short Amount); + + // Verifica se o valor digitado é válidp + if (Amount == 0) + { + MessageBox.Show("Enter a valid value!"); + return; + } + + // Solta o item + Send.DropItem(Game.Drop_Slot, Amount); + Panels.Get("Drop").Visible = false; + } + + private static void Drop_Cancel() + { + // Fecha o painel + Panels.Get("Drop").Visible = false; + } + + private static void Party_Yes() + { + // Aceita o grupo e fecha o painel + Send.Party_Accept(); + Panels.Get("Party_Invitation").Visible = false; + } + + private static void Party_No() + { + // Fecha o painel + Send.Party_Decline(); + Panels.Get("Party_Invitation").Visible = false; + } } \ No newline at end of file diff --git a/Source/Client/Interface/Chat.cs b/Source/Client/Interface/Chat.cs new file mode 100644 index 00000000..5aae4004 --- /dev/null +++ b/Source/Client/Interface/Chat.cs @@ -0,0 +1,139 @@ +using SFML.Graphics; +using System.Collections.Generic; + +class Chat +{ + // Ordem de renderização + public static List Order = new List(); + + // Chat + public static bool Text_Visible; + public const byte Lines_Visible = 9; + public static byte Lines_First; + private const byte Max_Lines = 50; + + // Estrutura do chat + public class Structure + { + public string Text; + public Color Color; + } + + private static void AddLine(string Text, Color Color) + { + Order.Add(new Structure()); + int i = Order.Count - 1; + + // Adiciona a mensagem em uma linha vazia + Order[i].Text = Text; + Order[i].Color = Color; + + // Remove uma linha se necessário + if (Order.Count > Max_Lines) Order.Remove(Order[0]); + if (i + Lines_First > Lines_Visible + Lines_First) + Lines_First = (byte)(i - Lines_Visible); + + // Torna as linhas visíveis + Text_Visible = true; + } + + public static void AddText(string Message, Color Color) + { + int Message_Width, Box_Width = Graphics.TSize(Graphics.Tex_Panel[Panels.Get("Chat").Texture_Num]).Width - 16; + string Temp_Message; + + // Remove os espaços + Message = Message.Trim(); + Message_Width = Tools.MeasureString(Message); + + // Caso couber, adiciona a mensagem normalmente + if (Message_Width < Box_Width) + AddLine(Message, Color); + else + for (int i = 0; i <= Message.Length; i++) + { + Temp_Message = Message.Substring(0, i); + + // Adiciona o texto à caixa + if (Tools.MeasureString(Temp_Message) > Box_Width) + { + AddLine(Temp_Message, Color); + AddText(Message.Substring(Temp_Message.Length), Color); + return; + } + } + } + + public static void Type() + { + TextBoxes.Structure Tool = TextBoxes.Get("Chat"); + Panels.Structure Panel = Panels.Get("Chat"); + + // Somente se necessário + if (!Player.IsPlaying(Player.MyIndex)) return; + + // Altera a visiblidade da caixa + Panel.Visible = !Panel.Visible; + + // Altera o foco do digitalizador + if (Panel.Visible) + { + Text_Visible = true; + TextBoxes.Focused = Tools.Get(Tool); + return; + } + else + TextBoxes.Focused = null; + + // Dados + string Message = Tool.Text; + + // Somente se necessário + if (Message.Length < 3) + { + Tool.Text = string.Empty; + return; + } + + // Limpa a caixa de texto + Tool.Text = string.Empty; + + // Separa as mensagens em partes + string[] Parts = Message.Split(' '); + + // Comandos + switch (Parts[0].ToLower()) + { + case "/party": + if (Parts.Length > 1) Send.Party_Invite(Parts[1]); + break; + case "/partyleave": + Send.Party_Leave(); + break; + default: + // Mensagem lobal + if (Message.Substring(0, 1) == "'") + Send.Message(Message.Substring(1), Game.Messages.Global); + // Mensagem particular + else if (Message.Substring(0, 1) == "!") + { + // Previne erros + if (Parts.GetUpperBound(0) < 1) + AddText("Use: '!' + Addressee + 'Message'", Color.White); + else + { + // Dados + string Destiny = Message.Substring(1, Parts[0].Length - 1); + Message = Message.Substring(Parts[0].Length + 1); + + // Envia a mensagem + Send.Message(Message, Game.Messages.Private, Destiny); + } + } + // Mensagem mapa + else + Send.Message(Message, Game.Messages.Map); + break; + } + } +} \ No newline at end of file diff --git a/Source/Client/Interface/CheckBoxes.cs b/Source/Client/Interface/CheckBoxes.cs index 321de199..82261c03 100644 --- a/Source/Client/Interface/CheckBoxes.cs +++ b/Source/Client/Interface/CheckBoxes.cs @@ -14,21 +14,20 @@ public class Structure : Tools.Structure { // Dados public string Text; - public bool State; + public bool Checked; // Eventos public void MouseUp() { // Tamanho do marcador Size Texture_Size = Graphics.TSize(Graphics.Tex_CheckBox); - int Text_Width = Tools.MeasureString(Text); - Size Box = new Size(Texture_Size.Width / 2 + Text_Width + Margin, Texture_Size.Height); + Size Box = new Size(Texture_Size.Width / 2 + Tools.MeasureString(Text) + Margin, Texture_Size.Height); // Somente se estiver sobrepondo a ferramenta if (!Tools.IsAbove(new Rectangle(Position, Box))) return; // Altera o estado do marcador - State = !State; + Checked = !Checked; // Executa o evento Execute(Name); @@ -38,15 +37,11 @@ public void MouseUp() public static Structure Get(string Name) { - // Lista os nomes das ferramentas - for (byte i = 0; i < List.Count; i++) - if (List[i].Name.Equals(Name)) - return List[i]; - - return null; + // Retorna a caixa de marcação procurada + return List.Find(x => x.Name.Equals(Name)); } - public static void Execute(string Name) + private static void Execute(string Name) { // Executa o evento do marcador switch (Name) @@ -58,10 +53,11 @@ public static void Execute(string Name) case "GenderFemale": GenreFemale(); break; case "Options_Sounds": Sounds(); break; case "Options_Musics": Musics(); break; + case "Options_Chat": Chat(); break; } } - - public static void Sounds() + + private static void Sounds() { // Salva os dados Lists.Options.Sounds = !Lists.Options.Sounds; @@ -69,7 +65,7 @@ public static void Sounds() Write.Options(); } - public static void Musics() + private static void Musics() { // Salva os dados Lists.Options.Musics = !Lists.Options.Musics; @@ -84,22 +80,31 @@ public static void Musics() Audio.Music.Play((Audio.Musics)Lists.Map.Music); } - public static void SaveUsername() + private static void SaveUsername() { // Salva os dados - Lists.Options.SaveUsername = Get("Connect_Save_Username").State; + Lists.Options.SaveUsername = Get("Connect_Save_Username").Checked; Write.Options(); } - public static void GenreName() + private static void GenreName() { // Altera o estado do marcador de outro gênero - Get("GenderFemale").State = !Get("GenderMale").State; + Get("GenderFemale").Checked = !Get("GenderMale").Checked; + Game.CreateCharacter_Tex = 0; } - public static void GenreFemale() + private static void GenreFemale() { // Altera o estado do marcador de outro gênero - Get("GenderMale").State = !Get("GenderFemale").State; + Get("GenderMale").Checked = !Get("GenderFemale").Checked; + Game.CreateCharacter_Tex = 0; + } + + private static void Chat() + { + // Desabilita a prévia do chat + Lists.Options.Chat = global::Chat.Text_Visible = Get("Options_Chat").Checked; + Write.Options(); } } \ No newline at end of file diff --git a/Source/Client/Interface/Panels.cs b/Source/Client/Interface/Panels.cs index 3bad7c5e..09bf4f15 100644 --- a/Source/Client/Interface/Panels.cs +++ b/Source/Client/Interface/Panels.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System.Drawing; +using System.Collections.Generic; class Panels { @@ -13,12 +14,8 @@ public class Structure : Tools.Structure public static Structure Get(string Name) { - // Lista os nomes das ferramentas - for (byte i = 0; i < List.Count; i++) - if (List[i].Name.Equals(Name)) - return List[i]; - - return null; + // Retorna o painel procurado + return List.Find(x => x.Name.Equals(Name)); } public static void Menu_Close() @@ -30,4 +27,100 @@ public static void Menu_Close() Get("SelectCharacter").Visible = false; Get("CreateCharacter").Visible = false; } + + public static byte Inventory_Mouse() + { + byte NumColumn = 5; + Point Panel_Position = Get("Menu_Inventory").Position; + + for (byte i = 1; i <= Game.Max_Inventory; i++) + { + // Posição do item + byte Line = (byte)((i - 1) / NumColumn); + int Column = i - (Line * 5) - 1; + Point Position = new Point(Panel_Position.X + 7 + Column * 36, Panel_Position.Y + 30 + Line * 36); + + // Retorna o slot em que o mouse está por cima + if (Tools.IsAbove(new Rectangle(Position.X, Position.Y, 32, 32))) return i; + } + + return 0; + } + + public static void Inventory_MouseDown(SFML.Window.MouseButtonEventArgs e) + { + byte Slot = Inventory_Mouse(); + + // Somente se necessário + if (Slot == 0) return; + if (Player.Inventory[Slot].Item_Num == 0) return; + + // Solta item + if (e.Button == SFML.Window.Mouse.Button.Right) + { + if (Lists.Item[Player.Inventory[Slot].Item_Num].Bind != Game.BindOn.Pickup) + if (Player.Inventory[Slot].Amount != 1) + { + Game.Drop_Slot = Slot; + TextBoxes.Get("Drop_Amount").Text = string.Empty; + Get("Drop").Visible = true; + } + else Send.DropItem(Slot, 1); + } + // Seleciona o item + else if (e.Button == SFML.Window.Mouse.Button.Left) Player.Inventory_Change = Slot; + } + + public static void Equipment_MouseDown(SFML.Window.MouseButtonEventArgs e) + { + Point Panel_Position = Get("Menu_Character").Position; + + for (byte i = 0; i < (byte)Game.Equipments.Count; i++) + if (Tools.IsAbove(new Rectangle(Panel_Position.X + 7 + i * 36, Panel_Position.Y + 247, 32, 32))) + // Remove o equipamento + if (e.Button == SFML.Window.Mouse.Button.Right) + if (Lists.Item[Player.Me.Equipment[i]].Bind != Game.BindOn.Equip) + { + Send.Equipment_Remove(i); + return; + } + } + + public static byte Hotbar_Mouse() + { + Point Panel_Position = Get("Hotbar").Position; + + for (byte i = 1; i <= Game.Max_Hotbar; i++) + { + // Posição do slot + Point Position = new Point(Panel_Position.X + 8 + (i - 1) * 36, Panel_Position.Y + 6); + + // Retorna o slot em que o mouse está por cima + if (Tools.IsAbove(new Rectangle(Position.X, Position.Y, 32, 32))) return i; + } + + return 0; + } + + public static void Hotbar_MouseDown(SFML.Window.MouseButtonEventArgs e) + { + byte Slot = Hotbar_Mouse(); + + // Somente se necessário + if (Slot == 0) return; + if (Player.Hotbar[Slot].Slot == 0) return; + + // Solta item + if (e.Button == SFML.Window.Mouse.Button.Right) + { + Send.Hotbar_Add(Slot, 0, 0); + return; + } + // Seleciona o item + else if (e.Button == SFML.Window.Mouse.Button.Left) + { + Player.Hotbar_Change = Slot; + return; + } + } } \ No newline at end of file diff --git a/Source/Client/Interface/TextBoxes.cs b/Source/Client/Interface/TextBoxes.cs index 2a7dbb77..0e5fdf05 100644 --- a/Source/Client/Interface/TextBoxes.cs +++ b/Source/Client/Interface/TextBoxes.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; +using SFML.Window; +using System.Collections.Generic; using System.Drawing; -using System.Windows.Forms; class TextBoxes { @@ -32,19 +32,19 @@ public void MouseUp(Tools.Order_Structure Order) // Altera o foco do digitalizador if (((Structure)Order.Data).Name.Equals("Chat")) { - Tools.Chat_Text_Visible = true; + Chat.Text_Visible = true; Panels.Get("Chat").Visible = true; } } - public void KeyPress(KeyPressEventArgs e) + public void TextEntered(TextEventArgs e) { // Apaga a última letra do texto if (Tools.Viewable(Tools.Get(this))) { if (!string.IsNullOrEmpty(Text)) { - if (e.KeyChar == '\b' && Text.Length > 0) + if (e.Unicode == "\b" && Text.Length > 0) { Text = Text.Remove(Text.Length - 1); return; @@ -55,21 +55,17 @@ public void KeyPress(KeyPressEventArgs e) if (Text.Length >= Lenght) return; } - - // Adiciona apenas os caractres válidos ao digitalizador - if (e.KeyChar >= 32 && e.KeyChar <= 126) Text += e.KeyChar.ToString(); + + // Adiciona o caracter à caixa de texto + if (char.IsLetterOrDigit(e.Unicode,0)) Text += e.Unicode; } } } public static Structure Get(string Name) { - // Lista os nomes das ferramentas - for (byte i = 0; i < List.Count; i++) - if (List[i].Name.Equals(Name)) - return List[i]; - - return null; + // Retorna a caixa de texto procurada + return List.Find(x => x.Name.Equals(Name)); } public static void Focus() @@ -96,6 +92,7 @@ public static void Focus() Stack.Push(Top[i].Nodes); } } + Focused = null; } public static void ChangeFocus() @@ -117,65 +114,4 @@ public static void ChangeFocus() Temp++; } } - - public static void Chat_Type() - { - Structure Tool = Get("Chat"); - Panels.Structure Panel = Panels.Get("Chat"); - - // Somente se necessário - if (!Player.IsPlaying(Player.MyIndex)) return; - - // Altera a visiblidade da caixa - Panel.Visible = !Panel.Visible; - - // Altera o foco do digitalizador - if (Panel.Visible) - { - Tools.Chat_Text_Visible = true; - Focused = Tools.Get(Tool); - return; - } - else - Focused = null; - - // Dados - string Message = Tool.Text; - - // Somente se necessário - if (Message.Length < 3) - { - Tool.Text = string.Empty; - return; - } - - // Separa as mensagens em partes - string[] Parts = Message.Split(' '); - - // Global - if (Message.Substring(0, 1) == "'") - Send.Message(Message.Substring(1), Game.Messages.Global); - // Particular - else if (Message.Substring(0, 1) == "!") - { - // Previne erros - if (Parts.GetUpperBound(0) < 1) - Tools.Chat_Add("Use: '!' + Addressee + 'Message'", SFML.Graphics.Color.White); - else - { - // Dados - string Destinatário = Message.Substring(1, Parts[0].Length - 1); - Message = Message.Substring(Parts[0].Length + 1); - - // Envia a mensagem - Send.Message(Message, Game.Messages.Private, Destinatário); - } - } - // Mapa - else - Send.Message(Message, Game.Messages.Map); - - // Limpa a caixa de texto - Tool.Text = string.Empty; - } } \ No newline at end of file diff --git a/Source/Client/Interface/Tools.cs b/Source/Client/Interface/Tools.cs index 0a058157..70417e6f 100644 --- a/Source/Client/Interface/Tools.cs +++ b/Source/Client/Interface/Tools.cs @@ -1,24 +1,16 @@ using System.Collections.Generic; using System.Drawing; -using System.Windows.Forms; class Tools { // Posição do ponteiro do mouse public static Point Mouse; - // Janela que está focada + // Janela que está aberta public static Windows CurrentWindow; - // Chat - public static bool Chat_Text_Visible; - public const byte Chat_Lines_Visible = 9; - public static byte Chat_Line; - public const byte Max_Chat_Lines = 50; - // Ordem da renderização das ferramentas public static List[] All_Order = new List[(byte)Windows.Count]; - public static List Chat = new List(); public class Order_Structure { @@ -47,12 +39,6 @@ public static List Order } } - public class Chat_Structure - { - public string Text; - public SFML.Graphics.Color Color; - } - // Identificação das janelas do jogo public enum Windows { @@ -82,6 +68,7 @@ public static bool IsAbove(Rectangle Rectangle) // Se não, retornar um valor nulo return false; } + public static bool Viewable(Order_Structure Order) { // Verifica se a ferramenta está visível @@ -94,7 +81,7 @@ public static bool Viewable(Order_Structure Order) public static Order_Structure Get(Structure Tool) { // Percorre toda a árvore de ordem para encontrar a ferramenta - Stack> Stack = new Stack>(); + Stack> Stack = new Stack>(); for (byte i = 0; i < All_Order.Length; i++) Stack.Push(All_Order[i]); while (Stack.Count != 0) { @@ -102,8 +89,7 @@ public static Order_Structure Get(Structure Tool) for (byte i = 0; i < Top.Count; i++) { - if (Top[i].Data == Tool) - return Top[i]; + if (Top[i].Data == Tool) return Top[i]; Stack.Push(Top[i].Nodes); } } @@ -121,13 +107,12 @@ public static short MeasureString(string Text) public static string TextBreak(string Text, int Width) { // Previne sobrecargas - if (string.IsNullOrEmpty(Text)) - return Text; + if (string.IsNullOrEmpty(Text)) return Text; - // Usado para fazer alguns calculos + // Usado para fazer alguns calculosk int Text_Width = MeasureString(Text); - // Diminui o tamanho do texto até que ele possa caber no digitalizador + // Diminui o tamanho do texto até que ele caiba no digitalizador while (Text_Width - Width >= 0) { Text = Text.Substring(1); @@ -136,154 +121,4 @@ public static string TextBreak(string Text, int Width) return Text; } - - public static void Chat_AddLine(string Mensagem, SFML.Graphics.Color Cor) - { - Chat.Add(new Chat_Structure()); - int i = Chat.Count - 1; - - // Adiciona a mensagem em uma linha vazia - Chat[i].Text = Mensagem; - Chat[i].Color = Cor; - - // Remove uma linha se necessário - if (Chat.Count > Max_Chat_Lines) Chat.Remove(Chat[0]); - if (i + Chat_Line > Chat_Lines_Visible + Chat_Line) - Chat_Line = (byte)(i - Chat_Lines_Visible); - - // Torna as linhas visíveis - Chat_Text_Visible = true; - } - - public static void Chat_Add(string Message, SFML.Graphics.Color Color) - { - int Message_Width, Box_Width = Graphics.TSize(Graphics.Tex_Panel[Panels.Get("Chat").Texture_Num]).Width - 16; - string Temp_Message; int Split; - - // Remove os espaços - Message = Message.Trim(); - Message_Width = MeasureString(Message); - - // Caso couber, adiciona a mensagem normalmente - if (Message_Width < Box_Width) - Chat_AddLine(Message, Color); - else - { - for (int i = 0; i <= Message.Length; i++) - { - // Verifica se o próximo caráctere é um separável - switch (Message[i]) - { - case '-': - case '_': - case ' ': Split = i; break; - } - - Temp_Message = Message.Substring(0, i); - - // Adiciona o texto à caixa - if (MeasureString(Temp_Message) > Box_Width) - { - Chat_AddLine(Temp_Message, Color); - Chat_Add(Message.Substring(Temp_Message.Length), Color); - return; - } - } - } - } - - public static byte Inventory_Mouse() - { - byte NumColumn = 5; - Point Panel_Position = Panels.Get("Menu_Inventory").Position; - - for (byte i = 1; i <= Game.Max_Inventory; i++) - { - // Posição do item - byte Line = (byte)((i - 1) / NumColumn); - int Column = i - (Line * 5) - 1; - Point Position = new Point(Panel_Position.X + 7 + Column * 36, Panel_Position.Y + 30 + Line * 36); - - // Retorna o slot em que o mouse está por cima - if (IsAbove(new Rectangle(Position.X, Position.Y, 32, 32))) - return i; - } - - return 0; - } - - public static void Inventory_MouseDown(MouseEventArgs e) - { - byte Slot = Inventory_Mouse(); - - // Somente se necessário - if (Slot == 0) return; - if (Player.Inventory[Slot].Item_Num == 0) return; - - // Solta item - if (e.Button == MouseButtons.Right) - { - Send.DropItem(Slot); - return; - } - // Seleciona o item - else if (e.Button == MouseButtons.Left) - { - Player.Inventory_Change = Slot; - return; - } - } - - public static void Equipment_MouseDown(MouseEventArgs e) - { - Point Panel_Position = Panels.Get("Menu_Character").Position; - - for (byte i = 0; i < (byte)Game.Equipments.Count; i++) - if (IsAbove(new Rectangle(Panel_Position.X + 7 + i * 36, Panel_Position.Y + 247, 32, 32))) - // Remove o equipamento - if (e.Button == MouseButtons.Right) - { - Send.Equipment_Remove(i); - return; - } - } - - public static byte Hotbar_Mouse() - { - Point Panel_Position = Panels.Get("Hotbar").Position; - - for (byte i = 1; i <= Game.Max_Hotbar; i++) - { - // Posição do slot - Point Position = new Point(Panel_Position.X + 8 + (i - 1) * 36, Panel_Position.Y + 6); - - // Retorna o slot em que o mouse está por cima - if (IsAbove(new Rectangle(Position.X, Position.Y, 32, 32))) - return i; - } - - return 0; - } - - public static void Hotbar_MouseDown(MouseEventArgs e) - { - byte Slot = Hotbar_Mouse(); - - // Somente se necessário - if (Slot == 0) return; - if (Player.Hotbar[Slot].Slot == 0) return; - - // Solta item - if (e.Button == MouseButtons.Right) - { - Send.Hotbar_Add(Slot, 0, 0); - return; - } - // Seleciona o item - else if (e.Button == MouseButtons.Left) - { - Player.Hotbar_Change = Slot; - return; - } - } } \ No newline at end of file diff --git a/Source/Client/Interface/Window.cs b/Source/Client/Interface/Window.cs new file mode 100644 index 00000000..be6391af --- /dev/null +++ b/Source/Client/Interface/Window.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using SFML.Window; + +class Window +{ + // Detecção de duplo clique + private static int DoubleClick_Timer; + + public static void OnClosed(object sender, EventArgs e) + { + // Fecha o jogo + if (Tools.CurrentWindow == Tools.Windows.Game) + Game.Leave(); + else + Program.Working = false; + } + + public static void OnMouseButtonPressed(object sender, MouseButtonEventArgs e) + { + // Clique duplo + if (Environment.TickCount < DoubleClick_Timer + 142) + { + if (Tools.CurrentWindow == Tools.Windows.Game) + { + // Usar item + byte Slot = Panels.Inventory_Mouse(); + if (Slot > 0) + if (Player.Inventory[Slot].Item_Num > 0) + Send.Inventory_Use(Slot); + + // Usar o que estiver na hotbar + Slot = Panels.Hotbar_Mouse(); + if (Slot > 0) + if (Player.Hotbar[Slot].Slot > 0) + Send.Hotbar_Use(Slot); + } + } + // Clique único + else + { + // Percorre toda a árvore de ordem para executar o comando + Stack> Stack = new Stack>(); + Stack.Push(Tools.Order); + while (Stack.Count != 0) + { + List Top = Stack.Pop(); + + for (byte i = 0; i < Top.Count; i++) + if (Top[i].Data.Visible) + { + // Executa o comando + if (Top[i].Data is Buttons.Structure) ((Buttons.Structure)Top[i].Data).MouseDown(e); + Stack.Push(Top[i].Nodes); + } + } + + // Eventos em jogo + if (Tools.CurrentWindow == Tools.Windows.Game) + { + Panels.Inventory_MouseDown(e); + Panels.Equipment_MouseDown(e); + Panels.Hotbar_MouseDown(e); + } + } + } + + public static void OnMouseButtonReleased(object sender, MouseButtonEventArgs e) + { + // Contagem do clique duplo + DoubleClick_Timer = Environment.TickCount; + + // Percorre toda a árvore de ordem para executar o comando + Stack> Stack = new Stack>(); + Stack.Push(Tools.Order); + while (Stack.Count != 0) + { + List Top = Stack.Pop(); + + for (byte i = 0; i < Top.Count; i++) + if (Top[i].Data.Visible) + { + // Executa o comando + if (Top[i].Data is Buttons.Structure) ((Buttons.Structure)Top[i].Data).MouseUp(); + else if (Top[i].Data is CheckBoxes.Structure) ((CheckBoxes.Structure)Top[i].Data).MouseUp(); + else if (Top[i].Data is TextBoxes.Structure) ((TextBoxes.Structure)Top[i].Data).MouseUp(Top[i]); + Stack.Push(Top[i].Nodes); + } + } + + // Eventos em jogo + if (Tools.CurrentWindow == Tools.Windows.Game) + { + // Muda o slot do item + if (Player.Inventory_Change > 0) + if (Panels.Inventory_Mouse() > 0) + Send.Inventory_Change(Player.Inventory_Change, Panels.Inventory_Mouse()); + + // Muda o slot da hotbar + if (Panels.Hotbar_Mouse() > 0) + { + if (Player.Hotbar_Change > 0) Send.Hotbar_Change(Player.Hotbar_Change, Panels.Hotbar_Mouse()); + if (Player.Inventory_Change > 0) Send.Hotbar_Add(Panels.Hotbar_Mouse(), (byte)Game.Hotbar.Item, Player.Inventory_Change); + } + + // Reseta a movimentação + Player.Inventory_Change = 0; + Player.Hotbar_Change = 0; + } + } + + public static void OnMouseMoved(object sender, MouseMoveEventArgs e) + { + // Define a posição do mouse à váriavel + Tools.Mouse.X = e.X; + Tools.Mouse.Y = e.Y; + + // Percorre toda a árvore de ordem para executar o comando + Stack> Stack = new Stack>(); + Stack.Push(Tools.Order); + while (Stack.Count != 0) + { + List Top = Stack.Pop(); + + for (byte i = 0; i < Top.Count; i++) + if (Top[i].Data.Visible) + { + // Executa o comando + if (Top[i].Data is Buttons.Structure) ((Buttons.Structure)Top[i].Data).MouseMove(); + Stack.Push(Top[i].Nodes); + } + } + } + + public static void OnKeyPressed(object sender, KeyEventArgs e) + { + // Define se um botão está sendo pressionado + switch (e.Code) + { + case Keyboard.Key.Tab: TextBoxes.ChangeFocus(); return; + } + } + + public static void OnKeyReleased(object sender, KeyEventArgs e) + { + // Define se um botão está sendo pressionado + if (Tools.CurrentWindow == Tools.Windows.Game) + switch (e.Code) + { + case Keyboard.Key.Enter: Chat.Type(); break; + case Keyboard.Key.Space: Player.CollectItem(); break; + case Keyboard.Key.Num1: Send.Hotbar_Use(1); break; + case Keyboard.Key.Num2: Send.Hotbar_Use(2); break; + case Keyboard.Key.Num3: Send.Hotbar_Use(3); break; + case Keyboard.Key.Num4: Send.Hotbar_Use(4); break; + case Keyboard.Key.Num5: Send.Hotbar_Use(5); break; + case Keyboard.Key.Num6: Send.Hotbar_Use(6); break; + case Keyboard.Key.Num7: Send.Hotbar_Use(7); break; + case Keyboard.Key.Num8: Send.Hotbar_Use(8); break; + case Keyboard.Key.Num9: Send.Hotbar_Use(9); break; + case Keyboard.Key.Num0: Send.Hotbar_Use(0); break; + } + } + + public static void OnTextEntered(object sender, TextEventArgs e) + { + // Executa os eventos + if (TextBoxes.Focused != null) ((TextBoxes.Structure)TextBoxes.Focused.Data).TextEntered(e); + } +} \ No newline at end of file diff --git a/Source/Client/Library/Clear.cs b/Source/Client/Library/Clear.cs index 4886420a..5289f3f3 100644 --- a/Source/Client/Library/Clear.cs +++ b/Source/Client/Library/Clear.cs @@ -3,11 +3,12 @@ public static void Options() { // Defini os dados das opções - Lists.Options.GameName = "CryBits"; + Lists.Options.Game_Name = "CryBits"; Lists.Options.SaveUsername = true; Lists.Options.Musics = true; Lists.Options.Sounds = true; Lists.Options.Username = string.Empty; + Lists.Options.Chat = true; // Salva o que foi modificado Write.Options(); @@ -21,6 +22,7 @@ public static void Player(byte Index) Lists.Player[Index].Max_Vital = new short[(byte)Game.Vitals.Count]; Lists.Player[Index].Attribute = new short[(byte)Game.Attributes.Count]; Lists.Player[Index].Equipment = new short[(byte)Game.Equipments.Count]; + Lists.Player[Index].Party = new byte[0]; // Reseta os valores Lists.Player[Index].Name = string.Empty; diff --git a/Source/Client/Library/Directories.cs b/Source/Client/Library/Directories.cs index e428666f..e3447ac1 100644 --- a/Source/Client/Library/Directories.cs +++ b/Source/Client/Library/Directories.cs @@ -9,31 +9,34 @@ class Directories // Diretório dos arquivos public static DirectoryInfo Sounds = new DirectoryInfo(Application.StartupPath + @"\Audio\Sounds\"); public static DirectoryInfo Musics = new DirectoryInfo(Application.StartupPath + @"\Audio\Musics\"); - public static DirectoryInfo Fonts = new DirectoryInfo(Application.StartupPath + @"\Fonts\"); + public static DirectoryInfo Fonts = new DirectoryInfo(Application.StartupPath + @"\Graphics\Fonts\"); public static FileInfo Options = new FileInfo(Application.StartupPath + @"\Data\Options" + Format); public static DirectoryInfo Maps_Data = new DirectoryInfo(Application.StartupPath + @"\Data\Maps\"); - public static FileInfo Tools = new FileInfo(Application.StartupPath + @"\Data\Tools" + Format); + public static FileInfo Tools_Data = new FileInfo(Application.StartupPath + @"\Data\Tools" + Format); public static FileInfo Tex_Background = new FileInfo(Application.StartupPath + @"\Graphics\Interface\Background"); public static FileInfo Tex_Chat = new FileInfo(Application.StartupPath + @"\Graphics\Interface\Chat"); public static FileInfo Tex_Equipments = new FileInfo(Application.StartupPath + @"\Graphics\Interface\Equipments"); - public static DirectoryInfo Tex_Panels = new DirectoryInfo(Application.StartupPath + @"\Graphics\Interface\Tools\Panels\"); - public static DirectoryInfo Tex_Buttons = new DirectoryInfo(Application.StartupPath + @"\Graphics\Interface\Tools\Buttons\"); - public static FileInfo Tex_CheckBox = new FileInfo(Application.StartupPath + @"\Graphics\Interface\Tools\CheckBox"); - public static FileInfo Tex_TextBox = new FileInfo(Application.StartupPath + @"\Graphics\Interface\Tools\TextBox"); + public static DirectoryInfo Tex_Panels = new DirectoryInfo(Application.StartupPath + @"\Graphics\Interface\Panels\"); + public static DirectoryInfo Tex_Buttons = new DirectoryInfo(Application.StartupPath + @"\Graphics\Interface\Buttons\"); + public static FileInfo Tex_CheckBox = new FileInfo(Application.StartupPath + @"\Graphics\Interface\CheckBox"); + public static FileInfo Tex_TextBox = new FileInfo(Application.StartupPath + @"\Graphics\Interface\TextBox"); public static DirectoryInfo Tex_Characters = new DirectoryInfo(Application.StartupPath + @"\Graphics\Characters\"); public static DirectoryInfo Tex_Tiles = new DirectoryInfo(Application.StartupPath + @"\Graphics\Tiles\"); public static DirectoryInfo Tex_Faces = new DirectoryInfo(Application.StartupPath + @"\Graphics\Faces\"); public static DirectoryInfo Tex_Panoramas = new DirectoryInfo(Application.StartupPath + @"\Graphics\Panoramas\"); public static DirectoryInfo Tex_Fogs = new DirectoryInfo(Application.StartupPath + @"\Graphics\Fogs\"); - public static FileInfo Tex_Weather = new FileInfo(Application.StartupPath + @"\Graphics\Weather"); - public static FileInfo Tex_Blank = new FileInfo(Application.StartupPath + @"\Graphics\Blank"); - public static FileInfo Tex_Directions = new FileInfo(Application.StartupPath + @"\Graphics\Directions"); - public static FileInfo Tex_Shadow = new FileInfo(Application.StartupPath + @"\Graphics\Shadow"); - public static FileInfo Tex_Bars = new FileInfo(Application.StartupPath + @"\Graphics\Bars"); - public static FileInfo Tex_Bars_Panel = new FileInfo(Application.StartupPath + @"\Graphics\Bars_Panel"); + public static FileInfo Tex_Weather = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Weather"); + public static FileInfo Tex_Blank = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Blank"); + public static FileInfo Tex_Directions = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Directions"); + public static FileInfo Tex_Shadow = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Shadow"); + public static FileInfo Tex_Bars = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Bars"); + public static FileInfo Tex_Bars_Panel = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Bars_Panel"); public static DirectoryInfo Tex_Lights = new DirectoryInfo(Application.StartupPath + @"\Graphics\Lights\"); public static DirectoryInfo Tex_Items = new DirectoryInfo(Application.StartupPath + @"\Graphics\Items\"); - public static FileInfo Tex_Grid = new FileInfo(Application.StartupPath + @"\Graphics\Grid"); + public static FileInfo Tex_Grid = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Grid"); + public static FileInfo Tex_Blood = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Blood"); + public static FileInfo Tex_Party_Bars = new FileInfo(Application.StartupPath + @"\Graphics\Misc\Party_Bars"); + public static FileInfo Tex_Intro = new FileInfo(Application.StartupPath + @"\Graphics\Interface\Intro"); public static void Create() { @@ -42,7 +45,7 @@ public static void Create() Sounds.Create(); Musics.Create(); Maps_Data.Create(); - Tools.Directory.Create(); + Tools_Data.Directory.Create(); Tex_Panoramas.Create(); Tex_Fogs.Create(); Tex_Characters.Create(); @@ -64,5 +67,7 @@ public static void Create() Tex_Items.Create(); Tex_Grid.Directory.Create(); Tex_Equipments.Directory.Create(); + Tex_Blood.Directory.Create(); + Tex_Party_Bars.Directory.Create(); } } \ No newline at end of file diff --git a/Source/Client/Library/Lists.cs b/Source/Client/Library/Lists.cs index 21b00214..120ad600 100644 --- a/Source/Client/Library/Lists.cs +++ b/Source/Client/Library/Lists.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; class Lists { @@ -17,12 +18,14 @@ class Lists // Estrutura dos itens em gerais public class Structures { + [Serializable] public struct Options { - public string GameName; + public string Game_Name; public bool SaveUsername; public bool Sounds; public bool Musics; + public bool Chat; public string Username; } @@ -45,10 +48,11 @@ public class Player // Geral public string Name; public byte Class; + public short Texture_Num; public bool Genre; public short Level; - public short Experience; - public short ExpNeeded; + public int Experience; + public int ExpNeeded; public short Points; public short[] Vital; public short[] Attribute; @@ -58,6 +62,7 @@ public class Player public Game.Directions Direction; public Game.Movements Movement; public short[] Equipment; + public byte[] Party; } public class Characters @@ -66,13 +71,15 @@ public class Characters public byte Class; public bool Genre; public short Level; + public short Texture_Num; } public class Class { public string Name; - public short Texture_Male; - public short Texture_Female; + public string Description; + public short[] Tex_Male; + public short[] Tex_Female; } [Serializable] @@ -98,6 +105,7 @@ public struct Temp_Map { public Map_NPCs[] NPC; public Map_Items[] Item; + public List Blood; } [Serializable] @@ -156,6 +164,7 @@ public struct Weather public struct NPCs { public string Name; + public string SayMsg; public short Texture; public byte Type; public short[] Vital; @@ -193,11 +202,13 @@ public struct Items public string Description; public short Texture; public byte Type; + public byte Rarity; + public Game.BindOn Bind; // Requerimentos public short Req_Level; public byte Req_Class; // Poção - public short Potion_Experience; + public int Potion_Experience; public short[] Potion_Vital; // Equipamento public byte Equip_Type; @@ -216,5 +227,23 @@ public struct Hotbar public byte Type; public byte Slot; } + + public class Map_Blood + { + // Dados + public byte Texture_Num; + public short X; + public short Y; + public int Timer; + + // Construtor + public Map_Blood(byte Texture_Num, short X, short Y, int Timer) + { + this.Texture_Num = Texture_Num; + this.X = X; + this.Y = Y; + this.Timer = Timer; + } + } } } \ No newline at end of file diff --git a/Source/Client/Library/Read.cs b/Source/Client/Library/Read.cs index 812a8934..0e090cae 100644 --- a/Source/Client/Library/Read.cs +++ b/Source/Client/Library/Read.cs @@ -11,35 +11,28 @@ public static void Data() Options(); } - public static void Options() + private static void Options() { // Cria o arquivo se ele não existir if (!Directories.Options.Exists) + { Clear.Options(); + Write.Options(); + } + // Lê os dados else { - // Cria um arquivo temporário - BinaryReader File = new BinaryReader(System.IO.File.OpenRead(Directories.Options.FullName)); - - // Carrega os dados - Lists.Options.GameName = File.ReadString(); - Lists.Options.SaveUsername = File.ReadBoolean(); - Lists.Options.Sounds = File.ReadBoolean(); - Lists.Options.Musics = File.ReadBoolean(); - Lists.Options.Username = File.ReadString(); - - // Descarrega o arquivo - File.Dispose(); + FileStream Stream = Directories.Options.OpenRead(); + Lists.Options = (Lists.Structures.Options)new BinaryFormatter().Deserialize(Stream); + Stream.Close(); } - // Adiciona os dados ao cache - CheckBoxes.Get("Sounds").State = Lists.Options.Sounds; - CheckBoxes.Get("Musics").State = Lists.Options.Musics; - CheckBoxes.Get("Connect_Save_Username").State = Lists.Options.SaveUsername; + // Eventos + CheckBoxes.Get("Connect_Save_Username").Checked = Lists.Options.SaveUsername; if (Lists.Options.SaveUsername) TextBoxes.Get("Connect_Username").Text = Lists.Options.Username; } - public static Buttons.Structure Button(BinaryReader Data) + private static Buttons.Structure Button(BinaryReader Data) { // Lê os dados Buttons.Structure Tool = new Buttons.Structure(); @@ -52,7 +45,7 @@ public static Buttons.Structure Button(BinaryReader Data) return Tool; } - public static TextBoxes.Structure TextBox(BinaryReader Data) + private static TextBoxes.Structure TextBox(BinaryReader Data) { // Lê os dados TextBoxes.Structure Tool = new TextBoxes.Structure(); @@ -67,7 +60,7 @@ public static TextBoxes.Structure TextBox(BinaryReader Data) return Tool; } - public static Panels.Structure Panel(BinaryReader Data) + private static Panels.Structure Panel(BinaryReader Data) { // Carrega os dados Panels.Structure Tool = new Panels.Structure(); @@ -80,7 +73,7 @@ public static Panels.Structure Panel(BinaryReader Data) return Tool; } - public static CheckBoxes.Structure CheckBox(BinaryReader Data) + private static CheckBoxes.Structure CheckBox(BinaryReader Data) { // Carrega os dados CheckBoxes.Structure Tool = new CheckBoxes.Structure(); @@ -90,22 +83,18 @@ public static CheckBoxes.Structure CheckBox(BinaryReader Data) Tool.Visible = Data.ReadBoolean(); Tool.Window = (Tools.Windows)Data.ReadByte(); Tool.Text = Data.ReadString(); - Tool.State = Data.ReadBoolean(); + Tool.Checked = Data.ReadBoolean(); return Tool; } - public static void Tools() + private static void Tools() { - FileInfo File = new FileInfo(Directories.Tools.FullName); + FileInfo File = new FileInfo(Directories.Tools_Data.FullName); for (byte i = 0; i < (byte)global::Tools.Windows.Count; i++) global::Tools.All_Order[i] = new List(); - // Cria um sistema binário para a manipulação dos dados + // Lê todas as ferramentas BinaryReader Data = new BinaryReader(File.OpenRead()); - - // Lê todos os nós for (byte n = 0; n < global::Tools.All_Order.Length; n++) Tools(null, ref global::Tools.All_Order[n], Data); - - // Fecha o sistema Data.Dispose(); } diff --git a/Source/Client/Library/Write.cs b/Source/Client/Library/Write.cs index 15fb6211..407615c6 100644 --- a/Source/Client/Library/Write.cs +++ b/Source/Client/Library/Write.cs @@ -5,18 +5,10 @@ class Write { public static void Options() { - // Cria um arquivo temporário - BinaryWriter Data = new BinaryWriter(File.OpenWrite(Directories.Options.FullName)); - - // Carrega todas as opções - Data.Write(Lists.Options.GameName); - Data.Write(Lists.Options.SaveUsername); - Data.Write(Lists.Options.Sounds); - Data.Write(Lists.Options.Musics); - Data.Write(Lists.Options.Username); - - // Fecha o arquivo - Data.Dispose(); + // Escreve os dados + FileStream Stream = new FileInfo(Directories.Options.FullName).OpenWrite(); + new BinaryFormatter().Serialize(Stream, Lists.Options); + Stream.Close(); } public static void Map(short Index) diff --git a/Source/Client/Logic/Game.cs b/Source/Client/Logic/Game.cs index 6971b2a0..a2763127 100644 --- a/Source/Client/Logic/Game.cs +++ b/Source/Client/Logic/Game.cs @@ -15,21 +15,16 @@ class Game // Interface public static byte CreateCharacter_Class = 1; + public static byte CreateCharacter_Tex = 0; public static int SelectCharacter = 1; public static short Infomation_Index; public static int Need_Information = 0; + public static byte Drop_Slot = 0; + public static string Party_Invitation; // Jogador public const short Attack_Speed = 750; - // Pressionamento das teclas - public static bool Press_Up; - public static bool Press_Down; - public static bool Press_Left; - public static bool Press_Right; - public static bool Press_Shift; - public static bool Press_Control; - // Animação public const byte Animation_Amount = 4; public const byte Animation_Stopped = 1; @@ -44,7 +39,7 @@ class Game public const byte Movement_Right = 2; // Visão do jogador - public static Rectangle Camera; + private static Rectangle Camera; public static Rectangle Tile_Sight; // Bloqueio direcional @@ -126,7 +121,7 @@ public enum Target NPC } - public enum Itens + public enum Items { None, Equipment, @@ -148,6 +143,24 @@ public enum Hotbar None, Item } + + public enum Rarity + { + Common, + Uncommon, + Rare, + Epic, + Legendary, + Count + } + + public enum BindOn + { + None, + Pickup, + Equip, + Count + } #endregion public static void OpenMenu() @@ -190,17 +203,16 @@ public static void SetSituation(Situations Situation) public static void Disconnect() { // Não fechar os paineis se não for necessário - if (Panels.Get("Options").Visible || Panels.Get("Connect").Visible || Panels.Get("Register").Visible) - return; + if (Panels.Get("Options").Visible || Panels.Get("Connect").Visible || Panels.Get("Register").Visible) return; // Limpa os valores Audio.Sound.Stop_All(); Player.MyIndex = 0; // Traz o jogador de volta ao menu - Tools.CurrentWindow = Tools.Windows.Menu; Panels.Menu_Close(); Panels.Get("Connect").Visible = true; + Tools.CurrentWindow = Tools.Windows.Menu; } public static void UpdateCamera() diff --git a/Source/Client/Logic/Loop.cs b/Source/Client/Logic/Loop.cs index 2b45ac40..b7f00a09 100644 --- a/Source/Client/Logic/Loop.cs +++ b/Source/Client/Logic/Loop.cs @@ -4,10 +4,10 @@ class Loop { // Contagens - private static int TextBox_Timer = 0; - private static int Chat_Timer = 0; + public static int TextBox_Timer = 0; + public static int Chat_Timer = 0; - public static void Main() + public static void Init() { int Count; int Timer_1000 = 0; @@ -21,14 +21,18 @@ public static void Main() // Manuseia os dados recebidos Socket.HandleData(); + // Processa os eventos da janela + Graphics.RenderWindow.DispatchEvents(); + // Apresenta os gráficos à tela Graphics.Present(); // Eventos TextBox(); - Map.Logic(); if (Player.MyIndex > 0 && Tools.CurrentWindow == Tools.Windows.Game) + { + Map.Logic(); if (Timer_30 < Environment.TickCount) { // Lógicas @@ -38,6 +42,7 @@ public static void Main() // Reinicia a contagem Timer_30 = Environment.TickCount + 30; } + } // Faz com que a aplicação se mantenha estável Application.DoEvents(); @@ -72,12 +77,12 @@ private static void TextBox() } // Chat - if (Tools.Chat_Text_Visible && !Panels.Get("Chat").Visible) + if ((Chat.Text_Visible && !Panels.Get("Chat").Visible)) { if (Chat_Timer < Environment.TickCount) - Tools.Chat_Text_Visible = false; + Chat.Text_Visible = false; } - else + else if (!Lists.Options.Chat) Chat_Timer = Chat_Timer = Environment.TickCount + 10000; } } \ No newline at end of file diff --git a/Source/Client/Logic/Map.cs b/Source/Client/Logic/Map.cs index cf2273eb..f014e034 100644 --- a/Source/Client/Logic/Map.cs +++ b/Source/Client/Logic/Map.cs @@ -61,9 +61,14 @@ public static void Logic() // Toda a lógica do mapa Fog(); Weather(); + + // Retira os sangues do chão depois de um determinado tempo + for (short i = 0; i < Lists.Temp_Map.Blood.Count; i++) + if (Lists.Temp_Map.Blood[i].Timer + 20000 < Environment.TickCount) + Lists.Temp_Map.Blood.RemoveAt(i); } - public static void NextTile(Game.Directions Direction, ref short X, ref short Y) + private static void NextTile(Game.Directions Direction, ref short X, ref short Y) { // Próximo azulejo switch (Direction) @@ -78,40 +83,28 @@ public static void NextTile(Game.Directions Direction, ref short X, ref short Y) public static bool OutOfLimit(short x, short y) { // Verifica se as coordenas estão no limite do mapa - if (x > Lists.Map.Width || y > Lists.Map.Height || x < 0 || y < 0) - return true; - else - return false; + return x > Lists.Map.Width || y > Lists.Map.Height || x < 0 || y < 0; } public static bool Tile_Blocked(short Map, byte X, byte Y, Game.Directions Direction) { - short Próximo_X = X, Próximo_Y = Y; + short Next_X = X, Next_Y = Y; // Próximo azulejo - NextTile(Direction, ref Próximo_X, ref Próximo_Y); + NextTile(Direction, ref Next_X, ref Next_Y); // Verifica se está indo para uma ligação - if (OutOfLimit(Próximo_X, Próximo_Y)) - if (Lists.Map.Link[(byte)Direction] == 0) - return true; - else - return false; + if (OutOfLimit(Next_X, Next_Y)) return Lists.Map.Link[(byte)Direction] == 0; // Verifica se o azulejo está bloqueado - if (Lists.Map.Tile[Próximo_X, Próximo_Y].Attribute == (byte)Layer_Attributes.Block) - return true; - else if (Lists.Map.Tile[Próximo_X, Próximo_Y].Block[(byte)Game.ReverseDirection(Direction)]) - return true; - else if (Lists.Map.Tile[X, Y].Block[(byte)Direction]) - return true; - else if (HasPlayer(Map, Próximo_X, Próximo_Y) > 0 || HasNPC(Próximo_X, Próximo_Y) > 0) - return true; - + if (Lists.Map.Tile[Next_X, Next_Y].Attribute == (byte)Layer_Attributes.Block) return true; + if (Lists.Map.Tile[Next_X, Next_Y].Block[(byte)Game.ReverseDirection(Direction)]) return true; + if (Lists.Map.Tile[X, Y].Block[(byte)Direction]) return true; + if (HasPlayer(Map, Next_X, Next_Y) > 0 || HasNPC(Next_X, Next_Y) > 0) return true; return false; } - public static byte HasNPC(short X, short Y) + private static byte HasNPC(short X, short Y) { // Verifica se há algum npc na cordenada for (byte i = 1; i < Lists.Temp_Map.NPC.Length; i++) @@ -122,7 +115,7 @@ public static byte HasNPC(short X, short Y) return 0; } - public static byte HasPlayer(short Num, short X, short Y) + private static byte HasPlayer(short Num, short X, short Y) { // Verifica se há algum Jogador na cordenada for (byte i = 1; i <= Player.HigherIndex; i++) @@ -382,7 +375,7 @@ public static void Update() Calculate(x, y, q, c); } - public static void Set(byte x, byte y, byte Layer_Num, byte Layer_Type, byte Part, string Index) + private static void Set(byte x, byte y, byte Layer_Num, byte Layer_Type, byte Part, string Index) { Point Position = new Point(0); @@ -426,7 +419,7 @@ public static void Set(byte x, byte y, byte Layer_Num, byte Layer_Type, byte Par Lists.Map.Tile[x, y].Data[Layer_Type, Layer_Num].Mini[Part].Y = Data.Y * Game.Grid + Position.Y; } - public static bool Check(int X1, int Y1, int X2, int Y2, byte Layer_Num, byte Layer_Type) + private static bool Check(int X1, int Y1, int X2, int Y2, byte Layer_Num, byte Layer_Type) { Lists.Structures.Map_Tile_Data Data1, Data2; @@ -447,7 +440,7 @@ public static bool Check(int X1, int Y1, int X2, int Y2, byte Layer_Num, byte La return true; } - public static void Calculate(byte x, byte y, byte Layer_Num, byte Layer_Type) + private static void Calculate(byte x, byte y, byte Layer_Num, byte Layer_Type) { // Calcula as quatros partes do azulejo Calculate_NW(x, y, Layer_Num, Layer_Type); @@ -456,7 +449,7 @@ public static void Calculate(byte x, byte y, byte Layer_Num, byte Layer_Type) Calculate_SE(x, y, Layer_Num, Layer_Type); } - public static void Calculate_NW(byte x, byte y, byte Layer_Num, byte Layer_Type) + private static void Calculate_NW(byte x, byte y, byte Layer_Num, byte Layer_Type) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -484,7 +477,7 @@ public static void Calculate_NW(byte x, byte y, byte Layer_Num, byte Layer_Type) } } - public static void Calculate_NE(byte x, byte y, byte Layer_Num, byte Layer_Type) + private static void Calculate_NE(byte x, byte y, byte Layer_Num, byte Layer_Type) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -512,7 +505,7 @@ public static void Calculate_NE(byte x, byte y, byte Layer_Num, byte Layer_Type) } } - public static void Calculate_SW(byte x, byte y, byte Layer_Num, byte Layer_Type) + private static void Calculate_SW(byte x, byte y, byte Layer_Num, byte Layer_Type) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -540,7 +533,7 @@ public static void Calculate_SW(byte x, byte y, byte Layer_Num, byte Layer_Type) } } - public static void Calculate_SE(byte x, byte y, byte Layer_Num, byte Layer_Type) + private static void Calculate_SE(byte x, byte y, byte Layer_Num, byte Layer_Type) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -572,7 +565,7 @@ public static void Calculate_SE(byte x, byte y, byte Layer_Num, byte Layer_Type) partial class Graphics { - public static void Map_Tiles(byte c) + private static void Map_Tiles(byte c) { // Previne erros if (Lists.Map.Name == null) return; @@ -599,7 +592,7 @@ public static void Map_Tiles(byte c) } } - public static void Map_Autotile(Point Position, Lists.Structures.Map_Tile_Data Dados, SFML.Graphics.Color Cor) + private static void Map_Autotile(Point Position, Lists.Structures.Map_Tile_Data Dados, SFML.Graphics.Color Cor) { // Desenha os 4 mini azulejos for (byte i = 0; i <= 3; i++) @@ -619,14 +612,14 @@ public static void Map_Autotile(Point Position, Lists.Structures.Map_Tile_Data D } } - public static void Map_Panorama() + private static void Map_Panorama() { // Desenha o panorama if (Lists.Map.Panorama > 0) Render(Tex_Panorama[Lists.Map.Panorama], new Point(0)); } - public static void Map_Fog() + private static void Map_Fog() { Lists.Structures.Map_Fog Data = Lists.Map.Fog; Size Texture_Size = TSize(Tex_Fog[Data.Texture]); @@ -640,7 +633,7 @@ public static void Map_Fog() Render(Tex_Fog[Data.Texture], new Point(x * Texture_Size.Width + Map.Fog_X, y * Texture_Size.Height + Map.Fog_Y), new SFML.Graphics.Color(255, 255, 255, Data.Alpha)); } - public static void Map_Weather() + private static void Map_Weather() { byte x = 0; @@ -662,7 +655,7 @@ public static void Map_Weather() Render(Tex_Blanc, 0, 0, 0, 0, Game.Screen_Width, Game.Screen_Height, new SFML.Graphics.Color(255, 255, 255, Map.Lightning)); } - public static void Map_Name() + private static void Map_Name() { SFML.Graphics.Color Color; @@ -677,10 +670,10 @@ public static void Map_Name() } // Desenha o nome do mapa - DrawText(Lists.Map.Name, 463, 48, Color); + DrawText(Lists.Map.Name, 426, 48, Color); } - public static void Map_Items() + private static void Map_Items() { // Desenha todos os itens que estão no chão for (byte i = 1; i < Lists.Temp_Map.Item.Length; i++) @@ -695,4 +688,14 @@ public static void Map_Items() Render(Tex_Item[Lists.Item[Data.Index].Texture], Position); } } + + private static void Map_Blood() + { + // Desenha todos os sangues + for (byte i = 0; i < Lists.Temp_Map.Blood.Count; i++) + { + Lists.Structures.Map_Blood Data = Lists.Temp_Map.Blood[i]; + Render(Tex_Blood, Game.ConvertX(Data.X * Game.Grid), Game.ConvertY(Data.Y * Game.Grid), Data.Texture_Num * 32, 0, 32, 32); + } + } } \ No newline at end of file diff --git a/Source/Client/Logic/NPC.cs b/Source/Client/Logic/NPC.cs index 5af25567..c207be84 100644 --- a/Source/Client/Logic/NPC.cs +++ b/Source/Client/Logic/NPC.cs @@ -19,7 +19,7 @@ public static void Logic() } } - public static void ProcessMovement(byte Index) + private static void ProcessMovement(byte Index) { byte Speed = 0; short x = Lists.Temp_Map.NPC[Index].X2, y = Lists.Temp_Map.NPC[Index].Y2; @@ -74,16 +74,17 @@ public static void ProcessMovement(byte Index) partial class Receive { - public static void NPCs(NetIncomingMessage Data) + private static void NPCs(NetIncomingMessage Data) { // Quantidade - Lists.NPC = new Lists.Structures.NPCs[Data.ReadInt16() + 1]; + Lists.NPC = new Lists.Structures.NPCs[Data.ReadInt16()]; // Lê os dados de todos for (byte i = 1; i < Lists.NPC.Length; i++) { // Geral Lists.NPC[i].Name = Data.ReadString(); + Lists.NPC[i].SayMsg = Data.ReadString(); Lists.NPC[i].Texture = Data.ReadInt16(); Lists.NPC[i].Type = Data.ReadByte(); @@ -94,10 +95,10 @@ public static void NPCs(NetIncomingMessage Data) } } - public static void Map_NPCs(NetIncomingMessage Data) + private static void Map_NPCs(NetIncomingMessage Data) { // Lê os dados - Lists.Temp_Map.NPC = new Lists.Structures.Map_NPCs[Data.ReadInt16() + 1]; + Lists.Temp_Map.NPC = new Lists.Structures.Map_NPCs[Data.ReadInt16()]; for (byte i = 1; i < Lists.Temp_Map.NPC.Length; i++) { Lists.Temp_Map.NPC[i].X2 = 0; @@ -114,7 +115,7 @@ public static void Map_NPCs(NetIncomingMessage Data) } } - public static void Map_NPC(NetIncomingMessage Data) + private static void Map_NPC(NetIncomingMessage Data) { // Lê os dados byte i = Data.ReadByte(); @@ -125,7 +126,7 @@ public static void Map_NPC(NetIncomingMessage Data) for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Lists.Temp_Map.NPC[i].Vital[n] = Data.ReadInt16(); } - public static void Map_NPC_Movement(NetIncomingMessage Data) + private static void Map_NPC_Movement(NetIncomingMessage Data) { // Lê os dados byte i = Data.ReadByte(); @@ -148,7 +149,7 @@ public static void Map_NPC_Movement(NetIncomingMessage Data) } } - public static void Map_NPC_Attack(NetIncomingMessage Data) + private static void Map_NPC_Attack(NetIncomingMessage Data) { byte Index = Data.ReadByte(), Victim = Data.ReadByte(), Victim_Type = Data.ReadByte(); @@ -159,12 +160,18 @@ public static void Map_NPC_Attack(NetIncomingMessage Data) // Sofrendo dano if (Victim > 0) if (Victim_Type == (byte)Game.Target.Player) + { Lists.Player[Victim].Hurt = Environment.TickCount; + Lists.Temp_Map.Blood.Add(new Lists.Structures.Map_Blood((byte)Game.Random.Next(0, 3), Lists.Player[Victim].X, Lists.Player[Victim].Y, Environment.TickCount)); + } else if (Victim_Type == (byte)Game.Target.NPC) + { Lists.Temp_Map.NPC[Victim].Hurt = Environment.TickCount; + Lists.Temp_Map.Blood.Add(new Lists.Structures.Map_Blood((byte)Game.Random.Next(0, 3), Lists.Temp_Map.NPC[Victim].X, Lists.Temp_Map.NPC[Victim].Y, Environment.TickCount)); + } } - public static void Map_NPC_Direction(NetIncomingMessage Data) + private static void Map_NPC_Direction(NetIncomingMessage Data) { // Define a direção de determinado NPC byte i = Data.ReadByte(); @@ -173,7 +180,7 @@ public static void Map_NPC_Direction(NetIncomingMessage Data) Lists.Temp_Map.NPC[i].Y2 = 0; } - public static void Map_NPC_Vitals(NetIncomingMessage Data) + private static void Map_NPC_Vitals(NetIncomingMessage Data) { byte Index = Data.ReadByte(); @@ -182,7 +189,7 @@ public static void Map_NPC_Vitals(NetIncomingMessage Data) Lists.Temp_Map.NPC[Index].Vital[n] = Data.ReadInt16(); } - public static void Map_NPC_Died(NetIncomingMessage Data) + private static void Map_NPC_Died(NetIncomingMessage Data) { byte i = Data.ReadByte(); @@ -198,7 +205,7 @@ public static void Map_NPC_Died(NetIncomingMessage Data) partial class Graphics { - public static void NPC(byte Index) + private static void NPC(byte Index) { int x2 = Lists.Temp_Map.NPC[Index].X2, y2 = Lists.Temp_Map.NPC[Index].Y2; byte Column = 0; @@ -230,7 +237,7 @@ public static void NPC(byte Index) NPC_Bars(Index, x, y); } - public static void NPC_Name(byte Index, int x, int y) + private static void NPC_Name(byte Index, int x, int y) { Point Position = new Point(); SFML.Graphics.Color Color; short NPC_Num = Lists.Temp_Map.NPC[Index].Index; @@ -254,7 +261,7 @@ public static void NPC_Name(byte Index, int x, int y) DrawText(Lists.NPC[NPC_Num].Name, Game.ConvertX(Position.X), Game.ConvertY(Position.Y), Color); } - public static void NPC_Bars(byte Index, int x, int y) + private static void NPC_Bars(byte Index, int x, int y) { Lists.Structures.Map_NPCs NPC = Lists.Temp_Map.NPC[Index]; Texture Texture = Tex_Character[Lists.NPC[NPC.Index].Texture]; diff --git a/Source/Client/Logic/Player.cs b/Source/Client/Logic/Player.cs index c7fcd530..ada40f02 100644 --- a/Source/Client/Logic/Player.cs +++ b/Source/Client/Logic/Player.cs @@ -2,6 +2,7 @@ using SFML.Graphics; using System; using System.Drawing; +using SFML.Window; class Player { @@ -33,21 +34,7 @@ public static Lists.Structures.Player Me public static bool IsPlaying(byte Index) { // Verifica se o jogador está dentro do jogo - if (MyIndex > 0 && !string.IsNullOrEmpty(Lists.Player[Index].Name)) - return true; - else - return false; - } - - public static short Player_Texture(byte Index) - { - byte Class = Lists.Player[Index].Class; - - // Retorna com o valor da textura - if (Lists.Player[Index].Genre) - return Lists.Class[Class].Texture_Male; - else - return Lists.Class[Class].Texture_Female; + return MyIndex > 0 && !string.IsNullOrEmpty(Lists.Player[Index].Name); } public static void Logic() @@ -57,7 +44,7 @@ public static void Logic() CheckAttack(); // Lógica dos jogadores - for (byte i = 1; i <= Player.HigherIndex; i++) + for (byte i = 1; i <= HigherIndex; i++) { // Dano if (Lists.Player[i].Hurt + 325 < Environment.TickCount) Lists.Player[i].Hurt = 0; @@ -67,36 +54,24 @@ public static void Logic() } } - public static bool TryingMove() - { - // Se estiver pressionando alguma tecla, está tentando se mover - if (Game.Press_Up || Game.Press_Down || Game.Press_Left || Game.Press_Right) - return true; - else - return false; - } - - public static bool CanMove() + private static bool CanMove() { // Não mover se já estiver tentando movimentar-se - if (Lists.Player[MyIndex].Movement != Game.Movements.Stopped) - return false; - - return true; + return Lists.Player[MyIndex].Movement == Game.Movements.Stopped; } - public static void CheckMovement() + private static void CheckMovement() { - if (Me.Movement > 0) return; + if (Me.Movement > 0 || !Graphics.RenderWindow.HasFocus()) return; // Move o personagem - if (Game.Press_Up) Move(Game.Directions.Up); - else if (Game.Press_Down) Move(Game.Directions.Down); - else if (Game.Press_Left) Move(Game.Directions.Left); - else if (Game.Press_Right) Move(Game.Directions.Right); + if (Keyboard.IsKeyPressed(Keyboard.Key.Up)) Move(Game.Directions.Up); + else if (Keyboard.IsKeyPressed(Keyboard.Key.Down)) Move(Game.Directions.Down); + else if (Keyboard.IsKeyPressed(Keyboard.Key.Left)) Move(Game.Directions.Left); + else if (Keyboard.IsKeyPressed(Keyboard.Key.Right)) Move(Game.Directions.Right); } - public static void Move(Game.Directions Direction) + private static void Move(Game.Directions Direction) { // Verifica se o jogador pode se mover if (!CanMove()) return; @@ -112,7 +87,7 @@ public static void Move(Game.Directions Direction) if (Map.Tile_Blocked(Lists.Player[MyIndex].Map, Lists.Player[MyIndex].X, Lists.Player[MyIndex].Y, Direction)) return; // Define a velocidade que o jogador se move - if (Game.Press_Shift) + if (Keyboard.IsKeyPressed(Keyboard.Key.LShift) && Graphics.RenderWindow.HasFocus()) Lists.Player[MyIndex].Movement = Game.Movements.Moving; else Lists.Player[MyIndex].Movement = Game.Movements.Walking; @@ -130,7 +105,7 @@ public static void Move(Game.Directions Direction) } } - public static void ProcessMovement(byte Index) + private static void ProcessMovement(byte Index) { byte Speed = 0; short x = Lists.Player[Index].X2, y = Lists.Player[Index].Y2; @@ -182,7 +157,7 @@ public static void ProcessMovement(byte Index) Lists.Player[Index].Animation = Game.Animation_Left; } - public static void CheckAttack() + private static void CheckAttack() { // Reseta o ataque if (Me.Attack_Timer + Game.Attack_Speed < Environment.TickCount) @@ -192,7 +167,7 @@ public static void CheckAttack() } // Somente se estiver pressionando a tecla de ataque e não estiver atacando - if (!Game.Press_Control) return; + if (!Keyboard.IsKeyPressed(Keyboard.Key.LControl) || !Graphics.RenderWindow.HasFocus()) return; if (Me.Attack_Timer > 0) return; // Envia os dados para o servidor @@ -205,7 +180,7 @@ public static void CollectItem() bool HasItem = false, HasSlot = false; // Previne erros - if (Tools.CurrentWindow != Tools.Windows.Game) return; + if (TextBoxes.Focused != null) return; // Verifica se tem algum item nas coordenadas for (byte i = 1; i < Lists.Temp_Map.Item.Length; i++) @@ -228,40 +203,6 @@ public static void CollectItem() } } -partial class Send -{ - public static void Player_Direction() - { - NetOutgoingMessage Dados = Socket.Device.CreateMessage(); - - // Envia os dados - Dados.Write((byte)Packets.Player_Direction); - Dados.Write((byte)Player.Me.Direction); - Packet(Dados); - } - - public static void Player_Move() - { - NetOutgoingMessage Dados = Socket.Device.CreateMessage(); - - // Envia os dados - Dados.Write((byte)Packets.Player_Move); - Dados.Write(Player.Me.X); - Dados.Write(Player.Me.Y); - Dados.Write((byte)Player.Me.Movement); - Packet(Dados); - } - - public static void Player_Attack() - { - NetOutgoingMessage Dados = Socket.Device.CreateMessage(); - - // Envia os dados - Dados.Write((byte)Packets.Player_Attack); - Packet(Dados); - } -} - partial class Receive { private static void Player_Data(NetIncomingMessage Data) @@ -271,6 +212,7 @@ private static void Player_Data(NetIncomingMessage Data) // Defini os dados do jogador Lists.Player[Index].Name = Data.ReadString(); Lists.Player[Index].Class = Data.ReadByte(); + Lists.Player[Index].Texture_Num = Data.ReadInt16(); Lists.Player[Index].Genre = Data.ReadBoolean(); Lists.Player[Index].Level = Data.ReadInt16(); Lists.Player[Index].Map = Data.ReadInt16(); @@ -327,7 +269,7 @@ private static void Player_Leave(NetIncomingMessage Dados) Clear.Player(Dados.ReadByte()); } - public static void Player_Move(NetIncomingMessage Data) + private static void Player_Move(NetIncomingMessage Data) { byte Index = Data.ReadByte(); @@ -349,13 +291,13 @@ public static void Player_Move(NetIncomingMessage Data) } } - public static void Player_Direction(NetIncomingMessage Data) + private static void Player_Direction(NetIncomingMessage Data) { // Define a direção de determinado jogador Lists.Player[Data.ReadByte()].Direction = (Game.Directions)Data.ReadByte(); } - public static void Player_Attack(NetIncomingMessage Data) + private static void Player_Attack(NetIncomingMessage Data) { byte Index = Data.ReadByte(), Victim = Data.ReadByte(), Victim_Type = Data.ReadByte(); @@ -366,16 +308,22 @@ public static void Player_Attack(NetIncomingMessage Data) // Sofrendo dano if (Victim > 0) if (Victim_Type == (byte)Game.Target.Player) + { Lists.Player[Victim].Hurt = Environment.TickCount; + Lists.Temp_Map.Blood.Add(new Lists.Structures.Map_Blood((byte)Game.Random.Next(0, 3), Lists.Player[Victim].X, Lists.Player[Victim].Y, Environment.TickCount)); + } else if (Victim_Type == (byte)Game.Target.NPC) + { Lists.Temp_Map.NPC[Victim].Hurt = Environment.TickCount; + Lists.Temp_Map.Blood.Add(new Lists.Structures.Map_Blood((byte)Game.Random.Next(0, 3), Lists.Temp_Map.NPC[Victim].X, Lists.Temp_Map.NPC[Victim].Y, Environment.TickCount)); + } } - public static void Player_Experience(NetIncomingMessage Data) + private static void Player_Experience(NetIncomingMessage Data) { // Define os dados - Player.Me.Experience = Data.ReadInt16(); - Player.Me.ExpNeeded = Data.ReadInt16(); + Player.Me.Experience = Data.ReadInt32(); + Player.Me.ExpNeeded = Data.ReadInt32(); Player.Me.Points = Data.ReadByte(); // Manipula a visibilidade dos botões @@ -409,7 +357,7 @@ private static void Player_Hotbar(NetIncomingMessage Data) partial class Graphics { - public static void Player_Character(byte Index) + private static void Player_Character(byte Index) { // Desenha o jogador Player_Texture(Index); @@ -417,13 +365,13 @@ public static void Player_Character(byte Index) Player_Bars(Index); } - public static void Player_Texture(byte Index) + private static void Player_Texture(byte Index) { byte Column = Game.Animation_Stopped; int x = Lists.Player[Index].X * Game.Grid + Lists.Player[Index].X2, y = Lists.Player[Index].Y * Game.Grid + Lists.Player[Index].Y2; short x2 = Lists.Player[Index].X2, y2 = Lists.Player[Index].Y2; bool Hurt = false; - short Texture = Player.Player_Texture(Index); + short Texture = Lists.Player[Index].Texture_Num; // Previne sobrecargas if (Texture <= 0 || Texture > Tex_Character.GetUpperBound(0)) return; @@ -446,9 +394,9 @@ public static void Player_Texture(byte Index) Character(Texture, new Point(Game.ConvertX(x), Game.ConvertY(y)), Lists.Player[Index].Direction, Column, Hurt); } - public static void Player_Bars(byte Index) + private static void Player_Bars(byte Index) { - Size Chracater_Size = TSize(Tex_Character[Player.Player_Texture(Index)]); + Size Chracater_Size = TSize(Tex_Character[Lists.Player[Index].Texture_Num]); int x = Lists.Player[Index].X * Game.Grid + Lists.Player[Index].X2, y = Lists.Player[Index].Y * Game.Grid + Lists.Player[Index].Y2; Point Position = new Point(Game.ConvertX(x), Game.ConvertY(y) + Chracater_Size.Height / Game.Animation_Amount + 4); int FullWidth = Chracater_Size.Width / Game.Animation_Amount; @@ -465,9 +413,9 @@ public static void Player_Bars(byte Index) Render(Tex_Bars, Position.X, Position.Y, 0, 0, Width, 4); } - public static void Player_Name(byte Index) + private static void Player_Name(byte Index) { - Texture Texture = Tex_Character[Player.Player_Texture(Index)]; + Texture Texture = Tex_Character[Lists.Player[Index].Texture_Num]; int Name_Size = Tools.MeasureString(Lists.Player[Index].Name); int x = Lists.Player[Index].X * Game.Grid + Lists.Player[Index].X2, y = Lists.Player[Index].Y * Game.Grid + Lists.Player[Index].Y2; diff --git a/Source/Client/Media/Audio.cs b/Source/Client/Media/Audio.cs index e61095a8..51935266 100644 --- a/Source/Client/Media/Audio.cs +++ b/Source/Client/Media/Audio.cs @@ -30,7 +30,7 @@ public class Sound public const string Format = ".wav"; // Dispositivo sonoro - public static SFML.Audio.Sound[] List; + private static SFML.Audio.Sound[] List; public static void Load() { @@ -70,10 +70,10 @@ public class Music public const string Format = ".ogg"; // Lista das músicas - public static SFML.Audio.Music Device; + private static SFML.Audio.Music Device; // Index da música reproduzida atualmente - public static byte Current; + private static byte Current; public static void Play(Musics Index, bool Loop = false) { diff --git a/Source/Client/Media/Graphics.cs b/Source/Client/Media/Graphics.cs index cc7273a9..4987370d 100644 --- a/Source/Client/Media/Graphics.cs +++ b/Source/Client/Media/Graphics.cs @@ -33,12 +33,15 @@ partial class Graphics public static Texture Tex_Bars_Panel; public static Texture Tex_Grid; public static Texture Tex_Equipments; + public static Texture Tex_Blood; + public static Texture Tex_Party_Bars; + public static Texture Tex_Intro; // Formato das texturas public const string Format = ".png"; #region Engine - public static Texture[] LoadTextures(string Directory) + private static Texture[] LoadTextures(string Directory) { short i = 1; Texture[] TempTex = new Texture[0]; @@ -64,20 +67,20 @@ public static Size TSize(Texture Texture) return new Size(0, 0); } - public static SFML.Graphics.Color CColor(byte R = 255, byte G = 255, byte B = 255, byte A = 255) + private static SFML.Graphics.Color CColor(byte R = 255, byte G = 255, byte B = 255, byte A = 255) { // Retorna com a cor return new SFML.Graphics.Color(R, G, B, A); } - public static void Render(Texture Texture, Rectangle Rec_Source, Rectangle Rec_Destiny, object Color = null, object Mode = null) + private static void Render(Texture Texture, Rectangle Rec_Source, Rectangle Rec_Destiny, object Color = null, object Mode = null) { Sprite TmpImage = new Sprite(Texture); // Define os dados TmpImage.TextureRect = new IntRect(Rec_Source.X, Rec_Source.Y, Rec_Source.Width, Rec_Source.Height); - TmpImage.Position = new Vector2f(Rec_Destiny.X, Rec_Destiny.Y); - TmpImage.Scale = new Vector2f(Rec_Destiny.Width / (float)Rec_Source.Width, Rec_Destiny.Height / (float)Rec_Source.Height); + TmpImage.Position = new SFML.System.Vector2f(Rec_Destiny.X, Rec_Destiny.Y); + TmpImage.Scale = new SFML.System.Vector2f(Rec_Destiny.Width / (float)Rec_Source.Width, Rec_Destiny.Height / (float)Rec_Source.Height); if (Color != null) TmpImage.Color = (SFML.Graphics.Color)Color; @@ -86,7 +89,7 @@ public static void Render(Texture Texture, Rectangle Rec_Source, Rectangle Rec_D RenderWindow.Draw(TmpImage, (RenderStates)Mode); } - public static void Render(Texture Texture, int X, int Y, int Source_X, int Source_Y, int Source_Width, int Source_Height, object Color = null) + private static void Render(Texture Texture, int X, int Y, int Source_X, int Source_Y, int Source_Width, int Source_Height, object Color = null) { // Define as propriedades dos retângulos Rectangle Source = new Rectangle(new Point(Source_X, Source_Y), new Size(Source_Width, Source_Height)); @@ -96,7 +99,7 @@ public static void Render(Texture Texture, int X, int Y, int Source_X, int Sourc Render(Texture, Source, Destiny, Color); } - public static void Render(Texture Texture, Rectangle Destiny, object Color = null) + private static void Render(Texture Texture, Rectangle Destiny, object Color = null) { // Define as propriedades dos retângulos Rectangle Source = new Rectangle(new Point(0), TSize(Texture)); @@ -105,7 +108,7 @@ public static void Render(Texture Texture, Rectangle Destiny, object Color = nul Render(Texture, Source, Destiny, Color); } - public static void Render(Texture Texture, Point Position, object Color = null) + private static void Render(Texture Texture, Point Position, object Color = null) { // Define as propriedades dos retângulos Rectangle Source = new Rectangle(new Point(0), TSize(Texture)); @@ -121,14 +124,48 @@ private static void DrawText(string Text, int X, int Y, SFML.Graphics.Color Colo // Define os dados TempText.CharacterSize = 10; - TempText.Color = Color; - TempText.Position = new Vector2f(X, Y); + TempText.FillColor = Color; + TempText.Position = new SFML.System.Vector2f(X, Y); // Desenha RenderWindow.Draw(TempText); } - public static void Render_Box(Texture Texture, byte Margin, Point Position, Size Size) + private static void DrawText(string Text, int X, int Y, SFML.Graphics.Color Color, int Max_Width, bool Cut = true) + { + string Temp_Text; + int Message_Width = Tools.MeasureString(Text), Split = -1; + + // Caso couber, adiciona a mensagem normalmente + if (Message_Width < Max_Width) + DrawText(Text, X, Y, Color); + else + for (int i = 0; i < Text.Length; i++) + { + // Verifica se o caráctere é um separável + switch (Text[i]) + { + case '-': + case '_': + case ' ': Split = i; break; + } + + // Desenha a parte do texto que cabe + Temp_Text = Text.Substring(0, i); + if (Tools.MeasureString(Temp_Text) > Max_Width) + { + // Divide o texto novamente caso tenha encontrado um ponto de divisão + if (Cut && Split != -1) Temp_Text = Text.Substring(0, Split + 1); + + // Desenha o texto cortado + DrawText(Temp_Text, X, Y, Color); + DrawText(Text.Substring(Temp_Text.Length), X, Y + 12, Color, Max_Width); + return; + } + } + } + + private static void Render_Box(Texture Texture, byte Margin, Point Position, Size Size) { int Texture_Width = TSize(Texture).Width; int Texture_Height = TSize(Texture).Height; @@ -142,12 +179,27 @@ public static void Render_Box(Texture Texture, byte Margin, Point Position, Size } #endregion - public static void LoadTextures() + public static void Init() { - // Inicia os dispositivos - RenderWindow = new RenderWindow(Window.Objects.Handle); + // Carrega a fonte Font_Default = new SFML.Graphics.Font(Directories.Fonts.FullName + "Georgia.ttf"); + // Carrega as texturas + LoadTextures(); + + // Inicia a janela + RenderWindow = new RenderWindow(new VideoMode(800, 608), Lists.Options.Game_Name, Styles.Close); + RenderWindow.Closed += new EventHandler(Window.OnClosed); + RenderWindow.MouseButtonPressed += new EventHandler(Window.OnMouseButtonPressed); + RenderWindow.MouseMoved += new EventHandler(Window.OnMouseMoved); + RenderWindow.MouseButtonReleased += new EventHandler(Window.OnMouseButtonReleased); + RenderWindow.KeyPressed += new EventHandler(Window.OnKeyPressed); + RenderWindow.KeyReleased += new EventHandler(Window.OnKeyReleased); + RenderWindow.TextEntered += new EventHandler(Window.OnTextEntered); + } + + private static void LoadTextures() + { // Conjuntos Tex_Character = LoadTextures(Directories.Tex_Characters.FullName); Tex_Tile = LoadTextures(Directories.Tex_Tiles.FullName); @@ -171,6 +223,9 @@ public static void LoadTextures() Tex_Bars_Panel = new Texture(Directories.Tex_Bars_Panel.FullName + Format); Tex_Grid = new Texture(Directories.Tex_Grid.FullName + Format); Tex_Equipments = new Texture(Directories.Tex_Equipments.FullName + Format); + Tex_Blood = new Texture(Directories.Tex_Blood.FullName + Format); + Tex_Party_Bars = new Texture(Directories.Tex_Party_Bars.FullName + Format); + Tex_Intro = new Texture(Directories.Tex_Intro.FullName + Format); } public static void Present() @@ -185,15 +240,15 @@ public static void Present() Interface(Tools.Order); // Desenha os dados do jogo - DrawText("FPS: " + Game.FPS.ToString(), 8, 73, SFML.Graphics.Color.White); - DrawText("Latency: " + Game.Latency.ToString(), 8, 83, SFML.Graphics.Color.White); + DrawText("FPS: " + Game.FPS.ToString(), 176, 7, SFML.Graphics.Color.White); + DrawText("Latency: " + Game.Latency.ToString(), 176, 19, SFML.Graphics.Color.White); if (Tools.CurrentWindow == Tools.Windows.Game) Game_Chat(); // Exibe o que foi renderizado RenderWindow.Display(); } - public static void InGame() + private static void InGame() { // Não desenhar se não estiver em jogo if (Tools.CurrentWindow != Tools.Windows.Game) return; @@ -204,6 +259,7 @@ public static void InGame() // Desenhos abaixo do jogador Map_Panorama(); Map_Tiles((byte)Map.Layers.Ground); + Map_Blood(); Map_Items(); // Desenha os NPCs @@ -226,6 +282,9 @@ public static void InGame() Map_Weather(); Map_Fog(); Map_Name(); + + // Desenha os membros da party + Player_Party(); } #region Tools @@ -248,7 +307,7 @@ private static void Interface(List Node) } } - public static void Button(Buttons.Structure Tool) + private static void Button(Buttons.Structure Tool) { byte Alpha = 225; @@ -263,27 +322,27 @@ public static void Button(Buttons.Structure Tool) Render(Tex_Button[Tool.Texture_Num], Tool.Position, new SFML.Graphics.Color(255, 255, 225, Alpha)); } - public static void Panel(Panels.Structure Tool) + private static void Panel(Panels.Structure Tool) { // Desenha o painel Render(Tex_Panel[Tool.Texture_Num], Tool.Position); } - public static void CheckBox(CheckBoxes.Structure Tool) + private static void CheckBox(CheckBoxes.Structure Tool) { // Define as propriedades dos retângulos Rectangle Rec_Source = new Rectangle(new Point(), new Size(TSize(Tex_CheckBox).Width / 2, TSize(Tex_CheckBox).Height)); Rectangle Rec_Destiny = new Rectangle(Tool.Position, Rec_Source.Size); // Desenha a textura do marcador pelo seu estado - if (Tool.State) Rec_Source.Location = new Point(TSize(Tex_CheckBox).Width / 2, 0); + if (Tool.Checked) Rec_Source.Location = new Point(TSize(Tex_CheckBox).Width / 2, 0); // Desenha o marcador Render(Tex_CheckBox, Rec_Source, Rec_Destiny); DrawText(Tool.Text, Rec_Destiny.Location.X + TSize(Tex_CheckBox).Width / 2 + CheckBoxes.Margin, Rec_Destiny.Location.Y + 1, SFML.Graphics.Color.White); } - public static void TextBox(TextBoxes.Structure Tool) + private static void TextBox(TextBoxes.Structure Tool) { Point Position = Tool.Position; string Text = Tool.Text; @@ -305,7 +364,7 @@ public static void TextBox(TextBoxes.Structure Tool) } #endregion - public static void Interface_Specific(Tools.Structure Tool) + private static void Interface_Specific(Tools.Structure Tool) { // Interações especificas if (!(Tool is Panels.Structure)) return; @@ -318,12 +377,12 @@ public static void Interface_Specific(Tools.Structure Tool) case "Menu_Inventory": Game_Menu_Inventory((Panels.Structure)Tool); break; case "Bars": Game_Bars(); break; case "Information": Panel_Informations(); break; + case "Party_Invitation": Party_Invitation((Panels.Structure)Tool); break; } } - public static void SelectCharacter_Class() + private static void SelectCharacter_Class() { - short Texture_Num; Point Text_Position = new Point(399, 425); string Text = "(" + Game.SelectCharacter + ") None"; @@ -344,13 +403,8 @@ public static void SelectCharacter_Class() return; } - // Textura do personagem - if (Lists.Characters[Game.SelectCharacter].Genre) - Texture_Num = Lists.Class[Class].Texture_Male; - else - Texture_Num = Lists.Class[Class].Texture_Female; - // Desenha o personagem + short Texture_Num = Lists.Characters[Game.SelectCharacter].Texture_Num; if (Texture_Num > 0) { Render(Tex_Face[Texture_Num], new Point(353, 442)); @@ -362,29 +416,33 @@ public static void SelectCharacter_Class() DrawText(Text, Text_Position.X - Tools.MeasureString(Text) / 2, Text_Position.Y, SFML.Graphics.Color.White); } - public static void CreateCharacter_Class() + private static void CreateCharacter_Class() { - short Texture; + short Texture_Num = 0; + Lists.Structures.Class Class = Lists.Class[Game.CreateCharacter_Class]; // Textura do personagem - if (CheckBoxes.Get("GenderMale").State) - Texture = Lists.Class[Game.CreateCharacter_Class].Texture_Male; - else - Texture = Lists.Class[Game.CreateCharacter_Class].Texture_Female; + if (CheckBoxes.Get("GenderMale").Checked && Class.Tex_Male.Length > 0) + Texture_Num = Class.Tex_Male[Game.CreateCharacter_Tex]; + else if (Class.Tex_Female.Length > 0) + Texture_Num = Class.Tex_Female[Game.CreateCharacter_Tex]; // Desenha o personagem - if (Texture > 0) + if (Texture_Num > 0) { - Render(Tex_Face[Texture], new Point(425, 467)); - Character(Texture, new Point(430, 527), Game.Directions.Down, Game.Animation_Stopped); + Render(Tex_Face[Texture_Num], new Point(425, 440)); + Character(Texture_Num, new Point(433, 501), Game.Directions.Down, Game.Animation_Stopped); } // Desenha o nome da classe - string Text = Lists.Class[Game.CreateCharacter_Class].Name; - DrawText(Text, 471 - Tools.MeasureString(Text) / 2, 449, SFML.Graphics.Color.White); + string Text = Class.Name; + DrawText(Text, 347 - Tools.MeasureString(Text) / 2, 509, SFML.Graphics.Color.White); + + // Descrição + DrawText(Class.Description, 282, 526, SFML.Graphics.Color.White, 123); } - public static void Game_Hotbar(Panels.Structure Tool) + private static void Game_Hotbar(Panels.Structure Tool) { string Indicator = string.Empty; Point Panel_Position = Tool.Position; @@ -429,7 +487,7 @@ public static void Game_Hotbar(Panels.Structure Tool) if (Game.Need_Information == 0) Panels.Get("Information").Visible = false; } - public static void Game_Menu_Character(Panels.Structure Tool) + private static void Game_Menu_Character(Panels.Structure Tool) { Point Panel_Position = Tool.Position; Game.Need_Information &= ~(1 << 1); @@ -437,7 +495,7 @@ public static void Game_Menu_Character(Panels.Structure Tool) // Dados básicos DrawText(Player.Me.Name, Panel_Position.X + 18, Panel_Position.Y + 52, SFML.Graphics.Color.White); DrawText(Player.Me.Level.ToString(), Panel_Position.X + 18, Panel_Position.Y + 79, SFML.Graphics.Color.White); - Render(Tex_Face[Lists.Class[Player.Me.Class].Texture_Male], new Point(Panel_Position.X + 82, Panel_Position.Y + 37)); + Render(Tex_Face[Player.Me.Texture_Num], new Point(Panel_Position.X + 82, Panel_Position.Y + 37)); // Atributos DrawText("Strength: " + Player.Me.Attribute[(byte)Game.Attributes.Strength], Panel_Position.X + 32, Panel_Position.Y + 146, SFML.Graphics.Color.White); @@ -469,7 +527,7 @@ public static void Game_Menu_Character(Panels.Structure Tool) if (Game.Need_Information == 0) Panels.Get("Information").Visible = false; } - public static void Game_Menu_Inventory(Panels.Structure Tool) + private static void Game_Menu_Inventory(Panels.Structure Tool) { byte NumColumns = 5; Point Panel_Position = Tool.Position; @@ -502,43 +560,61 @@ public static void Game_Menu_Inventory(Panels.Structure Tool) if (Game.Need_Information == 0) Panels.Get("Information").Visible = false; } - public static void Panel_Informations() + private static void Panel_Informations() { short Item_Num = Game.Infomation_Index; + SFML.Graphics.Color Text_Color; // Apenas se necessário if (Item_Num == -1) return; + // Define a cor de acordo com a raridade + switch ((Game.Rarity)Lists.Item[Item_Num].Rarity) + { + case Game.Rarity.Uncommon: Text_Color = CColor(204, 255, 153); break; // Verde + case Game.Rarity.Rare: Text_Color = CColor(102, 153, 255); break; // Azul + case Game.Rarity.Epic: Text_Color = CColor(153, 0, 204); break; // Roxo + case Game.Rarity.Legendary: Text_Color = CColor(255, 255, 77); break; // Amarelo + default: Text_Color = CColor(255, 255, 255); break; // Branco + } + // Informações Point Position = Panels.Get("Information").Position; - DrawText(Lists.Item[Item_Num].Name, Position.X + 9, Position.Y + 6, SFML.Graphics.Color.Yellow); + DrawText(Lists.Item[Item_Num].Name, Position.X + 9, Position.Y + 6, Text_Color); Render(Tex_Item[Lists.Item[Item_Num].Texture], new Rectangle(Position.X + 9, Position.Y + 21, 64, 64)); - // Requerimentos - if (Lists.Item[Item_Num].Type != (byte)Game.Itens.None) - { - DrawText("Req level: " + Lists.Item[Item_Num].Req_Level, Position.X + 9, Position.Y + 90, SFML.Graphics.Color.White); - if (Lists.Item[Item_Num].Req_Class > 0) - DrawText("Req class: " + Lists.Class[Lists.Item[Item_Num].Req_Class].Name, Position.X + 9, Position.Y + 102, SFML.Graphics.Color.White); - else - DrawText("Req class: None", Position.X + 9, Position.Y + 102, SFML.Graphics.Color.White); - } + // Descrição + DrawText(Lists.Item[Item_Num].Description, Position.X + 82, Position.Y + 20, SFML.Graphics.Color.White, 86); - // Específicas - if (Lists.Item[Item_Num].Type == (byte)Game.Itens.Potion) - { - for (byte n = 0; n < (byte)Game.Vitals.Count; n++) - DrawText(((Game.Vitals)n).ToString() + ": " + Lists.Item[Item_Num].Potion_Vital[n], Position.X + 100, Position.Y + 18 + 12 * n, SFML.Graphics.Color.White); - DrawText("Exp: " + Lists.Item[Item_Num].Potion_Experience, Position.X + 100, Position.Y + 42, SFML.Graphics.Color.White); - } - else if (Lists.Item[Item_Num].Type == (byte)Game.Itens.Equipment) + // Posições + Point[] Positions = { new Point(Position.X + 10, Position.Y + 90), new Point(Position.X + 10, Position.Y + 102), new Point(Position.X + 10, Position.Y + 114), new Point(Position.X + 96, Position.Y + 90), new Point(Position.X + 96, Position.Y + 102), new Point(Position.X + 96, Position.Y + 114) }; + byte p = 0; // iterador + + // Informações específicas + switch ((Game.Items)Lists.Item[Item_Num].Type) { - for (byte n = 0; n < (byte)Game.Attributes.Count; n++) DrawText(((Game.Attributes)n).ToString() + ": " + Lists.Item[Item_Num].Equip_Attribute[n], Position.X + 100, Position.Y + 18 + 12 * n, SFML.Graphics.Color.White); - if (Lists.Item[Item_Num].Equip_Type == (byte)Game.Equipments.Weapon) DrawText("Dano: " + Lists.Item[Item_Num].Weapon_Damage, Position.X + 100, Position.Y + 18 + 60, SFML.Graphics.Color.White); + // Poção + case Game.Items.Potion: + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) + if (Lists.Item[Item_Num].Potion_Vital[n] != 0) + DrawText(((Game.Vitals)n).ToString() + ": " + Lists.Item[Item_Num].Potion_Vital[n], Positions[p].X, Positions[p++].Y, SFML.Graphics.Color.White); + + if (Lists.Item[Item_Num].Potion_Experience != 0) DrawText("Experience: " + Lists.Item[Item_Num].Potion_Experience, Positions[p].X, Positions[p++].Y, SFML.Graphics.Color.White); + break; + // Equipamentos + case Game.Items.Equipment: + if (Lists.Item[Item_Num].Equip_Type == (byte)Game.Equipments.Weapon) + if (Lists.Item[Item_Num].Weapon_Damage != 0) + DrawText("Damage: " + Lists.Item[Item_Num].Weapon_Damage, Positions[p].X, Positions[p++].Y, SFML.Graphics.Color.White); + + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) + if (Lists.Item[Item_Num].Equip_Attribute[n] != 0) + DrawText(((Game.Attributes)n).ToString() + ": " + Lists.Item[Item_Num].Equip_Attribute[n], Positions[p].X, Positions[p++].Y, SFML.Graphics.Color.White); + break; } } - public static void Game_Bars() + private static void Game_Bars() { decimal HP_Percentage = Player.Me.Vital[(byte)Game.Vitals.HP] / (decimal)Player.Me.Max_Vital[(byte)Game.Vitals.HP]; decimal MP_Percentage = Player.Me.Vital[(byte)Game.Vitals.MP] / (decimal)Player.Me.Max_Vital[(byte)Game.Vitals.MP]; @@ -558,28 +634,28 @@ public static void Game_Bars() DrawText(Player.Me.Vital[(byte)Game.Vitals.HP] + "/" + Player.Me.Max_Vital[(byte)Game.Vitals.HP], 70, 15, SFML.Graphics.Color.White); DrawText(Player.Me.Vital[(byte)Game.Vitals.MP] + "/" + Player.Me.Max_Vital[(byte)Game.Vitals.MP], 70, 33, SFML.Graphics.Color.White); DrawText(Player.Me.Experience + "/" + Player.Me.ExpNeeded, 70, 51, SFML.Graphics.Color.White); - DrawText("Position: " + Player.Me.X + "/" + Player.Me.Y, 8, 93, SFML.Graphics.Color.White); + DrawText("Position: " + Player.Me.X + "/" + Player.Me.Y, 176, 31, SFML.Graphics.Color.White); } - public static void Game_Chat() + private static void Game_Chat() { Panels.Structure Tool = Panels.Get("Chat"); Tool.Visible = TextBoxes.Focused != null && ((TextBoxes.Structure)TextBoxes.Focused.Data).Name.Equals("Chat"); // Renderiza as mensagens - if (Tools.Chat_Text_Visible) - for (byte i = Tools.Chat_Line; i <= Tools.Chat_Lines_Visible + Tools.Chat_Line; i++) - if (Tools.Chat.Count > i) - DrawText(Tools.Chat[i].Text, 16, 461 + 11 * (i - Tools.Chat_Line), Tools.Chat[i].Color); + if (Tool.Visible || (Chat.Text_Visible && Lists.Options.Chat)) + for (byte i = Chat.Lines_First; i <= Chat.Lines_Visible + Chat.Lines_First; i++) + if (Chat.Order.Count > i) + DrawText(Chat.Order[i].Text, 16, 461 + 11 * (i - Chat.Lines_First), Chat.Order[i].Color); // Dica de como abrir o chat if (!Tool.Visible) DrawText("Press [Enter] to open chat.", TextBoxes.Get("Chat").Position.X + 5, TextBoxes.Get("Chat").Position.Y + 3, SFML.Graphics.Color.White); } - public static void Character(short Textura, Point Position, Game.Directions Direction, byte Column, bool Hurt = false) + private static void Character(short Texture_Num, Point Position, Game.Directions Direction, byte Column, bool Hurt = false) { Rectangle Rec_Source = new Rectangle(), Rec_Destiny; - Size Size = TSize(Tex_Character[Textura]); + Size Size = TSize(Tex_Character[Texture_Num]); SFML.Graphics.Color Color = new SFML.Graphics.Color(255, 255, 255); byte Line = 0; @@ -604,6 +680,28 @@ public static void Character(short Textura, Point Position, Game.Directions Dire // Desenha o personagem e sua sombra Render(Tex_Shadow, Rec_Destiny.Location.X, Rec_Destiny.Location.Y + Size.Height / Game.Animation_Amount - TSize(Tex_Shadow).Height + 5, 0, 0, Size.Width / Game.Animation_Amount, TSize(Tex_Shadow).Height); - Render(Tex_Character[Textura], Rec_Source, Rec_Destiny, Color); + Render(Tex_Character[Texture_Num], Rec_Source, Rec_Destiny, Color); + } + + private static void Party_Invitation(Panels.Structure Tool) + { + DrawText(Game.Party_Invitation + " has invite you to a party. Would you like to join?", Tool.Position.X + 14, Tool.Position.Y + 33, SFML.Graphics.Color.White, 160); + } + + private static void Player_Party() + { + for (byte i = 0; i < Player.Me.Party.Length; i++) + { + Lists.Structures.Player Member = Lists.Player[Player.Me.Party[i]]; + + // Barras do membro + Render(Tex_Party_Bars, 10, 92 + (27 * i), 0, 0, 82, 8); // HP Cinza + Render(Tex_Party_Bars, 10, 99 + (27 * i), 0, 0, 82, 8); // MP Cinza + if (Member.Vital[(byte)Game.Vitals.HP] > 0) Render(Tex_Party_Bars, 10, 92 + (27 * i), 0, 8, (Member.Vital[(byte)Game.Vitals.HP] * 82) / Member.Max_Vital[(byte)Game.Vitals.HP], 8); // HP + if (Member.Vital[(byte)Game.Vitals.MP] > 0) Render(Tex_Party_Bars, 10, 99 + (27 * i), 0, 16, (Member.Vital[(byte)Game.Vitals.MP] * 82) / Member.Max_Vital[(byte)Game.Vitals.MP], 8); // MP + + // Nome do membro + DrawText(Lists.Player[Player.Me.Party[i]].Name, 10, 79 + (27 * i), SFML.Graphics.Color.White); + } } } \ No newline at end of file diff --git a/Source/Client/Network/Receive.cs b/Source/Client/Network/Receive.cs index 052e5679..a3d1c792 100644 --- a/Source/Client/Network/Receive.cs +++ b/Source/Client/Network/Receive.cs @@ -6,7 +6,7 @@ partial class Receive { // Pacotes do servidor - public enum Packets + private enum Packets { Alert, Connect, @@ -41,7 +41,9 @@ public enum Packets Map_NPC_Attack, Map_NPC_Died, Items, - Map_Items + Map_Items, + Party, + Party_Invitation } public static void Handle(NetIncomingMessage Data) @@ -83,6 +85,8 @@ public static void Handle(NetIncomingMessage Data) case Packets.Map_NPC_Died: Map_NPC_Died(Data); break; case Packets.Items: Items(Data); break; case Packets.Map_Items: Map_Items(Data); break; + case Packets.Party: Party(Data); break; + case Packets.Party_Invitation: Party_Invitation(Data); break; } } @@ -119,9 +123,10 @@ private static void CreateCharacter() { // Reseta os valores TextBoxes.Get("CreateCharacter_Name").Text = string.Empty; - CheckBoxes.Get("GenderMale").State = true; - CheckBoxes.Get("GenderFemale").State = false; + CheckBoxes.Get("GenderMale").Checked = true; + CheckBoxes.Get("GenderFemale").Checked = false; Game.CreateCharacter_Class = 1; + Game.CreateCharacter_Tex = 0; // Abre o painel de criação de personagem Panels.Menu_Close(); @@ -138,12 +143,13 @@ private static void Classes(NetIncomingMessage Data) for (byte i = 1; i <= Amount; i++) { // Recebe os dados do personagem - Lists.Class[i] = new Lists.Structures.Class - { - Name = Data.ReadString(), - Texture_Male = Data.ReadInt16(), - Texture_Female = Data.ReadInt16() - }; + Lists.Class[i] = new Lists.Structures.Class(); + Lists.Class[i].Name = Data.ReadString(); + Lists.Class[i].Description = Data.ReadString(); + Lists.Class[i].Tex_Male = new short[Data.ReadByte()]; + for (byte n = 0; n < Lists.Class[i].Tex_Male.Length; n++) Lists.Class[i].Tex_Male[n] = Data.ReadInt16(); + Lists.Class[i].Tex_Female = new short[Data.ReadByte()]; + for (byte n = 0; n < Lists.Class[i].Tex_Female.Length; n++) Lists.Class[i].Tex_Female[n] = Data.ReadInt16(); } } @@ -162,6 +168,7 @@ private static void Characters(NetIncomingMessage Data) { Name = Data.ReadString(), Class = Data.ReadByte(), + Texture_Num = Data.ReadInt16(), Genre = Data.ReadBoolean(), Level = Data.ReadInt16() }; @@ -171,13 +178,23 @@ private static void Characters(NetIncomingMessage Data) private static void JoinGame() { // Reseta os valores - Tools.Chat = new System.Collections.Generic.List(); - Tools.Chat_Line = 0; + Chat.Order = new System.Collections.Generic.List(); + Chat.Lines_First = 0; TextBoxes.Get("Chat").Text = string.Empty; - Panels.Get("Chat").Visible = false; - CheckBoxes.Get("Options_Sounds").State = Lists.Options.Sounds; - CheckBoxes.Get("Options_Music").State = Lists.Options.Musics; + CheckBoxes.Get("Options_Sounds").Checked = Lists.Options.Sounds; + CheckBoxes.Get("Options_Musics").Checked = Lists.Options.Musics; + CheckBoxes.Get("Options_Chat").Checked = Chat.Text_Visible = Lists.Options.Chat; Game.Need_Information = 0; + Loop.Chat_Timer = Loop.Chat_Timer = Environment.TickCount + 10000; + Player.Me.Party = new byte[0]; + + // Fecha os paineis + Panels.Get("Menu_Character").Visible = false; + Panels.Get("Menu_Inventory").Visible = false; + Panels.Get("Menu_Options").Visible = false; + Panels.Get("Chat").Visible = false; + Panels.Get("Drop").Visible = false; + Panels.Get("Party_Invitation").Visible = false; // Abre o jogo Audio.Music.Stop(); @@ -190,7 +207,7 @@ private static void HigherIndex(NetIncomingMessage Data) Player.HigherIndex = Data.ReadByte(); } - public static void Map_Revision(NetIncomingMessage Data) + private static void Map_Revision(NetIncomingMessage Data) { bool Needed = false; short Map_Num = Data.ReadInt16(); @@ -212,9 +229,12 @@ public static void Map_Revision(NetIncomingMessage Data) // Solicita os dados do mapa Send.RequestMap(Needed); + + // Reseta os sangues do mapa + Lists.Temp_Map.Blood = new System.Collections.Generic.List(); } - public static void Map(NetIncomingMessage Data) + private static void Map(NetIncomingMessage Data) { // Define os dados short Map_Num = Data.ReadInt16(); @@ -234,8 +254,8 @@ public static void Map(NetIncomingMessage Data) Lists.Map.Fog.Speed_X = Data.ReadSByte(); Lists.Map.Fog.Speed_Y = Data.ReadSByte(); Lists.Map.Fog.Alpha = Data.ReadByte(); - Data.ReadByte(); // Light global - Data.ReadByte(); // lighting + Data.ReadByte(); // Luz global + Data.ReadByte(); // Iluminação // Ligações Lists.Map.Link = new short[(byte)Game.Directions.Count]; @@ -317,7 +337,7 @@ public static void Map(NetIncomingMessage Data) global::Map.Autotile.Update(); } - public static void JoinMap() + private static void JoinMap() { // Se tiver, reproduz a música de fundo do mapa if (Lists.Map.Music > 0) @@ -326,24 +346,24 @@ public static void JoinMap() Audio.Music.Stop(); } - public static void Latency() + private static void Latency() { // Define a latência Game.Latency = Environment.TickCount - Game.Latency_Send; } - public static void Message(NetIncomingMessage Data) + private static void Message(NetIncomingMessage Data) { // Adiciona a mensagem string Text = Data.ReadString(); Color Color = Color.FromArgb(Data.ReadInt32()); - Tools.Chat_Add(Text, new SFML.Graphics.Color(Color.R, Color.G, Color.B)); + Chat.AddText(Text, new SFML.Graphics.Color(Color.R, Color.G, Color.B)); } - public static void Items(NetIncomingMessage Data) + private static void Items(NetIncomingMessage Data) { // Quantidade de itens - Lists.Item = new Lists.Structures.Items[Data.ReadInt16() + 1]; + Lists.Item = new Lists.Structures.Items[Data.ReadInt16()]; for (short i = 1; i < Lists.Item.Length; i++) { @@ -358,10 +378,11 @@ public static void Items(NetIncomingMessage Data) Lists.Item[i].Type = Data.ReadByte(); Data.ReadInt16(); // Price Data.ReadBoolean(); // Stackable - Data.ReadBoolean(); // Bind + Lists.Item[i].Bind = (Game.BindOn)Data.ReadByte(); + Lists.Item[i].Rarity = Data.ReadByte(); Lists.Item[i].Req_Level = Data.ReadInt16(); Lists.Item[i].Req_Class = Data.ReadByte(); - Lists.Item[i].Potion_Experience = Data.ReadInt16(); + Lists.Item[i].Potion_Experience = Data.ReadInt32(); for (byte v = 0; v < (byte)Game.Vitals.Count; v++) Lists.Item[i].Potion_Vital[v] = Data.ReadInt16(); Lists.Item[i].Equip_Type = Data.ReadByte(); for (byte a = 0; a < (byte)Game.Attributes.Count; a++) Lists.Item[i].Equip_Attribute[a] = Data.ReadInt16(); @@ -369,7 +390,7 @@ public static void Items(NetIncomingMessage Data) } } - public static void Map_Items(NetIncomingMessage Data) + private static void Map_Items(NetIncomingMessage Data) { // Quantidade Lists.Temp_Map.Item = new Lists.Structures.Map_Items[Data.ReadInt16() + 1]; @@ -383,4 +404,18 @@ public static void Map_Items(NetIncomingMessage Data) Lists.Temp_Map.Item[i].Y = Data.ReadByte(); } } + + private static void Party(NetIncomingMessage Data) + { + // Lê os dados do grupo + Player.Me.Party = new byte[Data.ReadByte()]; + for (byte i = 0; i < Player.Me.Party.Length; i++) Player.Me.Party[i] = Data.ReadByte(); + } + + private static void Party_Invitation(NetIncomingMessage Data) + { + // Abre a janela de convite para o grupo + Game.Party_Invitation = Data.ReadString(); + Panels.Get("Party_Invitation").Visible = true; + } } \ No newline at end of file diff --git a/Source/Client/Network/Send.cs b/Source/Client/Network/Send.cs index 32e39166..3f764119 100644 --- a/Source/Client/Network/Send.cs +++ b/Source/Client/Network/Send.cs @@ -26,10 +26,14 @@ public enum Packets Equipment_Remove, Hotbar_Add, Hotbar_Change, - Hotbar_Use + Hotbar_Use, + Party_Invite, + Party_Decline, + Party_Leave, + Party_Accept } - public static void Packet(NetOutgoingMessage Data) + private static void Packet(NetOutgoingMessage Data) { // Envia os dados ao servidor Socket.Device.SendMessage(Data, NetDeliveryMethod.ReliableOrdered); @@ -66,7 +70,8 @@ public static void CreateCharacter() Data.Write((byte)Packets.CreateCharacter); Data.Write(TextBoxes.Get("CreateCharacter_Name").Text); Data.Write(Game.CreateCharacter_Class); - Data.Write(CheckBoxes.Get("GenderMale").State); + Data.Write(CheckBoxes.Get("GenderMale").Checked); + Data.Write(Game.CreateCharacter_Tex); Packet(Data); } @@ -152,13 +157,14 @@ public static void CollectItem() Packet(Data); } - public static void DropItem(byte Slot) + public static void DropItem(byte Slot, short Amount) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Packets.DropItem); Data.Write(Slot); + Data.Write(Amount); Packet(Data); } @@ -171,6 +177,9 @@ public static void Inventory_Change(byte Old, byte New) Data.Write(Old); Data.Write(New); Packet(Data); + + // Fecha o painel de soltar item + Panels.Get("Drop").Visible = false; } public static void Inventory_Use(byte Slot) @@ -181,6 +190,9 @@ public static void Inventory_Use(byte Slot) Data.Write((byte)Packets.Inventory_Use); Data.Write(Slot); Packet(Data); + + // Fecha o painel de soltar item + Panels.Get("Drop").Visible = false; } public static void Equipment_Remove(byte Slot) @@ -217,12 +229,86 @@ public static void Hotbar_Change(byte Old, byte New) } public static void Hotbar_Use(byte Slot) + { + if (TextBoxes.Focused == null) + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Hotbar_Use); + Data.Write(Slot); + Packet(Data); + + // Fecha o painel de soltar item + Panels.Get("Drop").Visible = false; + } + } + + public static void Party_Invite(string Player_Name) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - Data.Write((byte)Packets.Hotbar_Use); - Data.Write(Slot); + Data.Write((byte)Packets.Party_Invite); + Data.Write(Player_Name); + Packet(Data); + } + + public static void Party_Accept() + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Party_Accept); + Packet(Data); + } + + public static void Party_Decline() + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Party_Decline); + Packet(Data); + } + + public static void Party_Leave() + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Party_Leave); + Packet(Data); + } + + public static void Player_Direction() + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Player_Direction); + Data.Write((byte)Player.Me.Direction); + Packet(Data); + } + + public static void Player_Move() + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Player_Move); + Data.Write(Player.Me.X); + Data.Write(Player.Me.Y); + Data.Write((byte)Player.Me.Movement); + Packet(Data); + } + + public static void Player_Attack() + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Packets.Player_Attack); Packet(Data); } } \ No newline at end of file diff --git a/Source/Client/Network/Socket.cs b/Source/Client/Network/Socket.cs index d8dfdd3c..a9fb7845 100644 --- a/Source/Client/Network/Socket.cs +++ b/Source/Client/Network/Socket.cs @@ -7,7 +7,7 @@ class Socket public static NetClient Device; // Manuseamento dos dados - public static NetIncomingMessage Data; + private static NetIncomingMessage Data; // Dados para a conexão com o servidor public const string IP = "localhost"; diff --git a/Source/Client/Program.cs b/Source/Client/Program.cs index 63eca15e..05d8dd03 100644 --- a/Source/Client/Program.cs +++ b/Source/Client/Program.cs @@ -7,7 +7,7 @@ class Program public static bool Working = true; [STAThread] - public static void Main() + static void Main() { // Verifica se todos os diretórios existem, se não existirem então criá-los Directories.Create(); @@ -15,18 +15,16 @@ public static void Main() // Carrega todos os dados Read.Data(); - // Inicializa todos os dispositivos - Graphics.LoadTextures(); - Audio.Sound.Load(); - Socket.Init(); - // Abre a janela Game.OpenMenu(); - Window.Objects.Text = Lists.Options.GameName; - Window.Objects.Visible = true; + + // Inicializa todos os dispositivos + Socket.Init(); + Audio.Sound.Load(); + Graphics.Init(); // Inicia a aplicação - Loop.Main(); + Loop.Init(); } public static void Close() diff --git a/Source/Client/Properties/AssemblyInfo.cs b/Source/Client/Properties/AssemblyInfo.cs index 6f18749b..7fd09bae 100644 --- a/Source/Client/Properties/AssemblyInfo.cs +++ b/Source/Client/Properties/AssemblyInfo.cs @@ -3,5 +3,6 @@ [assembly: AssemblyTitle("Client")] [assembly: AssemblyCompany("Ricardo Dalarme")] [assembly: AssemblyProduct("CryBits")] -[assembly: AssemblyCopyright("Copyright (c) 2020 Ricardo Dalarme de Oliveira Filho")] -[assembly: AssemblyDescription("ORPG Game Engine")] \ No newline at end of file +[assembly: AssemblyCopyright("Copyright (c) 2020 Ricardo Dalarme")] +[assembly: AssemblyDescription("ORPG Game Engine")] +[assembly: AssemblyVersion("0.7.0")] \ No newline at end of file diff --git a/Source/Client/Window.Designer.cs b/Source/Client/Window.Designer.cs deleted file mode 100644 index fc3b21cf..00000000 --- a/Source/Client/Window.Designer.cs +++ /dev/null @@ -1,55 +0,0 @@ -partial class Window -{ - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // Window - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 608); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.Name = "Window"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Window"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Window_FormClosing); - this.Paint += new System.Windows.Forms.PaintEventHandler(this.Window_Paint); - this.DoubleClick += new System.EventHandler(this.Window_DoubleClick); - this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Window_KeyDown); - this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Window_KeyPress); - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Window_KeyUp); - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Window_MouseDown); - this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Window_MouseMove); - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Window_MouseUp); - this.ResumeLayout(false); - - } - - #endregion -} \ No newline at end of file diff --git a/Source/Client/Window.cs b/Source/Client/Window.cs deleted file mode 100644 index 7ace6e82..00000000 --- a/Source/Client/Window.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System.Collections.Generic; -using System.Windows.Forms; - -public partial class Window : Form -{ - // Usado para acessar os dados da janela - public static Window Objects = new Window(); - - public Window() - { - InitializeComponent(); - } - - private void Window_FormClosing(object sender, FormClosingEventArgs e) - { - // Fecha o jogo - if (Tools.CurrentWindow == Tools.Windows.Game) - { - e.Cancel = true; - Game.Leave(); - } - else - Program.Working = false; - } - - private void Window_MouseDown(object sender, MouseEventArgs e) - { - // Percorre toda a árvore de ordem para executar o comando - Stack> Stack = new Stack>(); - Stack.Push(Tools.Order); - while (Stack.Count != 0) - { - List Top = Stack.Pop(); - - for (byte i = 0; i < Top.Count; i++) - if (Top[i].Data.Visible) - { - // Executa o comando - if (Top[i].Data is Buttons.Structure) ((Buttons.Structure)Top[i].Data).MouseDown(e); - Stack.Push(Top[i].Nodes); - } - } - - // Eventos em jogo - if (Tools.CurrentWindow == Tools.Windows.Game) - { - Tools.Inventory_MouseDown(e); - Tools.Equipment_MouseDown(e); - Tools.Hotbar_MouseDown(e); - } - } - - private void Window_MouseMove(object sender, MouseEventArgs e) - { - // Define a posição do mouse à váriavel - Tools.Mouse.X = e.X; - Tools.Mouse.Y = e.Y; - - // Percorre toda a árvore de ordem para executar o comando - Stack> Stack = new Stack>(); - Stack.Push(Tools.Order); - while (Stack.Count != 0) - { - List Top = Stack.Pop(); - - for (byte i = 0; i < Top.Count; i++) - if (Top[i].Data.Visible) - { - // Executa o comando - if (Top[i].Data is Buttons.Structure) ((Buttons.Structure)Top[i].Data).MouseMove(e); - Stack.Push(Top[i].Nodes); - } - } - } - - private void Window_MouseUp(object sender, MouseEventArgs e) - { - // Percorre toda a árvore de ordem para executar o comando - Stack> Stack = new Stack>(); - Stack.Push(Tools.Order); - while (Stack.Count != 0) - { - List Top = Stack.Pop(); - - for (byte i = 0; i < Top.Count; i++) - if (Top[i].Data.Visible) - { - // Executa o comando - if (Top[i].Data is Buttons.Structure) ((Buttons.Structure)Top[i].Data).MouseUp(); - else if (Top[i].Data is CheckBoxes.Structure) ((CheckBoxes.Structure)Top[i].Data).MouseUp(); - else if (Top[i].Data is TextBoxes.Structure) ((TextBoxes.Structure)Top[i].Data).MouseUp(Top[i]); - Stack.Push(Top[i].Nodes); - } - } - - // Eventos em jogo - if (Tools.CurrentWindow == Tools.Windows.Game) - { - // Muda o slot do item - if (Player.Inventory_Change > 0) - if (Tools.Inventory_Mouse() > 0) - Send.Inventory_Change(Player.Inventory_Change, Tools.Inventory_Mouse()); - - // Muda o slot da hotbar - if (Tools.Hotbar_Mouse() > 0) - { - if (Player.Hotbar_Change > 0) Send.Hotbar_Change(Player.Hotbar_Change, Tools.Hotbar_Mouse()); - if (Player.Inventory_Change > 0) Send.Hotbar_Add(Tools.Hotbar_Mouse(), (byte)Game.Hotbar.Item, Player.Inventory_Change); - } - - // Reseta a movimentação - Player.Inventory_Change = 0; - Player.Hotbar_Change = 0; - } - } - - private void Window_KeyPress(object sender, KeyPressEventArgs e) - { - // Altera o foco do digitalizador para o próximo - if (e.KeyChar == (char)Keys.Tab) - { - TextBoxes.ChangeFocus(); - return; - } - - // Executa os eventos - if (TextBoxes.Focused != null) ((TextBoxes.Structure)TextBoxes.Focused.Data).KeyPress(e); - } - - private void Window_KeyDown(object sender, KeyEventArgs e) - { - // Define se um botão está sendo pressionado - switch (e.KeyCode) - { - case Keys.Up: Game.Press_Up = true; break; - case Keys.Down: Game.Press_Down = true; break; - case Keys.Left: Game.Press_Left = true; break; - case Keys.Right: Game.Press_Right = true; break; - case Keys.ShiftKey: Game.Press_Shift = true; break; - case Keys.ControlKey: Game.Press_Control = true; break; - case Keys.Enter: TextBoxes.Chat_Type(); break; - } - - // Em jogo - if (Tools.CurrentWindow == Tools.Windows.Game) - if (!Panels.Get("Chat").Visible) - { - // Panels.Get("Information").Visible = false; - - switch (e.KeyCode) - { - case Keys.Space: Player.CollectItem(); break; - case Keys.D1: Send.Hotbar_Use(1); break; - case Keys.D2: Send.Hotbar_Use(2); break; - case Keys.D3: Send.Hotbar_Use(3); break; - case Keys.D4: Send.Hotbar_Use(4); break; - case Keys.D5: Send.Hotbar_Use(5); break; - case Keys.D6: Send.Hotbar_Use(6); break; - case Keys.D7: Send.Hotbar_Use(7); break; - case Keys.D8: Send.Hotbar_Use(8); break; - case Keys.D9: Send.Hotbar_Use(9); break; - case Keys.D0: Send.Hotbar_Use(0); break; - } - } - } - - private void Window_KeyUp(object sender, KeyEventArgs e) - { - // Define se um botão está sendo pressionado - switch (e.KeyCode) - { - case Keys.Up: Game.Press_Up = false; break; - case Keys.Down: Game.Press_Down = false; break; - case Keys.Left: Game.Press_Left = false; break; - case Keys.Right: Game.Press_Right = false; break; - case Keys.ShiftKey: Game.Press_Shift = false; break; - case Keys.ControlKey: Game.Press_Control = false; break; - } - } - - private void Window_Paint(object sender, PaintEventArgs e) - { - // Atualiza a Window - Graphics.Present(); - } - - private void Window_DoubleClick(object sender, System.EventArgs e) - { - // Eventos em jogo - if (Tools.CurrentWindow == Tools.Windows.Game) - { - // Usar item - byte Slot = Tools.Inventory_Mouse(); - if (Slot > 0) - if (Player.Inventory[Slot].Item_Num > 0) - Send.Inventory_Use(Slot); - - // Usar o que estiver na hotbar - Slot = Tools.Hotbar_Mouse(); - if (Slot > 0) - if (Player.Hotbar[Slot].Slot > 0) - Send.Hotbar_Use(Slot); - } - } -} \ No newline at end of file diff --git a/Source/Client/icon.png b/Source/Client/icon.png new file mode 100644 index 00000000..2237047e Binary files /dev/null and b/Source/Client/icon.png differ diff --git a/Source/Editors/Editors.csproj b/Source/Editors/Editors.csproj index b3b978a2..d5fe382c 100644 --- a/Source/Editors/Editors.csproj +++ b/Source/Editors/Editors.csproj @@ -9,7 +9,7 @@ Properties Editors Editors - v4.6 + v4.8 512 false publicar\ @@ -71,14 +71,17 @@ False ..\..\..\lidgren-network-gen3-master\Lidgren.Network\bin\Debug\Lidgren.Network.dll - - ..\Referências\sfmlnet-audio-2.dll + + ..\..\Dev\Referências\SFML.Audio.dll - - ..\Referências\sfmlnet-graphics-2.dll + + ..\..\Dev\Referências\SFML.Graphics.dll - - ..\Referências\sfmlnet-window-2.dll + + ..\..\Dev\Referências\SFML.System.dll + + + ..\..\Dev\Referências\SFML.Window.dll ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll @@ -88,7 +91,6 @@ - @@ -228,7 +230,6 @@ false - diff --git a/Source/Editors/Editors/Classes.Designer.cs b/Source/Editors/Editors/Classes.Designer.cs index 3e1162e0..07f7a9ef 100644 --- a/Source/Editors/Editors/Classes.Designer.cs +++ b/Source/Editors/Editors/Classes.Designer.cs @@ -29,6 +29,8 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editor_Classes)); this.List = new System.Windows.Forms.ListBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtDescription = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); this.txtName = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.butSave = new System.Windows.Forms.Button(); @@ -50,20 +52,35 @@ private void InitializeComponent() this.lblMP = new System.Windows.Forms.Label(); this.lblHP = new System.Windows.Forms.Label(); this.grpTexture = new System.Windows.Forms.GroupBox(); + this.butFDelete = new System.Windows.Forms.Button(); + this.butMDelete = new System.Windows.Forms.Button(); + this.lstFemale = new System.Windows.Forms.ListBox(); + this.lstMale = new System.Windows.Forms.ListBox(); this.lblFTexture = new System.Windows.Forms.Label(); this.butFTexture = new System.Windows.Forms.Button(); this.lblMTexture = new System.Windows.Forms.Label(); this.butMTexture = new System.Windows.Forms.Button(); this.butQuantity = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.label9 = new System.Windows.Forms.Label(); + this.numSpawn_Y = new System.Windows.Forms.NumericUpDown(); this.numSpawn_X = new System.Windows.Forms.NumericUpDown(); + this.numSpawn_Map = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); this.cmbSpawn_Direction = new System.Windows.Forms.ComboBox(); - this.numSpawn_Y = new System.Windows.Forms.NumericUpDown(); this.label10 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); - this.numSpawn_Map = new System.Windows.Forms.NumericUpDown(); this.label7 = new System.Windows.Forms.Label(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.label12 = new System.Windows.Forms.Label(); + this.butItem_Delete = new System.Windows.Forms.Button(); + this.lstItems = new System.Windows.Forms.ListBox(); + this.butItem_Add = new System.Windows.Forms.Button(); + this.grpItem_Add = new System.Windows.Forms.GroupBox(); + this.numItem_Amount = new System.Windows.Forms.NumericUpDown(); + this.label13 = new System.Windows.Forms.Label(); + this.cmbItems = new System.Windows.Forms.ComboBox(); + this.label16 = new System.Windows.Forms.Label(); + this.butItem_Ok = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numAgility)).BeginInit(); @@ -75,9 +92,12 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numHP)).BeginInit(); this.grpTexture.SuspendLayout(); this.groupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numSpawn_X)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numSpawn_Y)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numSpawn_X)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numSpawn_Map)).BeginInit(); + this.groupBox4.SuspendLayout(); + this.grpItem_Add.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numItem_Amount)).BeginInit(); this.SuspendLayout(); // // List @@ -85,33 +105,53 @@ private void InitializeComponent() this.List.FormattingEnabled = true; this.List.Location = new System.Drawing.Point(11, 12); this.List.Name = "List"; - this.List.Size = new System.Drawing.Size(202, 446); + this.List.Size = new System.Drawing.Size(202, 420); this.List.TabIndex = 9; this.List.SelectedIndexChanged += new System.EventHandler(this.List_SelectedIndexChanged); // // groupBox1 // + this.groupBox1.Controls.Add(this.txtDescription); + this.groupBox1.Controls.Add(this.label11); this.groupBox1.Controls.Add(this.txtName); this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Location = new System.Drawing.Point(219, 12); + this.groupBox1.Location = new System.Drawing.Point(221, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(304, 70); + this.groupBox1.Size = new System.Drawing.Size(304, 161); this.groupBox1.TabIndex = 14; this.groupBox1.TabStop = false; this.groupBox1.Text = "General"; // + // txtDescription + // + this.txtDescription.Location = new System.Drawing.Point(9, 81); + this.txtDescription.Multiline = true; + this.txtDescription.Name = "txtDescription"; + this.txtDescription.Size = new System.Drawing.Size(285, 69); + this.txtDescription.TabIndex = 12; + this.txtDescription.TextChanged += new System.EventHandler(this.txtDescription_TextChanged); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(6, 65); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(63, 13); + this.label11.TabIndex = 11; + this.label11.Text = "Description:"; + // // txtName // - this.txtName.Location = new System.Drawing.Point(15, 37); + this.txtName.Location = new System.Drawing.Point(9, 37); this.txtName.Name = "txtName"; - this.txtName.Size = new System.Drawing.Size(273, 20); + this.txtName.Size = new System.Drawing.Size(285, 20); this.txtName.TabIndex = 10; this.txtName.Validated += new System.EventHandler(this.txtName_Validated); // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 19); + this.label3.Location = new System.Drawing.Point(6, 21); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(38, 13); this.label3.TabIndex = 9; @@ -119,19 +159,19 @@ private void InitializeComponent() // // butSave // - this.butSave.Location = new System.Drawing.Point(219, 467); + this.butSave.Location = new System.Drawing.Point(219, 437); this.butSave.Name = "butSave"; - this.butSave.Size = new System.Drawing.Size(97, 25); + this.butSave.Size = new System.Drawing.Size(201, 25); this.butSave.TabIndex = 16; - this.butSave.Text = "Save"; + this.butSave.Text = "Save All"; this.butSave.UseVisualStyleBackColor = true; this.butSave.Click += new System.EventHandler(this.butSave_Click); // // butCancel // - this.butCancel.Location = new System.Drawing.Point(426, 467); + this.butCancel.Location = new System.Drawing.Point(634, 437); this.butCancel.Name = "butCancel"; - this.butCancel.Size = new System.Drawing.Size(97, 25); + this.butCancel.Size = new System.Drawing.Size(201, 25); this.butCancel.TabIndex = 17; this.butCancel.Text = "Cancel"; this.butCancel.UseVisualStyleBackColor = true; @@ -139,9 +179,9 @@ private void InitializeComponent() // // butClear // - this.butClear.Location = new System.Drawing.Point(323, 467); + this.butClear.Location = new System.Drawing.Point(427, 437); this.butClear.Name = "butClear"; - this.butClear.Size = new System.Drawing.Size(97, 25); + this.butClear.Size = new System.Drawing.Size(201, 25); this.butClear.TabIndex = 18; this.butClear.Text = "Clear"; this.butClear.UseVisualStyleBackColor = true; @@ -163,33 +203,33 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.numHP); this.groupBox2.Controls.Add(this.lblMP); this.groupBox2.Controls.Add(this.lblHP); - this.groupBox2.Location = new System.Drawing.Point(219, 276); + this.groupBox2.Location = new System.Drawing.Point(221, 179); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(304, 185); + this.groupBox2.Size = new System.Drawing.Size(304, 140); this.groupBox2.TabIndex = 20; this.groupBox2.TabStop = false; this.groupBox2.Text = "Base Attributes"; // // numAgility // - this.numAgility.Location = new System.Drawing.Point(154, 118); + this.numAgility.Location = new System.Drawing.Point(9, 113); this.numAgility.Name = "numAgility"; - this.numAgility.Size = new System.Drawing.Size(139, 20); + this.numAgility.Size = new System.Drawing.Size(90, 20); this.numAgility.TabIndex = 32; this.numAgility.ValueChanged += new System.EventHandler(this.numAgility_ValueChanged); // // numVitality // - this.numVitality.Location = new System.Drawing.Point(10, 159); + this.numVitality.Location = new System.Drawing.Point(106, 113); this.numVitality.Name = "numVitality"; - this.numVitality.Size = new System.Drawing.Size(138, 20); + this.numVitality.Size = new System.Drawing.Size(90, 20); this.numVitality.TabIndex = 34; this.numVitality.ValueChanged += new System.EventHandler(this.numVitality_ValueChanged); // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(7, 143); + this.label4.Location = new System.Drawing.Point(103, 96); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(40, 13); this.label4.TabIndex = 33; @@ -198,7 +238,7 @@ private void InitializeComponent() // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(151, 102); + this.label6.Location = new System.Drawing.Point(8, 97); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(37, 13); this.label6.TabIndex = 31; @@ -206,16 +246,16 @@ private void InitializeComponent() // // numIntelligence // - this.numIntelligence.Location = new System.Drawing.Point(10, 117); + this.numIntelligence.Location = new System.Drawing.Point(203, 71); this.numIntelligence.Name = "numIntelligence"; - this.numIntelligence.Size = new System.Drawing.Size(138, 20); + this.numIntelligence.Size = new System.Drawing.Size(90, 20); this.numIntelligence.TabIndex = 29; this.numIntelligence.ValueChanged += new System.EventHandler(this.numIntelligence_ValueChanged); // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(7, 101); + this.label5.Location = new System.Drawing.Point(200, 55); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(64, 13); this.label5.TabIndex = 27; @@ -223,9 +263,9 @@ private void InitializeComponent() // // numResistance // - this.numResistance.Location = new System.Drawing.Point(154, 72); + this.numResistance.Location = new System.Drawing.Point(106, 71); this.numResistance.Name = "numResistance"; - this.numResistance.Size = new System.Drawing.Size(139, 20); + this.numResistance.Size = new System.Drawing.Size(90, 20); this.numResistance.TabIndex = 26; this.numResistance.ValueChanged += new System.EventHandler(this.numResistance_ValueChanged); // @@ -233,14 +273,14 @@ private void InitializeComponent() // this.numStrength.Location = new System.Drawing.Point(10, 72); this.numStrength.Name = "numStrength"; - this.numStrength.Size = new System.Drawing.Size(138, 20); + this.numStrength.Size = new System.Drawing.Size(90, 20); this.numStrength.TabIndex = 25; this.numStrength.ValueChanged += new System.EventHandler(this.numStrength_ValueChanged); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(151, 56); + this.label1.Location = new System.Drawing.Point(103, 55); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(63, 13); this.label1.TabIndex = 24; @@ -291,58 +331,98 @@ private void InitializeComponent() // // grpTexture // + this.grpTexture.Controls.Add(this.butFDelete); + this.grpTexture.Controls.Add(this.butMDelete); + this.grpTexture.Controls.Add(this.lstFemale); + this.grpTexture.Controls.Add(this.lstMale); this.grpTexture.Controls.Add(this.lblFTexture); this.grpTexture.Controls.Add(this.butFTexture); this.grpTexture.Controls.Add(this.lblMTexture); this.grpTexture.Controls.Add(this.butMTexture); - this.grpTexture.Location = new System.Drawing.Point(219, 88); + this.grpTexture.Location = new System.Drawing.Point(531, 12); this.grpTexture.Name = "grpTexture"; - this.grpTexture.Size = new System.Drawing.Size(304, 70); + this.grpTexture.Size = new System.Drawing.Size(304, 201); this.grpTexture.TabIndex = 19; this.grpTexture.TabStop = false; this.grpTexture.Text = "Textures:"; // + // butFDelete + // + this.butFDelete.Location = new System.Drawing.Point(225, 172); + this.butFDelete.Name = "butFDelete"; + this.butFDelete.Size = new System.Drawing.Size(68, 20); + this.butFDelete.TabIndex = 35; + this.butFDelete.Text = "Delete"; + this.butFDelete.UseVisualStyleBackColor = true; + this.butFDelete.Click += new System.EventHandler(this.butFDelete_Click); + // + // butMDelete + // + this.butMDelete.Location = new System.Drawing.Point(79, 172); + this.butMDelete.Name = "butMDelete"; + this.butMDelete.Size = new System.Drawing.Size(68, 20); + this.butMDelete.TabIndex = 34; + this.butMDelete.Text = "Delete"; + this.butMDelete.UseVisualStyleBackColor = true; + this.butMDelete.Click += new System.EventHandler(this.butMDelete_Click); + // + // lstFemale + // + this.lstFemale.FormattingEnabled = true; + this.lstFemale.Location = new System.Drawing.Point(155, 40); + this.lstFemale.Name = "lstFemale"; + this.lstFemale.Size = new System.Drawing.Size(139, 121); + this.lstFemale.TabIndex = 33; + // + // lstMale + // + this.lstMale.FormattingEnabled = true; + this.lstMale.Location = new System.Drawing.Point(9, 40); + this.lstMale.Name = "lstMale"; + this.lstMale.Size = new System.Drawing.Size(139, 121); + this.lstMale.TabIndex = 32; + // // lblFTexture // this.lblFTexture.AutoSize = true; - this.lblFTexture.Location = new System.Drawing.Point(12, 51); + this.lblFTexture.Location = new System.Drawing.Point(152, 24); this.lblFTexture.Name = "lblFTexture"; - this.lblFTexture.Size = new System.Drawing.Size(53, 13); + this.lblFTexture.Size = new System.Drawing.Size(47, 13); this.lblFTexture.TabIndex = 31; - this.lblFTexture.Text = "Female: 0"; + this.lblFTexture.Text = "Female: "; // // butFTexture // - this.butFTexture.Location = new System.Drawing.Point(104, 44); + this.butFTexture.Location = new System.Drawing.Point(154, 172); this.butFTexture.Name = "butFTexture"; - this.butFTexture.Size = new System.Drawing.Size(189, 20); + this.butFTexture.Size = new System.Drawing.Size(68, 20); this.butFTexture.TabIndex = 30; - this.butFTexture.Text = "Select"; + this.butFTexture.Text = "Add"; this.butFTexture.UseVisualStyleBackColor = true; this.butFTexture.Click += new System.EventHandler(this.butFTexture_Click); // // lblMTexture // this.lblMTexture.AutoSize = true; - this.lblMTexture.Location = new System.Drawing.Point(12, 26); + this.lblMTexture.Location = new System.Drawing.Point(7, 24); this.lblMTexture.Name = "lblMTexture"; - this.lblMTexture.Size = new System.Drawing.Size(42, 13); + this.lblMTexture.Size = new System.Drawing.Size(33, 13); this.lblMTexture.TabIndex = 29; - this.lblMTexture.Text = "Male: 0"; + this.lblMTexture.Text = "Male:"; // // butMTexture // - this.butMTexture.Location = new System.Drawing.Point(104, 19); + this.butMTexture.Location = new System.Drawing.Point(8, 172); this.butMTexture.Name = "butMTexture"; - this.butMTexture.Size = new System.Drawing.Size(189, 20); + this.butMTexture.Size = new System.Drawing.Size(68, 20); this.butMTexture.TabIndex = 28; - this.butMTexture.Text = "Select"; + this.butMTexture.Text = "Add"; this.butMTexture.UseVisualStyleBackColor = true; this.butMTexture.Click += new System.EventHandler(this.butMTexture_Click); // // butQuantity // - this.butQuantity.Location = new System.Drawing.Point(11, 467); + this.butQuantity.Location = new System.Drawing.Point(12, 438); this.butQuantity.Name = "butQuantity"; this.butQuantity.Size = new System.Drawing.Size(202, 25); this.butQuantity.TabIndex = 15; @@ -352,29 +432,28 @@ private void InitializeComponent() // // groupBox3 // - this.groupBox3.Controls.Add(this.label9); + this.groupBox3.Controls.Add(this.numSpawn_Y); this.groupBox3.Controls.Add(this.numSpawn_X); + this.groupBox3.Controls.Add(this.numSpawn_Map); + this.groupBox3.Controls.Add(this.label9); this.groupBox3.Controls.Add(this.cmbSpawn_Direction); - this.groupBox3.Controls.Add(this.numSpawn_Y); this.groupBox3.Controls.Add(this.label10); this.groupBox3.Controls.Add(this.label8); - this.groupBox3.Controls.Add(this.numSpawn_Map); this.groupBox3.Controls.Add(this.label7); - this.groupBox3.Location = new System.Drawing.Point(219, 164); + this.groupBox3.Location = new System.Drawing.Point(221, 325); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(304, 106); this.groupBox3.TabIndex = 35; this.groupBox3.TabStop = false; this.groupBox3.Text = "Spawn"; // - // label9 + // numSpawn_Y // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 62); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(17, 13); - this.label9.TabIndex = 26; - this.label9.Text = "X:"; + this.numSpawn_Y.Location = new System.Drawing.Point(155, 78); + this.numSpawn_Y.Name = "numSpawn_Y"; + this.numSpawn_Y.Size = new System.Drawing.Size(138, 20); + this.numSpawn_Y.TabIndex = 27; + this.numSpawn_Y.ValueChanged += new System.EventHandler(this.numSpawn_Y_ValueChanged); // // numSpawn_X // @@ -384,6 +463,33 @@ private void InitializeComponent() this.numSpawn_X.TabIndex = 27; this.numSpawn_X.ValueChanged += new System.EventHandler(this.numSpawn_X_ValueChanged); // + // numSpawn_Map + // + this.numSpawn_Map.Location = new System.Drawing.Point(9, 36); + this.numSpawn_Map.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numSpawn_Map.Name = "numSpawn_Map"; + this.numSpawn_Map.Size = new System.Drawing.Size(139, 20); + this.numSpawn_Map.TabIndex = 23; + this.numSpawn_Map.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numSpawn_Map.ValueChanged += new System.EventHandler(this.numSpawn_Map_ValueChanged); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(6, 62); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(17, 13); + this.label9.TabIndex = 26; + this.label9.Text = "X:"; + // // cmbSpawn_Direction // this.cmbSpawn_Direction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -399,14 +505,6 @@ private void InitializeComponent() this.cmbSpawn_Direction.TabIndex = 28; this.cmbSpawn_Direction.SelectedIndexChanged += new System.EventHandler(this.cmbSpawn_Direction_SelectedIndexChanged); // - // numSpawn_Y - // - this.numSpawn_Y.Location = new System.Drawing.Point(155, 78); - this.numSpawn_Y.Name = "numSpawn_Y"; - this.numSpawn_Y.Size = new System.Drawing.Size(138, 20); - this.numSpawn_Y.TabIndex = 27; - this.numSpawn_Y.ValueChanged += new System.EventHandler(this.numSpawn_Y_ValueChanged); - // // label10 // this.label10.AutoSize = true; @@ -425,39 +523,144 @@ private void InitializeComponent() this.label8.TabIndex = 24; this.label8.Text = "Direction:"; // - // numSpawn_Map + // label7 // - this.numSpawn_Map.Location = new System.Drawing.Point(9, 36); - this.numSpawn_Map.Minimum = new decimal(new int[] { + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(6, 20); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(31, 13); + this.label7.TabIndex = 22; + this.label7.Text = "Map:"; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.label12); + this.groupBox4.Controls.Add(this.butItem_Delete); + this.groupBox4.Controls.Add(this.lstItems); + this.groupBox4.Controls.Add(this.butItem_Add); + this.groupBox4.Location = new System.Drawing.Point(531, 219); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(304, 212); + this.groupBox4.TabIndex = 36; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Initial Items"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.Location = new System.Drawing.Point(61, 166); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(184, 12); + this.label12.TabIndex = 36; + this.label12.Text = "(Equipments will be automatically equipped)"; + // + // butItem_Delete + // + this.butItem_Delete.Location = new System.Drawing.Point(152, 184); + this.butItem_Delete.Name = "butItem_Delete"; + this.butItem_Delete.Size = new System.Drawing.Size(139, 20); + this.butItem_Delete.TabIndex = 35; + this.butItem_Delete.Text = "Delete"; + this.butItem_Delete.UseVisualStyleBackColor = true; + this.butItem_Delete.Click += new System.EventHandler(this.butItem_Delete_Click); + // + // lstItems + // + this.lstItems.FormattingEnabled = true; + this.lstItems.Location = new System.Drawing.Point(10, 16); + this.lstItems.Name = "lstItems"; + this.lstItems.Size = new System.Drawing.Size(284, 147); + this.lstItems.TabIndex = 34; + // + // butItem_Add + // + this.butItem_Add.Location = new System.Drawing.Point(8, 184); + this.butItem_Add.Name = "butItem_Add"; + this.butItem_Add.Size = new System.Drawing.Size(138, 20); + this.butItem_Add.TabIndex = 33; + this.butItem_Add.Text = "Add"; + this.butItem_Add.UseVisualStyleBackColor = true; + this.butItem_Add.Click += new System.EventHandler(this.butItem_Add_Click); + // + // grpItem_Add + // + this.grpItem_Add.Controls.Add(this.numItem_Amount); + this.grpItem_Add.Controls.Add(this.label13); + this.grpItem_Add.Controls.Add(this.cmbItems); + this.grpItem_Add.Controls.Add(this.label16); + this.grpItem_Add.Controls.Add(this.butItem_Ok); + this.grpItem_Add.Location = new System.Drawing.Point(531, 219); + this.grpItem_Add.Name = "grpItem_Add"; + this.grpItem_Add.Size = new System.Drawing.Size(304, 212); + this.grpItem_Add.TabIndex = 38; + this.grpItem_Add.TabStop = false; + this.grpItem_Add.Text = "Add Item"; + this.grpItem_Add.Visible = false; + // + // numItem_Amount + // + this.numItem_Amount.Location = new System.Drawing.Point(29, 117); + this.numItem_Amount.Minimum = new decimal(new int[] { 1, 0, 0, 0}); - this.numSpawn_Map.Name = "numSpawn_Map"; - this.numSpawn_Map.Size = new System.Drawing.Size(139, 20); - this.numSpawn_Map.TabIndex = 23; - this.numSpawn_Map.Value = new decimal(new int[] { + this.numItem_Amount.Name = "numItem_Amount"; + this.numItem_Amount.Size = new System.Drawing.Size(251, 20); + this.numItem_Amount.TabIndex = 32; + this.numItem_Amount.Value = new decimal(new int[] { 1, 0, 0, 0}); - this.numSpawn_Map.ValueChanged += new System.EventHandler(this.numSpawn_Map_ValueChanged); // - // label7 + // label13 // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 20); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(31, 13); - this.label7.TabIndex = 22; - this.label7.Text = "Map:"; + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(26, 103); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(46, 13); + this.label13.TabIndex = 31; + this.label13.Text = "Amount:"; + // + // cmbItems + // + this.cmbItems.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbItems.FormattingEnabled = true; + this.cmbItems.Location = new System.Drawing.Point(29, 79); + this.cmbItems.Name = "cmbItems"; + this.cmbItems.Size = new System.Drawing.Size(251, 21); + this.cmbItems.TabIndex = 0; + this.cmbItems.SelectedIndexChanged += new System.EventHandler(this.cmbItems_SelectedIndexChanged); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(26, 64); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(30, 13); + this.label16.TabIndex = 30; + this.label16.Text = "Item:"; + // + // butItem_Ok + // + this.butItem_Ok.Location = new System.Drawing.Point(29, 143); + this.butItem_Ok.Name = "butItem_Ok"; + this.butItem_Ok.Size = new System.Drawing.Size(251, 20); + this.butItem_Ok.TabIndex = 29; + this.butItem_Ok.Text = "Ok"; + this.butItem_Ok.UseVisualStyleBackColor = true; + this.butItem_Ok.Click += new System.EventHandler(this.butItem_Ok_Click); // // Editor_Classes // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(535, 497); + this.ClientSize = new System.Drawing.Size(847, 475); this.ControlBox = false; + this.Controls.Add(this.grpItem_Add); + this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.butQuantity); this.Controls.Add(this.groupBox2); @@ -488,9 +691,14 @@ private void InitializeComponent() this.grpTexture.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numSpawn_X)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numSpawn_Y)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numSpawn_X)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numSpawn_Map)).EndInit(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.grpItem_Add.ResumeLayout(false); + this.grpItem_Add.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numItem_Amount)).EndInit(); this.ResumeLayout(false); } @@ -533,4 +741,21 @@ private void InitializeComponent() private System.Windows.Forms.Label label8; private System.Windows.Forms.NumericUpDown numSpawn_Map; private System.Windows.Forms.Label label7; + public System.Windows.Forms.TextBox txtDescription; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button butFDelete; + private System.Windows.Forms.Button butMDelete; + public System.Windows.Forms.ListBox lstFemale; + public System.Windows.Forms.ListBox lstMale; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.Button butItem_Delete; + public System.Windows.Forms.ListBox lstItems; + private System.Windows.Forms.Button butItem_Add; + private System.Windows.Forms.GroupBox grpItem_Add; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button butItem_Ok; + private System.Windows.Forms.ComboBox cmbItems; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.NumericUpDown numItem_Amount; + private System.Windows.Forms.Label label13; } \ No newline at end of file diff --git a/Source/Editors/Editors/Classes.cs b/Source/Editors/Editors/Classes.cs index 8ef16d98..e283a086 100644 --- a/Source/Editors/Editors/Classes.cs +++ b/Source/Editors/Editors/Classes.cs @@ -1,13 +1,13 @@ using System; using System.Windows.Forms; -public partial class Editor_Classes : Form +partial class Editor_Classes : Form { // Usado para acessar os dados da janela public static Editor_Classes Objects = new Editor_Classes(); - // Index do item selecionado - public byte Selected; + // Classe selecionada + private Lists.Structures.Class Selected; public Editor_Classes() { @@ -17,11 +17,17 @@ public Editor_Classes() public static void Request() { // Lê os dados - Send.Request_Classes(true); + Globals.OpenEditor = Objects; + Send.Request_Items(); + Send.Request_Classes(); } public static void Open() { + // Lista de itens + Objects.cmbItems.Items.Clear(); + for (byte i = 1; i < Lists.Item.Length; i++) Objects.cmbItems.Items.Add(Globals.Numbering(i, Lists.Item.GetUpperBound(0), Lists.Item[i].Name)); + // Lista os dados List_Update(); @@ -32,39 +38,45 @@ public static void Open() private static void List_Update() { - // Limpa a lista + // Adiciona as classes às listas Objects.List.Items.Clear(); - - // Adiciona os itens à lista - for (byte i = 1; i < Lists.Class.Length; i++) - Objects.List.Items.Add(Globals.Numbering(i, Lists.Class.GetUpperBound(0)) + ":" + Lists.Class[i].Name); - - // Seleciona o primeiro item + for (byte i = 1; i < Lists.Class.Length; i++) Objects.List.Items.Add(Globals.Numbering(i, Lists.Class.GetUpperBound(0), Lists.Class[i].Name)); Objects.List.SelectedIndex = 0; } private void Update_Data() { - Selected = (byte)(List.SelectedIndex + 1); - // Previne erros - if (Selected == 0) return; + if (List.SelectedIndex == -1) return; + + // Limpa os dados necessários + lstMale.Items.Clear(); + lstFemale.Items.Clear(); + lstItems.Items.Clear(); + grpItem_Add.Visible = false; // Lista os dados - txtName.Text = Lists.Class[Selected].Name; - lblMTexture.Text = "Male: " + Lists.Class[Selected].Texture_Male; - lblFTexture.Text = "Female: " + Lists.Class[Selected].Texture_Female; - numHP.Value = Lists.Class[Selected].Vital[(byte)Globals.Vitals.HP]; - numMP.Value = Lists.Class[Selected].Vital[(byte)Globals.Vitals.MP]; - numStrength.Value = Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Strength]; - numResistance.Value = Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Resistance]; - numIntelligence.Value = Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Intelligence]; - numAgility.Value = Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Agility]; - numVitality.Value = Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Vitality]; - numSpawn_Map.Value = Lists.Class[Selected].Spawn_Map; - cmbSpawn_Direction.SelectedIndex = Lists.Class[Selected].Spawn_Direction; - numSpawn_X.Value = Lists.Class[Selected].Spawn_X; - numSpawn_Y.Value = Lists.Class[Selected].Spawn_Y; + txtName.Text = Selected.Name; + txtDescription.Text = Selected.Description; + numHP.Value = Selected.Vital[(byte)Globals.Vitals.HP]; + numMP.Value = Selected.Vital[(byte)Globals.Vitals.MP]; + numStrength.Value = Selected.Attribute[(byte)Globals.Attributes.Strength]; + numResistance.Value = Selected.Attribute[(byte)Globals.Attributes.Resistance]; + numIntelligence.Value = Selected.Attribute[(byte)Globals.Attributes.Intelligence]; + numAgility.Value = Selected.Attribute[(byte)Globals.Attributes.Agility]; + numVitality.Value = Selected.Attribute[(byte)Globals.Attributes.Vitality]; + numSpawn_Map.Value = Selected.Spawn_Map; + cmbSpawn_Direction.SelectedIndex = Selected.Spawn_Direction; + numSpawn_X.Value = Selected.Spawn_X; + numSpawn_Y.Value = Selected.Spawn_Y; + for (byte i = 0; i < Selected.Tex_Male.Count; i++) lstMale.Items.Add(Selected.Tex_Male[i]); + for (byte i = 0; i < Selected.Tex_Female.Count; i++) lstFemale.Items.Add(Selected.Tex_Female[i]); + for (byte i = 0; i < Selected.Item.Count; i++) lstItems.Items.Add(Globals.Numbering(Selected.Item[i].Item1, Lists.Item.GetUpperBound(0), Lists.Item[Selected.Item[i].Item1].Name + " [" + Selected.Item[i].Item2 + "x]")); + + // Seleciona os primeiros itens + if (lstMale.Items.Count > 0) lstMale.SelectedIndex = 0; + if (lstFemale.Items.Count > 0) lstFemale.SelectedIndex = 0; + if (lstItems.Items.Count > 0) lstItems.SelectedIndex = 0; } public static void Change_Quantity() @@ -83,10 +95,10 @@ public static void Change_Quantity() List_Update(); } - #region private void List_SelectedIndexChanged(object sender, EventArgs e) { // Atualiza a lista + Selected = Lists.Class[List.SelectedIndex + 1]; Update_Data(); } @@ -103,10 +115,10 @@ private void butSave_Click(object sender, EventArgs e) private void butClear_Click(object sender, EventArgs e) { // Limpa os dados - Clear.Class(Selected); + Clear.Class((byte)(List.SelectedIndex + 1)); // Atualiza os valores - List.Items[Selected - 1] = Globals.Numbering(Selected, List.Items.Count) + ":"; + List.Items[List.SelectedIndex] = Globals.Numbering(List.SelectedIndex + 1, List.Items.Count, string.Empty); Update_Data(); } @@ -126,91 +138,147 @@ private void butQuantity_Click(object sender, EventArgs e) private void txtName_Validated(object sender, EventArgs e) { // Atualiza a lista - if (Selected > 0) - { - Lists.Class[Selected].Name = txtName.Text; - List.Items[Selected - 1] = Globals.Numbering(Selected, List.Items.Count) + ":" + txtName.Text; - } + Selected.Name = txtName.Text; + List.Items[List.SelectedIndex] = Globals.Numbering(List.SelectedIndex + 1, List.Items.Count, txtName.Text); + } + + private void txtDescription_TextChanged(object sender, EventArgs e) + { + Selected.Description = txtDescription.Text; } private void numHP_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Vital[(byte)Globals.Vitals.HP] = (short)numHP.Value; + Selected.Vital[(byte)Globals.Vitals.HP] = (short)numHP.Value; } private void numMP_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Vital[(byte)Globals.Vitals.MP] = (short)numMP.Value; + Selected.Vital[(byte)Globals.Vitals.MP] = (short)numMP.Value; } private void numStrength_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Strength] = (short)numStrength.Value; + Selected.Attribute[(byte)Globals.Attributes.Strength] = (short)numStrength.Value; } private void numResistance_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Resistance] = (short)numResistance.Value; + Selected.Attribute[(byte)Globals.Attributes.Resistance] = (short)numResistance.Value; } private void numIntelligence_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Intelligence] = (short)numIntelligence.Value; + Selected.Attribute[(byte)Globals.Attributes.Intelligence] = (short)numIntelligence.Value; } private void numAgility_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Agility] = (short)numAgility.Value; + Selected.Attribute[(byte)Globals.Attributes.Agility] = (short)numAgility.Value; } private void numVitality_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Attribute[(byte)Globals.Attributes.Vitality] = (short)numVitality.Value; + Selected.Attribute[(byte)Globals.Attributes.Vitality] = (short)numVitality.Value; } private void butMTexture_Click(object sender, EventArgs e) { - // Abre a pré visualização - Lists.Class[Selected].Texture_Male = Preview.Select(Graphics.Tex_Character, Lists.Class[Selected].Texture_Male); - lblMTexture.Text = "Male: " + Lists.Class[Selected].Texture_Male; + // Adiciona a textura + short Texture_Num = Preview.Select(Graphics.Tex_Character, 0); + if (Texture_Num != 0) + { + Selected.Tex_Male.Add(Texture_Num); + lstMale.Items.Add(Texture_Num); + } } private void butFTexture_Click(object sender, EventArgs e) { - // Abre a pré visualização - Lists.Class[Selected].Texture_Female = Preview.Select(Graphics.Tex_Character, Lists.Class[Selected].Texture_Female); - lblFTexture.Text = "Female: " + Lists.Class[Selected].Texture_Female; + // Adiciona a textura + short Texture_Num = Preview.Select(Graphics.Tex_Character, 0); + if (Texture_Num != 0) + { + Selected.Tex_Female.Add(Texture_Num); + lstFemale.Items.Add(Texture_Num); + } + } + + private void butMDelete_Click(object sender, EventArgs e) + { + // Deleta a textura + short Selected_Item = (short)lstMale.SelectedIndex; + if (Selected_Item != -1) + { + lstMale.Items.RemoveAt(Selected_Item); + Selected.Tex_Male.RemoveAt(Selected_Item); + } + } + + private void butFDelete_Click(object sender, EventArgs e) + { + // Deleta a textura + short Selected_Item = (short)lstFemale.SelectedIndex; + if (Selected_Item != -1) + { + lstFemale.Items.RemoveAt(Selected_Item); + Selected.Tex_Female.RemoveAt(Selected_Item); + } } private void numSpawn_Map_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Spawn_Map = (short)numSpawn_Map.Value; + Selected.Spawn_Map = (short)numSpawn_Map.Value; } private void cmbSpawn_Direction_SelectedIndexChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Spawn_Direction = (byte)cmbSpawn_Direction.SelectedIndex; + Selected.Spawn_Direction = (byte)cmbSpawn_Direction.SelectedIndex; } private void numSpawn_X_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Spawn_X = (byte)numSpawn_X.Value; + Selected.Spawn_X = (byte)numSpawn_X.Value; } private void numSpawn_Y_ValueChanged(object sender, EventArgs e) { - // Define os valores - Lists.Class[Selected].Spawn_Y = (byte)numSpawn_Y.Value; + Selected.Spawn_Y = (byte)numSpawn_Y.Value; + } + private void butItem_Add_Click(object sender, EventArgs e) + { + // Abre a janela para adicionar o item + cmbItems.SelectedIndex = 0; + numItem_Amount.Value = 1; + grpItem_Add.Visible = true; + } + + private void butItem_Ok_Click(object sender, EventArgs e) + { + // Adiciona o item + if (cmbItems.SelectedIndex >= 0) + { + lstItems.Items.Add(Globals.Numbering(cmbItems.SelectedIndex + 1, Lists.Item.GetUpperBound(0), Lists.Item[cmbItems.SelectedIndex + 1].Name + " [" + numItem_Amount.Value + "x]")); + Selected.Item.Add(new Tuple((short)(cmbItems.SelectedIndex + 1), (short)numItem_Amount.Value)); + grpItem_Add.Visible = false; + } + } + + private void butItem_Delete_Click(object sender, EventArgs e) + { + // Deleta a textura + short Selected_Item = (short)lstItems.SelectedIndex; + if (Selected_Item != -1) + { + lstItems.Items.RemoveAt(Selected_Item); + Selected.Item.RemoveAt(Selected_Item); + } + } + + private void cmbItems_SelectedIndexChanged(object sender, EventArgs e) + { + // Quantidade de itens + if (cmbItems.SelectedIndex >= 0) numItem_Amount.Enabled = Lists.Item[cmbItems.SelectedIndex + 1].Stackable; + numItem_Amount.Value = 1; } - #endregion } \ No newline at end of file diff --git a/Source/Editors/Editors/Data.Designer.cs b/Source/Editors/Editors/Data.Designer.cs index c9689c29..96d865f5 100644 --- a/Source/Editors/Editors/Data.Designer.cs +++ b/Source/Editors/Editors/Data.Designer.cs @@ -28,6 +28,10 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editor_Data)); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.numMax_Map_Items = new System.Windows.Forms.NumericUpDown(); + this.label7 = new System.Windows.Forms.Label(); + this.numMax_Party_Members = new System.Windows.Forms.NumericUpDown(); + this.label6 = new System.Windows.Forms.Label(); this.txtWelcome = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.numPort = new System.Windows.Forms.NumericUpDown(); @@ -41,6 +45,8 @@ private void InitializeComponent() this.butCancel = new System.Windows.Forms.Button(); this.butSalve = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numMax_Map_Items)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numMax_Party_Members)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numPort)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numMax_Characters)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numMax_Players)).BeginInit(); @@ -48,6 +54,10 @@ private void InitializeComponent() // // groupBox1 // + this.groupBox1.Controls.Add(this.numMax_Map_Items); + this.groupBox1.Controls.Add(this.label7); + this.groupBox1.Controls.Add(this.numMax_Party_Members); + this.groupBox1.Controls.Add(this.label6); this.groupBox1.Controls.Add(this.txtWelcome); this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.numPort); @@ -60,16 +70,58 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(263, 196); + this.groupBox1.Size = new System.Drawing.Size(288, 233); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "General"; // + // numMax_Map_Items + // + this.numMax_Map_Items.Location = new System.Drawing.Point(147, 200); + this.numMax_Map_Items.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numMax_Map_Items.Name = "numMax_Map_Items"; + this.numMax_Map_Items.Size = new System.Drawing.Size(129, 20); + this.numMax_Map_Items.TabIndex = 12; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(144, 184); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(104, 13); + this.label7.TabIndex = 11; + this.label7.Text = "Maximum map items:"; + // + // numMax_Party_Members + // + this.numMax_Party_Members.Location = new System.Drawing.Point(9, 200); + this.numMax_Party_Members.Maximum = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numMax_Party_Members.Name = "numMax_Party_Members"; + this.numMax_Party_Members.Size = new System.Drawing.Size(132, 20); + this.numMax_Party_Members.TabIndex = 10; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(6, 184); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(125, 13); + this.label6.TabIndex = 9; + this.label6.Text = "Maximum party members:"; + // // txtWelcome // this.txtWelcome.Location = new System.Drawing.Point(9, 80); this.txtWelcome.Name = "txtWelcome"; - this.txtWelcome.Size = new System.Drawing.Size(246, 20); + this.txtWelcome.Size = new System.Drawing.Size(267, 20); this.txtWelcome.TabIndex = 2; // // label5 @@ -90,7 +142,7 @@ private void InitializeComponent() 0, 0}); this.numPort.Name = "numPort"; - this.numPort.Size = new System.Drawing.Size(246, 20); + this.numPort.Size = new System.Drawing.Size(267, 20); this.numPort.TabIndex = 3; // // label4 @@ -106,7 +158,7 @@ private void InitializeComponent() // this.txtGame_Name.Location = new System.Drawing.Point(9, 41); this.txtGame_Name.Name = "txtGame_Name"; - this.txtGame_Name.Size = new System.Drawing.Size(246, 20); + this.txtGame_Name.Size = new System.Drawing.Size(267, 20); this.txtGame_Name.TabIndex = 1; // // label3 @@ -120,15 +172,25 @@ private void InitializeComponent() // // numMax_Characters // - this.numMax_Characters.Location = new System.Drawing.Point(135, 161); + this.numMax_Characters.Location = new System.Drawing.Point(147, 161); + this.numMax_Characters.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); this.numMax_Characters.Name = "numMax_Characters"; - this.numMax_Characters.Size = new System.Drawing.Size(120, 20); + this.numMax_Characters.Size = new System.Drawing.Size(129, 20); this.numMax_Characters.TabIndex = 5; + this.numMax_Characters.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(132, 145); + this.label2.Location = new System.Drawing.Point(144, 145); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(107, 13); this.label2.TabIndex = 2; @@ -137,9 +199,19 @@ private void InitializeComponent() // numMax_Players // this.numMax_Players.Location = new System.Drawing.Point(9, 161); + this.numMax_Players.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); this.numMax_Players.Name = "numMax_Players"; - this.numMax_Players.Size = new System.Drawing.Size(120, 20); + this.numMax_Players.Size = new System.Drawing.Size(132, 20); this.numMax_Players.TabIndex = 4; + this.numMax_Players.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); // // label1 // @@ -152,9 +224,9 @@ private void InitializeComponent() // // butCancel // - this.butCancel.Location = new System.Drawing.Point(150, 214); + this.butCancel.Location = new System.Drawing.Point(163, 251); this.butCancel.Name = "butCancel"; - this.butCancel.Size = new System.Drawing.Size(125, 25); + this.butCancel.Size = new System.Drawing.Size(137, 25); this.butCancel.TabIndex = 20; this.butCancel.Text = "Cancel"; this.butCancel.UseVisualStyleBackColor = true; @@ -162,9 +234,9 @@ private void InitializeComponent() // // butSalve // - this.butSalve.Location = new System.Drawing.Point(12, 214); + this.butSalve.Location = new System.Drawing.Point(12, 251); this.butSalve.Name = "butSalve"; - this.butSalve.Size = new System.Drawing.Size(129, 25); + this.butSalve.Size = new System.Drawing.Size(140, 25); this.butSalve.TabIndex = 19; this.butSalve.Text = "Save"; this.butSalve.UseVisualStyleBackColor = true; @@ -174,7 +246,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(288, 250); + this.ClientSize = new System.Drawing.Size(312, 287); this.ControlBox = false; this.Controls.Add(this.butCancel); this.Controls.Add(this.butSalve); @@ -187,6 +259,8 @@ private void InitializeComponent() this.Text = "Data Editor"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numMax_Map_Items)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numMax_Party_Members)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numPort)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numMax_Characters)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numMax_Players)).EndInit(); @@ -209,4 +283,8 @@ private void InitializeComponent() private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; public System.Windows.Forms.TextBox txtWelcome; + public System.Windows.Forms.NumericUpDown numMax_Party_Members; + private System.Windows.Forms.Label label6; + public System.Windows.Forms.NumericUpDown numMax_Map_Items; + private System.Windows.Forms.Label label7; } \ No newline at end of file diff --git a/Source/Editors/Editors/Data.cs b/Source/Editors/Editors/Data.cs index a95c5c43..cb8dd5eb 100644 --- a/Source/Editors/Editors/Data.cs +++ b/Source/Editors/Editors/Data.cs @@ -13,7 +13,8 @@ public Editor_Data() public static void Request() { // Lê os dados - Send.Request_Server_Data(true); + Globals.OpenEditor = Objects; + Send.Request_Server_Data(); } public static void Open() @@ -24,6 +25,8 @@ public static void Open() Objects.numPort.Value = Lists.Server_Data.Port; Objects.numMax_Players.Value = Lists.Server_Data.Max_Players; Objects.numMax_Characters.Value = Lists.Server_Data.Max_Characters; + Objects.numMax_Party_Members.Value = Lists.Server_Data.Max_Party_Members; + Objects.numMax_Map_Items.Value = Lists.Server_Data.Max_Map_Items; // Abre a janela Selection.Objects.Visible = false; @@ -38,6 +41,8 @@ private void butSave_Click(object sender, System.EventArgs e) Lists.Server_Data.Port = (short)Objects.numPort.Value; Lists.Server_Data.Max_Players = (byte)Objects.numMax_Players.Value; Lists.Server_Data.Max_Characters = (byte)Objects.numMax_Characters.Value; + Lists.Server_Data.Max_Party_Members = (byte)Objects.numMax_Party_Members.Value; + Lists.Server_Data.Max_Map_Items = (byte)Objects.numMax_Map_Items.Value; Send.Write_Server_Data(); // Volta à janela de seleção diff --git a/Source/Editors/Editors/Interface.cs b/Source/Editors/Editors/Interface.cs index 02b48856..09e6c69c 100644 --- a/Source/Editors/Editors/Interface.cs +++ b/Source/Editors/Editors/Interface.cs @@ -18,7 +18,6 @@ public static void Open() { // Lê os dados Read.Tools(); - Read.Tools(); // Adiciona as janelas à lista Objects.cmbWindows.Items.Clear(); @@ -50,26 +49,29 @@ private void treOrder_AfterSelect(object sender, TreeViewEventArgs e) private void prgProperties_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { - byte Window = (byte)((Lists.Structures.Tool)treOrder.SelectedNode.Tag).Window; - - // Troca a ferramenta de janela - if (e.ChangedItem.Label == "Window") - { - Lists.Tool.Nodes[Window].Nodes.Add((TreeNode)treOrder.SelectedNode.Clone()); - treOrder.SelectedNode.Remove(); - cmbWindows.SelectedIndex = Window; - treOrder.SelectedNode = Lists.Tool.Nodes[Window].LastNode; - } - // Troca o nome da ferramenta - else if (e.ChangedItem.Label == "Name") + if (treOrder.SelectedNode != null) { - string Text = string.Empty; - Lists.Structures.Tool Tool = ((Lists.Structures.Tool)treOrder.SelectedNode.Tag); - if (Tool is Lists.Structures.Button) Text = "[Button] "; - else if (Tool is Lists.Structures.CheckBox) Text = "[CheckBox] "; - else if (Tool is Lists.Structures.TextBox) Text = "[TextBox] "; - else if (Tool is Lists.Structures.Panel) Text = "[Panel] "; - treOrder.SelectedNode.Text = Text + Tool.Name; + byte Window = (byte)((Lists.Structures.Tool)treOrder.SelectedNode.Tag).Window; + + // Troca a ferramenta de janela + if (e.ChangedItem.Label == "Window") + { + Lists.Tool.Nodes[Window].Nodes.Add((TreeNode)treOrder.SelectedNode.Clone()); + treOrder.SelectedNode.Remove(); + cmbWindows.SelectedIndex = Window; + treOrder.SelectedNode = Lists.Tool.Nodes[Window].LastNode; + } + // Troca o nome da ferramenta + else if (e.ChangedItem.Label == "Name") + { + string Text = string.Empty; + Lists.Structures.Tool Tool = ((Lists.Structures.Tool)treOrder.SelectedNode.Tag); + if (Tool is Lists.Structures.Button) Text = "[Button] "; + else if (Tool is Lists.Structures.CheckBox) Text = "[CheckBox] "; + else if (Tool is Lists.Structures.TextBox) Text = "[TextBox] "; + else if (Tool is Lists.Structures.Panel) Text = "[Panel] "; + treOrder.SelectedNode.Text = Text + Tool.Name; + } } } @@ -110,6 +112,7 @@ private void butConfirm_Click(object sender, EventArgs e) case Globals.Tools_Types.TextBox: Tool = new Lists.Structures.TextBox(); break; } Lists.Tool.Nodes[cmbWindows.SelectedIndex].Nodes.Add("[" + ((Globals.Tools_Types)cmbType.SelectedIndex).ToString() + "] "); + Tool.Window = (Globals.Windows)cmbWindows.SelectedIndex; Lists.Tool.Nodes[cmbWindows.SelectedIndex].LastNode.Tag = Tool; grpNew.Visible = false; } diff --git a/Source/Editors/Editors/Items.Designer.cs b/Source/Editors/Editors/Items.Designer.cs index 09c2ea6e..3121b819 100644 --- a/Source/Editors/Editors/Items.Designer.cs +++ b/Source/Editors/Editors/Items.Designer.cs @@ -29,11 +29,14 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editor_Items)); this.List = new System.Windows.Forms.ListBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.cmbRarity = new System.Windows.Forms.ComboBox(); + this.cmbBind = new System.Windows.Forms.ComboBox(); + this.label20 = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); this.numPrice = new System.Windows.Forms.NumericUpDown(); this.label18 = new System.Windows.Forms.Label(); this.txtDescription = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); - this.chkBind = new System.Windows.Forms.CheckBox(); this.chkStackable = new System.Windows.Forms.CheckBox(); this.cmbType = new System.Windows.Forms.ComboBox(); this.numTexture = new System.Windows.Forms.NumericUpDown(); @@ -52,6 +55,8 @@ private void InitializeComponent() this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.grpEquip_Bonus = new System.Windows.Forms.GroupBox(); + this.numWeapon_Damage = new System.Windows.Forms.NumericUpDown(); + this.lblWeapon_Damage = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.numEquip_Strength = new System.Windows.Forms.NumericUpDown(); this.label7 = new System.Windows.Forms.Label(); @@ -73,9 +78,6 @@ private void InitializeComponent() this.label14 = new System.Windows.Forms.Label(); this.grpEquipment = new System.Windows.Forms.GroupBox(); this.cmbEquipment_Type = new System.Windows.Forms.ComboBox(); - this.grpWeapon = new System.Windows.Forms.GroupBox(); - this.numWeapon_Damage = new System.Windows.Forms.NumericUpDown(); - this.label17 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numPrice)).BeginInit(); @@ -83,6 +85,7 @@ private void InitializeComponent() this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numReq_Level)).BeginInit(); this.grpEquip_Bonus.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numWeapon_Damage)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numEquip_Strength)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numEquip_Resistance)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numEquip_Intelligence)).BeginInit(); @@ -93,8 +96,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numPotion_HP)).BeginInit(); this.grpPotion.SuspendLayout(); this.grpEquipment.SuspendLayout(); - this.grpWeapon.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numWeapon_Damage)).BeginInit(); this.SuspendLayout(); // // List @@ -102,17 +103,20 @@ private void InitializeComponent() this.List.FormattingEnabled = true; this.List.Location = new System.Drawing.Point(11, 12); this.List.Name = "List"; - this.List.Size = new System.Drawing.Size(202, 498); + this.List.Size = new System.Drawing.Size(202, 446); this.List.TabIndex = 9; this.List.SelectedIndexChanged += new System.EventHandler(this.List_SelectedIndexChanged); // // groupBox1 // + this.groupBox1.Controls.Add(this.cmbRarity); + this.groupBox1.Controls.Add(this.cmbBind); + this.groupBox1.Controls.Add(this.label20); + this.groupBox1.Controls.Add(this.label19); this.groupBox1.Controls.Add(this.numPrice); this.groupBox1.Controls.Add(this.label18); this.groupBox1.Controls.Add(this.txtDescription); this.groupBox1.Controls.Add(this.label15); - this.groupBox1.Controls.Add(this.chkBind); this.groupBox1.Controls.Add(this.chkStackable); this.groupBox1.Controls.Add(this.cmbType); this.groupBox1.Controls.Add(this.numTexture); @@ -123,23 +127,61 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.label3); this.groupBox1.Location = new System.Drawing.Point(219, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(366, 185); + this.groupBox1.Size = new System.Drawing.Size(359, 187); this.groupBox1.TabIndex = 14; this.groupBox1.TabStop = false; this.groupBox1.Text = "General"; // + // cmbRarity + // + this.cmbRarity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbRarity.FormattingEnabled = true; + this.cmbRarity.Location = new System.Drawing.Point(272, 118); + this.cmbRarity.Name = "cmbRarity"; + this.cmbRarity.Size = new System.Drawing.Size(80, 21); + this.cmbRarity.TabIndex = 27; + this.cmbRarity.SelectedIndexChanged += new System.EventHandler(this.cmbRarity_SelectedIndexChanged); + // + // cmbBind + // + this.cmbBind.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbBind.FormattingEnabled = true; + this.cmbBind.Location = new System.Drawing.Point(184, 156); + this.cmbBind.Name = "cmbBind"; + this.cmbBind.Size = new System.Drawing.Size(80, 21); + this.cmbBind.TabIndex = 26; + this.cmbBind.SelectedIndexChanged += new System.EventHandler(this.cmbBind_SelectedIndexChanged); + // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(269, 102); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(37, 13); + this.label20.TabIndex = 29; + this.label20.Text = "Rarity:"; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(181, 141); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(31, 13); + this.label19.TabIndex = 28; + this.label19.Text = "Bind:"; + // // numPrice // - this.numPrice.Location = new System.Drawing.Point(190, 118); + this.numPrice.Location = new System.Drawing.Point(184, 118); this.numPrice.Name = "numPrice"; - this.numPrice.Size = new System.Drawing.Size(169, 20); + this.numPrice.Size = new System.Drawing.Size(80, 20); this.numPrice.TabIndex = 25; this.numPrice.ValueChanged += new System.EventHandler(this.numPrice_ValueChanged); // // label18 // this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point(187, 102); + this.label18.Location = new System.Drawing.Point(181, 102); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(34, 13); this.label18.TabIndex = 24; @@ -147,37 +189,26 @@ private void InitializeComponent() // // txtDescription // - this.txtDescription.Location = new System.Drawing.Point(15, 77); + this.txtDescription.Location = new System.Drawing.Point(7, 78); this.txtDescription.Multiline = true; this.txtDescription.Name = "txtDescription"; this.txtDescription.Size = new System.Drawing.Size(169, 98); this.txtDescription.TabIndex = 23; - this.txtDescription.Validated += new System.EventHandler(this.txtDescription_Validated); + this.txtDescription.TextChanged += new System.EventHandler(this.txtDescription_TextChanged); // // label15 // this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(12, 63); + this.label15.Location = new System.Drawing.Point(4, 63); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(63, 13); this.label15.TabIndex = 22; this.label15.Text = "Description:"; // - // chkBind - // - this.chkBind.AutoSize = true; - this.chkBind.Location = new System.Drawing.Point(190, 158); - this.chkBind.Name = "chkBind"; - this.chkBind.Size = new System.Drawing.Size(47, 17); - this.chkBind.TabIndex = 21; - this.chkBind.Text = "Bind"; - this.chkBind.UseVisualStyleBackColor = true; - this.chkBind.CheckedChanged += new System.EventHandler(this.chkBind_CheckedChanged); - // // chkStackable // this.chkStackable.AutoSize = true; - this.chkStackable.Location = new System.Drawing.Point(190, 142); + this.chkStackable.Location = new System.Drawing.Point(272, 160); this.chkStackable.Name = "chkStackable"; this.chkStackable.Size = new System.Drawing.Size(74, 17); this.chkStackable.TabIndex = 20; @@ -193,7 +224,7 @@ private void InitializeComponent() "None", "Equipment", "Potion"}); - this.cmbType.Location = new System.Drawing.Point(190, 36); + this.cmbType.Location = new System.Drawing.Point(184, 36); this.cmbType.Name = "cmbType"; this.cmbType.Size = new System.Drawing.Size(169, 21); this.cmbType.TabIndex = 18; @@ -201,15 +232,15 @@ private void InitializeComponent() // // numTexture // - this.numTexture.Location = new System.Drawing.Point(190, 79); + this.numTexture.Location = new System.Drawing.Point(184, 79); this.numTexture.Name = "numTexture"; - this.numTexture.Size = new System.Drawing.Size(82, 20); + this.numTexture.Size = new System.Drawing.Size(80, 20); this.numTexture.TabIndex = 12; this.numTexture.ValueChanged += new System.EventHandler(this.numTexture_ValueChanged); // // txtName // - this.txtName.Location = new System.Drawing.Point(15, 37); + this.txtName.Location = new System.Drawing.Point(7, 37); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(169, 20); this.txtName.TabIndex = 10; @@ -218,7 +249,7 @@ private void InitializeComponent() // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(187, 20); + this.label2.Location = new System.Drawing.Point(181, 20); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(34, 13); this.label2.TabIndex = 19; @@ -226,9 +257,9 @@ private void InitializeComponent() // // butTexture // - this.butTexture.Location = new System.Drawing.Point(278, 77); + this.butTexture.Location = new System.Drawing.Point(270, 79); this.butTexture.Name = "butTexture"; - this.butTexture.Size = new System.Drawing.Size(81, 20); + this.butTexture.Size = new System.Drawing.Size(83, 20); this.butTexture.TabIndex = 17; this.butTexture.Text = "Select"; this.butTexture.UseVisualStyleBackColor = true; @@ -237,7 +268,7 @@ private void InitializeComponent() // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(187, 63); + this.label1.Location = new System.Drawing.Point(181, 63); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(46, 13); this.label1.TabIndex = 11; @@ -246,7 +277,7 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 19); + this.label3.Location = new System.Drawing.Point(4, 19); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(38, 13); this.label3.TabIndex = 9; @@ -254,17 +285,17 @@ private void InitializeComponent() // // butSave // - this.butSave.Location = new System.Drawing.Point(219, 515); + this.butSave.Location = new System.Drawing.Point(219, 463); this.butSave.Name = "butSave"; this.butSave.Size = new System.Drawing.Size(119, 25); this.butSave.TabIndex = 16; - this.butSave.Text = "Save"; + this.butSave.Text = "Save All"; this.butSave.UseVisualStyleBackColor = true; this.butSave.Click += new System.EventHandler(this.butSave_Click); // // butCancel // - this.butCancel.Location = new System.Drawing.Point(465, 515); + this.butCancel.Location = new System.Drawing.Point(465, 463); this.butCancel.Name = "butCancel"; this.butCancel.Size = new System.Drawing.Size(119, 25); this.butCancel.TabIndex = 17; @@ -274,7 +305,7 @@ private void InitializeComponent() // // butClear // - this.butClear.Location = new System.Drawing.Point(342, 515); + this.butClear.Location = new System.Drawing.Point(342, 463); this.butClear.Name = "butClear"; this.butClear.Size = new System.Drawing.Size(119, 25); this.butClear.TabIndex = 18; @@ -284,7 +315,7 @@ private void InitializeComponent() // // butQuantity // - this.butQuantity.Location = new System.Drawing.Point(11, 515); + this.butQuantity.Location = new System.Drawing.Point(12, 464); this.butQuantity.Name = "butQuantity"; this.butQuantity.Size = new System.Drawing.Size(202, 25); this.butQuantity.TabIndex = 15; @@ -298,9 +329,9 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.numReq_Level); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.label4); - this.groupBox2.Location = new System.Drawing.Point(220, 203); + this.groupBox2.Location = new System.Drawing.Point(219, 205); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(365, 63); + this.groupBox2.Size = new System.Drawing.Size(359, 63); this.groupBox2.TabIndex = 19; this.groupBox2.TabStop = false; this.groupBox2.Text = "Requirements"; @@ -317,7 +348,7 @@ private void InitializeComponent() "Shield", "Amulet", "Potion"}); - this.cmbReq_Class.Location = new System.Drawing.Point(190, 34); + this.cmbReq_Class.Location = new System.Drawing.Point(182, 34); this.cmbReq_Class.Name = "cmbReq_Class"; this.cmbReq_Class.Size = new System.Drawing.Size(169, 21); this.cmbReq_Class.TabIndex = 20; @@ -325,7 +356,7 @@ private void InitializeComponent() // // numReq_Level // - this.numReq_Level.Location = new System.Drawing.Point(14, 35); + this.numReq_Level.Location = new System.Drawing.Point(7, 35); this.numReq_Level.Name = "numReq_Level"; this.numReq_Level.Size = new System.Drawing.Size(169, 20); this.numReq_Level.TabIndex = 14; @@ -334,7 +365,7 @@ private void InitializeComponent() // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(187, 20); + this.label5.Location = new System.Drawing.Point(180, 19); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(35, 13); this.label5.TabIndex = 21; @@ -343,7 +374,7 @@ private void InitializeComponent() // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(11, 19); + this.label4.Location = new System.Drawing.Point(4, 19); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(36, 13); this.label4.TabIndex = 13; @@ -351,6 +382,8 @@ private void InitializeComponent() // // grpEquip_Bonus // + this.grpEquip_Bonus.Controls.Add(this.numWeapon_Damage); + this.grpEquip_Bonus.Controls.Add(this.lblWeapon_Damage); this.grpEquip_Bonus.Controls.Add(this.label13); this.grpEquip_Bonus.Controls.Add(this.numEquip_Strength); this.grpEquip_Bonus.Controls.Add(this.label7); @@ -364,17 +397,38 @@ private void InitializeComponent() this.grpEquip_Bonus.Controls.Add(this.label11); this.grpEquip_Bonus.Location = new System.Drawing.Point(11, 58); this.grpEquip_Bonus.Name = "grpEquip_Bonus"; - this.grpEquip_Bonus.Size = new System.Drawing.Size(168, 167); + this.grpEquip_Bonus.Size = new System.Drawing.Size(342, 117); this.grpEquip_Bonus.TabIndex = 20; this.grpEquip_Bonus.TabStop = false; this.grpEquip_Bonus.Text = "Bonus:"; // + // numWeapon_Damage + // + this.numWeapon_Damage.Location = new System.Drawing.Point(236, 73); + this.numWeapon_Damage.Minimum = new decimal(new int[] { + 100, + 0, + 0, + -2147483648}); + this.numWeapon_Damage.Name = "numWeapon_Damage"; + this.numWeapon_Damage.Size = new System.Drawing.Size(103, 20); + this.numWeapon_Damage.TabIndex = 58; + // + // lblWeapon_Damage + // + this.lblWeapon_Damage.AutoSize = true; + this.lblWeapon_Damage.Location = new System.Drawing.Point(233, 57); + this.lblWeapon_Damage.Name = "lblWeapon_Damage"; + this.lblWeapon_Damage.Size = new System.Drawing.Size(75, 13); + this.lblWeapon_Damage.TabIndex = 57; + this.lblWeapon_Damage.Text = "Base damage:"; + // // label13 // this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label13.Location = new System.Drawing.Point(6, 135); + this.label13.Location = new System.Drawing.Point(8, 96); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(154, 27); + this.label13.Size = new System.Drawing.Size(328, 18); this.label13.TabIndex = 56; this.label13.Text = "(Negative values are also valid)"; this.label13.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -388,14 +442,14 @@ private void InitializeComponent() 0, -2147483648}); this.numEquip_Strength.Name = "numEquip_Strength"; - this.numEquip_Strength.Size = new System.Drawing.Size(72, 20); + this.numEquip_Strength.Size = new System.Drawing.Size(103, 20); this.numEquip_Strength.TabIndex = 43; this.numEquip_Strength.ValueChanged += new System.EventHandler(this.numEquip_Strength_ValueChanged); // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(8, 16); + this.label7.Location = new System.Drawing.Point(7, 16); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(50, 13); this.label7.TabIndex = 41; @@ -403,47 +457,47 @@ private void InitializeComponent() // // numEquip_Resistance // - this.numEquip_Resistance.Location = new System.Drawing.Point(88, 32); + this.numEquip_Resistance.Location = new System.Drawing.Point(122, 32); this.numEquip_Resistance.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); this.numEquip_Resistance.Name = "numEquip_Resistance"; - this.numEquip_Resistance.Size = new System.Drawing.Size(72, 20); + this.numEquip_Resistance.Size = new System.Drawing.Size(103, 20); this.numEquip_Resistance.TabIndex = 44; this.numEquip_Resistance.ValueChanged += new System.EventHandler(this.numEquip_Resistance_ValueChanged); // // numEquip_Intelligence // - this.numEquip_Intelligence.Location = new System.Drawing.Point(10, 73); + this.numEquip_Intelligence.Location = new System.Drawing.Point(235, 32); this.numEquip_Intelligence.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); this.numEquip_Intelligence.Name = "numEquip_Intelligence"; - this.numEquip_Intelligence.Size = new System.Drawing.Size(72, 20); + this.numEquip_Intelligence.Size = new System.Drawing.Size(103, 20); this.numEquip_Intelligence.TabIndex = 46; this.numEquip_Intelligence.ValueChanged += new System.EventHandler(this.numEquip_Intelligence_ValueChanged); // // numEquip_Vitality // - this.numEquip_Vitality.Location = new System.Drawing.Point(11, 112); + this.numEquip_Vitality.Location = new System.Drawing.Point(122, 73); this.numEquip_Vitality.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); this.numEquip_Vitality.Name = "numEquip_Vitality"; - this.numEquip_Vitality.Size = new System.Drawing.Size(72, 20); + this.numEquip_Vitality.Size = new System.Drawing.Size(103, 20); this.numEquip_Vitality.TabIndex = 52; this.numEquip_Vitality.ValueChanged += new System.EventHandler(this.numEquip_Vitality_ValueChanged); // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(8, 96); + this.label10.Location = new System.Drawing.Point(119, 57); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(40, 13); this.label10.TabIndex = 51; @@ -452,7 +506,7 @@ private void InitializeComponent() // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(85, 16); + this.label6.Location = new System.Drawing.Point(119, 16); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(63, 13); this.label6.TabIndex = 42; @@ -460,21 +514,21 @@ private void InitializeComponent() // // numEquip_Agility // - this.numEquip_Agility.Location = new System.Drawing.Point(88, 73); + this.numEquip_Agility.Location = new System.Drawing.Point(10, 73); this.numEquip_Agility.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); this.numEquip_Agility.Name = "numEquip_Agility"; - this.numEquip_Agility.Size = new System.Drawing.Size(72, 20); + this.numEquip_Agility.Size = new System.Drawing.Size(103, 20); this.numEquip_Agility.TabIndex = 48; this.numEquip_Agility.ValueChanged += new System.EventHandler(this.numEquip_Agility_ValueChanged); // // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(85, 55); + this.label8.Location = new System.Drawing.Point(7, 55); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(37, 13); this.label8.TabIndex = 47; @@ -483,7 +537,7 @@ private void InitializeComponent() // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(8, 56); + this.label11.Location = new System.Drawing.Point(233, 16); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(64, 13); this.label11.TabIndex = 45; @@ -500,21 +554,21 @@ private void InitializeComponent() // // numPotion_Experience // - this.numPotion_Experience.Location = new System.Drawing.Point(246, 37); + this.numPotion_Experience.Location = new System.Drawing.Point(242, 37); this.numPotion_Experience.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); this.numPotion_Experience.Name = "numPotion_Experience"; - this.numPotion_Experience.Size = new System.Drawing.Size(113, 20); + this.numPotion_Experience.Size = new System.Drawing.Size(111, 20); this.numPotion_Experience.TabIndex = 50; this.numPotion_Experience.ValueChanged += new System.EventHandler(this.numEquip_Experience_ValueChanged); // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(243, 21); + this.label9.Location = new System.Drawing.Point(239, 21); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(63, 13); this.label9.TabIndex = 49; @@ -522,14 +576,14 @@ private void InitializeComponent() // // numPotion_MP // - this.numPotion_MP.Location = new System.Drawing.Point(127, 37); + this.numPotion_MP.Location = new System.Drawing.Point(125, 37); this.numPotion_MP.Minimum = new decimal(new int[] { 100, 0, 0, -2147483648}); this.numPotion_MP.Name = "numPotion_MP"; - this.numPotion_MP.Size = new System.Drawing.Size(113, 20); + this.numPotion_MP.Size = new System.Drawing.Size(111, 20); this.numPotion_MP.TabIndex = 40; this.numPotion_MP.ValueChanged += new System.EventHandler(this.numEquip_Mana_ValueChanged); // @@ -542,14 +596,14 @@ private void InitializeComponent() 0, -2147483648}); this.numPotion_HP.Name = "numPotion_HP"; - this.numPotion_HP.Size = new System.Drawing.Size(113, 20); + this.numPotion_HP.Size = new System.Drawing.Size(111, 20); this.numPotion_HP.TabIndex = 39; this.numPotion_HP.ValueChanged += new System.EventHandler(this.numEquip_Vida_ValueChanged); // // lblMP // this.lblMP.AutoSize = true; - this.lblMP.Location = new System.Drawing.Point(124, 21); + this.lblMP.Location = new System.Drawing.Point(122, 21); this.lblMP.Name = "lblMP"; this.lblMP.Size = new System.Drawing.Size(26, 13); this.lblMP.TabIndex = 38; @@ -564,9 +618,9 @@ private void InitializeComponent() this.grpPotion.Controls.Add(this.lblMP); this.grpPotion.Controls.Add(this.label12); this.grpPotion.Controls.Add(this.label9); - this.grpPotion.Location = new System.Drawing.Point(219, 272); + this.grpPotion.Location = new System.Drawing.Point(218, 274); this.grpPotion.Name = "grpPotion"; - this.grpPotion.Size = new System.Drawing.Size(366, 77); + this.grpPotion.Size = new System.Drawing.Size(360, 77); this.grpPotion.TabIndex = 21; this.grpPotion.TabStop = false; this.grpPotion.Text = "Potion"; @@ -577,7 +631,7 @@ private void InitializeComponent() this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label14.Location = new System.Drawing.Point(10, 60); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(349, 12); + this.label14.Size = new System.Drawing.Size(344, 14); this.label14.TabIndex = 55; this.label14.Text = "(Negative values are also valid)"; this.label14.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -585,15 +639,14 @@ private void InitializeComponent() // grpEquipment // this.grpEquipment.Controls.Add(this.cmbEquipment_Type); - this.grpEquipment.Controls.Add(this.grpWeapon); this.grpEquipment.Controls.Add(this.label16); this.grpEquipment.Controls.Add(this.grpEquip_Bonus); - this.grpEquipment.Location = new System.Drawing.Point(219, 272); + this.grpEquipment.Location = new System.Drawing.Point(218, 274); this.grpEquipment.Name = "grpEquipment"; - this.grpEquipment.Size = new System.Drawing.Size(365, 237); + this.grpEquipment.Size = new System.Drawing.Size(360, 183); this.grpEquipment.TabIndex = 22; this.grpEquipment.TabStop = false; - this.grpEquipment.Text = "Equipamento"; + this.grpEquipment.Text = "Equipment"; // // cmbEquipment_Type // @@ -607,43 +660,10 @@ private void InitializeComponent() "Amulet"}); this.cmbEquipment_Type.Location = new System.Drawing.Point(11, 31); this.cmbEquipment_Type.Name = "cmbEquipment_Type"; - this.cmbEquipment_Type.Size = new System.Drawing.Size(168, 21); + this.cmbEquipment_Type.Size = new System.Drawing.Size(342, 21); this.cmbEquipment_Type.TabIndex = 22; this.cmbEquipment_Type.SelectedIndexChanged += new System.EventHandler(this.cmbEquipment_Type_SelectedIndexChanged); // - // grpWeapon - // - this.grpWeapon.Controls.Add(this.numWeapon_Damage); - this.grpWeapon.Controls.Add(this.label17); - this.grpWeapon.Location = new System.Drawing.Point(190, 19); - this.grpWeapon.Name = "grpWeapon"; - this.grpWeapon.Size = new System.Drawing.Size(168, 206); - this.grpWeapon.TabIndex = 24; - this.grpWeapon.TabStop = false; - this.grpWeapon.Text = "Weapon"; - // - // numWeapon_Damage - // - this.numWeapon_Damage.Location = new System.Drawing.Point(12, 39); - this.numWeapon_Damage.Minimum = new decimal(new int[] { - 100, - 0, - 0, - -2147483648}); - this.numWeapon_Damage.Name = "numWeapon_Damage"; - this.numWeapon_Damage.Size = new System.Drawing.Size(150, 20); - this.numWeapon_Damage.TabIndex = 45; - this.numWeapon_Damage.ValueChanged += new System.EventHandler(this.numWeapon_Damage_ValueChanged); - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(9, 23); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(75, 13); - this.label17.TabIndex = 44; - this.label17.Text = "Base damage:"; - // // label16 // this.label16.AutoSize = true; @@ -657,7 +677,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(596, 551); + this.ClientSize = new System.Drawing.Size(589, 499); this.ControlBox = false; this.Controls.Add(this.grpEquipment); this.Controls.Add(this.grpPotion); @@ -683,6 +703,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numReq_Level)).EndInit(); this.grpEquip_Bonus.ResumeLayout(false); this.grpEquip_Bonus.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numWeapon_Damage)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numEquip_Strength)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numEquip_Resistance)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numEquip_Intelligence)).EndInit(); @@ -695,9 +716,6 @@ private void InitializeComponent() this.grpPotion.PerformLayout(); this.grpEquipment.ResumeLayout(false); this.grpEquipment.PerformLayout(); - this.grpWeapon.ResumeLayout(false); - this.grpWeapon.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numWeapon_Damage)).EndInit(); this.ResumeLayout(false); } @@ -743,14 +761,16 @@ private void InitializeComponent() private System.Windows.Forms.Label label13; public System.Windows.Forms.TextBox txtDescription; private System.Windows.Forms.Label label15; - private System.Windows.Forms.CheckBox chkBind; private System.Windows.Forms.CheckBox chkStackable; private System.Windows.Forms.GroupBox grpEquipment; - private System.Windows.Forms.GroupBox grpWeapon; - private System.Windows.Forms.NumericUpDown numWeapon_Damage; - private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label16; private System.Windows.Forms.ComboBox cmbEquipment_Type; private System.Windows.Forms.NumericUpDown numPrice; private System.Windows.Forms.Label label18; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.ComboBox cmbRarity; + private System.Windows.Forms.ComboBox cmbBind; + private System.Windows.Forms.NumericUpDown numWeapon_Damage; + public System.Windows.Forms.Label lblWeapon_Damage; } \ No newline at end of file diff --git a/Source/Editors/Editors/Items.cs b/Source/Editors/Editors/Items.cs index fbd25f7b..71f584f5 100644 --- a/Source/Editors/Editors/Items.cs +++ b/Source/Editors/Editors/Items.cs @@ -1,13 +1,13 @@ using System; using System.Windows.Forms; -public partial class Editor_Items : Form +partial class Editor_Items : Form { // Usado para acessar os dados da janela public static Editor_Items Objects = new Editor_Items(); - // Index do item selecionado - public byte Selected; + // Item selecionado + private Lists.Structures.Item Selected; public Editor_Items() { @@ -17,8 +17,9 @@ public Editor_Items() public static void Request() { // Lê os dados + Globals.OpenEditor = Objects; Send.Request_Classes(); - Send.Request_Items(true); + Send.Request_Items(); } public static void Open() @@ -28,6 +29,14 @@ public static void Open() Objects.cmbReq_Class.Items.Add("None"); for (byte i = 1; i <= Lists.Class.GetUpperBound(0); i++) Objects.cmbReq_Class.Items.Add(Lists.Class[i].Name); + // Lista de raridades + Objects.cmbRarity.Items.Clear(); + for (byte i = 0; i < (byte)Globals.Rarity.Count; i++) Objects.cmbRarity.Items.Add((Globals.Rarity)i); + + // Lista de preensão + Objects.cmbBind.Items.Clear(); + for (byte i = 0; i < (byte)Globals.BindOn.Count; i++) Objects.cmbBind.Items.Add((Globals.BindOn)i); + // Lista os itens Update_List(); @@ -43,7 +52,7 @@ private static void Update_List() // Adiciona os itens à lista for (byte i = 1; i <= Lists.Item.GetUpperBound(0); i++) - Objects.List.Items.Add(Globals.Numbering(i, Lists.Item.GetUpperBound(0)) + ":" + Lists.Item[i].Name); + Objects.List.Items.Add(Globals.Numbering(i, Lists.Item.GetUpperBound(0), Lists.Item[i].Name)); // Seleciona o primeiro item Objects.List.SelectedIndex = 0; @@ -51,34 +60,33 @@ private static void Update_List() private void Update_Data() { - Selected = (byte)(List.SelectedIndex + 1); - // Previne erros - if (Selected == 0) return; + if (List.SelectedIndex == -1) return; // Define os limites numTexture.Maximum = Graphics.Tex_Item.GetUpperBound(0); // Lista os dados - txtName.Text = Lists.Item[Selected].Name; - txtDescription.Text = Lists.Item[Selected].Description; - numTexture.Value = Lists.Item[Selected].Texture; - cmbType.SelectedIndex = Lists.Item[Selected].Type; - numPrice.Value = Lists.Item[Selected].Price; - chkStackable.Checked = Lists.Item[Selected].Stackable; - chkBind.Checked = Lists.Item[Selected].Bind; - numReq_Level.Value = Lists.Item[Selected].Req_Level; - cmbReq_Class.SelectedIndex = Lists.Item[Selected].Req_Class; - numPotion_Experience.Value = Lists.Item[Selected].Potion_Experience; - numPotion_HP.Value = Lists.Item[Selected].Potion_Vital[(byte)Globals.Vitals.HP]; - numPotion_MP.Value = Lists.Item[Selected].Potion_Vital[(byte)Globals.Vitals.MP]; - cmbEquipment_Type.SelectedIndex = Lists.Item[Selected].Equip_Type; - numEquip_Strength.Value = Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Strength]; - numEquip_Resistance.Value = Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Resistance]; - numEquip_Intelligence.Value = Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Intelligence]; - numEquip_Agility.Value = Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Agility]; - numEquip_Vitality.Value = Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Vitality]; - numWeapon_Damage.Value = Lists.Item[Selected].Weapon_Damage; + txtName.Text = Selected.Name; + txtDescription.Text = Selected.Description; + numTexture.Value = Selected.Texture; + cmbType.SelectedIndex = Selected.Type; + numPrice.Value = Selected.Price; + chkStackable.Checked = Selected.Stackable; + cmbBind.SelectedIndex = Selected.Bind; + cmbRarity.SelectedIndex = Selected.Rarity; + numReq_Level.Value = Selected.Req_Level; + cmbReq_Class.SelectedIndex = Selected.Req_Class; + numPotion_Experience.Value = Selected.Potion_Experience; + numPotion_HP.Value = Selected.Potion_Vital[(byte)Globals.Vitals.HP]; + numPotion_MP.Value = Selected.Potion_Vital[(byte)Globals.Vitals.MP]; + cmbEquipment_Type.SelectedIndex = Selected.Equip_Type; + numEquip_Strength.Value = Selected.Equip_Attribute[(byte)Globals.Attributes.Strength]; + numEquip_Resistance.Value = Selected.Equip_Attribute[(byte)Globals.Attributes.Resistance]; + numEquip_Intelligence.Value = Selected.Equip_Attribute[(byte)Globals.Attributes.Intelligence]; + numEquip_Agility.Value = Selected.Equip_Attribute[(byte)Globals.Attributes.Agility]; + numEquip_Vitality.Value = Selected.Equip_Attribute[(byte)Globals.Attributes.Vitality]; + numWeapon_Damage.Value = Selected.Weapon_Damage; } public static void Change_Quantity() @@ -100,6 +108,7 @@ public static void Change_Quantity() private void List_SelectedIndexChanged(object sender, EventArgs e) { // Atualiza a lista + Selected = Lists.Item[List.SelectedIndex + 1]; Update_Data(); } @@ -116,10 +125,10 @@ private void butSave_Click(object sender, EventArgs e) private void butClear_Click(object sender, EventArgs e) { // Limpa os dados - Clear.Item(Selected); + Clear.Item((short)(List.SelectedIndex + 1)); // Atualiza os valores - List.Items[Selected - 1] = Globals.Numbering(Selected, List.Items.Count) + ":"; + List.Items[List.SelectedIndex] = Globals.Numbering(List.SelectedIndex + 1, List.Items.Count,string.Empty); Update_Data(); } @@ -139,124 +148,115 @@ private void butQuantity_Click(object sender, EventArgs e) private void txtName_Validated(object sender, EventArgs e) { // Atualiza a lista - if (Selected > 0) - { - Lists.Item[Selected].Name = txtName.Text; - List.Items[Selected - 1] = Globals.Numbering(Selected, List.Items.Count) + ":" + txtName.Text; - } + Selected.Name = txtName.Text; + List.Items[List.SelectedIndex] = Globals.Numbering(List.SelectedIndex + 1, List.Items.Count,txtName.Text); } private void numTexture_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Texture = (short)numTexture.Value; + Selected.Texture = (short)numTexture.Value; } private void butTexture_Click(object sender, EventArgs e) { // Abre a pré visualização - Lists.Item[Selected].Texture = Preview.Select(Graphics.Tex_Item, Lists.Item[Selected].Texture); - numTexture.Value = Lists.Item[Selected].Texture; + Selected.Texture = Preview.Select(Graphics.Tex_Item, Selected.Texture); + numTexture.Value = Selected.Texture; } private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { - Lists.Item[Selected].Type = (byte)cmbType.SelectedIndex; + Selected.Type = (byte)cmbType.SelectedIndex; // Visibilidade dos paineis - if (cmbType.SelectedIndex == (byte)Globals.Items.Equipment) - grpEquipment.Visible = true; - else - grpEquipment.Visible = false; - - if (cmbType.SelectedIndex == (byte)Globals.Items.Potion) - grpPotion.Visible = true; - else - grpPotion.Visible = false; + if (cmbType.SelectedIndex == (byte)Globals.Items.Equipment) grpEquipment.Visible = true; + else grpEquipment.Visible = false; + if (cmbType.SelectedIndex == (byte)Globals.Items.Potion) grpPotion.Visible = true; + else grpPotion.Visible = false; } private void numReq_Level_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Req_Level = (short)numReq_Level.Value; + Selected.Req_Level = (short)numReq_Level.Value; } private void cmbReq_Class_SelectedIndexChanged(object sender, EventArgs e) { - Lists.Item[Selected].Req_Class = (byte)cmbReq_Class.SelectedIndex; + Selected.Req_Class = (byte)cmbReq_Class.SelectedIndex; } private void numEquip_Vida_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Potion_Vital[(byte)Globals.Vitals.HP] = (short)numPotion_HP.Value; + Selected.Potion_Vital[(byte)Globals.Vitals.HP] = (short)numPotion_HP.Value; } private void numEquip_Mana_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Potion_Vital[(byte)Globals.Vitals.MP] = (short)numPotion_MP.Value; + Selected.Potion_Vital[(byte)Globals.Vitals.MP] = (short)numPotion_MP.Value; } private void numEquip_Experience_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Potion_Experience = (short)numPotion_Experience.Value; + Selected.Potion_Experience = (int)numPotion_Experience.Value; } private void numEquip_Strength_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Strength] = (short)numEquip_Strength.Value; + Selected.Equip_Attribute[(byte)Globals.Attributes.Strength] = (short)numEquip_Strength.Value; } private void numEquip_Resistance_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Resistance] = (short)numEquip_Resistance.Value; + Selected.Equip_Attribute[(byte)Globals.Attributes.Resistance] = (short)numEquip_Resistance.Value; } private void numEquip_Intelligence_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Intelligence] = (short)numEquip_Intelligence.Value; + Selected.Equip_Attribute[(byte)Globals.Attributes.Intelligence] = (short)numEquip_Intelligence.Value; } private void numEquip_Agility_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Agility] = (short)numEquip_Agility.Value; + Selected.Equip_Attribute[(byte)Globals.Attributes.Agility] = (short)numEquip_Agility.Value; } private void numEquip_Vitality_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Equip_Attribute[(byte)Globals.Attributes.Vitality] = (short)numEquip_Vitality.Value; - } - - private void chkBind_CheckedChanged(object sender, EventArgs e) - { - Lists.Item[Selected].Bind = chkBind.Checked; + Selected.Equip_Attribute[(byte)Globals.Attributes.Vitality] = (short)numEquip_Vitality.Value; } - private void numPrice_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Price = (short)numPrice.Value; + Selected.Price = (short)numPrice.Value; } private void chkStackable_CheckedChanged(object sender, EventArgs e) { - Lists.Item[Selected].Stackable = chkStackable.Checked; + Selected.Stackable = chkStackable.Checked; } private void numWeapon_Damage_ValueChanged(object sender, EventArgs e) { - Lists.Item[Selected].Weapon_Damage = (short)numWeapon_Damage.Value; + Selected.Weapon_Damage = (short)numWeapon_Damage.Value; } private void cmbEquipment_Type_SelectedIndexChanged(object sender, EventArgs e) { - Lists.Item[Selected].Equip_Type = (byte)cmbEquipment_Type.SelectedIndex; + Selected.Equip_Type = (byte)cmbEquipment_Type.SelectedIndex; + numWeapon_Damage.Visible = lblWeapon_Damage.Visible = (cmbEquipment_Type.SelectedIndex == (byte)Globals.Equipments.Weapon); + } - // Visibilidade dos paineis - if (cmbEquipment_Type.SelectedIndex == (byte)Globals.Equipments.Weapon) - grpWeapon.Visible = true; - else - grpWeapon.Visible = false; + private void txtDescription_TextChanged(object sender, EventArgs e) + { + Selected.Description = txtDescription.Text; + } + + private void cmbRarity_SelectedIndexChanged(object sender, EventArgs e) + { + Selected.Rarity = (byte)cmbRarity.SelectedIndex; } - private void txtDescription_Validated(object sender, EventArgs e) + private void cmbBind_SelectedIndexChanged(object sender, EventArgs e) { - Lists.Item[Selected].Description = txtDescription.Text; + Selected.Bind = (byte)cmbBind.SelectedIndex; } } \ No newline at end of file diff --git a/Source/Editors/Editors/Login.Designer.cs b/Source/Editors/Editors/Login.Designer.cs index 6b3e674d..8804e7af 100644 --- a/Source/Editors/Editors/Login.Designer.cs +++ b/Source/Editors/Editors/Login.Designer.cs @@ -79,6 +79,7 @@ private void InitializeComponent() // // Login // + this.AcceptButton = this.butConnect; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(204, 127); diff --git a/Source/Editors/Editors/Maps.cs b/Source/Editors/Editors/Maps.cs index 5f6f89e0..6240d72c 100644 --- a/Source/Editors/Editors/Maps.cs +++ b/Source/Editors/Editors/Maps.cs @@ -17,11 +17,11 @@ partial class Editor_Maps : Form // Posição do mouse public static Point Tile_Mouse; - public static Point Map_Mouse; + private static Point Map_Mouse; // Seleção retângular - public static Rectangle Def_Tiles_Selection = new Rectangle(0, 0, 1, 1); - public static Rectangle Def_Map_Selection = new Rectangle(0, 0, 1, 1); + private static Rectangle Def_Tiles_Selection = new Rectangle(0, 0, 1, 1); + private static Rectangle Def_Map_Selection = new Rectangle(0, 0, 1, 1); // Dados dos atributos private static short AData_1; @@ -30,7 +30,7 @@ partial class Editor_Maps : Form private static short AData_4; // Azulejos copiados - public static Copy_Struct Tiles_Copy = new Copy_Struct(); + private static Copy_Struct Tiles_Copy = new Copy_Struct(); public struct Copy_Struct { @@ -54,7 +54,7 @@ private void Editor_Maps_FormClosing(object sender, FormClosingEventArgs e) // Volta ao menu e.Cancel = true; Visible = false; - global::Selection.Objects.Visible = true; + Selection.Objects.Visible = true; } private void Editor_Maps_SizeChanged(object sender, EventArgs e) @@ -67,6 +67,7 @@ private void Editor_Maps_SizeChanged(object sender, EventArgs e) public static void Request() { // Lê os dados + Globals.OpenEditor = Objects; Send.Request_NPCs(); Send.Request_Tiles(); Send.Request_Items(); @@ -131,8 +132,8 @@ private static void Update_List() // Adiciona os itens às listas for (byte i = 1; i < Lists.Map.Length; i++) { - Objects.cmbList.Items.Add(Globals.Numbering(i, Lists.Map.GetUpperBound(0)) + ":" + Lists.Map[i].Name); - Objects.cmbA_Warp_Map.Items.Add(Globals.Numbering(i, Lists.Map.GetUpperBound(0)) + ":" + Lists.Map[i].Name); + Objects.cmbList.Items.Add(Globals.Numbering(i, Lists.Map.GetUpperBound(0), Lists.Map[i].Name)); + Objects.cmbA_Warp_Map.Items.Add(Globals.Numbering(i, Lists.Map.GetUpperBound(0) , Lists.Map[i].Name)); } // Seleciona o primeiro item @@ -349,7 +350,7 @@ private void butClearAllr_Click(object sender, EventArgs e) Clear.Map(Selected); // Atualiza os valores - cmbList.Items[Selected - 1] = Globals.Numbering(Selected, cmbList.Items.Count) + ":"; + cmbList.Items[Selected - 1] = Globals.Numbering(Selected, cmbList.Items.Count,string.Empty); } private void Copiar() @@ -1295,7 +1296,7 @@ private void butLayers_Remove_Click(object sender, EventArgs e) } } - public static int Find_Layer(string Nome) + private static int Find_Layer(string Nome) { // Encontra a camada for (byte i = 0; i < Lists.Map[Selected].Layer.Count; i++) @@ -1378,7 +1379,7 @@ private void butLayers_Edit_Click(object sender, EventArgs e) #region Calculations #region Zoom // Retângulo da seleção de azulejos - public static Rectangle Tiles_Selection // Somente para obter + private static Rectangle Tiles_Selection // Somente para obter { get { @@ -1420,7 +1421,7 @@ public static Rectangle Zoom(Rectangle Value) return new Rectangle(new Point(Value.X / Zoom(), Value.Y / Zoom()), new Size(Value.Width / Zoom(), Value.Height / Zoom())); } - public static byte Grid_Zoom + private static byte Grid_Zoom { // Tamanho da grade com o zoom get @@ -1436,7 +1437,7 @@ public static Rectangle Zoom_Grid(Rectangle Rectangle) } #endregion - public static Rectangle Selection_Rec(Rectangle Temp) + private static Rectangle Selection_Rec(Rectangle Temp) { // Largura if (Temp.Width <= 0) @@ -1458,10 +1459,7 @@ public static Rectangle Selection_Rec(Rectangle Temp) public bool OutLimit(short Map_Num, short x, short y) { // Verifica se as coordenas estão no limite do mapa - if (x > Lists.Map[Map_Num].Width || y > Lists.Map[Map_Num].Height || x < 0 || y < 0) - return true; - else - return false; + return x > Lists.Map[Map_Num].Width || y > Lists.Map[Map_Num].Height || x < 0 || y < 0; } public static Size Map_Size @@ -1517,7 +1515,7 @@ public static void Update(short Map_Num, int x, int y, byte Layer_Num) Calculate(Map_Num, (byte)x2, (byte)y2, Layer_Num); } - public static void Set(short Map_Num, byte x, byte y, byte Layer_Num, byte Part, string Index) + private static void Set(short Map_Num, byte x, byte y, byte Layer_Num, byte Part, string Index) { Point Position = new Point(0); @@ -1561,7 +1559,7 @@ public static void Set(short Map_Num, byte x, byte y, byte Layer_Num, byte Part, Lists.Map[Map_Num].Layer[Layer_Num].Tile[x, y].Mini[Part].Y = Data.Y * Globals.Grid + Position.Y; } - public static bool Check(short Map_Num, int X1, int Y1, int X2, int Y2, byte Layer_Num) + private static bool Check(short Map_Num, int X1, int Y1, int X2, int Y2, byte Layer_Num) { Lists.Structures.Map_Tile_Data Data1, Data2; @@ -1582,7 +1580,7 @@ public static bool Check(short Map_Num, int X1, int Y1, int X2, int Y2, byte Lay return true; } - public static void Calculate(short Map_Num, byte x, byte y, byte Layer_Num) + private static void Calculate(short Map_Num, byte x, byte y, byte Layer_Num) { // Calcula as quatros partes do azulejo Calculate_NW(Map_Num, x, y, Layer_Num); @@ -1591,7 +1589,7 @@ public static void Calculate(short Map_Num, byte x, byte y, byte Layer_Num) Calculate_SE(Map_Num, x, y, Layer_Num); } - public static void Calculate_NW(short Map_Num, byte x, byte y, byte Layer_Num) + private static void Calculate_NW(short Map_Num, byte x, byte y, byte Layer_Num) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -1619,7 +1617,7 @@ public static void Calculate_NW(short Map_Num, byte x, byte y, byte Layer_Num) } } - public static void Calculate_NE(short Map_Num, byte x, byte y, byte Layer_Num) + private static void Calculate_NE(short Map_Num, byte x, byte y, byte Layer_Num) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -1647,7 +1645,7 @@ public static void Calculate_NE(short Map_Num, byte x, byte y, byte Layer_Num) } } - public static void Calculate_SW(short Map_Num, byte x, byte y, byte Layer_Num) + private static void Calculate_SW(short Map_Num, byte x, byte y, byte Layer_Num) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; @@ -1675,7 +1673,7 @@ public static void Calculate_SW(short Map_Num, byte x, byte y, byte Layer_Num) } } - public static void Calculate_SE(short Map_Num, byte x, byte y, byte Layer_Num) + private static void Calculate_SE(short Map_Num, byte x, byte y, byte Layer_Num) { bool[] Tile = new bool[4]; AddMode Mode = AddMode.None; diff --git a/Source/Editors/Editors/Maps_Properties.cs b/Source/Editors/Editors/Maps_Properties.cs index 4b16b51b..6549bd7e 100644 --- a/Source/Editors/Editors/Maps_Properties.cs +++ b/Source/Editors/Editors/Maps_Properties.cs @@ -5,10 +5,10 @@ public partial class Editor_Maps_Properties : Form { // Usado para acessar os dados da janela - public static Editor_Maps_Properties Objects = new Editor_Maps_Properties(); + private static Editor_Maps_Properties Objects = new Editor_Maps_Properties(); // Dados temporários - public static int Selected; + private static int Selected; public Editor_Maps_Properties() { @@ -186,7 +186,7 @@ private void butSave_Click(object sender, EventArgs e) Editor_Maps.Update_Data(); // Altera o nome na lista - Editor_Maps.Objects.cmbList.Items[Selected - 1] = Globals.Numbering(Selected, Editor_Maps.Objects.cmbList.Items.Count) + ":" + txtName.Text; + Editor_Maps.Objects.cmbList.Items[Selected - 1] = Globals.Numbering(Selected, Editor_Maps.Objects.cmbList.Items.Count, txtName.Text); // Reseta os valores Globals.Weather_Update(); diff --git a/Source/Editors/Editors/NPCs.Designer.cs b/Source/Editors/Editors/NPCs.Designer.cs index d28f5b03..3f41e508 100644 --- a/Source/Editors/Editors/NPCs.Designer.cs +++ b/Source/Editors/Editors/NPCs.Designer.cs @@ -30,63 +30,86 @@ private void InitializeComponent() this.List = new System.Windows.Forms.ListBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.numTexture = new System.Windows.Forms.NumericUpDown(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.lblTexture = new System.Windows.Forms.Label(); + this.butTexture = new System.Windows.Forms.Button(); + this.txtSayMsg = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); this.numSpawn = new System.Windows.Forms.NumericUpDown(); this.label8 = new System.Windows.Forms.Label(); this.numRange = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); this.cmbBehavior = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.txtName = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.lblTexture = new System.Windows.Forms.Label(); - this.butTexture = new System.Windows.Forms.Button(); this.butSave = new System.Windows.Forms.Button(); this.butCancel = new System.Windows.Forms.Button(); this.butClear = new System.Windows.Forms.Button(); this.butQuantity = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.grpDrop = new System.Windows.Forms.GroupBox(); - this.cmbDrop_Amount = new System.Windows.Forms.NumericUpDown(); - this.label13 = new System.Windows.Forms.Label(); - this.cmbDrop_Item = new System.Windows.Forms.ComboBox(); - this.label12 = new System.Windows.Forms.Label(); - this.numDrop_Chance = new System.Windows.Forms.NumericUpDown(); - this.label11 = new System.Windows.Forms.Label(); - this.scrlDrop = new System.Windows.Forms.HScrollBar(); - this.groupBox4 = new System.Windows.Forms.GroupBox(); this.numResistance = new System.Windows.Forms.NumericUpDown(); + this.numExperience = new System.Windows.Forms.NumericUpDown(); this.numIntelligence = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); this.numVitality = new System.Windows.Forms.NumericUpDown(); + this.numMP = new System.Windows.Forms.NumericUpDown(); this.label10 = new System.Windows.Forms.Label(); + this.numHP = new System.Windows.Forms.NumericUpDown(); this.numStrength = new System.Windows.Forms.NumericUpDown(); this.label7 = new System.Windows.Forms.Label(); + this.lblMP = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); + this.lblHP = new System.Windows.Forms.Label(); this.numAgility = new System.Windows.Forms.NumericUpDown(); - this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); - this.numExperience = new System.Windows.Forms.NumericUpDown(); - this.label9 = new System.Windows.Forms.Label(); - this.numMP = new System.Windows.Forms.NumericUpDown(); - this.numHP = new System.Windows.Forms.NumericUpDown(); - this.lblMP = new System.Windows.Forms.Label(); - this.lblHP = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.numDrop_Amount = new System.Windows.Forms.NumericUpDown(); + this.cmbDrop_Item = new System.Windows.Forms.ComboBox(); + this.numDrop_Chance = new System.Windows.Forms.NumericUpDown(); + this.label11 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.butDrop_Delete = new System.Windows.Forms.Button(); + this.lstDrop = new System.Windows.Forms.ListBox(); + this.butDrop_Add = new System.Windows.Forms.Button(); + this.grpDrop_Add = new System.Windows.Forms.GroupBox(); + this.label15 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.butItem_Ok = new System.Windows.Forms.Button(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.butAllie_Delete = new System.Windows.Forms.Button(); + this.butAllie_Add = new System.Windows.Forms.Button(); + this.lstAllies = new System.Windows.Forms.ListBox(); + this.label12 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.cmbMovement = new System.Windows.Forms.ComboBox(); + this.numFlee_Health = new System.Windows.Forms.NumericUpDown(); + this.label13 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.grpAllie_Add = new System.Windows.Forms.GroupBox(); + this.cmbAllie_NPC = new System.Windows.Forms.ComboBox(); + this.label17 = new System.Windows.Forms.Label(); + this.butAllie_Ok = new System.Windows.Forms.Button(); + this.chkAttackNPC = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numTexture)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numSpawn)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numRange)).BeginInit(); this.groupBox2.SuspendLayout(); - this.grpDrop.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.cmbDrop_Amount)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numDrop_Chance)).BeginInit(); - this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numResistance)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numExperience)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numIntelligence)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numVitality)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numStrength)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numAgility)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numExperience)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numMP)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numHP)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numStrength)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numAgility)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDrop_Amount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDrop_Chance)).BeginInit(); + this.groupBox3.SuspendLayout(); + this.grpDrop_Add.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numFlee_Health)).BeginInit(); + this.grpAllie_Add.SuspendLayout(); this.SuspendLayout(); // // List @@ -94,33 +117,27 @@ private void InitializeComponent() this.List.FormattingEnabled = true; this.List.Location = new System.Drawing.Point(11, 12); this.List.Name = "List"; - this.List.Size = new System.Drawing.Size(202, 498); + this.List.Size = new System.Drawing.Size(202, 472); this.List.TabIndex = 9; this.List.SelectedIndexChanged += new System.EventHandler(this.List_SelectedIndexChanged); // // groupBox1 // this.groupBox1.Controls.Add(this.numTexture); - this.groupBox1.Controls.Add(this.numSpawn); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this.numRange); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.cmbBehavior); - this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.txtName); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.lblTexture); this.groupBox1.Controls.Add(this.butTexture); this.groupBox1.Location = new System.Drawing.Point(219, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(304, 196); + this.groupBox1.Size = new System.Drawing.Size(304, 103); this.groupBox1.TabIndex = 14; this.groupBox1.TabStop = false; this.groupBox1.Text = "General"; // // numTexture // - this.numTexture.Location = new System.Drawing.Point(15, 78); + this.numTexture.Location = new System.Drawing.Point(14, 75); this.numTexture.Maximum = new decimal(new int[] { 20, 0, @@ -131,16 +148,69 @@ private void InitializeComponent() this.numTexture.TabIndex = 36; this.numTexture.ValueChanged += new System.EventHandler(this.numTexture_ValueChanged); // + // txtName + // + this.txtName.Location = new System.Drawing.Point(14, 36); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(279, 20); + this.txtName.TabIndex = 10; + this.txtName.Validated += new System.EventHandler(this.txtName_Validated); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(11, 18); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(38, 13); + this.label3.TabIndex = 9; + this.label3.Text = "Name:"; + // + // lblTexture + // + this.lblTexture.AutoSize = true; + this.lblTexture.Location = new System.Drawing.Point(11, 59); + this.lblTexture.Name = "lblTexture"; + this.lblTexture.Size = new System.Drawing.Size(46, 13); + this.lblTexture.TabIndex = 29; + this.lblTexture.Text = "Texture:"; + // + // butTexture + // + this.butTexture.Location = new System.Drawing.Point(207, 75); + this.butTexture.Name = "butTexture"; + this.butTexture.Size = new System.Drawing.Size(86, 19); + this.butTexture.TabIndex = 28; + this.butTexture.Text = "Select"; + this.butTexture.UseVisualStyleBackColor = true; + this.butTexture.Click += new System.EventHandler(this.butTexture_Click); + // + // txtSayMsg + // + this.txtSayMsg.Location = new System.Drawing.Point(13, 108); + this.txtSayMsg.Name = "txtSayMsg"; + this.txtSayMsg.Size = new System.Drawing.Size(279, 20); + this.txtSayMsg.TabIndex = 38; + this.txtSayMsg.TextChanged += new System.EventHandler(this.txtSayMsg_TextChanged); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(10, 92); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(73, 13); + this.label14.TabIndex = 37; + this.label14.Text = "Say message:"; + // // numSpawn // - this.numSpawn.Location = new System.Drawing.Point(160, 120); + this.numSpawn.Location = new System.Drawing.Point(157, 147); this.numSpawn.Maximum = new decimal(new int[] { 20, 0, 0, 0}); this.numSpawn.Name = "numSpawn"; - this.numSpawn.Size = new System.Drawing.Size(139, 20); + this.numSpawn.Size = new System.Drawing.Size(135, 20); this.numSpawn.TabIndex = 35; this.numSpawn.ValueChanged += new System.EventHandler(this.numSpawn_ValueChanged); // @@ -148,7 +218,7 @@ private void InitializeComponent() // this.label8.AutoSize = true; this.label8.BackColor = System.Drawing.Color.Transparent; - this.label8.Location = new System.Drawing.Point(157, 104); + this.label8.Location = new System.Drawing.Point(154, 131); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(90, 13); this.label8.TabIndex = 34; @@ -156,21 +226,21 @@ private void InitializeComponent() // // numRange // - this.numRange.Location = new System.Drawing.Point(15, 162); + this.numRange.Location = new System.Drawing.Point(13, 147); this.numRange.Maximum = new decimal(new int[] { 20, 0, 0, 0}); this.numRange.Name = "numRange"; - this.numRange.Size = new System.Drawing.Size(139, 20); + this.numRange.Size = new System.Drawing.Size(135, 20); this.numRange.TabIndex = 33; this.numRange.ValueChanged += new System.EventHandler(this.numRange_ValueChanged); // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 146); + this.label2.Location = new System.Drawing.Point(10, 131); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(42, 13); this.label2.TabIndex = 32; @@ -184,72 +254,27 @@ private void InitializeComponent() "Friendly", "Attack On Sight", "Attack When Attacked"}); - this.cmbBehavior.Location = new System.Drawing.Point(15, 119); + this.cmbBehavior.Location = new System.Drawing.Point(13, 18); this.cmbBehavior.Name = "cmbBehavior"; - this.cmbBehavior.Size = new System.Drawing.Size(139, 21); + this.cmbBehavior.Size = new System.Drawing.Size(279, 21); this.cmbBehavior.TabIndex = 31; this.cmbBehavior.SelectedIndexChanged += new System.EventHandler(this.cmbBehavior_SelectedIndexChanged); // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 103); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(52, 13); - this.label1.TabIndex = 30; - this.label1.Text = "Behavior:"; - // - // txtName - // - this.txtName.Location = new System.Drawing.Point(15, 37); - this.txtName.Name = "txtName"; - this.txtName.Size = new System.Drawing.Size(279, 20); - this.txtName.TabIndex = 10; - this.txtName.Validated += new System.EventHandler(this.txtName_Validated); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 19); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(38, 13); - this.label3.TabIndex = 9; - this.label3.Text = "Name:"; - // - // lblTexture - // - this.lblTexture.AutoSize = true; - this.lblTexture.Location = new System.Drawing.Point(12, 62); - this.lblTexture.Name = "lblTexture"; - this.lblTexture.Size = new System.Drawing.Size(46, 13); - this.lblTexture.TabIndex = 29; - this.lblTexture.Text = "Texture:"; - // - // butTexture - // - this.butTexture.Location = new System.Drawing.Point(208, 78); - this.butTexture.Name = "butTexture"; - this.butTexture.Size = new System.Drawing.Size(86, 19); - this.butTexture.TabIndex = 28; - this.butTexture.Text = "Select"; - this.butTexture.UseVisualStyleBackColor = true; - this.butTexture.Click += new System.EventHandler(this.butTexture_Click); - // // butSave // - this.butSave.Location = new System.Drawing.Point(219, 514); + this.butSave.Location = new System.Drawing.Point(219, 492); this.butSave.Name = "butSave"; - this.butSave.Size = new System.Drawing.Size(97, 25); + this.butSave.Size = new System.Drawing.Size(201, 25); this.butSave.TabIndex = 16; - this.butSave.Text = "Save"; + this.butSave.Text = "Save All"; this.butSave.UseVisualStyleBackColor = true; this.butSave.Click += new System.EventHandler(this.butSave_Click); // // butCancel // - this.butCancel.Location = new System.Drawing.Point(426, 514); + this.butCancel.Location = new System.Drawing.Point(632, 492); this.butCancel.Name = "butCancel"; - this.butCancel.Size = new System.Drawing.Size(97, 25); + this.butCancel.Size = new System.Drawing.Size(201, 25); this.butCancel.TabIndex = 17; this.butCancel.Text = "Cancel"; this.butCancel.UseVisualStyleBackColor = true; @@ -257,9 +282,9 @@ private void InitializeComponent() // // butClear // - this.butClear.Location = new System.Drawing.Point(323, 514); + this.butClear.Location = new System.Drawing.Point(425, 492); this.butClear.Name = "butClear"; - this.butClear.Size = new System.Drawing.Size(97, 25); + this.butClear.Size = new System.Drawing.Size(201, 25); this.butClear.TabIndex = 18; this.butClear.Text = "Clear"; this.butClear.UseVisualStyleBackColor = true; @@ -267,7 +292,7 @@ private void InitializeComponent() // // butQuantity // - this.butQuantity.Location = new System.Drawing.Point(11, 514); + this.butQuantity.Location = new System.Drawing.Point(11, 492); this.butQuantity.Name = "butQuantity"; this.butQuantity.Size = new System.Drawing.Size(202, 25); this.butQuantity.TabIndex = 15; @@ -277,280 +302,481 @@ private void InitializeComponent() // // groupBox2 // - this.groupBox2.Controls.Add(this.grpDrop); - this.groupBox2.Controls.Add(this.groupBox4); + this.groupBox2.Controls.Add(this.numResistance); this.groupBox2.Controls.Add(this.numExperience); + this.groupBox2.Controls.Add(this.numIntelligence); this.groupBox2.Controls.Add(this.label9); + this.groupBox2.Controls.Add(this.numVitality); this.groupBox2.Controls.Add(this.numMP); + this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.numHP); + this.groupBox2.Controls.Add(this.numStrength); + this.groupBox2.Controls.Add(this.label7); this.groupBox2.Controls.Add(this.lblMP); + this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.lblHP); - this.groupBox2.Location = new System.Drawing.Point(219, 214); + this.groupBox2.Controls.Add(this.numAgility); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Location = new System.Drawing.Point(219, 348); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(304, 294); + this.groupBox2.Size = new System.Drawing.Size(304, 137); this.groupBox2.TabIndex = 21; this.groupBox2.TabStop = false; - this.groupBox2.Text = "Combat:"; - // - // grpDrop - // - this.grpDrop.Controls.Add(this.cmbDrop_Amount); - this.grpDrop.Controls.Add(this.label13); - this.grpDrop.Controls.Add(this.cmbDrop_Item); - this.grpDrop.Controls.Add(this.label12); - this.grpDrop.Controls.Add(this.numDrop_Chance); - this.grpDrop.Controls.Add(this.label11); - this.grpDrop.Controls.Add(this.scrlDrop); - this.grpDrop.Location = new System.Drawing.Point(9, 163); - this.grpDrop.Name = "grpDrop"; - this.grpDrop.Size = new System.Drawing.Size(284, 118); - this.grpDrop.TabIndex = 22; - this.grpDrop.TabStop = false; - this.grpDrop.Text = "Drop - 1"; - // - // cmbDrop_Amount - // - this.cmbDrop_Amount.Location = new System.Drawing.Point(145, 48); - this.cmbDrop_Amount.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.cmbDrop_Amount.Name = "cmbDrop_Amount"; - this.cmbDrop_Amount.Size = new System.Drawing.Size(130, 20); - this.cmbDrop_Amount.TabIndex = 37; - this.cmbDrop_Amount.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.cmbDrop_Amount.ValueChanged += new System.EventHandler(this.cmbDrop_Amount_ValueChanged); - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(142, 32); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(46, 13); - this.label13.TabIndex = 36; - this.label13.Text = "Amount:"; - // - // cmbDrop_Item - // - this.cmbDrop_Item.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbDrop_Item.FormattingEnabled = true; - this.cmbDrop_Item.Location = new System.Drawing.Point(9, 48); - this.cmbDrop_Item.Name = "cmbDrop_Item"; - this.cmbDrop_Item.Size = new System.Drawing.Size(130, 21); - this.cmbDrop_Item.TabIndex = 35; - this.cmbDrop_Item.SelectedIndexChanged += new System.EventHandler(this.cmbDrop_Item_SelectedIndexChanged); - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(7, 32); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(30, 13); - this.label12.TabIndex = 34; - this.label12.Text = "Item:"; - // - // numDrop_Chance - // - this.numDrop_Chance.Location = new System.Drawing.Point(9, 87); - this.numDrop_Chance.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numDrop_Chance.Name = "numDrop_Chance"; - this.numDrop_Chance.Size = new System.Drawing.Size(266, 20); - this.numDrop_Chance.TabIndex = 33; - this.numDrop_Chance.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numDrop_Chance.ValueChanged += new System.EventHandler(this.numDrop_Chance_ValueChanged); - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(6, 71); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(64, 13); - this.label11.TabIndex = 32; - this.label11.Text = "Chance: (%)"; - // - // scrlDrop - // - this.scrlDrop.LargeChange = 1; - this.scrlDrop.Location = new System.Drawing.Point(7, 16); - this.scrlDrop.Name = "scrlDrop"; - this.scrlDrop.Size = new System.Drawing.Size(265, 16); - this.scrlDrop.TabIndex = 0; - this.scrlDrop.ValueChanged += new System.EventHandler(this.scrlDrop_ValueChanged); - // - // groupBox4 - // - this.groupBox4.Controls.Add(this.numResistance); - this.groupBox4.Controls.Add(this.numIntelligence); - this.groupBox4.Controls.Add(this.numVitality); - this.groupBox4.Controls.Add(this.label10); - this.groupBox4.Controls.Add(this.numStrength); - this.groupBox4.Controls.Add(this.label7); - this.groupBox4.Controls.Add(this.label4); - this.groupBox4.Controls.Add(this.numAgility); - this.groupBox4.Controls.Add(this.label6); - this.groupBox4.Controls.Add(this.label5); - this.groupBox4.Location = new System.Drawing.Point(9, 58); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(284, 99); - this.groupBox4.TabIndex = 23; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "Attributes"; + this.groupBox2.Text = "Base Attributes"; // // numResistance // - this.numResistance.Location = new System.Drawing.Point(96, 34); + this.numResistance.Location = new System.Drawing.Point(109, 70); this.numResistance.Name = "numResistance"; - this.numResistance.Size = new System.Drawing.Size(85, 20); + this.numResistance.Size = new System.Drawing.Size(88, 20); this.numResistance.TabIndex = 26; this.numResistance.ValueChanged += new System.EventHandler(this.numResistance_ValueChanged); // + // numExperience + // + this.numExperience.Location = new System.Drawing.Point(203, 32); + this.numExperience.Name = "numExperience"; + this.numExperience.Size = new System.Drawing.Size(88, 20); + this.numExperience.TabIndex = 34; + this.numExperience.ValueChanged += new System.EventHandler(this.numExperience_ValueChanged); + // // numIntelligence // - this.numIntelligence.Location = new System.Drawing.Point(187, 34); + this.numIntelligence.Location = new System.Drawing.Point(204, 70); this.numIntelligence.Name = "numIntelligence"; - this.numIntelligence.Size = new System.Drawing.Size(85, 20); + this.numIntelligence.Size = new System.Drawing.Size(88, 20); this.numIntelligence.TabIndex = 29; this.numIntelligence.ValueChanged += new System.EventHandler(this.numIntelligence_ValueChanged); // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(200, 16); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(63, 13); + this.label9.TabIndex = 33; + this.label9.Text = "Experience:"; + // // numVitality // - this.numVitality.Location = new System.Drawing.Point(96, 73); + this.numVitality.Location = new System.Drawing.Point(109, 110); this.numVitality.Name = "numVitality"; - this.numVitality.Size = new System.Drawing.Size(85, 20); + this.numVitality.Size = new System.Drawing.Size(88, 20); this.numVitality.TabIndex = 36; this.numVitality.ValueChanged += new System.EventHandler(this.numVitality_ValueChanged); // + // numMP + // + this.numMP.Location = new System.Drawing.Point(109, 32); + this.numMP.Name = "numMP"; + this.numMP.Size = new System.Drawing.Size(88, 20); + this.numMP.TabIndex = 22; + this.numMP.ValueChanged += new System.EventHandler(this.numMP_ValueChanged); + // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(93, 57); + this.label10.Location = new System.Drawing.Point(106, 94); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(40, 13); this.label10.TabIndex = 35; this.label10.Text = "Vitality:"; // + // numHP + // + this.numHP.Location = new System.Drawing.Point(14, 32); + this.numHP.Name = "numHP"; + this.numHP.Size = new System.Drawing.Size(88, 20); + this.numHP.TabIndex = 21; + this.numHP.ValueChanged += new System.EventHandler(this.numHP_ValueChanged); + // // numStrength // - this.numStrength.Location = new System.Drawing.Point(6, 34); + this.numStrength.Location = new System.Drawing.Point(13, 70); this.numStrength.Name = "numStrength"; - this.numStrength.Size = new System.Drawing.Size(85, 20); + this.numStrength.Size = new System.Drawing.Size(88, 20); this.numStrength.TabIndex = 25; this.numStrength.ValueChanged += new System.EventHandler(this.numStrength_ValueChanged); // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(3, 18); + this.label7.Location = new System.Drawing.Point(10, 54); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(50, 13); this.label7.TabIndex = 23; this.label7.Text = "Strength:"; // + // lblMP + // + this.lblMP.AutoSize = true; + this.lblMP.Location = new System.Drawing.Point(106, 18); + this.lblMP.Name = "lblMP"; + this.lblMP.Size = new System.Drawing.Size(26, 13); + this.lblMP.TabIndex = 3; + this.lblMP.Text = "MP:"; + // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(93, 18); + this.label4.Location = new System.Drawing.Point(106, 54); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(63, 13); this.label4.TabIndex = 24; this.label4.Text = "Resistance:"; // + // lblHP + // + this.lblHP.AutoSize = true; + this.lblHP.Location = new System.Drawing.Point(11, 16); + this.lblHP.Name = "lblHP"; + this.lblHP.Size = new System.Drawing.Size(25, 13); + this.lblHP.TabIndex = 1; + this.lblHP.Text = "HP:"; + // // numAgility // - this.numAgility.Location = new System.Drawing.Point(6, 73); + this.numAgility.Location = new System.Drawing.Point(13, 110); this.numAgility.Name = "numAgility"; - this.numAgility.Size = new System.Drawing.Size(85, 20); + this.numAgility.Size = new System.Drawing.Size(88, 20); this.numAgility.TabIndex = 32; this.numAgility.ValueChanged += new System.EventHandler(this.numAgility_ValueChanged); // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(201, 54); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(64, 13); + this.label5.TabIndex = 27; + this.label5.Text = "Intelligence:"; + // // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 57); + this.label6.Location = new System.Drawing.Point(10, 94); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(37, 13); this.label6.TabIndex = 31; this.label6.Text = "Agility:"; // - // label5 + // numDrop_Amount // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(184, 18); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(64, 13); - this.label5.TabIndex = 27; - this.label5.Text = "Intelligence:"; + this.numDrop_Amount.Location = new System.Drawing.Point(28, 116); + this.numDrop_Amount.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numDrop_Amount.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numDrop_Amount.Name = "numDrop_Amount"; + this.numDrop_Amount.Size = new System.Drawing.Size(122, 20); + this.numDrop_Amount.TabIndex = 37; + this.numDrop_Amount.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); // - // numExperience + // cmbDrop_Item // - this.numExperience.Location = new System.Drawing.Point(203, 32); - this.numExperience.Name = "numExperience"; - this.numExperience.Size = new System.Drawing.Size(90, 20); - this.numExperience.TabIndex = 34; - this.numExperience.ValueChanged += new System.EventHandler(this.numExperience_ValueChanged); + this.cmbDrop_Item.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbDrop_Item.FormattingEnabled = true; + this.cmbDrop_Item.Location = new System.Drawing.Point(28, 77); + this.cmbDrop_Item.Name = "cmbDrop_Item"; + this.cmbDrop_Item.Size = new System.Drawing.Size(251, 21); + this.cmbDrop_Item.TabIndex = 35; // - // label9 + // numDrop_Chance // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(200, 16); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(63, 13); - this.label9.TabIndex = 33; - this.label9.Text = "Experience:"; + this.numDrop_Chance.Location = new System.Drawing.Point(157, 116); + this.numDrop_Chance.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numDrop_Chance.Name = "numDrop_Chance"; + this.numDrop_Chance.Size = new System.Drawing.Size(122, 20); + this.numDrop_Chance.TabIndex = 33; + this.numDrop_Chance.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); // - // numMP + // label11 // - this.numMP.Location = new System.Drawing.Point(105, 32); - this.numMP.Name = "numMP"; - this.numMP.Size = new System.Drawing.Size(90, 20); - this.numMP.TabIndex = 22; - this.numMP.ValueChanged += new System.EventHandler(this.numMP_ValueChanged); + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(154, 100); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(64, 13); + this.label11.TabIndex = 32; + this.label11.Text = "Chance: (%)"; // - // numHP + // groupBox3 + // + this.groupBox3.Controls.Add(this.butDrop_Delete); + this.groupBox3.Controls.Add(this.lstDrop); + this.groupBox3.Controls.Add(this.butDrop_Add); + this.groupBox3.Location = new System.Drawing.Point(529, 271); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(304, 215); + this.groupBox3.TabIndex = 37; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Drop items"; + // + // butDrop_Delete + // + this.butDrop_Delete.Location = new System.Drawing.Point(155, 185); + this.butDrop_Delete.Name = "butDrop_Delete"; + this.butDrop_Delete.Size = new System.Drawing.Size(139, 20); + this.butDrop_Delete.TabIndex = 35; + this.butDrop_Delete.Text = "Delete"; + this.butDrop_Delete.UseVisualStyleBackColor = true; + this.butDrop_Delete.Click += new System.EventHandler(this.butDrop_Delete_Click); + // + // lstDrop + // + this.lstDrop.FormattingEnabled = true; + this.lstDrop.Location = new System.Drawing.Point(10, 16); + this.lstDrop.Name = "lstDrop"; + this.lstDrop.Size = new System.Drawing.Size(284, 160); + this.lstDrop.TabIndex = 34; + // + // butDrop_Add + // + this.butDrop_Add.Location = new System.Drawing.Point(10, 185); + this.butDrop_Add.Name = "butDrop_Add"; + this.butDrop_Add.Size = new System.Drawing.Size(138, 20); + this.butDrop_Add.TabIndex = 33; + this.butDrop_Add.Text = "Add"; + this.butDrop_Add.UseVisualStyleBackColor = true; + this.butDrop_Add.Click += new System.EventHandler(this.butDrop_Add_Click); + // + // grpDrop_Add + // + this.grpDrop_Add.Controls.Add(this.numDrop_Amount); + this.grpDrop_Add.Controls.Add(this.label15); + this.grpDrop_Add.Controls.Add(this.numDrop_Chance); + this.grpDrop_Add.Controls.Add(this.label11); + this.grpDrop_Add.Controls.Add(this.cmbDrop_Item); + this.grpDrop_Add.Controls.Add(this.label16); + this.grpDrop_Add.Controls.Add(this.butItem_Ok); + this.grpDrop_Add.Location = new System.Drawing.Point(529, 271); + this.grpDrop_Add.Name = "grpDrop_Add"; + this.grpDrop_Add.Size = new System.Drawing.Size(304, 215); + this.grpDrop_Add.TabIndex = 38; + this.grpDrop_Add.TabStop = false; + this.grpDrop_Add.Text = "Add Item"; + this.grpDrop_Add.Visible = false; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(25, 100); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(46, 13); + this.label15.TabIndex = 31; + this.label15.Text = "Amount:"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(25, 61); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(30, 13); + this.label16.TabIndex = 30; + this.label16.Text = "Item:"; + // + // butItem_Ok + // + this.butItem_Ok.Location = new System.Drawing.Point(28, 140); + this.butItem_Ok.Name = "butItem_Ok"; + this.butItem_Ok.Size = new System.Drawing.Size(251, 20); + this.butItem_Ok.TabIndex = 29; + this.butItem_Ok.Text = "Ok"; + this.butItem_Ok.UseVisualStyleBackColor = true; + this.butItem_Ok.Click += new System.EventHandler(this.butItem_Ok_Click); + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.butAllie_Delete); + this.groupBox5.Controls.Add(this.butAllie_Add); + this.groupBox5.Controls.Add(this.lstAllies); + this.groupBox5.Controls.Add(this.label12); + this.groupBox5.Controls.Add(this.chkAttackNPC); + this.groupBox5.Location = new System.Drawing.Point(531, 12); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(304, 253); + this.groupBox5.TabIndex = 39; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "NPC vs NPC"; + // + // butAllie_Delete + // + this.butAllie_Delete.Location = new System.Drawing.Point(155, 221); + this.butAllie_Delete.Name = "butAllie_Delete"; + this.butAllie_Delete.Size = new System.Drawing.Size(139, 20); + this.butAllie_Delete.TabIndex = 36; + this.butAllie_Delete.Text = "Delete"; + this.butAllie_Delete.UseVisualStyleBackColor = true; + this.butAllie_Delete.Click += new System.EventHandler(this.butAllie_Delete_Click); + // + // butAllie_Add + // + this.butAllie_Add.Location = new System.Drawing.Point(10, 221); + this.butAllie_Add.Name = "butAllie_Add"; + this.butAllie_Add.Size = new System.Drawing.Size(139, 20); + this.butAllie_Add.TabIndex = 35; + this.butAllie_Add.Text = "Add"; + this.butAllie_Add.UseVisualStyleBackColor = true; + this.butAllie_Add.Click += new System.EventHandler(this.butAllie_Add_Click); + // + // lstAllies + // + this.lstAllies.FormattingEnabled = true; + this.lstAllies.Location = new System.Drawing.Point(10, 55); + this.lstAllies.Name = "lstAllies"; + this.lstAllies.Size = new System.Drawing.Size(284, 160); + this.lstAllies.TabIndex = 2; // - this.numHP.Location = new System.Drawing.Point(9, 32); - this.numHP.Name = "numHP"; - this.numHP.Size = new System.Drawing.Size(90, 20); - this.numHP.TabIndex = 21; - this.numHP.ValueChanged += new System.EventHandler(this.numHP_ValueChanged); + // label12 // - // lblMP + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(7, 39); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(34, 13); + this.label12.TabIndex = 1; + this.label12.Text = "Allies:"; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.txtSayMsg); + this.groupBox6.Controls.Add(this.cmbMovement); + this.groupBox6.Controls.Add(this.numFlee_Health); + this.groupBox6.Controls.Add(this.cmbBehavior); + this.groupBox6.Controls.Add(this.numSpawn); + this.groupBox6.Controls.Add(this.numRange); + this.groupBox6.Controls.Add(this.label14); + this.groupBox6.Controls.Add(this.label13); + this.groupBox6.Controls.Add(this.label1); + this.groupBox6.Controls.Add(this.label2); + this.groupBox6.Controls.Add(this.label8); + this.groupBox6.Location = new System.Drawing.Point(219, 121); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(304, 220); + this.groupBox6.TabIndex = 40; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Behaviour"; + // + // cmbMovement + // + this.cmbMovement.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbMovement.FormattingEnabled = true; + this.cmbMovement.Items.AddRange(new object[] { + "Move Randomly", + "Turn Randomly", + "Stand Still"}); + this.cmbMovement.Location = new System.Drawing.Point(13, 63); + this.cmbMovement.Name = "cmbMovement"; + this.cmbMovement.Size = new System.Drawing.Size(279, 21); + this.cmbMovement.TabIndex = 40; + this.cmbMovement.SelectedIndexChanged += new System.EventHandler(this.cmbMovement_SelectedIndexChanged); + // + // numFlee_Health + // + this.numFlee_Health.Location = new System.Drawing.Point(13, 190); + this.numFlee_Health.Name = "numFlee_Health"; + this.numFlee_Health.Size = new System.Drawing.Size(279, 20); + this.numFlee_Health.TabIndex = 37; + this.numFlee_Health.ValueChanged += new System.EventHandler(this.numFlee_Health_ValueChanged); // - this.lblMP.AutoSize = true; - this.lblMP.Location = new System.Drawing.Point(102, 16); - this.lblMP.Name = "lblMP"; - this.lblMP.Size = new System.Drawing.Size(26, 13); - this.lblMP.TabIndex = 3; - this.lblMP.Text = "MP:"; + // label13 // - // lblHP + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(10, 47); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(60, 13); + this.label13.TabIndex = 39; + this.label13.Text = "Movement:"; // - this.lblHP.AutoSize = true; - this.lblHP.Location = new System.Drawing.Point(6, 16); - this.lblHP.Name = "lblHP"; - this.lblHP.Size = new System.Drawing.Size(25, 13); - this.lblHP.TabIndex = 1; - this.lblHP.Text = "HP:"; + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(10, 174); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 13); + this.label1.TabIndex = 36; + this.label1.Text = "Flee health (%):"; + // + // grpAllie_Add + // + this.grpAllie_Add.Controls.Add(this.cmbAllie_NPC); + this.grpAllie_Add.Controls.Add(this.label17); + this.grpAllie_Add.Controls.Add(this.butAllie_Ok); + this.grpAllie_Add.Location = new System.Drawing.Point(531, 12); + this.grpAllie_Add.Name = "grpAllie_Add"; + this.grpAllie_Add.Size = new System.Drawing.Size(304, 253); + this.grpAllie_Add.TabIndex = 41; + this.grpAllie_Add.TabStop = false; + this.grpAllie_Add.Text = "Add Allie"; + this.grpAllie_Add.Visible = false; + // + // cmbAllie_NPC + // + this.cmbAllie_NPC.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbAllie_NPC.FormattingEnabled = true; + this.cmbAllie_NPC.Location = new System.Drawing.Point(26, 118); + this.cmbAllie_NPC.Name = "cmbAllie_NPC"; + this.cmbAllie_NPC.Size = new System.Drawing.Size(251, 21); + this.cmbAllie_NPC.TabIndex = 38; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(23, 102); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(32, 13); + this.label17.TabIndex = 37; + this.label17.Text = "NPC:"; + // + // butAllie_Ok + // + this.butAllie_Ok.Location = new System.Drawing.Point(26, 144); + this.butAllie_Ok.Name = "butAllie_Ok"; + this.butAllie_Ok.Size = new System.Drawing.Size(251, 20); + this.butAllie_Ok.TabIndex = 36; + this.butAllie_Ok.Text = "Ok"; + this.butAllie_Ok.UseVisualStyleBackColor = true; + this.butAllie_Ok.Click += new System.EventHandler(this.butAllie_Ok_Click); + // + // chkAttackNPC + // + this.chkAttackNPC.AutoSize = true; + this.chkAttackNPC.Location = new System.Drawing.Point(10, 19); + this.chkAttackNPC.Name = "chkAttackNPC"; + this.chkAttackNPC.Size = new System.Drawing.Size(71, 17); + this.chkAttackNPC.TabIndex = 0; + this.chkAttackNPC.Text = "Enabled?"; + this.chkAttackNPC.UseVisualStyleBackColor = true; + this.chkAttackNPC.CheckedChanged += new System.EventHandler(this.chkAttackNPC_CheckedChanged); // // Editor_NPCs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(535, 550); + this.ClientSize = new System.Drawing.Size(844, 527); this.ControlBox = false; + this.Controls.Add(this.grpAllie_Add); + this.Controls.Add(this.groupBox6); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.grpDrop_Add); + this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.butQuantity); this.Controls.Add(this.butClear); @@ -571,20 +797,26 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numRange)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); - this.grpDrop.ResumeLayout(false); - this.grpDrop.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.cmbDrop_Amount)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numDrop_Chance)).EndInit(); - this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numResistance)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numExperience)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numIntelligence)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numVitality)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numStrength)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numAgility)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numExperience)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numMP)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numHP)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numStrength)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numAgility)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDrop_Amount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numDrop_Chance)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.grpDrop_Add.ResumeLayout(false); + this.grpDrop_Add.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numFlee_Health)).EndInit(); + this.grpAllie_Add.ResumeLayout(false); + this.grpAllie_Add.PerformLayout(); this.ResumeLayout(false); } @@ -603,7 +835,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown numRange; private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox cmbBehavior; - private System.Windows.Forms.Label label1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.NumericUpDown numAgility; private System.Windows.Forms.Label label6; @@ -624,13 +855,33 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown numVitality; private System.Windows.Forms.Label label10; private System.Windows.Forms.NumericUpDown numTexture; - private System.Windows.Forms.GroupBox grpDrop; - private System.Windows.Forms.NumericUpDown cmbDrop_Amount; - private System.Windows.Forms.Label label13; + private System.Windows.Forms.NumericUpDown numDrop_Amount; private System.Windows.Forms.ComboBox cmbDrop_Item; - private System.Windows.Forms.Label label12; private System.Windows.Forms.NumericUpDown numDrop_Chance; private System.Windows.Forms.Label label11; - private System.Windows.Forms.HScrollBar scrlDrop; - private System.Windows.Forms.GroupBox groupBox4; + public System.Windows.Forms.TextBox txtSayMsg; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox grpDrop_Add; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button butItem_Ok; + private System.Windows.Forms.Button butDrop_Delete; + public System.Windows.Forms.ListBox lstDrop; + private System.Windows.Forms.Button butDrop_Add; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.ListBox lstAllies; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Button butAllie_Delete; + private System.Windows.Forms.Button butAllie_Add; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown numFlee_Health; + private System.Windows.Forms.ComboBox cmbMovement; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.GroupBox grpAllie_Add; + private System.Windows.Forms.ComboBox cmbAllie_NPC; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Button butAllie_Ok; + private System.Windows.Forms.CheckBox chkAttackNPC; } \ No newline at end of file diff --git a/Source/Editors/Editors/NPCs.cs b/Source/Editors/Editors/NPCs.cs index 447b2894..00bb16d3 100644 --- a/Source/Editors/Editors/NPCs.cs +++ b/Source/Editors/Editors/NPCs.cs @@ -7,7 +7,7 @@ public partial class Editor_NPCs : Form public static Editor_NPCs Objects = new Editor_NPCs(); // Index do item selecionado - public byte Selected; + private Lists.Structures.NPC Selected; public Editor_NPCs() { @@ -17,20 +17,19 @@ public Editor_NPCs() public static void Request() { // Lê os dados + Globals.OpenEditor = Objects; Send.Request_Items(); - Send.Request_NPCs(true); + Send.Request_NPCs(); } public static void Open() { // Lista de itens Objects.cmbDrop_Item.Items.Clear(); - Objects.cmbDrop_Item.Items.Add("None"); for (byte i = 1; i < Lists.Item.Length; i++) Objects.cmbDrop_Item.Items.Add(Lists.Item[i].Name); // Define os limites Objects.numTexture.Maximum = Graphics.Tex_Character.GetUpperBound(0); - Objects.scrlDrop.Maximum = Globals.Max_NPC_Drop - 1; Update_List(); // Abre a janela @@ -40,41 +39,51 @@ public static void Open() private static void Update_List() { - // Limpa a lista - Objects.List.Items.Clear(); - // Adiciona os itens à lista - for (byte i = 1; i < Lists.NPC.Length; i++) - Objects.List.Items.Add(Globals.Numbering(i, Lists.NPC.GetUpperBound(0)) + ":" + Lists.NPC[i].Name); - - // Seleciona o primeiro item + Objects.List.Items.Clear(); + for (byte i = 1; i < Lists.NPC.Length; i++) Objects.List.Items.Add(Globals.Numbering(i, Lists.NPC.GetUpperBound(0), Lists.NPC[i].Name)); Objects.List.SelectedIndex = 0; } private void Update_Data() { - Selected = (byte)(List.SelectedIndex + 1); - // Previne erros - if (Selected == 0) return; + if (List.SelectedIndex == -1) return; + + // Reseta os dados necessários + lstDrop.Items.Clear(); + grpDrop_Add.Visible = false; + lstAllies.Items.Clear(); + grpAllie_Add.Visible = false; + + // Remove o NPC dos aliados caso ele não existir + for (byte i = 0; i < Selected.Allie.Count; i++) + if (Selected.Allie[i] >= Lists.NPC.Length) + Selected.Allie.RemoveAt(i); // Lista os dados - txtName.Text = Lists.NPC[Selected].Name; - numTexture.Value = Lists.NPC[Selected].Texture; - cmbBehavior.SelectedIndex = Lists.NPC[Selected].Behaviour; - numSpawn.Value = Lists.NPC[Selected].SpawnTime; - numRange.Value = Lists.NPC[Selected].Sight; - numExperience.Value = Lists.NPC[Selected].Experience; - numHP.Value = Lists.NPC[Selected].Vital[(byte)Globals.Vitals.HP]; - numMP.Value = Lists.NPC[Selected].Vital[(byte)Globals.Vitals.MP]; - numStrength.Value = Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Strength]; - numResistance.Value = Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Resistance]; - numIntelligence.Value = Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Intelligence]; - numAgility.Value = Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Agility]; - numVitality.Value = Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Vitality]; - if (cmbDrop_Item.Items.Count > 0) cmbDrop_Item.SelectedIndex = Lists.NPC[Selected].Drop[scrlDrop.Value].Item_Num; - cmbDrop_Amount.Value = Lists.NPC[Selected].Drop[scrlDrop.Value].Amount; - numDrop_Chance.Value = Lists.NPC[Selected].Drop[scrlDrop.Value].Chance; + txtName.Text = Selected.Name; + txtSayMsg.Text = Selected.SayMsg; + numTexture.Value = Selected.Texture; + cmbBehavior.SelectedIndex = Selected.Behaviour; + numSpawn.Value = Selected.SpawnTime; + numRange.Value = Selected.Sight; + numExperience.Value = Selected.Experience; + numHP.Value = Selected.Vital[(byte)Globals.Vitals.HP]; + numMP.Value = Selected.Vital[(byte)Globals.Vitals.MP]; + numStrength.Value = Selected.Attribute[(byte)Globals.Attributes.Strength]; + numResistance.Value = Selected.Attribute[(byte)Globals.Attributes.Resistance]; + numIntelligence.Value = Selected.Attribute[(byte)Globals.Attributes.Intelligence]; + numAgility.Value = Selected.Attribute[(byte)Globals.Attributes.Agility]; + numVitality.Value = Selected.Attribute[(byte)Globals.Attributes.Vitality]; + for (byte i = 0; i < Selected.Drop.Count; i++) lstDrop.Items.Add(Drop_String(Selected.Drop[i])); + cmbMovement.SelectedIndex = (byte)Selected.Movement; + numFlee_Health.Value = Selected.Flee_Helth; + chkAttackNPC.Checked = Selected.AttackNPC; + for (byte i = 0; i < Selected.Allie.Count; i++) lstAllies.Items.Add(Globals.Numbering(Selected.Allie[i], Lists.NPC.GetUpperBound(0), Lists.NPC[Selected.Allie[i]].Name)); + + // Seleciona os primeiros itens + if (lstDrop.Items.Count > 0) lstDrop.SelectedIndex = 0; } public static void Change_Quantity() @@ -93,10 +102,10 @@ public static void Change_Quantity() Update_List(); } - #region private void List_SelectedIndexChanged(object sender, EventArgs e) { // Atualiza a lista + Selected = Lists.NPC[List.SelectedIndex + 1]; Update_Data(); } @@ -113,10 +122,10 @@ private void butSave_Click(object sender, EventArgs e) private void butClear_Click(object sender, EventArgs e) { // Limpa os dados - Clear.NPC(Selected); + Clear.NPC((short)(List.SelectedIndex + 1)); // Atualiza os valores - List.Items[Selected - 1] = Globals.Numbering(Selected, List.Items.Count) + ":"; + List.Items[List.SelectedIndex] = Globals.Numbering(List.SelectedIndex + 1, List.Items.Count, string.Empty); Update_Data(); } @@ -136,105 +145,164 @@ private void butQuantity_Click(object sender, EventArgs e) private void txtName_Validated(object sender, EventArgs e) { // Atualiza a lista - if (Selected > 0) - { - Lists.NPC[Selected].Name = txtName.Text; - List.Items[Selected - 1] = Globals.Numbering(Selected, List.Items.Count) + ":" + txtName.Text; - } + Selected.Name = txtName.Text; + List.Items[List.SelectedIndex] = Globals.Numbering(List.SelectedIndex + 1, List.Items.Count, txtName.Text); + } + + private void txtSayMsg_TextChanged(object sender, EventArgs e) + { + Selected.SayMsg = txtSayMsg.Text; } private void butTexture_Click(object sender, EventArgs e) { // Abre a pré visualização - Lists.NPC[Selected].Texture = Preview.Select(Graphics.Tex_Character, Lists.NPC[Selected].Texture); - numTexture.Value = Lists.NPC[Selected].Texture; + Selected.Texture = Preview.Select(Graphics.Tex_Character, Selected.Texture); + numTexture.Value = Selected.Texture; } private void numTexture_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Texture = (byte)numTexture.Value; + Selected.Texture = (byte)numTexture.Value; } private void numRange_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Sight = (byte)numRange.Value; + Selected.Sight = (byte)numRange.Value; } private void cmbBehavior_SelectedIndexChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Behaviour = (byte)cmbBehavior.SelectedIndex; + Selected.Behaviour = (byte)cmbBehavior.SelectedIndex; } private void numHP_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Vital[(byte)Globals.Vitals.HP] = (short)numHP.Value; + Selected.Vital[(byte)Globals.Vitals.HP] = (short)numHP.Value; } private void numMP_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Vital[(byte)Globals.Vitals.MP] = (short)numMP.Value; + Selected.Vital[(byte)Globals.Vitals.MP] = (short)numMP.Value; } private void numStrength_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Strength] = (short)numStrength.Value; + Selected.Attribute[(byte)Globals.Attributes.Strength] = (short)numStrength.Value; } private void numResistance_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Resistance] = (short)numResistance.Value; + Selected.Attribute[(byte)Globals.Attributes.Resistance] = (short)numResistance.Value; } private void numIntelligence_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Intelligence] = (short)numIntelligence.Value; + Selected.Attribute[(byte)Globals.Attributes.Intelligence] = (short)numIntelligence.Value; } private void numAgility_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Agility] = (short)numAgility.Value; + Selected.Attribute[(byte)Globals.Attributes.Agility] = (short)numAgility.Value; } private void numVitality_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Attribute[(byte)Globals.Attributes.Vitality] = (short)numVitality.Value; + Selected.Attribute[(byte)Globals.Attributes.Vitality] = (short)numVitality.Value; } private void numSpawn_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].SpawnTime = (byte)numSpawn.Value; + Selected.SpawnTime = (byte)numSpawn.Value; } private void numExperience_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Experience = (byte)numExperience.Value; + Selected.Experience = (int)numExperience.Value; } - private void scrlDrop_ValueChanged(object sender, EventArgs e) + private void butDrop_Add_Click(object sender, EventArgs e) { - // Previne erros - if (Selected <= 0) return; + // Reseta os valores e abre a janela para adicionar o item + cmbDrop_Item.SelectedIndex = 0; + numDrop_Amount.Value = 1; + numDrop_Chance.Value = 100; + grpDrop_Add.Visible = true; + } - // Atualiza os valores - grpDrop.Text = "Drop - " + (scrlDrop.Value + 1); - cmbDrop_Item.SelectedIndex = Lists.NPC[Selected].Drop[scrlDrop.Value].Item_Num; - cmbDrop_Amount.Value = Lists.NPC[Selected].Drop[scrlDrop.Value].Amount; - numDrop_Chance.Value = Lists.NPC[Selected].Drop[scrlDrop.Value].Chance; + private void butDrop_Delete_Click(object sender, EventArgs e) + { + // Deleta a item + short Selected_Item = (short)lstDrop.SelectedIndex; + if (Selected_Item != -1) + { + lstDrop.Items.RemoveAt(Selected_Item); + Selected.Drop.RemoveAt(Selected_Item); + } + } + + private void butItem_Ok_Click(object sender, EventArgs e) + { + // Adiciona o item + if (cmbDrop_Item.SelectedIndex >= 0) + { + Lists.Structures.NPC_Drop Drop = new Lists.Structures.NPC_Drop((short)(cmbDrop_Item.SelectedIndex + 1), (short)numDrop_Amount.Value, (byte)numDrop_Chance.Value); + Selected.Drop.Add(Drop); + lstDrop.Items.Add(Drop_String(Drop)); + grpDrop_Add.Visible = false; + } + } + + private string Drop_String(Lists.Structures.NPC_Drop Drop) + { + return Globals.Numbering(Drop.Item_Num, Lists.Item.GetUpperBound(0), Lists.Item[Drop.Item_Num].Name + " [" + Drop.Amount + "x, " + Drop.Chance + "%]"); + } + + private void chkAttackNPC_CheckedChanged(object sender, EventArgs e) + { + Selected.AttackNPC = lstAllies.Enabled = chkAttackNPC.Checked; + } + + private void butAllie_Add_Click(object sender, EventArgs e) + { + // Adiciona os NPCs + cmbAllie_NPC.Items.Clear(); + for (short i = 1; i < Lists.NPC.Length; i++) cmbAllie_NPC.Items.Add(Globals.Numbering(i, Lists.NPC.GetUpperBound(0), Lists.NPC[i].Name)); + cmbAllie_NPC.SelectedIndex = 0; + + // Abre a janela para adicionar o aliado + grpAllie_Add.Visible = true; + } + + private void butAllie_Delete_Click(object sender, EventArgs e) + { + // Deleta a aliado + short Selected_Item = (short)lstAllies.SelectedIndex; + if (Selected_Item != -1) + { + lstAllies.Items.RemoveAt(Selected_Item); + Selected.Allie.RemoveAt(Selected_Item); + } } - private void cmbDrop_Item_SelectedIndexChanged(object sender, EventArgs e) + private void butAllie_Ok_Click(object sender, EventArgs e) { - if (Selected > 0) Lists.NPC[Selected].Drop[scrlDrop.Value].Item_Num = (short)cmbDrop_Item.SelectedIndex; + // Adiciona o aliado + if (cmbAllie_NPC.SelectedIndex >= 0) + { + Selected.Allie.Add((short)(cmbAllie_NPC.SelectedIndex + 1)); + lstAllies.Items.Add(Globals.Numbering(cmbAllie_NPC.SelectedIndex + 1, Lists.NPC.GetUpperBound(0), Lists.NPC[cmbAllie_NPC.SelectedIndex + 1].Name)); + grpAllie_Add.Visible = false; + } } - private void cmbDrop_Amount_ValueChanged(object sender, EventArgs e) + private void cmbMovement_SelectedIndexChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Drop[scrlDrop.Value].Amount = (short)cmbDrop_Amount.Value; + Selected.Movement = (Globals.NPC_Movements)cmbMovement.SelectedIndex; } - private void numDrop_Chance_ValueChanged(object sender, EventArgs e) + private void numFlee_Health_ValueChanged(object sender, EventArgs e) { - Lists.NPC[Selected].Drop[scrlDrop.Value].Chance = (byte)numDrop_Chance.Value; + Selected.Flee_Helth = (byte)numFlee_Health.Value; } - #endregion } \ No newline at end of file diff --git a/Source/Editors/Editors/Preview.cs b/Source/Editors/Editors/Preview.cs index bf385d45..47dbefa2 100644 --- a/Source/Editors/Editors/Preview.cs +++ b/Source/Editors/Editors/Preview.cs @@ -8,7 +8,7 @@ public partial class Preview : Form // Imagens public static SFML.Graphics.Texture[] Texture; - public static short Pattern; + private static short Pattern; public Preview() { diff --git a/Source/Editors/Editors/Tiles.cs b/Source/Editors/Editors/Tiles.cs index 6237f7eb..8ae946bb 100644 --- a/Source/Editors/Editors/Tiles.cs +++ b/Source/Editors/Editors/Tiles.cs @@ -18,7 +18,8 @@ public Editor_Tiles() public static void Request() { // Lê os dados - Send.Request_Tiles(true); + Globals.OpenEditor = Objects; + Send.Request_Tiles(); } public static void Open() @@ -102,15 +103,12 @@ private void picTile_MouseDown(object sender, MouseEventArgs e) } // Bloqueio direcional else if (optDirBlock.Checked) - { for (byte i = 0; i < (byte)Globals.Directions.Count; i++) if (Tile_Dif.X >= Globals.Block_Position(i).X && Tile_Dif.X <= Globals.Block_Position(i).X + 8) if (Tile_Dif.Y >= Globals.Block_Position(i).Y && Tile_Dif.Y <= Globals.Block_Position(i).Y + 8) if (Lists.Tile[scrlTile.Value].Data[Position.X, Position.Y].Attribute != (byte)Globals.Tile_Attributes.Block) // Altera o valor de bloqueio Lists.Tile[scrlTile.Value].Data[Position.X, Position.Y].Block[i] = !Lists.Tile[scrlTile.Value].Data[Position.X, Position.Y].Block[i]; - } - } private void optBlock_CheckedChanged(object sender, EventArgs e) diff --git a/Source/Editors/Library/Clear.cs b/Source/Editors/Library/Clear.cs index 881f93fe..98ceb76a 100644 --- a/Source/Editors/Library/Clear.cs +++ b/Source/Editors/Library/Clear.cs @@ -30,25 +30,24 @@ public static void Class(byte Index) Lists.Class[Index].Name = string.Empty; Lists.Class[Index].Vital = new short[(byte)Globals.Vitals.Count]; Lists.Class[Index].Attribute = new short[(byte)Globals.Attributes.Count]; + Lists.Class[Index].Tex_Male = new List(); + Lists.Class[Index].Tex_Female = new List(); + Lists.Class[Index].Item = new List>(); Lists.Class[Index].Spawn_Map = 1; } - public static void NPC(byte Index) + public static void NPC(short Index) { // Reseta os valores Lists.NPC[Index] = new Lists.Structures.NPC(); Lists.NPC[Index].Name = string.Empty; Lists.NPC[Index].Vital = new short[(byte)Globals.Vitals.Count]; Lists.NPC[Index].Attribute = new short[(byte)Globals.Attributes.Count]; - Lists.NPC[Index].Drop = new Lists.Structures.NPC_Drop[Globals.Max_NPC_Drop]; - for (byte i = 0; i < Globals.Max_NPC_Drop; i++) - { - Lists.NPC[Index].Drop[i].Chance = 100; - Lists.NPC[Index].Drop[i].Amount = 1; - } + Lists.NPC[Index].Drop = new List(); + Lists.NPC[Index].Allie = new List(); } - public static void Item(byte Index) + public static void Item(short Index) { // Reseta os valores Lists.Item[Index] = new Lists.Structures.Item(); @@ -85,7 +84,7 @@ public static void Map(short Index) Lists.Map[Index].Tile[x, y].Block = new bool[(byte)Globals.Directions.Count]; } - public static void Map_Layers(short Index) + private static void Map_Layers(short Index) { for (byte c = 0; c < Lists.Map[Index].Layer.Count; c++) { diff --git a/Source/Editors/Library/Directories.cs b/Source/Editors/Library/Directories.cs index 65852fe2..a70170ca 100644 --- a/Source/Editors/Library/Directories.cs +++ b/Source/Editors/Library/Directories.cs @@ -48,26 +48,26 @@ public static void SetClient() Selection.Objects.txtDirectory_Client.Text = Directory; // Cliente - Fonts = new DirectoryInfo(Directory + @"\Fonts\"); Sounds = new DirectoryInfo(Directory + @"\Audio\Sounds\"); Musics = new DirectoryInfo(Directory + @"\Audio\Musics\"); Tools = new FileInfo(Directory + @"\Data\Tools" + Format); + Fonts = new DirectoryInfo(Directory + @"\Graphics\Fonts\"); Tex_Panoramas = new DirectoryInfo(Directory + @"\Graphics\Panoramas\"); Tex_Lights = new DirectoryInfo(Directory + @"\Graphics\Lights\"); Tex_Fogs = new DirectoryInfo(Directory + @"\Graphics\Fogs\"); Tex_Characters = new DirectoryInfo(Directory + @"\Graphics\Characters\"); Tex_Faces = new DirectoryInfo(Directory + @"\Graphics\Faces\"); - Tex_Painel = new DirectoryInfo(Directory + @"\Graphics\Interface\Tools\Panels\"); - Tex_Buttons = new DirectoryInfo(Directory + @"\Graphics\Interface\Tools\Buttons\"); - Tex_CheckBox = new FileInfo(Directory + @"\Graphics\Interface\Tools\CheckBox"); - Tex_TextBox = new FileInfo(Directory + @"\Graphics\Interface\Tools\TextBox"); + Tex_Painel = new DirectoryInfo(Directory + @"\Graphics\Interface\Panels\"); + Tex_Buttons = new DirectoryInfo(Directory + @"\Graphics\Interface\Buttons\"); + Tex_CheckBox = new FileInfo(Directory + @"\Graphics\Interface\CheckBox"); + Tex_TextBox = new FileInfo(Directory + @"\Graphics\Interface\TextBox"); Tex_Tiles = new DirectoryInfo(Directory + @"\Graphics\Tiles\"); - Tex_Grid = new FileInfo(Directory + @"\Graphics\Grid"); - Tex_Weather = new FileInfo(Directory + @"\Graphics\Weather"); - Tex_Blanc = new FileInfo(Directory + @"\Graphics\Blank"); - Tex_Directions = new FileInfo(Directory + @"\Graphics\Directions"); - Tex_Transparent = new FileInfo(Directory + @"\Graphics\Transparent"); - Tex_Lighting = new FileInfo(Directory + @"\Graphics\Lighting"); + Tex_Grid = new FileInfo(Directory + @"\Graphics\Misc\Grid"); + Tex_Weather = new FileInfo(Directory + @"\Graphics\Misc\Weather"); + Tex_Blanc = new FileInfo(Directory + @"\Graphics\Misc\Blank"); + Tex_Directions = new FileInfo(Directory + @"\Graphics\Misc\Directions"); + Tex_Transparent = new FileInfo(Directory + @"\Graphics\Misc\Transparent"); + Tex_Lighting = new FileInfo(Directory + @"\Graphics\Misc\Lighting"); Tex_Items = new DirectoryInfo(Directory + @"\Graphics\Items\"); // Cria os diretórios diff --git a/Source/Editors/Library/Lists.cs b/Source/Editors/Library/Lists.cs index d589f8a1..67055317 100644 --- a/Source/Editors/Library/Lists.cs +++ b/Source/Editors/Library/Lists.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; @@ -34,6 +35,8 @@ public struct Server_Data public short Port; public byte Max_Players; public byte Max_Characters; + public byte Max_Party_Members; + public byte Max_Map_Items; } public class Tool @@ -59,7 +62,7 @@ public class TextBox : Tool public class CheckBox : Tool { public string Text { get; set; } - public bool State { get; set; } + public bool Checked { get; set; } } public class Panel : Tool @@ -67,17 +70,19 @@ public class Panel : Tool public byte Texture_Num { get; set; } } - public struct Class + public class Class { public string Name; - public short Texture_Male; - public short Texture_Female; + public string Description; + public List Tex_Male; + public List Tex_Female; public short Spawn_Map; public byte Spawn_Direction; public byte Spawn_X; public byte Spawn_Y; public short[] Vital; public short[] Attribute; + public List> Item; } public struct Tile @@ -199,20 +204,25 @@ public struct Weather public bool Back; } - public struct NPC + public class NPC { public string Name; + public string SayMsg; public short Texture; public byte Behaviour; public byte SpawnTime; public byte Sight; - public byte Experience; + public int Experience; public short[] Vital; public short[] Attribute; - public NPC_Drop[] Drop; + public List Drop; + public bool AttackNPC; + public List Allie; + public Globals.NPC_Movements Movement; + public byte Flee_Helth; } - public struct Item + public class Item { // Geral public string Name; @@ -221,12 +231,13 @@ public struct Item public byte Type; public short Price; public bool Stackable; - public bool Bind; + public byte Bind; + public byte Rarity; // Requerimentos public short Req_Level; public byte Req_Class; // Poção - public short Potion_Experience; + public int Potion_Experience; public short[] Potion_Vital; // Equipamento public byte Equip_Type; @@ -234,11 +245,18 @@ public struct Item public short Weapon_Damage; } - public struct NPC_Drop + public class NPC_Drop { public short Item_Num; public short Amount; public byte Chance; + + public NPC_Drop(short Item_Num, short Amount, byte Chance) + { + this.Item_Num = Item_Num; + this.Amount = Amount; + this.Chance = Chance; + } } } } \ No newline at end of file diff --git a/Source/Editors/Library/Read.cs b/Source/Editors/Library/Read.cs index 2d63c9ba..f5f1657f 100644 --- a/Source/Editors/Library/Read.cs +++ b/Source/Editors/Library/Read.cs @@ -65,7 +65,7 @@ public static void Tools() Data.Dispose(); } - private static void Tools(TreeNode Node, BinaryReader Data) + public static void Tools(TreeNode Node, BinaryReader Data) { // Lê todos os filhos byte Size = Data.ReadByte(); @@ -89,7 +89,7 @@ private static void Tools(TreeNode Node, BinaryReader Data) } } - public static Lists.Structures.Button Button(BinaryReader Data) + private static Lists.Structures.Button Button(BinaryReader Data) { // Lê os dados Lists.Structures.Button Tool = new Lists.Structures.Button @@ -103,7 +103,7 @@ public static Lists.Structures.Button Button(BinaryReader Data) return Tool; } - public static Lists.Structures.TextBox TextBox(BinaryReader Data) + private static Lists.Structures.TextBox TextBox(BinaryReader Data) { // Lê os dados Lists.Structures.TextBox Tool = new Lists.Structures.TextBox @@ -119,7 +119,7 @@ public static Lists.Structures.TextBox TextBox(BinaryReader Data) return Tool; } - public static Lists.Structures.Panel Panel(BinaryReader Data) + private static Lists.Structures.Panel Panel(BinaryReader Data) { // Carrega os dados Lists.Structures.Panel Tool = new Lists.Structures.Panel @@ -133,7 +133,7 @@ public static Lists.Structures.Panel Panel(BinaryReader Data) return Tool; } - public static Lists.Structures.CheckBox CheckBox(BinaryReader Data) + private static Lists.Structures.CheckBox CheckBox(BinaryReader Data) { // Carrega os dados Lists.Structures.CheckBox Tool = new Lists.Structures.CheckBox @@ -143,7 +143,7 @@ public static Lists.Structures.CheckBox CheckBox(BinaryReader Data) Visible = Data.ReadBoolean(), Window = (Globals.Windows)Data.ReadByte(), Text = Data.ReadString(), - State = Data.ReadBoolean() + Checked = Data.ReadBoolean() }; return Tool; } diff --git a/Source/Editors/Library/Write.cs b/Source/Editors/Library/Write.cs index b367d1a0..cfb076c0 100644 --- a/Source/Editors/Library/Write.cs +++ b/Source/Editors/Library/Write.cs @@ -66,7 +66,7 @@ private static void Tools(TreeNode Node, BinaryWriter Data) } } - public static void Button(BinaryWriter Data, Lists.Structures.Button Tool) + private static void Button(BinaryWriter Data, Lists.Structures.Button Tool) { // Escreve os dados Data.Write(Tool.Name); @@ -77,7 +77,7 @@ public static void Button(BinaryWriter Data, Lists.Structures.Button Tool) Data.Write(Tool.Texture_Num); } - public static void TextBox(BinaryWriter Data, Lists.Structures.TextBox Tool) + private static void TextBox(BinaryWriter Data, Lists.Structures.TextBox Tool) { // Escreve os dados Data.Write(Tool.Name); @@ -90,7 +90,7 @@ public static void TextBox(BinaryWriter Data, Lists.Structures.TextBox Tool) Data.Write(Tool.Password); } - public static void Panel(BinaryWriter Data, Lists.Structures.Panel Tool) + private static void Panel(BinaryWriter Data, Lists.Structures.Panel Tool) { // Escreve os dados Data.Write(Tool.Name); @@ -101,7 +101,7 @@ public static void Panel(BinaryWriter Data, Lists.Structures.Panel Tool) Data.Write(Tool.Texture_Num); } - public static void CheckBox(BinaryWriter Data, Lists.Structures.CheckBox Tool) + private static void CheckBox(BinaryWriter Data, Lists.Structures.CheckBox Tool) { // Escreve os dados Data.Write(Tool.Name); @@ -110,6 +110,6 @@ public static void CheckBox(BinaryWriter Data, Lists.Structures.CheckBox Tool) Data.Write(Tool.Visible); Data.Write((byte)Tool.Window); Data.Write(Tool.Text); - Data.Write(Tool.State); + Data.Write(Tool.Checked); } } \ No newline at end of file diff --git a/Source/Editors/Logic/Globals.cs b/Source/Editors/Logic/Globals.cs index 81718dbe..3a633208 100644 --- a/Source/Editors/Logic/Globals.cs +++ b/Source/Editors/Logic/Globals.cs @@ -7,6 +7,9 @@ class Globals public const byte Grid = 32; public static Size Grid_Size = new Size(Grid, Grid); + // Editor que será aberto + public static System.Windows.Forms.Form OpenEditor; + // Medida de calculo do atraso do jogo public static short FPS; @@ -27,9 +30,6 @@ class Globals public const byte Snow_Movement = 10; public static byte Lightning; - // Limites em geral - public const byte Max_NPC_Drop = 4; - // Números aleAmountatórios public static Random GameRandom = new Random(); @@ -121,7 +121,7 @@ public enum Equipments Helmet, Shield, Amulet, - Amount + Count } public enum Windows @@ -131,6 +131,31 @@ public enum Windows Global, } + public enum Rarity + { + Common, + Uncommon, + Rare, + Epic, + Legendary, + Count + } + + public enum BindOn + { + None, + Pickup, + Equip, + Count + } + + public enum NPC_Movements + { + MoveRandomly, + TurnRandomly, + StandStill + } + public static void Weather_Update() { // Redimensiona a lista @@ -142,15 +167,12 @@ public static void Weather_Update() } } - public static string Numbering(int Number, int Limit) + public static string Numbering(int Number, int Limit, string Text) { int Amount = Limit.ToString().Length - Number.ToString().Length; // Retorna com a numeração - if (Amount > 0) - return new string('0', Amount) + Number; - else - return Number.ToString(); + return new string('0', Amount) + Number + ":" + Text; } public static Point Block_Position(byte Direction) diff --git a/Source/Editors/Logic/Loop.cs b/Source/Editors/Logic/Loop.cs index fd1e1096..3753effb 100644 --- a/Source/Editors/Logic/Loop.cs +++ b/Source/Editors/Logic/Loop.cs @@ -9,9 +9,8 @@ class Loop private static int FogY_Timer = 0; private static int Snow_Timer = 0; private static int Thundering_Timer = 0; - public static byte Anim = 0; - public static void Main() + public static void Init() { int Count; int Timer_1000 = 0; diff --git a/Source/Editors/Media/Graphics.cs b/Source/Editors/Media/Graphics.cs index 068fa771..15235c6a 100644 --- a/Source/Editors/Media/Graphics.cs +++ b/Source/Editors/Media/Graphics.cs @@ -1,5 +1,5 @@ using SFML.Graphics; -using SFML.Window; +using SFML.System; using System; using System.Drawing; using System.IO; @@ -21,7 +21,7 @@ partial class Graphics // Texturas public static Texture[] Tex_Character; public static Texture[] Tex_Tile; - public static Texture[] Tex_Face; + private static Texture[] Tex_Face; public static Texture[] Tex_Panel; public static Texture[] Tex_Button; public static Texture[] Tex_Panorama; @@ -41,7 +41,7 @@ partial class Graphics public const string Format = ".png"; #region Engine - public static Texture[] AddTextures(string Directory) + private static Texture[] AddTextures(string Directory) { short i = 1; Texture[] TempTex = new Texture[0]; @@ -67,13 +67,13 @@ public static Size TSize(Texture Texture) return new Size(0, 0); } - public static SFML.Graphics.Color CColor(byte R = 255, byte G = 255, byte B = 255, byte A = 255) + private static SFML.Graphics.Color CColor(byte R = 255, byte G = 255, byte B = 255, byte A = 255) { // Retorna com a cor return new SFML.Graphics.Color(R, G, B, A); } - public static void Render(RenderWindow Window, Texture Texture, Rectangle Source, Rectangle Destiny, object Color = null, object Mode = null) + private static void Render(RenderWindow Window, Texture Texture, Rectangle Source, Rectangle Destiny, object Color = null, object Mode = null) { // Define os dados Sprite TmpImage = new Sprite(Texture) @@ -89,7 +89,7 @@ public static void Render(RenderWindow Window, Texture Texture, Rectangle Source Window.Draw(TmpImage, (RenderStates)Mode); } - public static void Render(RenderTexture Window, Texture Texture, Rectangle Destiny, object Color = null, object Mode = null) + private static void Render(RenderTexture Window, Texture Texture, Rectangle Destiny, object Color = null, object Mode = null) { // Define os dados Sprite TmpImage = new Sprite(Texture) @@ -104,7 +104,7 @@ public static void Render(RenderTexture Window, Texture Texture, Rectangle Desti Window.Draw(TmpImage, (RenderStates)Mode); } - public static void Render(RenderWindow Window, Texture Texture, int X, int Y, int Source_X, int Source_Y, int Source_Width, int Source_Height, object Color = null, object Mode = null) + private static void Render(RenderWindow Window, Texture Texture, int X, int Y, int Source_X, int Source_Y, int Source_Width, int Source_Height, object Color = null, object Mode = null) { // Define as propriedades dos retângulos Rectangle Source = new Rectangle(new Point(Source_X, Source_Y), new Size(Source_Width, Source_Height)); @@ -114,7 +114,7 @@ public static void Render(RenderWindow Window, Texture Texture, int X, int Y, in Render(Window, Texture, Source, Destiny, Color, Mode); } - public static void Render(RenderWindow Window, Texture Texture, Rectangle Destiny, object Color = null, object Mode = null) + private static void Render(RenderWindow Window, Texture Texture, Rectangle Destiny, object Color = null, object Mode = null) { // Define as propriedades dos retângulos Rectangle Source = new Rectangle(new Point(0), TSize(Texture)); @@ -123,7 +123,7 @@ public static void Render(RenderWindow Window, Texture Texture, Rectangle Destin Render(Window, Texture, Source, Destiny, Color, Mode); } - public static void Render(RenderWindow Window, Texture Texture, Point Point, object Color = null, object Mode = null) + private static void Render(RenderWindow Window, Texture Texture, Point Point, object Color = null, object Mode = null) { // Define as propriedades dos retângulos Rectangle Source = new Rectangle(new Point(0), TSize(Texture)); @@ -133,7 +133,7 @@ public static void Render(RenderWindow Window, Texture Texture, Point Point, obj Render(Window, Texture, Source, Destiny, Color, Mode); } - public static void RenderRectangle(RenderWindow Window, Rectangle Rectangle, object Color = null) + private static void RenderRectangle(RenderWindow Window, Rectangle Rectangle, object Color = null) { // Desenha a caixa Render(Window, Tex_Grid, Rectangle.X, Rectangle.Y, 0, 0, Rectangle.Width, 1, Color); @@ -142,13 +142,13 @@ public static void RenderRectangle(RenderWindow Window, Rectangle Rectangle, obj Render(Window, Tex_Grid, Rectangle.X + Rectangle.Width - 1, Rectangle.Y, 0, 0, 1, Rectangle.Height, Color); } - public static void RenderRectangle(RenderWindow Window, int x, int y, int Width, int Height, object Color = null) + private static void RenderRectangle(RenderWindow Window, int x, int y, int Width, int Height, object Color = null) { // Desenha a caixa RenderRectangle(Window, new Rectangle(x, y, Width, Height), Color); } - public static void Render_Box(RenderWindow Window, Texture Texture, byte Margin, Point Position, Size Size) + private static void Render_Box(RenderWindow Window, Texture Texture, byte Margin, Point Position, Size Size) { int Texture_Width = TSize(Texture).Width; int Texture_Height = TSize(Texture).Height; @@ -167,7 +167,7 @@ private static void DrawText(RenderWindow Window, string Text, int X, int Y, SFM Text TempText = new Text(Text, GameFont) { CharacterSize = 10, - Color = Color, + FillColor = Color, Position = new Vector2f(X, Y) }; @@ -213,7 +213,7 @@ public static void Present() Interface(); } - public static void Transparent(RenderWindow Window) + private static void Transparent(RenderWindow Window) { Size Tamanho = TSize(Tex_Transparent); @@ -248,7 +248,7 @@ public static void Preview_Image() #endregion #region Tile Editor - public static void Editor_Tile() + private static void Editor_Tile() { Editor_Tiles Objects = Editor_Tiles.Objects; @@ -285,7 +285,7 @@ public static void Editor_Tile() Win_Tile.Display(); } - public static void Editor_Tile_Attributes(byte x, byte y) + private static void Editor_Tile_Attributes(byte x, byte y) { Editor_Tiles Objects = Editor_Tiles.Objects; Point Tile = new Point(Objects.scrlTileX.Value + x, Objects.scrlTileY.Value + y); @@ -305,7 +305,7 @@ public static void Editor_Tile_Attributes(byte x, byte y) } } - public static void Editor_Tile_DirBlock(byte x, byte y) + private static void Editor_Tile_DirBlock(byte x, byte y) { Editor_Tiles Objects = Editor_Tiles.Objects; Point Tile = new Point(Objects.scrlTileX.Value + x, Objects.scrlTileY.Value + y); @@ -337,7 +337,7 @@ public static void Editor_Tile_DirBlock(byte x, byte y) #endregion #region Map Editor - public static void Editor_Maps_Tile() + private static void Editor_Maps_Tile() { Editor_Maps Objects = Editor_Maps.Objects; @@ -369,7 +369,7 @@ public static void Editor_Maps_Tile() Win_Map_Tile.Display(); } - public static void Editor_Maps_Map() + private static void Editor_Maps_Map() { short Index = Editor_Maps.Selected; @@ -393,7 +393,7 @@ public static void Editor_Maps_Map() Win_Map.Display(); } - public static void Editor_Maps_Map_Panorama(short Index) + private static void Editor_Maps_Map_Panorama(short Index) { short Texture = Lists.Map[Index].Panorama; Size Size = TSize(Tex_Panorama[Texture]); @@ -414,7 +414,7 @@ public static void Editor_Maps_Map_Panorama(short Index) Render(Win_Map, Tex_Panorama[Texture], Editor_Maps.Zoom(new Rectangle(new Point(0), Size))); } - public static void Editor_Maps_Map_Tiles(short Index) + private static void Editor_Maps_Map_Tiles(short Index) { Editor_Maps Objects = Editor_Maps.Objects; Lists.Structures.Map Map = Lists.Map[Index]; @@ -458,7 +458,7 @@ public static void Editor_Maps_Map_Tiles(short Index) } } - public static void Editor_Maps_AutoTile(Point Position, Lists.Structures.Map_Tile_Data Data, SFML.Graphics.Color Color) + private static void Editor_Maps_AutoTile(Point Position, Lists.Structures.Map_Tile_Data Data, SFML.Graphics.Color Color) { // Desenha os 4 mini azulejos for (byte i = 0; i <= 3; i++) @@ -478,7 +478,7 @@ public static void Editor_Maps_AutoTile(Point Position, Lists.Structures.Map_Til } } - public static void Editor_Maps_Map_Fog(short Index) + private static void Editor_Maps_Map_Fog(short Index) { Lists.Structures.Map_Fog Data = Lists.Map[Index].Fog; Point Position; @@ -498,7 +498,7 @@ public static void Editor_Maps_Map_Fog(short Index) } } - public static void Editor_Maps_Map_Weather(short Index) + private static void Editor_Maps_Map_Weather(short Index) { // Somente se necessário if (!Editor_Maps.Objects.butVisualization.Checked || Lists.Map[Index].Weather.Type == (byte)Globals.Weathers.Normal) return; @@ -513,7 +513,7 @@ public static void Editor_Maps_Map_Weather(short Index) Render(Win_Map, Tex_Weather, new Rectangle(x, 0, 32, 32), Editor_Maps.Zoom(new Rectangle(Lists.Weather[i].x, Lists.Weather[i].y, 32, 32)), CColor(255, 255, 255, 150)); } - public static void Editor_Maps_Map_Light(short Index) + private static void Editor_Maps_Map_Light(short Index) { Editor_Maps Objects = Editor_Maps.Objects; byte GlobalLight_Tex = Lists.Map[Index].Light_Global; @@ -554,7 +554,7 @@ public static void Editor_Maps_Map_Light(short Index) Render(Win_Map, Tex_Blank, 0, 0, 0, 0, Size.Width, Size.Height, CColor(255, 255, 255, Globals.Lightning)); } - public static void Editor_Maps_Map_Grids(short Index) + private static void Editor_Maps_Map_Grids(short Index) { Editor_Maps Objects = Editor_Maps.Objects; Rectangle Source = Editor_Maps.Tile_Source, Destiny = new Rectangle(); @@ -590,7 +590,7 @@ public static void Editor_Maps_Map_Grids(short Index) RenderRectangle(Win_Map, Destiny.X, Destiny.Y, Editor_Maps.Map_Selection.Width * Globals.Grid_Zoom, Editor_Maps.Map_Selection.Height * Globals.Grid_Zoom); } - public static void Editor_Maps_Map_Zones(short Index, byte x, byte y) + private static void Editor_Maps_Map_Zones(short Index, byte x, byte y) { Point Position = new Point((x - Editor_Maps.Objects.scrlMapX.Value) * Globals.Grid_Zoom, (y - Editor_Maps.Objects.scrlMapY.Value) * Globals.Grid_Zoom); byte Zone_Num = Lists.Map[Index].Tile[x, y].Zone; @@ -611,7 +611,7 @@ public static void Editor_Maps_Map_Zones(short Index, byte x, byte y) DrawText(Win_Map, Zone_Num.ToString(), Position.X, Position.Y, SFML.Graphics.Color.White); } - public static void Editor_Maps_Map_Attributes(short Index, byte x, byte y) + private static void Editor_Maps_Map_Attributes(short Index, byte x, byte y) { Point Position = new Point((x - Editor_Maps.Objects.scrlMapX.Value) * Globals.Grid_Zoom, (y - Editor_Maps.Objects.scrlMapY.Value) * Globals.Grid_Zoom); Globals.Tile_Attributes Attribute = (Globals.Tile_Attributes)Lists.Map[Index].Tile[x, y].Attribute; @@ -638,7 +638,7 @@ public static void Editor_Maps_Map_Attributes(short Index, byte x, byte y) DrawText(Win_Map, Letter, Position.X, Position.Y, SFML.Graphics.Color.White); } - public static void Editor_Maps_Map_DirBlock(short Index, byte x, byte y) + private static void Editor_Maps_Map_DirBlock(short Index, byte x, byte y) { Point Tile = new Point(Editor_Maps.Objects.scrlMapX.Value + x, Editor_Maps.Objects.scrlMapY.Value + y); byte Y; @@ -664,7 +664,7 @@ public static void Editor_Maps_Map_DirBlock(short Index, byte x, byte y) } } - public static void Editor_Maps_Map_NPCs(short Index) + private static void Editor_Maps_Map_NPCs(short Index) { if (Editor_Maps.Objects.butMNPCs.Checked) for (byte i = 0; i < Lists.Map[Index].NPC.Count; i++) @@ -680,7 +680,7 @@ public static void Editor_Maps_Map_NPCs(short Index) #endregion #region Interface Editor - public static void Interface() + private static void Interface() { // Apenas se necessário if (!Editor_Interface.Objects.Visible) return; @@ -710,28 +710,28 @@ private static void Interface_Order(TreeNode Node) } } - public static void Button(Lists.Structures.Button Tool) + private static void Button(Lists.Structures.Button Tool) { // Desenha o botão if (Tool.Texture_Num < Tex_Button.Length) Render(Win_Interface, Tex_Button[Tool.Texture_Num], Tool.Position, new SFML.Graphics.Color(255, 255, 225, 225)); } - public static void Panel(Lists.Structures.Panel Tool) + private static void Panel(Lists.Structures.Panel Tool) { // Desenha o painel if (Tool.Texture_Num < Tex_Panel.Length) Render(Win_Interface, Tex_Panel[Tool.Texture_Num], Tool.Position); } - public static void CheckBox(Lists.Structures.CheckBox Tool) + private static void CheckBox(Lists.Structures.CheckBox Tool) { // Define as propriedades dos retângulos Rectangle Rec_Source = new Rectangle(new Point(), new Size(TSize(Tex_CheckBox).Width / 2, TSize(Tex_CheckBox).Height)); Rectangle Rec_Destiny = new Rectangle(Tool.Position, Rec_Source.Size); // Desenha a textura do marcador pelo seu estado - if (Tool.State) + if (Tool.Checked) Rec_Source.Location = new Point(TSize(Tex_CheckBox).Width / 2, 0); // Desenha o marcador @@ -740,7 +740,7 @@ public static void CheckBox(Lists.Structures.CheckBox Tool) DrawText(Win_Interface, Tool.Text, Rec_Destiny.Location.X + TSize(Tex_CheckBox).Width / 2 + Margin, Rec_Destiny.Location.Y + 1, SFML.Graphics.Color.White); } - public static void TextBox(Lists.Structures.TextBox Tool) + private static void TextBox(Lists.Structures.TextBox Tool) { // Desenha a ferramenta Render_Box(Win_Interface, Tex_TextBox, 3, Tool.Position, new Size(Tool.Width, TSize(Tex_TextBox).Height)); diff --git a/Source/Editors/Network/Receive.cs b/Source/Editors/Network/Receive.cs index 23f5a923..9abdcc87 100644 --- a/Source/Editors/Network/Receive.cs +++ b/Source/Editors/Network/Receive.cs @@ -1,11 +1,12 @@ using Lidgren.Network; +using System; using System.Drawing; using System.Windows.Forms; partial class Receive { // Pacotes do servidor - public enum Packets + private enum Packets { Alert, Connect, @@ -48,7 +49,7 @@ private static void Connect() Selection.Objects.Visible = true; } - public static void Server_Data(NetIncomingMessage Data) + private static void Server_Data(NetIncomingMessage Data) { // Lê os dados Lists.Server_Data.Game_Name = Data.ReadString(); @@ -56,12 +57,14 @@ public static void Server_Data(NetIncomingMessage Data) Lists.Server_Data.Port = Data.ReadInt16(); Lists.Server_Data.Max_Players = Data.ReadByte(); Lists.Server_Data.Max_Characters = Data.ReadByte(); + Lists.Server_Data.Max_Party_Members = Data.ReadByte(); + Lists.Server_Data.Max_Map_Items = Data.ReadByte(); // Abre o editor - if (Data.ReadBoolean()) Editor_Data.Open(); + if (Globals.OpenEditor == Editor_Data.Objects) Editor_Data.Open(); } - public static void Classes(NetIncomingMessage Data) + private static void Classes(NetIncomingMessage Data) { // Quantidade de classes Lists.Class = new Lists.Structures.Class[Data.ReadByte() + 1]; @@ -69,32 +72,41 @@ public static void Classes(NetIncomingMessage Data) for (short i = 1; i < Lists.Class.Length; i++) { // Redimensiona os valores necessários + Lists.Class[i] = new Lists.Structures.Class(); Lists.Class[i].Vital = new short[(byte)Globals.Vitals.Count]; Lists.Class[i].Attribute = new short[(byte)Globals.Attributes.Count]; + Lists.Class[i].Tex_Male = new System.Collections.Generic.List(); + Lists.Class[i].Tex_Female = new System.Collections.Generic.List(); + Lists.Class[i].Item = new System.Collections.Generic.List>(); // Lê os dados Lists.Class[i].Name = Data.ReadString(); - Lists.Class[i].Texture_Male = Data.ReadInt16(); - Lists.Class[i].Texture_Female = Data.ReadInt16(); + Lists.Class[i].Description = Data.ReadString(); + byte Num_Tex_Male = Data.ReadByte(); + for (byte t = 0; t < Num_Tex_Male; t++) Lists.Class[i].Tex_Male.Add(Data.ReadInt16()); + byte Num_Tex_Female = Data.ReadByte(); + for (byte t = 0; t < Num_Tex_Female; t++) Lists.Class[i].Tex_Female.Add(Data.ReadInt16()); Lists.Class[i].Spawn_Map = Data.ReadInt16(); Lists.Class[i].Spawn_Direction = Data.ReadByte(); Lists.Class[i].Spawn_X = Data.ReadByte(); Lists.Class[i].Spawn_Y = Data.ReadByte(); for (byte v = 0; v < (byte)Globals.Vitals.Count; v++) Lists.Class[i].Vital[v] = Data.ReadInt16(); for (byte a = 0; a < (byte)Globals.Attributes.Count; a++) Lists.Class[i].Attribute[a] = Data.ReadInt16(); + byte Num_Items = Data.ReadByte(); + for (byte a = 0; a < Num_Items; a++) Lists.Class[i].Item.Add(new Tuple (Data.ReadInt16(), Data.ReadInt16())); } // Abre o editor - if (Data.ReadBoolean()) Editor_Classes.Open(); + if (Globals.OpenEditor == Editor_Classes.Objects) Editor_Classes.Open(); } - public static void Maps(NetIncomingMessage Data) + private static void Maps(NetIncomingMessage Data) { // Quantidade de mapas Lists.Map = new Lists.Structures.Map[Data.ReadInt16()]; } - public static void Map(NetIncomingMessage Data) + private static void Map(NetIncomingMessage Data) { // Dados básicos short i = Data.ReadInt16(); @@ -190,47 +202,52 @@ public static void Map(NetIncomingMessage Data) if (Data.ReadBoolean()) Editor_Maps.Open(); } - public static void NPCs(NetIncomingMessage Data) + private static void NPCs(NetIncomingMessage Data) { // Quantidade de nocs - Lists.NPC = new Lists.Structures.NPC[Data.ReadInt16() + 1]; + Lists.NPC = new Lists.Structures.NPC[Data.ReadInt16()]; for (short i = 1; i < Lists.NPC.Length; i++) { // Redimensiona os valores necessários + Lists.NPC[i] = new Lists.Structures.NPC(); Lists.NPC[i].Vital = new short[(byte)Globals.Vitals.Count]; Lists.NPC[i].Attribute = new short[(byte)Globals.Attributes.Count]; - Lists.NPC[i].Drop = new Lists.Structures.NPC_Drop[Globals.Max_NPC_Drop]; + Lists.NPC[i].Drop = new System.Collections.Generic.List(); + Lists.NPC[i].Allie = new System.Collections.Generic.List(); // Lê os dados Lists.NPC[i].Name = Data.ReadString(); + Lists.NPC[i].SayMsg = Data.ReadString(); Lists.NPC[i].Texture = Data.ReadInt16(); Lists.NPC[i].Behaviour = Data.ReadByte(); for (byte n = 0; n < (byte)Globals.Vitals.Count; n++) Lists.NPC[i].Vital[n] = Data.ReadInt16(); Lists.NPC[i].SpawnTime = Data.ReadByte(); Lists.NPC[i].Sight = Data.ReadByte(); - Lists.NPC[i].Experience = Data.ReadByte(); + Lists.NPC[i].Experience = Data.ReadInt32(); for (byte n = 0; n < (byte)Globals.Attributes.Count; n++) Lists.NPC[i].Attribute[n] = Data.ReadInt16(); - for (byte n = 0; n < Globals.Max_NPC_Drop; n++) - { - Lists.NPC[i].Drop[n].Item_Num = Data.ReadInt16(); - Lists.NPC[i].Drop[n].Amount = Data.ReadInt16(); - Lists.NPC[i].Drop[n].Chance = Data.ReadByte(); - } + byte Num_Drops = Data.ReadByte(); + for (byte n = 0; n < Num_Drops; n++) Lists.NPC[i].Drop.Add(new Lists.Structures.NPC_Drop(Data.ReadInt16(), Data.ReadInt16(), Data.ReadByte())); + Lists.NPC[i].AttackNPC = Data.ReadBoolean(); + byte Num_Allies = Data.ReadByte(); + for (byte n = 0; n < Num_Allies; n++) Lists.NPC[i].Allie.Add(Data.ReadInt16()); + Lists.NPC[i].Movement = (Globals.NPC_Movements)Data.ReadByte(); + Lists.NPC[i].Flee_Helth = Data.ReadByte(); } // Abre o editor - if (Data.ReadBoolean()) Editor_NPCs.Open(); + if (Globals.OpenEditor == Editor_NPCs.Objects) Editor_NPCs.Open(); } - public static void Items(NetIncomingMessage Data) + private static void Items(NetIncomingMessage Data) { // Quantidade de itens - Lists.Item = new Lists.Structures.Item[Data.ReadInt16() + 1]; + Lists.Item = new Lists.Structures.Item[Data.ReadInt16()]; for (short i = 1; i < Lists.Item.Length; i++) { // Redimensiona os valores necessários + Lists.Item[i] = new Lists.Structures.Item(); Lists.Item[i].Potion_Vital = new short[(byte)Globals.Vitals.Count]; Lists.Item[i].Equip_Attribute = new short[(byte)Globals.Attributes.Count]; @@ -241,10 +258,11 @@ public static void Items(NetIncomingMessage Data) Lists.Item[i].Type = Data.ReadByte(); Lists.Item[i].Price = Data.ReadInt16(); Lists.Item[i].Stackable = Data.ReadBoolean(); - Lists.Item[i].Bind = Data.ReadBoolean(); + Lists.Item[i].Bind = Data.ReadByte(); + Lists.Item[i].Rarity = Data.ReadByte(); Lists.Item[i].Req_Level = Data.ReadInt16(); Lists.Item[i].Req_Class = Data.ReadByte(); - Lists.Item[i].Potion_Experience = Data.ReadInt16(); + Lists.Item[i].Potion_Experience = Data.ReadInt32(); for (byte v = 0; v < (byte)Globals.Vitals.Count; v++) Lists.Item[i].Potion_Vital[v] = Data.ReadInt16(); Lists.Item[i].Equip_Type = Data.ReadByte(); for (byte a = 0; a < (byte)Globals.Attributes.Count; a++) Lists.Item[i].Equip_Attribute[a] = Data.ReadInt16(); @@ -252,21 +270,23 @@ public static void Items(NetIncomingMessage Data) } // Abre o editor - if (Data.ReadBoolean()) Editor_Items.Open(); + if (Globals.OpenEditor == Editor_Items.Objects) Editor_Items.Open(); } - public static void Tiles(NetIncomingMessage Data) + private static void Tiles(NetIncomingMessage Data) { - Lists.Tile = new Lists.Structures.Tile[Data.ReadByte()]; + // Limpa os dados dos azulejos + Lists.Tile = new Lists.Structures.Tile[Graphics.Tex_Tile.Length]; + for (byte i = 1; i < Graphics.Tex_Tile.Length; i++) Clear.Tile(i); - for (byte i = 1; i < Lists.Tile.Length; i++) + // Lê os dados + byte Num_Tiles = Data.ReadByte(); + for (byte i = 1; i < Num_Tiles; i++) { // Dados básicos byte Width = Data.ReadByte(); byte Height = Data.ReadByte(); - // Dados de cada azulejo - Clear.Tile(i); for (byte x = 0; x <= Width; x++) for (byte y = 0; y <= Height; y++) { @@ -289,7 +309,6 @@ public static void Tiles(NetIncomingMessage Data) } // Abre o editor - if (Data.ReadBoolean()) - Editor_Tiles.Open(); + if (Globals.OpenEditor == Editor_Tiles.Objects) Editor_Tiles.Open(); } } \ No newline at end of file diff --git a/Source/Editors/Network/Send.cs b/Source/Editors/Network/Send.cs index b96a68da..bdd7cb6d 100644 --- a/Source/Editors/Network/Send.cs +++ b/Source/Editors/Network/Send.cs @@ -21,7 +21,7 @@ public enum Packets Request_Items } - public static void Packet(NetOutgoingMessage Data) + private static void Packet(NetOutgoingMessage Data) { // Envia os dados ao servidor Socket.Device.SendMessage(Data, NetDeliveryMethod.ReliableOrdered); @@ -39,33 +39,30 @@ public static void Connect() Packet(Data); } - public static void Request_Server_Data(bool OpenEditor = false) + public static void Request_Server_Data() { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Packets.Request_Server_Data); - Data.Write(OpenEditor); Packet(Data); } - public static void Request_Classes(bool OpenEditor = false) + public static void Request_Classes() { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Packets.Request_Classes); - Data.Write(OpenEditor); Packet(Data); } - public static void Request_Tiles(bool OpenEditor = false) + public static void Request_Tiles() { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Packets.Request_Tiles); - Data.Write(OpenEditor); Packet(Data); } @@ -89,23 +86,21 @@ public static void Request_Maps(bool OpenEditor = false) Packet(Data); } - public static void Request_NPCs(bool OpenEditor = false) + public static void Request_NPCs() { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Packets.Request_NPCs); - Data.Write(OpenEditor); Packet(Data); } - public static void Request_Items(bool OpenEditor = false) + public static void Request_Items() { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Packets.Request_Items); - Data.Write(OpenEditor); Packet(Data); } @@ -120,6 +115,8 @@ public static void Write_Server_Data() Data.Write(Lists.Server_Data.Port); Data.Write(Lists.Server_Data.Max_Players); Data.Write(Lists.Server_Data.Max_Characters); + Data.Write(Lists.Server_Data.Max_Party_Members); + Data.Write(Lists.Server_Data.Max_Map_Items); Packet(Data); } @@ -133,15 +130,24 @@ public static void Write_Classes() for (byte i = 1; i < Lists.Class.Length; i++) { // Escreve os dados + Data.Write((byte)Lists.Class[i].Tex_Male.Count); + Data.Write((byte)Lists.Class[i].Tex_Female.Count); + Data.Write((byte)Lists.Class[i].Item.Count); Data.Write(Lists.Class[i].Name); - Data.Write(Lists.Class[i].Texture_Male); - Data.Write(Lists.Class[i].Texture_Female); + Data.Write(Lists.Class[i].Description); + for (byte t = 0; t < Lists.Class[i].Tex_Male.Count; t++) Data.Write(Lists.Class[i].Tex_Male[t]); + for (byte t = 0; t < Lists.Class[i].Tex_Female.Count; t++) Data.Write(Lists.Class[i].Tex_Female[t]); Data.Write(Lists.Class[i].Spawn_Map); Data.Write(Lists.Class[i].Spawn_Direction); Data.Write(Lists.Class[i].Spawn_X); Data.Write(Lists.Class[i].Spawn_Y); for (byte v = 0; v < (byte)Globals.Vitals.Count; v++) Data.Write(Lists.Class[i].Vital[v]); for (byte a = 0; a < (byte)Globals.Attributes.Count; a++) Data.Write(Lists.Class[i].Attribute[a]); + for (byte a = 0; a < Lists.Class[i].Item.Count; a++) + { + Data.Write(Lists.Class[i].Item[a].Item1); + Data.Write(Lists.Class[i].Item[a].Item2); + } } Packet(Data); } @@ -270,6 +276,7 @@ public static void Write_NPCs() for (short Index = 1; Index < Lists.NPC.Length; Index++) { Data.Write(Lists.NPC[Index].Name); + Data.Write(Lists.NPC[Index].SayMsg); Data.Write(Lists.NPC[Index].Texture); Data.Write(Lists.NPC[Index].Behaviour); Data.Write(Lists.NPC[Index].SpawnTime); @@ -277,12 +284,18 @@ public static void Write_NPCs() Data.Write(Lists.NPC[Index].Experience); for (byte i = 0; i < (byte)Globals.Vitals.Count; i++) Data.Write(Lists.NPC[Index].Vital[i]); for (byte i = 0; i < (byte)Globals.Attributes.Count; i++) Data.Write(Lists.NPC[Index].Attribute[i]); - for (byte i = 0; i < Globals.Max_NPC_Drop; i++) + Data.Write((byte)Lists.NPC[Index].Drop.Count); + for (byte i = 0; i < Lists.NPC[Index].Drop.Count; i++) { Data.Write(Lists.NPC[Index].Drop[i].Item_Num); Data.Write(Lists.NPC[Index].Drop[i].Amount); Data.Write(Lists.NPC[Index].Drop[i].Chance); } + Data.Write(Lists.NPC[Index].AttackNPC); + Data.Write((byte)Lists.NPC[Index].Allie.Count); + for (byte i = 0; i < Lists.NPC[Index].Allie.Count; i++) Data.Write(Lists.NPC[Index].Allie[i]); + Data.Write((byte)Lists.NPC[Index].Movement); + Data.Write(Lists.NPC[Index].Flee_Helth); } Packet(Data); } @@ -303,6 +316,7 @@ public static void Write_Items() Data.Write(Lists.Item[Index].Price); Data.Write(Lists.Item[Index].Stackable); Data.Write(Lists.Item[Index].Bind); + Data.Write(Lists.Item[Index].Rarity); Data.Write(Lists.Item[Index].Req_Level); Data.Write(Lists.Item[Index].Req_Class); Data.Write(Lists.Item[Index].Potion_Experience); diff --git a/Source/Editors/Network/Socket.cs b/Source/Editors/Network/Socket.cs index e88045df..6eb92336 100644 --- a/Source/Editors/Network/Socket.cs +++ b/Source/Editors/Network/Socket.cs @@ -8,7 +8,7 @@ class Socket public static NetClient Device; // Manuseamento dos dados - public static NetIncomingMessage Data; + private static NetIncomingMessage Data; // Dados para a conexão com o servidor public const string IP = "localhost"; @@ -76,7 +76,7 @@ public static bool TryConnect() return IsConnected(); } - public static void Leave() + private static void Leave() { // Fecha todas as janelas abertar e abre o menu de login for (int i = 0; i < Application.OpenForms.Count; i++) Application.OpenForms[i].Visible = false; diff --git a/Source/Editors/Program.cs b/Source/Editors/Program.cs index aeee826f..0556a116 100644 --- a/Source/Editors/Program.cs +++ b/Source/Editors/Program.cs @@ -18,7 +18,7 @@ static void Main() // Inicia a aplicação Login.Objects.Visible = true; Application.EnableVisualStyles(); - Loop.Main(); + Loop.Init(); } public static void Close() diff --git a/Source/Editors/Properties/AssemblyInfo.cs b/Source/Editors/Properties/AssemblyInfo.cs index 976c6f69..914686bd 100644 --- a/Source/Editors/Properties/AssemblyInfo.cs +++ b/Source/Editors/Properties/AssemblyInfo.cs @@ -3,5 +3,6 @@ [assembly: AssemblyTitle("Editors")] [assembly: AssemblyCompany("Ricardo Dalarme")] [assembly: AssemblyProduct("CryBits")] -[assembly: AssemblyCopyright("Copyright (c) 2020 Ricardo Dalarme de Oliveira Filho")] -[assembly: AssemblyDescription("ORPG Game Engine")] \ No newline at end of file +[assembly: AssemblyCopyright("Copyright (c) 2020 Ricardo Dalarme")] +[assembly: AssemblyDescription("ORPG Game Engine")] +[assembly: AssemblyVersion("0.7.0")] \ No newline at end of file diff --git a/Source/Server/Library/Clear.cs b/Source/Server/Library/Clear.cs index 938c4241..5facbf47 100644 --- a/Source/Server/Library/Clear.cs +++ b/Source/Server/Library/Clear.cs @@ -2,17 +2,11 @@ class Clear { - public static void All() - { - // Limpa todos os dados necessários - Players(); - } - public static void Players() { // Redimensiona a lista Lists.Player = new Lists.Structures.Player[Lists.Server_Data.Max_Players + 1]; - Lists.TempPlayer = new Lists.Structures.TempPlayer[Lists.Server_Data.Max_Players + 1]; + Lists.Temp_Player = new Lists.Structures.TempPlayer[Lists.Server_Data.Max_Players + 1]; // Limpa os dados de todos jogadores for (byte i = 1; i <= Lists.Server_Data.Max_Players; i++) @@ -23,7 +17,7 @@ public static void Player(byte Index) { // Limpa os dados do jogador Lists.Player[Index] = new Lists.Structures.Player(); - Lists.TempPlayer[Index] = new Lists.Structures.TempPlayer(); + Lists.Temp_Player[Index] = new Lists.Structures.TempPlayer(); Lists.Player[Index].User = string.Empty; Lists.Player[Index].Password = string.Empty; Lists.Player[Index].Character = new Player.Character_Structure[Lists.Server_Data.Max_Characters + 1]; @@ -39,8 +33,9 @@ public static void Player_Character(byte Index, byte Char_Num) Lists.Player[Index].Character[Char_Num] = new Player.Character_Structure(); Lists.Player[Index].Character[Char_Num].Index = Index; Lists.Player[Index].Character[Char_Num].Inventory = new Lists.Structures.Inventories[Game.Max_Inventory + 1]; - Lists.Player[Index].Character[Char_Num].Equipment = new short[(byte)Game.Equipments.Amount]; + Lists.Player[Index].Character[Char_Num].Equipment = new short[(byte)Game.Equipments.Count]; Lists.Player[Index].Character[Char_Num].Hotbar = new Lists.Structures.Hotbar[Game.Max_Hotbar + 1]; + Lists.Player[Index].Character[Char_Num].Party = new System.Collections.Generic.List(); } public static void Server_Data() @@ -51,6 +46,8 @@ public static void Server_Data() Lists.Server_Data.Port = 7001; Lists.Server_Data.Max_Players = 15; Lists.Server_Data.Max_Characters = 3; + Lists.Server_Data.Max_Party_Members = 3; + Lists.Server_Data.Max_Map_Items = 100; Lists.Server_Data.Num_Classes = 1; Lists.Server_Data.Num_Maps = 1; Lists.Server_Data.Num_Items = 1; @@ -63,8 +60,11 @@ public static void Class(byte Index) // Reseta os valores Lists.Class[Index] = new Lists.Structures.Class(); Lists.Class[Index].Name = string.Empty; - Lists.Class[Index].Vital = new short[(byte)Game.Vitals.Amount]; - Lists.Class[Index].Attribute = new short[(byte)Game.Attributes.Amount]; + Lists.Class[Index].Vital = new short[(byte)Game.Vitals.Count]; + Lists.Class[Index].Attribute = new short[(byte)Game.Attributes.Count]; + Lists.Class[Index].Tex_Male = new short[0]; + Lists.Class[Index].Tex_Female = new short[0]; + Lists.Class[Index].Item = new Tuple[0]; Lists.Class[Index].Spawn_Map = 1; } @@ -73,15 +73,10 @@ public static void NPC(byte Index) // Reseta os valores Lists.NPC[Index] = new Lists.Structures.NPC(); Lists.NPC[Index].Name = string.Empty; - Lists.NPC[Index].Vital = new short[(byte)Game.Vitals.Amount]; - Lists.NPC[Index].Attribute = new short[(byte)Game.Attributes.Amount]; - Lists.NPC[Index].Drop = new Lists.Structures.NPC_Drop[Game.Max_NPC_Drop]; - for (byte i = 0; i < Game.Max_NPC_Drop; i++) - { - Lists.NPC[Index].Drop[i] = new Lists.Structures.NPC_Drop(); - Lists.NPC[Index].Drop[i].Chance = 100; - Lists.NPC[Index].Drop[i].Amount = 1; - } + Lists.NPC[Index].Vital = new short[(byte)Game.Vitals.Count]; + Lists.NPC[Index].Attribute = new short[(byte)Game.Attributes.Count]; + Lists.NPC[Index].Drop = new Lists.Structures.NPC_Drop[0]; + Lists.NPC[Index].Allie = new short[0]; } public static void Item(byte Index) @@ -90,8 +85,8 @@ public static void Item(byte Index) Lists.Item[Index] = new Lists.Structures.Item(); Lists.Item[Index].Name = string.Empty; Lists.Item[Index].Description = string.Empty; - Lists.Item[Index].Potion_Vital = new short[(byte)Game.Vitals.Amount]; - Lists.Item[Index].Equip_Attribute = new short[(byte)Game.Attributes.Amount]; + Lists.Item[Index].Potion_Vital = new short[(byte)Game.Vitals.Count]; + Lists.Item[Index].Equip_Attribute = new short[(byte)Game.Attributes.Count]; } public static void Map(short Index) diff --git a/Source/Server/Library/Lists.cs b/Source/Server/Library/Lists.cs index ec6e6002..a8f8bf00 100644 --- a/Source/Server/Library/Lists.cs +++ b/Source/Server/Library/Lists.cs @@ -6,7 +6,7 @@ class Lists // Armazenamento de dados public static Structures.Server_Data Server_Data = new Structures.Server_Data(); public static Structures.Player[] Player; - public static Structures.TempPlayer[] TempPlayer; + public static Structures.TempPlayer[] Temp_Player; public static Structures.Class[] Class; public static Structures.Map[] Map; public static Structures.Temp_Map[] Temp_Map; @@ -25,6 +25,8 @@ public struct Server_Data public short Port; public byte Max_Players; public byte Max_Characters; + public byte Max_Party_Members; + public byte Max_Map_Items; public byte Num_Classes; public short Num_Maps; public byte Num_Tiles; @@ -46,20 +48,23 @@ public struct TempPlayer public byte Using; public bool GettingMap; public bool InEditor; + public string Party_Invitation; } [Serializable] public class Class { public string Name; - public short Texture_Male; - public short Texture_Female; + public string Description; + public short[] Tex_Male; + public short[] Tex_Female; public short Spawn_Map; public byte Spawn_Direction; public byte Spawn_X; public byte Spawn_Y; public short[] Vital; public short[] Attribute; + public Tuple[] Item; } [Serializable] @@ -159,14 +164,19 @@ public struct Map_Fog public class NPC { public string Name; + public string SayMsg; public short Texture; public byte Behaviour; public byte SpawnTime; public byte Sight; - public byte Experience; + public int Experience; public short[] Vital; public short[] Attribute; public NPC_Drop[] Drop; + public bool AttackNPC; + public short[] Allie; + public global::NPC.Movements Movement; + public byte Flee_Helth; } public struct Map_NPCs @@ -200,12 +210,13 @@ public class Item public byte Type; public short Price; public bool Stackable; - public bool Bind; + public byte Bind; + public byte Rarity; // Requerimentos public short Req_Level; public byte Req_Class; // Poção - public short Potion_Experience; + public int Potion_Experience; public short[] Potion_Vital; // Equipamento public byte Equip_Type; @@ -222,9 +233,18 @@ public struct Inventories [Serializable] public class NPC_Drop { + // Dados public short Item_Num; public short Amount; public byte Chance; + + // Construtor + public NPC_Drop(short Item_Num, short Amount, byte Chance) + { + this.Item_Num = Item_Num; + this.Amount = Amount; + this.Chance = Chance; + } } public struct Hotbar diff --git a/Source/Server/Library/Read.cs b/Source/Server/Library/Read.cs index 229d97bb..392be474 100644 --- a/Source/Server/Library/Read.cs +++ b/Source/Server/Library/Read.cs @@ -21,7 +21,7 @@ public static void All() Tiles(); } - public static void Server_Data() + private static void Server_Data() { // Cria o arquivo caso ele não existir if (!Directories.Server_Data.Exists) @@ -55,22 +55,23 @@ public static void Player(byte Index, string Name, bool ReadCharacter = true) { Lists.Player[Index].Character[i].Name = Data.ReadString(); Lists.Player[Index].Character[i].Class = Data.ReadByte(); + Lists.Player[Index].Character[i].Texture_Num = Data.ReadInt16(); Lists.Player[Index].Character[i].Genre = Data.ReadBoolean(); Lists.Player[Index].Character[i].Level = Data.ReadInt16(); - Lists.Player[Index].Character[i].Experience = Data.ReadInt16(); + Lists.Player[Index].Character[i].Experience = Data.ReadInt32(); Lists.Player[Index].Character[i].Points = Data.ReadByte(); Lists.Player[Index].Character[i].Map = Data.ReadInt16(); Lists.Player[Index].Character[i].X = Data.ReadByte(); Lists.Player[Index].Character[i].Y = Data.ReadByte(); Lists.Player[Index].Character[i].Direction = (Game.Directions)Data.ReadByte(); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Lists.Player[Index].Character[i].Vital[n] = Data.ReadInt16(); - for (byte n = 0; n < (byte)Game.Attributes.Amount; n++) Lists.Player[Index].Character[i].Attribute[n] = Data.ReadInt16(); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Lists.Player[Index].Character[i].Vital[n] = Data.ReadInt16(); + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) Lists.Player[Index].Character[i].Attribute[n] = Data.ReadInt16(); for (byte n = 1; n <= Game.Max_Inventory; n++) { Lists.Player[Index].Character[i].Inventory[n].Item_Num = Data.ReadInt16(); Lists.Player[Index].Character[i].Inventory[n].Amount = Data.ReadInt16(); } - for (byte n = 0; n < (byte)Game.Equipments.Amount; n++) Lists.Player[Index].Character[i].Equipment[n] = Data.ReadInt16(); + for (byte n = 0; n < (byte)Game.Equipments.Count; n++) Lists.Player[Index].Character[i].Equipment[n] = Data.ReadInt16(); for (byte n = 1; n <= Game.Max_Hotbar; n++) { Lists.Player[Index].Character[i].Hotbar[n].Type = Data.ReadByte(); @@ -120,14 +121,14 @@ public static string Characters_Name() return Characters; } - public static void Classes() + private static void Classes() { // Lê os dados Lists.Class = new Lists.Structures.Class[Lists.Server_Data.Num_Classes + 1]; for (byte i = 1; i < Lists.Class.Length; i++) Class(i); } - public static void Class(byte Index) + private static void Class(byte Index) { FileInfo File = new FileInfo(Directories.Classes.FullName + Index + Directories.Format); @@ -145,14 +146,14 @@ public static void Class(byte Index) Stream.Close(); } - public static void Items() + private static void Items() { // Lê os dados Lists.Item = new Lists.Structures.Item[Lists.Server_Data.Num_Items + 1]; for (byte i = 1; i < Lists.Item.Length; i++) Item(i); } - public static void Item(byte Index) + private static void Item(byte Index) { FileInfo File = new FileInfo(Directories.Items.FullName + Index + Directories.Format); @@ -170,7 +171,7 @@ public static void Item(byte Index) Stream.Close(); } - public static void Maps() + private static void Maps() { // Lê os dados1 Lists.Map = new Lists.Structures.Map[Lists.Server_Data.Num_Maps + 1]; @@ -178,7 +179,7 @@ public static void Maps() for (short i = 1; i < Lists.Map.Length; i++) Map(i); } - public static void Map(short Index) + private static void Map(short Index) { FileInfo File = new FileInfo(Directories.Maps.FullName + Index + Directories.Format); @@ -203,14 +204,14 @@ public static void Map(short Index) global::Map.Spawn_Items(Index); } - public static void NPCs() + private static void NPCs() { // Lê os dados Lists.NPC = new Lists.Structures.NPC[Lists.Server_Data.Num_NPCs + 1]; for (byte i = 1; i < Lists.NPC.Length; i++) NPC(i); } - public static void NPC(byte Index) + private static void NPC(byte Index) { FileInfo File = new FileInfo(Directories.NPCs.FullName + Index + Directories.Format); @@ -228,14 +229,14 @@ public static void NPC(byte Index) Stream.Close(); } - public static void Tiles() + private static void Tiles() { // Lê os dados Lists.Tile = new Lists.Structures.Tile[Lists.Server_Data.Num_Tiles + 1]; for (byte i = 1; i < Lists.Tile.Length; i++) Tile(i); } - public static void Tile(byte Index) + private static void Tile(byte Index) { FileInfo File = new FileInfo(Directories.Tiles.FullName + Index + Directories.Format); diff --git a/Source/Server/Library/Write.cs b/Source/Server/Library/Write.cs index 62a00be7..41f5b729 100644 --- a/Source/Server/Library/Write.cs +++ b/Source/Server/Library/Write.cs @@ -22,6 +22,7 @@ public static void Player(byte Index) { Data.Write(Lists.Player[Index].Character[i].Name); Data.Write(Lists.Player[Index].Character[i].Class); + Data.Write(Lists.Player[Index].Character[i].Texture_Num); Data.Write(Lists.Player[Index].Character[i].Genre); Data.Write(Lists.Player[Index].Character[i].Level); Data.Write(Lists.Player[Index].Character[i].Experience); @@ -30,14 +31,14 @@ public static void Player(byte Index) Data.Write(Lists.Player[Index].Character[i].X); Data.Write(Lists.Player[Index].Character[i].Y); Data.Write((byte)Lists.Player[Index].Character[i].Direction); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Data.Write(Lists.Player[Index].Character[i].Vital[n]); - for (byte n = 0; n < (byte)Game.Attributes.Amount; n++) Data.Write(Lists.Player[Index].Character[i].Attribute[n]); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Data.Write(Lists.Player[Index].Character[i].Vital[n]); + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) Data.Write(Lists.Player[Index].Character[i].Attribute[n]); for (byte n = 1; n <= Game.Max_Inventory; n++) { Data.Write(Lists.Player[Index].Character[i].Inventory[n].Item_Num); Data.Write(Lists.Player[Index].Character[i].Inventory[n].Amount); } - for (byte n = 0; n < (byte)Game.Equipments.Amount; n++) Data.Write(Lists.Player[Index].Character[i].Equipment[n]); + for (byte n = 0; n < (byte)Game.Equipments.Count; n++) Data.Write(Lists.Player[Index].Character[i].Equipment[n]); for (byte n = 1; n <= Game.Max_Hotbar; n++) { Data.Write(Lists.Player[Index].Character[i].Hotbar[n].Type); @@ -72,6 +73,7 @@ public static void Characters(string Characters_Name) // Descarrega o arquivo Data.Dispose(); } + public static void Server_Data() { // Escreve os dados diff --git a/Source/Server/Logic/Game.cs b/Source/Server/Logic/Game.cs index 64587d61..e108899b 100644 --- a/Source/Server/Logic/Game.cs +++ b/Source/Server/Logic/Game.cs @@ -19,14 +19,11 @@ class Game public const byte Min_Name_Length = 3; // Limites em geral - public const byte Max_NPC_Drop = 4; public const byte Max_Inventory = 30; - public const byte Max_Map_Items = 100; public const byte Max_Hotbar = 10; public const byte Min_Map_Width = 24; public const byte Min_Map_Height = 18; - #region Nums public enum Directions { @@ -49,7 +46,7 @@ public enum Vitals { HP, MP, - Amount + Count } public enum Attributes @@ -59,7 +56,7 @@ public enum Attributes Intelligence, Agility, Vitality, - Amount + Count } public enum Messages @@ -90,7 +87,7 @@ public enum Equipments Helmet, Shield, Amulet, - Amount + Count } public enum Hotbar @@ -98,6 +95,14 @@ public enum Hotbar None, Item } + + public enum BindOn + { + None, + Pickup, + Equip, + Count + } #endregion public static void SetHigherIndex() diff --git a/Source/Server/Logic/Loop.cs b/Source/Server/Logic/Loop.cs index 3123396d..67b1ff2e 100644 --- a/Source/Server/Logic/Loop.cs +++ b/Source/Server/Logic/Loop.cs @@ -12,7 +12,7 @@ class Loop public static int Timer_NPC_Regen = 0; public static int Timer_Map_Items = 0; - public static void Main() + public static void Init() { int CPS = 0; diff --git a/Source/Server/Logic/Map.cs b/Source/Server/Logic/Map.cs index e3a2019d..123fe852 100644 --- a/Source/Server/Logic/Map.cs +++ b/Source/Server/Logic/Map.cs @@ -91,10 +91,7 @@ public static byte HasItem(short Map_Num, byte X, byte Y) public static bool OutLimit(short Map_Num, short X, short Y) { // Verifica se as coordenas estão no limite do mapa - if (X > Lists.Map[Map_Num].Width || Y > Lists.Map[Map_Num].Height || X < 0 || Y < 0) - return true; - else - return false; + return X > Lists.Map[Map_Num].Width || Y > Lists.Map[Map_Num].Height || X < 0 || Y < 0; } public static void NextTile(Game.Directions Direction, ref short X, ref short Y) @@ -112,11 +109,8 @@ public static void NextTile(Game.Directions Direction, ref short X, ref short Y) public static bool Tile_Blocked(short Map_Num, short X, short Y) { // Verifica se o azulejo está bloqueado - if (OutLimit(Map_Num, X, Y)) - return true; - else if (Lists.Map[Map_Num].Tile[X, Y].Attribute == (byte)Attributes.Block) - return true; - + if (OutLimit(Map_Num, X, Y)) return true; + if (Lists.Map[Map_Num].Tile[X, Y].Attribute == (byte)Attributes.Block) return true; return false; } @@ -128,15 +122,10 @@ public static bool Tile_Blocked(short Map_Num, short X, short Y, Game.Directions NextTile(Direction, ref Next_X, ref Next_Y); // Verifica se o azulejo está bloqueado - if (Tile_Blocked(Map_Num, (byte)Next_X, (byte)Next_Y)) - return true; - else if (Lists.Map[Map_Num].Tile[Next_X, Next_Y].Block[(byte)Game.ReverseDirection(Direction)]) - return true; - else if (Lists.Map[Map_Num].Tile[X, Y].Block[(byte)Direction]) - return true; - else if (CountEntities && (HasPlayer(Map_Num, Next_X, Next_Y) > 0 || HasNPC(Map_Num, Next_X, Next_Y) > 0)) - return true; - + if (Tile_Blocked(Map_Num, (byte)Next_X, (byte)Next_Y)) return true; + if (Lists.Map[Map_Num].Tile[Next_X, Next_Y].Block[(byte)Game.ReverseDirection(Direction)]) return true; + if (Lists.Map[Map_Num].Tile[X, Y].Block[(byte)Direction]) return true; + if (CountEntities && (HasPlayer(Map_Num, Next_X, Next_Y) > 0 || HasNPC(Map_Num, Next_X, Next_Y) > 0)) return true; return false; } diff --git a/Source/Server/Logic/NPC.cs b/Source/Server/Logic/NPC.cs index 815d9549..fd9944cc 100644 --- a/Source/Server/Logic/NPC.cs +++ b/Source/Server/Logic/NPC.cs @@ -9,7 +9,14 @@ public enum Behaviour AttackWhenAttacked } - public static short Regeneration(short Map_Num, byte Index, byte Vital) + public enum Movements + { + MoveRandomly, + TurnRandomly, + StandStill + } + + private static short Regeneration(short Map_Num, byte Index, byte Vital) { Lists.Structures.NPC Data = Lists.NPC[Lists.Temp_Map[Map_Num].NPC[Index].Index]; @@ -31,18 +38,19 @@ public static void Logic(short Map_Num) Lists.Structures.Map_NPCs Data = Lists.Temp_Map[Map_Num].NPC[i]; Lists.Structures.NPC NPC_Data = Lists.NPC[Lists.Map[Map_Num].NPC[i].Index]; - ////////////////// - // Aparecimento // - ////////////////// + //////////////// + // Surgimento // + //////////////// if (Data.Index == 0) { if (Environment.TickCount > Data.Spawn_Timer + (NPC_Data.SpawnTime * 1000)) Spawn(i, Map_Num); + continue; } else { byte TargetX = 0, TargetY = 0; bool[] CanMove = new bool[(byte)Game.Directions.Count]; - short Distance_X, Distance_Y; + short Distance; bool Moved = false; bool Move = false; @@ -50,7 +58,7 @@ public static void Logic(short Map_Num) // Regeneração // ///////////////// if (Environment.TickCount > Loop.Timer_NPC_Regen + 5000) - for (byte v = 0; v < (byte)Game.Vitals.Amount; v++) + for (byte v = 0; v < (byte)Game.Vitals.Count; v++) if (Data.Vital[v] < NPC_Data.Vital[v]) { // Renera os vitais @@ -64,31 +72,54 @@ public static void Logic(short Map_Num) Send.Map_NPC_Vitals(Map_Num, i); } - /////////////// - // Movimento // - /////////////// + ////////////////// + // Movimentação // + ////////////////// // Atacar ao ver - if (Lists.Temp_Map[Map_Num].NPC[i].Target_Index == 0 && NPC_Data.Behaviour == (byte)Behaviour.AttackOnSight) - for (byte p = 1; p <= Game.HigherIndex; p++) - { - // Verifica se o jogador está jogando e no mesmo mapa que o NPC - if (!Player.IsPlaying(p)) continue; - if (Player.Character(p).Map != Map_Num) continue; - - // Distância entre o NPC e o jogador - Distance_X = (short)(Data.X - Player.Character(p).X); - Distance_Y = (short)(Data.Y - Player.Character(p).Y); - if (Distance_X < 0) Distance_X *= -1; - if (Distance_Y < 0) Distance_Y *= -1; - - // Se estiver no alcance, ir atrás do jogador - if (Distance_X <= NPC_Data.Sight && Distance_Y <= NPC_Data.Sight) + if (NPC_Data.Behaviour == (byte)Behaviour.AttackOnSight) + { + // Jogador + if (Lists.Temp_Map[Map_Num].NPC[i].Target_Index == 0) + for (byte Player_Index = 1; Player_Index <= Game.HigherIndex; Player_Index++) { - Lists.Temp_Map[Map_Num].NPC[i].Target_Type = (byte)Game.Target.Player; - Lists.Temp_Map[Map_Num].NPC[i].Target_Index = p; - Data = Lists.Temp_Map[Map_Num].NPC[i]; + // Verifica se o jogador está jogando e no mesmo mapa que o NPC + if (!Player.IsPlaying(Player_Index)) continue; + if (Player.Character(Player_Index).Map != Map_Num) continue; + + // Se o jogador estiver no alcance do NPC, ir atrás dele + Distance = (short)Math.Sqrt(Math.Pow(Data.X - Player.Character(Player_Index).X, 2) + Math.Pow(Data.Y - Player.Character(Player_Index).Y, 2)); + if (Distance <= NPC_Data.Sight) + { + Lists.Temp_Map[Map_Num].NPC[i].Target_Type = (byte)Game.Target.Player; + Lists.Temp_Map[Map_Num].NPC[i].Target_Index = Player_Index; + Data = Lists.Temp_Map[Map_Num].NPC[i]; + + // Mensagem + if (!string.IsNullOrEmpty(Lists.NPC[Lists.Temp_Map[Map_Num].NPC[i].Index].SayMsg)) Send.Message(Player_Index, Lists.NPC[Lists.Temp_Map[Map_Num].NPC[i].Index].Name + ": " + Lists.NPC[Lists.Temp_Map[Map_Num].NPC[i].Index].SayMsg, System.Drawing.Color.White); + break; + } } - } + + // NPC + if (NPC_Data.AttackNPC && Lists.Temp_Map[Map_Num].NPC[i].Target_Index == 0) + for (byte NPC_Index = 1; NPC_Index < Lists.Temp_Map[Map_Num].NPC.Length; NPC_Index++) + { + // Verifica se pode atacar + if (NPC_Index == i) continue; + if (Lists.Temp_Map[Map_Num].NPC[NPC_Index].Index == 0) continue; + if (IsAlied(Data.Index, Lists.Temp_Map[Map_Num].NPC[NPC_Index].Index)) continue; + + // Se o NPC estiver no alcance do NPC, ir atrás dele + Distance = (short)Math.Sqrt(Math.Pow(Data.X - Lists.Temp_Map[Map_Num].NPC[NPC_Index].X, 2) + Math.Pow(Data.Y - Lists.Temp_Map[Map_Num].NPC[NPC_Index].Y, 2)); + if (Distance <= NPC_Data.Sight) + { + Lists.Temp_Map[Map_Num].NPC[i].Target_Type = (byte)Game.Target.NPC; + Lists.Temp_Map[Map_Num].NPC[i].Target_Index = NPC_Index; + Data = Lists.Temp_Map[Map_Num].NPC[i]; + break; + } + } + } if (Data.Target_Type == (byte)Game.Target.Player) { @@ -99,20 +130,33 @@ public static void Logic(short Map_Num) Lists.Temp_Map[Map_Num].NPC[i].Target_Index = 0; Data = Lists.Temp_Map[Map_Num].NPC[i]; } - // Posição do alvo - TargetX = Player.Character(Lists.Temp_Map[Map_Num].NPC[i].Target_Index).X; - TargetY = Player.Character(Lists.Temp_Map[Map_Num].NPC[i].Target_Index).Y; + else + { + TargetX = Player.Character(Data.Target_Index).X; + TargetY = Player.Character(Data.Target_Index).Y; + } + } + else if (Data.Target_Type == (byte)Game.Target.NPC) + { + // Verifica se o NPC ainda está disponível + if (Lists.Temp_Map[Map_Num].NPC[Data.Target_Index].Index == 0) + { + Lists.Temp_Map[Map_Num].NPC[i].Target_Type = 0; + Lists.Temp_Map[Map_Num].NPC[i].Target_Index = 0; + Data = Lists.Temp_Map[Map_Num].NPC[i]; + } + // Posição do alvo + else + { + TargetX = Lists.Temp_Map[Map_Num].NPC[Data.Target_Index].X; + TargetY = Lists.Temp_Map[Map_Num].NPC[Data.Target_Index].Y; + } } - // Distância entre o NPC e o alvo - Distance_X = (short)(Data.X - TargetX); - Distance_Y = (short)(Data.Y - TargetY); - if (Distance_X < 0) Distance_X *= -1; - if (Distance_Y < 0) Distance_Y *= -1; - - // Verifica se o alvo saiu do alcance - if (Distance_X > NPC_Data.Sight || Distance_Y > NPC_Data.Sight) + // Verifica se o alvo saiu do alcance do NPC + Distance = (short)Math.Sqrt(Math.Pow(Data.X - TargetX, 2) + Math.Pow(Data.Y - TargetY, 2)); + if (Distance > NPC_Data.Sight) { Lists.Temp_Map[Map_Num].NPC[i].Target_Type = 0; Lists.Temp_Map[Map_Num].NPC[i].Target_Index = 0; @@ -124,7 +168,7 @@ public static void Logic(short Map_Num) Move = true; else { - // Define o alvo até a zona do NPC + // Define o alvo a zona do NPC if (Lists.Map[Map_Num].NPC[i].Zone > 0) if (Lists.Map[Map_Num].Tile[Data.X, Data.Y].Zone != Lists.Map[Map_Num].NPC[i].Zone) for (byte x2 = 0; x2 <= Lists.Map[Map_Num].Width; x2++) @@ -139,14 +183,26 @@ public static void Logic(short Map_Num) } } - // Movimenta o NPC até mais perto do alvo + // Movimenta o NPC if (Move) { - // Verifica como pode se mover até o alvo - if (Data.Y > TargetY) CanMove[(byte)Game.Directions.Up] = true; - if (Data.Y < TargetY) CanMove[(byte)Game.Directions.Down] = true; - if (Data.X > TargetX) CanMove[(byte)Game.Directions.Left] = true; - if (Data.X < TargetX) CanMove[(byte)Game.Directions.Right] = true; + // Verifica como o NPC pode se mover + if (NPC_Data.Flee_Helth == 0 || Data.Vital[(byte)Game.Vitals.HP] > NPC_Data.Vital[(byte)Game.Vitals.HP] * (NPC_Data.Flee_Helth / 100.0)) + { + // Para perto do alvo + CanMove[(byte)Game.Directions.Up] = Data.Y > TargetY; + CanMove[(byte)Game.Directions.Down] = Data.Y < TargetY; + CanMove[(byte)Game.Directions.Left] = Data.X > TargetX; + CanMove[(byte)Game.Directions.Right] = Data.X < TargetX; + } + else + { + // Para longe do alvo + CanMove[(byte)Game.Directions.Up] = Data.Y < TargetY; + CanMove[(byte)Game.Directions.Down] = Data.Y > TargetY; + CanMove[(byte)Game.Directions.Left] = Data.X < TargetX; + CanMove[(byte)Game.Directions.Right] = Data.X > TargetX; + } // Aleatoriza a forma que ele vai se movimentar até o alvo if (Game.Random.Next(0, 2) == 0) @@ -164,18 +220,29 @@ public static void Logic(short Map_Num) // Move-se aleatoriamente if (NPC_Data.Behaviour == (byte)Behaviour.Friendly || Data.Target_Index == 0) if (Game.Random.Next(0, 3) == 0 && !Moved) - NPC.Move(Map_Num, i, (Game.Directions)Game.Random.Next(0, 4), 1, true); - } + if (NPC_Data.Movement == Movements.MoveRandomly) + NPC.Move(Map_Num, i, (Game.Directions)Game.Random.Next(0, 4), 1, true); + else if (NPC_Data.Movement == Movements.TurnRandomly) + { + Lists.Temp_Map[Map_Num].NPC[i].Direction = (Game.Directions)Game.Random.Next(0, 4); + Send.Map_NPC_Direction(Map_Num, i); + } - //////////// - // Ataque // - //////////// - short Next_X = Data.X, Next_Y = Data.Y; - Map.NextTile(Data.Direction, ref Next_X, ref Next_Y); - if (Data.Target_Type == (byte)Game.Target.Player) - { - // Verifica se o jogador está na frente do NPC - if (Map.HasPlayer(Map_Num, Next_X, Next_Y) == Data.Target_Index) Attack_Player(Map_Num, i, Data.Target_Index); + //////////// + // Ataque // + //////////// + short Next_X = Data.X, Next_Y = Data.Y; + Map.NextTile(Data.Direction, ref Next_X, ref Next_Y); + if (Data.Target_Type == (byte)Game.Target.Player) + { + // Verifica se o jogador está na frente do NPC + if (Map.HasPlayer(Map_Num, Next_X, Next_Y) == Data.Target_Index) Attack_Player(Map_Num, i, Data.Target_Index); + } + else if (Data.Target_Type == (byte)Game.Target.NPC) + { + // Verifica se o NPC alvo está na frente do NPC + if (Map.HasNPC(Map_Num, Next_X, Next_Y) == Data.Target_Index) Attack_NPC(Map_Num, i, Data.Target_Index); + } } } } @@ -213,7 +280,7 @@ public static void Spawn(byte Index, short Map_Num) // Em último caso, tentar no primeiro lugar possível for (byte x2 = 0; x2 <= Lists.Map[Map_Num].Width; x2++) for (byte y2 = 0; y2 <= Lists.Map[Map_Num].Height; y2++) - if (!global::Map.Tile_Blocked(Map_Num, x2, y2)) + if (!Map.Tile_Blocked(Map_Num, x2, y2)) { // Verifica se está dentro da zona if (Lists.Map[Map_Num].NPC[Index].Zone > 0) @@ -226,23 +293,26 @@ public static void Spawn(byte Index, short Map_Num) } } - public static void Spawn(byte Index, short Map_Num, byte x, byte y, Game.Directions Direction = 0) + private static void Spawn(byte Index, short Map_Num, byte x, byte y, Game.Directions Direction = 0) { - Lists.Structures.NPC Data = Lists.NPC[Lists.Map[Map_Num].NPC[Index].Index]; + short NPC_Index = Lists.Map[Map_Num].NPC[Index].Index; + + // Previne erros + if (NPC_Index >= Lists.NPC.Length) return; // Define os dados - Lists.Temp_Map[Map_Num].NPC[Index].Index = Lists.Map[Map_Num].NPC[Index].Index; + Lists.Temp_Map[Map_Num].NPC[Index].Index = NPC_Index; Lists.Temp_Map[Map_Num].NPC[Index].X = x; Lists.Temp_Map[Map_Num].NPC[Index].Y = y; Lists.Temp_Map[Map_Num].NPC[Index].Direction = Direction; - Lists.Temp_Map[Map_Num].NPC[Index].Vital = new short[(byte)Game.Vitals.Amount]; - for (byte i = 0; i < (byte)Game.Vitals.Amount; i++) Lists.Temp_Map[Map_Num].NPC[Index].Vital[i] = Data.Vital[i]; + Lists.Temp_Map[Map_Num].NPC[Index].Vital = new short[(byte)Game.Vitals.Count]; + for (byte i = 0; i < (byte)Game.Vitals.Count; i++) Lists.Temp_Map[Map_Num].NPC[Index].Vital[i] = Lists.NPC[NPC_Index].Vital[i]; // Envia os dados aos jogadores if (Socket.Device != null) Send.Map_NPC(Map_Num, Index); } - public static bool Move(short Map_Num, byte Index, Game.Directions Direction, byte Movement = 1, bool CountZone = false) + private static bool Move(short Map_Num, byte Index, Game.Directions Direction, byte Movement = 1, bool CheckZone = false) { Lists.Structures.Map_NPCs Data = Lists.Temp_Map[Map_Num].NPC[Index]; byte x = Data.X, y = Data.Y; @@ -260,7 +330,7 @@ public static bool Move(short Map_Num, byte Index, Game.Directions Direction, by if (Map.Tile_Blocked(Map_Num, x, y, Direction)) return false; // Verifica se está dentro da zona - if (CountZone) + if (CheckZone) if (Lists.Map[Map_Num].Tile[Next_X, Next_Y].Zone != Lists.Map[Map_Num].NPC[Index].Zone) return false; @@ -271,7 +341,7 @@ public static bool Move(short Map_Num, byte Index, Game.Directions Direction, by return true; } - public static void Attack_Player(short Map_Num, byte Index, byte Victim) + private static void Attack_Player(short Map_Num, byte Index, byte Victim) { Lists.Structures.Map_NPCs Data = Lists.Temp_Map[Map_Num].NPC[Index]; short x = Data.X, y = Data.Y; @@ -283,7 +353,7 @@ public static void Attack_Player(short Map_Num, byte Index, byte Victim) if (Data.Index == 0) return; if (Environment.TickCount < Data.Attack_Timer + 750) return; if (!Player.IsPlaying(Victim)) return; - if (Lists.TempPlayer[Victim].GettingMap) return; + if (Lists.Temp_Player[Victim].GettingMap) return; if (Map_Num != Player.Character(Victim).Map) return; if (Player.Character(Victim).X != x || Player.Character(Victim).Y != y) return; if (Map.Tile_Blocked(Map_Num, Data.X, Data.Y, Data.Direction, false)) return; @@ -291,14 +361,15 @@ public static void Attack_Player(short Map_Num, byte Index, byte Victim) // Tempo de ataque Lists.Temp_Map[Map_Num].NPC[Index].Attack_Timer = Environment.TickCount; - // Demonstra o ataque aos outros jogadores - Send.Map_NPC_Attack(Map_Num, Index, Victim, (byte)Game.Target.Player); - // Cálculo de dano short Damage = (short)(Lists.NPC[Data.Index].Attribute[(byte)Game.Attributes.Strength] - Player.Character(Victim).Player_Defense); // Dano não fatal if (Damage > 0) + { + // Demonstra o ataque aos outros jogadores + Send.Map_NPC_Attack(Map_Num, Index, Victim, (byte)Game.Target.Player); + if (Damage < Player.Character(Victim).Vital[(byte)Game.Vitals.HP]) { Player.Character(Victim).Vital[(byte)Game.Vitals.HP] -= Damage; @@ -314,6 +385,62 @@ public static void Attack_Player(short Map_Num, byte Index, byte Victim) // Mata o jogador Player.Died(Victim); } + } + // Demonstra o ataque aos outros jogadores + else + Send.Map_NPC_Attack(Map_Num, Index); + } + + private static void Attack_NPC(short Map_Num, byte Index, byte Victim) + { + Lists.Structures.Map_NPCs Data = Lists.Temp_Map[Map_Num].NPC[Index], Victim_Data = Lists.Temp_Map[Map_Num].NPC[Victim]; + short x = Data.X, y = Data.Y; + + // Define o azujelo a frente do NPC + Map.NextTile(Data.Direction, ref x, ref y); + + // Verifica se a vítima pode ser atacada + if (Data.Index == 0) return; + if (Victim_Data.Index == 0) return; + if (Environment.TickCount < Data.Attack_Timer + 750) return; + if (Victim_Data.X != x || Victim_Data.Y != y) return; + if (Map.Tile_Blocked(Map_Num, Data.X, Data.Y, Data.Direction, false)) return; + + // Tempo de ataque + Lists.Temp_Map[Map_Num].NPC[Index].Attack_Timer = Environment.TickCount; + + // Define o alvo do NPC + Lists.Temp_Map[Map_Num].NPC[Victim].Target_Index = Index; + Lists.Temp_Map[Map_Num].NPC[Victim].Target_Type = (byte)Game.Target.NPC; + + // Cálculo de dano + short Damage = (short)(Lists.NPC[Data.Index].Attribute[(byte)Game.Attributes.Strength] - Lists.NPC[Victim_Data.Index].Attribute[(byte)Game.Attributes.Resistance]); + + // Dano não fatal + if (Damage > 0) + { + // Demonstra o ataque aos outros jogadores + Send.Map_NPC_Attack(Map_Num, Index, Victim, (byte)Game.Target.NPC); + + if (Damage < Victim_Data.Vital[(byte)Game.Vitals.HP]) + { + Lists.Temp_Map[Map_Num].NPC[Victim].Vital[(byte)Game.Vitals.HP] -= Damage; + Send.Map_NPC_Vitals(Map_Num, Victim); + } + // FATALITY + else + { + // Reseta o alvo do NPC + Lists.Temp_Map[Map_Num].NPC[Index].Target_Type = 0; + Lists.Temp_Map[Map_Num].NPC[Index].Target_Index = 0; + + // Mata o NPC + Died(Map_Num, Victim); + } + } + // Demonstra o ataque aos outros jogadores + else + Send.Map_NPC_Attack(Map_Num, Index); } public static void Died(short Map_Num, byte Index) @@ -321,7 +448,7 @@ public static void Died(short Map_Num, byte Index) Lists.Structures.NPC NPC = Lists.NPC[Lists.Temp_Map[Map_Num].NPC[Index].Index]; // Solta os itens - for (byte i = 0; i < Game.Max_NPC_Drop; i++) + for (byte i = 0; i < NPC.Drop.Length; i++) if (NPC.Drop[i].Item_Num > 0) if (Game.Random.Next(NPC.Drop[i].Chance, 101) == 100) { @@ -347,4 +474,13 @@ public static void Died(short Map_Num, byte Index) Lists.Temp_Map[Map_Num].NPC[Index].Target_Index = 0; Send.Map_NPC_Died(Map_Num, Index); } + + public static bool IsAlied(short Index, short Allie) + { + // Verifica se o NPC é aliado do outro + for (byte i = 0; i < Lists.NPC[Index].Allie.Length; i++) + if (Lists.NPC[Index].Allie[i] == Allie) + return true; + return false; + } } \ No newline at end of file diff --git a/Source/Server/Logic/Player.cs b/Source/Server/Logic/Player.cs index 6ee8e3fd..0de9ba75 100644 --- a/Source/Server/Logic/Player.cs +++ b/Source/Server/Logic/Player.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Drawing; class Player @@ -6,7 +7,7 @@ class Player public static Character_Structure Character(byte Index) { // Retorna com os valores do personagem atual - return Lists.Player[Index].Character[Lists.TempPlayer[Index].Using]; + return Lists.Player[Index].Character[Lists.Temp_Player[Index].Using]; } public class Character_Structure @@ -15,12 +16,13 @@ public class Character_Structure public byte Index; public string Name = string.Empty; public byte Class; + public short Texture_Num; public bool Genre; public short Level; - private short experience; + public int Experience; public byte Points; - public short[] Vital = new short[(byte)Game.Vitals.Amount]; - public short[] Attribute = new short[(byte)Game.Attributes.Amount]; + public short[] Vital = new short[(byte)Game.Vitals.Count]; + public short[] Attribute = new short[(byte)Game.Attributes.Count]; public short Map; public byte X; public byte Y; @@ -29,18 +31,19 @@ public class Character_Structure public Lists.Structures.Inventories[] Inventory; public short[] Equipment; public Lists.Structures.Hotbar[] Hotbar; + public List Party; - public short Experience + public void GiveExperience(int Value) { - get - { - return experience; - } - set - { - experience = value; - CheckLevelUp(Index); - } + // Dá a experiência ao jogador, caso ele estiver em um grupo divide a experiência entre os membros + if (Party.Count > 0 && Value > 0) Party_SplitXP(Index, Value); + else Experience += Value; + + // Verifica se a experiência não ficou negtiva + if (Character(Index).Experience < 0) Character(Index).Experience = 0; + + // Verifica se passou de level + CheckLevelUp(Index); } // Cálcula o dano do jogador @@ -93,14 +96,14 @@ public short Regeneration(byte Vital) return 0; } - public short ExpNeeded + public int ExpNeeded { get { short Total = 0; - // Amount de experiência para passar para o próximo level - for (byte i = 0; i <= (byte)(Game.Attributes.Amount - 1); i++) Total += Attribute[i]; - return (short)((Level + 1) * 2.5 + (Total + Points) / 2); + // Quantidade de experiência para passar para o próximo level + for (byte i = 0; i < (byte)Game.Attributes.Count; i++) Total += Attribute[i]; + return (int)((Level + 1) * 2.5 + (Total + Points) / 2); } } } @@ -108,11 +111,10 @@ public short ExpNeeded public static void Join(byte Index) { // Previne que alguém que já está online de logar - if (IsPlaying(Index)) - return; + if (IsPlaying(Index)) return; // Define que o jogador está dentro do jogo - Lists.TempPlayer[Index].Playing = true; + Lists.Temp_Player[Index].Playing = true; // Envia todos os dados necessários Send.Join(Index); @@ -134,22 +136,26 @@ public static void Join(byte Index) public static void Leave(byte Index) { - // Limpa os dados do jogador - Clear.Player(Index); + // Sai do grupo + if (Lists.Temp_Player[Index].Playing) + Party_Leave(Index); // Salva os dados do e envia atualiza os demais jogadores da desconexão - if (!Lists.TempPlayer[Index].InEditor) + if (!Lists.Temp_Player[Index].InEditor) { Write.Player(Index); Send.Player_Leave(Index); } + + // Limpa os dados do jogador + Clear.Player(Index); } public static bool IsPlaying(byte Index) { // Verifica se o jogador está dentro do jogo if (Socket.IsConnected(Index)) - if (Lists.TempPlayer[Index].Playing) + if (Lists.Temp_Player[Index].Playing) return true; return false; @@ -207,7 +213,7 @@ public static bool MultipleAccounts(string User) return false; } - public static void Move(byte Index, byte Movimento) + public static void Move(byte Index, byte Movement) { byte x = Character(Index).X, y = Character(Index).Y; short Map_Num = Character(Index).Map; @@ -216,8 +222,8 @@ public static void Move(byte Index, byte Movimento) bool SecondMovement = false; // Previne erros - if (Movimento < 1 || Movimento > 2) return; - if (Lists.TempPlayer[Index].GettingMap) return; + if (Movement < 1 || Movement > 2) return; + if (Lists.Temp_Player[Index].GettingMap) return; // Próximo azulejo Map.NextTile(Character(Index).Direction, ref Next_X, ref Next_Y); @@ -228,10 +234,10 @@ public static void Move(byte Index, byte Movimento) if (Link > 0) switch (Character(Index).Direction) { - case Game.Directions.Up: Warp(Index, Link, x, Lists.Map[Map_Num].Height); break; - case Game.Directions.Down: Warp(Index, Link, x, 0); break; - case Game.Directions.Right: Warp(Index, Link, 0, y); break; - case Game.Directions.Left: Warp(Index, Link, Lists.Map[Map_Num].Width, y); break; + case Game.Directions.Up: Warp(Index, Link, x, Lists.Map[Map_Num].Height); return; + case Game.Directions.Down: Warp(Index, Link, x, 0); return; + case Game.Directions.Right: Warp(Index, Link, 0, y); return; + case Game.Directions.Left: Warp(Index, Link, Lists.Map[Map_Num].Width, y); return; } else { @@ -261,12 +267,12 @@ public static void Move(byte Index, byte Movimento) // Envia os dados if (!SecondMovement && (x != Character(Index).X || y != Character(Index).Y)) - Send.Player_Move(Index, Movimento); + Send.Player_Move(Index, Movement); else Send.Player_Position(Index); } - public static void Warp(byte Index, short Map, byte x, byte y) + private static void Warp(byte Index, short Map, byte x, byte y) { short Map_Old = Character(Index).Map; @@ -292,7 +298,7 @@ public static void Warp(byte Index, short Map, byte x, byte y) Send.Player_Position(Index); // Atualiza os valores - Lists.TempPlayer[Index].GettingMap = true; + Lists.Temp_Player[Index].GettingMap = true; // Verifica se será necessário enviar os dados do mapa para o jogador Send.Map_Revision(Index, Map); @@ -332,7 +338,7 @@ public static void Attack(byte Index) Character(Index).Attack_Timer = Environment.TickCount; } - public static void Attack_Player(byte Index, byte Victim) + private static void Attack_Player(byte Index, byte Victim) { short Damage; short x = Character(Index).X, y = Character(Index).Y; @@ -342,18 +348,15 @@ public static void Attack_Player(byte Index, byte Victim) // Verifica se a vítima pode ser atacada if (!IsPlaying(Victim)) return; - if (Lists.TempPlayer[Victim].GettingMap) return; + if (Lists.Temp_Player[Victim].GettingMap) return; if (Character(Index).Map != Character(Victim).Map) return; if (Character(Victim).X != x || Character(Victim).Y != y) return; if (Lists.Map[Character(Index).Map].Moral == (byte)Map.Morals.Pacific) { - Send.Message(Index, "This is a peaceful area..", Color.White); + Send.Message(Index, "This is a peaceful area.", Color.White); return; } - // Demonstra o ataque aos outros jogadores - Send.Player_Attack(Index, Victim, (byte)Game.Target.Player); - // Tempo de ataque Character(Index).Attack_Timer = Environment.TickCount; @@ -362,7 +365,11 @@ public static void Attack_Player(byte Index, byte Victim) // Dano não fatal if (Damage > 0) - if (Damage <= Character(Victim).MaxVital((byte)Game.Vitals.HP)) + { + // Demonstra o ataque aos outros jogadores + Send.Player_Attack(Index, Victim, (byte)Game.Target.Player); + + if (Damage < Character(Victim).MaxVital((byte)Game.Vitals.HP)) { Character(Victim).Vital[(byte)Game.Vitals.HP] -= Damage; Send.Player_Vitals(Victim); @@ -371,42 +378,54 @@ public static void Attack_Player(byte Index, byte Victim) else { // Dá 10% da experiência da vítima ao atacante - Character(Index).Experience += (short)(Character(Victim).Experience / 10); + Character(Index).GiveExperience(Character(Victim).Experience / 10); // Mata a vítima Died(Victim); } + } + else + // Demonstra o ataque aos outros jogadores + Send.Player_Attack(Index); } - public static void Attack_NPC(byte Index, byte Victim) + private static void Attack_NPC(byte Index, byte Victim) { short Damage; short x = Character(Index).X, y = Character(Index).Y; - Lists.Structures.Map_NPCs NPC = Lists.Temp_Map[Character(Index).Map].NPC[Victim]; + Lists.Structures.Map_NPCs Map_NPC = Lists.Temp_Map[Character(Index).Map].NPC[Victim]; // Define o azujelo a frente do jogador Map.NextTile(Character(Index).Direction, ref x, ref y); // Verifica se a vítima pode ser atacada - if (NPC.X != x || NPC.Y != y) return; - if (Lists.NPC[NPC.Index].Behaviour == (byte)global::NPC.Behaviour.Friendly) return; + if (Map_NPC.X != x || Map_NPC.Y != y) return; + + // Mensagem + if (Map_NPC.Target_Index != Index && !string.IsNullOrEmpty(Lists.NPC[Map_NPC.Index].SayMsg)) Send.Message(Index, Lists.NPC[Map_NPC.Index].Name + ": " + Lists.NPC[Map_NPC.Index].SayMsg, Color.White); + + // Não executa o combate com um NPC amigavel + if (Lists.NPC[Map_NPC.Index].Behaviour == (byte)global::NPC.Behaviour.Friendly) return; // Define o alvo do NPC Lists.Temp_Map[Character(Index).Map].NPC[Victim].Target_Index = Index; Lists.Temp_Map[Character(Index).Map].NPC[Victim].Target_Type = (byte)Game.Target.Player; - // Demonstra o ataque aos outros jogadores - Send.Player_Attack(Index, Victim, (byte)Game.Target.NPC); - // Tempo de ataque Character(Index).Attack_Timer = Environment.TickCount; // Cálculo de dano - Damage = (short)(Character(Index).Damage - Lists.NPC[NPC.Index].Attribute[(byte)Game.Attributes.Resistance]); + Damage = (short)(Character(Index).Damage - Lists.NPC[Map_NPC.Index].Attribute[(byte)Game.Attributes.Resistance]); + + // Demonstra o ataque aos outros jogadores // Dano não fatal if (Damage > 0) - if (Damage < Lists.Temp_Map[Character(Index).Map].NPC[Victim].Vital[(byte)Game.Vitals.HP]) + { + // Demonstra o ataque aos outros jogadores + Send.Player_Attack(Index, Victim, (byte)Game.Target.NPC); + + if (Damage < Map_NPC.Vital[(byte)Game.Vitals.HP]) { Lists.Temp_Map[Character(Index).Map].NPC[Victim].Vital[(byte)Game.Vitals.HP] -= Damage; Send.Map_NPC_Vitals(Character(Index).Map, Victim); @@ -415,11 +434,15 @@ public static void Attack_NPC(byte Index, byte Victim) else { // Experiência ganhada - Character(Index).Experience += Lists.NPC[NPC.Index].Experience; + Character(Index).GiveExperience(Lists.NPC[Map_NPC.Index].Experience); // Reseta os dados do NPC - global::NPC.Died(Character(Index).Map, Victim); + NPC.Died(Character(Index).Map, Victim); } + } + else + // Demonstra o ataque aos outros jogadores + Send.Player_Attack(Index); } public static void Died(byte Index) @@ -427,7 +450,7 @@ public static void Died(byte Index) Lists.Structures.Class Data = Lists.Class[Character(Index).Class]; // Recupera os vitais - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Character(Index).Vital[n] = Character(Index).MaxVital(n); // Perde 10% da experiência @@ -451,7 +474,7 @@ public static void Logic() // Reneração // /////////////// if (Environment.TickCount > Loop.Timer_Player_Regen + 5000) - for (byte v = 0; v < (byte)Game.Vitals.Amount; v++) + for (byte v = 0; v < (byte)Game.Vitals.Count; v++) if (Character(i).Vital[v] < Character(i).MaxVital(v)) { // Renera a vida do jogador @@ -467,9 +490,9 @@ public static void Logic() if (Environment.TickCount > Loop.Timer_Player_Regen + 5000) Loop.Timer_Player_Regen = Environment.TickCount; } - public static void CheckLevelUp(byte Index) + private static void CheckLevelUp(byte Index) { - byte NumLevel = 0; short ExpRest; + byte NumLevel = 0; int ExpRest; // Previne erros if (!IsPlaying(Index)) return; @@ -477,7 +500,7 @@ public static void CheckLevelUp(byte Index) while (Character(Index).Experience >= Character(Index).ExpNeeded) { NumLevel += 1; - ExpRest = (short)(Character(Index).Experience - Character(Index).ExpNeeded); + ExpRest = Character(Index).Experience - Character(Index).ExpNeeded; // Define os dados Character(Index).Level += 1; @@ -515,27 +538,30 @@ public static bool GiveItem(byte Index, short Item_Num, short Amount) return true; } - public static void DropItem(byte Index, byte Slot) + public static void DropItem(byte Index, byte Slot, short Amount) { short Map_Num = Character(Index).Map; Lists.Structures.Map_Items Map_Item = new Lists.Structures.Map_Items(); // Somente se necessário - if (Lists.Temp_Map[Map_Num].Item.Count == Game.Max_Map_Items) return; + if (Lists.Temp_Map[Map_Num].Item.Count == Lists.Server_Data.Max_Map_Items) return; if (Character(Index).Inventory[Slot].Item_Num == 0) return; - if (Lists.Item[Character(Index).Inventory[Slot].Item_Num].Bind) return; + if (Lists.Item[Character(Index).Inventory[Slot].Item_Num].Bind == (byte)Game.BindOn.Pickup) return; + + // Verifica se não está dropando mais do que tem + if (Amount > Character(Index).Inventory[Slot].Amount) Amount = Character(Index).Inventory[Slot].Amount; // Solta o item no chão Map_Item.Index = Character(Index).Inventory[Slot].Item_Num; - Map_Item.Amount = Character(Index).Inventory[Slot].Amount; + Map_Item.Amount = Amount; Map_Item.X = Character(Index).X; Map_Item.Y = Character(Index).Y; Lists.Temp_Map[Map_Num].Item.Add(Map_Item); Send.Map_Items(Map_Num); // Retira o item do inventário do jogador - Character(Index).Inventory[Slot].Item_Num = 0; - Character(Index).Inventory[Slot].Amount = 0; + if (Amount == Character(Index).Inventory[Slot].Amount) Character(Index).Inventory[Slot].Item_Num = 0; + Character(Index).Inventory[Slot].Amount = (short)(Character(Index).Inventory[Slot].Amount - Amount); Send.Player_Inventory(Index); } @@ -575,7 +601,7 @@ public static void UseItem(byte Index, byte Slot) // Equipa o item Character(Index).Equipment[Lists.Item[Item_Num].Equip_Type] = Item_Num; - for (byte i = 0; i < (byte)Game.Attributes.Amount; i++) Character(Index).Attribute[i] += Lists.Item[Item_Num].Equip_Attribute[i]; + for (byte i = 0; i < (byte)Game.Attributes.Count; i++) Character(Index).Attribute[i] += Lists.Item[Item_Num].Equip_Attribute[i]; // Envia os dados Send.Player_Inventory(Index); @@ -586,9 +612,8 @@ public static void UseItem(byte Index, byte Slot) { // Efeitos bool HadEffect = false; - Character(Index).Experience += Lists.Item[Item_Num].Potion_Experience; - if (Character(Index).Experience < 0) Character(Index).Experience = 0; - for (byte i = 0; i < (byte)Game.Vitals.Amount; i++) + Character(Index).GiveExperience(Lists.Item[Item_Num].Potion_Experience); + for (byte i = 0; i < (byte)Game.Vitals.Count; i++) { // Verifica se o item causou algum efeito if (Character(Index).Vital[i] < Character(Index).MaxVital(i) && Lists.Item[Item_Num].Potion_Vital[i] != 0) HadEffect = true; @@ -634,4 +659,59 @@ public static byte FindInventory(byte Index, short Item_Num) return 0; } + + public static void Party_Leave(byte Index) + { + // Retira o jogador do grupo + for (byte i = 0; i < Character(Index).Party.Count; i++) + Character(Character(Index).Party[i]).Party.Remove(Index); + + // Envia o dados para todos os membros do grupo + for (byte i = 0; i < Character(Index).Party.Count; i++) Send.Party(Character(Index).Party[i]); + Character(Index).Party.Clear(); + Send.Party(Index); + } + + private static void Party_SplitXP(byte Index, int Experience) + { + // Somatório do level de todos os jogadores do grupo + int Given_Experience, Experience_Sum = 0, Difference; + double[] Diff = new double[Character(Index).Party.Count]; + double Diff_Sum = 0, k; + + // Cálcula a diferença dos leveis entre os jogadores + for (byte i = 0; i < Character(Index).Party.Count; i++) + { + Difference = Math.Abs(Character(Index).Level - Character(Character(Index).Party[i]).Level); + + // Constante para a diminuir potêncialmente a experiência que diferenças altas ganhariam + if (Difference < 3) k = 1.15; + else if (Difference < 6) k = 1.55; + else if (Difference < 10) k = 1.85; + else k = 2.3; + + // Transforma o valor em fração + Diff[i] = 1 / Math.Pow(k, Math.Min(15, Difference)); + Diff_Sum += Diff[i]; + } + + // Divide a experiência pro grupo com base na diferença dos leveis + for (byte i = 0; i < Character(Index).Party.Count; i++) + { + // Caso a somatório for maior que um (100%) balanceia os valores + if (Diff_Sum > 1) Diff[i] *= (1 / Diff_Sum); + + // Divide a experiência + Given_Experience = (int)((Experience / 2) * Diff[i]); + Experience_Sum += Given_Experience; + Character(Character(Index).Party[i]).Experience+= Given_Experience; + CheckLevelUp(Character(Index).Party[i]); + Send.Player_Experience(Character(Index).Party[i]); + } + + // Dá ao jogador principal o restante da experiência + Character(Index).Experience += Experience - Experience_Sum; + CheckLevelUp(Index); + Send.Player_Experience(Index); + } } \ No newline at end of file diff --git a/Source/Server/Network/Receive.cs b/Source/Server/Network/Receive.cs index e1e89d09..4c20210b 100644 --- a/Source/Server/Network/Receive.cs +++ b/Source/Server/Network/Receive.cs @@ -4,7 +4,7 @@ class Receive { // Pacotes do cliente - public enum Client_Packets + private enum Client_Packets { Connect, Latency, @@ -26,11 +26,15 @@ public enum Client_Packets Equipment_Remove, Hotbar_Add, Hotbar_Change, - Hotbar_Use + Hotbar_Use, + Party_Invite, + Party_Leave, + Party_Decline, + Party_Accept } // Pacotes do editor - public enum Editor_Packets + private enum Editor_Packets { Connect, Write_Server_Data, @@ -54,7 +58,7 @@ public static void Handle(byte Index, NetIncomingMessage Data) // Pacote principal de conexão if (Packet_Num == 0) Connect(Index, Data); - else if (!Lists.TempPlayer[Index].InEditor) + else if (!Lists.Temp_Player[Index].InEditor) // Manuseia os dados recebidos do cliente switch ((Client_Packets)Packet_Num) { @@ -78,6 +82,10 @@ public static void Handle(byte Index, NetIncomingMessage Data) case Client_Packets.Hotbar_Add: Hotbar_Add(Index, Data); break; case Client_Packets.Hotbar_Change: Hotbar_Change(Index, Data); break; case Client_Packets.Hotbar_Use: Hotbar_Use(Index, Data); break; + case Client_Packets.Party_Invite: Party_Invite(Index, Data); break; + case Client_Packets.Party_Accept: Party_Accept(Index); break; + case Client_Packets.Party_Decline: Party_Decline(Index); break; + case Client_Packets.Party_Leave: Party_Leave(Index); break; } else // Manuseia os dados recebidos do editor @@ -90,12 +98,12 @@ public static void Handle(byte Index, NetIncomingMessage Data) case Editor_Packets.Write_NPCs: Write_NPCs(Index, Data); break; case Editor_Packets.Write_Items: Write_Items(Index, Data); break; case Editor_Packets.Request_Server_Data: Request_Server_Data(Index, Data); break; - case Editor_Packets.Request_Classes: Request_Classes(Index, Data); break; - case Editor_Packets.Request_Tiles: Request_Tiles(Index, Data); break; + case Editor_Packets.Request_Classes: Request_Classes(Index); break; + case Editor_Packets.Request_Tiles: Request_Tiles(Index); break; case Editor_Packets.Request_Map: Request_Map(Index, Data); break; case Editor_Packets.Request_Maps: Request_Maps(Index, Data); break; - case Editor_Packets.Request_NPCs: Request_NPCs(Index, Data); break; - case Editor_Packets.Request_Items: Request_Items(Index, Data); break; + case Editor_Packets.Request_NPCs: Request_NPCs(Index); break; + case Editor_Packets.Request_Items: Request_Items(Index); break; } } @@ -143,7 +151,7 @@ private static void Connect(byte Index, NetIncomingMessage Data) } // Abre a janela de edição - Lists.TempPlayer[Index].InEditor = true; + Lists.Temp_Player[Index].InEditor = true; Send.Connect(Index); } else @@ -222,19 +230,27 @@ private static void CreateCharacter(byte Index, NetIncomingMessage Data) } // Define o personagem que será usado - Lists.TempPlayer[Index].Using = Character; + Lists.Temp_Player[Index].Using = Character; // Define os valores iniciais do personagem Player.Character(Index).Name = Name; Player.Character(Index).Level = 1; Player.Character(Index).Class = Data.ReadByte(); + Lists.Structures.Class Class = Lists.Class[Player.Character(Index).Class]; Player.Character(Index).Genre = Data.ReadBoolean(); - Player.Character(Index).Attribute = Lists.Class[Player.Character(Index).Class].Attribute; - Player.Character(Index).Map = Lists.Class[Player.Character(Index).Class].Spawn_Map; - Player.Character(Index).Direction = (Game.Directions)Lists.Class[Player.Character(Index).Class].Spawn_Direction; - Player.Character(Index).X = Lists.Class[Player.Character(Index).Class].Spawn_X; - Player.Character(Index).Y = Lists.Class[Player.Character(Index).Class].Spawn_Y; - for (byte i = 0; i < (byte)Game.Vitals.Amount; i++) Player.Character(Index).Vital[i] = Player.Character(Index).MaxVital(i); + if (Player.Character(Index).Genre) Player.Character(Index).Texture_Num = Class.Tex_Male[Data.ReadByte()]; + else Player.Character(Index).Texture_Num = Class.Tex_Female[Data.ReadByte()]; + Player.Character(Index).Attribute = Class.Attribute; + Player.Character(Index).Map = Class.Spawn_Map; + Player.Character(Index).Direction = (Game.Directions)Class.Spawn_Direction; + Player.Character(Index).X = Class.Spawn_X; + Player.Character(Index).Y = Class.Spawn_Y; + for (byte i = 0; i < (byte)Game.Vitals.Count; i++) Player.Character(Index).Vital[i] = Player.Character(Index).MaxVital(i); + for (byte i = 0; i < (byte)Class.Item.Length; i++) + if (Lists.Item[Class.Item[i].Item1].Type == (byte)Game.Items.Equipment && Player.Character(Index).Equipment[Lists.Item[Class.Item[i].Item1].Equip_Type] == 0) + Player.Character(Index).Equipment[Lists.Item[Class.Item[i].Item1].Equip_Type] = Class.Item[i].Item1; + else + Player.GiveItem(Index, Class.Item[i].Item1, Class.Item[i].Item2); // Salva a conta Write.Character(Name); @@ -247,7 +263,7 @@ private static void CreateCharacter(byte Index, NetIncomingMessage Data) private static void Character_Use(byte Index, NetIncomingMessage Data) { // Define o personagem que será usado - Lists.TempPlayer[Index].Using = Data.ReadByte(); + Lists.Temp_Player[Index].Using = Data.ReadByte(); // Entra no jogo Player.Join(Index); @@ -291,7 +307,7 @@ private static void Player_Direction(byte Index, NetIncomingMessage Data) // Previne erros if (Direction < Game.Directions.Up || Direction > Game.Directions.Right) return; - if (Lists.TempPlayer[Index].GettingMap) return; + if (Lists.Temp_Player[Index].GettingMap) return; // Defini a direção do jogador Player.Character(Index).Direction = Direction; @@ -318,7 +334,7 @@ private static void RequestMap(byte Index, NetIncomingMessage Data) Send.Map_Players(Index); // Entra no mapa - Lists.TempPlayer[Index].GettingMap = false; + Lists.Temp_Player[Index].GettingMap = false; Send.JoinMap(Index); } @@ -380,37 +396,22 @@ private static void CollectItem(byte Index) private static void DropItem(byte Index, NetIncomingMessage Data) { - Player.DropItem(Index, Data.ReadByte()); + Player.DropItem(Index, Data.ReadByte(), Data.ReadInt16()); } private static void Inventory_Change(byte Index, NetIncomingMessage Data) { byte Slot_Old = Data.ReadByte(), Slot_New = Data.ReadByte(); - byte Hotbar_Old = Player.FindHotbar(Index, (byte)Game.Hotbar.Item, Slot_Old), Hotbar_New = Player.FindHotbar(Index, (byte)Game.Hotbar.Item, Slot_New); - Lists.Structures.Inventories Old = Player.Character(Index).Inventory[Slot_Old]; + byte Hotbar_Slot = Player.FindHotbar(Index, (byte)Game.Hotbar.Item, Slot_Old); // Somente se necessário if (Player.Character(Index).Inventory[Slot_Old].Item_Num == 0) return; if (Slot_Old == Slot_New) return; - // Caso houver um item no novo slot, trocar ele para o velho - if (Player.Character(Index).Inventory[Slot_New].Item_Num > 0) - { - // Inventário - Player.Character(Index).Inventory[Slot_Old].Item_Num = Player.Character(Index).Inventory[Slot_New].Item_Num; - Player.Character(Index).Inventory[Slot_Old].Amount = Player.Character(Index).Inventory[Slot_New].Amount; - Player.Character(Index).Hotbar[Hotbar_New].Slot = Slot_Old; - } - else - { - Player.Character(Index).Inventory[Slot_Old].Item_Num = 0; - Player.Character(Index).Inventory[Slot_Old].Amount = 0; - } - // Muda o item de slot - Player.Character(Index).Inventory[Slot_New].Item_Num = Old.Item_Num; - Player.Character(Index).Inventory[Slot_New].Amount = Old.Amount; - Player.Character(Index).Hotbar[Hotbar_Old].Slot = Slot_New; + (Player.Character(Index).Inventory[Slot_Old].Item_Num, Player.Character(Index).Inventory[Slot_New].Item_Num) = (Player.Character(Index).Inventory[Slot_New].Item_Num, Player.Character(Index).Inventory[Slot_Old].Item_Num); + (Player.Character(Index).Inventory[Slot_Old].Amount, Player.Character(Index).Inventory[Slot_New].Amount) = (Player.Character(Index).Inventory[Slot_New].Amount, Player.Character(Index).Inventory[Slot_Old].Amount); + Player.Character(Index).Hotbar[Hotbar_Slot].Slot = Slot_New; Send.Player_Inventory(Index); Send.Player_Hotbar(Index); } @@ -428,12 +429,13 @@ private static void Equipment_Remove(byte Index, NetIncomingMessage Data) // Apenas se necessário if (Player.Character(Index).Equipment[Slot] == 0) return; + if (Lists.Item[Player.Character(Index).Equipment[Slot]].Bind == (byte)Game.BindOn.Equip) return; // Adiciona o equipamento ao inventário if (!Player.GiveItem(Index, Player.Character(Index).Equipment[Slot], 1)) { // Somente se necessário - if (Lists.Temp_Map[Map_Num].Item.Count == Game.Max_Map_Items) return; + if (Lists.Temp_Map[Map_Num].Item.Count == Lists.Server_Data.Max_Map_Items) return; // Solta o item no chão Map_Item.Index = Player.Character(Index).Equipment[Slot]; @@ -448,7 +450,7 @@ private static void Equipment_Remove(byte Index, NetIncomingMessage Data) } // Remove o equipamento - for (byte i = 0; i < (byte)Game.Attributes.Amount; i++) Player.Character(Index).Attribute[i] -= Lists.Item[Player.Character(Index).Equipment[Slot]].Equip_Attribute[i]; + for (byte i = 0; i < (byte)Game.Attributes.Count; i++) Player.Character(Index).Attribute[i] -= Lists.Item[Player.Character(Index).Equipment[Slot]].Equip_Attribute[i]; Player.Character(Index).Equipment[Slot] = 0; // Envia os dados @@ -475,27 +477,14 @@ private static void Hotbar_Add(byte Index, NetIncomingMessage Data) private static void Hotbar_Change(byte Index, NetIncomingMessage Data) { byte Slot_Old = Data.ReadByte(), Slot_New = Data.ReadByte(); - Lists.Structures.Hotbar Old = Player.Character(Index).Hotbar[Slot_Old]; // Somente se necessário if (Player.Character(Index).Hotbar[Slot_Old].Slot == 0) return; if (Slot_Old == Slot_New) return; - // Caso houver um item no novo slot, trocar ele para o velho - if (Player.Character(Index).Hotbar[Slot_New].Slot > 0) - { - Player.Character(Index).Hotbar[Slot_Old].Slot = Player.Character(Index).Hotbar[Slot_New].Slot; - Player.Character(Index).Hotbar[Slot_Old].Type = Player.Character(Index).Hotbar[Slot_New].Type; - } - else - { - Player.Character(Index).Hotbar[Slot_Old].Slot = 0; - Player.Character(Index).Hotbar[Slot_Old].Type = 0; - } - // Muda o item de slot - Player.Character(Index).Hotbar[Slot_New].Slot = Old.Slot; - Player.Character(Index).Hotbar[Slot_New].Type = Old.Type; + (Player.Character(Index).Hotbar[Slot_Old].Slot, Player.Character(Index).Hotbar[Slot_New].Slot) = (Player.Character(Index).Hotbar[Slot_New].Slot, Player.Character(Index).Hotbar[Slot_Old].Slot); + (Player.Character(Index).Hotbar[Slot_Old].Type, Player.Character(Index).Hotbar[Slot_New].Type) = (Player.Character(Index).Hotbar[Slot_New].Type, Player.Character(Index).Hotbar[Slot_Old].Type); Send.Player_Hotbar(Index); } @@ -523,6 +512,8 @@ private static void Write_Server_Data(byte Index, NetIncomingMessage Data) Lists.Server_Data.Port = Data.ReadInt16(); Lists.Server_Data.Max_Players = Data.ReadByte(); Lists.Server_Data.Max_Characters = Data.ReadByte(); + Lists.Server_Data.Max_Party_Members = Data.ReadByte(); + Lists.Server_Data.Max_Map_Items = Data.ReadByte(); // Salva os dados Write.Server_Data(); @@ -546,19 +537,24 @@ private static void Write_Classes(byte Index, NetIncomingMessage Data) { // Redimensiona os valores necessários Lists.Class[i] = new Lists.Structures.Class(); - Lists.Class[i].Vital = new short[(byte)Game.Vitals.Amount]; - Lists.Class[i].Attribute = new short[(byte)Game.Attributes.Amount]; + Lists.Class[i].Vital = new short[(byte)Game.Vitals.Count]; + Lists.Class[i].Attribute = new short[(byte)Game.Attributes.Count]; + Lists.Class[i].Tex_Male = new short[Data.ReadByte()]; + Lists.Class[i].Tex_Female = new short[Data.ReadByte()]; + Lists.Class[i].Item = new System.Tuple[Data.ReadByte()]; // Lê os dados Lists.Class[i].Name = Data.ReadString(); - Lists.Class[i].Texture_Male = Data.ReadInt16(); - Lists.Class[i].Texture_Female = Data.ReadInt16(); + Lists.Class[i].Description = Data.ReadString(); + for (byte t = 0; t < Lists.Class[i].Tex_Male.Length; t++) Lists.Class[i].Tex_Male[t] = Data.ReadInt16(); + for (byte t = 0; t < Lists.Class[i].Tex_Female.Length; t++) Lists.Class[i].Tex_Female[t] = Data.ReadInt16(); Lists.Class[i].Spawn_Map = Data.ReadInt16(); Lists.Class[i].Spawn_Direction = Data.ReadByte(); Lists.Class[i].Spawn_X = Data.ReadByte(); Lists.Class[i].Spawn_Y = Data.ReadByte(); - for (byte v = 0; v < (byte)Game.Vitals.Amount; v++) Lists.Class[i].Vital[v] = Data.ReadInt16(); - for (byte a = 0; a < (byte)Game.Attributes.Amount; a++) Lists.Class[i].Attribute[a] = Data.ReadInt16(); + for (byte v = 0; v < (byte)Game.Vitals.Count; v++) Lists.Class[i].Vital[v] = Data.ReadInt16(); + for (byte a = 0; a < (byte)Game.Attributes.Count; a++) Lists.Class[i].Attribute[a] = Data.ReadInt16(); + for (byte n = 0; n < (byte)Lists.Class[i].Item.Length; n++) Lists.Class[i].Item[n] = new System.Tuple(Data.ReadInt16(), Data.ReadInt16()); } // Salva os dados e envia pra todos jogadores conectados @@ -621,6 +617,7 @@ private static void Write_Maps(byte Index, NetIncomingMessage Data) // Quantidade de mapas Lists.Map = new Lists.Structures.Map[Data.ReadInt16()]; + Lists.Temp_Map = new Lists.Structures.Temp_Map[Lists.Map.Length]; Lists.Server_Data.Num_Maps = (short)Lists.Map.GetUpperBound(0); Write.Server_Data(); @@ -711,12 +708,18 @@ private static void Write_Maps(byte Index, NetIncomingMessage Data) Lists.Map[i].NPC[n].Spawn = Data.ReadBoolean(); Lists.Map[i].NPC[n].X = Data.ReadByte(); Lists.Map[i].NPC[n].Y = Data.ReadByte(); + NPC.Spawn(n, i); } + // Itens + Lists.Temp_Map[i].Item = new System.Collections.Generic.List(); + Lists.Temp_Map[i].Item.Add(new Lists.Structures.Map_Items()); + Map.Spawn_Items(i); + // Envia o mapa para todos os jogadores que estão nele for (byte n = 1; n <= Game.HigherIndex; n++) if (n != Index) - if (Player.Character(n).Map == i || Lists.TempPlayer[n].InEditor) Send.Map(n, i); + if (Player.Character(n).Map == i || Lists.Temp_Player[n].InEditor) Send.Map(n, i); } // Salva os dados @@ -741,26 +744,26 @@ private static void Write_NPCs(byte Index, NetIncomingMessage Data) { // Redimensiona os valores necessários Lists.NPC[i] = new Lists.Structures.NPC(); - Lists.NPC[i].Vital = new short[(byte)Game.Vitals.Amount]; - Lists.NPC[i].Attribute = new short[(byte)Game.Attributes.Amount]; - Lists.NPC[i].Drop = new Lists.Structures.NPC_Drop[Game.Max_NPC_Drop]; + Lists.NPC[i].Vital = new short[(byte)Game.Vitals.Count]; + Lists.NPC[i].Attribute = new short[(byte)Game.Attributes.Count]; // Lê os dados Lists.NPC[i].Name = Data.ReadString(); + Lists.NPC[i].SayMsg = Data.ReadString(); Lists.NPC[i].Texture = Data.ReadInt16(); Lists.NPC[i].Behaviour = Data.ReadByte(); Lists.NPC[i].SpawnTime = Data.ReadByte(); Lists.NPC[i].Sight = Data.ReadByte(); - Lists.NPC[i].Experience = Data.ReadByte(); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Lists.NPC[i].Vital[n] = Data.ReadInt16(); - for (byte n = 0; n < (byte)Game.Attributes.Amount; n++) Lists.NPC[i].Attribute[n] = Data.ReadInt16(); - for (byte n = 0; n < Game.Max_NPC_Drop; n++) - { - Lists.NPC[i].Drop[n] = new Lists.Structures.NPC_Drop(); - Lists.NPC[i].Drop[n].Item_Num = Data.ReadInt16(); - Lists.NPC[i].Drop[n].Amount = Data.ReadInt16(); - Lists.NPC[i].Drop[n].Chance = Data.ReadByte(); - } + Lists.NPC[i].Experience = Data.ReadInt32(); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Lists.NPC[i].Vital[n] = Data.ReadInt16(); + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) Lists.NPC[i].Attribute[n] = Data.ReadInt16(); + Lists.NPC[i].Drop = new Lists.Structures.NPC_Drop[Data.ReadByte()]; + for (byte n = 0; n < Lists.NPC[i].Drop.Length; n++) Lists.NPC[i].Drop[n] = new Lists.Structures.NPC_Drop(Data.ReadInt16(), Data.ReadInt16(), Data.ReadByte()); + Lists.NPC[i].AttackNPC = Data.ReadBoolean(); + Lists.NPC[i].Allie = new short[Data.ReadByte()]; + for (byte n = 0; n < Lists.NPC[i].Allie.Length; n++) Lists.NPC[i].Allie[n] = Data.ReadInt16(); + Lists.NPC[i].Movement = (NPC.Movements)Data.ReadByte(); + Lists.NPC[i].Flee_Helth = Data.ReadByte(); } // Salva os dados e envia pra todos jogadores conectados @@ -787,8 +790,8 @@ private static void Write_Items(byte Index, NetIncomingMessage Data) { // Redimensiona os valores necessários Lists.Item[i] = new Lists.Structures.Item(); - Lists.Item[i].Potion_Vital = new short[(byte)Game.Vitals.Amount]; - Lists.Item[i].Equip_Attribute = new short[(byte)Game.Attributes.Amount]; + Lists.Item[i].Potion_Vital = new short[(byte)Game.Vitals.Count]; + Lists.Item[i].Equip_Attribute = new short[(byte)Game.Attributes.Count]; // Lê os dados Lists.Item[i].Name = Data.ReadString(); @@ -797,13 +800,14 @@ private static void Write_Items(byte Index, NetIncomingMessage Data) Lists.Item[i].Type = Data.ReadByte(); Lists.Item[i].Price = Data.ReadInt16(); Lists.Item[i].Stackable = Data.ReadBoolean(); - Lists.Item[i].Bind = Data.ReadBoolean(); + Lists.Item[i].Bind = Data.ReadByte(); + Lists.Item[i].Rarity = Data.ReadByte(); Lists.Item[i].Req_Level = Data.ReadInt16(); Lists.Item[i].Req_Class = Data.ReadByte(); - Lists.Item[i].Potion_Experience = Data.ReadInt16(); - for (byte v = 0; v < (byte)Game.Vitals.Amount; v++) Lists.Item[i].Potion_Vital[v] = Data.ReadInt16(); + Lists.Item[i].Potion_Experience = Data.ReadInt32(); + for (byte v = 0; v < (byte)Game.Vitals.Count; v++) Lists.Item[i].Potion_Vital[v] = Data.ReadInt16(); Lists.Item[i].Equip_Type = Data.ReadByte(); - for (byte a = 0; a < (byte)Game.Attributes.Amount; a++) Lists.Item[i].Equip_Attribute[a] = Data.ReadInt16(); + for (byte a = 0; a < (byte)Game.Attributes.Count; a++) Lists.Item[i].Equip_Attribute[a] = Data.ReadInt16(); Lists.Item[i].Weapon_Damage = Data.ReadInt16(); } @@ -816,17 +820,17 @@ private static void Write_Items(byte Index, NetIncomingMessage Data) private static void Request_Server_Data(byte Index, NetIncomingMessage Data) { - Send.Server_Data(Index, Data.ReadBoolean()); + Send.Server_Data(Index); } - private static void Request_Classes(byte Index, NetIncomingMessage Data) + private static void Request_Classes(byte Index) { - Send.Classes(Index, Data.ReadBoolean()); + Send.Classes(Index); } - private static void Request_Tiles(byte Index, NetIncomingMessage Data) + private static void Request_Tiles(byte Index) { - Send.Tiles(Index, Data.ReadBoolean()); + Send.Tiles(Index); } private static void Request_Map(byte Index, NetIncomingMessage Data) @@ -839,13 +843,110 @@ private static void Request_Maps(byte Index, NetIncomingMessage Data) Send.Maps(Index, Data.ReadBoolean()); } - private static void Request_NPCs(byte Index, NetIncomingMessage Data) + private static void Request_NPCs(byte Index) { - Send.NPCs(Index, Data.ReadBoolean()); + Send.NPCs(Index); + } + + private static void Request_Items(byte Index) + { + Send.Items(Index); + } + + private static void Party_Invite(byte Index, NetIncomingMessage Data) + { + string Name = Data.ReadString(); + + // Encontra o jogador + byte Invited = Player.Find(Name); + + // Verifica se o jogador está convectado + if (Invited == 0) + { + Send.Message(Index, "The player ins't connected.", System.Drawing.Color.White); + return; + } + // Verifica se não está tentando se convidar + if (Invited == Index) + { + Send.Message(Index, "You can't be invited.", System.Drawing.Color.White); + return; + } + // Verifica se já tem um grupo + if (Player.Character(Invited).Party.Count != 0) + { + Send.Message(Index, "The player is already part of a party.", System.Drawing.Color.White); + return; + } + // Verifica se o jogador já está analisando um convite para algum grupo + if (!string.IsNullOrEmpty(Lists.Temp_Player[Invited].Party_Invitation)) + { + Send.Message(Index, "The player is analyzing an invitation to another party.", System.Drawing.Color.White); + return; + } + // Verifica se o grupo está cheio + if (Player.Character(Index).Party.Count == Lists.Server_Data.Max_Party_Members - 1) + { + Send.Message(Index, "Your party is full.", System.Drawing.Color.White); + return; + } + + // Convida o jogador + Lists.Temp_Player[Invited].Party_Invitation = Player.Character(Index).Name; + Send.Party_Invitation(Invited, Player.Character(Index).Name); + } + + private static void Party_Accept(byte Index) + { + byte Invitation = Player.Find(Lists.Temp_Player[Index].Party_Invitation); + + // Verifica se já tem um grupo + if (Player.Character(Index).Party.Count != 0) + { + Send.Message(Index, "You are already part of a party.", System.Drawing.Color.White); + return; + } + // Verifica se quem chamou ainda está disponível + if (Invitation == 0) + { + Send.Message(Index, "Who invited you is no longer avaliable.", System.Drawing.Color.White); + return; + } + // Verifica se o grupo está cheio + if (Player.Character(Invitation).Party.Count == Lists.Server_Data.Max_Party_Members - 1) + { + Send.Message(Index, "The party is full.", System.Drawing.Color.White); + return; + } + + // Entra na festa + for (byte i = 0; i < Player.Character(Invitation).Party.Count; i++) + { + Player.Character(Player.Character(Invitation).Party[i]).Party.Add(Index); + Player.Character(Index).Party.Add(Player.Character(Invitation).Party[i]); + } + Player.Character(Index).Party.Insert(0, Invitation); + Player.Character(Invitation).Party.Add(Index); + Lists.Temp_Player[Index].Party_Invitation = string.Empty; + Send.Message(Invitation, Player.Character(Index).Name + " joined the party.", System.Drawing.Color.White); + + // Envia os dados para o grupo + Send.Party(Index); + for (byte i = 0; i < Player.Character(Index).Party.Count; i++) Send.Party(Player.Character(Index).Party[i]); + } + + private static void Party_Decline(byte Index) + { + byte Invitation = Player.Find(Lists.Temp_Player[Index].Party_Invitation); + + // Recusa o convite + if (Invitation != 0) Send.Message(Invitation, Player.Character(Index).Name + " joined the party.", System.Drawing.Color.White); + Lists.Temp_Player[Index].Party_Invitation = string.Empty; } - private static void Request_Items(byte Index, NetIncomingMessage Data) + private static void Party_Leave(byte Index) { - Send.Items(Index, Data.ReadBoolean()); + // Sai do grupo + Player.Party_Leave(Index); } } \ No newline at end of file diff --git a/Source/Server/Network/Send.cs b/Source/Server/Network/Send.cs index 0e46da22..2a928e6e 100644 --- a/Source/Server/Network/Send.cs +++ b/Source/Server/Network/Send.cs @@ -40,6 +40,8 @@ public enum Client_Packets Map_NPC_Died, Items, Map_Items, + Party, + Party_Invitation } // Pacotes do servidor para o editor @@ -56,7 +58,7 @@ public enum Editor_Packets Items } - public static void ToPlayer(byte Index, NetOutgoingMessage Data) + private static void ToPlayer(byte Index, NetOutgoingMessage Data) { // Previne sobrecarga if (!Socket.IsConnected(Index)) return; @@ -67,7 +69,7 @@ public static void ToPlayer(byte Index, NetOutgoingMessage Data) Socket.Device.SendMessage(Data_Send, Socket.Connection[Index], NetDeliveryMethod.ReliableOrdered); } - public static void ToAll(NetOutgoingMessage Data) + private static void ToAll(NetOutgoingMessage Data) { // Envia os dados para todos conectados for (byte i = 1; i <= Game.HigherIndex; i++) @@ -75,7 +77,7 @@ public static void ToAll(NetOutgoingMessage Data) ToPlayer(i, Data); } - public static void ToAllBut(byte Index, NetOutgoingMessage Data) + private static void ToAllBut(byte Index, NetOutgoingMessage Data) { // Envia os dados para todos conectados, com excessão do índice for (byte i = 1; i <= Game.HigherIndex; i++) @@ -84,7 +86,7 @@ public static void ToAllBut(byte Index, NetOutgoingMessage Data) ToPlayer(i, Data); } - public static void ToMap(short Map, NetOutgoingMessage Data) + private static void ToMap(short Map, NetOutgoingMessage Data) { // Envia os dados para todos conectados, com excessão do índice for (byte i = 1; i <= Game.HigherIndex; i++) @@ -93,7 +95,7 @@ public static void ToMap(short Map, NetOutgoingMessage Data) ToPlayer(i, Data); } - public static void ToMapBut(short Map, byte Index, NetOutgoingMessage Data) + private static void ToMapBut(short Map, byte Index, NetOutgoingMessage Data) { // Envia os dados para todos conectados, com excessão do índice for (byte i = 1; i <= Game.HigherIndex; i++) @@ -108,7 +110,7 @@ public static void Alert(byte Index, string Message, bool Disconnect = true) NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - if (Lists.TempPlayer[Index].InEditor) Data.Write((byte)Editor_Packets.Alert); + if (Lists.Temp_Player[Index].InEditor) Data.Write((byte)Editor_Packets.Alert); else Data.Write((byte)Client_Packets.Alert); Data.Write(Message); ToPlayer(Index, Data); @@ -132,7 +134,7 @@ public static void Connect(byte Index) NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - if (Lists.TempPlayer[Index].InEditor) Data.Write((byte)Editor_Packets.Connect); + if (Lists.Temp_Player[Index].InEditor) Data.Write((byte)Editor_Packets.Connect); else Data.Write((byte)Client_Packets.Connect); Data.Write(Index); ToPlayer(Index, Data); @@ -171,6 +173,7 @@ public static void Characters(byte Index) { Data.Write(Lists.Player[Index].Character[i].Name); Data.Write(Lists.Player[Index].Character[i].Class); + Data.Write(Lists.Player[Index].Character[i].Texture_Num); Data.Write(Lists.Player[Index].Character[i].Genre); Data.Write(Lists.Player[Index].Character[i].Level); } @@ -178,12 +181,12 @@ public static void Characters(byte Index) ToPlayer(Index, Data); } - public static void Classes(byte Index, bool OpenEditor = false) + public static void Classes(byte Index) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - if (Lists.TempPlayer[Index].InEditor) Data.Write((byte)Editor_Packets.Classes); + if (Lists.Temp_Player[Index].InEditor) Data.Write((byte)Editor_Packets.Classes); else Data.Write((byte)Client_Packets.Classes); Data.Write(Lists.Server_Data.Num_Classes); @@ -191,21 +194,29 @@ public static void Classes(byte Index, bool OpenEditor = false) { // Escreve os dados Data.Write(Lists.Class[i].Name); - Data.Write(Lists.Class[i].Texture_Male); - Data.Write(Lists.Class[i].Texture_Female); + Data.Write(Lists.Class[i].Description); + Data.Write((byte)Lists.Class[i].Tex_Male.Length); + for (byte t = 0; t < Lists.Class[i].Tex_Male.Length; t++) Data.Write(Lists.Class[i].Tex_Male[t]); + Data.Write((byte)Lists.Class[i].Tex_Female.Length); + for (byte t = 0; t < Lists.Class[i].Tex_Female.Length; t++) Data.Write(Lists.Class[i].Tex_Female[t]); // Apenas dados do editor - if (Lists.TempPlayer[Index].InEditor) + if (Lists.Temp_Player[Index].InEditor) { Data.Write(Lists.Class[i].Spawn_Map); Data.Write(Lists.Class[i].Spawn_Direction); Data.Write(Lists.Class[i].Spawn_X); Data.Write(Lists.Class[i].Spawn_Y); - for (byte v = 0; v < (byte)Game.Vitals.Amount; v++) Data.Write(Lists.Class[i].Vital[v]); - for (byte a = 0; a < (byte)Game.Attributes.Amount; a++) Data.Write(Lists.Class[i].Attribute[a]); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Data.Write(Lists.Class[i].Vital[n]); + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) Data.Write(Lists.Class[i].Attribute[n]); + Data.Write((byte)Lists.Class[i].Item.Length); + for (byte n = 0; n < (byte)Lists.Class[i].Item.Length; n++) + { + Data.Write(Lists.Class[i].Item[n].Item1); + Data.Write(Lists.Class[i].Item[n].Item2); + } } } - Data.Write(OpenEditor); // Envia os dados ToPlayer(Index, Data); @@ -229,19 +240,20 @@ public static NetOutgoingMessage Player_Data_Cache(byte Index) Data.Write(Index); Data.Write(Player.Character(Index).Name); Data.Write(Player.Character(Index).Class); + Data.Write(Player.Character(Index).Texture_Num); Data.Write(Player.Character(Index).Genre); Data.Write(Player.Character(Index).Level); Data.Write(Player.Character(Index).Map); Data.Write(Player.Character(Index).X); Data.Write(Player.Character(Index).Y); Data.Write((byte)Player.Character(Index).Direction); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) { Data.Write(Player.Character(Index).Vital[n]); Data.Write(Player.Character(Index).MaxVital(n)); } - for (byte n = 0; n < (byte)Game.Attributes.Amount; n++) Data.Write(Player.Character(Index).Attribute[n]); - for (byte n = 0; n < (byte)Game.Equipments.Amount; n++) Data.Write(Player.Character(Index).Equipment[n]); + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) Data.Write(Player.Character(Index).Attribute[n]); + for (byte n = 0; n < (byte)Game.Equipments.Count; n++) Data.Write(Player.Character(Index).Equipment[n]); return Data; } @@ -266,7 +278,7 @@ public static void Player_Vitals(byte Index) // Envia os dados Data.Write((byte)Client_Packets.Player_Vitals); Data.Write(Index); - for (byte i = 0; i < (byte)Game.Vitals.Amount; i++) + for (byte i = 0; i < (byte)Game.Vitals.Count; i++) { Data.Write(Player.Character(Index).Vital[i]); Data.Write(Player.Character(Index).MaxVital(i)); @@ -339,7 +351,7 @@ public static void Player_Equipments(byte Index) // Envia os dados Data.Write((byte)Client_Packets.Player_Equipments); Data.Write(Index); - for (byte i = 0; i < (byte)Game.Equipments.Amount; i++) Data.Write(Player.Character(Index).Equipment[i]); + for (byte i = 0; i < (byte)Game.Equipments.Count; i++) Data.Write(Player.Character(Index).Equipment[i]); ToMap(Player.Character(Index).Map, Data); } @@ -402,7 +414,7 @@ public static void Map(byte Index, short Map_Num, bool OpenEditor = false) NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - if (Lists.TempPlayer[Index].InEditor) Data.Write((byte)Editor_Packets.Map); + if (Lists.Temp_Player[Index].InEditor) Data.Write((byte)Editor_Packets.Map); else Data.Write((byte)Client_Packets.Map); Data.Write(Map_Num); Data.Write(Lists.Map[Map_Num].Revision); @@ -496,13 +508,13 @@ public static void Latency(byte Index) ToPlayer(Index, Data); } - public static void Message(byte Index, string Mensagem, Color Color) + public static void Message(byte Index, string Text, Color Color) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados Data.Write((byte)Client_Packets.Message); - Data.Write(Mensagem); + Data.Write(Text); Data.Write(Color.ToArgb()); ToPlayer(Index, Data); } @@ -531,17 +543,6 @@ public static void Message_Global(byte Index, string Text) ToAll(Data); } - public static void Mensagem_Global(string Message) - { - NetOutgoingMessage Data = Socket.Device.CreateMessage(); - - // Envia os dados - Data.Write((byte)Client_Packets.Message); - Data.Write(Message); - Data.Write(Color.Yellow.ToArgb()); - ToAll(Data); - } - public static void Message_Private(byte Index, string Addressee_Name, string Texto) { byte Addressee = Player.Find(Addressee_Name); @@ -558,7 +559,7 @@ public static void Message_Private(byte Index, string Addressee_Name, string Tex Message(Addressee, "[From] " + Player.Character(Index).Name + ": " + Texto, Color.Pink); } - public static void Player_Attack(byte Index, byte Victim, byte Victim_Type) + public static void Player_Attack(byte Index, byte Victim = 0, byte Victim_Type = 0) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); @@ -570,14 +571,14 @@ public static void Player_Attack(byte Index, byte Victim, byte Victim_Type) ToMap(Player.Character(Index).Map, Data); } - public static void Items(byte Index, bool OpenEditor = false) + public static void Items(byte Index) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - if (Lists.TempPlayer[Index].InEditor) Data.Write((byte)Editor_Packets.Items); + if (Lists.Temp_Player[Index].InEditor) Data.Write((byte)Editor_Packets.Items); else Data.Write((byte)Client_Packets.Items); - Data.Write((short)Lists.Item.GetUpperBound(0)); + Data.Write((short)Lists.Item.Length); for (short i = 1; i < Lists.Item.Length; i++) { Data.Write(Lists.Item[i].Name); @@ -587,15 +588,15 @@ public static void Items(byte Index, bool OpenEditor = false) Data.Write(Lists.Item[i].Price); Data.Write(Lists.Item[i].Stackable); Data.Write(Lists.Item[i].Bind); + Data.Write(Lists.Item[i].Rarity); Data.Write(Lists.Item[i].Req_Level); Data.Write(Lists.Item[i].Req_Class); Data.Write(Lists.Item[i].Potion_Experience); - for (byte v = 0; v < (byte)Game.Vitals.Amount; v++) Data.Write(Lists.Item[i].Potion_Vital[v]); + for (byte v = 0; v < (byte)Game.Vitals.Count; v++) Data.Write(Lists.Item[i].Potion_Vital[v]); Data.Write(Lists.Item[i].Equip_Type); - for (byte a = 0; a < (byte)Game.Attributes.Amount; a++) Data.Write(Lists.Item[i].Equip_Attribute[a]); + for (byte a = 0; a < (byte)Game.Attributes.Count; a++) Data.Write(Lists.Item[i].Equip_Attribute[a]); Data.Write(Lists.Item[i].Weapon_Damage); } - Data.Write(OpenEditor); // Envia os dados ToPlayer(Index, Data); @@ -665,38 +666,44 @@ public static void Player_Hotbar(byte Index) ToPlayer(Index, Data); } - public static void NPCs(byte Index, bool OpenEditor = false) + public static void NPCs(byte Index) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); // Envia os dados - if (Lists.TempPlayer[Index].InEditor) Data.Write((byte)Editor_Packets.NPCs); + if (Lists.Temp_Player[Index].InEditor) Data.Write((byte)Editor_Packets.NPCs); else Data.Write((byte)Client_Packets.NPCs); - Data.Write((short)Lists.NPC.GetUpperBound(0)); + Data.Write((short)Lists.NPC.Length); for (byte i = 1; i < Lists.NPC.Length; i++) { // Geral Data.Write(Lists.NPC[i].Name); + Data.Write(Lists.NPC[i].SayMsg); Data.Write(Lists.NPC[i].Texture); Data.Write(Lists.NPC[i].Behaviour); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Data.Write(Lists.NPC[i].Vital[n]); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Data.Write(Lists.NPC[i].Vital[n]); // Dados apenas do editor - if (Lists.TempPlayer[Index].InEditor) + if (Lists.Temp_Player[Index].InEditor) { Data.Write(Lists.NPC[i].SpawnTime); Data.Write(Lists.NPC[i].Sight); Data.Write(Lists.NPC[i].Experience); - for (byte n = 0; n < (byte)Game.Attributes.Amount; n++) Data.Write(Lists.NPC[i].Attribute[n]); - for (byte n = 0; n < Game.Max_NPC_Drop; n++) + for (byte n = 0; n < (byte)Game.Attributes.Count; n++) Data.Write(Lists.NPC[i].Attribute[n]); + Data.Write((byte)Lists.NPC[i].Drop.Length); + for (byte n = 0; n < Lists.NPC[i].Drop.Length; n++) { Data.Write(Lists.NPC[i].Drop[n].Item_Num); Data.Write(Lists.NPC[i].Drop[n].Amount); Data.Write(Lists.NPC[i].Drop[n].Chance); } + Data.Write(Lists.NPC[i].AttackNPC); + Data.Write((byte)Lists.NPC[i].Allie.Length); + for (byte n = 0; n < Lists.NPC[i].Allie.Length; n++) Data.Write(Lists.NPC[i].Allie[n]); + Data.Write((byte)Lists.NPC[i].Movement); + Data.Write(Lists.NPC[i].Flee_Helth); } } - Data.Write(OpenEditor); ToPlayer(Index, Data); } @@ -706,14 +713,14 @@ public static void Map_NPCs(byte Index, short Map_Num) // Envia os dados Data.Write((byte)Client_Packets.Map_NPCs); - Data.Write((short)Lists.Temp_Map[Map_Num].NPC.GetUpperBound(0)); + Data.Write((short)Lists.Temp_Map[Map_Num].NPC.Length); for (byte i = 1; i < Lists.Temp_Map[Map_Num].NPC.Length; i++) { Data.Write(Lists.Temp_Map[Map_Num].NPC[i].Index); Data.Write(Lists.Temp_Map[Map_Num].NPC[i].X); Data.Write(Lists.Temp_Map[Map_Num].NPC[i].Y); Data.Write((byte)Lists.Temp_Map[Map_Num].NPC[i].Direction); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Data.Write(Lists.Temp_Map[Map_Num].NPC[i].Vital[n]); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Data.Write(Lists.Temp_Map[Map_Num].NPC[i].Vital[n]); } ToPlayer(Index, Data); } @@ -729,7 +736,7 @@ public static void Map_NPC(short Map_Num, byte Index) Data.Write(Lists.Temp_Map[Map_Num].NPC[Index].X); Data.Write(Lists.Temp_Map[Map_Num].NPC[Index].Y); Data.Write((byte)Lists.Temp_Map[Map_Num].NPC[Index].Direction); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Data.Write(Lists.Temp_Map[Map_Num].NPC[Index].Vital[n]); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Data.Write(Lists.Temp_Map[Map_Num].NPC[Index].Vital[n]); ToMap(Map_Num, Data); } @@ -765,11 +772,11 @@ public static void Map_NPC_Vitals(short Map_Num, byte Index) // Envia os dados Data.Write((byte)Client_Packets.Map_NPC_Vitals); Data.Write(Index); - for (byte n = 0; n < (byte)Game.Vitals.Amount; n++) Data.Write(Lists.Temp_Map[Map_Num].NPC[Index].Vital[n]); + for (byte n = 0; n < (byte)Game.Vitals.Count; n++) Data.Write(Lists.Temp_Map[Map_Num].NPC[Index].Vital[n]); ToMap(Map_Num, Data); } - public static void Map_NPC_Attack(short Map_Num, byte Index, byte Victim, byte Victim_Type) + public static void Map_NPC_Attack(short Map_Num, byte Index, byte Victim = 0, byte Victim_Type = 0) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); @@ -791,7 +798,7 @@ public static void Map_NPC_Died(short Map_Num, byte Index) ToMap(Map_Num, Data); } - public static void Tiles(byte Index, bool OpenEditor = false) + public static void Tiles(byte Index) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); @@ -813,11 +820,10 @@ public static void Tiles(byte Index, bool OpenEditor = false) Data.Write(Lists.Tile[i].Data[x, y].Block[d]); } } - Data.Write(OpenEditor); ToPlayer(Index, Data); } - public static void Server_Data(byte Index, bool OpenEdtior) + public static void Server_Data(byte Index) { NetOutgoingMessage Data = Socket.Device.CreateMessage(); @@ -828,7 +834,29 @@ public static void Server_Data(byte Index, bool OpenEdtior) Data.Write(Lists.Server_Data.Port); Data.Write(Lists.Server_Data.Max_Players); Data.Write(Lists.Server_Data.Max_Characters); - Data.Write(OpenEdtior); + Data.Write(Lists.Server_Data.Max_Party_Members); + Data.Write(Lists.Server_Data.Max_Map_Items); + ToPlayer(Index, Data); + } + + public static void Party(byte Index) + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Client_Packets.Party); + Data.Write((byte)Player.Character(Index).Party.Count); + for (byte i = 0; i < Player.Character(Index).Party.Count; i++) Data.Write(Player.Character(Index).Party[i]); + ToPlayer(Index, Data); + } + + public static void Party_Invitation(byte Index, string Player_Invitation) + { + NetOutgoingMessage Data = Socket.Device.CreateMessage(); + + // Envia os dados + Data.Write((byte)Client_Packets.Party_Invitation); + Data.Write(Player_Invitation); ToPlayer(Index, Data); } } \ No newline at end of file diff --git a/Source/Server/Network/Socket.cs b/Source/Server/Network/Socket.cs index 45e6b0c5..1592320a 100644 --- a/Source/Server/Network/Socket.cs +++ b/Source/Server/Network/Socket.cs @@ -60,7 +60,7 @@ public static void HandleData() } } - public static void Connect(NetIncomingMessage IncomingMsg) + private static void Connect(NetIncomingMessage IncomingMsg) { // Define a conexão do jogador Connection[FindConnection(null)] = IncomingMsg.SenderConnection; @@ -69,7 +69,7 @@ public static void Connect(NetIncomingMessage IncomingMsg) Game.SetHigherIndex(); } - public static void Disconnect(byte Index) + private static void Disconnect(byte Index) { // Redefine o maior índice dos jogadores Game.SetHigherIndex(); @@ -89,7 +89,7 @@ public static bool IsConnected(byte Index) return Connection[Index].Status == NetConnectionStatus.Connected; } - public static byte FindConnection(NetConnection Data) + private static byte FindConnection(NetConnection Data) { // Encontra uma determinada conexão for (byte i = 1; i <= Lists.Server_Data.Max_Players; i++) diff --git a/Source/Server/Program.cs b/Source/Server/Program.cs index ff46da7c..2d4d3973 100644 --- a/Source/Server/Program.cs +++ b/Source/Server/Program.cs @@ -11,7 +11,7 @@ class Program static EventHandler Handler; [STAThread] - public static void Main() + private static void Main() { // Abre o servidor e define suas configurações Console.Title = "Server"; @@ -26,9 +26,11 @@ public static void Main() Directories.Create(); Console.WriteLine("Directories created."); - // Limpa e carrega todos os dados necessários + // Carrega todos os dados necessários Read.All(); - Clear.All(); + + // Limpa os dados dos jogadores + Clear.Players(); // Cria os dispositivos da rede Socket.Init(); @@ -40,7 +42,7 @@ public static void Main() // Inicia os laços Thread Console_Loop = new Thread(Loop.Commands); Console_Loop.Start(); - Loop.Main(); + Loop.Init(); } private static bool Exit() @@ -55,7 +57,7 @@ private static bool Exit() return true; } - public static void Logo() + private static void Logo() { Console.WriteLine(@" ______ _____ _ | ___| | \ | | diff --git a/Source/Server/Properties/AssemblyInfo.cs b/Source/Server/Properties/AssemblyInfo.cs index 08d97c64..70054791 100644 --- a/Source/Server/Properties/AssemblyInfo.cs +++ b/Source/Server/Properties/AssemblyInfo.cs @@ -3,5 +3,6 @@ [assembly: AssemblyTitle("Server")] [assembly: AssemblyCompany("Ricardo Dalarme")] [assembly: AssemblyProduct("CryBits")] -[assembly: AssemblyCopyright("Copyright (c) 2020 Ricardo Dalarme de Oliveira Filho")] -[assembly: AssemblyDescription("ORPG Game Engine")] \ No newline at end of file +[assembly: AssemblyCopyright("Copyright (c) 2020 Ricardo Dalarme")] +[assembly: AssemblyDescription("ORPG Game Engine")] +[assembly: AssemblyVersion("0.7.0")] \ No newline at end of file diff --git a/Source/Server/Server.csproj b/Source/Server/Server.csproj index d199b25f..5b3401a7 100644 --- a/Source/Server/Server.csproj +++ b/Source/Server/Server.csproj @@ -8,7 +8,7 @@ Exe Server Server - v4.6 + v4.8 512 true false @@ -106,7 +106,6 @@ false -