-
Notifications
You must be signed in to change notification settings - Fork 2
/
FabricatorSystem.h
126 lines (109 loc) · 3.16 KB
/
FabricatorSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#pragma once
#include <Spore\BasicIncludes.h>
#include "stdafx.h"
#include "Spore/Simulator/SubSystem/SpaceTrading.h"
#include <Spore\BasicIncludes.h>
#include <Spore/CommonIDs.h>
#include "xFabClose.h"
#include <Spore/Simulator/cSpaceToolData.h>
#include "FabricatorSystem.h"
#include <exception>
#include <stdexcept>
#include <Spore\App\cJob.h>
#include <Spore\App\JobManager.h>
#include <Spore\UI\ScrollFrameVertical.h>
#include <set>
#include "AchievementSystem.h"
#define FabricatorSystemPtr intrusive_ptr<FabricatorSystem>
#define FabricatorSystemA (FabricatorSystem::Get())[0]
///
/// In your dllmain Initialize method, add the system like this:
/// ModAPI::AddSimulatorStrategy(new FabricatorSystem(), FabricatorSystem::NOUN_ID);
///
struct Category
{
public:
Category(uint32_t propID);
Category();
uint32_t mCatID; //A fake SpaceTool that provides the image of the category.
PropertyListPtr mpPropList;
uint32_t Cat; //The internal number that this category is.
explicit operator bool() const;
};
struct Recipe
{
public:
Recipe(uint32_t propID);
Recipe();
//Recipe(PropertyListPtr propList, uint32_t toolID, vector<uint32_t> Blueprint, vector<uint32_t> Ingredients , uint32_t CraftingID);
explicit operator bool() const;
PropertyListPtr mpPropList;
uint32_t mToolID;
vector<uint32_t> Blueprint;
vector<uint32_t> Ingredients;
vector<uint32_t> IngCount;
uint32_t productAmount;
uint32_t CraftingID;
uint32_t Cat;
//LocalizedString CName;
//LocalizedString CDesc;
bool Secret;
bool CargoType;
};
///kamacite - ni - [0]
///sulphide - s - [1]
///ice - h - [2]
///silica - si - [3]
///carbon - c - [4]
///copper - cu - [5]
///titanium - ti - [6]
///gold - au - [7]
///latticine - lt - [8]
///
class FabricatorSystem
: public Simulator::cStrategy
{
public:
static const uint32_t TYPE = id("RattlerSpore::FabricatorSystem");
static const uint32_t NOUN_ID = TYPE;
UTFWin::UILayout layout;
int AddRef() override;
int Release() override;
void Initialize() override;
void Dispose() override;
const char* GetName() const override;
bool Write(Simulator::ISerializerStream* stream) override;
bool Read(Simulator::ISerializerStream* stream) override;
void Update(int deltaTime, int deltaGameTime) override;
bool WriteToXML(Simulator::XmlSerializer* writexml) override;
//
// You can add more methods here
//
map<uint32_t, Recipe> RecipeMap;
map<uint32_t, Category> CatMap;
static Simulator::Attribute ATTRIBUTES[];
static FabricatorSystem* Get();
Recipe& GetRecipe(uint32_t resID);
Recipe Selected;
bool InCategory(uint32_t resID, uint32_t cat);
bool SelectRecipe(Recipe ThatRecipe);
bool IsSecret(uint32_t resID);
bool OpenFab(bool sex);
bool CloseFab(bool sex);
bool Fabricate(Recipe res);
void RenderRecipies(uint32_t cat);
vector<UTFWin::IWindow*> mapUI;
bool UseMaterial(uint32_t WareID, int neededAmount);
bool GiveItem(uint32_t WareID, uint32_t givenAmount);
bool GiveSpice(uint32_t WareID, uint32_t givenAmount);
bool HasMaterial(uint32_t WareID, int neededAmount);
bool AbleToCraft(Recipe res);
private:
//
// You can add members here
//
static FabricatorSystem* sInstance;
UTFWin::UILayout* mpUIlayout;
bool ReadRecipes();
float mWindowOffset;
};