Implement crafting requirement structures and dummy data for equipment.
This commit is contained in:
parent
c7e3115b89
commit
318719d46f
48
Crawler/CraftingRequirement.cpp
Normal file
48
Crawler/CraftingRequirement.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#pragma region License
|
||||||
|
/*
|
||||||
|
License (OLC-3)
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Copyright 2018 - 2022 OneLoneCoder.com
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above
|
||||||
|
copyright notice. This list of conditions and the following disclaimer must be
|
||||||
|
reproduced in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType
|
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
#pragma endregion
|
||||||
|
#include "CraftingRequirement.h"
|
||||||
|
|
||||||
|
CraftingRequirement::CraftingRequirement(const std::vector<Item>&craftingItems,const uint32_t cost)
|
||||||
|
:craftingItems(craftingItems),cost(cost){}
|
||||||
|
|
||||||
|
const std::vector<Item>&CraftingRequirement::GetItems()const{
|
||||||
|
return craftingItems;
|
||||||
|
}
|
||||||
|
const uint32_t CraftingRequirement::GetCost()const{
|
||||||
|
return cost;
|
||||||
|
}
|
48
Crawler/CraftingRequirement.h
Normal file
48
Crawler/CraftingRequirement.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#pragma region License
|
||||||
|
/*
|
||||||
|
License (OLC-3)
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Copyright 2018 - 2023 OneLoneCoder.com
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions or derivations of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions or derivative works in binary form must reproduce the above
|
||||||
|
copyright notice. This list of conditions and the following disclaimer must be
|
||||||
|
reproduced in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
|
||||||
|
Portions of this software are copyright © 2023 The FreeType
|
||||||
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||||
|
All rights reserved.
|
||||||
|
*/
|
||||||
|
#pragma endregion
|
||||||
|
#pragma once
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
|
class CraftingRequirement{
|
||||||
|
std::vector<Item>craftingItems;
|
||||||
|
uint32_t cost;
|
||||||
|
public:
|
||||||
|
CraftingRequirement(const std::vector<Item>&craftingItems,const uint32_t cost);
|
||||||
|
const std::vector<Item>&GetItems()const;
|
||||||
|
const uint32_t GetCost()const;
|
||||||
|
};
|
@ -308,6 +308,7 @@
|
|||||||
<ClInclude Include="ClassInfo.h" />
|
<ClInclude Include="ClassInfo.h" />
|
||||||
<ClInclude Include="config.h" />
|
<ClInclude Include="config.h" />
|
||||||
<ClInclude Include="ConnectionPoint.h" />
|
<ClInclude Include="ConnectionPoint.h" />
|
||||||
|
<ClInclude Include="CraftingRequirement.h" />
|
||||||
<ClInclude Include="Crawler.h" />
|
<ClInclude Include="Crawler.h" />
|
||||||
<ClInclude Include="DamageNumber.h" />
|
<ClInclude Include="DamageNumber.h" />
|
||||||
<ClInclude Include="DEFINES.h" />
|
<ClInclude Include="DEFINES.h" />
|
||||||
@ -455,6 +456,10 @@
|
|||||||
<ClCompile Include="ChargedArrow.cpp" />
|
<ClCompile Include="ChargedArrow.cpp" />
|
||||||
<ClCompile Include="ClassSelectionWindow.cpp" />
|
<ClCompile Include="ClassSelectionWindow.cpp" />
|
||||||
<ClCompile Include="ConnectionPoint.cpp" />
|
<ClCompile Include="ConnectionPoint.cpp" />
|
||||||
|
<ClCompile Include="CraftingRequirement.cpp">
|
||||||
|
<SubType>
|
||||||
|
</SubType>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="Crawler.cpp" />
|
<ClCompile Include="Crawler.cpp" />
|
||||||
<ClCompile Include="DamageNumber.cpp" />
|
<ClCompile Include="DamageNumber.cpp" />
|
||||||
<ClCompile Include="discord-files\achievement_manager.cpp" />
|
<ClCompile Include="discord-files\achievement_manager.cpp" />
|
||||||
|
@ -378,6 +378,9 @@
|
|||||||
<ClInclude Include="RowMerchantInventoryScrollableWindowComponent.h">
|
<ClInclude Include="RowMerchantInventoryScrollableWindowComponent.h">
|
||||||
<Filter>Header Files\Interface</Filter>
|
<Filter>Header Files\Interface</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="CraftingRequirement.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Player.cpp">
|
<ClCompile Include="Player.cpp">
|
||||||
@ -623,6 +626,9 @@
|
|||||||
<ClCompile Include="SellItemWindow.cpp">
|
<ClCompile Include="SellItemWindow.cpp">
|
||||||
<Filter>Source Files\Interface</Filter>
|
<Filter>Source Files\Interface</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CraftingRequirement.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
@ -153,6 +153,16 @@ void ItemInfo::InitializeItems(){
|
|||||||
enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex));
|
enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex));
|
||||||
attrIndex++;
|
attrIndex++;
|
||||||
}
|
}
|
||||||
|
std::vector<Item>itemsRequired;
|
||||||
|
uint32_t goldCost=0;
|
||||||
|
if(enhancementLevel!=0){ //The first level does not require any crafting, skip this level.
|
||||||
|
while(data[key]["Crafting"][std::format("Level[{}]",enhancementLevel)].HasProperty(std::format("Item[{}]",itemsRequired.size()))){
|
||||||
|
datafile&item=data[key]["Crafting"][std::format("Level[{}]",enhancementLevel)][std::format("Item[{}]",itemsRequired.size())];
|
||||||
|
itemsRequired.push_back(Item(item.GetInt(1),item.GetString(0)));
|
||||||
|
}
|
||||||
|
goldCost=data[key]["Crafting"][std::format("Level[{}]",enhancementLevel)]["Gold"].GetInt();
|
||||||
|
}
|
||||||
|
enhancementStats.SetCraftingRequirements(enhancementLevel,itemsRequired,goldCost);
|
||||||
}
|
}
|
||||||
it.enhancement=enhancementStats;
|
it.enhancement=enhancementStats;
|
||||||
}
|
}
|
||||||
@ -589,8 +599,8 @@ const float Item::CooldownTime()const{
|
|||||||
return it->CooldownTime();
|
return it->CooldownTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Stats&EnhancementInfo::operator[](int level)const{
|
const EnhancementLevelInfo EnhancementInfo::operator[](int level)const{
|
||||||
return enhancementStats[level];
|
return EnhancementLevelInfo{const_cast<Stats&>(enhancementStats.at(level)),const_cast<CraftingRequirement&>(craftingRequirements.at(level))};
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::optional<const ItemSet *const>ItemInfo::ItemSet()const{
|
const std::optional<const ItemSet *const>ItemInfo::ItemSet()const{
|
||||||
@ -675,7 +685,7 @@ const Stats&ItemInfo::GetStats(int enhancementLevel)const{
|
|||||||
if(enhancement.size()<=enhancementLevel){
|
if(enhancement.size()<=enhancementLevel){
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return enhancement[enhancementLevel];
|
return enhancement[enhancementLevel].stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Stats Item::GetStats()const{
|
const Stats Item::GetStats()const{
|
||||||
@ -824,3 +834,13 @@ void Stats::InitializeDamageReductionTable(){
|
|||||||
maxDamageReductionTable[i]=totalReduction;
|
maxDamageReductionTable[i]=totalReduction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnhancementInfo::SetCraftingRequirements(const int enhanceLevel,const std::vector<Item>&requiredItems,const uint32_t goldCost){
|
||||||
|
while(craftingRequirements.size()<=enhanceLevel){
|
||||||
|
craftingRequirements.push_back(CraftingRequirement({},0));
|
||||||
|
}
|
||||||
|
craftingRequirements[enhanceLevel]=CraftingRequirement(requiredItems,goldCost);
|
||||||
|
}
|
||||||
|
|
||||||
|
EnhancementLevelInfo::EnhancementLevelInfo(const Stats&stats,const CraftingRequirement&craftingRequirement)
|
||||||
|
:stats(stats),craftingRequirement(craftingRequirement){}
|
@ -45,6 +45,7 @@ All rights reserved.
|
|||||||
#include "BitwiseEnum.h"
|
#include "BitwiseEnum.h"
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include "Merchant.h"
|
#include "Merchant.h"
|
||||||
|
#include "CraftingRequirement.h"
|
||||||
|
|
||||||
class Crawler;
|
class Crawler;
|
||||||
class ItemInfo;
|
class ItemInfo;
|
||||||
@ -102,12 +103,23 @@ public:
|
|||||||
const std::string GetStatsString(CompactText compact=NON_COMPACT)const;
|
const std::string GetStatsString(CompactText compact=NON_COMPACT)const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Stats;
|
||||||
|
class CraftingRequirement;
|
||||||
|
|
||||||
|
struct EnhancementLevelInfo{
|
||||||
|
const Stats&stats;
|
||||||
|
const CraftingRequirement&craftingRequirement;
|
||||||
|
EnhancementLevelInfo(const Stats&stats,const CraftingRequirement&craftingRequirement);
|
||||||
|
};
|
||||||
|
|
||||||
struct EnhancementInfo{
|
struct EnhancementInfo{
|
||||||
private:
|
private:
|
||||||
std::vector<Stats>enhancementStats;
|
std::vector<Stats>enhancementStats;
|
||||||
|
std::vector<CraftingRequirement>craftingRequirements;
|
||||||
public:
|
public:
|
||||||
void SetAttribute(int enhanceLevel,ItemAttribute attribute,float value);
|
void SetAttribute(int enhanceLevel,ItemAttribute attribute,float value);
|
||||||
const Stats&operator[](int level)const;
|
void SetCraftingRequirements(const int enhanceLevel,const std::vector<Item>&requiredItems,const uint32_t goldCost);
|
||||||
|
const EnhancementLevelInfo operator[](int level)const;
|
||||||
const size_t size()const;
|
const size_t size()const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 4874
|
#define VERSION_BUILD 4878
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user