Compare commits
4 Commits
master
...
hotfix/iss
Author | SHA1 | Date | |
---|---|---|---|
![]() |
48c67c9344 | ||
![]() |
3e43860efc | ||
![]() |
6ddf1a3224 | ||
![]() |
02438563c5 |
@ -67,12 +67,14 @@
|
|||||||
# Rate Drop rate of item. (Default: 1)
|
# Rate Drop rate of item. (Default: 1)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
||||||
# - Item Item name.
|
# - Item Item name.
|
||||||
# Rate Drop rate of item. (Default: 1)
|
# Rate Drop rate of item. (Default: 1)
|
||||||
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
Header:
|
Header:
|
||||||
|
@ -67,12 +67,14 @@
|
|||||||
# Rate Drop rate of item. (Default: 1)
|
# Rate Drop rate of item. (Default: 1)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
||||||
# - Item Item name.
|
# - Item Item name.
|
||||||
# Rate Drop rate of item. (Default: 1)
|
# Rate Drop rate of item. (Default: 1)
|
||||||
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
Header:
|
Header:
|
||||||
|
@ -67,12 +67,14 @@
|
|||||||
# Rate Drop rate of item.
|
# Rate Drop rate of item.
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
||||||
# - Item Item name.
|
# - Item Item name.
|
||||||
# Rate Drop rate of item.
|
# Rate Drop rate of item.
|
||||||
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
Header:
|
Header:
|
||||||
|
@ -67,12 +67,14 @@
|
|||||||
# Rate Drop rate of item.
|
# Rate Drop rate of item.
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
||||||
# - Item Item name.
|
# - Item Item name.
|
||||||
# Rate Drop rate of item.
|
# Rate Drop rate of item.
|
||||||
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
Header:
|
Header:
|
||||||
|
@ -50,10 +50,12 @@
|
|||||||
# Rate Drop rate of item.
|
# Rate Drop rate of item.
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
# Drops: List of possible normal item drops. Max of MAX_MOB_DROP. (Optional)
|
||||||
# - Item Item name.
|
# - Item Item name.
|
||||||
# Rate Drop rate of item.
|
# Rate Drop rate of item.
|
||||||
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
# StealProtected If the item is shielded from TF_STEAL. (Default: false)
|
||||||
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
# RandomOptionGroup Random Option Group applied to item on drop. (Default: None)
|
||||||
# Index Index used for overwriting item. (Optional)
|
# Index Index used for overwriting item. (Optional)
|
||||||
|
# Clear If an index is given only the specific drop is cleared otherwise all drops are cleared. (Optional)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -149,7 +149,11 @@ void YamlDatabase::parse( const ryml::Tree& tree ){
|
|||||||
const char* fileName = this->currentFile.c_str();
|
const char* fileName = this->currentFile.c_str();
|
||||||
|
|
||||||
for( const ryml::NodeRef &node : bodyNode ){
|
for( const ryml::NodeRef &node : bodyNode ){
|
||||||
|
if( this->nodeExists( node, "Remove" ) ){
|
||||||
|
this->removeBodyNode( node );
|
||||||
|
}else{
|
||||||
count += this->parseBodyNode( node );
|
count += this->parseBodyNode( node );
|
||||||
|
}
|
||||||
|
|
||||||
ShowStatus( "Loading [%" PRIdPTR "/%" PRIdPTR "] entries from '" CL_WHITE "%s" CL_RESET "'" CL_CLL "\r", ++childNodesProgressed, childNodesCount, fileName );
|
ShowStatus( "Loading [%" PRIdPTR "/%" PRIdPTR "] entries from '" CL_WHITE "%s" CL_RESET "'" CL_CLL "\r", ++childNodesProgressed, childNodesCount, fileName );
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ private:
|
|||||||
bool load( const std::string& path );
|
bool load( const std::string& path );
|
||||||
void parse( const ryml::Tree& rootNode );
|
void parse( const ryml::Tree& rootNode );
|
||||||
void parseImports( const ryml::Tree& rootNode );
|
void parseImports( const ryml::Tree& rootNode );
|
||||||
template <typename R> bool asType( const ryml::NodeRef& node, const std::string& name, R& out );
|
|
||||||
|
|
||||||
// These should be visible/usable by the implementation provider
|
// These should be visible/usable by the implementation provider
|
||||||
protected:
|
protected:
|
||||||
@ -43,6 +42,7 @@ protected:
|
|||||||
std::string getCurrentFile();
|
std::string getCurrentFile();
|
||||||
|
|
||||||
// Conversion functions
|
// Conversion functions
|
||||||
|
template <typename R> bool asType( const ryml::NodeRef& node, const std::string& name, R& out );
|
||||||
bool asBool(const ryml::NodeRef& node, const std::string &name, bool &out);
|
bool asBool(const ryml::NodeRef& node, const std::string &name, bool &out);
|
||||||
bool asInt16(const ryml::NodeRef& node, const std::string& name, int16& out );
|
bool asInt16(const ryml::NodeRef& node, const std::string& name, int16& out );
|
||||||
bool asUInt16(const ryml::NodeRef& node, const std::string& name, uint16& out);
|
bool asUInt16(const ryml::NodeRef& node, const std::string& name, uint16& out);
|
||||||
@ -76,6 +76,7 @@ public:
|
|||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
virtual const std::string getDefaultLocation() = 0;
|
virtual const std::string getDefaultLocation() = 0;
|
||||||
virtual uint64 parseBodyNode( const ryml::NodeRef& node ) = 0;
|
virtual uint64 parseBodyNode( const ryml::NodeRef& node ) = 0;
|
||||||
|
virtual void removeBodyNode( const ryml::NodeRef& node ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename keytype, typename datatype> class TypesafeYamlDatabase : public YamlDatabase{
|
template <typename keytype, typename datatype> class TypesafeYamlDatabase : public YamlDatabase{
|
||||||
@ -138,6 +139,14 @@ public:
|
|||||||
void erase(keytype key) {
|
void erase(keytype key) {
|
||||||
this->data.erase(key);
|
this->data.erase(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeBodyNode( const ryml::NodeRef& node ){
|
||||||
|
keytype key;
|
||||||
|
|
||||||
|
if( this->asType<keytype>( node, "Remove", key ) ){
|
||||||
|
this->data.erase( key );
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename keytype, typename datatype> class TypesafeCachedYamlDatabase : public TypesafeYamlDatabase<keytype, datatype>{
|
template <typename keytype, typename datatype> class TypesafeCachedYamlDatabase : public TypesafeYamlDatabase<keytype, datatype>{
|
||||||
|
@ -4205,13 +4205,63 @@ bool MobDatabase::parseDropNode(std::string nodeName, const ryml::NodeRef& node,
|
|||||||
this->invalidWarning(dropit["Index"], "Invalid monster %s index %hu. Must be between 0~%hu, skipping.\n", nodeName.c_str(), index, max - 1);
|
this->invalidWarning(dropit["Index"], "Invalid monster %s index %hu. Must be between 0~%hu, skipping.\n", nodeName.c_str(), index, max - 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
index = i++;
|
|
||||||
|
|
||||||
if (index >= max) {
|
if( this->nodeExists( dropit, "Clear" ) ){
|
||||||
|
bool clear;
|
||||||
|
|
||||||
|
if( !this->asBool( dropit, "Clear", clear ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( clear ){
|
||||||
|
// Clear specific index
|
||||||
|
drops[index] = {};
|
||||||
|
|
||||||
|
if( !this->nodeExists( dropit, "Item" ) ){
|
||||||
|
// Continue with next yaml node
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Find next empty slot
|
||||||
|
for( ; i < max; i++ ){
|
||||||
|
if( drops[i].nameid == 0 ){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No empty slots anymore
|
||||||
|
if (i >= max) {
|
||||||
this->invalidWarning(dropit, "Maximum of %d monster %s met, skipping.\n", max, nodeName.c_str());
|
this->invalidWarning(dropit, "Maximum of %d monster %s met, skipping.\n", max, nodeName.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use free index and increment it for the next entry
|
||||||
|
index = i++;
|
||||||
|
|
||||||
|
if( this->nodeExists( dropit, "Clear" ) ){
|
||||||
|
bool clear;
|
||||||
|
|
||||||
|
if( !this->asBool( dropit, "Clear", clear ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( clear ){
|
||||||
|
// Clear all
|
||||||
|
for( uint8 j = 0; j < max; j++ ){
|
||||||
|
drops[j] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset current index for next entry
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
if( !this->nodeExists( dropit, "Item" ) ){
|
||||||
|
// Continue with next yaml node
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
|
@ -362,8 +362,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clear() override{ };
|
void clear() override{ };
|
||||||
const std::string getDefaultLocation() override;
|
void removeBodyNode(const ryml::NodeRef& node) override{ };
|
||||||
uint64 parseBodyNode(const ryml::NodeRef& node) override;
|
const std::string getDefaultLocation();
|
||||||
|
uint64 parseBodyNode(const ryml::NodeRef& node);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct s_randomsummon_entry {
|
struct s_randomsummon_entry {
|
||||||
|
@ -2078,6 +2078,7 @@ public:
|
|||||||
void clear() override{ }
|
void clear() override{ }
|
||||||
const std::string getDefaultLocation() override;
|
const std::string getDefaultLocation() override;
|
||||||
uint64 parseBodyNode(const ryml::NodeRef& node) override;
|
uint64 parseBodyNode(const ryml::NodeRef& node) override;
|
||||||
|
void removeBodyNode( const ryml::NodeRef& node ) override { };
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14628,6 +14628,21 @@ uint64 AttributeDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AttributeDatabase::removeBodyNode( const ryml::NodeRef& node ){
|
||||||
|
uint16 level;
|
||||||
|
|
||||||
|
if( !this->asUInt16( node, "Level", level ) ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !CHK_ELEMENT_LEVEL( level ) ){
|
||||||
|
this->invalidWarning( node["Level"], "Invalid element level %hu.\n", level );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::fill_n( &attr_fix_table[level - 1][0][0], ELE_MAX * ELE_MAX, 100 );
|
||||||
|
}
|
||||||
|
|
||||||
AttributeDatabase elemental_attribute_db;
|
AttributeDatabase elemental_attribute_db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,6 +137,7 @@ public:
|
|||||||
}
|
}
|
||||||
const std::string getDefaultLocation() override;
|
const std::string getDefaultLocation() override;
|
||||||
uint64 parseBodyNode(const ryml::NodeRef& node) override;
|
uint64 parseBodyNode(const ryml::NodeRef& node) override;
|
||||||
|
void removeBodyNode( const ryml::NodeRef& node ) override;
|
||||||
|
|
||||||
// Additional
|
// Additional
|
||||||
int16 getAttribute(uint16 level, uint16 atk_ele, uint16 def_ele);
|
int16 getAttribute(uint16 level, uint16 atk_ele, uint16 def_ele);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user