Added Rings to equipment lists. Add randomized stats functionality.

pull/28/head
sigonasr2 11 months ago
parent c1391f153c
commit c2d9178de3
  1. 2
      Crawler/AttributableStat.h
  2. 1
      Crawler/Crawler.vcxproj
  3. 3
      Crawler/Crawler.vcxproj.filters
  4. 59
      Crawler/Item.cpp
  5. 10
      Crawler/Item.h
  6. 2
      Crawler/Version.h
  7. 26
      Crawler/assets/config/items/Accessories.txt
  8. 40
      Crawler/assets/config/items/Equipment.txt
  9. 30
      Crawler/assets/config/items/Weapons.txt
  10. 1
      Crawler/assets/config/items/items.txt
  11. BIN
      Crawler/assets/items/Ring of the Bear.png
  12. BIN
      Crawler/assets/items/Ring of the Slime King.png
  13. BIN
      Crawler/assets/items/Ring.png

@ -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){

@ -595,6 +595,7 @@
<Text Include="assets\config\configuration.txt" />
<Text Include="assets\config\gfx\gfx.txt" />
<Text Include="assets\config\gfx\themes.txt" />
<Text Include="assets\config\items\Accessories.txt" />
<Text Include="assets\config\items\Equipment.txt" />
<Text Include="assets\config\items\ItemCategory.txt" />
<Text Include="assets\config\items\ItemDatabase.txt" />

@ -767,6 +767,9 @@
<Text Include="Merchant%27s Items.txt">
<Filter>Documentation\Menus</Filter>
</Text>
<Text Include="assets\config\items\Accessories.txt">
<Filter>Configurations\Items</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<Image Include="assets\heart.ico">

@ -43,6 +43,7 @@ All rights reserved.
#include "Ability.h"
#include "AttributableStat.h"
#include <numeric>
#include "util.h"
INCLUDE_game
INCLUDE_DATA
@ -105,6 +106,8 @@ void ItemInfo::InitializeItems(){
std::vector<ItemAttribute>statValueList;
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;i<data[key]["StatValues"].GetValueCount();i++){
for(int i=0;i<data[key][keyName].GetValueCount();i++){
statValueList.push_back(ItemAttribute::Get(data[key]["StatValues"].GetString(i)));
}
}else
@ -147,13 +150,12 @@ void ItemInfo::InitializeItems(){
ItemInfo&it=ITEM_DATA[key];
if(statValueList.size()>0){
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<Item>(amt,it)})).second);
}else{
auto inventory=_inventory.equal_range(it);
std::accumulate(inventory.first,inventory.second,0,[&](int counter,std::pair<IT,std::shared_ptr<Item>>item){
if(std::accumulate(inventory.first,inventory.second,0,
[&](int counter,std::pair<IT,std::shared_ptr<Item>>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;
}

@ -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>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<std::shared_ptr<Item>>CopyItem(IT it);
static std::vector<std::weak_ptr<Item>>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{

@ -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

@ -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
}
}

@ -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

@ -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

@ -5,6 +5,7 @@ ItemConfiguration
Item Categories = ItemCategory.txt
Equipment = Equipment.txt
Weapons = Weapons.txt
Accessories = Accessories.txt
}
Item
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Loading…
Cancel
Save