Skip to content

Commit

Permalink
feat: add empty monotype (Salty) model & dynamic recipe view
Browse files Browse the repository at this point in the history
  • Loading branch information
Insektaure committed Jun 3, 2024
1 parent c5eea0a commit 8cce374
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 30 deletions.
253 changes: 253 additions & 0 deletions source/models/monotypeSalty.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
#pragma once

#include <vector>
#include <string>

struct RecipeItems {
std::string name;
int quantity;
};

struct RecipeBonus {
std::string name;
int level;
};

struct Recipe {
std::vector<RecipeItems> items;
std::vector<RecipeBonus> bonuses;
};

Recipe Normal = {
{
{"Tofu", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Fire = {
{
{"Red Pepper", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Water = {
{
{"Cucumber", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Electric = {
{
{"Yellow Pepper", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Grass = {
{
{"Lettuce", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Ice = {
{
{"Klawf Stick", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Fighting = {
{
{"Pickle", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Poison = {
{
{"Green Pepper", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Ground = {
{
{"Ham", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Flying = {
{
{"Prosciutto", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Psychic = {
{
{"Onion", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Bug = {
{
{"Cherry Tomato", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Rock = {
{
{"Bacon", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Ghost = {
{
{"Red Onion", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Dragon = {
{
{"Avocado", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Dark = {
{
{"Smoked Fillet", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Steel = {
{
{"Hamburger", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};

Recipe Fairy = {
{
{"Tomato", 1},
{"Salty Herba Mystica", 1},
{"Sweet Herba Mystica", 1}
},
{
{"Sparkling Power", 3},
{"Title Power", 3},
{"Encounter Power", 3}
}
};
27 changes: 16 additions & 11 deletions source/views/recipe-view.hpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
#pragma once

#include "../components/button.hpp"
#include "../models/monotypeSalty.hpp"
#include <functional>
#include <tesla.hpp>

class RecipeView : public tsl::Gui {

public:
RecipeView(const std::string &type) : type(type) { }
RecipeView(const std::string &type, const Recipe& recipe) : type(type), recipe(recipe) { }
~RecipeView() {};

virtual tsl::elm::Element *createUI() override {
auto frame = new tsl::elm::OverlayFrame("Recipe", type);
auto list = new tsl::elm::List();


// Display RecipeItems
list->addItem(new tsl::elm::CategoryHeader("Ingredients"));
for (RecipeItems& item : recipe.items) {
list->addItem(new tsl::elm::ListItem(std::to_string(item.quantity) + "x " + item.name));
}

/*for (Ingredient& ingredient : serving.ingredients) {
list->addItem(new tsl::elm::ListItem(std::to_string(ingredient.quantity.quantity) + "x " + ingredient.name));
//std::cout << "Ingredient: " << ingredient.name << ", Quantity: " << ingredient.quantity.quantity << std::endl;
}*/
// Display RecipeBonus
list->addItem(new tsl::elm::CategoryHeader("Bonuses"));
for (RecipeBonus& bonus : recipe.bonuses) {
list->addItem(new tsl::elm::ListItem(bonus.name + " Lvl " + std::to_string(bonus.level)));
}

frame->setContent(list);

Expand All @@ -29,16 +33,17 @@ class RecipeView : public tsl::Gui {

private:
std::string type;
Recipe recipe;
};


class RecipeViewButton : public Button {
public:
RecipeViewButton(const std::string &text, const std::string &type)
: Button(text), type(type) {
this->onClick([this]() { tsl::changeTo<RecipeView>(this->type); });
RecipeViewButton(const std::string &text, const std::string &type, const Recipe& recipe)
: Button(text), type(type), recipe(recipe) {
this->onClick([this]() { tsl::changeTo<RecipeView>(this->type, this->recipe); });
}

private:
std::string type;
Recipe recipe;
};
39 changes: 20 additions & 19 deletions source/views/sv/monotype-view.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "../../components/button.hpp"
#include "../../models/monotypeSalty.hpp"
#include "../recipe-view.hpp"
#include <tesla.hpp>

Expand All @@ -9,28 +10,28 @@ class MonotypeView : public tsl::Gui {
MonotypeView() { }

virtual tsl::elm::Element *createUI() override {
auto frame = new tsl::elm::OverlayFrame("Monotype (Salty HM)", " ");
auto frame = new tsl::elm::OverlayFrame("Monotype (Salty)", " ");
auto list = new tsl::elm::List();

list->addItem(new tsl::elm::CategoryHeader("Type"));

list->addItem(new RecipeViewButton("Bug", "Bug"));
list->addItem(new RecipeViewButton("Dark", "Dark"));
list->addItem(new RecipeViewButton("Dragon", "Dragon"));
list->addItem(new RecipeViewButton("Electric", "Electric"));
list->addItem(new RecipeViewButton("Fairy", "Fairy"));
list->addItem(new RecipeViewButton("Fighting", "Fighting"));
list->addItem(new RecipeViewButton("Fire", "Fire"));
list->addItem(new RecipeViewButton("Flying", "Flying"));
list->addItem(new RecipeViewButton("Ghost", "Ghost"));
list->addItem(new RecipeViewButton("Grass", "Grass"));
list->addItem(new RecipeViewButton("Ground", "Ground"));
list->addItem(new RecipeViewButton("Ice", "Ice"));
list->addItem(new RecipeViewButton("Normal", "Normal"));
list->addItem(new RecipeViewButton("Psychic", "Psychic"));
list->addItem(new RecipeViewButton("Rock", "Rock"));
list->addItem(new RecipeViewButton("Steel", "Steel"));
list->addItem(new RecipeViewButton("Water", "Water"));
list->addItem(new RecipeViewButton("Bug", "Bug", Bug));
list->addItem(new RecipeViewButton("Dark", "Dark", Dark));
list->addItem(new RecipeViewButton("Dragon", "Dragon", Dragon));
list->addItem(new RecipeViewButton("Electric", "Electric", Electric));
list->addItem(new RecipeViewButton("Fairy", "Fairy", Fairy));
list->addItem(new RecipeViewButton("Fighting", "Fighting", Fighting));
list->addItem(new RecipeViewButton("Fire", "Fire", Fire));
list->addItem(new RecipeViewButton("Flying", "Flying", Flying));
list->addItem(new RecipeViewButton("Ghost", "Ghost", Ghost));
list->addItem(new RecipeViewButton("Grass", "Grass", Grass));
list->addItem(new RecipeViewButton("Ground", "Ground", Ground));
list->addItem(new RecipeViewButton("Ice", "Ice", Ice));
list->addItem(new RecipeViewButton("Normal", "Normal", Normal));
list->addItem(new RecipeViewButton("Psychic", "Psychic", Psychic));
list->addItem(new RecipeViewButton("Rock", "Rock", Rock));
list->addItem(new RecipeViewButton("Steel", "Steel", Steel));
list->addItem(new RecipeViewButton("Water", "Water", Water));

frame->setContent(list);

Expand All @@ -41,5 +42,5 @@ class MonotypeView : public tsl::Gui {

class MonotypeViewButton : public Button {
public:
MonotypeViewButton() : Button("Monotype (Salty HM)") { this->onClick(tsl::changeTo<MonotypeView>); }
MonotypeViewButton() : Button("Monotype (Salty)") { this->onClick(tsl::changeTo<MonotypeView>); }
};

0 comments on commit 8cce374

Please sign in to comment.