@ -0,0 +1,38 @@ |
||||
#pragma once |
||||
#include "Item.h" |
||||
#include "safemap.h" |
||||
#include "DEFINES.h" |
||||
#include "Crawler.h" |
||||
|
||||
INCLUDE_game |
||||
INCLUDE_DATA |
||||
|
||||
safemap<std::string,ItemInfo>ITEM_DATA; |
||||
|
||||
typedef std::string IT; |
||||
|
||||
void ItemInfo::InitializeItems(){ |
||||
for(auto&key:DATA["ItemDatabase"].GetKeys()){ |
||||
std::cout<<key.first<<std::endl; |
||||
} |
||||
|
||||
ITEM_DATA.SetInitialized(); |
||||
} |
||||
|
||||
void Inventory::AddItem(IT it,int amt){ |
||||
|
||||
} |
||||
|
||||
void Inventory::GetItemCount(IT it){ |
||||
|
||||
} |
||||
|
||||
void Inventory::UseItem(IT it,int amt) |
||||
{ |
||||
|
||||
} |
||||
|
||||
void Inventory::RemoveItem(IT it,int amt) |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,39 @@ |
||||
#pragma once |
||||
|
||||
#include <string> |
||||
#include <functional> |
||||
#include <map> |
||||
#include "olcPixelGameEngine.h" |
||||
|
||||
class Crawler; |
||||
class ItemInfo; |
||||
|
||||
class Item{ |
||||
private: |
||||
int amt; |
||||
ItemInfo*it; |
||||
}; |
||||
|
||||
class Inventory{ |
||||
public: |
||||
void AddItem(std::string it,int amt=1); |
||||
void GetItemCount(std::string it); |
||||
void UseItem(std::string it,int amt=1); |
||||
void RemoveItem(std::string it,int amt=1); |
||||
private: |
||||
static std::map<std::string,Item>inventory; |
||||
}; |
||||
|
||||
class ItemInfo{ |
||||
std::string name; |
||||
std::string displayName; |
||||
Decal*img; |
||||
//Returns true if the item can be used, false otherwise
|
||||
std::function<bool(Crawler*)>useFunc; |
||||
public: |
||||
static void InitializeItems(); |
||||
/*
|
||||
For the useFunc, return true if the item can be used, false otherwise. |
||||
*/ |
||||
ItemInfo(std::string name,std::string displayName,Decal*img,std::function<bool(Crawler*)>useFunc); |
||||
}; |
@ -0,0 +1,19 @@ |
||||
#pragma once |
||||
#include "MenuIconButton.h" |
||||
#include "Item.h" |
||||
|
||||
INCLUDE_game |
||||
|
||||
class ItemComponent:public MenuIconButton{ |
||||
Item::ItemName item; |
||||
public: |
||||
inline ItemComponent(geom2d::rect<float>rect,Item::ItemName*item,MenuFunc onClick) |
||||
:MenuIconButton(rect,,onClick){} |
||||
protected: |
||||
virtual void inline Update(Crawler*game)override{ |
||||
MenuIconButton::Update(game); |
||||
} |
||||
virtual void inline Draw(Crawler*game,vf2d parentPos,bool focused)override{ |
||||
MenuIconButton::Draw(game,parentPos,focused); |
||||
} |
||||
}; |
@ -0,0 +1,19 @@ |
||||
ItemCategory |
||||
{ |
||||
Consumables |
||||
{ |
||||
Description = Items that will be consumed after a single use. |
||||
} |
||||
Equipment |
||||
{ |
||||
Description = Gear that can be placed onto a player. |
||||
} |
||||
Accesories |
||||
{ |
||||
Description = Items worn as extra items on the player. |
||||
} |
||||
Materials |
||||
{ |
||||
Description = Items used as crafting materials for the forge. |
||||
} |
||||
} |
@ -0,0 +1,67 @@ |
||||
ItemDatabase |
||||
{ |
||||
Small Health Potion |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 40 health points. |
||||
HP Restore = 40 |
||||
ItemCategory = Consumables |
||||
} |
||||
Medium Health Potion |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 100 health points. |
||||
HP Restore = 100 |
||||
ItemCategory = Consumables |
||||
} |
||||
Large Health Potion |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 320 health points. |
||||
HP Restore = 320 |
||||
ItemCategory = Consumables |
||||
} |
||||
Small Mana Potion |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 40 mana points. |
||||
MP Restore = 40 |
||||
ItemCategory = Consumables |
||||
} |
||||
Medium Mana Potion |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 100 mana points. |
||||
MP Restore = 100 |
||||
ItemCategory = Consumables |
||||
} |
||||
Large Mana Potion |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 320 mana points. |
||||
MP Restore = 320 |
||||
ItemCategory = Consumables |
||||
} |
||||
Bandages |
||||
{ |
||||
ItemScript = Restore |
||||
Description = Restores 10% health points. |
||||
HP % Restore = 10% |
||||
ItemCategory = Consumables |
||||
} |
||||
Green Slime Remains |
||||
{ |
||||
Description = The remains of a green slime. It stares at you intently. |
||||
ItemCategory = Materials |
||||
} |
||||
Blue Slime Remains |
||||
{ |
||||
Description = The remains of a blue slime. It stares at you intently. |
||||
ItemCategory = Materials |
||||
} |
||||
Red Slime Remains |
||||
{ |
||||
Description = The remains of a red slime. It stares at you intently. |
||||
ItemCategory = Materials |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
ItemScript |
||||
{ |
||||
# Used with the Item Database. |
||||
# Any of these properties can be overwritten by specifying them in the main item. |
||||
|
||||
# Restores stats. |
||||
Restore |
||||
{ |
||||
HP Restore = 0 |
||||
HP % Restore = 0 |
||||
MP Restore = 0 |
||||
MP % Restore = 0 |
||||
} |
||||
} |
@ -0,0 +1,6 @@ |
||||
ItemConfiguration |
||||
{ |
||||
Item Database = "ItemDatabase.txt" |
||||
Item Scripts = "ItemScript.txt" |
||||
Item Categories = "ItemCategory.txt" |
||||
} |
After Width: | Height: | Size: 942 B |
After Width: | Height: | Size: 682 B |
After Width: | Height: | Size: 677 B |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 821 B |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 687 B |
After Width: | Height: | Size: 789 B |
After Width: | Height: | Size: 798 B |