diff --git a/Crawler/AttributableStat.h b/Crawler/AttributableStat.h
index 5af0d9e5..794da501 100644
--- a/Crawler/AttributableStat.h
+++ b/Crawler/AttributableStat.h
@@ -82,7 +82,7 @@ public:
ItemAttributable&operator+=(Stats&rhs);
//Returns a copy of all the attributes to be passed to a new instance easily / to sync values between both.
- inline void copyTo(ItemAttributable&target){
+ inline void copyTo(ItemAttributable&target)const{
target.attributes=attributes;
}
inline float&get(std::string_view a){
diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj
index e4a9683c..17811b08 100644
--- a/Crawler/Crawler.vcxproj
+++ b/Crawler/Crawler.vcxproj
@@ -595,6 +595,7 @@
+
diff --git a/Crawler/Crawler.vcxproj.filters b/Crawler/Crawler.vcxproj.filters
index a0aed0cf..73d81e47 100644
--- a/Crawler/Crawler.vcxproj.filters
+++ b/Crawler/Crawler.vcxproj.filters
@@ -767,6 +767,9 @@
Documentation\Menus
+
+ Configurations\Items
+
diff --git a/Crawler/Item.cpp b/Crawler/Item.cpp
index 709838f3..644fd9b2 100644
--- a/Crawler/Item.cpp
+++ b/Crawler/Item.cpp
@@ -43,6 +43,7 @@ All rights reserved.
#include "Ability.h"
#include "AttributableStat.h"
#include
+#include "util.h"
INCLUDE_game
INCLUDE_DATA
@@ -105,6 +106,8 @@ void ItemInfo::InitializeItems(){
std::vectorstatValueList;
uint32_t sellValue=0;
uint32_t buyValue=0;
+ Stats minStats;
+ Stats maxStats;
bool useDuringCast=false;
for(auto&[itemKey,itemValue]:data[key].GetKeys()){
std::string keyName=itemKey;
@@ -129,7 +132,7 @@ void ItemInfo::InitializeItems(){
}
}else
if(keyName=="StatValues"){
- for(int i=0;i0){
+ if(data[key].HasProperty("StatValues[0]")){ //This means this has enhancement levels.
EnhancementInfo enhancementStats;
for(int enhancementLevel=0;enhancementLevel<=10;enhancementLevel++){
uint8_t availableChapter=1;
datafile&dat=data[key]["StatValues["+std::to_string(enhancementLevel)+"]"];
- int attrIndex=0;
- for(ItemAttribute&attr:statValueList){
+ for(int attrIndex=0;ItemAttribute&attr:statValueList){
enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex));
attrIndex++;
}
@@ -191,6 +193,22 @@ void ItemInfo::InitializeItems(){
it.enhancement.SetAttribute(1,ItemAttribute::Get("Attack"),0.f);
it.enhancement.SetCraftingRequirements(1,itemsRequired,goldCost,availableChapter);
}
+
+ if(data[key].HasProperty("MinStats")){
+ if(data[key]["MinStats"].GetValueCount()!=statValueList.size())ERR(std::format("MinStats attribute count does not match statValueList attribute count {}!={}",data[key]["MinStats"].GetValueCount(),statValueList.size()));
+ for(int attrCount=0;ItemAttribute&attr:statValueList){
+ minStats.A(attr)=data[key]["MinStats"].GetReal(attrCount);
+ attrCount++;
+ }
+ }
+ if(data[key].HasProperty("MaxStats")){
+ if(data[key]["MaxStats"].GetValueCount()!=statValueList.size())ERR(std::format("MaxStats attribute count does not match statValueList attribute count {}!={}",data[key]["MaxStats"].GetValueCount(),statValueList.size()));
+ for(int attrCount=0;ItemAttribute&attr:statValueList){
+ maxStats.A(attr)=data[key]["MaxStats"].GetReal(attrCount);
+ attrCount++;
+ }
+ }
+ if(data[key].HasProperty("MinStats")^data[key].HasProperty("MaxStats"))ERR("Only one of MinStats/MaxStats was provided! Both are required!");
if(scriptName!=""){
if(scriptName=="RestoreDuringCast"){
@@ -228,6 +246,8 @@ void ItemInfo::InitializeItems(){
props.customProps=&data[key];
}
it.useFunc=scriptName;
+ it.minStats=minStats;
+ it.maxStats=maxStats;
#pragma region Equipment Category Verification Tests
int equipmentCategories=0;
@@ -372,11 +392,10 @@ void Inventory::AddItem(IT it,uint32_t amt,bool monsterDrop){
InsertIntoSortedInv((*_inventory.insert({it,std::make_shared- (amt,it)})).second);
}else{
auto inventory=_inventory.equal_range(it);
- std::accumulate(inventory.first,inventory.second,0,[&](int counter,std::pair>item){
+ if(std::accumulate(inventory.first,inventory.second,0,
+ [&](int counter,std::pair>item){
(*item.second).amt+=amt;
- if(counter>=1)ERR("WARNING! We should not have more than 1 instance of a stackable item!");
- return counter+1;
- });
+ return counter+1;})>1)ERR("WARNING! We should not have more than 1 instance of a stackable item!");
}
SkipAddingStackableItem:
@@ -542,7 +561,7 @@ const bool Item::IsEquippable()const{
}
const std::string Item::Description(CompactText compact)const{
std::string description=it->Description();
- if(IsEquippable()){
+ if(IsArmor()||IsWeapon()){
description+='\n';
description+=GetStats().GetStatsString(compact);
if(ItemSet()){
@@ -1026,4 +1045,26 @@ const bool Item::EnhancementIsPossible()const{
const uint8_t EnhancementInfo::AvailableChapter()const{
return availableChapter;
+}
+
+const Stats&Item::RandomStats()const{
+ return randomizedStats;
+};
+void Item::SetRandomStat(const ItemAttribute attr,const float val){
+ randomizedStats.A(attr)=val;
+};
+
+const Stats ItemInfo::GetMinStats()const{
+ return minStats;
+}
+const Stats ItemInfo::GetMaxStats()const{
+ return maxStats;
+}
+Stats ItemInfo::RandomizeStats(){
+ Stats randomRolls;
+ for(auto&[attr,minVal]:minStats){
+ float diff=maxStats.A(attr)-minVal;
+ randomRolls.A(attr)=util::random(diff)+minVal;
+ }
+ return randomRolls;
}
\ No newline at end of file
diff --git a/Crawler/Item.h b/Crawler/Item.h
index a4b0c6c4..cf43fc26 100644
--- a/Crawler/Item.h
+++ b/Crawler/Item.h
@@ -163,6 +163,7 @@ private:
static int IsBlankStaticCallCounter;
const bool _IsBlank()const;
static ItemEnhancementFunctionPrimingData enhanceFunctionPrimed;
+ Stats randomizedStats;
public:
Item();
Item(uint32_t amt,IT item,uint8_t enhancementLevel=0);
@@ -200,6 +201,8 @@ public:
const uint32_t SellValue()const;
const bool CanBeSold()const;
const bool CanBePurchased()const;
+ const Stats&RandomStats()const;
+ void SetRandomStat(const ItemAttribute attr,const float val);
const EnhancementInfo&GetEnhancementInfo()const;
//Use ISBLANK macro instead!! This should not be called directly!!
static bool IsBlank(std::shared_ptr
- item);
@@ -219,7 +222,7 @@ class Inventory{
public:
static void AddItem(IT it,uint32_t amt=1,bool monsterDrop=false);
//Returns the actual amount available in your main inventory.
- static uint32_t GetItemCount(IT it);
+ [[nodiscard]] static uint32_t GetItemCount(IT it);
static std::vector>CopyItem(IT it);
static std::vector>GetItem(IT it);
//Auto-executes its use function and removes the amt specified from the inventory. Multiple amounts will cause the item to execute its useFunc multiple times.
@@ -284,6 +287,8 @@ class ItemInfo{
uint32_t sellValue=0;
//If true, this item's action is activated at the beginning of the cast instead of after the cast completes.
bool useDuringCast=false;
+ Stats minStats;
+ Stats maxStats;
private:
static void InitializeScripts();
static void InitializeSets();
@@ -317,6 +322,9 @@ public:
const bool IsWeapon()const;
const bool IsArmor()const;
const bool IsAccessory()const;
+ const Stats GetMinStats()const;
+ const Stats GetMaxStats()const;
+ Stats RandomizeStats();
};
class ItemOverlay{
diff --git a/Crawler/Version.h b/Crawler/Version.h
index 0978322d..e09b5ee9 100644
--- a/Crawler/Version.h
+++ b/Crawler/Version.h
@@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
-#define VERSION_BUILD 5110
+#define VERSION_BUILD 5119
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Crawler/assets/config/items/Accessories.txt b/Crawler/assets/config/items/Accessories.txt
new file mode 100644
index 00000000..baae1af0
--- /dev/null
+++ b/Crawler/assets/config/items/Accessories.txt
@@ -0,0 +1,26 @@
+Equipment
+{
+ Ring of the Slime King
+ {
+ Slot = Ring1,Ring2
+ ItemCategory = Equipment
+
+ # See ItemStats.txt for valid stat names
+ StatValues = Health,Attack,Mana,Move Spd %
+ MinStats = 5,2,1,1
+ MaxStats = 20,4,4,3
+ SellValue = 90
+
+ }
+ Ring of the Bear
+ {
+ Slot = Ring1,Ring2
+ ItemCategory = Equipment
+
+ # See ItemStats.txt for valid stat names
+ StatValues = Health,Attack,Mana
+ MinStats = 4,4,1
+ MaxStats = 10,10,3
+ SellValue = 75
+ }
+}
\ No newline at end of file
diff --git a/Crawler/assets/config/items/Equipment.txt b/Crawler/assets/config/items/Equipment.txt
index da121275..242af795 100644
--- a/Crawler/assets/config/items/Equipment.txt
+++ b/Crawler/assets/config/items/Equipment.txt
@@ -7,7 +7,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 3,2,0
StatValues[1] = 4,3,0
@@ -93,7 +93,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 5,1,0
StatValues[1] = 6,1,0
@@ -179,7 +179,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 4,1,1
StatValues[1] = 5,1,1
@@ -265,7 +265,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 1,0,1
StatValues[1] = 2,0,3
@@ -351,7 +351,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 2,1,0
StatValues[1] = 3,1,1
@@ -437,7 +437,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 7,5,2
StatValues[1] = 9,5,2
@@ -523,7 +523,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 10,3,2
StatValues[1] = 11,4,2
@@ -609,7 +609,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 9,3,3
StatValues[1] = 10,3,4
@@ -695,7 +695,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 5,2,5
StatValues[1] = 6,2,5
@@ -781,7 +781,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 6,3,3
StatValues[1] = 7,3,3
@@ -867,7 +867,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 12,8,4
StatValues[1] = 13,8,4
@@ -953,7 +953,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 14,6,4
StatValues[1] = 15,7,4
@@ -1039,7 +1039,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 13,5,6
StatValues[1] = 14,5,7
@@ -1125,7 +1125,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 8,4,7
StatValues[1] = 8,4,8
@@ -1211,7 +1211,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 9,5,4
StatValues[1] = 9,5,5
@@ -1297,7 +1297,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 24,12,5
StatValues[1] = 29,12,5
@@ -1383,7 +1383,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 33,9,5
StatValues[1] = 37,10,5
@@ -1470,7 +1470,7 @@ Equipment
Description = Pants made out of hardened bone.
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 24,7,9
StatValues[1] = 26,8,10
@@ -1556,7 +1556,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 9,5,11
StatValues[1] = 10,5,12
@@ -1642,7 +1642,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Defense,Health,Attack
StatValues[0] = 11,7,7
StatValues[1] = 11,8,8
diff --git a/Crawler/assets/config/items/Weapons.txt b/Crawler/assets/config/items/Weapons.txt
index 690f0bfb..d14d9470 100644
--- a/Crawler/assets/config/items/Weapons.txt
+++ b/Crawler/assets/config/items/Weapons.txt
@@ -6,7 +6,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,Move Spd %
StatValues[0] = 5,5,0
StatValues[1] = 10,6,1
@@ -109,7 +109,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,Move Spd %
StatValues[0] = 5,5,0
StatValues[1] = 10,6,1
@@ -194,7 +194,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,Move Spd %
StatValues[0] = 5,5,0
StatValues[1] = 10,6,1
@@ -279,7 +279,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,Defense
StatValues[0] = 26,5,5
StatValues[1] = 31,6,10
@@ -364,7 +364,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,Defense
StatValues[0] = 26,5,5
StatValues[1] = 31,6,10
@@ -449,7 +449,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,Defense
StatValues[0] = 26,5,5
StatValues[1] = 31,6,10
@@ -534,7 +534,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,CDR,Mana
StatValues[0] = 47,5,0,0
StatValues[1] = 52,6,2,1
@@ -619,7 +619,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,CDR,Mana
StatValues[0] = 47,5,0,0
StatValues[1] = 52,6,2,1
@@ -704,7 +704,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate,CDR,Mana
StatValues[0] = 47,5,0,0
StatValues[1] = 52,6,2,1
@@ -789,7 +789,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate
StatValues[0] = 68,10
StatValues[1] = 73,12
@@ -874,7 +874,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate
StatValues[0] = 68,10
StatValues[1] = 73,12
@@ -959,7 +959,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
StatValues = Attack,Crit Rate
StatValues[0] = 68,10
StatValues[1] = 73,12
@@ -1044,7 +1044,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
# Attack Speed Increase reduces Cooldown of LeftClick Attacks (0.1 sec in this case)
StatValues = Attack,Crit Rate,Attack Spd
StatValues[0] = 89,5,0.1
@@ -1130,7 +1130,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
# Attack Speed Increase reduces Cooldown of LeftClick Attacks (0.1 sec in this case)
StatValues = Attack,Crit Rate,Attack Spd
StatValues[0] = 89,5,0.1
@@ -1216,7 +1216,7 @@ Equipment
ItemCategory = Equipment
# Stat Values of the item based on Enhancement level.
- # See ItemSets.txt for valid stat names
+ # See ItemStats.txt for valid stat names
# Attack Speed Increase reduces Cooldown of LeftClick Attacks (0.1 sec in this case)
StatValues = Attack,Crit Rate,Attack Spd
StatValues[0] = 89,5,0.1
diff --git a/Crawler/assets/config/items/items.txt b/Crawler/assets/config/items/items.txt
index c5da2ea6..86694c8a 100644
--- a/Crawler/assets/config/items/items.txt
+++ b/Crawler/assets/config/items/items.txt
@@ -5,6 +5,7 @@ ItemConfiguration
Item Categories = ItemCategory.txt
Equipment = Equipment.txt
Weapons = Weapons.txt
+ Accessories = Accessories.txt
}
Item
{
diff --git a/Crawler/assets/items/Ring of the Bear.png b/Crawler/assets/items/Ring of the Bear.png
new file mode 100644
index 00000000..fc470d45
Binary files /dev/null and b/Crawler/assets/items/Ring of the Bear.png differ
diff --git a/Crawler/assets/items/Ring of the Slime King.png b/Crawler/assets/items/Ring of the Slime King.png
new file mode 100644
index 00000000..a66e6b99
Binary files /dev/null and b/Crawler/assets/items/Ring of the Slime King.png differ
diff --git a/Crawler/assets/items/Ring.png b/Crawler/assets/items/Ring.png
new file mode 100644
index 00000000..90476243
Binary files /dev/null and b/Crawler/assets/items/Ring.png differ