Added Sound effect configuration and implementation.

This commit is contained in:
2024-01-08 05:26:20 -06:00
parent 6539bbdb50
commit 0643393b9c
13 changed files with 259 additions and 57 deletions
+12
View File
@@ -110,6 +110,7 @@ void ItemInfo::InitializeItems(){
Stats minStats;
Stats maxStats;
bool useDuringCast=false;
EventName useSound;
for(auto&[itemKey,itemValue]:data[key].GetKeys()){
std::string keyName=itemKey;
if(keyName=="Description"){
@@ -145,6 +146,9 @@ void ItemInfo::InitializeItems(){
}else
if(keyName=="SellValue"){
sellValue=data[key][keyName].GetInt();
}else
if(keyName=="UseSound"){
useSound=data[key][keyName].GetString();
}else{ //THis is a custom override modifier for a script. NO-OP
}
}
@@ -230,6 +234,7 @@ void ItemInfo::InitializeItems(){
it.buyValue=buyValue;
it.sellValue=sellValue;
it.useDuringCast=useDuringCast;
it.useSound=useSound;
if(slot.size()>0){
for(std::string&s:slot){
if(!nameToEquipSlot.count(s))ERR("WARNING! Tried to add item "<<it.name<<" to slot "<<s<<" which doesn't exist!");
@@ -1097,4 +1102,11 @@ Stats ItemInfo::RandomizeStats(){
const bool Item::HasRandomizedStats()const{
return randomizedStats.size()>0;
}
const EventName&ItemInfo::UseSound()const{
return useSound;
}
const EventName&Item::UseSound()const{
return it->UseSound();
}