diff options
39 files changed, 502 insertions, 293 deletions
diff --git a/contrib/mysql_to_pgsql/cmake/FindMySQL.cmake b/contrib/mysql_to_pgsql/cmake/FindMySQL.cmake index e7d158de275..3d13c6f4d2a 100644 --- a/contrib/mysql_to_pgsql/cmake/FindMySQL.cmake +++ b/contrib/mysql_to_pgsql/cmake/FindMySQL.cmake @@ -30,7 +30,7 @@ IF(MSVC) ELSE(MSVC) SET(MYSQL_NAMES mysqlclient mysqlclient_r) ENDIF(MSVC) -SET(MYSQL_SEARCH_LIB_PATHS +SET(MYSQL_SEARCH_LIB_PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 6.0;Location]/lib/opt" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.1;Location]/lib/opt" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.0;Location]/lib/opt" @@ -71,4 +71,4 @@ MARK_AS_ADVANCED( MYSQL_INCLUDE_DIR ) -ENDMACRO(FIND_MYSQL)
\ No newline at end of file +ENDMACRO(FIND_MYSQL) diff --git a/contrib/mysql_to_pgsql/cmake/FindPostgreSQL.cmake b/contrib/mysql_to_pgsql/cmake/FindPostgreSQL.cmake index 06a1adc9e7a..6cfabd2a2ff 100644 --- a/contrib/mysql_to_pgsql/cmake/FindPostgreSQL.cmake +++ b/contrib/mysql_to_pgsql/cmake/FindPostgreSQL.cmake @@ -14,7 +14,7 @@ ENDIF (PGSQL_INCLUDE_DIR) # the registry settings checked are in order: # - for pgInstaller 8.2.x postgresql version # - for pgInstaller 8.3.x postgresql version -SET(PGSQL_WIN_BASE +SET(PGSQL_WIN_BASE "[HKEY_LOCAL_MACHINE\\SOFTWARE\\PostgreSQL\\Installations\\{B823632F-3B72-4514-8861-B961CE263224};Base Directory]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\PostgreSQL\\Installations\\{1F701DBD-1660-4108-B10A-FB435EA63BF0};Base Directory]") @@ -42,12 +42,12 @@ FIND_PATH(PGSQL_INCLUDE_DIR libpq-fe.h ) SET(PGSQL_NAMES pq libpq) -SET(PGSQL_SEARCH_LIB_PATHS +SET(PGSQL_SEARCH_LIB_PATHS ${PGSQL_SEARCH_LIB_PATHS} "[HKEY_LOCAL_MACHINE\\SOFTWARE\\PostgreSQL\\Installations\\{1F701DBD-1660-4108-B10A-FB435EA63BF0};Base Directory]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\PostgreSQL\\Installations\\{B823632F-3B72-4514-8861-B961CE263224};Base Directory]/lib" - /usr/local/pgsql/lib - /usr/local/lib + /usr/local/pgsql/lib + /usr/local/lib /usr/lib ) FIND_LIBRARY(PGSQL_LIBRARY diff --git a/contrib/mysql_to_pgsql/src/defines.h b/contrib/mysql_to_pgsql/src/defines.h index ed151bf5fae..3ffaf9923e0 100644 --- a/contrib/mysql_to_pgsql/src/defines.h +++ b/contrib/mysql_to_pgsql/src/defines.h @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + #ifndef _DEFINES_ #define _DEFINES_ @@ -59,7 +59,7 @@ typedef vector<sField> T_Table; typedef vector<string> T_TableList; typedef map< string, T_Table > TDataBase; -static +static void pg_notice(void *arg, const char *message) { /// Do nothing diff --git a/doc/EventAI.txt b/doc/EventAI.txt index 2557bada995..cf385643ba0 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -1,140 +1,146 @@ ============================================= -EventAI documentation: (Updated May 19, 2009) +EventAI documentation: (updated May 19, 2009) ============================================= EventAI allows users to create new creature scripts entierly within the database. For the AI to be used, you must first make sure to set AIname for each creature that should use this AI. - UPDATE creature_template SET AIName = 'EventAI' WHERE entry IN (...); + ========================================= -Basic Structure of EventAI +Basic structure of EventAI ========================================= + EventAI follows a basic if (Event) then do (Action) format. -Below is a the list of current fields within the creature_ai_scripts table. +Below is the list of current fields of the creature_ai_scripts table. -(Field_Name Discription) -id This value is mearly an incrementing counter of the current Event number. Required for sql queries. -creature_id Creature id which this event should occur on. +(Field_Name) (Description) +id This value is merely an incrementing counter of the current Event number. Required for sql queries. +creature_id Creature id which should trigger this event. -event_type Type of event (See Event Types below) -event_inverse_phase_mask Mask which phases this event should NOT trigger in* -event_chance Percent chance of this event occuring (1 - 100) -event_flags Event flags such as if the event is repeatable (see below) -event_param1 Variable for event (dependant on Event type) +event_type The type of event (see "Event types" below) +event_inverse_phase_mask Mask with phases this event should NOT trigger in* +event_chance Percentage chance of triggering the event (1 - 100) +event_flags Event flags (repeatable, ... (see below)) +event_param1 Variables for the event (depends on event_type) event_param2 event_param3 event_param4 -action1_type First Type of Action to take when event occurs (See Action Types below) -action1_param1 Variables used for Action1 (dependant on Action type) +action1_type An action to take when the event occurs (see "Action types" below) +action1_param1 Variables used by Action1 (depends on action_type) action1_param2 action1_param3 -action2_type Second Type of Action to take when event occurs (See Action Types below) -action2_param1 Variables used for Action2 (dependant on Action type) +action2_type +action2_param1 action2_param2 action2_param3 -action3_type Third Type of Action to take when event occurs (See Action Types below) -action3_param1 Variables used for Action3 (dependant on Action type) +action3_type +action3_param1 action3_param2 action3_param3 -All params are signed 32 bit values (+/- 2147483647). If param specifies time then time is in milliseconds. -If param specifies percentage then percentages are value/100 (ex: if param = 500 then that means 500%, -50 = -50%) +All params are signed 32-bit values (+/- 2147483647). Time values are always in milliseconds. +In case of a percentage value, use value/100 (ie. param = 500 then that means 500%, -50 = -50%) + +[*] Phase mask is a bitmask of phases which shouldn't trigger this event. (ie. Phase mask of value 12 (binary 1100) results in triggering this event in phases 0, 1 and all others with exception for phases 2 and 3 (counting from 0). -*Phase mask is a bit mask of which phases this event should not trigger in. Example: Phase mask value of 12 (1100) -would mean that this event would trigger 0, 1 and all other phases except for 2 and 3 (0 counts as the first phase). ========================================= -Event Types +Event types ========================================= -Below is the list of current Event types that EventAI can handle. + +A list of event types EventAI is able to handle. Each event type has its own specific interpretation of the params that accompany it. -Params are always read from Param1, then Param2, then Param3. -Events will not repeat until the creature exits combat unless EFLAG_REPEATABLE is set. +Params are always read in the ascending order (from Param1 to Param3). +Events will not repeat until the creature exits combat or unless EFLAG_REPEATABLE is set. Some events such as EVENT_T_AGGRO, EVENT_T_DEATH, EVENT_T_SPAWNED, and EVENT_T_EVADE cannot repeat. -# Internal Name Pamarm usage Description +# Internal name Param usage Description ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -0 EVENT_T_TIMER InitialMin, InitialMax, RepeatMin, RepeatMax Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4). but only in combat. -1 EVENT_T_TIMER_OOC InitialMin, InitialMax, RepeatMin, RepeatMax Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4). but only out of combat. -2 EVENT_T_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). -3 EVENT_T_MANA ManaMax%,ManaMin% RepeatMin, RepeatMax Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). -4 EVENT_T_AGGRO NONE Expires upon initial aggro (does not repeat). -5 EVENT_T_KILL RepeatMin, RepeatMax Expires upon killing a player. Will repeat between every (Param1) and (Param2). -6 EVENT_T_DEATH NONE Expires upon Death of the Creature. +0 EVENT_T_TIMER InitialMin, InitialMax, RepeatMin, RepeatMax Expires at first between (Param1) and (Param2) and then between every (Param3) and (Param4), but only in combat. +1 EVENT_T_TIMER_OOC InitialMin, InitialMax, RepeatMin, RepeatMax Expires at first between (Param1) and (Param2) and then between every (Param3) and (Param4), but only out of combat. +2 EVENT_T_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +3 EVENT_T_MANA ManaMax%,ManaMin% RepeatMin, RepeatMax Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +4 EVENT_T_AGGRO NONE Expires upon initial aggro (does not repeat). +5 EVENT_T_KILL RepeatMin, RepeatMax Expires upon killing a player. Will repeat between (Param1) and (Param2). +6 EVENT_T_DEATH NONE Expires upon creature death. 7 EVENT_T_EVADE NONE Expires upon creature EnterEvadeMode(). -8 EVENT_T_SPELLHIT SpellID, Schoolmask, RepeatMin, RepeatMax Expires upon Spell hit. If (param1) is set will only expire on that spell. If (param2) will only expire on spells of the selected schools (-1 for all). Will repeat every (Param3) and (Param4) . -9 EVENT_T_RANGE MinDist, MaxDist, RepeatMin, RepeatMax Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4) . -10 EVENT_T_OOC_LOS Hostile-or-Not, MaxAllowedRange, RepeatMin, RepeatMax Expires when a Unit moves within distance(MaxAllowedRange) to creature. If Param1=0 it will expire if Unit are Hostile. If Param1=1 it will only expire if Unit are not Hostile(generally determined by faction). Will repeat every (Param3) and (Param4). Does not expire when the creature is in combat. -11 EVENT_T_SPAWNED NONE Expires at initial spawn and at creature respawn (useful for setting ranged movement type) -12 EVENT_T_TARGET_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when Current Target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) . -13 EVENT_T_TARGET_CASTING RepeatMin, RepeatatMax Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2) . -14 EVENT_T_FRIENDLY_HP HPDeficit, Radius, RepeatMin, RepeatMax Expires when a friendly unit in radius has at least (param1) hp missing. Will repeat every (Param3) and (Param4) . -15 EVENT_T_FRIENDLY_IS_CC DispelType, Radius, RepeatMin, RepeatMax Expires when a friendly unit is Crowd controlled within the given radius (param2). Will repeat every (Param3) and (Param4) . -16 EVENT_T_MISSING_BUFF SpellId, Radius, RepeatMin, RepeatMax Expires when a friendly unit is missing aura's given by spell (param1) within radius (param2). Will repeat every (Param3) and (Param4) . -17 EVENT_T_SUMMONED_UNIT CreatureId, RepeatMin, RepeatMax Expires after creature with entry = (param1) is spawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3). +8 EVENT_T_SPELLHIT SpellID, Schoolmask, RepeatMin, RepeatMax Expires upon a spell hit. When (param1) is set, it will be used as a trigger. With (param2) specified, the expiration is limited to specific spell schools (-1 for all). Will repeat every (Param3) and (Param4). +9 EVENT_T_RANGE MinDist, MaxDist, RepeatMin, RepeatMax Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4). +10 EVENT_T_OOC_LOS Hostile-or-Not, MaxAllowedRange, RepeatMin, RepeatMax Expires when a unit moves within distance (MaxAllowedRange) of a creature. If (Param1) is zero it will expire only when unit is hostile, friendly otherwise (Param1 = 1), depends generally on faction. Will repeat every (Param3) and (Param4). Does not expire when the creature is in combat. +11 EVENT_T_SPAWNED NONE Expires on initial spawn and on creature respawn (useful for setting ranged movement type). +12 EVENT_T_TARGET_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when current target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +13 EVENT_T_TARGET_CASTING RepeatMin, RepeatatMax Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2). +14 EVENT_T_FRIENDLY_HP HPDeficit, Radius, RepeatMin, RepeatMax Expires when a friendly unit in radius has at least (Param1) HP missing. Will repeat every (Param3) and (Param4). +15 EVENT_T_FRIENDLY_IS_CC DispelType, Radius, RepeatMin, RepeatMax Expires when a friendly unit is crowd controlled within the given radius (Param2). Will repeat every (Param3) and (Param4). +16 EVENT_T_MISSING_BUFF SpellId, Radius, RepeatMin, RepeatMax Expires when a friendly unit is missing aura(s) given by a spell (Param1) within radius (Param2). Will repeat every (Param3) and (Param4). +17 EVENT_T_SUMMONED_UNIT CreatureId, RepeatMin, RepeatMax Expires after creature with entry = (Param1) is spawned (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3). 18 EVENT_T_TARGET_MANA ManaMax%, ManaMin%, RepeatMin, RepeatMax -21 EVENT_T_REACHED_HOME NONE Expires when creature reach it's home(spawn) location after Evade. -22 EVENT_T_RECEIVE_EMOTE EmoteId, Condition, CondValue1, CondValue2 Expires when creature receive emote with text emote id(enum TextEmotes). Condition can be defined. If set, then most conditions has additional value (see enum ConditionType) -23 EVENT_T_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when creature have spell (Param1) auras applied stack greater or equal provided in Param2 amount. Will repeat every (Param3) and (Param4). -24 EVENT_T_TARGET_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when target unit have spell (Param1) auras applied stack greater or equal provided in Param2 amount. Will repeat every (Param3) and (Param4). +21 EVENT_T_REACHED_HOME NONE Expires when a creature reach it's home(spawn) location after evade. +22 EVENT_T_RECEIVE_EMOTE EmoteId, Condition, CondValue1, CondValue2 Expires when a creature receives an emote with emote text id (enum TextEmotes) in (Param1). Conditions can be defined (Param2) with optional values (Param3,Param4), see enum ConditionType. +23 EVENT_T_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a creature has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4). +24 EVENT_T_TARGET_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a target unit has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4). + ========================================= Action Types ========================================= -Below is the list of current Action types that EventAI can handle. -Each event type has its own specific interpretation of the params that accompany it. -Params are always read from Param1, then Param2, then Param3. - -(# Internal Name Param usage Discription) -0 ACTION_T_NONE No Action Does Nothing -1 ACTION_T_TEXT -TextId1, -TextId2, -TextId3 Displays the -TextId as defined. In case -TextId2 and optionally -TextId3, the output will be randomized. Type text are defined in the text table itself(say, yell, whisper, etc) along with other options for the text. All values are required to be negative. -2 ACTION_T_SET_FACTION FactionId Change faction for creature. If param1==0, creature will revert to default faction. -3 ACTION_T_MORPH_TO_ENTRY_OR_MODEL CreatureEntry, ModelId Set model from creature_template.entry(param1) OR set explicit modelId(param2). If param1 AND param2 both 0, demorph and revert to default model for creature. -4 ACTION_T_SOUND SoundId Plays Sound -5 ACTION_T_EMOTE EmoteId Does emote + +A list of action types that EventAI can handle. +Each event type has its own specific interpretation of it's params, like every event type. + +# Internal name Param usage Description +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +0 ACTION_T_NONE No Action Does nothing. +1 ACTION_T_TEXT -TextId1, -TextId2, -TextId3 Simply displays the specified -TextId. When -TextId2 and -TextId3 are specified, the selection will be randomized. Text types are defined, along with other options for the text, in a table below. All values needs to be negative. +2 ACTION_T_SET_FACTION FactionId Changes faction for a creature. When param1 is zero, creature will revert to it's default faction. +3 ACTION_T_MORPH_TO_ENTRY_OR_MODEL CreatureEntry, ModelId Set either model from creature_template.entry (Param1) OR explicit modelId (Param2). If (Param1) AND (Param2) are both 0, demorph and revert to the default model. +4 ACTION_T_SOUND SoundId Plays a sound +5 ACTION_T_EMOTE EmoteId Does an emote 6 ACTION_T_RANDOM_SAY UNUSED 7 ACTION_T_RANDOM_YELL UNUSED 8 ACTION_T_RANDOM_TEXTEMOTE UNUSED -9 ACTION_T_RANDOM_SOUND SoundId1, SoundId2, SoundId3 Plays random sound between 3 params* -10 ACTION_T_RANDOM_EMOTE EmoteId1, EmoteId2, EmoteId3 Emotes random emote between 3 params -11 ACTION_T_CAST SpellId, Target, CastFlags Casts spell (param1) on target type (param2). Uses Cast Flags (specified below target types) -12 ACTION_T_SUMMON CreatureID, Target, Duration Summons creature (param1) to attack target (param2) for (param3) duration. Spawns on top of current creature. -13 ACTION_T_THREAT_SINGLE_PCT Threat%, Target Modifies threat by (param1) on target type (param2) -14 ACTION_T_THREAT_ALL_PCT Threat% Modifies threat by (param1) on all targets (using -100% on all will result in full aggro dump) -15 ACTION_T_QUEST_EVENT QuestID, Target Calls AreaExploredOrEventHappens with (param1) for target type (Param2) -16 ACTION_T_QUEST_CASTCREATUREGO CreatureID, SpellId, Target Sends CastCreatureOrGo for CreatureId (param1) with SpellId (param2) for target (param3) -17 ACTION_T_SET_UNIT_FIELD Field_Number, Value, Target Sets Unit Field (param1) to Value (param2) on target type (param3) -18 ACTION_T_SET_UNIT_FLAG Flags, Target Sets flag (flags can be binary OR together to modify multiple flags at once) on for Target type (param2) -19 ACTION_T_REMOVE_UNIT_FLAG Flags, Target Removes flag (flags can be binary OR together to modify multiple flags at once) on for Target type (param2) -20 ACTION_T_AUTO_ATTACK AllowAutoAttack 0 = stop melee attack, anything else means continue attacking/allow melee attacking -21 ACTION_T_COMBAT_MOVEMENT AllowCombatMovement 0 = stop combat based movement, anything else continue/allow combat based movement (targeted movement generator) -22 ACTION_T_SET_PHASE Phase Sets the current phase to (param1) -23 ACTION_T_INC_PHASE Value Increments the phase by (param1). May be negative to decrement phase but should not be 0. -24 ACTION_T_EVADE No Params Forces the creature to evade. Wiping all threat and dropping combat. -25 ACTION_T_FLEE_FOR_ASSIST No Params Causes the creature to flee for assistence (at low helth mostly). -26 ACTION_T_QUEST_EVENT_ALL QuestId Calls GroupEventHappens with (param1). Only used if it's _expected_ event should complete for all players in current party -27 ACTION_T_CASTCREATUREGO_ALL QuestId, SpellId Calls CastedCreatureOrGo for all players on the threat list with QuestID(Param1) and SpellId(Param2) -28 ACTION_T_REMOVEAURASFROMSPELL Target, Spellid Removes all auras on Target caused by Spellid -29 ACTION_T_RANGED_MOVEMENT Distance, Angle Changes the movement generator type to a ranged type. Note: Default melee type can still be done with this. Specify 0 angle and 0 distance. -30 ACTION_T_RANDOM_PHASE PhaseId1, PhaseId2, PhaseId3 Sets the phase to the id between 3 params* -31 ACTION_T_RANDOM_PHASE_RANGE PhaseMin, PhaseMax Sets the phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). PhaseMax must be greater than PhaseMin. -32 ACTION_T_SUMMON CreatureID, Target, SummonID Summons creature (param1) to attack target (param2) at location specified by EventAI_Summons (param3). -33 ACTION_T_KILLED_MONSTER CreatureID, Target Calls KilledMonster (param1) for target of type (param2) -34 ACTION_T_SET_INST_DATA Field, Data Calls ScriptedInstance::SetData with field (param1) and data (param2) -35 ACTION_T_SET_INST_DATA64 Field, Target Calls ScriptedInstance::SetData64 with field (param1) and data (param2) target's GUID. -36 ACTION_T_UPDATE_TEMPLATE TemplateId, Team Changes the creature to a new creature template of (param1) with team = Alliance if (param2) = false or Horde if (param2) = true +9 ACTION_T_RANDOM_SOUND SoundId1, SoundId2, SoundId3 Plays a random sound * +10 ACTION_T_RANDOM_EMOTE EmoteId1, EmoteId2, EmoteId3 Emotes a random emote +11 ACTION_T_CAST SpellId, Target, CastFlags Casts spell (Param1) on a target (Param2) using cast flags (specified below). +12 ACTION_T_SUMMON CreatureID, Target, Duration Summons a creature (Param1) for (Param3) duration and orders it to attach (Param2) target. Spawns on top of current creature. +13 ACTION_T_THREAT_SINGLE_PCT Threat%, Target Modifies a threat by (Param1) percent on a target (Param2). +14 ACTION_T_THREAT_ALL_PCT Threat% Modifies a threat by (Param1) on all targets in the threat list (using -100% here will result in full aggro dump). +15 ACTION_T_QUEST_EVENT QuestID, Target Calls AreaExploredOrEventHappens with (Param1) for a target in (Param2). +16 ACTION_T_QUEST_CASTCREATUREGO CreatureID, SpellId, Target Sends CastCreatureOrGo for a creature specified by CreatureId (Param1) with provided spell id (Param2) for a target in (Param3). +17 ACTION_T_SET_UNIT_FIELD Field_Number, Value, Target Sets a unit field (Param1) to provided value (Param2) on a target in (Param3). +18 ACTION_T_SET_UNIT_FLAG Flags, Target Sets flag (flags can be used together to modify multiple flags at once) on a target (Param2). +19 ACTION_T_REMOVE_UNIT_FLAG Flags, Target Removes flag on a target (Param2). +20 ACTION_T_AUTO_ATTACK AllowAutoAttack Stop melee attack when (Param1) is zero, otherwise continue attacking / allow melee attack. +21 ACTION_T_COMBAT_MOVEMENT AllowCombatMovement Stop combat based movement when (Param1) is zero, otherwise continue/allow combat based movement (targeted movement generator). +22 ACTION_T_SET_PHASE Phase Sets the current phase to (Param1). +23 ACTION_T_INC_PHASE Value Increments the phase by (Param1). May be negative to decrement, but should not be zero. +24 ACTION_T_EVADE No Params Forces the creature to evade, wiping all threat and dropping combat. +25 ACTION_T_FLEE_FOR_ASSIST No Params Causes the creature to flee for assistence (often at low health). +26 ACTION_T_QUEST_EVENT_ALL QuestId Calls GroupEventHappens with (Param1). Only used if it's _expected_ event should call quest completion for all players in a current party. +27 ACTION_T_CASTCREATUREGO_ALL QuestId, SpellId Calls CastedCreatureOrGo for all players on the threat list with quest id specified in (Param1) and spell id in (Param2). +28 ACTION_T_REMOVEAURASFROMSPELL Target, Spellid Removes all auras on a target (Param1) caused by a spell (Param2). +29 ACTION_T_RANGED_MOVEMENT Distance, Angle Changes the movement generator to a ranged type. (note: default melee type can still be set by using 0 as angle and 0 as distance). +30 ACTION_T_RANDOM_PHASE PhaseId1, PhaseId2, PhaseId3 Sets a phase to a specified id(s)* +31 ACTION_T_RANDOM_PHASE_RANGE PhaseMin, PhaseMax Sets a phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). PhaseMax must be greater than PhaseMin. +32 ACTION_T_SUMMON CreatureID, Target, SummonID Summons a creature (Param1) to attack target (Param2) at location specified by EventAI_Summons (Param3). +33 ACTION_T_KILLED_MONSTER CreatureID, Target Calls KilledMonster (Param1) for a target (Param2). +34 ACTION_T_SET_INST_DATA Field, Data Calls ScriptedInstance::SetData with field (Param1) and data (Param2). +35 ACTION_T_SET_INST_DATA64 Field, Target Calls ScriptedInstance::SetData64 with field (Param1) and target's GUID (Param2). +36 ACTION_T_UPDATE_TEMPLATE TemplateId, Team Changes a creature's template to (Param1) with team = Alliance or Horde when (Param2) is either false or true respectively. 37 ACTION_T_DIE No Params Kills the creature -38 ACTION_T_ZONE_COMBAT_PULSE No Params Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances. -39 ACTION_T_CALL_FOR_HELP Radius Call any friendly creatures (if its not in combat/etc) in radius attack creature target. -40 ACTION_T_SET_SHEATH Sheath Let set sheath state for creature (0-no weapon show (not used mostly by creatures), 1-melee weapon show, 2-ranged weapon show) +38 ACTION_T_ZONE_COMBAT_PULSE No Params Puts all players within an instance into combat with the creature. Only works when a creature is already in combat. Doesn't work outside instances. +39 ACTION_T_CALL_FOR_HELP Radius Call any friendly out-of-combat creatures in a radius (Param1) to attack current creature's target. +40 ACTION_T_SET_SHEATH Sheath Sets sheath state for a creature (0 = no weapon, 1 = melee weapon, 2 = ranged weapon). 41 ACTION_T_FORCE_DESPAWN No Params Despawns the creature +42 ACTION_T_SET_INVINCIBILITY_HP_LEVEL hp_level, is_percent Set min. health level for creature that can be set at damage as flat value or percent from max health + +* = Use -1 where the param is expected to do nothing. Random constant is generated for each event, so if you have a random yell and a random sound, they will be linked up with each other (ie. param2 with param2). -* = Use -1 to specify that if this param is picked to do nothing. Random is constant between actions within an event. So if you have a random Yell and a random Sound they will match up (ex: param2 with param2) ========================================= Event Types @@ -147,7 +153,7 @@ BOTH - This event can trigger both in and out of combat. Events that do not have lables on them are events that are directly involved with the in and out of combat state. ------------------ -0 = EVENT_T_TIMER: +0 = EVENT_T_TIMER: ------------------ Parameter 1: InitialMin - Minumum Time used to calculate Random Initial Expire Parameter 2: InitialMax - Maximum Time used to calculate Random Initial Expire @@ -165,7 +171,7 @@ Parameter 2: InitialMax - Maximum Time used to calculate Random Initial Expire Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire -OUT OF COMBAT ONLY! - Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4) from then on. +OUT OF COMBAT ONLY! - Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4) from then on. This is commonly used for events that occur and repeat outside of combat. --------------- @@ -176,7 +182,7 @@ Parameter 2: HPMin% - Minimum HP% That this Event will Expire Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire -BOTH - Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +BOTH - Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). This is commonly used for events that trigger at a specific HP% (Such as Heal/Enrage Spells or NPC's that Flee). ----------------- @@ -187,7 +193,7 @@ Parameter 2: ManaMin% - Minimum Mana% That this Event will Expire Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire -BOTH - Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +BOTH - Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). This is commonly used for events where an NPC low on Mana will do something (Such as stop casting spells and switch to melee). ------------------ @@ -201,7 +207,7 @@ This Event Expires upon initial aggro (does not repeat). Parameter 1: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 2: RepeatMax - Maximum Time used to calculate Random Repeat Expire -COMBAT ONLY! - Expires upon killing a player. Will repeat every (Param1) and (Param2). +COMBAT ONLY! - Expires upon killing a player. Will repeat every (Param1) and (Param2). This Event Expires upon killing a player. It is commonly used for NPC's who yell or do something after killing a player. ------------------ @@ -213,7 +219,7 @@ This is commonly used for NPC's who have a yell on death or cast some kind if su ------------------ 7 = EVENT_T_EVADE: ------------------ -This Event Expires upon the creature EnterEvadeMode(). +This Event Expires upon the creature EnterEvadeMode(). This is commonly used for NPC's who use phases, allows you to reset their phase to 0 upon evade to prevent possible strange behavior. --------------------- @@ -246,7 +252,7 @@ Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire COMBAT ONLY! - Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4). -This Event is commonly used for NPC's who have Ranged Combat and will Throw/Shoot between a certian distance. +This Event is commonly used for NPC's who have Ranged Combat and will Throw/Shoot between a certian distance. --------------------- 10 = EVENT_T_OOC_LOS: @@ -275,7 +281,7 @@ Parameter 2: HPMin% - Minimum HP% That this Event will Expire Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire -COMBAT ONLY! - Expires when Current NPC's Target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +COMBAT ONLY! - Expires when Current NPC's Target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). This Event is commonly used for NPC's who have a special ability (Like Execute) that only casts when a Player HP is low. ---------------------------- @@ -284,7 +290,7 @@ This Event is commonly used for NPC's who have a special ability (Like Execute) Parameter 1: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 2: RepeatMax - Maximum Time used to calculate Random Repeat Expire -COMBAT ONLY! - Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2). +COMBAT ONLY! - Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2). This event is commonly used for NPC's who will cast a counter spell when their target starts to cast a spell. ------------------------- @@ -306,7 +312,7 @@ Parameter 2: Radius - This is the Range in Yards the NPC will scan for nearby Fr Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire -COMBAT ONLY! - Expires when a friendly unit is Crowd controlled within the given radius (param2). Will repeat every (Param3) and (Param4). +COMBAT ONLY! - Expires when a friendly unit is Crowd controlled within the given radius (param2). Will repeat every (Param3) and (Param4). This is commonly used for NPC's who can come to the resule of other Friendly NPC's if being Crowd Controlled -------------------------- @@ -327,7 +333,7 @@ Parameter 1: CreatureId - The CreatureID that the NPC is watching to spawn to tr Parameter 2: RepeatMin - Minimum Time used to calculate Random Repeat Expire Parameter 3: RepeatMax - Maximum Time used to calculate Random Repeat Expire -BOTH - Expires after creature with entry(Param1) is spawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) . +BOTH - Expires after creature with entry(Param1) is spawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) . This is commonly used for NPC's who will do something special once another NPC is summoned. Usually used is Complex Scripts or Special Events. --------------------------- @@ -438,16 +444,16 @@ UNUSED Can be reused to create new action type -------------------------- Parameter 1: The Sound ID to be played as Random Choice #1. Parameter 2: The Sound ID to be played as Random Choice #2. -Parameter 3: The Sound ID to be played as Random Choice #3. +Parameter 3: The Sound ID to be played as Random Choice #3. -Similar to the ACTION_T_SOUND action, it will choose at random a sound to play. +Similar to the ACTION_T_SOUND action, it will choose at random a sound to play. --------------------------- 10 = ACTION_T_RANDOM_EMOTE: --------------------------- Parameter 1: The Emote ID to be played as Random Choice #1. Parameter 2: The Emote ID to be played as Random Choice #2. -Parameter 3: The Emote ID to be played as Random Choice #3. +Parameter 3: The Emote ID to be played as Random Choice #3. Similar to the ACTION_T_EMOTE action, it will choose at random an Emote to Visually Perform. @@ -458,26 +464,26 @@ Parameter 1: SpellId - The Spell ID to use for the NPC to cast. The value used i Parameter 2: Target - The Target Type defining who the creature should cast the spell at. The value in this field needs to be a valid Target Type as specified in the reference tables below. Parameter 3: CastFlags - See Table Below for Cast Flag Bitmask Values. If you are unsure what to set this value at leave it at 0. -The creature will cast a spell specified by a spell ID on a target specified by the target type. +The creature will cast a spell specified by a spell ID on a target specified by the target type. This is commonly used for NPC's who cast spells. --------------------- 12 = ACTION_T_SUMMON: --------------------- Parameter 1: CreatureID - The Creature Template ID to be Summoned. The value here needs to be a valid Creature Template ID. -Parameter 2: Target - The Target Type defining who the Summoned creature will attack once spawned. The value in this field needs to be a valid Target Type as specified in the reference tables below. -Parameter 3: Duration - The duration until the summoned creature should be unsummoned AFTER Combat ends. The value in this field is in milliseconds or 0. +Parameter 2: Target - The Target Type defining who the Summoned creature will attack once spawned. The value in this field needs to be a valid Target Type as specified in the reference tables below. +Parameter 3: Duration - The duration until the summoned creature should be unsummoned AFTER Combat ends. The value in this field is in milliseconds or 0. -The NPC will Summon another creature at the same spot as itself that will attack the specified target. +The NPC will Summon another creature at the same spot as itself that will attack the specified target. NOTE: Almost all Creature Summons have proper Summon Spells that should be used when possible. This Action is a powerful last resort option only to be used if nothing else works. NOTE: Using Target Type 0 will cause the Summoned creature to not attack anyone. -NOTE: If Duration is set at 0, then the summoned creature will not despawn until it has died. +NOTE: If Duration is set at 0, then the summoned creature will not despawn until it has died. This is used as a manual way to force an NPC to Summon. -------------------------------- 13 = ACTION_T_THREAT_SINGLE_PCT: -------------------------------- Parameter 1: Threat% - Threat percent that should be modified. The value in this field can range from -100 to +100. If it is negative, threat will be taken away and if positive, threat will be added. -Parameter 2: Target - The Target Type defining on whom the threat change should occur. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 2: Target - The Target Type defining on whom the threat change should occur. The value in this field needs to be a valid target type as specified in the reference tables below. This action will modify the threat of a target in the creature's threat list by the specified percent. This is commonly used to allow an NPC to adjust the Threat to a single player. @@ -485,7 +491,7 @@ This is commonly used to allow an NPC to adjust the Threat to a single player. ----------------------------- 14 = ACTION_T_THREAT_ALL_PCT: ----------------------------- -Parameter 1: Threat% - The percent that should be used in modifying everyone's threat in the creature's threat list. The value here can range from -100 to +100. +Parameter 1: Threat% - The percent that should be used in modifying everyone's threat in the creature's threat list. The value here can range from -100 to +100. This action will modify the threat for everyone in the creature's threat list by the specified percent. NOTE: Using -100 will cause the creature to reset everyone's threat to 0 so that everyone has the same amount of threat. It will NOT remove anyone from the threat list. @@ -495,10 +501,10 @@ This is commonly used to allow an NPC to drop threat for all players to zero. 15 = ACTION_T_QUEST_EVENT: -------------------------- Parameter 1: QuestID - The Quest Template ID. The value here must be a valid quest template ID. Furthermore, the quest should have SpecialFlags | 2 as it would need to be completed by an external event which is the activation of this action. -Parameter 2: Target - The Target Type defining whom the quest should be completed for. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 2: Target - The Target Type defining whom the quest should be completed for. The value in this field needs to be a valid target type as specified in the reference tables below. -This action will satisfy the external completion requirement for the quest for the specified target defined by the target type. -NOTE: This action can only be used with player targets so it must be ensured that the target type will point to a player. +This action will satisfy the external completion requirement for the quest for the specified target defined by the target type. +NOTE: This action can only be used with player targets so it must be ensured that the target type will point to a player. This is commonly used for Quests where only ONE player will gain credit for the quest. ----------------------------- @@ -506,9 +512,9 @@ This is commonly used for Quests where only ONE player will gain credit for the ----------------------------- Parameter 1: CreatureID - The Creature Template ID to be Summoned. The value here needs to be a valid Creature Template ID. Parameter 2: SpellId - The Spell ID to use to simulate the cast. The value used in this field needs to be a valid Spell ID. -Parameter 3: Target - The Target Type defining whom the quest credit should be given to. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 3: Target - The Target Type defining whom the quest credit should be given to. The value in this field needs to be a valid target type as specified in the reference tables below. -This action will call CastedCreatureOrGO() function for the player. It can be used to give quest credit for casting a spell on the creature. +This action will call CastedCreatureOrGO() function for the player. It can be used to give quest credit for casting a spell on the creature. This is commonly used for NPC's who have a special requirement to have a Spell cast on them to complete a quest. ----------------------------- @@ -516,7 +522,7 @@ This is commonly used for NPC's who have a special requirement to have a Spell c ----------------------------- Parameter 1: Field_Number - The index of the Field Number to be changed. Use (http://wiki.udbforums.org/index.php/Character_data) for a list of indeces and what they control. Creatures only contain the OBJECT_FIELD_* and UNIT_FIELD_* fields. They do not contain the PLAYER_FIELD_* fields. Parameter 2: Value - The new value to be put in the field. -Parameter 3: Target - The Target Type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 3: Target - The Target Type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below. When activated, this action can change the target's unit field values. More information on the field value indeces can be found at (http://wiki.udbforums.org/index.php/Character_data) @@ -524,32 +530,32 @@ When activated, this action can change the target's unit field values. More info 18 = ACTION_T_SET_UNIT_FLAG: ---------------------------- Parameter 1: Flags - The flag(s) to be set. Multiple flags can be set by using bitwise-OR on them (adding them together). -Parameter 2: Target - The Target Type defining for whom the flags should be changed. The value in this field needs to be a valid Target Type as specified in the reference tables below. +Parameter 2: Target - The Target Type defining for whom the flags should be changed. The value in this field needs to be a valid Target Type as specified in the reference tables below. -When activated, this action changes the target's flags by adding (turning on) more flags. For example, this action can make the creature unattackable/unselectable if the right flags are used. +When activated, this action changes the target's flags by adding (turning on) more flags. For example, this action can make the creature unattackable/unselectable if the right flags are used. ------------------------------- 19 = ACTION_T_REMOVE_UNIT_FLAG: ------------------------------- Parameter 1: Flags - The flag(s) to be removed. Multiple flags can be set by using bitwise-OR on them (adding them together). -Parameter 2: Target - The target type defining for whom the flags should be changed. The value in this field needs to be a valid Target Type as specified in the reference tables below. +Parameter 2: Target - The target type defining for whom the flags should be changed. The value in this field needs to be a valid Target Type as specified in the reference tables below. -When activated, this action changes the target's flags by removing (turning off) flags. For example, this action can make the creature normal after it was unattackable/unselectable if the right flags are used. +When activated, this action changes the target's flags by removing (turning off) flags. For example, this action can make the creature normal after it was unattackable/unselectable if the right flags are used. -------------------------- 20 = ACTION_T_AUTO_ATTACK: -------------------------- -Parameter 1: AllowAutoAttack - If zero, then the creature will stop its melee attacks. If non-zero, then the creature will either continue its melee attacks (the action would then have no effect) or it will start its melee attacks on the target with the top threat if its melee attacks were previously stopped. +Parameter 1: AllowAutoAttack - If zero, then the creature will stop its melee attacks. If non-zero, then the creature will either continue its melee attacks (the action would then have no effect) or it will start its melee attacks on the target with the top threat if its melee attacks were previously stopped. -This action controls whether or not the creature should stop or start the auto melee attack. +This action controls whether or not the creature should stop or start the auto melee attack. NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values (0 = Stop Melee, 1 = Start Melee). This is commonly used in combination with EVENT_T_RANGE and ACTION_T_COMBAT_MOVEMENT for Ranged Combat for Mages and Spell Casters. ------------------------------ 21 = ACTION_T_COMBAT_MOVEMENT: ------------------------------ -Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before. -Parameter 2: If non-zero, then stop melee combat state (if param1=0) or start melee combat state (if param1!=0) and creature in combat with selected target. +Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before. +Parameter 2: If non-zero, then stop melee combat state (if param1=0) or start melee combat state (if param1!=0) and creature in combat with selected target. This action controls whether or not the creature will always move towards its target. NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values. (0 = Stop Movement, 1 = Start Movement) @@ -559,7 +565,7 @@ Parameter 2 specialy used for ranged combat proper client side visual show range ------------------------ 22 = ACTION_T_SET_PHASE: ------------------------ -Parameter 1: The new phase to set the creature in. This number must be an integer between 0 and 31. Numbers outside of that range will result in an error. +Parameter 1: The new phase to set the creature in. This number must be an integer between 0 and 31. Numbers outside of that range will result in an error. When activated, this action sets the creature's event to the specified value. NOTE: The creature's current Phase is NOT reset at creature evade. You must manually set the phase back to 0 at EVENT_T_RESET. @@ -569,20 +575,20 @@ This is commonly used for complex scripts with several phases and you need to sw ------------------------ 23 = ACTION_T_INC_PHASE: ------------------------ -Parameter 1: Value - The number of phases to increase or decrease. Use negative values to decrease the current phase. +Parameter 1: Value - The number of phases to increase or decrease. Use negative values to decrease the current phase. -When activated, this action will increase (or decrease) the current creature's phase. -NOTE: After increasing or decreasing the phase by this action, the current phase must NOT be lower than 0 or exceed 31. +When activated, this action will increase (or decrease) the current creature's phase. +NOTE: After increasing or decreasing the phase by this action, the current phase must NOT be lower than 0 or exceed 31. This can be used instead of ACTION_T_SET_PHASE to change phases in scripts. Just a user friendly option for changing phases. -------------------- 24 = ACTION_T_EVADE: -------------------- -When activated, the creature will immediately exit out of combat, clear its threat list, and move back to its spawn point. Basically, this action will reset the whole encounter. +When activated, the creature will immediately exit out of combat, clear its threat list, and move back to its spawn point. Basically, this action will reset the whole encounter. NOTE: All Param Values Are 0 for this Action. ------------------- -25 = ACTION_T_FLEE: +25 = ACTION_T_FLEE: ------------------- When activated, the creature will try to flee from combat. Currently this is done by it casting a fear-like spell on itself called "Run Away". A Better Flee system is in Development. @@ -591,47 +597,47 @@ NOTE: All Param Values Are 0 for this Action. ------------------------------ 26 = ACTION_T_QUEST_EVENT_ALL: ------------------------------ -Parameter 1: QuestId - The quest ID to finish for everyone. +Parameter 1: QuestId - The quest ID to finish for everyone. -This action does the same thing as the ACTION_T_QUEST_EVENT does but it does it for all players in the creature's threat list. -NOTE: If a player is not in the NPC's threat list for whatever reason, he/she won't get the quest completed. +This action does the same thing as the ACTION_T_QUEST_EVENT does but it does it for all players in the creature's threat list. +NOTE: If a player is not in the NPC's threat list for whatever reason, he/she won't get the quest completed. --------------------------------- 27 = ACTION_T_CASTCREATUREGO_ALL: --------------------------------- Parameter 1: QuestId - The quest template ID. -Parameter 2: SpellId - The spell ID used to simulate the cast. +Parameter 2: SpellId - The spell ID used to simulate the cast. -This action does the same thing as the ACTION_T_CASTCREATUREGO does but it does it for all players in the creature's threat list. -NOTE: If a player is not in its threat list for whatever reason, he/she won't receive the cast emulation. +This action does the same thing as the ACTION_T_CASTCREATUREGO does but it does it for all players in the creature's threat list. +NOTE: If a player is not in its threat list for whatever reason, he/she won't receive the cast emulation. ----------------------------------- 28 = ACTION_T_REMOVEAURASFROMSPELL: ----------------------------------- Parameter 1: Target - The target type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below. -Parameter 2: SpellId - The spell ID whose auras will be removed. +Parameter 2: SpellId - The spell ID whose auras will be removed. -This action will remove all auras from a specific spell from the target. +This action will remove all auras from a specific spell from the target. This is commonly used for NPC's who have an OOC Aura that is removed at combat start or a similar idea (Like Stealth or Shape Shift) ------------------------------ 29 = ACTION_T_RANGED_MOVEMENT: ------------------------------ Parameter 1: Distance - The distance the mob should keep between it and its target. -Parameter 2: Angle - The angle the mob should use. +Parameter 2: Angle - The angle the mob should use. -This action changes the movement type generator to ranged type using the specified values for angle and distance. -NOTE: Specifying zero angle and distance will make it just melee instead. -This is commonly used for NPC's who always attack at range and you can specify the distance they will maintain from the target. +This action changes the movement type generator to ranged type using the specified values for angle and distance. +NOTE: Specifying zero angle and distance will make it just melee instead. +This is commonly used for NPC's who always attack at range and you can specify the distance they will maintain from the target. --------------------------- 30 = ACTION_T_RANDOM_PHASE: --------------------------- Parameter 1: PhaseId1 - A possible random phase choice. Parameter 2: PhaseId2 - A possible random phase choice. -Parameter 3: PhaseId3 - A possible random phase choice. +Parameter 3: PhaseId3 - A possible random phase choice. -Randomly sets the phase to one from the three parameter choices. +Randomly sets the phase to one from the three parameter choices. NOTE: Use -1 to specify that if this param is picked to do nothing. Random is constant between actions within an event. So if you have a random Yell and a random Sound they will match up (ex: param2 with param2) NOTE 2: PLEASE NOTE THAT EACH OF THE PARAM VALUES ARE ACTUAL PHASE NUMBERS NOT THE INVERSE PHASE MASK VALUE. This is commonly used for Spellcasting NPC's who on Aggro may select at random a school of spells to use for the fight. Use this if you have up to 3 phases used, otherwise use Action 31 for more then 3 phases. @@ -640,9 +646,9 @@ This is commonly used for Spellcasting NPC's who on Aggro may select at random a 31 = ACTION_T_RANDOM_PHASE_RANGE: --------------------------------- Parameter 1: PhaseMin - The minimum of the phase range. -Parameter 2: PhaseMax - The maximum of the phase range. The number here must be greater than PhaseMin. +Parameter 2: PhaseMax - The maximum of the phase range. The number here must be greater than PhaseMin. -Randomly sets the phase between a range of phases controlled by the parameters. Sets the phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). +Randomly sets the phase between a range of phases controlled by the parameters. Sets the phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). NOTE: PhaseMax must be greater than PhaseMin. NOTE 2: PLEASE NOTE THAT EACH OF THE PARAM VALUES ARE ACTUAL PHASE NUMBERS NOT THE INVERSE PHASE MASK VALUE. This is commonly used for Spellcasting NPC's who on Aggro may select at random a school of spells to use for the fight. Use this if you have MORE then 3 phases used, otherwise use Action 30. @@ -652,9 +658,9 @@ This is commonly used for Spellcasting NPC's who on Aggro may select at random a --------------------- Parameter 1: CreatureID - The creature template ID to be summoned. The value here needs to be a valid creature template ID. Parameter 2: Target - The target type defining who the summoned creature will attack. The value in this field needs to be a valid target type as specified in the reference tables below. NOTE: Using target type 0 will cause the summoned creature to not attack anyone. -Parameter 3: SummonID - The summon ID from the creature_ai_summons table controlling the position (and spawntime) where the summoned mob should be spawned at. +Parameter 3: SummonID - The summon ID from the creature_ai_summons table controlling the position (and spawntime) where the summoned mob should be spawned at. -Summons creature (param1) to attack target (param2) at location specified by creature_ai_summons (param3). +Summons creature (param1) to attack target (param2) at location specified by creature_ai_summons (param3). NOTE: Param3 Value is the ID Value used for the entry used in creature_ai_summons for this action. You MUST have an creature_ai_summons entry to use this action. This is commonly used for NPC's who need to Summon a creature at a specific location. (Normally used for complex events) @@ -662,9 +668,9 @@ This is commonly used for NPC's who need to Summon a creature at a specific loca 33 = ACTION_T_KILLED_MONSTER: ----------------------------- Parameter 1: CreatureID - The creature template ID. The value here must be a valid creature template ID. -Parameter 2: Target - The target type defining whom the quest kill count should be given to. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 2: Target - The target type defining whom the quest kill count should be given to. The value in this field needs to be a valid target type as specified in the reference tables below. -When activated, this action will call KilledMonster() function for the player. It can be used to give creature credit for killing a creature. In general if the quest is set to be accompished on different creatures (e.g. "Credit" templates). +When activated, this action will call KilledMonster() function for the player. It can be used to give creature credit for killing a creature. In general if the quest is set to be accompished on different creatures (e.g. "Credit" templates). NOTE: It can be ANY creature including certain quest specific triggers This is commonly used for giving the player Quest Credits for NPC kills (Many NPC's may use the same CreatureID for the Kill Credit) @@ -674,37 +680,37 @@ This is commonly used for giving the player Quest Credits for NPC kills (Many NP Parameter 1: Field - The field to change in the instance script. Again, this field needs to be a valid field that has been already defined in the instance's script. Parameter 2: Data - The value to put at that field index. -Sets data for the instance. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned. +Sets data for the instance. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned. This is commonly used to link an EventAI script with a existing Script Library C++ Script. You make make things happen like opening doors on specific events that happen. ------------------------------ 35 = ACTION_T_SET_INST_DATA64: ------------------------------ Parameter 1: Field - The field to change in the instance script. Again, this field needs to be a valid field that has been already defined in the instance's script. -Parameter 2: Target - The target type to use to get the GUID that will be stored at the field index. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 2: Target - The target type to use to get the GUID that will be stored at the field index. The value in this field needs to be a valid target type as specified in the reference tables below. -Sets GUID (64 bits) data for the instance based on the target. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned. +Sets GUID (64 bits) data for the instance based on the target. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned. Calls ScriptedInstance::SetData64 with field (param1) and data (param2) target's GUID. ------------------------------ 36 = ACTION_T_UPDATE_TEMPLATE: ------------------------------ Parameter 1: TemplateId - The creature template ID. The value here must be a valid creature template ID. -Parameter 2: Team - Use model_id from team : Alliance(0) or Horde (1). +Parameter 2: Team - Use model_id from team : Alliance(0) or Horde (1). -This function temporarily changes creature entry to new entry, display is changed, loot is changed, but AI is not changed. At respawn creature will be reverted to original entry. +This function temporarily changes creature entry to new entry, display is changed, loot is changed, but AI is not changed. At respawn creature will be reverted to original entry. Changes the creature to a new creature template of (param1) with team = Alliance if (param2) = false or Horde if (param2) = true ------------------ 37 = ACTION_T_DIE: ------------------ Kills the creature -This is commonly used if you need to Instakill the creature for one reason or another. +This is commonly used if you need to Instakill the creature for one reason or another. -------------------------------- 38 = ACTION_T_ZONE_COMBAT_PULSE: -------------------------------- -Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances. +Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances. ---------------------------- 39 = ACTION_T_CALL_FOR_HELP: @@ -732,6 +738,14 @@ This possible setup by set ar event AI start (single used EVENT_T_TIMER_OOC set Despawns the creature (in or out of combat) No parameters +------------------------- +42 ACTION_T_SET_INVINCIBILITY_HP_LEVEL +------------------------- +Parameter 1: min. health level for creature that can be set at damage, 0 used as absent min. health value for apply damage. +Parameter 2: format of paramater 1 value +0 paramater 1 used as flat value +1 paramater 1 used as percent (0..100) from creature max health + ========================================= Target Types ========================================= @@ -763,7 +777,7 @@ Another example: the number "5" (101 in Binary, selecting first and third option 4 16 CAST_FORCE_TARGET_SELF Forces the target to cast this spell on itself 5 32 CAST_AURA_NOT_PRESENT Only casts the spell on the target if the target does not have the aura from that spell on itself already. -NOTE: You can add the numbers in the decimal column to combine flags. +NOTE: You can add the numbers in the decimal column to combine flags. For example if you wanted to use CAST_NO_MELEE_IF_OOM(8) and CAST_TRIGGERED(2) you would simply use 10 in the cast flags field (8 + 2 = 10). ========================================= @@ -820,8 +834,8 @@ Below is the list of current Text types that texts tables can handle. These were ----------------------------------------------------------- 0 CHAT_TYPE_SAY This type sets the text to be displayed as a Say (Speech Bubble). 1 CHAT_TYPE_YELL This type sets the text to be displayed as a Yell (Red Speech Bubble) and usually has a matching Sound ID. -2 CHAT_TYPE_TEXT_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log. -3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses). +2 CHAT_TYPE_TEXT_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log. +3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses). 4 CHAT_TYPE_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log. 5 CHAT_TYPE_BOSS_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log (Used only for specific Bosses). 6 CHAT_TYPE_ZONE_YELL Same as CHAT_TYPE_YELL but will display to all players in current zone. @@ -833,7 +847,7 @@ Below is the list of current Language types that are allowed. This is the Race Language that the text is native to (So it will display properly) # Internal Name Description ------------------------------------------------------------ +----------------------------------------------------------- 0 UNIVERSAL Text in this language is understood by ALL Races. 1 ORCISH Text in this language is understood ONLY by Horde Races. 2 DARNASSIAN Text in this language is understood ONLY by the Night Elf Race. diff --git a/sql/mangos.sql b/sql/mangos.sql index 90ff12ab883..3e99024dfc6 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, - `required_8213_01_mangos_spell_bonus_data` bit(1) default NULL + `required_8247_01_mangos_spell_bonus_data` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -17667,8 +17667,15 @@ INSERT INTO `spell_proc_event` VALUES (63108, 0x00000000, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63156, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), (63158, 0x00000000, 0, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +<<<<<<< HEAD:sql/mangos.sql (63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); >>>>>>> 4386e1133bd161f1b3a8d378e567b3d61f83ce89:sql/mangos.sql +======= +(63245, 0x00000000, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(63730, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(63733, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(63737, 0x00000000, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +>>>>>>> ee001a20a10446a8936bec95b7680b50319ac61d:sql/mangos.sql /*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; UNLOCK TABLES; @@ -17688,6 +17695,20 @@ CREATE TABLE `spell_bonus_data` ( LOCK TABLES `spell_bonus_data` WRITE; /*!40000 ALTER TABLE `spell_bonus_data` DISABLE KEYS */; INSERT INTO `spell_bonus_data` VALUES +('49941', '0', '0', '0.04', 'Death Knight - Blood Boil'), +('55078', '0', '0', '0.055', 'Death Knight - Blood Plague Dummy Proc'), +('50444', '0', '0', '0.105', 'Death Knight - Corpse Explosion Triggered'), +('52212', '0', '0', '0.0475', 'Death Knight - Death and Decay Triggered'), +('47632', '0', '0', '0.15', 'Death Knight - Death Coil Damage'), +('47633', '0', '0', '0.15', 'Death Knight - Death Coil Heal'), +('55095', '0', '0', '0.055', 'Death Knight - Frost Fever'), +('49184', '0', '0', '0.1', 'Death Knight - Howling Blast'), +('45477', '0', '0', '0.1', 'Death Knight - Icy Touch'), +('50842', '0', '0', '0.04', 'Death Knight - Pestilence'), +('47476', '0', '0', '0.06', 'Death Knight - Strangulate'), +('50536', '0', '0', '0.013', 'Death Knight - Unholy Blight Triggered'), +('50401', '0', '0', '0', 'Death Knight - Razor Frost'), +('56903', '0', '0', '0', 'Death Knight - Lichflame'), ('5185', '1.6104', '0', '0', 'Druid - Healing Touch'), ('33763', '0', '0.09518', '0', 'Druid - Lifebloom'), ('774', '0', '0.37604', '0', 'Druid - Rejuvenation'), @@ -18014,7 +18035,6 @@ INSERT INTO `spell_threat` VALUES (284,39), (285,59), (770,108), -(778,108), (1608,78), (1672,180), (1715,61), @@ -18034,10 +18054,8 @@ INSERT INTO `spell_threat` VALUES (8380,180), (8972,118), (9745,148), -(9749,108), (9880,178), (9881,207), -(9907,108), (11556,43), (11564,98), (11565,118), @@ -18050,20 +18068,12 @@ INSERT INTO `spell_threat` VALUES (11600,275), (11601,315), (11775,395), -(14274,200), (14921,415), -(15629,300), -(15630,400), -(15631,500), -(15632,600), (16857,108), (17735,200), (17750,300), (17751,450), (17752,600), -(17390,108), -(17391,108), -(17392,108), (20569,100), (20736,100), (20925,20), @@ -18083,9 +18093,7 @@ INSERT INTO `spell_threat` VALUES (25286,175), (25288,355), (25289,60), -(26993,127), (26996,176), -(27011,127), (27179,54), (29704,230), (29707,196), diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index 73c84ee6701..14a5c2689db 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -249,6 +249,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (50246,-1, -1, -1, -1, -1, -1, -1, -1,-1,'01001000', 'Spell::EffectDummy'), (50286, 7,0x0000000000000000,0x00000100, -1, -1, -1, 3, -1,-1,'Starfall', 'Spell::EffectDummy'), (50288,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Starfall', 'Spell::EffectDummy'), +(51209,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Hungering Cold', 'Spell::EffectDummy'), (51582, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::EffectDummy'), (51592, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'), (52025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cleansing Totem Effect', 'Spell::EffectDummy'), @@ -318,6 +319,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0,11,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Healing Stream Totem', 'Spell::EffectDummy'), ( 0, 4,0x0000000100000000,0x00000000, -1, -1, -1, 2, -1,-1,'Heroic Throw', 'Spell::EffectSchoolDMG'), ( 0,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), +( 0,15,0x0000100000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Hungering Cold', 'Spell::EffectDummy'), ( 0, 5,0x0000000000000004,0x00000000, -1, -1, -1, -1, 3,-1,'Immolate', 'Spell::EffectSchoolDMG'), (0, 5, -1, -1, 208, -1, -1, -1, 4,-1,'Improved Life Tap', 'Spell::EffectDummy'), ( 0, 5,0x0000004000000000,0x00000000,2128, -1, -1, 2, -1,-1,'Incinerate', 'Spell::EffectSchoolDMG'), diff --git a/sql/updates/4643_world_8237_creature_template.sql b/sql/updates/4643_world_8237_creature_template.sql new file mode 100644 index 00000000000..8a199e4d9b7 --- /dev/null +++ b/sql/updates/4643_world_8237_creature_template.sql @@ -0,0 +1,4 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8227_01_mangos_spell_proc_event required_8237_01_mangos_creature_template bit; + +UPDATE creature_template + SET mindmg = ROUND(mindmg + attackpower), maxdmg=ROUND(maxdmg+attackpower);
\ No newline at end of file diff --git a/sql/updates/4649_world_8250_spell_threat.sql b/sql/updates/4649_world_8250_spell_threat.sql new file mode 100644 index 00000000000..a19513363bd --- /dev/null +++ b/sql/updates/4649_world_8250_spell_threat.sql @@ -0,0 +1,3 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8249_02_mangos_spell_chain required_8250_01_mangos_spell_threat bit; + +DELETE FROM `spell_threat` WHERE `entry` IN (778,9749,9907,14274,15629,15630,15631,15632,17390,17391,17392,26993,27011);
\ No newline at end of file diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index e1cff09cdac..fdaa5dd82a8 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -1306,7 +1306,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(IsCompletedCriteria(achievementCriteria,achievement)) CompletedCriteriaFor(achievement); - // check again the completeness for SUMM and REQ COUNT achievements, + // check again the completeness for SUMM and REQ COUNT achievements, // as they don't depend on the completed criteria but on the sum of the progress of each individual criteria if (achievement->flags & ACHIEVEMENT_FLAG_SUMM) { @@ -1523,7 +1523,7 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry) return false; } - // Default case - need complete all or + // Default case - need complete all or bool completed_all = true; for(AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) { diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 6e8ac6a4909..5c425217844 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -96,6 +96,8 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c) AttackDistance = 0.0f; AttackAngle = 0.0f; + InvinceabilityHpLevel = 0; + //Handle Spawned Events if (!bEmptyList) { @@ -792,6 +794,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 m_creature->ForcedDespawn(); break; } + case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: + { + if(action.invincibility_hp_level.is_percent) + InvinceabilityHpLevel = m_creature->GetMaxHealth()*action.invincibility_hp_level.hp_level/100; + else + InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; + break; + } } } @@ -1338,6 +1348,17 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote) } } +void CreatureEventAI::DamageTaken( Unit* done_by, uint32& damage ) +{ + if(InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage) + { + if(m_creature->GetHealth() <= InvinceabilityHpLevel) + damage = 0; + else + damage = m_creature->GetHealth() - InvinceabilityHpLevel; + } +} + bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event) { if(event.event_type != EVENT_T_SPAWNED) diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index ad3827ef75d..7882e7542ec 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -113,6 +113,7 @@ enum EventAI_ActionType ACTION_T_FORCE_DESPAWN = 41, // No Params ACTION_T_END = 105, + ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat,1-percent from max health) }; enum Target @@ -379,6 +380,12 @@ struct CreatureEventAI_Action { uint32 sheath; } set_sheath; + // ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42 + struct + { + uint32 hp_level; + uint32 is_percent; + } invincibility_hp_level; // RAW struct { @@ -581,6 +588,7 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI void AttackStart(Unit *who); void MoveInLineOfSight(Unit *who); void SpellHit(Unit* pUnit, const SpellEntry* pSpell); + void DamageTaken(Unit* done_by, uint32& damage); void UpdateAI(const uint32 diff); void ReceiveEmote(Player* pPlayer, uint32 text_emote); static int Permissible(const Creature *); @@ -608,10 +616,11 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI bool bEmptyList; //Variables used by Events themselves - uint8 Phase; //Current phase, max 32 phases - bool CombatMovementEnabled; //If we allow targeted movment gen (movement twoards top threat) - bool MeleeEnabled; //If we allow melee auto attack - float AttackDistance; //Distance to attack from - float AttackAngle; //Angle of attack + uint8 Phase; // Current phase, max 32 phases + bool CombatMovementEnabled; // If we allow targeted movment gen (movement twoards top threat) + bool MeleeEnabled; // If we allow melee auto attack + float AttackDistance; // Distance to attack from + float AttackAngle; // Angle of attack + uint32 InvinceabilityHpLevel; // Minimal health level allowed at damage apply }; #endif diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index 18db935536b..45bff09eb03 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -661,6 +661,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() action.set_sheath.sheath = SHEATH_STATE_UNARMED; } break; + case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: + if(action.invincibility_hp_level.is_percent) + { + if(action.invincibility_hp_level.hp_level > 100) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level); + action.invincibility_hp_level.hp_level = 100; + } + } + break; case ACTION_T_EVADE: //No Params case ACTION_T_FLEE_FOR_ASSIST: //No Params case ACTION_T_DIE: //No Params diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index ffc37e1ee9b..910316881a4 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1463,13 +1463,6 @@ struct SpellFocusObjectEntry // 16 string flags, unused }; -// stored in SQL table -struct SpellThreatEntry -{ - uint32 spellId; - int32 threat; -}; - struct SpellRadiusEntry { uint32 ID; diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index d886cda742b..114393f4287 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -862,12 +862,14 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) recvPacket >> guid; // cheating protection + /* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command. Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); if(!pCreature) { sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); return; } + */ uint32 slot = _player->GetBankBagSlotCount(); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 2488e7696e0..c2a93c36e0c 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1018,10 +1018,11 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) uint32 size = adata->Data.size(); + uLongf destSize = compressBound(size); + ByteBuffer dest; - dest.resize(size); + dest.resize(destSize); - uLongf destSize = size; if(size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK) { sLog.outDebug("RAD: Failed to compress account data"); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index d565818910e..abf4de09275 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -259,13 +259,13 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData * data) const data->AddOutOfRangeGUID(GetGUID()); } -void Object::DestroyForPlayer(Player *target) const +void Object::DestroyForPlayer( Player *target, bool anim ) const { ASSERT(target); WorldPacket data(SMSG_DESTROY_OBJECT, 8); data << uint64(GetGUID()); - data << uint8(0); // WotLK (bool) + data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation target->GetSession()->SendPacket( &data ); } @@ -730,7 +730,7 @@ void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const void Object::SetInt32Value( uint16 index, int32 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(m_int32Values[ index ] != value) { @@ -749,7 +749,7 @@ void Object::SetInt32Value( uint16 index, int32 value ) void Object::SetUInt32Value( uint16 index, uint32 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(m_uint32Values[ index ] != value) { @@ -768,7 +768,7 @@ void Object::SetUInt32Value( uint16 index, uint32 value ) void Object::SetUInt64Value( uint16 index, const uint64 &value ) { - ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) ); if(*((uint64*)&(m_uint32Values[ index ])) != value) { m_uint32Values[ index ] = *((uint32*)&value); @@ -829,7 +829,7 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 &value) void Object::SetFloatValue( uint16 index, float value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(m_floatValues[ index ] != value) { @@ -848,7 +848,7 @@ void Object::SetFloatValue( uint16 index, float value ) void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 4) { @@ -874,7 +874,7 @@ void Object::SetByteValue( uint16 index, uint8 offset, uint8 value ) void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 2) { @@ -948,7 +948,7 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) void Object::SetFlag( uint16 index, uint32 newFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); uint32 oldval = m_uint32Values[ index ]; uint32 newval = oldval | newFlag; @@ -969,7 +969,7 @@ void Object::SetFlag( uint16 index, uint32 newFlag ) void Object::RemoveFlag( uint16 index, uint32 oldFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); uint32 oldval = m_uint32Values[ index ]; uint32 newval = oldval & ~oldFlag; @@ -990,7 +990,7 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag ) void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 4) { @@ -1015,7 +1015,7 @@ void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag ) { - ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + ASSERT( index < m_valuesCount || PrintIndexError( index, true ) ); if(offset > 4) { @@ -1432,7 +1432,7 @@ bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2, void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const { - if(distance==0) + if(distance == 0) { rand_x = x; rand_y = y; @@ -1666,7 +1666,7 @@ void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /* void WorldObject::SendObjectDeSpawnAnim(uint64 guid) { WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8); - data << guid; + data << uint64(guid); SendMessageToSet(&data, true); } diff --git a/src/game/Object.h b/src/game/Object.h index 3004601cd50..235b3fb6b38 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -171,7 +171,7 @@ class TRINITY_DLL_SPEC Object void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const; void BuildUpdate(UpdateDataMapType &); - virtual void DestroyForPlayer( Player *target ) const; + virtual void DestroyForPlayer( Player *target, bool anim = false ) const; const int32& GetInt32Value( uint16 index ) const { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index c531366845f..7557c23d072 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -635,7 +635,7 @@ void ObjectMgr::LoadCreatureTemplates() // used later for scale CreatureDisplayInfoEntry const* displayScaleEntry = NULL; - + if (cInfo->DisplayID_A[0]) { CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A[0]); @@ -7111,7 +7111,7 @@ uint8 ObjectMgr::CheckPlayerName( const std::string& name, bool create ) uint32 strictMask = sWorld.getConfig(CONFIG_STRICT_PLAYER_NAMES); if(!isValidString(wname,strictMask,false,create)) return CHAR_NAME_MIXED_LANGUAGES; - + return CHAR_NAME_SUCCESS; } diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index ddf7c74146a..8fd57ad52be 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1025,7 +1025,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, &WorldSession::HandleReportPvPAFK }, - /*0x3E5*/ { "CMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x3E5*/ { "SMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankerActivate }, /*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankQueryTab }, /*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index b3d9c4f8f11..b468cc64978 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -694,8 +694,8 @@ enum Opcodes CMSG_GROUP_ASSISTANT_LEADER = 0x28F, CMSG_BUYBACK_ITEM = 0x290, SMSG_SERVER_MESSAGE = 0x291, - CMSG_MEETINGSTONE_JOIN = 0x292, - CMSG_MEETINGSTONE_LEAVE = 0x293, // SMSG? + CMSG_MEETINGSTONE_JOIN = 0x292, // lua: SetSavedInstanceExtend + SMSG_MEETINGSTONE_LEAVE = 0x293, CMSG_MEETINGSTONE_CHEAT = 0x294, SMSG_MEETINGSTONE_SETQUEUE = 0x295, CMSG_MEETINGSTONE_INFO = 0x296, @@ -1033,7 +1033,7 @@ enum Opcodes SMSG_COMSAT_CONNECT_FAIL = 0x3E2, SMSG_VOICE_CHAT_STATUS = 0x3E3, CMSG_REPORT_PVP_AFK = 0x3E4, - CMSG_REPORT_PVP_AFK_RESULT = 0x3E5, + SMSG_REPORT_PVP_AFK_RESULT = 0x3E5, // SMSG? CMSG_GUILD_BANKER_ACTIVATE = 0x3E6, CMSG_GUILD_BANK_QUERY_TAB = 0x3E7, SMSG_GUILD_BANK_LIST = 0x3E8, diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 704e0981413..4071cfb50bb 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -156,7 +156,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool } uint32 pet_number = fields[0].GetUInt32(); - + if (current && owner->IsPetNeedBeTemporaryUnsummoned()) { owner->SetTemporaryUnsummonedPetNumber(pet_number); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d2dbdd1263c..5659f14f28a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1329,8 +1329,8 @@ void Player::Update( uint32 p_time ) { if (p_time >= m_DetectInvTimer) { - m_DetectInvTimer = 3000; HandleStealthedUnitsDetection(); + m_DetectInvTimer = 3000; } else m_DetectInvTimer -= p_time; @@ -3865,9 +3865,9 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) Unit::BuildCreateUpdateBlockForPlayer( data, target ); } -void Player::DestroyForPlayer( Player *target ) const +void Player::DestroyForPlayer( Player *target, bool anim ) const { - Unit::DestroyForPlayer( target ); + Unit::DestroyForPlayer( target, anim ); for(uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { @@ -10710,7 +10710,6 @@ Item* Player::EquipNewItem( uint16 pos, uint32 item, bool update ) Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) { - AddEnchantmentDurations(pItem); AddItemDurations(pItem); @@ -16717,10 +16716,10 @@ void Player::SendAttackSwingBadFacingAttack() GetSession()->SendPacket( &data ); } -void Player::SendAutoRepeatCancel() +void Player::SendAutoRepeatCancel(Unit *target) { - WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, GetPackGUID().size()); - data.append(GetPackGUID()); // may be it's target guid + WorldPacket data(SMSG_CANCEL_AUTO_REPEAT, target->GetPackGUID().size()); + data.append(target->GetPackGUID()); // may be it's target guid GetSession()->SendPacket( &data ); } @@ -17553,19 +17552,38 @@ void Player::HandleStealthedUnitsDetection() Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(this, stealthedUnits, u_check); VisitNearbyObject(World::GetMaxVisibleDistance(), searcher); - for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i) + for (std::list<Unit*>::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i) { - if (!HaveAtClient(*i) && canSeeOrDetect(*i, true)) + if((*i)==this) + continue; + + bool hasAtClient = HaveAtClient((*i)); + bool hasDetected = canSeeOrDetect(*i, true); + + if (hasDetected) { - (*i)->SendUpdateToPlayer(this); - m_clientGUIDs.insert((*i)->GetGUID()); + if(!hasAtClient) + { + (*i)->SendUpdateToPlayer(this); + m_clientGUIDs.insert((*i)->GetGUID()); - #ifdef TRINITY_DEBUG - if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) - sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i)); - #endif + #ifdef MANGOS_DEBUG + if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0) + sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i)); + #endif - SendInitialVisiblePackets(*i); + // target aura duration for caster show only if target exist at caster client + // send data at target visibility change (adding to client) + SendInitialVisiblePackets(*i); + } + } + else + { + if(hasAtClient) + { + (*i)->DestroyForPlayer(this); + m_clientGUIDs.erase((*i)->GetGUID()); + } } } } @@ -18773,7 +18791,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) { if(HaveAtClient(target)) { - if(!target->isVisibleForInState(this,true)) + if(!target->isVisibleForInState(this, true)) { target->DestroyForPlayer(this); m_clientGUIDs.erase(target->GetGUID()); @@ -20360,11 +20378,30 @@ bool Player::HasTitle(uint32 bitIndex) return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } -void Player::SetTitle(CharTitlesEntry const* title) +void Player::SetTitle(CharTitlesEntry const* title, bool lost) { uint32 fieldIndexOffset = title->bit_index / 32; uint32 flag = 1 << (title->bit_index % 32); - SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); + + if(lost) + { + if(!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag)) + return; + + RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); + } + else + { + if(HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag)) + return; + + SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); + } + + WorldPacket data(SMSG_TITLE_EARNED, 4 + 4); + data << uint32(title->bit_index); + data << uint32(lost ? 0 : 1); // 1 - earned, 0 - lost + GetSession()->SendPacket(&data); } /*-----------------------TRINITY--------------------------*/ diff --git a/src/game/Player.h b/src/game/Player.h index a8ec9e80172..49d4c1346b9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -136,11 +136,12 @@ enum ActionButtonUpdateState enum ActionButtonType { - ACTION_BUTTON_SPELL = 0, - ACTION_BUTTON_EQSET = 32, - ACTION_BUTTON_MACRO = 64, - ACTION_BUTTON_CMACRO= 65, - ACTION_BUTTON_ITEM = 128 + ACTION_BUTTON_SPELL = 0x00, + ACTION_BUTTON_C = 0x01, // click? + ACTION_BUTTON_EQSET = 0x20, + ACTION_BUTTON_MACRO = 0x40, + ACTION_BUTTON_CMACRO = ACTION_BUTTON_C | ACTION_BUTTON_MACRO, + ACTION_BUTTON_ITEM = 0x80 }; #define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) @@ -1653,7 +1654,7 @@ class TRINITY_DLL_SPEC Player : public Unit void SetSession(WorldSession *s) { m_session = s; } void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; - void DestroyForPlayer( Player *target ) const; + void DestroyForPlayer( Player *target, bool anim = false ) const; void SendDelayResponse(const uint32); void SendLogXPGain(uint32 GivenXP,Unit* victim,uint32 RestXP); @@ -1663,7 +1664,7 @@ class TRINITY_DLL_SPEC Player : public Unit void SendAttackSwingDeadTarget(); void SendAttackSwingNotInRange(); void SendAttackSwingBadFacingAttack(); - void SendAutoRepeatCancel(); + void SendAutoRepeatCancel(Unit *target); void SendExplorationExperience(uint32 Area, uint32 Experience); void SendDungeonDifficulty(bool IsInGroup); @@ -2050,7 +2051,6 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow); // Stealth detection system - uint32 m_DetectInvTimer; void HandleStealthedUnitsDetection(); uint8 m_forced_speed_changes[MAX_MOVE_TYPE]; @@ -2140,7 +2140,7 @@ class TRINITY_DLL_SPEC Player : public Unit void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0); bool HasTitle(uint32 bitIndex); bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); } - void SetTitle(CharTitlesEntry const* title); + void SetTitle(CharTitlesEntry const* title, bool lost = false); //bool isActiveObject() const { return true; } bool canSeeSpellClickOn(Creature const* creature) const; @@ -2403,6 +2403,8 @@ class TRINITY_DLL_SPEC Player : public Unit bool m_bCanDelayTeleport; bool m_bHasDelayedTeleport; + uint32 m_DetectInvTimer; + // Temporary removed pet cache uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 80f7c402fd4..2187614d368 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -332,7 +332,7 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl std::string PlayerDumpWriter::GetDump(uint32 guid) { std::string dump; - + dump += "IMPORTANT NOTE: This sql queries not created for apply directly, use '.pdump load' command in console or client chat instead.\n"; dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n"; diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 0540f8f7dbe..535664462a5 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -667,10 +667,10 @@ enum SpellEffects SPELL_EFFECT_APPLY_AREA_AURA_ENEMY = 129, SPELL_EFFECT_REDIRECT_THREAT = 130, SPELL_EFFECT_131 = 131, - SPELL_EFFECT_132 = 132, + SPELL_EFFECT_PLAY_MUSIC = 132, SPELL_EFFECT_UNLEARN_SPECIALIZATION = 133, SPELL_EFFECT_KILL_CREDIT2 = 134, - SPELL_EFFECT_135 = 135, + SPELL_EFFECT_CALL_PET = 135, SPELL_EFFECT_HEAL_PCT = 136, SPELL_EFFECT_ENERGIZE_PCT = 137, SPELL_EFFECT_138 = 138, diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index de441168576..686fcf889b9 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -106,7 +106,9 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.count(reqSkillOrSpell)==0) { - sLog.outErrorDb("Spell (ID: %u) not have have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",reqSkillOrSpell,spellId); + sLog.outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" + " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", + reqSkillOrSpell,spellId); reportedReqSpells.insert(reqSkillOrSpell); } continue; @@ -145,6 +147,21 @@ void LoadSkillDiscoveryTable() sLog.outString( ">> Loaded %u skill discovery definitions", count ); if(!ssNonDiscoverableEntries.str().empty()) sLog.outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s",ssNonDiscoverableEntries.str().c_str()); + + // report about empty data for explicit discovery spells + for(uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id) + { + SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell_id); + if(!spellEntry) + continue; + + // skip not explicit discovery spells + if (!IsExplicitDiscoverySpell(spellEntry)) + continue; + + if(SkillDiscoveryStore.find(spell_id)==SkillDiscoveryStore.end()) + sLog.outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table",spell_id); + } } uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f4e992b6a7b..5c1b2fc3687 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4200,13 +4200,14 @@ void Spell::HandleThreatSpells(uint32 spellId) if(!m_targets.getUnitTarget()->CanHaveThreatList()) return; - SpellThreatEntry const *threatSpell = sSpellThreatStore.LookupEntry<SpellThreatEntry>(spellId); - if(!threatSpell) + uint16 threat = spellmgr.GetSpellThreat(spellId); + + if(!threat) return; - m_targets.getUnitTarget()->AddThreat(m_caster, float(threatSpell->threat)); + m_targets.getUnitTarget()->AddThreat(m_caster, float(threat)); - DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threatSpell->threat); + DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threat); } void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i) diff --git a/src/game/Spell.h b/src/game/Spell.h index 1f4086280f0..b593bf79881 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -354,6 +354,7 @@ class Spell void EffectActivateRune(uint32 i); void EffectTitanGrip(uint32 i); void EffectEnchantItemPrismatic(uint32 i); + void EffectPlayMusic(uint32 i); typedef std::set<Aura *> UsedSpellMods; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 2a072cf817f..df55a4fc1be 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -6357,7 +6357,17 @@ void AuraEffect::PeriodicTick() if(m_auraName==SPELL_AURA_OBS_MOD_HEALTH) pdamage = uint32(m_target->GetMaxHealth() * pdamage * GetParentAura()->GetStackAmount() / 100); else + { + // Wild Growth (1/7 - 6 + 2*ramainTicks) % + if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellIconID == 2864) + { + int32 ticks = GetParentAura()->GetAuraMaxDuration()/m_amplitude; + int32 remainingTicks = int32(float(GetParentAura()->GetAuraDuration()) / m_amplitude + 0.5); + pdamage = int32(pdamage) + int32(pdamage)*ticks*(-6+2*remainingTicks)/100; + } + pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount()); + } bool crit = false; Unit::AuraEffectList const& mPeriodicCritAuras= pCaster->GetAurasByType(SPELL_AURA_ABILITY_PERIODIC_CRIT); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 7523664c8b1..724c57c48b6 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -196,7 +196,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectApplyAreaAura, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY &Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT &Spell::EffectUnused, //131 SPELL_EFFECT_131 used in some test spells - &Spell::EffectNULL, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc) + &Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc) &Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization &Spell::EffectKillCredit, //134 SPELL_EFFECT_KILL_CREDIT misc value is creature entry &Spell::EffectNULL, //135 SPELL_EFFECT_CALL_PET @@ -932,7 +932,7 @@ void Spell::EffectDummy(uint32 i) case 23448: // Transporter Arrival - Ultrasafe Transporter: Gadgetzan - backfires { int32 r = irand(0, 119); - if ( r < 20 ) // Transporter Malfunction - 1/6 polymorph + if ( r < 20 ) // Transporter Malfunction - 1/6 polymorph m_caster->CastSpell(m_caster, 23444, true); else if ( r < 100 ) // Evil Twin - 4/6 evil twin m_caster->CastSpell(m_caster, 23445, true); @@ -1155,13 +1155,13 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(m_caster, 45088, true); return; } - case 55004: // Nitro Boosts - if(!m_CastItem) return; - if(roll_chance_i(95)) // Nitro Boosts - success - m_caster->CastSpell(m_caster, 54861, true, m_CastItem); - else // Knocked Up - backfire 5% - m_caster->CastSpell(m_caster, 46014, true, m_CastItem); - return; + case 55004: // Nitro Boosts + if(!m_CastItem) return; + if(roll_chance_i(95)) // Nitro Boosts - success + m_caster->CastSpell(m_caster, 54861, true, m_CastItem); + else // Knocked Up - backfire 5% + m_caster->CastSpell(m_caster, 46014, true, m_CastItem); + return; case 50243: // Teach Language { if(m_caster->GetTypeId() != TYPEID_PLAYER) @@ -5089,6 +5089,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 61177: // Northrend Inscription Research case 61288: // Minor Inscription Research case 61756: // Northrend Inscription Research (FAST QA VERSION) + case 64323: // Book of Glyph Mastery { if(m_caster->GetTypeId() != TYPEID_PLAYER) return; @@ -6495,16 +6496,14 @@ void Spell::EffectTransmitted(uint32 effIndex) case GAMEOBJECT_TYPE_FISHINGHOLE: case GAMEOBJECT_TYPE_CHEST: default: - { break; - } } pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); - pGameObj->SetOwnerGUID(m_caster->GetGUID() ); + pGameObj->SetOwnerGUID(m_caster->GetGUID()); - //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() ); + //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); pGameObj->SetSpellId(m_spellInfo->Id); DEBUG_LOG("AddObject at SpellEfects.cpp EffectTransmitted"); @@ -6524,9 +6523,9 @@ void Spell::EffectTransmitted(uint32 effIndex) m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) { linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILISECONDS : 0); - //linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() ); + //linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); linkedGO->SetSpellId(m_spellInfo->Id); - linkedGO->SetOwnerGUID(m_caster->GetGUID() ); + linkedGO->SetOwnerGUID(m_caster->GetGUID()); linkedGO->GetMap()->Add(linkedGO); } @@ -6877,4 +6876,23 @@ void Spell::EffectRenamePet(uint32 /*eff_idx*/) return; unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED); -}
\ No newline at end of file +} + +void Spell::EffectPlayMusic(uint32 i) +{ + if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + return; + + uint32 soundid = m_spellInfo->EffectMiscValue[i]; + + if (!sSoundEntriesStore.LookupEntry(soundid)) + { + sLog.outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.",soundid,m_spellInfo->Id); + return; + } + + WorldPacket data(SMSG_PLAY_MUSIC, 4); + data << uint32(soundid); + ((Player*)unitTarget)->GetSession()->SendPacket(&data); +} + diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 9c9bb255ef2..ae708153142 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1446,12 +1446,50 @@ void SpellMgr::LoadSpellElixirs() void SpellMgr::LoadSpellThreats() { - sSpellThreatStore.Free(); // for reload + mSpellThreatMap.clear(); // need for reload case - sSpellThreatStore.Load(); + uint32 count = 0; + + // 0 1 + QueryResult *result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat"); + if( !result ) + { + + barGoLink bar( 1 ); + + bar.step(); + + sLog.outString(); + sLog.outString( ">> Loaded %u aggro generating spells", count ); + return; + } + + barGoLink bar( result->GetRowCount() ); + + do + { + Field *fields = result->Fetch(); + + bar.step(); + + uint32 entry = fields[0].GetUInt32(); + uint16 Threat = fields[1].GetUInt16(); + + if (!sSpellStore.LookupEntry(entry)) + { + sLog.outErrorDb("Spell %u listed in `spell_threat` does not exist", entry); + continue; + } + + mSpellThreatMap[entry] = Threat; + + ++count; + } while( result->NextRow() ); + + delete result; - sLog.outString( ">> Loaded %u aggro generating spells", sSpellThreatStore.RecordCount ); sLog.outString(); + sLog.outString( ">> Loaded %u aggro generating spells", count ); } bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const @@ -2843,6 +2881,11 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto // Explicit Diminishing Groups switch(spellproto->SpellFamilyName) { + case SPELLFAMILY_GENERIC: + // some generic arena related spells have by some strange reason MECHANIC_TURN + if (spellproto->Mechanic == MECHANIC_TURN) + return DIMINISHING_NONE; + break; case SPELLFAMILY_MAGE: { // Frostbite 0x80000000 diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 8315fdc2965..2540f141b43 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -40,8 +40,6 @@ class Player; class Spell; struct SpellModifier; -extern SQLStorage sSpellThreatStore; - // only used in code enum SpellCategories { @@ -224,7 +222,9 @@ inline bool IsElementalShield(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) { - return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM && spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT; + return spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM + && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT + || spellInfo->Id == 64323; // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) } inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) @@ -524,6 +524,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap; #define ELIXIR_SHATTRATH_MASK 0x8 typedef std::map<uint32, uint8> SpellElixirMap; +typedef std::map<uint32, uint16> SpellThreatMap; // Spell script target related declarations (accessed using SpellMgr functions) enum SpellScriptTargetType @@ -761,6 +762,15 @@ class SpellMgr return SPELL_NORMAL; } + uint16 GetSpellThreat(uint32 spellid) const + { + SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid); + if(itr==mSpellThreatMap.end()) + return 0; + + return itr->second; + } + // Spell proc events SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const { @@ -1078,6 +1088,7 @@ class SpellMgr SpellLearnSpellMap mSpellLearnSpells; SpellTargetPositionMap mSpellTargetPositions; SpellElixirMap mSpellElixirs; + SpellThreatMap mSpellThreatMap; SpellProcEventMap mSpellProcEventMap; SpellBonusMap mSpellBonusMap; SkillLineAbilityMap mSkillLineAbilityMap; diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index bd283c81fc5..fbe16c9b726 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -863,7 +863,9 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND; - float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType); + /* difference in AP between current attack power and base value from DB */ + float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureInfo()->attackpower; + float base_value = GetModifierValue(unitMod, BASE_VALUE) + (att_pwr_change * GetAPMultiplier(attType, false) / 14.0f); float base_pct = GetModifierValue(unitMod, BASE_PCT); float total_value = GetModifierValue(unitMod, TOTAL_VALUE); float total_pct = GetModifierValue(unitMod, TOTAL_PCT); diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index b11146367b2..d35ba9e30b9 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -57,9 +57,9 @@ void Totem::InitStats(uint32 duration) Minion::InitStats(duration); CreatureInfo const *cinfo = GetCreatureInfo(); - if (m_owner->GetTypeId()==TYPEID_PLAYER && cinfo) + if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo) { - uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(),cinfo); + uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(), cinfo); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; @@ -137,7 +137,7 @@ void Totem::UnSummon() bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const { - // TODO: possibly all negative auras immuned? + // TODO: possibly all negative auras immune? switch(spellInfo->EffectApplyAuraName[index]) { case SPELL_AURA_PERIODIC_DAMAGE: @@ -150,4 +150,3 @@ bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) co } return Creature::IsImmunedToSpellEffect(spellInfo, index); } - diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 359e31c3acc..3656e5096f3 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3477,8 +3477,8 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant) // send autorepeat cancel message for autorepeat spells if (spellType == CURRENT_AUTOREPEAT_SPELL) { - if(GetTypeId()==TYPEID_PLAYER) - ((Player*)this)->SendAutoRepeatCancel(); + if(GetTypeId() == TYPEID_PLAYER) + ((Player*)this)->SendAutoRepeatCancel(this); } if (spell->getState() != SPELL_STATE_FINISHED) @@ -9241,7 +9241,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } else // Tundra Stalker { - if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT,0, 0x4000000,0)) + // Frost Fever (target debuff) + if (pVictim->GetAura(SPELL_AURA_MOD_HASTE, SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x2)) DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f; break; } @@ -10875,6 +10876,7 @@ bool Unit::canDetectStealthOf(Unit const* target, float distance) const //-Stealth Mod(positive like Master of Deception) and Stealth Detection(negative like paranoia) //based on wowwiki every 5 mod we have 1 more level diff in calculation visibleDistance += (float)(GetTotalAuraModifier(SPELL_AURA_MOD_DETECT) - target->GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL)) / 5.0f; + visibleDistance = visibleDistance > MAX_PLAYER_STEALTH_DETECT_RANGE ? MAX_PLAYER_STEALTH_DETECT_RANGE : visibleDistance; return distance < visibleDistance; } diff --git a/src/game/Unit.h b/src/game/Unit.h index 3488c9b8f14..85f2ed154dd 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1012,6 +1012,7 @@ enum ReactiveType // delay time next attack to prevent client attack animation problems #define ATTACK_DISPLAY_DELAY 200 +#define MAX_PLAYER_STEALTH_DETECT_RANGE 45.0f // max distance for detection targets by player struct SpellProcEventEntry; // used only privately diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp index a3192b74b0e..e461d63e248 100644 --- a/src/game/UpdateData.cpp +++ b/src/game/UpdateData.cpp @@ -128,7 +128,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet) if (pSize > 100 ) // compress large packets { - uint32 destsize = pSize; + uint32 destsize = compressBound(pSize); packet->resize( destsize + sizeof(uint32) ); packet->put<uint32>(0, pSize); diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 50fd484bff5..4113d35236d 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -38,7 +38,6 @@ const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii"; const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii"; const char PageTextfmt[]="isi"; -const char SpellThreatfmt[]="ii"; const char InstanceTemplatesrcfmt[]="iiiiiiffffs"; const char InstanceTemplatedstfmt[]="iiiiiiffffi"; @@ -50,7 +49,6 @@ SQLStorage sEquipmentStorage(EquipmentInfofmt,"entry","creature_equip_template") SQLStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry","gameobject_template"); SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry","item_template"); SQLStorage sPageTextStore(PageTextfmt,"entry","page_text"); -SQLStorage sSpellThreatStore(SpellThreatfmt,"entry","spell_threat"); SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map","instance_template"); void SQLStorage::Free () diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index cbaa4e58108..75997a847a2 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -243,7 +243,7 @@ namespace VMAP char destnamebuffer[500]; char fullnamedestnamebuffer[500]; - + if(nameCollection.iMainFiles.size() >0) { sprintf(destnamebuffer,"%03u_%i_%i.vmap",pMapId, pYPos, pXPos); // flip it here too |