Merge DarkflameServer

This commit is contained in:
TheMatt2
2022-01-30 13:40:08 -05:00
77 changed files with 1019 additions and 331 deletions

View File

@@ -40,13 +40,13 @@ std::string CDBehaviorParameterTable::GetName(void) const {
return "BehaviorParameter";
}
float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name)
float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue)
{
size_t hash = 0;
GeneralUtils::hash_combine(hash, behaviorID);
GeneralUtils::hash_combine(hash, name);
// Search for specific perameter
// Search for specific parameter
const auto& it = m_Entries.find(hash);
if (it != m_Entries.end()) {
return it->second;
@@ -55,7 +55,7 @@ float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::s
// Check if this behavior has already been checked
const auto& itChecked = m_Entries.find(behaviorID);
if (itChecked != m_Entries.end()) {
return itChecked->second;
return defaultValue;
}
#ifndef CDCLIENT_CACHE_ALL
@@ -86,5 +86,5 @@ float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::s
}
#endif
return 0;
return defaultValue;
}

View File

@@ -35,5 +35,5 @@ public:
*/
std::string GetName(void) const override;
float GetEntry(const uint32_t behaviorID, const std::string& name);
float GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
};

View File

@@ -58,7 +58,7 @@ CDMissionsTable::CDMissionsTable(void) {
entry.reward_item2_repeatable = tableData.getIntField(32, -1);
entry.reward_item2_repeat_count = tableData.getIntField(33, -1);
entry.reward_item3_repeatable = tableData.getIntField(34, -1);
entry.reward_item3_repeat_count = tableData.getIntField(34, -1);
entry.reward_item3_repeat_count = tableData.getIntField(35, -1);
entry.reward_item4_repeatable = tableData.getIntField(36, -1);
entry.reward_item4_repeat_count = tableData.getIntField(37, -1);
entry.time_limit = tableData.getIntField(38, -1);