Spells/Sounds

* get sounds from ScreenEffect.dbc and link to type Spell and type Sound
 * resolve ScreenEffect name in SpellDetailPage
Fixup
 * fix warning in UI escape sequence parsing
This commit is contained in:
Sarjuuk
2023-08-31 14:54:23 +02:00
parent 9b16f2d84a
commit ac34b47c26
8 changed files with 85 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
<?php
define('AOWOW_REVISION', 34);
define('AOWOW_REVISION', 35);
define('CLI', PHP_SAPI === 'cli');

View File

@@ -795,7 +795,7 @@ class Lang
// |4 - numeric switch <number> |4<singular>:<plural>[:<plural2>];
$var = preg_replace_callback('/([\d\.\,]+)([^\d]*)\|4([^:]*):([^:;]+)(?::([^;]+))?;/i', function ($m)
{
[$_, $num, $pad, $singular, $plural1, $plural2] = $m;
[$_, $num, $pad, $singular, $plural1, $plural2] = array_pad($m, 6, null);
if (self::$locId != LOCALE_RU || !$plural2)
return $num . $pad . ($num == 1 ? $singular : $plural1);

View File

@@ -131,6 +131,14 @@ class SoundPage extends GenericPage
impactarea = ?d
', $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId);
$seMiscValues = DB::Aowow()->selectCol('
SELECT `id` FROM ?_screeneffect_sounds WHERE
`ambienceDay` = ?d OR
`ambienceNight` = ?d OR
`musicDay` = ?d OR
`musicNight` = ?d
', $this->typeId, $this->typeId, $this->typeId, $this->typeId);
$cnd = array(
'OR',
['AND', ['effect1Id', 132], ['effect1MiscValue', $this->typeId]],
@@ -141,6 +149,14 @@ class SoundPage extends GenericPage
if ($displayIds)
$cnd[] = ['spellVisualId', $displayIds];
if ($seMiscValues)
$cnd[] = array(
'OR',
['AND', ['effect1AuraId', 260], ['effect1MiscValue', $seMiscValues]],
['AND', ['effect2AuraId', 260], ['effect2MiscValue', $seMiscValues]],
['AND', ['effect3AuraId', 260], ['effect3MiscValue', $seMiscValues]]
);
$spells = new SpellList($cnd);
if (!$spells->error)
{

View File

@@ -1170,11 +1170,17 @@ class SpellPage extends GenericPage
}
// tab: sounds
$data = [];
$seSounds = [];
for ($i = 1; $i < 4; $i++) // sounds from screen effect
if ($this->subject->getField('effect'.$i.'AuraId') == 260)
$seSounds = DB::Aowow()->selectRow('SELECT `ambienceDay`, `ambienceNight`, `musicDay`, `musicNight` FROM ?_screeneffect_sounds WHERE `id` = ?d', $this->subject->getField('effect'.$i.'MiscValue'));
$activitySounds = DB::Aowow()->selectRow('SELECT * FROM ?_spell_sounds WHERE id = ?d', $this->subject->getField('spellVisualId'));
array_shift($activitySounds); // remove id-column
if ($activitySounds)
if ($soundIDs = $activitySounds + $seSounds)
{
$sounds = new SoundList(array(['id', $activitySounds]));
$sounds = new SoundList(array(['id', $soundIDs]));
if (!$sounds->error)
{
$data = $sounds->getListviewData();
@@ -2165,6 +2171,10 @@ class SpellPage extends GenericPage
$bar = ' ('.Lang::game('npc').' #'.$effMV.')';
if ($n = CreatureList::getName($effMV))
$bar = ' (<a href="?npc='.$effMV.'">'.$n.'</a>)';
break;
case 260: // Screen Effect
if ($_ = DB::Aowow()->selectCell('SELECT `name` FROM ?_screeneffect_sounds WHERE `id` = ?d', $effMV))
$bar = User::isInGroup(U_GROUP_EMPLOYEE | U_GROUP_TESTER) ? sprintf(Util::$dfnString, 'MiscValue'.Lang::main('colon').$effMV, $_) : $_;
}
$foo['name'] .= strstr($bar, 'href') || strstr($bar, '#') ? $bar : ($bar ? ' ('.$bar.')' : null);

View File

@@ -2363,6 +2363,24 @@ CREATE TABLE `aowow_scalingstatvalues` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `aowow_screeneffect_sounds`
--
DROP TABLE IF EXISTS `aowow_screeneffect_sounds`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aowow_screeneffect_sounds` (
`id` smallint(5) unsigned NOT NULL,
`name` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
`ambienceDay` smallint(5) unsigned NOT NULL,
`ambienceNight` smallint(5) unsigned NOT NULL,
`musicDay` smallint(5) unsigned NOT NULL,
`musicNight` smallint(5) unsigned NOT NULL,
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `aowow_screenshots`
--
@@ -3232,7 +3250,7 @@ UNLOCK TABLES;
LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1692289952,0,NULL,NULL);
INSERT INTO `aowow_dbversion` VALUES (1693485225,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES;

View File

@@ -108,6 +108,7 @@ class DBC
'randproppoints' => 'niiiiiiiiiiiiiii',
'scalingstatdistribution' => 'niiiiiiiiiiiiiiiiiiiii',
'scalingstatvalues' => 'xniiiiiiiiiiiiiiiiiiiiii',
'screeneffect' => 'nsxxxxxxii',
'skillline' => 'nixsxsssxsxsxxxxxxxxsxsssxsxsxxxxxxxxixxxxxxxxxxxxxxxxxx',
'skilllineability' => 'niiiixxixiiixx',
'skilllinecategory' => 'nsxsssxsxsxxxxxxxxi',
@@ -215,6 +216,7 @@ class DBC
'randproppoints' => 'id,epic1,epic2,epic3,epic4,epic5,rare1,rare2,rare3,rare4,rare5,uncommon1,uncommon2,uncommon3,uncommon4,uncommon5',
'scalingstatdistribution' => 'id,statMod1,statMod2,statMod3,statMod4,statMod5,statMod6,statMod7,statMod8,statMod9,statMod10,modifier1,modifier2,modifier3,modifier4,modifier5,modifier6,modifier7,modifier8,modifier9,modifier10,maxLevel',
'scalingstatvalues' => 'id,shoulderMultiplier,trinketMultiplier,weaponMultiplier,rangedMultiplier,clothShoulderArmor,leatherShoulderArmor,mailShoulderArmor,plateShoulderArmor,weaponDPS1H,weaponDPS2H,casterDPS1H,casterDPS2H,rangedDPS,wandDPS,spellPower,primBudged,tertBudged,clothCloakArmor,clothChestArmor,leatherChestArmor,mailChestArmor,plateChestArmor',
'screeneffect' => 'id,name,soundAmbienceId,zoneMusicId',
'skillline' => 'id,categoryId,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8,description_loc0,description_loc2,description_loc3,description_loc4,description_loc6,description_loc8,iconId',
'skilllineability' => 'id,skillLineId,spellId,reqRaceMask,reqClassMask,reqSkillLevel,acquireMethod,skillLevelGrey,skillLevelYellow',
'skilllinecategory' => 'id,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8,index',

View File

@@ -19,7 +19,7 @@ SqlGen::register(new class extends SetupScript
// creatures
'npcsounds', 'creaturesounddata', 'creaturedisplayinfo', 'creaturemodeldata',
// spells
'spell', 'spellvisual', 'spellvisualkit',
'spell', 'spellvisual', 'spellvisualkit', 'screeneffect',
// zones
'soundambience', 'zonemusic', 'zoneintromusictable', 'worldstatezonesounds', 'areatable',
// items
@@ -423,6 +423,27 @@ SqlGen::register(new class extends SetupScript
subClassMask = subClassMask | (1 << isc.subClass)
');
/************************/
/* Screen Effect Sounds */
/************************/
CLI::write(' - linking to screen effects');
DB::Aowow()->query('TRUNCATE ?_screeneffect_sounds');
DB::Aowow()->query('
INSERT INTO
?_screeneffect_sounds
SELECT
se.id, se.name, IFNULL(sa.soundIdDay, 0), IFNULL(sa.soundIdNight, 0), IFNULL(zm.soundIdDay, 0), IFNULL(zm.soundIdNight, 0)
FROM
dbc_screeneffect se
LEFT JOIN
dbc_soundambience sa ON se.soundAmbienceId = sa.id
LEFT JOIN
dbc_zonemusic zm ON se.zoneMusicId = zm.id
');
$this->reapplyCCFlags('sounds', Type::SOUND);
return true;

View File

@@ -0,0 +1,12 @@
DROP TABLE IF EXISTS `aowow_screeneffect_sounds`;
CREATE TABLE `aowow_screeneffect_sounds` (
`id` SMALLINT(5) unsigned NOT NULL,
`name` VARCHAR(40) COLLATE utf8mb4_unicode_ci NOT NULL,
`ambienceDay` SMALLINT(5) unsigned NOT NULL,
`ambienceNight` SMALLINT(5) unsigned NOT NULL,
`musicDay` SMALLINT(5) unsigned NOT NULL,
`musicNight` SMALLINT(5) unsigned NOT NULL,
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' sounds');