Просмотр исходного кода

[FL-2828] Dolphin score points update #1809

Nikolay Minaylov 3 лет назад
Родитель
Сommit
04f5ad83f8

+ 2 - 0
applications/main/gpio/scenes/gpio_scene_start.c

@@ -1,6 +1,7 @@
 #include "../gpio_app_i.h"
 #include "../gpio_app_i.h"
 #include "furi_hal_power.h"
 #include "furi_hal_power.h"
 #include "furi_hal_usb.h"
 #include "furi_hal_usb.h"
+#include <dolphin/dolphin.h>
 
 
 enum GpioItem {
 enum GpioItem {
     GpioItemUsbUart,
     GpioItemUsbUart,
@@ -88,6 +89,7 @@ bool gpio_scene_start_on_event(void* context, SceneManagerEvent event) {
         } else if(event.event == GpioStartEventUsbUart) {
         } else if(event.event == GpioStartEventUsbUart) {
             scene_manager_set_scene_state(app->scene_manager, GpioSceneStart, GpioItemUsbUart);
             scene_manager_set_scene_state(app->scene_manager, GpioSceneStart, GpioItemUsbUart);
             if(!furi_hal_usb_is_locked()) {
             if(!furi_hal_usb_is_locked()) {
+                DOLPHIN_DEED(DolphinDeedGpioUartBridge);
                 scene_manager_next_scene(app->scene_manager, GpioSceneUsbUart);
                 scene_manager_next_scene(app->scene_manager, GpioSceneUsbUart);
             } else {
             } else {
                 scene_manager_next_scene(app->scene_manager, GpioSceneUsbUartCloseRpc);
                 scene_manager_next_scene(app->scene_manager, GpioSceneUsbUartCloseRpc);

+ 1 - 1
applications/main/infrared/scenes/common/infrared_scene_universal_common.c

@@ -70,7 +70,7 @@ bool infrared_scene_universal_common_on_event(void* context, SceneManagerEvent e
                 uint32_t record_count;
                 uint32_t record_count;
                 if(infrared_brute_force_start(
                 if(infrared_brute_force_start(
                        brute_force, infrared_custom_event_get_value(event.event), &record_count)) {
                        brute_force, infrared_custom_event_get_value(event.event), &record_count)) {
-                    DOLPHIN_DEED(DolphinDeedIrBruteForce);
+                    DOLPHIN_DEED(DolphinDeedIrSend);
                     infrared_scene_universal_common_show_popup(infrared, record_count);
                     infrared_scene_universal_common_show_popup(infrared, record_count);
                 } else {
                 } else {
                     scene_manager_next_scene(scene_manager, InfraredSceneErrorDatabases);
                     scene_manager_next_scene(scene_manager, InfraredSceneErrorDatabases);

+ 1 - 1
applications/main/nfc/scenes/nfc_scene_detect_reader.c

@@ -26,7 +26,7 @@ void nfc_scene_detect_reader_callback(void* context) {
 
 
 void nfc_scene_detect_reader_on_enter(void* context) {
 void nfc_scene_detect_reader_on_enter(void* context) {
     Nfc* nfc = context;
     Nfc* nfc = context;
-    DOLPHIN_DEED(DolphinDeedNfcEmulate);
+    DOLPHIN_DEED(DolphinDeedNfcDetectReader);
 
 
     detect_reader_set_callback(nfc->detect_reader, nfc_scene_detect_reader_callback, nfc);
     detect_reader_set_callback(nfc->detect_reader, nfc_scene_detect_reader_callback, nfc);
     detect_reader_set_nonces_max(nfc->detect_reader, NFC_SCENE_DETECT_READER_PAIR_NONCES_MAX);
     detect_reader_set_nonces_max(nfc->detect_reader, NFC_SCENE_DETECT_READER_PAIR_NONCES_MAX);

+ 3 - 0
applications/main/nfc/scenes/nfc_scene_mf_classic_menu.c

@@ -1,4 +1,5 @@
 #include "../nfc_i.h"
 #include "../nfc_i.h"
+#include <dolphin/dolphin.h>
 
 
 enum SubmenuIndex {
 enum SubmenuIndex {
     SubmenuIndexSave,
     SubmenuIndexSave,
@@ -35,6 +36,8 @@ bool nfc_scene_mf_classic_menu_on_event(void* context, SceneManagerEvent event)
 
 
     if(event.type == SceneManagerEventTypeCustom) {
     if(event.type == SceneManagerEventTypeCustom) {
         if(event.event == SubmenuIndexSave) {
         if(event.event == SubmenuIndexSave) {
+            DOLPHIN_DEED(DolphinDeedNfcMfcAdd);
+
             scene_manager_set_scene_state(
             scene_manager_set_scene_state(
                 nfc->scene_manager, NfcSceneMfClassicMenu, SubmenuIndexSave);
                 nfc->scene_manager, NfcSceneMfClassicMenu, SubmenuIndexSave);
             nfc->dev->format = NfcDeviceSaveFormatMifareClassic;
             nfc->dev->format = NfcDeviceSaveFormatMifareClassic;

+ 3 - 1
applications/main/nfc/scenes/nfc_scene_mf_ultralight_read_auth_result.c

@@ -14,7 +14,6 @@ void nfc_scene_mf_ultralight_read_auth_result_widget_callback(
 
 
 void nfc_scene_mf_ultralight_read_auth_result_on_enter(void* context) {
 void nfc_scene_mf_ultralight_read_auth_result_on_enter(void* context) {
     Nfc* nfc = context;
     Nfc* nfc = context;
-    DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
 
 
     // Setup dialog view
     // Setup dialog view
     FuriHalNfcDevData* nfc_data = &nfc->dev->dev_data.nfc_data;
     FuriHalNfcDevData* nfc_data = &nfc->dev->dev_data.nfc_data;
@@ -38,6 +37,7 @@ void nfc_scene_mf_ultralight_read_auth_result_on_enter(void* context) {
     widget_add_string_element(
     widget_add_string_element(
         widget, 0, 17, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(temp_str));
         widget, 0, 17, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(temp_str));
     if(mf_ul_data->auth_success) {
     if(mf_ul_data->auth_success) {
+        DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
         furi_string_printf(
         furi_string_printf(
             temp_str,
             temp_str,
             "Password: %02X %02X %02X %02X",
             "Password: %02X %02X %02X %02X",
@@ -54,6 +54,8 @@ void nfc_scene_mf_ultralight_read_auth_result_on_enter(void* context) {
             config_pages->auth_data.pack.raw[1]);
             config_pages->auth_data.pack.raw[1]);
         widget_add_string_element(
         widget_add_string_element(
             widget, 0, 39, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(temp_str));
             widget, 0, 39, AlignLeft, AlignTop, FontSecondary, furi_string_get_cstr(temp_str));
+    } else {
+        DOLPHIN_DEED(DolphinDeedNfcMfulError);
     }
     }
     furi_string_printf(
     furi_string_printf(
         temp_str, "Pages Read: %d/%d", mf_ul_data->data_read / 4, mf_ul_data->data_size / 4);
         temp_str, "Pages Read: %d/%d", mf_ul_data->data_read / 4, mf_ul_data->data_size / 4);

+ 1 - 1
applications/main/nfc/scenes/nfc_scene_set_uid.c

@@ -30,7 +30,7 @@ bool nfc_scene_set_uid_on_event(void* context, SceneManagerEvent event) {
 
 
     if(event.type == SceneManagerEventTypeCustom) {
     if(event.type == SceneManagerEventTypeCustom) {
         if(event.event == NfcCustomEventByteInputDone) {
         if(event.event == NfcCustomEventByteInputDone) {
-            DOLPHIN_DEED(DolphinDeedNfcAdd);
+            DOLPHIN_DEED(DolphinDeedNfcAddSave);
             if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSavedMenu)) {
             if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSavedMenu)) {
                 nfc->dev->dev_data.nfc_data = nfc->dev_edit_data;
                 nfc->dev->dev_data.nfc_data = nfc->dev_edit_data;
                 if(nfc_device_save(nfc->dev, nfc->dev->dev_name)) {
                 if(nfc_device_save(nfc->dev, nfc->dev->dev_name)) {

+ 3 - 0
applications/plugins/bt_hid_app/bt_hid.c

@@ -1,6 +1,7 @@
 #include "bt_hid.h"
 #include "bt_hid.h"
 #include <furi_hal_bt.h>
 #include <furi_hal_bt.h>
 #include <notification/notification_messages.h>
 #include <notification/notification_messages.h>
+#include <dolphin/dolphin.h>
 
 
 #define TAG "BtHidApp"
 #define TAG "BtHidApp"
 
 
@@ -185,6 +186,8 @@ int32_t bt_hid_app(void* p) {
     }
     }
     furi_hal_bt_start_advertising();
     furi_hal_bt_start_advertising();
 
 
+    DOLPHIN_DEED(DolphinDeedPluginStart);
+
     view_dispatcher_run(app->view_dispatcher);
     view_dispatcher_run(app->view_dispatcher);
 
 
     bt_set_status_changed_callback(app->bt, NULL, NULL);
     bt_set_status_changed_callback(app->bt, NULL, NULL);

+ 3 - 0
applications/plugins/snake_game/snake_game.c

@@ -2,6 +2,7 @@
 #include <gui/gui.h>
 #include <gui/gui.h>
 #include <input/input.h>
 #include <input/input.h>
 #include <stdlib.h>
 #include <stdlib.h>
+#include <dolphin/dolphin.h>
 #include <notification/notification.h>
 #include <notification/notification.h>
 #include <notification/notification_messages.h>
 #include <notification/notification_messages.h>
 
 
@@ -346,6 +347,8 @@ int32_t snake_game_app(void* p) {
 
 
     notification_message_block(notification, &sequence_display_backlight_enforce_on);
     notification_message_block(notification, &sequence_display_backlight_enforce_on);
 
 
+    DOLPHIN_DEED(DolphinDeedPluginGameStart);
+
     SnakeEvent event;
     SnakeEvent event;
     for(bool processing = true; processing;) {
     for(bool processing = true; processing;) {
         FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
         FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

+ 19 - 9
applications/services/dolphin/helpers/dolphin_deed.c

@@ -18,13 +18,15 @@ static const DolphinDeedWeight dolphin_deed_weights[] = {
     {1, DolphinAppNfc}, // DolphinDeedNfcRead
     {1, DolphinAppNfc}, // DolphinDeedNfcRead
     {3, DolphinAppNfc}, // DolphinDeedNfcReadSuccess
     {3, DolphinAppNfc}, // DolphinDeedNfcReadSuccess
     {3, DolphinAppNfc}, // DolphinDeedNfcSave
     {3, DolphinAppNfc}, // DolphinDeedNfcSave
+    {1, DolphinAppNfc}, // DolphinDeedNfcDetectReader
     {2, DolphinAppNfc}, // DolphinDeedNfcEmulate
     {2, DolphinAppNfc}, // DolphinDeedNfcEmulate
-    {2, DolphinAppNfc}, // DolphinDeedNfcAdd
+    {2, DolphinAppNfc}, // DolphinDeedNfcMfcAdd
+    {1, DolphinAppNfc}, // DolphinDeedNfcMfulError
+    {1, DolphinAppNfc}, // DolphinDeedNfcAddSave
 
 
     {1, DolphinAppIr}, // DolphinDeedIrSend
     {1, DolphinAppIr}, // DolphinDeedIrSend
     {3, DolphinAppIr}, // DolphinDeedIrLearnSuccess
     {3, DolphinAppIr}, // DolphinDeedIrLearnSuccess
     {3, DolphinAppIr}, // DolphinDeedIrSave
     {3, DolphinAppIr}, // DolphinDeedIrSave
-    {2, DolphinAppIr}, // DolphinDeedIrBruteForce
 
 
     {1, DolphinAppIbutton}, // DolphinDeedIbuttonRead
     {1, DolphinAppIbutton}, // DolphinDeedIbuttonRead
     {3, DolphinAppIbutton}, // DolphinDeedIbuttonReadSuccess
     {3, DolphinAppIbutton}, // DolphinDeedIbuttonReadSuccess
@@ -34,16 +36,24 @@ static const DolphinDeedWeight dolphin_deed_weights[] = {
 
 
     {3, DolphinAppBadusb}, // DolphinDeedBadUsbPlayScript
     {3, DolphinAppBadusb}, // DolphinDeedBadUsbPlayScript
     {3, DolphinAppU2f}, // DolphinDeedU2fAuthorized
     {3, DolphinAppU2f}, // DolphinDeedU2fAuthorized
+
+    {1, DolphinAppGpio}, // DolphinDeedGpioUartBridge
+
+    {1, DolphinAppPlugin}, // DolphinDeedPluginStart
+    {1, DolphinAppPlugin}, // DolphinDeedPluginGameStart
+    {10, DolphinAppPlugin}, // DolphinDeedPluginGameWin
 };
 };
 
 
 static uint8_t dolphin_deed_limits[] = {
 static uint8_t dolphin_deed_limits[] = {
-    15, // DolphinAppSubGhz
-    15, // DolphinAppRfid
-    15, // DolphinAppNfc
-    15, // DolphinAppIr
-    15, // DolphinAppIbutton
-    15, // DolphinAppBadusb
-    15, // DolphinAppU2f
+    20, // DolphinAppSubGhz
+    20, // DolphinAppRfid
+    20, // DolphinAppNfc
+    20, // DolphinAppIr
+    20, // DolphinAppIbutton
+    20, // DolphinAppBadusb
+    20, // DolphinAppU2f
+    20, // DolphinAppGpio
+    20, // DolphinAppPlugin
 };
 };
 
 
 _Static_assert(COUNT_OF(dolphin_deed_weights) == DolphinDeedMAX, "dolphin_deed_weights size error");
 _Static_assert(COUNT_OF(dolphin_deed_weights) == DolphinDeedMAX, "dolphin_deed_weights size error");

+ 12 - 2
applications/services/dolphin/helpers/dolphin_deed.h

@@ -14,6 +14,8 @@ typedef enum {
     DolphinAppIbutton,
     DolphinAppIbutton,
     DolphinAppBadusb,
     DolphinAppBadusb,
     DolphinAppU2f,
     DolphinAppU2f,
+    DolphinAppGpio,
+    DolphinAppPlugin,
     DolphinAppMAX,
     DolphinAppMAX,
 } DolphinApp;
 } DolphinApp;
 
 
@@ -34,13 +36,15 @@ typedef enum {
     DolphinDeedNfcRead,
     DolphinDeedNfcRead,
     DolphinDeedNfcReadSuccess,
     DolphinDeedNfcReadSuccess,
     DolphinDeedNfcSave,
     DolphinDeedNfcSave,
+    DolphinDeedNfcDetectReader,
     DolphinDeedNfcEmulate,
     DolphinDeedNfcEmulate,
-    DolphinDeedNfcAdd,
+    DolphinDeedNfcMfcAdd,
+    DolphinDeedNfcMfulError,
+    DolphinDeedNfcAddSave,
 
 
     DolphinDeedIrSend,
     DolphinDeedIrSend,
     DolphinDeedIrLearnSuccess,
     DolphinDeedIrLearnSuccess,
     DolphinDeedIrSave,
     DolphinDeedIrSave,
-    DolphinDeedIrBruteForce,
 
 
     DolphinDeedIbuttonRead,
     DolphinDeedIbuttonRead,
     DolphinDeedIbuttonReadSuccess,
     DolphinDeedIbuttonReadSuccess,
@@ -52,6 +56,12 @@ typedef enum {
 
 
     DolphinDeedU2fAuthorized,
     DolphinDeedU2fAuthorized,
 
 
+    DolphinDeedGpioUartBridge,
+
+    DolphinDeedPluginStart,
+    DolphinDeedPluginGameStart,
+    DolphinDeedPluginGameWin,
+
     DolphinDeedMAX,
     DolphinDeedMAX,
 
 
     DolphinDeedTestLeft,
     DolphinDeedTestLeft,