38 g_Game.ConfigGetTextArray(
m_CfgPath +
" attachSoundSlot", cfgSlotArray);
40 int soundSetCount = cfgSoundsetArray.Count();
41 if (soundSetCount > 0 && soundSetCount == cfgSlotArray.Count())
45 for (
int i = 0; i < soundSetCount; ++i)
47 string soundSet = cfgSoundsetArray[i];
50 ErrorEx(
string.Format(
"[%1] Try to register attach sound set with empty string not allowed! Please check attachSoundSet configuration for item %2", i,
m_Name));
57 ErrorEx(
string.Format(
"[%1] Try to register attach sound set %2 with empty slot name. Please check attachSoundSlot configuration for item %3", i, soundSet,
m_Name));
61 int slotId = InventorySlots.GetSlotIdFromString(
slotName);
62 if (slotId == InventorySlots.INVALID)
64 ErrorEx(
string.Format(
"[%1] Try to register attach sound set %2 with invalid slot ID %3 (slot name: %4). Please check attachSoundSlot configuration for item %5", i, soundSet, slotId,
slotName,
m_Name));
71 #ifdef ITEM_SOUND_EVENTS_DEBUG
77 #ifdef ITEM_SOUND_EVENTS_DEBUG
92 g_Game.ConfigGetTextArray(
m_CfgPath +
" detachSoundSet", cfgSoundsetArray);
93 g_Game.ConfigGetTextArray(
m_CfgPath +
" detachSoundSlot", cfgSlotArray);
95 if (cfgSoundsetArray.Count() > 0 && cfgSoundsetArray.Count() == cfgSlotArray.Count())
99 for (
int i = 0; i < cfgSoundsetArray.Count(); ++i)
101 string soundSet = cfgSoundsetArray[i];
104 ErrorEx(
string.Format(
"[%1] Try to register detach sound set %2 but sting is empty! Please check detachSoundSet configuration for item %3", i, soundSet,
m_Name));
111 ErrorEx(
string.Format(
"[%1] Try to register detach sound set %2 with invalid slot name %3. Please check detachSoundSlot configuration for item %4", i, soundSet,
slotName,
m_Name));
118 ErrorEx(
string.Format(
"[%1] Try to register detach sound set %2 with invalid slot ID %3 (slot name: %4). Please check detachSoundSlot configuration for item %5", i, soundSet, slotId,
slotName,
m_Name));
125 #ifdef ITEM_SOUND_EVENTS_DEBUG
131 #ifdef ITEM_SOUND_EVENTS_DEBUG
144 private string m_DropSoundSet;
146 void InventoryItemType()
151 void ~InventoryItemType()
162 int soundCount =
g_Game.ConfigGetChildrenCount(cfgPath);
167 soundCount =
g_Game.ConfigGetChildrenCount(cfgPath);
173 soundCount =
g_Game.ConfigGetChildrenCount(cfgPath);
178 cfgPath =
CFG_AMMO +
" " +
name +
" AnimEvents SoundWeapon";
179 soundCount =
g_Game.ConfigGetChildrenCount(cfgPath);
182 for (
int i = 0; i < soundCount; ++i)
185 g_Game.ConfigGetChildName(cfgPath, i, soundName);
186 string soundPath = cfgPath +
" " + soundName +
" ";
187 AnimSoundEvent soundEvent =
new AnimSoundEvent(soundPath);
188 if (soundEvent.IsValid())
191 #ifdef ITEM_SOUND_EVENTS_DEBUG
192 ErrorEx(
string.Format(
"[%1] Registered animation sound event for item %2. Sound name= %3 | Sound path= %4", i,
name, soundName, soundPath),
ErrorExSeverity.INFO);
195 #ifdef ITEM_SOUND_EVENTS_DEBUG
198 ErrorEx(
string.Format(
"[%1] Skipped registration of animation sound event for item %2. Sound event invalid in configuration class! Sound name= %3 | Sound path= %4", i,
name, soundName, soundPath),
ErrorExSeverity.INFO);
203 SetDetachSoundEvent();
204 SetAttachSoundEvent();
207 bool SetDetachSoundEvent()
213 string soundPath = cfgPath +
" detachSoundSet";
214 g_Game.ConfigGetTextArray(soundPath, cfgDetachSoundsetArray);
215 int soundCount = cfgDetachSoundsetArray.Count();
220 soundPath = cfgPath +
" detachSoundSet";
221 g_Game.ConfigGetTextArray(soundPath, cfgDetachSoundsetArray);
222 soundCount = cfgDetachSoundsetArray.Count();
228 soundPath = cfgPath +
" detachSoundSet";
229 g_Game.ConfigGetTextArray(soundPath, cfgDetachSoundsetArray);
230 soundCount = cfgDetachSoundsetArray.Count();
236 soundPath = cfgPath +
" detachSoundSet";
237 g_Game.ConfigGetTextArray(soundPath, cfgDetachSoundsetArray);
238 soundCount = cfgDetachSoundsetArray.Count();
243 m_ActionSoundEvents.Set(SoundConstants.ITEM_DETACH,
new InventoryItemSoundDetach(
name, cfgPath));
244 #ifdef ITEM_SOUND_EVENTS_DEBUG
249 #ifdef ITEM_SOUND_EVENTS_DEBUG
252 ErrorEx(
string.Format(
"Skipped creation of detach sound event instance for item %1. No detach sound in configuration class!",
GetName()),
ErrorExSeverity.INFO);
259 bool SetAttachSoundEvent()
265 string soundPath = cfgPath +
" attachSoundSet";
266 g_Game.ConfigGetTextArray(soundPath, cfgAttachSoundsetArray);
267 int soundCount = cfgAttachSoundsetArray.Count();
272 soundPath = cfgPath +
" attachSoundSet";
273 g_Game.ConfigGetTextArray(soundPath, cfgAttachSoundsetArray);
274 soundCount = cfgAttachSoundsetArray.Count();
280 soundPath = cfgPath +
" attachSoundSet";
281 g_Game.ConfigGetTextArray(soundPath, cfgAttachSoundsetArray);
282 soundCount = cfgAttachSoundsetArray.Count();
288 soundPath = cfgPath +
" attachSoundSet";
289 g_Game.ConfigGetTextArray(soundPath, cfgAttachSoundsetArray);
290 soundCount = cfgAttachSoundsetArray.Count();
295 m_ActionSoundEvents.Set(SoundConstants.ITEM_ATTACH,
new InventoryItemSoundAttach(
name, cfgPath));
296 #ifdef ITEM_SOUND_EVENTS_DEBUG
301 #ifdef ITEM_SOUND_EVENTS_DEBUG
304 ErrorEx(
string.Format(
"Skipped creation of attach sound event instance for item %1. No attach sound in configuration class!",
name),
ErrorExSeverity.INFO);
316 InventoryItemSoundAttach GetAttachSoundEvent()
318 return InventoryItemSoundAttach.Cast(m_ActionSoundEvents[SoundConstants.ITEM_ATTACH]);
321 InventoryItemSoundDetach GetDetachSoundEvent()
323 return InventoryItemSoundDetach.Cast(m_ActionSoundEvents[SoundConstants.ITEM_DETACH]);
326 string GetSlotAttachSoundSet(
int slotId = InventorySlots.INVALID)
328 InventoryItemSoundAttach soundEvent = GetAttachSoundEvent();
331 #ifdef ITEM_SOUND_EVENTS_DEBUG
338 map<int, string> soundSets = soundEvent.GetAttachSoundSets();
339 if (soundSets && soundSets.Count() > 0)
341 if (slotId != InventorySlots.INVALID)
343 soundSets.Find(slotId, soundSet);
347 soundSet = soundSets.GetElement(0);
353 string GetSlotDetachSoundSet(
int slotId = InventorySlots.INVALID)
355 InventoryItemSoundDetach soundEvent = GetDetachSoundEvent();
358 #ifdef ITEM_SOUND_EVENTS_DEBUG
365 map<int, string> soundSets = soundEvent.GetDetachSoundSets();
366 if (soundSets && soundSets.Count() > 0)
368 if (slotId != InventorySlots.INVALID)
370 soundSets.Find(slotId, soundSet);
374 soundSet = soundSets.GetElement(0);
381 ref array<ref AnimSoundEvent> m_animSoundEvents;
class InventoryItemSoundBase LoadSoundEvents()
InventoryItemSoundDetach m_AnimSoundEvents
ref map< int, string > m_AttachSoundSets
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
ref map< int, string > m_AttachSoundSets
ref map< int, string > m_DetachSoundSets
ref map< int, string > GetAttachSoundSets()
ref map< int, string > GetDetachSoundSets()
void InventoryItemSoundBase(string name, string cfgPath)
provides access to slot configuration
class DayZPlayerTypeAttachmentSoundLookupTable GetSoundEvent(int event_id)
array< string > TStringArray
proto string GetName()
Suite class name getter. Strictly for UI porposes!