From b2034df79dd7a2e433f011d34b43b73333dd42ff Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 27 Dec 2020 00:47:08 +0100 Subject: [PATCH] wip(Stats/Features): Pushing progress for stats & join message --- BigBaseV2/src/features.cpp | 1 + BigBaseV2/src/features.hpp | 2 ++ BigBaseV2/src/features/join_message.cpp | 22 +++++++++++++++++ BigBaseV2/src/features/stats.cpp | 18 ++++++++++++++ BigBaseV2/src/features/stats.hpp | 1 + BigBaseV2/src/gui/main_window.cpp | 1 + BigBaseV2/src/gui/tab_bar/tab_bar.hpp | 1 + BigBaseV2/src/gui/tab_bar/tab_misc.cpp | 33 +++++++++++++++++++++++++ BigBaseV2/src/settings.h | 1 + 9 files changed, 80 insertions(+) create mode 100644 BigBaseV2/src/features/join_message.cpp create mode 100644 BigBaseV2/src/gui/tab_bar/tab_misc.cpp diff --git a/BigBaseV2/src/features.cpp b/BigBaseV2/src/features.cpp index 31279b76..bbd0892b 100644 --- a/BigBaseV2/src/features.cpp +++ b/BigBaseV2/src/features.cpp @@ -13,6 +13,7 @@ namespace big update_screen_sizes(); god_mode(); + join_message(); never_wanted(); no_bike_fall(); no_idle_kick(); diff --git a/BigBaseV2/src/features.hpp b/BigBaseV2/src/features.hpp index b1fd11a3..7d3b9c9a 100644 --- a/BigBaseV2/src/features.hpp +++ b/BigBaseV2/src/features.hpp @@ -4,6 +4,7 @@ #include "structs/player.hpp" #include "structs/temp.hpp" #include "features/notify.hpp" +#include "features/stats.hpp" #include "features/teleport.hpp" namespace big @@ -24,6 +25,7 @@ namespace big void script_func(); void god_mode(); + void join_message(); void never_wanted(); void no_bike_fall(); void no_idle_kick(); diff --git a/BigBaseV2/src/features/join_message.cpp b/BigBaseV2/src/features/join_message.cpp new file mode 100644 index 00000000..cbdf5d55 --- /dev/null +++ b/BigBaseV2/src/features/join_message.cpp @@ -0,0 +1,22 @@ +#include "features.hpp" + +namespace big +{ + void features::join_message() + { + bool bJoinMessage = g_settings.options["join_message"].get(); + + if (bJoinMessage) + { + for (int i = 0; i < 32; i++) { + if (!g_players[i].is_online && ENTITY::DOES_ENTITY_EXIST(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i))) { + char joinMsg[64]; + strcpy(joinMsg, g_players[i].name); + strcat(joinMsg, "is joining"); + + features::notify::above_map(joinMsg); + } + } + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/features/stats.cpp b/BigBaseV2/src/features/stats.cpp index 3fea5901..60b12d15 100644 --- a/BigBaseV2/src/features/stats.cpp +++ b/BigBaseV2/src/features/stats.cpp @@ -1,7 +1,17 @@ #include "stats.hpp" +#include "script.hpp" namespace big::features { + void stats::unlock_achievements() + { + for (int i = 1; i < 100; i++) { + PLAYER::GIVE_ACHIEVEMENT_TO_PLAYER(i); + + script::get_current()->yield(); + } + } + void stats::unlock_all() { QUEUE_JOB_BEGIN_CLAUSE() @@ -228,6 +238,8 @@ namespace big::features strcat(str, tmp); Hash hashs = MISC::GET_HASH_KEY(str); STATS::STAT_SET_INT(hashs, -1, 1); + + script::get_current()->yield(); } for (int i = 0; i < 140; i++) { @@ -245,6 +257,8 @@ namespace big::features strcat(str, tmp); Hash hashs = MISC::GET_HASH_KEY(str); STATS::STAT_SET_INT(hashs, -1, 1); + + script::get_current()->yield(); } for (int i = 0; i < 26; i++) { @@ -263,6 +277,8 @@ namespace big::features strcat(str, tmp); Hash hashs = MISC::GET_HASH_KEY(str); STATS::STAT_SET_INT(hashs, -1, 1); + + script::get_current()->yield(); } for (int i = 0; i < 38; i++) { @@ -280,6 +296,8 @@ namespace big::features strcat(str, tmp); Hash hashs = MISC::GET_HASH_KEY(str); STATS::STAT_SET_INT(hashs, -1, 1); + + script::get_current()->yield(); } STATS::STAT_SET_INT(MISC::GET_HASH_KEY("MP1_SCRIPT_INCREASE_STAM"), 100, 1); STATS::STAT_SET_INT(MISC::GET_HASH_KEY("MP1_SCRIPT_INCREASE_STRN"), 100, 1); diff --git a/BigBaseV2/src/features/stats.hpp b/BigBaseV2/src/features/stats.hpp index 19f7b6c9..fece77e6 100644 --- a/BigBaseV2/src/features/stats.hpp +++ b/BigBaseV2/src/features/stats.hpp @@ -8,6 +8,7 @@ namespace big::features class stats { public: + static void unlock_achievements(); static void unlock_all(); }; } \ No newline at end of file diff --git a/BigBaseV2/src/gui/main_window.cpp b/BigBaseV2/src/gui/main_window.cpp index ed288d08..a2ffa3f8 100644 --- a/BigBaseV2/src/gui/main_window.cpp +++ b/BigBaseV2/src/gui/main_window.cpp @@ -15,6 +15,7 @@ namespace big tabbar::render_teleport(); tabbar::render_vehicle(); tabbar::render_network(); + tabbar::render_misc(); tabbar::render_spawn(); ImGui::EndTabBar(); } diff --git a/BigBaseV2/src/gui/tab_bar/tab_bar.hpp b/BigBaseV2/src/gui/tab_bar/tab_bar.hpp index 6e471014..5ed198b5 100644 --- a/BigBaseV2/src/gui/tab_bar/tab_bar.hpp +++ b/BigBaseV2/src/gui/tab_bar/tab_bar.hpp @@ -18,6 +18,7 @@ namespace big static void render_teleport(); static void render_vehicle(); static void render_network(); + static void render_misc(); static void render_spawn(); }; diff --git a/BigBaseV2/src/gui/tab_bar/tab_misc.cpp b/BigBaseV2/src/gui/tab_bar/tab_misc.cpp new file mode 100644 index 00000000..0f9589e2 --- /dev/null +++ b/BigBaseV2/src/gui/tab_bar/tab_misc.cpp @@ -0,0 +1,33 @@ +#include "tab_bar.hpp" + +namespace big +{ + void tabbar::render_misc() + { + if (ImGui::BeginTabItem("Misc")) + { + if (ImGui::Checkbox("Player Join Message", g_settings.options["join_message"].get())) + g_settings.save(); + + ImGui::Separator(); + + if (ImGui::Button("Unlock Achievements")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + features::stats::unlock_achievements(); + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::Button("Unlock All Stats")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + features::stats::unlock_all(); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/settings.h b/BigBaseV2/src/settings.h index c1b7d477..e6e8be1b 100644 --- a/BigBaseV2/src/settings.h +++ b/BigBaseV2/src/settings.h @@ -14,6 +14,7 @@ namespace big nlohmann::json default_options = R"({ "god_mode": false, + "join_message": false, "never_wanted": false, "no_bike_fall": false, "no_idle_kick": false,