diff --git a/ZeldaHWLSaveEditor.v12.suo b/ZeldaHWLSaveEditor.v12.suo index 1dee24a..a0be79d 100644 Binary files a/ZeldaHWLSaveEditor.v12.suo and b/ZeldaHWLSaveEditor.v12.suo differ diff --git a/ZeldaHWLSaveEditor.vcxproj b/ZeldaHWLSaveEditor.vcxproj index c104aa4..e4739ea 100644 --- a/ZeldaHWLSaveEditor.vcxproj +++ b/ZeldaHWLSaveEditor.vcxproj @@ -42,10 +42,12 @@ HWLSaveEditor tmp\$(ProjectName)\$(Configuration)\ + true HWLSaveEditor tmp\$(ProjectName)\$(Configuration)\ + false @@ -58,13 +60,15 @@ true bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + bin\$(Configuration)\$(Platform)\$(TargetName).pdb - - rd /s /q "$(TargetDir)" - + + + rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" + @@ -76,21 +80,24 @@ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true true true bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + bin\$(Configuration)\$(Platform)\$(TargetName).pdb - - rd /s /q "$(TargetDir)" - + + + rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" + + + @@ -98,7 +105,9 @@ + + diff --git a/ZeldaHWLSaveEditor.vcxproj.filters b/ZeldaHWLSaveEditor.vcxproj.filters index 212dbe6..ee42b5d 100644 --- a/ZeldaHWLSaveEditor.vcxproj.filters +++ b/ZeldaHWLSaveEditor.vcxproj.filters @@ -33,6 +33,12 @@ Quelldateien + + Quelldateien + + + Quelldateien + @@ -53,6 +59,12 @@ Headerdateien + + Headerdateien + + + Headerdateien + diff --git a/ZeldaHWLSaveEditor.vcxproj.user b/ZeldaHWLSaveEditor.vcxproj.user index ef5ff2a..49d75b2 100644 --- a/ZeldaHWLSaveEditor.vcxproj.user +++ b/ZeldaHWLSaveEditor.vcxproj.user @@ -1,4 +1,12 @@  - + + WindowsLocalDebugger + bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + $(ProjectDir) + + + bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + WindowsLocalDebugger + \ No newline at end of file diff --git a/ZeldaHWLSaveEditorGUI.vcxproj b/ZeldaHWLSaveEditorGUI.vcxproj index 6526631..eb7383e 100644 --- a/ZeldaHWLSaveEditorGUI.vcxproj +++ b/ZeldaHWLSaveEditorGUI.vcxproj @@ -43,10 +43,12 @@ HWLSaveEditorGUI tmp\$(ProjectName)\$(Configuration)\ + false HWLSaveEditorGUI tmp\$(ProjectName)\$(Configuration)\ + true @@ -59,9 +61,10 @@ true bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + bin\$(Configuration)\$(Platform)\$(TargetName).pdb - rd /s /q "$(TargetDir)" + rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" @@ -79,20 +82,22 @@ NotUsing - true true true bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + bin\$(Configuration)\$(Platform)\$(TargetName).pdb - rd /s /q "$(TargetDir)" + rd /s /q "$(IntDir)" && rd /s /q "$(TargetDir)" + + @@ -101,20 +106,26 @@ + + + + + + @@ -128,4 +139,9 @@ + + + + + \ No newline at end of file diff --git a/ZeldaHWLSaveEditorGUI.vcxproj.filters b/ZeldaHWLSaveEditorGUI.vcxproj.filters index 9de3ead..55febd7 100644 --- a/ZeldaHWLSaveEditorGUI.vcxproj.filters +++ b/ZeldaHWLSaveEditorGUI.vcxproj.filters @@ -54,6 +54,18 @@ Headerdateien + + Headerdateien + + + Headerdateien + + + Headerdateien + + + Headerdateien + @@ -89,6 +101,18 @@ Quelldateien + + Quelldateien + + + Quelldateien + + + Quelldateien + + + Quelldateien + diff --git a/ZeldaHWLSaveEditorGUI.vcxproj.user b/ZeldaHWLSaveEditorGUI.vcxproj.user new file mode 100644 index 0000000..a5e419c --- /dev/null +++ b/ZeldaHWLSaveEditorGUI.vcxproj.user @@ -0,0 +1,11 @@ + + + + bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + WindowsLocalDebugger + + + bin\$(Configuration)\$(Platform)\$(TargetName)$(TargetExt) + WindowsLocalDebugger + + \ No newline at end of file diff --git a/source/console/ZeldaHWLSaveEditorConsole.rc b/source/console/ZeldaHWLSaveEditorConsole.rc index 6aec135..7c1ae3e 100644 Binary files a/source/console/ZeldaHWLSaveEditorConsole.rc and b/source/console/ZeldaHWLSaveEditorConsole.rc differ diff --git a/source/console/main.cpp b/source/console/main.cpp index 24f77c0..717b86b 100644 --- a/source/console/main.cpp +++ b/source/console/main.cpp @@ -9,12 +9,18 @@ void get_submenu(int i_menu_code); void get_ruby_menu(); void get_chara_menu(); -void change_chara_values(int i_type, int i_chara_id); +void change_chara_values(int i_choose, int i_chara_id); void get_materials_menu(); -void get_materials_submenu(int i_type); +void get_materials_submenu(int i_choose); void change_materials_values(int i_choose, int i_material_id, int i_type, int i_size); +void get_fairyFood_menu(); +void change_fairyFood_values(int i_choose, int i_fairyFood_id); + +void get_amItem_menu(); +void change_amItem_values(int i_choose); + int main() { try @@ -25,13 +31,15 @@ int main() while (1) { - cout << "Hyrule Warriors Legends - SaveEditor" << endl; - cout << "____________________________________" << endl << endl; + cout << "Hyrule Warriors Legends - SaveEditor, V1.1" << endl; + cout << "__________________________________________" << endl << endl; cout << "Menue: " << endl; cout << "1 - Rubies (Submenu)" << endl; cout << "2 - Characters (Submenu)" << endl; cout << "3 - Materials (Submenu)" << endl; + cout << "4 - FairyFood (Submenu)" << endl; + cout << "5 - Adventure Mode-Items (Submenu)" << endl; cout << "0 - Quit" << endl; cout << "Your choose: "; cin >> i_choose; @@ -52,12 +60,12 @@ int main() cin.get(); system("cls"); } - } + } } catch (HWLSaveEdit::HWLException &e) { - cout << "Hyrule Warriors Legends - SaveEditor" << endl; - cout << "____________________________________" << endl << endl; + cout << "Hyrule Warriors Legends - SaveEditor, V1.1" << endl; + cout << "__________________________________________" << endl << endl; save = nullptr; cout << e.what() << endl; } @@ -70,8 +78,6 @@ int main() void get_submenu(int i_menu_code) { - cout << "Hyrule Warriors Legends - SaveEditor" << endl; - cout << "____________________________________" << endl << endl; switch (i_menu_code) { @@ -94,6 +100,18 @@ void get_submenu(int i_menu_code) break; } + case 4: + { + get_fairyFood_menu(); + break; + } + + case 5: + { + get_amItem_menu(); + break; + } + } } @@ -607,3 +625,298 @@ void change_materials_values(int i_choose, int i_material_id, int i_type, int i_ break; } } + + + +void get_fairyFood_menu() +{ + string s_choose; + + + while (1) + { + cout << "Menue: " << endl; + cout << "1 - List Fairy-Foods (0-65) " << endl; + cout << "2 - List Fairy-Foods (66-" << save->vs_fairyFood.size()-1 << ") " << endl; + cout << "3,ID - Change Value of this Fairy-Food" << endl; + cout << "4 - Maximize Value of all Fairy-Foods " << endl; + cout << "4,ID - Maximize Value of this Fairy-Food " << endl; + cout << "5 - Maximize Value of all Gratitude Crystals " << endl; + cout << "0 - back" << endl; + cout << "Your choose: "; + cin >> s_choose; + + int i_current_id = -1; + int i_find_pos = s_choose.find(","); + if (i_find_pos != string::npos) + { + string s_substr = s_choose.substr(i_find_pos + 1, string::npos); + i_current_id = atoi(&s_substr[0u]); + } + + if (iswdigit(s_choose[0])) + { + if (atoi(&s_choose[0]) == 0) + { + system("cls"); + break; + } + else + change_fairyFood_values(atoi(&s_choose[0]), i_current_id); + } + + save->save_file(); + + if(atoi(&s_choose[0]) > 2) + system("cls"); + + } +} + + +void change_fairyFood_values(int i_choose, int i_fairyFood_id) +{ + //i_choose is number of menu-entry + + switch (i_choose) + { + case 1: + { + system("cls"); + + for (int i = 0; i <= 65; i++) + { + cout << "ID: " << i << endl << save->get_fairyFood(i)->get_FairyFoodForOutput() << endl; + } + break; + } + + case 2: + { + system("cls"); + + for (int i = 66; i < save->vs_fairyFood.size(); i++) + { + cout << "ID: " << i << endl << save->get_fairyFood(i)->get_FairyFoodForOutput() << endl; + } + break; + } + + case 3: + { + if (i_fairyFood_id == -1) + { + cout << "No ID given, please try again with an ID (eq: 3,5)" << endl; + cin.clear(); + getchar(); + cin.get(); + system("cls"); + } + else{ + bool check_id = false; + + if (i_fairyFood_id < save->vs_fairyFood.size() && i_fairyFood_id > 0) + check_id = true; + + + if (check_id) + { + string s_fairyFood_value = ""; + cout << "Enter your new Value (Max: " << HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax << ") : "; + cin >> s_fairyFood_value; + + if (iswdigit(s_fairyFood_value[0])) + { + int i_fairyFood_value = atoi(s_fairyFood_value.c_str()); + if (i_fairyFood_value > HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax) + i_fairyFood_value = HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax; + + if (i_fairyFood_value < 0) + i_fairyFood_value = 0; + + cout << "Changing Value of FairyFood with ID " << i_fairyFood_id << endl; + save->get_fairyFood(i_fairyFood_id)->set_value(i_fairyFood_value); + save->get_fairyFood(i_fairyFood_id)->save_FairyFood(); + cout << "Finish. You have now " << i_fairyFood_value << " of this FairyFood! " << endl; + + } + else + { + cout << "Sorry, wrong value, back to the last menu." << endl; + } + + } + else{ + cout << "Sorry, but this FairyFood-ID doesn't exist!" << endl; + + } + + cin.clear(); + getchar(); + cin.get(); + system("cls"); + } + break; + } + + case 4: + { + if (i_fairyFood_id == -1) + { + cout << "Maximize Value of all FairyFoods" << endl; + for (int i = 0; i < save->vs_fairyFood.size(); i++) + { + save->get_fairyFood(i)->set_value(HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + save->get_fairyFood(i)->save_FairyFood(); + } + + cout << "Finish. You have now enough of all FairyFoods!" << endl; + cin.clear(); + getchar(); + cin.get(); + system("cls"); + + } + else{ + bool check_id = false; + + if (i_fairyFood_id < save->vs_fairyFood.size() && i_fairyFood_id > 0) + check_id = true; + + if (check_id) + { + cout << "Maximize Value of FairyFood with ID " << i_fairyFood_id << endl; + save->get_fairyFood(i_fairyFood_id)->set_value(HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + save->get_fairyFood(i_fairyFood_id)->save_FairyFood(); + cout << "Finish. You have now enough of this FairyFood!" << endl; + + } + else{ + cout << "Sorry, but this FairyFood-ID doesn't exist!" << endl; + + } + + cin.clear(); + getchar(); + cin.get(); + system("cls"); + } + break; + } + + case 5: + { + cout << "Maximize Value of all Gratitude Crystals" << endl; + for (int i = HWLSaveEdit::HWLFairyFood::fairyGratitudeCrystalIDBegin; i <= HWLSaveEdit::HWLFairyFood::fairyGratitudeCrystalIDEnd; i++) + { + save->get_fairyFood(i)->set_value(HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + save->get_fairyFood(i)->save_FairyFood(); + } + + cout << "Finish. You have now enough of all Gratitude Crystals!" << endl; + cin.clear(); + getchar(); + cin.get(); + system("cls"); + } + + + default: + break; + + } +} + +void get_amItem_menu() +{ + char c_choose; + + while (1) + { + cout << "Menue: " << endl; + cout << "1 - List all Map-Items" << endl; + cout << "2 - Maximize Adventure-Map Items" << endl; + cout << "3 - Maximize GreatSea-Map Items" << endl; + cout << "4 - Maximize MasterQuest-Map Items" << endl; + cout << "0 - back" << endl; + cout << "Your choose: "; + cin >> c_choose; + + + if (iswdigit(c_choose)) + { + if (atoi(&c_choose) == 0) + { + system("cls"); + break; + } + else + change_amItem_values(atoi(&c_choose)); + } + else{ + cout << "Wrong Menu-Number, try again" << endl; + cin.get(); + cin.get(); + system("cls"); + } + + save->save_file(); + + } +} +void change_amItem_values(int i_choose) +{ + //i_choose is number of menu-entry + + switch (i_choose) + { + case 1: + { + system("cls"); + + int i_max_ids = HWLSaveEdit::HWLAdventureModeItems::amItemPerMapMax * save->get_adventureMode_maxItemCount(); + + for (int i = 0; i < i_max_ids; i++) + { + cout << save->get_amItem(i)->get_AMItemForOutput() << endl; + } + + cout << "Finish. Press a key to go back." << endl; + cin.clear(); + getchar(); + cin.get(); + system("cls"); + break; + } + + case 2: + case 3: + case 4: + { + if (i_choose == 2) + cout << "Maximize Value of all Adventure-Map Items" << endl; + else if (i_choose == 3) + cout << "Maximize Value of all GreatSea-Map Items" << endl; + else + cout << "Maximize Value of all MasterQuest-Map Items" << endl; + + for (int i = 0; i < HWLSaveEdit::HWLAdventureModeItems::amItemPerMapMax; i++) + { + save->get_amItem(i, i_choose - 2)->set_value(HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); + save->get_amItem(i, i_choose - 2)->save_AMItem(); + } + + cout << "Finish. You have now enough of those Map-Items" << endl; + cin.clear(); + getchar(); + cin.get(); + system("cls"); + break; + } + + default: + break; + + } +} + diff --git a/source/core/HWLAdventureModeItems.cpp b/source/core/HWLAdventureModeItems.cpp new file mode 100644 index 0000000..eedb57c --- /dev/null +++ b/source/core/HWLAdventureModeItems.cpp @@ -0,0 +1,118 @@ +//needed for including in a MFC-App +#ifdef __MFC__ +#include "../gui/stdafx.h" +#endif // __MFC__ + +#include "HWLAdventureModeItems.h" + +//use the project-namespace +using namespace HWLSaveEdit; + +const int HWLAdventureModeItems::amItemValueMax = 5; + +const int HWLAdventureModeItems::amItemPerMapMax = 12; + +HWLAdventureModeItems::HWLAdventureModeItems(string s_name, int i_offset, int i_type) +{ + this->s_name = s_name; + this->i_offset = i_offset; + this->i_type = i_type; + this->i_value = this->calc_value(); +} + + +HWLAdventureModeItems::~HWLAdventureModeItems() +{ +} + +int HWLAdventureModeItems::calc_value() +{ + string s_amItem_value; + int i_amItem_offset = this->i_offset; + + s_amItem_value = this->getHexStringFromFileContent(i_amItem_offset, this->amItemOffsetLength); + + int i_amItem_value= this->HexStringToInt(s_amItem_value); + + return i_amItem_value; +} + +void HWLAdventureModeItems::save_value() +{ + int i_value_tmp = this->i_value; + string s_amItem_value; + int i_amItem_offset = this->i_offset; + + s_amItem_value = this->intToHexString(i_value_tmp, false); + this->addZeroToHexString(s_amItem_value, this->amItemOffsetLength * 2); + + this->setHexStringToFileContent(s_amItem_value, i_amItem_offset); +} + +void HWLAdventureModeItems::set_value(int i_value) +{ + if (i_value < 0) + i_value = 0; + else if (i_value > this->amItemValueMax) + i_value = this->amItemValueMax; + + this->i_value = i_value; + +} + +string HWLAdventureModeItems::get_name() +{ + return this->s_name; +} + +int HWLAdventureModeItems::get_offset() +{ + return this->i_offset; +} + +int HWLAdventureModeItems::get_type() +{ + return this->i_type; +} + +string HWLAdventureModeItems::get_type(bool b_get_string) +{ + switch (this->i_type) + { + case 0: + return "Adventure-Map Item"; + break; + + case 1: + return "GreatSea-Map Item"; + break; + + case 2: + return "MasterQuest-Map Item "; + break; + + default: + return to_string(i_type); + } +} + +int HWLAdventureModeItems::get_value() +{ + return this->i_value; +} + + + +string HWLAdventureModeItems::get_AMItemForOutput() +{ + string s_output = "Name: " + this->s_name + "\n" + + " Type: " + this->get_type(true) + "\n" + + " Value: " + to_string(this->i_value) + "\n"; + + return s_output; +} + +void HWLAdventureModeItems::save_AMItem() +{ + this->save_value(); +} diff --git a/source/core/HWLAdventureModeItems.h b/source/core/HWLAdventureModeItems.h new file mode 100644 index 0000000..7889987 --- /dev/null +++ b/source/core/HWLAdventureModeItems.h @@ -0,0 +1,39 @@ +#pragma once +#include "HWLSaveEditorCore.h" + +namespace HWLSaveEdit +{ + class HWLAdventureModeItems : public HWLSaveEditorCore + { + private: + string s_name; + int i_offset; + int i_type; + int i_value; + + int calc_value(); + void save_value(); + + public: + static const int amItemValueMax; + static const int amItemPerMapMax; + + HWLAdventureModeItems(string s_name, int i_offset, int i_type); + ~HWLAdventureModeItems(); + + void set_value(int i_value); + + string get_name(); + int get_offset(); + int get_type(); + string get_type(bool b_get_string); + int get_value(); + + + string get_AMItemForOutput(); + void save_AMItem(); + + }; + +} + diff --git a/source/core/HWLException.cpp b/source/core/HWLException.cpp index f826530..52ebabe 100644 --- a/source/core/HWLException.cpp +++ b/source/core/HWLException.cpp @@ -3,7 +3,6 @@ #include "../gui/stdafx.h" #endif // __MFC__ - #include "HWLException.h" //use the project-namespace diff --git a/source/core/HWLFairyFood.cpp b/source/core/HWLFairyFood.cpp new file mode 100644 index 0000000..da369b8 --- /dev/null +++ b/source/core/HWLFairyFood.cpp @@ -0,0 +1,89 @@ +//needed for including in a MFC-App +#ifdef __MFC__ +#include "../gui/stdafx.h" +#endif // __MFC__ + +#include "HWLFairyFood.h" + +//use the project-namespace +using namespace HWLSaveEdit; + +const int HWLFairyFood::fairyFoodlValueMax = 255; + +const int HWLFairyFood::fairyGratitudeCrystalIDBegin = 114; +const int HWLFairyFood::fairyGratitudeCrystalIDEnd = 128; + +HWLFairyFood::HWLFairyFood(string s_name, int i_offset) +{ + this->s_name = s_name; + this->i_offset = i_offset; + this->i_value = this->calc_value(); +} + + +HWLFairyFood::~HWLFairyFood() +{ +} + +int HWLFairyFood::calc_value() +{ + string s_fairyFood_value; + int i_fairyFood_offset = this->i_offset; + + s_fairyFood_value = this->getHexStringFromFileContent(i_fairyFood_offset, this->fairyFoodOffsetLength); + + int i_fairyFood_value = this->HexStringToInt(s_fairyFood_value); + + return i_fairyFood_value; +} + +void HWLFairyFood::save_value() +{ + int i_value_tmp = this->i_value; + string s_fairyFood_value; + int i_fairyFood_offset = this->i_offset; + + s_fairyFood_value = this->intToHexString(i_value_tmp, false); + this->addZeroToHexString(s_fairyFood_value, this->fairyFoodOffsetLength * 2); + + this->setHexStringToFileContent(s_fairyFood_value, i_fairyFood_offset); +} + +void HWLFairyFood::set_value(int i_value) +{ + if (i_value < 0) + i_value = 0; + else if (i_value > this->fairyFoodlValueMax) + i_value = this->fairyFoodlValueMax; + + this->i_value = i_value; +} + +string HWLFairyFood::get_name() +{ + return this->s_name; +} + +int HWLFairyFood::get_offset() +{ + return this->i_offset; +} + +int HWLFairyFood::get_value() +{ + return this->i_value; +} + + +string HWLFairyFood::get_FairyFoodForOutput() +{ + string s_output = "Name: " + this->s_name + "\n" + + " Value: " + to_string(this->i_value) + "\n"; + + return s_output; +} + +void HWLFairyFood::save_FairyFood() +{ + this->save_value(); +} diff --git a/source/core/HWLFairyFood.h b/source/core/HWLFairyFood.h new file mode 100644 index 0000000..680ff5b --- /dev/null +++ b/source/core/HWLFairyFood.h @@ -0,0 +1,36 @@ +#pragma once +#include "HWLSaveEditorCore.h" + +//add the class to the project-namespace +namespace HWLSaveEdit +{ + class HWLFairyFood : public HWLSaveEditorCore + { + private: + string s_name; + int i_offset; + int i_value; + + int calc_value(); + void save_value(); + + public: + static const int fairyFoodlValueMax; + static const int fairyGratitudeCrystalIDBegin; + static const int fairyGratitudeCrystalIDEnd; + + HWLFairyFood(string s_name, int i_offset); + ~HWLFairyFood(); + + void set_value(int i_value); + + string get_name(); + int get_offset(); + int get_value(); + + string get_FairyFoodForOutput(); + void save_FairyFood(); + }; + +} + diff --git a/source/core/HWLSaveEditor.cpp b/source/core/HWLSaveEditor.cpp index 96a5614..d9c5757 100644 --- a/source/core/HWLSaveEditor.cpp +++ b/source/core/HWLSaveEditor.cpp @@ -11,25 +11,22 @@ using namespace HWLSaveEdit; //offsets definitions -/* @var rubyOffset the offset-begin for rubies */ +/* @var fileHeaderOffsetBegin the offset-begin for the file-header */ const int HWLSaveEditor::fileHeaderOffsetBegin = 0x0; -/* @var rubyOffset the offset-begin for rubies */ +/* @var rubyOffset the offset-begin for rubies */ const int HWLSaveEditor::rubyOffset = 0xde; -/* @var rubyOffsetLength length for ruby-offset */ +/* @var rubyOffsetLength length for ruby-offset */ const int HWLSaveEditor::rubyOffsetLength = 0x3; -/* @var rubyMax max value for rubies */ +/* @var rubyMax max value for rubies */ const int HWLSaveEditor::rubyMax = 9999999; -/* @var playerOffsetBegin beginning of player-offsets (first character) */ +/* @var playerOffsetBegin beginning of player-offsets (first character) */ const int HWLSaveEditor::playerOffsetBegin = 0x2EBF2; -/* @var playerOffsetLength length of one player/character */ -const int HWLSaveEditor::playerOffsetLength = 0x30; - -/* @var vs_players vector for holding all names of the characters */ +/* @var vs_players vector for holding all names of the characters */ const vector HWLSaveEditor::vs_players = { "Link", @@ -195,6 +192,233 @@ const vector HWLSaveEditor::vs_goldMaterials = "King Daphnes's Crown", }; +/* @var fairyFoodOffsetBegin offset begin of first fairyfood-item */ +const int HWLSaveEditor::fairyFoodOffsetBegin = 0x233A; + +/* @var vs_fairyFood vector for holding all names of fairyFood-Items */ +const vector HWLSaveEditor::vs_fairyFood = +{ + "Weird Egg", + "Tasty Weird Egg", + "Delicious Weird Egg", + "Lon Lon Milk", + "Tasty Lon Lon Milk", + "Delicious Lon Lon Milk", + "Odd Mushroom", + "Tasty Odd Mushroom", + "Delicious Odd Mushroom", + "Deku Nut", + "Tasty Deku Nut", + "Delicious Deku Nut", + "Magic Beans", + "Tasty Magic Beans", + "Delicious Magic Beans", + "Pumpkin Soup", + "Tasty Pumpkin Soup", + "Delicious Pumpkin Soup", + "Sacred Water", + "Tasty Sacred Water", + "Delicious Sacred Water", + "Life Tree Fruit", + "Tasty Life Tree Fruit", + "Delicious Life Tree Fruit", + "Light Fruit", + "Tasty Light Fruit", + "Delicious Light Fruit", + "Stamina Fruit", + "Tasty Stamina Fruit", + "Delicious Stamina Fruit", + "Water Fruit", + "Tasty Water Fruit", + "Delicious Water Fruit", + "Mushroom Spores", + "Tasty Mushroom Spores", + "Delicious Mushroom Spores", + "All-Purpose Bait", + "Tasty All-Purpose Bait", + "Delicious All-Purpose Bait", + "Elixir Soup", + "Tasty Elixir Soup", + "Delicious Elixir Soup", + "Hyoi Pear", + "Tasty Hyoi Pear", + "Delicious Hyoi Pear", + "Ordon Goat Cheese", + "Tasty Ordon Goat Cheese", + "Delicious Ordon Goat Cheese", + "Great Fairy's Tears", + "Tasty Great Fairy's Tears", + "Delicious Great Fairy's Tears", + "Greengill", + "Tasty Greengill", + "Delicious Greengill", + "Ordon Catfish", + "Tasty Ordon Catfish", + "Delicious Ordon Catfish", + "Hyrule Bass", + "Tasty Hyrule Bass", + "Delicious Hyrule Bass", + "Hylian Pike", + "Tasty Hylian Pike", + "Delicious Hylian Pike", + "Reekfish", + "Tasty Reekfish", + "Delicious Reekfish", + "Hylian Loach", + "Tasty Hylian Loach", + "Delicious Hylian Loach", + "Skullfish", + "Tasty Skullfish", + "Delicious Skullfish", + "Bombfish", + "Tasty Bombfish", + "Delicious Bombfish", + "Chu Jelly", + "Tasty Chu Jelly", + "Delicious Chu Jelly", + "Bee Larvae", + "Tasty Bee Larvae", + "Delicious Bee Larvae", + "Chateau Romani", + "Tasty Chateau Romani", + "Delicious Chateau Romani", + "Bottled Water", + "Tasty Bottled Water", + "Delicious Bottled Water", + "Hot Spring Water", + "Tasty Hot Spring Water", + "Delicious Hot Spring Water", + "Rock Sirloin", + "Tasty Rock Sirloin", + "Delicious Rock Sirloin", + "Meat", + "Tasty Meat", + "Delicious Meat", + "Carrot", + "Tasty Carrot", + "Delicious Carrot", + "Ember Seeds", + "Tasty Ember Seeds", + "Delicious Ember Seeds", + "Scent Seeds", + "Tasty Scent Seeds", + "Delicious Scent Seeds", + "Pegasus Seeds", + "Tasty Pegasus Seeds", + "Delicious Pegasus Seeds", + "Gale Seeds", + "Tasty Gale Seeds", + "Delicious Gale Seeds", + "Mystery Seeds", + "Tasty Mystery Seeds", + "Delicious Mystery Seeds", + "Gratitude Crystal Red S", + "Gratitude Crystal Red M", + "Gratitude Crystal Red L", + "Gratitude Crystal Blue S", + "Gratitude Crystal Blue M", + "Gratitude Crystal Blue L", + "Gratitude Crystal Orange S", + "Gratitude Crystal Orange M", + "Gratitude Crystal Orange L", + "Gratitude Crystal Pink S", + "Gratitude Crystal Pink M", + "Gratitude Crystal Pink L", + "Gratitude Crystal Purple S", + "Gratitude Crystal Purple M", + "Gratitude Crystal Purple L", + "Pumpkin", + "Tasty Pumpkin", + "Delicious Pumpkin" +}; + +/* @var amItemOffsetBegin vector for holding the offsets-begin for AdventureMode items */ +const vector HWLSaveEditor::amItemOffsetBegin = +{ + 0x2EFA, //Start of Adventure-Map Items + 0xEB73, //Start of GreatSea-Map Items (WindWaker and so on) + 0x7A52, //Start of MasterQuest-Map Items +}; + +/* @var amItemOffsetBegin vector for holding the offsets-begin for AdventureMode items */ +const vector HWLSaveEditor::amItemOffsetBeginSpecial = +{ + 0xEB56, //Compass of GreatSea-Map + 0xEB5F //Hookshot of GreatSea-Map +}; + + +/* @var vs_amItems vector for holding all names of AdventureMode-Items */ +const vector HWLSaveEditor::vs_amItems = +{ + "Compass", //Adventure-Map Items Begin + "Bombs", + "Candle", + "Ladder", + "Power Bracelet", + "Water Bombs", + "Digging Mitts", + "Ice Arrow", + "Raft", + "Hookshot", + "Recorder", + "Goddess's Harp", //Adventure-Map Items End + + "Compass", //GreatSea-Map Items Begin + "Hookshot", + "Wind Waker", + "Cannon", + "Boomerang", + "Hero's Bow", + "Grappling Hook", + "Hyoi Pears", + "Deku Leaf", + "Sea Chart", + "Power Bracelet", + "Hammer", //GreatSea-Map Items End + + "Compass", //MasterQuest-Map Items Begin + "Bombs", + "Candle", + "Ladder", + "Power Bracelet", + "Water Bombs", + "Digging Mitts", + "Ice Arrow", + "Raft", + "Hookshot", + "Recorder", + "Goddess's Harp", //MasterQuest-Map Items End + + "Compass", //Twilight-Map Items Begin + "Lantern", + "Bombs", + "Jar", + "Fishing Rod", + "Clawshot", + "Spinner", + "Water Bombs", + "Digging Mitts", + "Ooccoo", + "Tears of Light", + "Tears of Twilight", //Twilight-Map Items End + + "Compass", //Termina-Map Items Begin + "Deku Mask", + "Goron Mask", + "Zora Mask", + "Mask of Truth", + "Majora's Mask", + "Deku Stick", + "Bombs", + "Ice Arrow", + "Song of Time", + "Inverted Song of Time", + "Giants" //Termina-Map Items End + + +}; + HWLSaveEditor::HWLSaveEditor(string s_filepathname) { //set the needed values for the file and program @@ -223,6 +447,8 @@ HWLSaveEditor::HWLSaveEditor(string s_filepathname) this->i_rubies = this->calc_rubies(); this->calc_players(); this->calc_materials(); + this->calc_fairyFood(); + this->calc_amItems(); } else{ this->i_error = 400; @@ -318,6 +544,52 @@ void HWLSaveEditor::calc_materials() } } +void HWLSaveEditor::calc_fairyFood() +{ + int i_offset = this->fairyFoodOffsetBegin; + + for (int i = 0; i < this->vs_fairyFood.size(); i++) + { + shared_ptr hwlff_tmp = make_shared(vs_fairyFood[i], i_offset); + this->m_fairyfood[this->vs_fairyFood[i]] = hwlff_tmp; + i_offset = i_offset + this->fairyFoodOffsetLength; + } + +} + +void HWLSaveEditor::calc_amItems() +{ + int i_offset = this->amItemOffsetBegin[0]; + int i_type = 0; + + for (int i = 0; i < this->vs_amItems.size(); i++) + { + if (i == HWLSaveEdit::HWLAdventureModeItems::amItemPerMapMax * (i_type + 1)) + { + i_type++; + + if (i_type == this->amItemOffsetBegin.size()) + break; + + if (i == 12) + i_offset = this->amItemOffsetBeginSpecial[0]; + else + i_offset = this->amItemOffsetBegin[i_type]; + } + + if (i == 13) + i_offset = this->amItemOffsetBeginSpecial[1]; + else if (i == 14) + i_offset = this->amItemOffsetBegin[i_type]; + + + shared_ptr hwlami_tmp = make_shared(vs_amItems[i], i_offset, i_type); + this->m_amItem[i] = hwlami_tmp; + i_offset = i_offset + this->amItemOffsetLength; + } + +} + void HWLSaveEditor::save_rubies() { int i_ruby_tmp = this->i_rubies; @@ -382,6 +654,45 @@ shared_ptr HWLSaveEditor::get_material(string s_name) return hwlm_tmp; } +shared_ptr HWLSaveEditor::get_fairyFood(int i_id) +{ + shared_ptr hwlff_tmp = this->m_fairyfood[this->vs_fairyFood[i_id]]; + + return hwlff_tmp; +} + +shared_ptr HWLSaveEditor::get_fairyFood(string s_name) +{ + shared_ptr hwlff_tmp = this->m_fairyfood[s_name]; + + return hwlff_tmp; +} + +shared_ptr HWLSaveEditor::get_amItem(int i_id) +{ + shared_ptr hwlami_tmp = this->m_amItem[i_id]; + + return hwlami_tmp; +} + +shared_ptr HWLSaveEditor::get_amItem(int i_id, int i_type) +{ + if (i_type >= this->amItemOffsetBegin.size()) + i_type = 0; + + if (i_type != 0) + i_id = i_id + (HWLSaveEdit::HWLAdventureModeItems::amItemPerMapMax * i_type); + + shared_ptr hwlami_tmp = this->m_amItem[i_id]; + + return hwlami_tmp; +} + +int HWLSaveEditor::get_adventureMode_maxItemCount() +{ + return this->amItemOffsetBegin.size(); +} + void HWLSaveEditor::set_rubies(int i_rubies) { diff --git a/source/core/HWLSaveEditor.h b/source/core/HWLSaveEditor.h index 6d71350..ead0214 100644 --- a/source/core/HWLSaveEditor.h +++ b/source/core/HWLSaveEditor.h @@ -6,9 +6,11 @@ //include the other needed classes #include "HWLSaveEditorCore.h" +#include "HWLException.h" #include "HWLPlayer.h" #include "HWLMaterial.h" -#include "HWLException.h" +#include "HWLFairyFood.h" +#include "HWLAdventureModeItems.h" //add the class to the project-namespace namespace HWLSaveEdit{ @@ -40,7 +42,6 @@ namespace HWLSaveEdit{ static const int rubyOffsetLength; static const int playerOffsetBegin; - static const int playerOffsetLength; static const int bronzeMaterialsOffsetBegin; static const int bronzeMaterialsOffsetBeginNew; @@ -52,16 +53,29 @@ namespace HWLSaveEdit{ static const int goldMaterialsOffsetBegin; static const int goldMaterialsOffsetBeginNew; + static const int fairyFoodOffsetBegin; + + static const vector amItemOffsetBegin; + static const vector amItemOffsetBeginSpecial; + /* @var m_players map for holding all playable characters */ map< string, shared_ptr > m_players; /* @var m_materials map for holding all foundable materials */ map< string, shared_ptr > m_materials; - //calculate methods for player/material + /* @var m_fairyfood map for holding all foundable fairyfood items */ + map< string, shared_ptr > m_fairyfood; + + /* @var m_amItem map for holding all foundable Adventure-Mode items */ + map< int, shared_ptr > m_amItem; + + //calculate methods for player, material and fairyFood int calc_rubies(); void calc_players(); void calc_materials(); + void calc_fairyFood(); + void calc_amItems(); //save new ruby-value void save_rubies(); @@ -74,6 +88,8 @@ namespace HWLSaveEdit{ static const vector vs_bronzeMaterials; static const vector vs_silverMaterials; static const vector vs_goldMaterials; + static const vector vs_fairyFood; + static const vector vs_amItems; HWLSaveEditor(string s_filepathname = "zmha.bin"); ~HWLSaveEditor(); @@ -85,6 +101,14 @@ namespace HWLSaveEdit{ shared_ptr get_player(string s_name); shared_ptr get_material(int i_id, int i_type); shared_ptr get_material(string s_name); + shared_ptr get_fairyFood(int i_id); + shared_ptr get_fairyFood(string s_name); + shared_ptr get_amItem(int i_id); + shared_ptr get_amItem(int i_id, int i_type); + + //special getter for the size of current adventure-mode-offsets vector + //todo: delete if we have all offsets + int get_adventureMode_maxItemCount(); //setter for rubies void set_rubies(int i_rubies); diff --git a/source/core/HWLSaveEditorCore.cpp b/source/core/HWLSaveEditorCore.cpp index 206e462..21a3147 100644 --- a/source/core/HWLSaveEditorCore.cpp +++ b/source/core/HWLSaveEditorCore.cpp @@ -11,9 +11,18 @@ using namespace HWLSaveEdit; //initialize the static-member unsigned char* HWLSaveEditorCore::cp_filecontent = 0; +/* @var playerOffsetLength length of one player/character */ +const int HWLSaveEditorCore::playerOffsetLength = 0x30; + /* @var materialOffsetLength length for all material-offsets */ const int HWLSaveEditorCore::materialOffsetLength = 0x2; +/* @var fairyFoodOffsetLength length for all fairyFood-offsets */ +const int HWLSaveEditorCore::fairyFoodOffsetLength = 0x1; + +/* @var amItemOffsetLength length for all adventureMode-Item-offsets */ +const int HWLSaveEditorCore::amItemOffsetLength = 0x1; + /** * Only the initialization of the normal-constructor */ diff --git a/source/core/HWLSaveEditorCore.h b/source/core/HWLSaveEditorCore.h index 7553cba..1c42a72 100644 --- a/source/core/HWLSaveEditorCore.h +++ b/source/core/HWLSaveEditorCore.h @@ -19,7 +19,10 @@ namespace HWLSaveEdit */ static unsigned char* cp_filecontent; + static const int playerOffsetLength; static const int materialOffsetLength; + static const int fairyFoodOffsetLength; + static const int amItemOffsetLength; public: /* Constructor and pure-virtual Destructor diff --git a/source/gui/ZeldaEditAdventureModeItem.cpp b/source/gui/ZeldaEditAdventureModeItem.cpp new file mode 100644 index 0000000..92ac480 --- /dev/null +++ b/source/gui/ZeldaEditAdventureModeItem.cpp @@ -0,0 +1,348 @@ +// ZeldaEditAdventureModeItem.cpp: Implementierungsdatei +// + +#include "stdafx.h" +#include "ZeldaHWLSaveEditorGUI.h" +#include "ZeldaEditAdventureModeItem.h" +#include "afxdialogex.h" + + +// CZeldaEditAdventureModeItem-Dialogfeld + +IMPLEMENT_DYNAMIC(CZeldaEditAdventureModeItem, CDialogEx) + +CZeldaEditAdventureModeItem::CZeldaEditAdventureModeItem(CWnd* pParent /*=NULL*/, int i_type) + : CDialogEx(CZeldaEditAdventureModeItem::IDD, pParent) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + this->i_type = i_type; + this->i_map = i_type+1; +} + +CZeldaEditAdventureModeItem::~CZeldaEditAdventureModeItem() +{ +} + +void CZeldaEditAdventureModeItem::DoDataExchange(CDataExchange* pDX) +{ + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + //menu + CMenu *cm_menu = GetMenu(); + CMenu* cm_submenu = cm_menu->GetSubMenu(1); + cm_submenu->CheckMenuItem(4, MF_CHECKED | MF_BYPOSITION); + + //own inits + save = CZeldaHWLSaveEditorGUIApp::save; + + if (save != nullptr) + { + if (this->i_type > -1) + { + cm_submenu = cm_submenu->GetSubMenu(4); + + for (int i = 0; i < save->get_adventureMode_maxItemCount(); i++) + { + cm_submenu->CheckMenuItem(i, MF_UNCHECKED | MF_BYPOSITION); + } + + cm_submenu->CheckMenuItem(this->i_type, MF_CHECKED | MF_BYPOSITION); + this->i_map_max = save->get_adventureMode_maxItemCount(); + CString cs_amItem_type(save->get_amItem(0,this->i_type)->get_type(true).c_str()); + cs_amItem_type.Replace(L" Item", L""); + SetDlgItemText(IDC_AM_MAPNAME, cs_amItem_type); + + + if (this->i_map <= 1) + GetDlgItem(IDC_AMITEM_PAGE_PREVIOUS)->EnableWindow(false); + else + GetDlgItem(IDC_AMITEM_PAGE_PREVIOUS)->EnableWindow(true); + + if (this->i_map >= this->i_map_max) + GetDlgItem(IDC_AMITEM_PAGE_NEXT)->EnableWindow(false); + else + GetDlgItem(IDC_AMITEM_PAGE_NEXT)->EnableWindow(true); + + + for (int i = IDC_EDIT_AMITEM1; i <= IDC_EDIT_AMITEM12; i++) + { + GetDlgItem(i)->EnableWindow(true); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + } + + for (int i = IDC_STATIC_AMITEM1; i <= IDC_STATIC_AMITEM12; i++) + { + GetDlgItem(i)->EnableWindow(true); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + } + + + CString s_map_count; + s_map_count.Format(L"%d / %d", this->i_map, this->i_map_max); + SetDlgItemText(IDC_STATIC_MAP_COUNT, s_map_count); + + this->calc_amItems(); + } + }else + { + SetDlgItemText(IDC_AM_MAPNAME, L""); + + for (int i = IDC_EDIT_AMITEM1; i <= IDC_EDIT_AMITEM12; i++) + { + SetDlgItemText(i, L""); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + GetDlgItem(i)->EnableWindow(false); + } + + for (int i = IDC_STATIC_AMITEM1; i <= IDC_STATIC_AMITEM12; i++) + { + SetDlgItemText(i, L"AM-Items"); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + } + + SetDlgItemText(IDC_STATIC_MAP_COUNT, L"0 / 0"); + GetDlgItem(IDC_AMITEM_PAGE_PREVIOUS)->EnableWindow(false); + GetDlgItem(IDC_AMITEM_PAGE_NEXT)->EnableWindow(false); + } + + + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CZeldaEditAdventureModeItem, CDialogEx) + ON_COMMAND(ID_MENU_MAIN_EXIT, &CZeldaEditAdventureModeItem::OnMenuMainExit) + ON_COMMAND(ID_MENU_EDIT_GENERAL, &CZeldaEditAdventureModeItem::OnMenuEditGeneral) + ON_COMMAND(ID_MENU_EDIT_CHARACTERS_STATS, &CZeldaEditAdventureModeItem::OnMenuEditCharactersStats) + ON_COMMAND(ID_MENU_EDIT_MATERIALS_BRONZE, &CZeldaEditAdventureModeItem::OnMenuEditMaterialsBronze) + ON_COMMAND(ID_MENU_EDIT_MATERIALS_SILVER, &CZeldaEditAdventureModeItem::OnMenuEditMaterialsSilver) + ON_COMMAND(ID_MENU_EDIT_MATERIALS_GOLD, &CZeldaEditAdventureModeItem::OnMenuEditMaterialsGold) + ON_COMMAND(ID_MENU_EDIT_FAIRYFOODS, &CZeldaEditAdventureModeItem::OnMenuEditFairyfoods) + ON_BN_CLICKED(ID_SAVE, &CZeldaEditAdventureModeItem::OnBnClickedSave) + ON_BN_CLICKED(ID_EXIT, &CZeldaEditAdventureModeItem::OnBnClickedExit) + ON_BN_CLICKED(IDC_AMITEM_PAGE_PREVIOUS, &CZeldaEditAdventureModeItem::OnBnClickedAMItemPagePrevious) + ON_BN_CLICKED(IDC_AMITEM_PAGE_NEXT, &CZeldaEditAdventureModeItem::OnBnClickedAMItemPageNext) + ON_CONTROL_RANGE(EN_CHANGE, IDC_EDIT_AMITEM1, IDC_EDIT_AMITEM12, &OnEnChangeValueEdit) + ON_COMMAND(ID_MENU_EDIT_AM_AVMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmAvmap) + ON_COMMAND(ID_MENU_EDIT_AM_GSMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmGsmap) + ON_COMMAND(ID_MENU_EDIT_AM_MQMAP, &CZeldaEditAdventureModeItem::OnMenuEditAmMqmap) + ON_BN_CLICKED(IDC_AMITEM_MAX_VALUE_MAP, &CZeldaEditAdventureModeItem::OnBnClickedAmitemMaxValueMap) +END_MESSAGE_MAP() + + +// CZeldaEditAdventureModeItem-Meldungshandler +void CZeldaEditAdventureModeItem::OnMenuMainExit() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem::OnOK(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditGeneral() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditGeneralDlg dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditCharactersStats() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditCharaStatsDlg dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditMaterialsBronze() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditMaterials dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditMaterialsSilver() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditMaterials dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditMaterialsGold() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditMaterials dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditFairyfoods() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditFairyFoods dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditAdventureModeItem::OnBnClickedSave() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + try + { + this->save_amItems(); + save->save_file(); + } + catch (std::exception &e) + { + CString str(e.what()); + MessageBox(str, L"Error"); + } + } + else{ + CString str("There is no SaveFile opened!"); + MessageBox(str, L"Error"); + } +} + +void CZeldaEditAdventureModeItem::OnBnClickedExit() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + CZeldaEditAdventureModeItem::OnOK(); +} + +void CZeldaEditAdventureModeItem::OnBnClickedAMItemPagePrevious() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + this->save_amItems(); + this->i_map--; + this->i_type--; + this->UpdateData(); +} + + +void CZeldaEditAdventureModeItem::OnBnClickedAMItemPageNext() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + this->save_amItems(); + this->i_map++; + this->i_type++; + this->UpdateData(); +} + +void CZeldaEditAdventureModeItem::OnMenuEditAmAvmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + if (this->i_type != 0) + { + CZeldaEditAdventureModeItem dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); + } +} + + +void CZeldaEditAdventureModeItem::OnMenuEditAmGsmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + if (this->i_type != 1) + { + CZeldaEditAdventureModeItem dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); + } + +} + + +void CZeldaEditAdventureModeItem::OnMenuEditAmMqmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + if (this->i_type != 2) + { + CZeldaEditAdventureModeItem dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); + } + +} + + +void CZeldaEditAdventureModeItem::calc_amItems() +{ + for (int i = 0; i < this->maxAMItemsShown; i++) + { + CString s_amItem_name(save->get_amItem(i, this->i_type)->get_name().c_str()); + CString s_amItem_value; + s_amItem_value.Format(L"%d", save->get_amItem(i, this->i_type)->get_value()); + + SetDlgItemText((IDC_STATIC_AMITEM1 + i), s_amItem_name + L": "); + SetDlgItemText((IDC_EDIT_AMITEM1 + i), s_amItem_value); + + CEdit *e_test = (CEdit*)GetDlgItem((IDC_EDIT_AMITEM1 + i)); + e_test->SetLimitText(2); + + } +} + +void CZeldaEditAdventureModeItem::save_amItems() +{ + for (int i = 0; i < this->maxAMItemsShown; i++) + { + CString s_amItem_value; + + GetDlgItemText((IDC_EDIT_AMITEM1 + i), s_amItem_value); + int i_amItem_value = _wtof(s_amItem_value); + + save->get_amItem(i, this->i_type)->set_value(i_amItem_value); + save->get_amItem(i, this->i_type)->save_AMItem(); + } +} + +void CZeldaEditAdventureModeItem::OnEnChangeValueEdit(UINT nID) +{ + if (SendDlgItemMessage(nID, EM_GETMODIFY, 0, 0)) + { + if (save != nullptr) + { + CString test; + CEdit *e_test = (CEdit*)GetDlgItem(nID); + e_test->SetLimitText(2); + GetDlgItemText(nID, test); + int i_test = _wtoi(test); + + if (i_test > HWLSaveEdit::HWLAdventureModeItems::amItemValueMax) + { + test.Format(L"%d", HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); + SetDlgItemText(nID, test); + e_test->SetLimitText(1); + } + + } + } +} + +void CZeldaEditAdventureModeItem::OnBnClickedAmitemMaxValueMap() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + for (int i = 0; i < this->maxAMItemsShown; i++) + { + save->get_amItem(i, this->i_type)->set_value(HWLSaveEdit::HWLAdventureModeItems::amItemValueMax); + save->get_amItem(i, this->i_type)->save_AMItem(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } + +} diff --git a/source/gui/ZeldaEditAdventureModeItem.h b/source/gui/ZeldaEditAdventureModeItem.h new file mode 100644 index 0000000..2799750 --- /dev/null +++ b/source/gui/ZeldaEditAdventureModeItem.h @@ -0,0 +1,53 @@ +#pragma once + + +// CZeldaEditAdventureModeItem-Dialogfeld + +class CZeldaEditAdventureModeItem : public CDialogEx +{ + DECLARE_DYNAMIC(CZeldaEditAdventureModeItem) + +public: + CZeldaEditAdventureModeItem(CWnd* pParent = NULL, int i_type = -1); // Standardkonstruktor + virtual ~CZeldaEditAdventureModeItem(); + +// Dialogfelddaten + enum { IDD = IDD_EDIT_AMITEM }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + + HICON m_hIcon; + HWLSaveEdit::HWLSaveEditor *save; + int i_type; + int i_map; + int i_map_max; + const int maxAMItemsShown = 12; + + DECLARE_MESSAGE_MAP() + + //own methods + void calc_amItems(); + void save_amItems(); + +public: + + afx_msg void OnEnChangeValueEdit(UINT nID); + + afx_msg void OnMenuMainExit(); + afx_msg void OnMenuEditGeneral(); + afx_msg void OnMenuEditCharactersStats(); + afx_msg void OnMenuEditMaterialsBronze(); + afx_msg void OnMenuEditMaterialsSilver(); + afx_msg void OnMenuEditMaterialsGold(); + afx_msg void OnMenuEditFairyfoods(); + + afx_msg void OnBnClickedSave(); + afx_msg void OnBnClickedExit(); + afx_msg void OnBnClickedAMItemPagePrevious(); + afx_msg void OnBnClickedAMItemPageNext(); + afx_msg void OnMenuEditAmAvmap(); + afx_msg void OnMenuEditAmGsmap(); + afx_msg void OnMenuEditAmMqmap(); + afx_msg void OnBnClickedAmitemMaxValueMap(); +}; diff --git a/source/gui/ZeldaEditCharaStatsDlg.cpp b/source/gui/ZeldaEditCharaStatsDlg.cpp index e1ff8ee..4d6d23a 100644 --- a/source/gui/ZeldaEditCharaStatsDlg.cpp +++ b/source/gui/ZeldaEditCharaStatsDlg.cpp @@ -118,6 +118,13 @@ BEGIN_MESSAGE_MAP(CZeldaEditCharaStatsDlg, CDialogEx) ON_COMMAND(ID_MENU_EDIT_MATERIALS_SILVER, &CZeldaEditCharaStatsDlg::OnMenuEditMaterialsSilver) ON_COMMAND(ID_MENU_EDIT_MATERIALS_GOLD, &CZeldaEditCharaStatsDlg::OnMenuEditMaterialsGold) ON_COMMAND(ID_MENU_MAIN_EXIT, &CZeldaEditCharaStatsDlg::OnMenuMainExit) + ON_COMMAND(ID_MENU_EDIT_FAIRYFOODS, &CZeldaEditCharaStatsDlg::OnMenuEditFairyfoods) + ON_COMMAND(ID_MENU_EDIT_AM_AVMAP, &CZeldaEditCharaStatsDlg::OnMenuEditAmAvmap) + ON_COMMAND(ID_MENU_EDIT_AM_GSMAP, &CZeldaEditCharaStatsDlg::OnMenuEditAmGsmap) + ON_COMMAND(ID_MENU_EDIT_AM_MQMAP, &CZeldaEditCharaStatsDlg::OnMenuEditAmMqmap) + ON_BN_CLICKED(IDC_CHARA_MAX_EXP_ALL, &CZeldaEditCharaStatsDlg::OnBnClickedCharaMaxExpAll) + ON_BN_CLICKED(IDC_CHARA_MAX_ATK_ALL, &CZeldaEditCharaStatsDlg::OnBnClickedCharaMaxAtkAll) + ON_BN_CLICKED(IDC_CHARA_UNLOCK_ALL, &CZeldaEditCharaStatsDlg::OnBnClickedCharaUnlockAll) END_MESSAGE_MAP() @@ -373,3 +380,133 @@ void CZeldaEditCharaStatsDlg::OnMenuMainExit() CZeldaEditCharaStatsDlg::OnOK(); } + + +void CZeldaEditCharaStatsDlg::OnMenuEditFairyfoods() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditFairyFoods dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditCharaStatsDlg::OnMenuEditAmAvmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditCharaStatsDlg::OnMenuEditAmGsmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditCharaStatsDlg::OnMenuEditAmMqmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditCharaStatsDlg::OnBnClickedCharaMaxExpAll() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + + if (save != nullptr) + { + int unused_charas = 0; + + for (int i = 0; i < save->vs_players.size(); i++) + { + CString s_player_name(save->get_player(i)->get_name().c_str()); + + if (s_player_name == L"???") + { + unused_charas++; + continue; + } + + save->get_player(i)->set_exp(HWLSaveEdit::HWLPlayer::playerEXPMax); + save->get_player(i)->save_Player(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } + +} + + +void CZeldaEditCharaStatsDlg::OnBnClickedCharaMaxAtkAll() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + + if (save != nullptr) + { + int unused_charas = 0; + + for (int i = 0; i < save->vs_players.size(); i++) + { + CString s_player_name(save->get_player(i)->get_name().c_str()); + + if (s_player_name == L"???") + { + unused_charas++; + continue; + } + + save->get_player(i)->set_atk(HWLSaveEdit::HWLPlayer::playerATKMax); + save->get_player(i)->save_Player(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + + } +} + + +void CZeldaEditCharaStatsDlg::OnBnClickedCharaUnlockAll() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + + if (save != nullptr) + { + int unused_charas = 0; + + for (int i = 0; i < save->vs_players.size(); i++) + { + CString s_player_name(save->get_player(i)->get_name().c_str()); + CButton *cb_check; + + if (s_player_name == L"???") + { + unused_charas++; + continue; + } + + save->get_player(i)->set_isUnlock(true); + save->get_player(i)->save_Player(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + + } +} diff --git a/source/gui/ZeldaEditCharaStatsDlg.h b/source/gui/ZeldaEditCharaStatsDlg.h index ebdf7cc..a1b0e58 100644 --- a/source/gui/ZeldaEditCharaStatsDlg.h +++ b/source/gui/ZeldaEditCharaStatsDlg.h @@ -40,5 +40,12 @@ class CZeldaEditCharaStatsDlg : public CDialogEx afx_msg void OnMenuEditMaterialsSilver(); afx_msg void OnMenuEditMaterialsGold(); afx_msg void OnMenuMainExit(); + afx_msg void OnMenuEditFairyfoods(); + afx_msg void OnMenuEditAmAvmap(); + afx_msg void OnMenuEditAmGsmap(); + afx_msg void OnMenuEditAmMqmap(); + afx_msg void OnBnClickedCharaMaxExpAll(); + afx_msg void OnBnClickedCharaMaxAtkAll(); + afx_msg void OnBnClickedCharaUnlockAll(); }; diff --git a/source/gui/ZeldaEditFairyFoods.cpp b/source/gui/ZeldaEditFairyFoods.cpp new file mode 100644 index 0000000..4d41351 --- /dev/null +++ b/source/gui/ZeldaEditFairyFoods.cpp @@ -0,0 +1,407 @@ +// ZeldaEditFairyFoods.cpp: Implementierungsdatei +// + +#include "stdafx.h" +#include "ZeldaHWLSaveEditorGUI.h" +#include "ZeldaEditFairyFoods.h" +#include "afxdialogex.h" + + +// CZeldaEditFairyFoods-Dialogfeld + +IMPLEMENT_DYNAMIC(CZeldaEditFairyFoods, CDialogEx) + +CZeldaEditFairyFoods::CZeldaEditFairyFoods(CWnd* pParent /*=NULL*/) + : CDialogEx(CZeldaEditFairyFoods::IDD, pParent) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + this->i_page = 1; +} + +CZeldaEditFairyFoods::~CZeldaEditFairyFoods() +{ +} + +void CZeldaEditFairyFoods::DoDataExchange(CDataExchange* pDX) +{ + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // TODO: Add extra initialization here + + //menu + CMenu *cm_menu = GetMenu(); + CMenu* cm_submenu = cm_menu->GetSubMenu(1); + cm_submenu->CheckMenuItem(3, MF_CHECKED | MF_BYPOSITION); + + //own inits + save = CZeldaHWLSaveEditorGUIApp::save; + + if (save != nullptr) + { + this->i_page_max = (save->vs_fairyFood.size() / this->maxFairyFoodsShown) + 1; + + if (this->i_page <= 1) + GetDlgItem(IDC_FAIRYFOOD_PAGE_PREVIOUS)->EnableWindow(false); + else + GetDlgItem(IDC_FAIRYFOOD_PAGE_PREVIOUS)->EnableWindow(true); + + if (this->i_page >= this->i_page_max) + GetDlgItem(IDC_FAIRYFOOD_PAGE_NEXT)->EnableWindow(false); + else + GetDlgItem(IDC_FAIRYFOOD_PAGE_NEXT)->EnableWindow(true); + + + for (int i = IDC_EDIT_FAIRYFOOD1; i <= IDC_EDIT_FAIRYFOOD30; i++) + { + GetDlgItem(i)->EnableWindow(true); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + } + + for (int i = IDC_STATIC_FAIRYFOOD1; i <= IDC_STATIC_FAIRYFOOD30; i++) + { + GetDlgItem(i)->EnableWindow(true); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + } + + + CString s_page_count; + s_page_count.Format(L"%d / %d", this->i_page, this->i_page_max); + SetDlgItemText(IDC_STATIC_PAGE_COUNT, s_page_count); + + this->calc_fairyFood(); + }else + { + + for (int i = IDC_EDIT_FAIRYFOOD1; i <= IDC_EDIT_FAIRYFOOD30; i++) + { + SetDlgItemText(i, L""); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + GetDlgItem(i)->EnableWindow(false); + } + + for (int i = IDC_STATIC_FAIRYFOOD1; i <= IDC_STATIC_FAIRYFOOD30; i++) + { + SetDlgItemText(i, L"Fairy Food"); + GetDlgItem(i)->ShowWindow(SW_SHOWNORMAL); + } + + SetDlgItemText(IDC_STATIC_PAGE_COUNT, L"0 / 0"); + GetDlgItem(IDC_FAIRYFOOD_PAGE_PREVIOUS)->EnableWindow(false); + GetDlgItem(IDC_FAIRYFOOD_PAGE_NEXT)->EnableWindow(false); + } + + + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CZeldaEditFairyFoods, CDialogEx) + ON_COMMAND(ID_MENU_ABOUT, &CZeldaEditFairyFoods::OnMenuAbout) + ON_COMMAND(ID_MENU_EDIT_GENERAL, &CZeldaEditFairyFoods::OnMenuEditGeneral) + ON_COMMAND(ID_MENU_EDIT_CHARACTERS_STATS, &CZeldaEditFairyFoods::OnMenuEditCharactersStats) + ON_COMMAND(ID_MENU_EDIT_MATERIALS_BRONZE, &CZeldaEditFairyFoods::OnMenuEditMaterialsBronze) + ON_COMMAND(ID_MENU_EDIT_MATERIALS_SILVER, &CZeldaEditFairyFoods::OnMenuEditMaterialsSilver) + ON_COMMAND(ID_MENU_EDIT_MATERIALS_GOLD, &CZeldaEditFairyFoods::OnMenuEditMaterialsGold) + ON_COMMAND(ID_MENU_MAIN_EXIT, &CZeldaEditFairyFoods::OnMenuMainExit) + ON_COMMAND(ID_MENU_EDIT_FAIRYFOODS, &CZeldaEditFairyFoods::OnMenuEditFairyfoods) + ON_BN_CLICKED(ID_EXIT, &CZeldaEditFairyFoods::OnBnClickedExit) + ON_BN_CLICKED(ID_SAVE, &CZeldaEditFairyFoods::OnBnClickedSave) + ON_CONTROL_RANGE(EN_CHANGE, IDC_EDIT_FAIRYFOOD1, IDC_EDIT_FAIRYFOOD30, &OnEnChangeValueEdit) + ON_BN_CLICKED(IDC_FAIRYFOOD_PAGE_PREVIOUS, &CZeldaEditFairyFoods::OnBnClickedFairyfoodPagePrevious) + ON_BN_CLICKED(IDC_FAIRYFOOD_PAGE_NEXT, &CZeldaEditFairyFoods::OnBnClickedFairyfoodPageNext) + ON_COMMAND(ID_MENU_EDIT_AM_AVMAP, &CZeldaEditFairyFoods::OnMenuEditAmAvmap) + ON_COMMAND(ID_MENU_EDIT_AM_GSMAP, &CZeldaEditFairyFoods::OnMenuEditAmGsmap) + ON_COMMAND(ID_MENU_EDIT_AM_MQMAP, &CZeldaEditFairyFoods::OnMenuEditAmMqmap) + ON_BN_CLICKED(IDC_FAIRYFOOD_MAX_VALUE_PAGE, &CZeldaEditFairyFoods::OnBnClickedFairyfoodMaxValuePage) + ON_BN_CLICKED(IDC_FAIRYFOOD_MAX_VALUE_ALL, &CZeldaEditFairyFoods::OnBnClickedFairyfoodMaxValueAll) + ON_BN_CLICKED(IDC_FAIRYFOOD_MAX_VALUE_GRATITUDE, &CZeldaEditFairyFoods::OnBnClickedFairyfoodMaxValueGratitude) +END_MESSAGE_MAP() + + +// CZeldaEditFairyFoods-Meldungshandler + +void CZeldaEditFairyFoods::OnMenuAbout() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaAboutDlg about; + about.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuEditGeneral() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditGeneralDlg dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + +void CZeldaEditFairyFoods::OnMenuEditCharactersStats() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditCharaStatsDlg dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuEditMaterialsBronze() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditMaterials dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuEditMaterialsSilver() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditMaterials dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuEditMaterialsGold() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditMaterials dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuMainExit() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditFairyFoods::OnOK(); + +} + + +void CZeldaEditFairyFoods::OnMenuEditFairyfoods() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. +} + + +void CZeldaEditFairyFoods::OnBnClickedExit() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + CZeldaEditFairyFoods::OnOK(); + +} + + +void CZeldaEditFairyFoods::OnBnClickedSave() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + try + { + this->save_fairyFood(); + save->save_file(); + } + catch (std::exception &e) + { + CString str(e.what()); + MessageBox(str, L"Error"); + } + } + else{ + CString str("There is no SaveFile opened!"); + MessageBox(str, L"Error"); + } +} + +void CZeldaEditFairyFoods::calc_fairyFood() +{ + int i_size = save->vs_fairyFood.size(); + int i_diff = i_size - ((this->i_page - 1) * this->maxFairyFoodsShown); + + for (int i = 0; i < this->maxFairyFoodsShown; i++) + { + if (i < i_diff) + { + int i_fairyFood_id = i + ((this->i_page - 1) * this->maxFairyFoodsShown); + CString s_fairyFood_name(save->get_fairyFood(i_fairyFood_id)->get_name().c_str()); + CString s_fairyFood_value; + s_fairyFood_value.Format(L"%d", save->get_fairyFood(i_fairyFood_id)->get_value()); + + SetDlgItemText((IDC_STATIC_FAIRYFOOD1 + i), s_fairyFood_name + L": "); + SetDlgItemText((IDC_EDIT_FAIRYFOOD1 + i), s_fairyFood_value); + + CEdit *e_test = (CEdit*)GetDlgItem((IDC_EDIT_FAIRYFOOD1 + i)); + e_test->SetLimitText(4); + } + else{ + if (GetDlgItem(IDC_STATIC_FAIRYFOOD1 + i)->IsWindowVisible()) + GetDlgItem(IDC_STATIC_FAIRYFOOD1 + i)->ShowWindow(SW_HIDE); + + if (GetDlgItem(IDC_EDIT_FAIRYFOOD1 + i)->IsWindowVisible()) + GetDlgItem(IDC_EDIT_FAIRYFOOD1 + i)->ShowWindow(SW_HIDE); + + } + + } +} + +void CZeldaEditFairyFoods::save_fairyFood() +{ + + + int i_size = save->vs_fairyFood.size(); + int i_diff = i_size - ((this->i_page - 1) * this->maxFairyFoodsShown); + + for (int i = 0; i < this->maxFairyFoodsShown; i++) + { + if (i < i_diff) + { + int i_fairyFood_id = i + ((this->i_page - 1) * this->maxFairyFoodsShown); + CString s_fairyFood_value; + + GetDlgItemText((IDC_EDIT_FAIRYFOOD1 + i), s_fairyFood_value); + int i_fairyFood_value = _wtof(s_fairyFood_value); + + save->get_fairyFood(i_fairyFood_id)->set_value(i_fairyFood_value); + save->get_fairyFood(i_fairyFood_id)->save_FairyFood(); + } + } +} + +void CZeldaEditFairyFoods::OnEnChangeValueEdit(UINT nID) +{ + if (SendDlgItemMessage(nID, EM_GETMODIFY, 0, 0)) + { + if (save != nullptr) + { + CString test; + CEdit *e_test = (CEdit*)GetDlgItem(nID); + e_test->SetLimitText(4); + GetDlgItemText(nID, test); + int i_test = _wtoi(test); + + if (i_test > HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax) + { + test.Format(L"%d", HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + SetDlgItemText(nID, test); + e_test->SetLimitText(3); + } + + } + } +} + +void CZeldaEditFairyFoods::OnBnClickedFairyfoodPagePrevious() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + this->save_fairyFood(); + this->i_page--; + this->UpdateData(); +} + + +void CZeldaEditFairyFoods::OnBnClickedFairyfoodPageNext() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + this->save_fairyFood(); + this->i_page++; + this->UpdateData(); +} + + +void CZeldaEditFairyFoods::OnMenuEditAmAvmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuEditAmGsmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnMenuEditAmMqmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditFairyFoods::OnBnClickedFairyfoodMaxValuePage() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + int i_size = save->vs_fairyFood.size(); + int i_diff = i_size - ((this->i_page - 1) * this->maxFairyFoodsShown); + + for (int i = 0; i < this->maxFairyFoodsShown; i++) + { + if (i < i_diff) + { + int i_fairyFood_id = i + ((this->i_page - 1) * this->maxFairyFoodsShown); + + save->get_fairyFood(i_fairyFood_id)->set_value(HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + save->get_fairyFood(i_fairyFood_id)->save_FairyFood(); + } + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } +} + + +void CZeldaEditFairyFoods::OnBnClickedFairyfoodMaxValueAll() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + for (int i = 0; i < save->vs_fairyFood.size(); i++) + { + save->get_fairyFood(i)->set_value(HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + save->get_fairyFood(i)->save_FairyFood(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } +} + + +void CZeldaEditFairyFoods::OnBnClickedFairyfoodMaxValueGratitude() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + for (int i = HWLSaveEdit::HWLFairyFood::fairyGratitudeCrystalIDBegin; i <= HWLSaveEdit::HWLFairyFood::fairyGratitudeCrystalIDEnd; i++) + { + save->get_fairyFood(i)->set_value(HWLSaveEdit::HWLFairyFood::fairyFoodlValueMax); + save->get_fairyFood(i)->save_FairyFood(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } +} diff --git a/source/gui/ZeldaEditFairyFoods.h b/source/gui/ZeldaEditFairyFoods.h new file mode 100644 index 0000000..863466c --- /dev/null +++ b/source/gui/ZeldaEditFairyFoods.h @@ -0,0 +1,54 @@ +#pragma once + + +// CZeldaEditFairyFoods-Dialogfeld + +class CZeldaEditFairyFoods : public CDialogEx +{ + DECLARE_DYNAMIC(CZeldaEditFairyFoods) + +public: + CZeldaEditFairyFoods(CWnd* pParent = NULL); // Standardkonstruktor + virtual ~CZeldaEditFairyFoods(); + +// Dialogfelddaten + enum { IDD = IDD_EDIT_FAIRYFOODS }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + + HICON m_hIcon; + HWLSaveEdit::HWLSaveEditor *save; + int i_page; + int i_page_max; + const int maxFairyFoodsShown = 30; + + DECLARE_MESSAGE_MAP() + + //own methods + void calc_fairyFood(); + void save_fairyFood(); + +public: + + afx_msg void OnEnChangeValueEdit(UINT nID); + + afx_msg void OnMenuAbout(); + afx_msg void OnMenuEditGeneral(); + afx_msg void OnMenuEditCharactersStats(); + afx_msg void OnMenuEditMaterialsBronze(); + afx_msg void OnMenuEditMaterialsSilver(); + afx_msg void OnMenuEditMaterialsGold(); + afx_msg void OnMenuMainExit(); + afx_msg void OnMenuEditFairyfoods(); + afx_msg void OnBnClickedExit(); + afx_msg void OnBnClickedSave(); + afx_msg void OnBnClickedFairyfoodPagePrevious(); + afx_msg void OnBnClickedFairyfoodPageNext(); + afx_msg void OnMenuEditAmAvmap(); + afx_msg void OnMenuEditAmGsmap(); + afx_msg void OnMenuEditAmMqmap(); + afx_msg void OnBnClickedFairyfoodMaxValuePage(); + afx_msg void OnBnClickedFairyfoodMaxValueAll(); + afx_msg void OnBnClickedFairyfoodMaxValueGratitude(); +}; diff --git a/source/gui/ZeldaEditGeneralDlg.cpp b/source/gui/ZeldaEditGeneralDlg.cpp index d5b883d..4c88150 100644 --- a/source/gui/ZeldaEditGeneralDlg.cpp +++ b/source/gui/ZeldaEditGeneralDlg.cpp @@ -66,6 +66,12 @@ BEGIN_MESSAGE_MAP(CZeldaEditGeneralDlg, CDialogEx) ON_COMMAND(ID_MENU_EDIT_MATERIALS_BRONZE, &CZeldaEditGeneralDlg::OnMenuEditMaterialsBronze) ON_COMMAND(ID_MENU_EDIT_MATERIALS_SILVER, &CZeldaEditGeneralDlg::OnMenuEditMaterialsSilver) ON_COMMAND(ID_MENU_EDIT_MATERIALS_GOLD, &CZeldaEditGeneralDlg::OnMenuEditMaterialsGold) + ON_COMMAND(ID_MENU_EDIT_FAIRYFOODS, &CZeldaEditGeneralDlg::OnMenuEditFairyfoods) + ON_COMMAND(ID_MENU_EDIT_AM_AVMAP, &CZeldaEditGeneralDlg::OnMenuEditAmAvmap) + ON_COMMAND(ID_MENU_EDIT_AM_GSMAP, &CZeldaEditGeneralDlg::OnMenuEditAmGsmap) + ON_COMMAND(ID_MENU_EDIT_AM_MQMAP, &CZeldaEditGeneralDlg::OnMenuEditAmMqmap) + ON_COMMAND(ID_MENU_EDIT_GENERAL, &CZeldaEditGeneralDlg::OnMenuEditGeneral) + ON_BN_CLICKED(IDC_RUBY_MAX, &CZeldaEditGeneralDlg::OnBnClickedRubyMax) END_MESSAGE_MAP() @@ -102,25 +108,6 @@ void CZeldaEditGeneralDlg::OnBnClickedExit() } - -void CZeldaEditGeneralDlg::OnMenuEditCharactersStats() -{ - // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. - CZeldaEditCharaStatsDlg dlg; - EndDialog(this->IDD); - dlg.DoModal(); - -} - - -void CZeldaEditGeneralDlg::OnMenuAbout() -{ - // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. - CZeldaAboutDlg about; - about.DoModal(); - -} - void CZeldaEditGeneralDlg::OnEnChangeRubyEdit() { // TODO: Falls dies ein RICHEDIT-Steuerelement ist, wird das Kontrollelement @@ -251,6 +238,22 @@ void CZeldaEditGeneralDlg::OnMenuMainExit() } +void CZeldaEditGeneralDlg::OnMenuAbout() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaAboutDlg about; + about.DoModal(); + +} + +void CZeldaEditGeneralDlg::OnMenuEditCharactersStats() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditCharaStatsDlg dlg; + EndDialog(this->IDD); + dlg.DoModal(); + +} void CZeldaEditGeneralDlg::OnMenuEditMaterialsBronze() { @@ -277,3 +280,62 @@ void CZeldaEditGeneralDlg::OnMenuEditMaterialsGold() EndDialog(this->IDD); dlg.DoModal(); } + + +void CZeldaEditGeneralDlg::OnMenuEditFairyfoods() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditFairyFoods dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditGeneralDlg::OnMenuEditAmAvmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditGeneralDlg::OnMenuEditAmGsmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditGeneralDlg::OnMenuEditAmMqmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditGeneralDlg::OnMenuEditGeneral() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. +} + + +void CZeldaEditGeneralDlg::OnBnClickedRubyMax() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + CString cs_ruby_value; + + save->set_rubies(save->rubyMax); + cs_ruby_value.Format(L"%d", save->get_rubies()); + SetDlgItemText(IDC_RUBY_EDIT, cs_ruby_value); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } +} diff --git a/source/gui/ZeldaEditGeneralDlg.h b/source/gui/ZeldaEditGeneralDlg.h index 9142d56..975fc54 100644 --- a/source/gui/ZeldaEditGeneralDlg.h +++ b/source/gui/ZeldaEditGeneralDlg.h @@ -35,4 +35,10 @@ class CZeldaEditGeneralDlg : public CDialogEx afx_msg void OnMenuEditMaterialsBronze(); afx_msg void OnMenuEditMaterialsSilver(); afx_msg void OnMenuEditMaterialsGold(); + afx_msg void OnMenuEditFairyfoods(); + afx_msg void OnMenuEditAmAvmap(); + afx_msg void OnMenuEditAmGsmap(); + afx_msg void OnMenuEditAmMqmap(); + afx_msg void OnMenuEditGeneral(); + afx_msg void OnBnClickedRubyMax(); }; diff --git a/source/gui/ZeldaEditMaterials.cpp b/source/gui/ZeldaEditMaterials.cpp index cf96284..487a49d 100644 --- a/source/gui/ZeldaEditMaterials.cpp +++ b/source/gui/ZeldaEditMaterials.cpp @@ -146,6 +146,11 @@ BEGIN_MESSAGE_MAP(CZeldaEditMaterials, CDialogEx) ON_BN_CLICKED(IDC_MATERIAL_PAGE_NEXT, &CZeldaEditMaterials::OnBnClickedMaterialPageNext) ON_COMMAND(ID_MENU_EDIT_MATERIALS_GOLD, &CZeldaEditMaterials::OnMenuEditMaterialsGold) ON_COMMAND(ID_MENU_MAIN_EXIT, &CZeldaEditMaterials::OnMenuMainExit) + ON_COMMAND(ID_MENU_EDIT_FAIRYFOODS, &CZeldaEditMaterials::OnMenuEditFairyfoods) + ON_COMMAND(ID_MENU_EDIT_AM_AVMAP, &CZeldaEditMaterials::OnMenuEditAmAvmap) + ON_COMMAND(ID_MENU_EDIT_AM_GSMAP, &CZeldaEditMaterials::OnMenuEditAmGsmap) + ON_COMMAND(ID_MENU_EDIT_AM_MQMAP, &CZeldaEditMaterials::OnMenuEditAmMqmap) + ON_BN_CLICKED(IDC_MATERIAL_MAX_VALUE_ALL, &CZeldaEditMaterials::OnBnClickedMaterialMaxValueAll) END_MESSAGE_MAP() @@ -173,7 +178,6 @@ void CZeldaEditMaterials::OnBnClickedExit() { // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. CZeldaEditMaterials::OnOK(); - //this->DestroyWindow(); } @@ -186,6 +190,7 @@ void CZeldaEditMaterials::OnBnClickedCancel() void CZeldaEditMaterials::OnBnClickedSave() { + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. if (save != nullptr) { try @@ -203,7 +208,6 @@ void CZeldaEditMaterials::OnBnClickedSave() CString str("There is no SaveFile opened!"); MessageBox(str, L"Error"); } - // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. } void CZeldaEditMaterials::calc_materials() @@ -246,10 +250,10 @@ void CZeldaEditMaterials::calc_materials() e_test->SetLimitText(4); } else{ - if (GetDlgItem(IDC_STATIC_MATERIAL1 + i)->IsWindowVisible()) + if (GetDlgItem(IDC_STATIC_MATERIAL1 + i)->IsWindowVisible() || this->i_type == 0) GetDlgItem(IDC_STATIC_MATERIAL1 + i)->ShowWindow(SW_HIDE); - if (GetDlgItem(IDC_EDIT_MATERIAL1 + i)->IsWindowVisible()) + if (GetDlgItem(IDC_EDIT_MATERIAL1 + i)->IsWindowVisible() || this->i_type == 0) GetDlgItem(IDC_EDIT_MATERIAL1 + i)->ShowWindow(SW_HIDE); } @@ -383,3 +387,79 @@ void CZeldaEditMaterials::OnMenuMainExit() // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. CZeldaEditMaterials::OnOK(); } + + +void CZeldaEditMaterials::OnMenuEditFairyfoods() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditFairyFoods dlg; + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditMaterials::OnMenuEditAmAvmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 0); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditMaterials::OnMenuEditAmGsmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 1); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditMaterials::OnMenuEditAmMqmap() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. + CZeldaEditAdventureModeItem dlg(NULL, 2); + EndDialog(this->IDD); + dlg.DoModal(); +} + + +void CZeldaEditMaterials::OnBnClickedMaterialMaxValueAll() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. + if (save != nullptr) + { + int i_size; + switch (this->i_type) + { + case 0: { + i_size = save->vs_bronzeMaterials.size(); + break; + } + + case 1: { + i_size = save->vs_silverMaterials.size(); + break; + } + + case 2: { + i_size = save->vs_goldMaterials.size(); + break; + } + + } + + for (int i = 0; i < i_size; i++) + { + save->get_material(i, this->i_type)->set_value(HWLSaveEdit::HWLMaterial::materialValueMax); + save->get_material(i, this->i_type)->save_Material(); + } + + this->UpdateData(); + + CString str("Finish! All needed Values are updated."); + MessageBox(str, L"Information", MB_OK | MB_ICONINFORMATION); + } + +} diff --git a/source/gui/ZeldaEditMaterials.h b/source/gui/ZeldaEditMaterials.h index d8c2f4c..2e72abd 100644 --- a/source/gui/ZeldaEditMaterials.h +++ b/source/gui/ZeldaEditMaterials.h @@ -46,4 +46,9 @@ class CZeldaEditMaterials : public CDialogEx afx_msg void OnBnClickedMaterialPageNext(); afx_msg void OnMenuEditMaterialsGold(); afx_msg void OnMenuMainExit(); + afx_msg void OnMenuEditFairyfoods(); + afx_msg void OnMenuEditAmAvmap(); + afx_msg void OnMenuEditAmGsmap(); + afx_msg void OnMenuEditAmMqmap(); + afx_msg void OnBnClickedMaterialMaxValueAll(); }; diff --git a/source/gui/ZeldaHWLSaveEditorGUI.aps b/source/gui/ZeldaHWLSaveEditorGUI.aps deleted file mode 100644 index 36cad59..0000000 Binary files a/source/gui/ZeldaHWLSaveEditorGUI.aps and /dev/null differ diff --git a/source/gui/ZeldaHWLSaveEditorGUI.h b/source/gui/ZeldaHWLSaveEditorGUI.h index d283dee..3262918 100644 --- a/source/gui/ZeldaHWLSaveEditorGUI.h +++ b/source/gui/ZeldaHWLSaveEditorGUI.h @@ -14,6 +14,8 @@ #include "ZeldaEditCharaStatsDlg.h" #include "ZeldaEditGeneralDlg.h" #include "ZeldaEditMaterials.h" +#include "ZeldaEditFairyFoods.h" +#include "ZeldaEditAdventureModeItem.h" // CZeldaHWLSaveEditorGUIApp: // See ZeldaHWLSaveEditorGUI.cpp for the implementation of this class diff --git a/source/gui/ZeldaHWLSaveEditorGUI.rc b/source/gui/ZeldaHWLSaveEditorGUI.rc index 3959d15..8998e30 100644 Binary files a/source/gui/ZeldaHWLSaveEditorGUI.rc and b/source/gui/ZeldaHWLSaveEditorGUI.rc differ diff --git a/source/gui/resource.h b/source/gui/resource.h index 5c1cf63..c5714a0 100644 Binary files a/source/gui/resource.h and b/source/gui/resource.h differ