Implemented new type: mail

* display and link clientside mails to other types and events
 * fixed favorites menu for new types
 * fixed sorting column triggered spells in enchantment listview
 * some misc cleanups
This commit is contained in:
Sarjuuk
2018-12-15 01:49:55 +01:00
parent ccef11323b
commit fd04e9f977
38 changed files with 682 additions and 171 deletions

View File

@@ -1583,13 +1583,13 @@ CREATE TABLE `aowow_loot_link` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `aowow_mailtemplate`
-- Table structure for table `aowow_mails`
--
DROP TABLE IF EXISTS `aowow_mailtemplate`;
DROP TABLE IF EXISTS `aowow_mails`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aowow_mailtemplate` (
CREATE TABLE `aowow_mails` (
`id` smallint(5) unsigned NOT NULL,
`subject_loc0` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc2` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
@@ -1597,12 +1597,12 @@ CREATE TABLE `aowow_mailtemplate` (
`subject_loc4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc8` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc0` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc2` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc3` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc4` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc6` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc8` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc0` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc2` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc3` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc4` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc6` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc8` text COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@@ -198,13 +198,13 @@ class CLISetup
$dbc = new DBC($name, ['temporary' => self::$tmpDBC]);
if ($dbc->error)
{
CLI::write('SqlGen::generate() - required DBC '.$name.'.dbc not found!', CLI::LOG_ERROR);
CLI::write('CLISetup::loadDBC() - required DBC '.$name.'.dbc not found!', CLI::LOG_ERROR);
return false;
}
if (!$dbc->readFile())
{
CLI::write('SqlGen::generate() - DBC '.$name.'.dbc could not be written to DB!', CLI::LOG_ERROR);
CLI::write('CLISetup::loadDBC() - DBC '.$name.'.dbc could not be written to DB!', CLI::LOG_ERROR);
return false;
}

View File

@@ -24,9 +24,9 @@ function firstrun()
/****************/
$steps = array(
// clisetup/, params, test script result, introText, errorText
// clisetup, params, test function, introText, errorText
['dbconfig', null, 'testDB', 'Please enter your database credentials.', 'could not establish connection to:'],
['siteconfig', null, 'testSelf', 'SITE_HOST and STATIC_HOST '.CLI::bold('must').' be set. Also enable FORCE_SSL if needed. You may also want to change other variables such as NAME, NAME_SHORT OR LOCALES.', 'could not access:'],
['siteconfig', null, 'testSelf', 'SITE_HOST and STATIC_HOST '.CLI::bold('must').' be set. Also enable FORCE_SSL if needed. You may also want to change other variables such as NAME, NAME_SHORT or LOCALES.', 'could not access:'],
// sql- and build- stuff here
['SqlGen::generate', 'achievementcategory', null, null, null],
['SqlGen::generate', 'achievementcriteria', null, null, null],
@@ -37,7 +37,7 @@ function firstrun()
['SqlGen::generate', 'itemlimitcategory', null, null, null],
['SqlGen::generate', 'itemrandomproppoints', null, null, null],
['SqlGen::generate', 'lock', null, null, null],
['SqlGen::generate', 'mailtemplate', null, null, null],
['SqlGen::generate', 'mails', null, null, null],
['SqlGen::generate', 'scalingstatdistribution', null, null, null],
['SqlGen::generate', 'scalingstatvalues', null, null, null],
['SqlGen::generate', 'spellfocusobject', null, null, null],
@@ -184,7 +184,7 @@ function firstrun()
if ($resp == 301 || $resp == 302)
{
CLI::write('self test received status '.CLI::bold($resp).' (page moved) for '.$conf.', pointing to: '.$protocol.$host.$testFile, CLI::LOG_WARN);
$inp = ['x' => ['should '.CLI::bold($conf).' be set to '.CLI::bold($host).' and force_ssl be updated?', true, '/y|n/i']];
$inp = ['x' => ['should '.CLI::bold($conf).' be set to '.CLI::bold($host).' and force_ssl be updated? (y/n)', true, '/y|n/i']];
if (!CLI::readInput($inp, true) || !$inp || strtolower($inp['x']) == 'n')
$error[] = ' * could not access '.$protocol.$host.$testFile.' ['.$resp.']';
else

View File

@@ -217,7 +217,7 @@ if (!CLI)
if (isset(FileGen::$cliOpts['loadingscreens']))
$groups[] = 11;
// filter by pasaed options
// filter by passed options
if (!$groups) // by default do not generate loadingscreens
unset($paths[11]);
else
@@ -373,8 +373,8 @@ if (!CLI)
/*
ready for some major bullshitery? well, here it comes anyway!
the class-icon tile [idx: 4] isn't 64x64 but 63x64 .. the right side border is 1px short
so if we don't watch out, the icons start to shift over and show the borderi
also the icon border is displayced by 1px
so if we don't watch out, the icons start to shift over and show the border
also the icon border is displaced by 1px
*/
$from = array(
'x' => $borderOffset + 1 + ($tileSize - ($i == 4 ? 1 : 0)) * $x,

View File

@@ -9,10 +9,52 @@ if (!CLI)
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'mails';
protected $command = 'mailtemplate';
protected $dbcSourceFiles = ['mailtemplate'];
public function generate(array $ids = []) : bool
{
DB::Aowow()->query('TRUNCATE aowow_mails');
// copy data over from dbc
DB::Aowow()->query('INSERT INTO ?_mails SELECT *, 0 FROM dbc_mailtemplate');
CLI::write('SqlGen::generate() - merging achievement_reward into aowow_mails');
$acvMail = DB::World()->select('
SELECT
-ar.ID,
IFNULL(ar.Subject, "") AS s0, IFNULL(arl2.Subject, "") AS s2, IFNULL(arl3.Subject, "") AS s3, IFNULL(arl4.Subject, "") AS s4, IFNULL(arl6.Subject, "") AS s6, IFNULL(arl8.Subject, "") AS s8,
IFNULL(ar.Text, "") AS t0, IFNULL(arl2.Text, "") AS t2, IFNULL(arl3.Text, "") AS t3, IFNULL(arl4.Text, "") AS t4, IFNULL(arl6.Text, "") AS t6, IFNULL(arl8.Text, "") AS t8,
ItemID
FROM
achievement_reward ar
LEFT JOIN
achievement_reward_locale arl2 ON ar.ID = arl2.ID AND arl2.Locale = "frFR"
LEFT JOIN
achievement_reward_locale arl3 ON ar.ID = arl3.ID AND arl3.Locale = "deDE"
LEFT JOIN
achievement_reward_locale arl4 ON ar.ID = arl4.ID AND arl4.Locale = "zhCN"
LEFT JOIN
achievement_reward_locale arl6 ON ar.ID = arl6.ID AND arl6.Locale = "esES"
LEFT JOIN
achievement_reward_locale arl8 ON ar.ID = arl8.ID AND arl8.Locale = "ruRU"
WHERE
ar.MailTemplateID = 0 AND ar.Text <> ""
');
DB::Aowow()->query('INSERT INTO aowow_mails VALUES (?a)', array_values($acvMail));
CLI::write('SqlGen::generate() - merging mail_loot_template into aowow_mails');
// assume mails to only contain one single item, wich works for an unmodded installation
$mlt = DB::World()->selectCol('SELECT Entry AS ARRAY_KEY, Item FROM mail_loot_template');
foreach ($mlt as $k => $v)
DB::Aowow()->query('UPDATE ?_mails SET attachment = ?d WHERE id = ?d', $v, $k);
return true;
}
});
?>

View File

@@ -1070,7 +1070,7 @@ SqlGen::register(new class extends SetupScript
continue;
$effects = $tSpells[$spellId];
$trainerId = $npc['entry'] > 200000 || $npc['qty'] > 1 ? null : $npc['entry'];
$trainerId = $npc['entry'] > 200000 || $npc['qty'] > 1 ? 0 : $npc['entry'];
$triggered = false;
for ($i = 1; $i <= 3; $i++)

View File

@@ -0,0 +1,21 @@
DROP TABLE IF EXISTS `aowow_mailtemplate`;
DROP TABLE IF EXISTS `aowow_mails`;
CREATE TABLE `aowow_mails` (
`id` smallint(5) unsigned NOT NULL,
`subject_loc0` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc2` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc3` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc4` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc6` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject_loc8` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc0` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc2` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc3` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc4` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc6` text COLLATE utf8mb4_unicode_ci NOT NULL,
`text_loc8` text COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
UPDATE aowow_dbversion SET `sql` = CONCAT(IFNULL(`sql`, ''), ' mails');