[WIP] Conditions

* add missing conditionsTypes

todo:
 process params in Util::getServerConditions()
 add locale strings to js
 extend verbose display in global.js ConditionList
This commit is contained in:
Sarjuuk
2021-03-21 22:00:22 +01:00
parent e4b8a8e908
commit a1f0f3d30d
5 changed files with 165 additions and 76 deletions

View File

@@ -628,6 +628,13 @@ define('QUEST_FLAG_SPECIAL_DUNGEON_FINDER', 0x08);
define('QUEST_FLAG_SPECIAL_MONTHLY', 0x10);
define('QUEST_FLAG_SPECIAL_SPELLCAST', 0x20); // not documented in wiki! :[
define('QUEST_STATE_NOT_TAKEN', 0x01);
define('QUEST_STATE_COMPLETED', 0x02);
define('QUEST_STATE_IN_PROGRESS', 0x08);
define('QUEST_STATE_FAILED', 0x10);
define('QUEST_STATE_REWARDED', 0x20);
// GameObject
define('OBJECT_DOOR', 0);
define('OBJECT_BUTTON', 1);
@@ -1322,6 +1329,19 @@ define('CND_DISTANCE_TO', 35); // distance to targe
define('CND_ALIVE', 36); // target is alive: NULL, NULL, NULL
define('CND_HP_VAL', 37); // targets absolute health: amount, operator, NULL
define('CND_HP_PCT', 38); // targets relative health: amount, operator, NULL
define('CND_REALM_ACHIEVEMENT', 39); // target has achieved: achievementId, NULL, NULL
define('CND_IN_WATER', 40); // target is in water: NULL, NULL, NULL - NegativeCondition: 0 - land; 1 - water
// define('CND_TERRAIN_SWAP', 41); // not used in 3.3.5
define('CND_STAND_STATE', 42); // target has stateType: isExact, 0:standing;1:sitting, NULL
define('CND_DAILY_QUEST_DONE', 43); // target has done Quest: questId, NULL, NULL
define('CND_CHARMED', 44); // target is charmed: NULL, NULL, NULL
define('CND_PET_TYPE', 45); // target has pet of type: petTypeMask NULL, NULL
define('CND_TAXI', 46); // target is using tyxi: NULL, NULL, NULL
define('CND_QUESTSTATE', 47); // target has questState: questId, stateMask, NULL
define('CND_QUEST_OBJECTIVE_COMPLETE', 48); // target has quest status: questId, objectiveIdx, counter
define('CND_DIFFICULTY_ID', 49); // difficulty mode of map: mode, NULL, NULL
define('CND_OBJECT_ENTRY_GUID', 51); // target object is of..: typeId, orEntry, orGuid
define('CND_TYPE_MASK', 52); // target object has: typeMask, NULL, NULL
// TrinityCore - SmartAI
define('SAI_SRC_TYPE_CREATURE', 0);

View File

@@ -1135,6 +1135,9 @@ class Util
$c['ConditionValue1'] = 2;
else
continue 2;
case CND_QUESTSTATE: // 47
$jsGlobals[TYPE_QUEST][] = $c['ConditionValue1'];
break;
}
$res = [$c['NegativeCondition'] ? -$c['ConditionTypeOrReference'] : $c['ConditionTypeOrReference']];

View File

@@ -22860,24 +22860,51 @@ var ConditionList = new function() {
switch (Math.abs(entry[0])) {
case 1:
case 25: param[0] = '[spell=' + entry[1] + ']'; break;
case 2: param[1] = entry[2]; // do not break
case 3: param[0] = '[item=' + entry[1] + ']'; break;
case 25:
param[0] = '[spell=' + entry[1] + ']';
break;
case 2:
param[1] = entry[2];
// do not break
case 3:
param[0] = '[item=' + entry[1] + ']';
break;
case 4:
case 23: param[0] = '[zone=' + entry[1] + ']'; break;
case 23:
param[0] = '[zone=' + entry[1] + ']';
break;
case 8:
case 9:
case 14:
case 28: param[0] = '[quest=' + entry[1] + ']'; break;
case 12: param[0] = '[event=' + entry[1] + ']'; break;
case 17: param[0] = '[achievement=' + entry[1] + ']'; break;
case 18: param[0] = '[title=' + entry[1] + ']'; break;
case 6: param[0] = g_sides[entry[1]]; break;
case 10: param[0] = g_drunk_states[entry[1]]; break;
case 22: param[0] = g_zone_categories[entry[1]]; break;
case 15: param[0] = _listing(entry[1], g_chr_classes, '[class=$1]'); break;
case 16: param[0] = _listing(entry[1], g_chr_races, '[race=$1]'); break;
case 7: param[0] = '[skill=' + entry[1] + ']';
case 28:
param[0] = '[quest=' + entry[1] + ']';
break;
case 12:
param[0] = '[event=' + entry[1] + ']';
break;
case 17:
param[0] = '[achievement=' + entry[1] + ']';
break;
case 18:
param[0] = '[title=' + entry[1] + ']';
break;
case 6:
param[0] = g_sides[entry[1]];
break;
case 10:
param[0] = g_drunk_states[entry[1]];
break;
case 22:
param[0] = g_zone_categories[entry[1]];
break;
case 15:
param[0] = _listing(entry[1], g_chr_classes, '[class=$1]');
break;
case 16:
param[0] = _listing(entry[1], g_chr_races, '[race=$1]');
break;
case 7:
param[0] = '[skill=' + entry[1] + ']';
if (entry[2])
param[0] += $WH.sprintf(LANG.qty, entry[2]);
break;
@@ -22899,10 +22926,12 @@ var ConditionList = new function() {
else
param[0] = g_npc_types[10];
break;
case 29: param[0] = '[npc=' + entry[1] + ']';
case 29:
param[0] = '[npc=' + entry[1] + ']';
param[1] = entry[2];
break;
case 30: param[0] = '[object=' + entry[1] + ']';
case 30:
param[0] = '[object=' + entry[1] + ']';
param[1] = entry[2];
break;
case 31: if (entry[2] && entry[1] == 3) {
@@ -22915,17 +22944,21 @@ var ConditionList = new function() {
}
else // create mask from id and resolve in case 32
entry[1] = (1 << entry[1]);
case 32: param[0] = _listing(entry[1], g_world_object_types, '$2'); break;
case 36: break;
case 32:
param[0] = _listing(entry[1], g_world_object_types, '$2');
break;
case 27:
case 37:
case 38: param[0] = entry[1];
case 38:
param[0] = entry[1];
param[1] = g_operators[entry[2]];
break;
case 35: param[0] = entry[2];
case 35:
param[0] = entry[2];
param[1] = g_operators[entry[3]];
break;
case 11: param[0] = entry[1];
case 11:
param[0] = entry[1];
param[1] = entry[2];
break;
case 26:
@@ -22940,6 +22973,17 @@ var ConditionList = new function() {
}
pIndex++;
}
case 47:
param[0] = '[quest=' + entry[1] + ']';
param[1] = '';
let _ = Listview.funcBox.assocBinFlags(entry[2], g_quest_states);
for (var i = 0, len = _.length; i < len; ++i) {
if (i > 0)
param[1] += ', ';
param[1] += g_quest_states[_[i]];
}
break;
}
str = g_conditions[strIdx];

View File

@@ -2430,7 +2430,7 @@ var g_conditions = {
35: 'Das Ziel ist$: nicht; $2 $1m entfernt',
36: 'Das Ziel ist$: nicht; am Leben',
37: 'Die Gesundheit des Ziels ist$: nicht; $2 $1',
37: 'Die Gesundheit des Ziels ist$: nicht; $2 $1%'
38: 'Die Gesundheit des Ziels ist$: nicht; $2 $1%'
};
/* end aowow custom */

View File

@@ -2418,6 +2418,16 @@ var g_world_object_types = {
7: 'Player Corpse'
};
var g_quest_states = {
1: 'not taken',
2: 'completed',
// 3: 'unavailable',
4: 'in progress',
// 5: 'available',
6: 'failed',
7: 'rewarded'
};
var g_condition_types = {
1: ['Looting', 'If the conditions are met, this item can be dropped by [npc=$1].'], // CND_SRC_CREATURE_LOOT_TEMPLATE
2: ['Disenchanting', 'If the conditions are met, this item can be found when disenchanting [item=$1].'], // CND_SRC_DISENCHANT_LOOT_TEMPLATE
@@ -2477,7 +2487,19 @@ var g_conditions = {
35: 'The target is$: not; $2 $1yd away',
36: 'The target is$: not; alive',
37: 'The target\'s health is$: not; $2 $1',
37: 'The target\'s health is$: not; $2 $1%'
38: 'The target\'s health is$: not; $2 $1%',
39: 'The player has achieved $1',
40: 'The target is$: not; swimming',
41: '', // not used
42: 'The target is $sitting:standing;', // use param1: exact match
43: 'The player has finished $1',
44: 'The target is charmed',
45: 'The target\'s pet is a $1',
46: 'The player is using a taxi',
47: 'The player is on quest $1 with status $2',
48: 'The player completed $3 objective $2 from $1',
49: 'The difficulty of this map is $1',
51: 'The target object is $1' // also used by 52
};
/* end aowow custom */