[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_MONTHLY', 0x10);
define('QUEST_FLAG_SPECIAL_SPELLCAST', 0x20); // not documented in wiki! :[ 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 // GameObject
define('OBJECT_DOOR', 0); define('OBJECT_DOOR', 0);
define('OBJECT_BUTTON', 1); define('OBJECT_BUTTON', 1);
@@ -1284,44 +1291,57 @@ define('CND_SRC_SMART_EVENT', 22);
define('CND_SRC_NPC_VENDOR', 23); define('CND_SRC_NPC_VENDOR', 23);
define('CND_SRC_SPELL_PROC', 24); define('CND_SRC_SPELL_PROC', 24);
define('CND_AURA', 1); // aura is applied: spellId, UNUSED, NULL define('CND_AURA', 1); // aura is applied: spellId, UNUSED, NULL
define('CND_ITEM', 2); // owns item: itemId, count, UNUSED define('CND_ITEM', 2); // owns item: itemId, count, UNUSED
define('CND_ITEM_EQUIPPED', 3); // has item equipped: itemId, NULL, NULL define('CND_ITEM_EQUIPPED', 3); // has item equipped: itemId, NULL, NULL
define('CND_ZONEID', 4); // is in zone: areaId, NULL, NULL define('CND_ZONEID', 4); // is in zone: areaId, NULL, NULL
define('CND_REPUTATION_RANK', 5); // reputation status: factionId, rankMask, NULL define('CND_REPUTATION_RANK', 5); // reputation status: factionId, rankMask, NULL
define('CND_TEAM', 6); // is on team: teamId, NULL, NULL define('CND_TEAM', 6); // is on team: teamId, NULL, NULL
define('CND_SKILL', 7); // has skill: skillId, value, NULL define('CND_SKILL', 7); // has skill: skillId, value, NULL
define('CND_QUESTREWARDED', 8); // has finished quest: questId, NULL, NULL define('CND_QUESTREWARDED', 8); // has finished quest: questId, NULL, NULL
define('CND_QUESTTAKEN', 9); // has accepted quest: questId, NULL, NULL define('CND_QUESTTAKEN', 9); // has accepted quest: questId, NULL, NULL
define('CND_DRUNKENSTATE', 10); // has drunken status: stateId, NULL, NULL define('CND_DRUNKENSTATE', 10); // has drunken status: stateId, NULL, NULL
define('CND_WORLD_STATE', 11); define('CND_WORLD_STATE', 11);
define('CND_ACTIVE_EVENT', 12); // world event is active: eventId, NULL, NULL define('CND_ACTIVE_EVENT', 12); // world event is active: eventId, NULL, NULL
define('CND_INSTANCE_INFO', 13); define('CND_INSTANCE_INFO', 13);
define('CND_QUEST_NONE', 14); // never seen quest: questId, NULL, NULL define('CND_QUEST_NONE', 14); // never seen quest: questId, NULL, NULL
define('CND_CLASS', 15); // belongs to classes: classMask, NULL, NULL define('CND_CLASS', 15); // belongs to classes: classMask, NULL, NULL
define('CND_RACE', 16); // belongs to races: raceMask, NULL, NULL define('CND_RACE', 16); // belongs to races: raceMask, NULL, NULL
define('CND_ACHIEVEMENT', 17); // obtained achievement: achievementId, NULL, NULL define('CND_ACHIEVEMENT', 17); // obtained achievement: achievementId, NULL, NULL
define('CND_TITLE', 18); // obtained title: titleId, NULL, NULL define('CND_TITLE', 18); // obtained title: titleId, NULL, NULL
define('CND_SPAWNMASK', 19); define('CND_SPAWNMASK', 19);
define('CND_GENDER', 20); // has gender: genderId, NULL, NULL define('CND_GENDER', 20); // has gender: genderId, NULL, NULL
define('CND_UNIT_STATE', 21); define('CND_UNIT_STATE', 21);
define('CND_MAPID', 22); // is on map: mapId, NULL, NULL define('CND_MAPID', 22); // is on map: mapId, NULL, NULL
define('CND_AREAID', 23); // is in area: areaId, NULL, NULL define('CND_AREAID', 23); // is in area: areaId, NULL, NULL
define('CND_UNUSED_24', 24); define('CND_UNUSED_24', 24);
define('CND_SPELL', 25); // knows spell: spellId, NULL, NULL define('CND_SPELL', 25); // knows spell: spellId, NULL, NULL
define('CND_PHASEMASK', 26); // is in phase: phaseMask, NULL, NULL define('CND_PHASEMASK', 26); // is in phase: phaseMask, NULL, NULL
define('CND_LEVEL', 27); // player level is..: level, operator, NULL define('CND_LEVEL', 27); // player level is..: level, operator, NULL
define('CND_QUEST_COMPLETE', 28); // has completed quest: questId, NULL, NULL define('CND_QUEST_COMPLETE', 28); // has completed quest: questId, NULL, NULL
define('CND_NEAR_CREATURE', 29); // is near creature: creatureId, dist, NULL define('CND_NEAR_CREATURE', 29); // is near creature: creatureId, dist, NULL
define('CND_NEAR_GAMEOBJECT', 30); // is near gameObject: gameObjectId, dist, NULL define('CND_NEAR_GAMEOBJECT', 30); // is near gameObject: gameObjectId, dist, NULL
define('CND_OBJECT_ENTRY', 31); // target is ???: objectType, id, NULL define('CND_OBJECT_ENTRY', 31); // target is ???: objectType, id, NULL
define('CND_TYPE_MASK', 32); // target is type: typeMask, NULL, NULL define('CND_TYPE_MASK', 32); // target is type: typeMask, NULL, NULL
define('CND_RELATION_TO', 33); define('CND_RELATION_TO', 33);
define('CND_REACTION_TO', 34); define('CND_REACTION_TO', 34);
define('CND_DISTANCE_TO', 35); // distance to target targetType, dist, operator define('CND_DISTANCE_TO', 35); // distance to target targetType, dist, operator
define('CND_ALIVE', 36); // target is alive: NULL, NULL, NULL define('CND_ALIVE', 36); // target is alive: NULL, NULL, NULL
define('CND_HP_VAL', 37); // targets absolute health: amount, operator, 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_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 // TrinityCore - SmartAI
define('SAI_SRC_TYPE_CREATURE', 0); define('SAI_SRC_TYPE_CREATURE', 0);

View File

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

View File

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

View File

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

View File

@@ -2418,6 +2418,16 @@ var g_world_object_types = {
7: 'Player Corpse' 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 = { var g_condition_types = {
1: ['Looting', 'If the conditions are met, this item can be dropped by [npc=$1].'], // CND_SRC_CREATURE_LOOT_TEMPLATE 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 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', 35: 'The target is$: not; $2 $1yd away',
36: 'The target is$: not; alive', 36: 'The target is$: not; alive',
37: 'The target\'s health is$: not; $2 $1', 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 */ /* end aowow custom */