mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[11990] More db-script command changes
* Allow SCRIPT_COMMAND_KILL_CREDIT to give the kill of an involved npc. This is marked by datalong (creature-entry) == 0 * Remove immediate execution of commands. This will prevent infinite loops when db-scripts trigger db-scripts which are executed immediately * Add check for SCRIPT_COMMAND_PLAY_SOUND * Add check to catch an invalid command Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
419ba5fc28
commit
414d432d24
6 changed files with 109 additions and 91 deletions
|
|
@ -175,7 +175,7 @@ Where "A -> B" means that the command is executed from A with B as target.
|
||||||
* datalong2 = distance or 0
|
* datalong2 = distance or 0
|
||||||
|
|
||||||
8 SCRIPT_COMMAND_KILL_CREDIT source or target with Player
|
8 SCRIPT_COMMAND_KILL_CREDIT source or target with Player
|
||||||
* datalong = creature entry
|
* datalong = creature entry, or 0; If 0 the entry of the creature source or target is used
|
||||||
* datalong2 = bool (0=personal credit, 1=group credit)
|
* datalong2 = bool (0=personal credit, 1=group credit)
|
||||||
|
|
||||||
9 SCRIPT_COMMAND_RESPAWN_GAMEOBJECT source = any, target = any
|
9 SCRIPT_COMMAND_RESPAWN_GAMEOBJECT source = any, target = any
|
||||||
|
|
|
||||||
|
|
@ -1620,20 +1620,14 @@ bool Map::ScriptsStart(ScriptMapMapName const& scripts, uint32 id, Object* sourc
|
||||||
|
|
||||||
///- Schedule script execution for all scripts in the script map
|
///- Schedule script execution for all scripts in the script map
|
||||||
ScriptMap const *s2 = &(s->second);
|
ScriptMap const *s2 = &(s->second);
|
||||||
bool immedScript = false;
|
|
||||||
for (ScriptMap::const_iterator iter = s2->begin(); iter != s2->end(); ++iter)
|
for (ScriptMap::const_iterator iter = s2->begin(); iter != s2->end(); ++iter)
|
||||||
{
|
{
|
||||||
ScriptAction sa(scripts.first, this, sourceGuid, targetGuid, ownerGuid, &iter->second);
|
ScriptAction sa(scripts.first, this, sourceGuid, targetGuid, ownerGuid, &iter->second);
|
||||||
|
|
||||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld.GetGameTime() + iter->first), sa));
|
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld.GetGameTime() + iter->first), sa));
|
||||||
if (iter->first == 0)
|
|
||||||
immedScript = true;
|
|
||||||
|
|
||||||
sScriptMgr.IncreaseScheduledScriptsCount();
|
sScriptMgr.IncreaseScheduledScriptsCount();
|
||||||
}
|
}
|
||||||
///- If one of the effects should be immediate, launch the script execution
|
|
||||||
if (immedScript)
|
|
||||||
ScriptsProcess();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1652,10 +1646,6 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
||||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld.GetGameTime() + delay), sa));
|
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld.GetGameTime() + delay), sa));
|
||||||
|
|
||||||
sScriptMgr.IncreaseScheduledScriptsCount();
|
sScriptMgr.IncreaseScheduledScriptsCount();
|
||||||
|
|
||||||
///- If effects should be immediate, launch the script execution
|
|
||||||
if(delay == 0)
|
|
||||||
ScriptsProcess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Process queued scripts
|
/// Process queued scripts
|
||||||
|
|
|
||||||
|
|
@ -21080,7 +21080,7 @@ void Player::RewardSinglePlayerAtKill(Unit* pVictim)
|
||||||
|
|
||||||
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
|
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
|
||||||
{
|
{
|
||||||
ObjectGuid creature_guid = pRewardSource->GetTypeId()==TYPEID_UNIT ? pRewardSource->GetObjectGuid() : ObjectGuid();
|
ObjectGuid creature_guid = pRewardSource && pRewardSource->GetTypeId() == TYPEID_UNIT ? pRewardSource->GetObjectGuid() : ObjectGuid();
|
||||||
|
|
||||||
// prepare data for near group iteration
|
// prepare data for near group iteration
|
||||||
if (Group *pGroup = GetGroup())
|
if (Group *pGroup = GetGroup())
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
switch (tmp.command)
|
switch (tmp.command)
|
||||||
{
|
{
|
||||||
case SCRIPT_COMMAND_TALK:
|
case SCRIPT_COMMAND_TALK: // 0
|
||||||
{
|
{
|
||||||
if (tmp.talk.chatType > CHAT_TYPE_ZONE_YELL)
|
if (tmp.talk.chatType > CHAT_TYPE_ZONE_YELL)
|
||||||
{
|
{
|
||||||
|
|
@ -247,7 +247,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
// if (!GetMangosStringLocale(tmp.dataint)) will be checked after db_script_string loading
|
// if (!GetMangosStringLocale(tmp.dataint)) will be checked after db_script_string loading
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_EMOTE:
|
case SCRIPT_COMMAND_EMOTE: // 1
|
||||||
{
|
{
|
||||||
if (!sEmotesStore.LookupEntry(tmp.emote.emoteId))
|
if (!sEmotesStore.LookupEntry(tmp.emote.emoteId))
|
||||||
{
|
{
|
||||||
|
|
@ -256,7 +256,12 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_TELEPORT_TO:
|
case SCRIPT_COMMAND_FIELD_SET: // 2
|
||||||
|
case SCRIPT_COMMAND_MOVE_TO: // 3
|
||||||
|
case SCRIPT_COMMAND_FLAG_SET: // 4
|
||||||
|
case SCRIPT_COMMAND_FLAG_REMOVE: // 5
|
||||||
|
break;
|
||||||
|
case SCRIPT_COMMAND_TELEPORT_TO: // 6
|
||||||
{
|
{
|
||||||
if (!sMapStore.LookupEntry(tmp.teleportTo.mapId))
|
if (!sMapStore.LookupEntry(tmp.teleportTo.mapId))
|
||||||
{
|
{
|
||||||
|
|
@ -271,7 +276,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
case SCRIPT_COMMAND_QUEST_EXPLORED: // 7
|
||||||
{
|
{
|
||||||
Quest const* quest = sObjectMgr.GetQuestTemplate(tmp.questExplored.questId);
|
Quest const* quest = sObjectMgr.GetQuestTemplate(tmp.questExplored.questId);
|
||||||
if (!quest)
|
if (!quest)
|
||||||
|
|
@ -313,16 +318,16 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
case SCRIPT_COMMAND_KILL_CREDIT: // 8
|
||||||
{
|
{
|
||||||
if (!ObjectMgr::GetCreatureTemplate(tmp.killCredit.creatureEntry))
|
if (tmp.killCredit.creatureEntry && !ObjectMgr::GetCreatureTemplate(tmp.killCredit.creatureEntry))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tablename, tmp.killCredit.creatureEntry, tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tablename, tmp.killCredit.creatureEntry, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: // 9
|
||||||
{
|
{
|
||||||
uint32 goEntry = 0;
|
uint32 goEntry = 0;
|
||||||
|
|
||||||
|
|
@ -364,7 +369,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: // 10
|
||||||
{
|
{
|
||||||
if (!MaNGOS::IsValidMapCoord(tmp.x, tmp.y, tmp.z, tmp.o))
|
if (!MaNGOS::IsValidMapCoord(tmp.x, tmp.y, tmp.z, tmp.o))
|
||||||
{
|
{
|
||||||
|
|
@ -379,8 +384,8 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
case SCRIPT_COMMAND_OPEN_DOOR: // 11
|
||||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
case SCRIPT_COMMAND_CLOSE_DOOR: // 12
|
||||||
{
|
{
|
||||||
uint32 goEntry = 0;
|
uint32 goEntry = 0;
|
||||||
|
|
||||||
|
|
@ -419,7 +424,9 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_REMOVE_AURA:
|
case SCRIPT_COMMAND_ACTIVATE_OBJECT: // 13
|
||||||
|
break;
|
||||||
|
case SCRIPT_COMMAND_REMOVE_AURA: // 14
|
||||||
{
|
{
|
||||||
if (!sSpellStore.LookupEntry(tmp.removeAura.spellId))
|
if (!sSpellStore.LookupEntry(tmp.removeAura.spellId))
|
||||||
{
|
{
|
||||||
|
|
@ -429,7 +436,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CAST_SPELL:
|
case SCRIPT_COMMAND_CAST_SPELL: // 15
|
||||||
{
|
{
|
||||||
if (!sSpellStore.LookupEntry(tmp.castSpell.spellId))
|
if (!sSpellStore.LookupEntry(tmp.castSpell.spellId))
|
||||||
{
|
{
|
||||||
|
|
@ -439,7 +446,17 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CREATE_ITEM:
|
case SCRIPT_COMMAND_PLAY_SOUND: // 16
|
||||||
|
{
|
||||||
|
if (!sSoundEntriesStore.LookupEntry(tmp.playSound.soundId))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `%s` using nonexistent sound (id: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u",
|
||||||
|
tablename, tmp.playSound.soundId, tmp.id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SCRIPT_COMMAND_CREATE_ITEM: // 17
|
||||||
{
|
{
|
||||||
if (!ObjectMgr::GetItemPrototype(tmp.createItem.itemEntry))
|
if (!ObjectMgr::GetItemPrototype(tmp.createItem.itemEntry))
|
||||||
{
|
{
|
||||||
|
|
@ -455,12 +472,12 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_DESPAWN_SELF:
|
case SCRIPT_COMMAND_DESPAWN_SELF: // 18
|
||||||
{
|
{
|
||||||
// for later, we might consider despawn by database guid, and define in datalong2 as option to despawn self.
|
// for later, we might consider despawn by database guid, and define in datalong2 as option to despawn self.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_PLAY_MOVIE:
|
case SCRIPT_COMMAND_PLAY_MOVIE: // 19
|
||||||
{
|
{
|
||||||
if (!sMovieStore.LookupEntry(tmp.playMovie.movieId))
|
if (!sMovieStore.LookupEntry(tmp.playMovie.movieId))
|
||||||
{
|
{
|
||||||
|
|
@ -470,7 +487,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MOVEMENT:
|
case SCRIPT_COMMAND_MOVEMENT: // 20
|
||||||
{
|
{
|
||||||
if (tmp.movement.movementType >= MAX_DB_MOTION_TYPE)
|
if (tmp.movement.movementType >= MAX_DB_MOTION_TYPE)
|
||||||
{
|
{
|
||||||
|
|
@ -481,11 +498,9 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_SET_ACTIVEOBJECT:
|
case SCRIPT_COMMAND_SET_ACTIVEOBJECT: // 21
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
case SCRIPT_COMMAND_SET_FACTION: // 22
|
||||||
case SCRIPT_COMMAND_SET_FACTION:
|
|
||||||
{
|
{
|
||||||
if (tmp.faction.factionId && !sFactionTemplateStore.LookupEntry(tmp.faction.factionId))
|
if (tmp.faction.factionId && !sFactionTemplateStore.LookupEntry(tmp.faction.factionId))
|
||||||
{
|
{
|
||||||
|
|
@ -495,7 +510,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL:
|
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL: // 23
|
||||||
{
|
{
|
||||||
if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||||
{
|
{
|
||||||
|
|
@ -516,7 +531,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL:
|
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL: // 24
|
||||||
{
|
{
|
||||||
if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
if (tmp.data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||||
{
|
{
|
||||||
|
|
@ -537,15 +552,10 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_SET_RUN:
|
case SCRIPT_COMMAND_SET_RUN: // 25
|
||||||
{
|
case SCRIPT_COMMAND_ATTACK_START: // 26
|
||||||
break;
|
break;
|
||||||
}
|
case SCRIPT_COMMAND_GO_LOCK_STATE: // 27
|
||||||
case SCRIPT_COMMAND_ATTACK_START:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SCRIPT_COMMAND_GO_LOCK_STATE:
|
|
||||||
{
|
{
|
||||||
if (// lock(0x01) and unlock(0x02) together
|
if (// lock(0x01) and unlock(0x02) together
|
||||||
((tmp.goLockState.lockState & 0x01) && (tmp.goLockState.lockState & 0x02)) ||
|
((tmp.goLockState.lockState & 0x01) && (tmp.goLockState.lockState & 0x02)) ||
|
||||||
|
|
@ -561,7 +571,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_STAND_STATE:
|
case SCRIPT_COMMAND_STAND_STATE: // 28
|
||||||
{
|
{
|
||||||
if (tmp.standState.stand_state >= MAX_UNIT_STAND_STATE)
|
if (tmp.standState.stand_state >= MAX_UNIT_STAND_STATE)
|
||||||
{
|
{
|
||||||
|
|
@ -570,11 +580,9 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MODIFY_NPC_FLAGS:
|
case SCRIPT_COMMAND_MODIFY_NPC_FLAGS: // 29
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
case SCRIPT_COMMAND_SEND_TAXI_PATH: // 30
|
||||||
case SCRIPT_COMMAND_SEND_TAXI_PATH:
|
|
||||||
{
|
{
|
||||||
if (!sTaxiPathStore.LookupEntry(tmp.sendTaxiPath.taxiPathId))
|
if (!sTaxiPathStore.LookupEntry(tmp.sendTaxiPath.taxiPathId))
|
||||||
{
|
{
|
||||||
|
|
@ -606,6 +614,11 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `%s` unknown command %u, skipping.", tablename, tmp.command);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scripts.second.find(tmp.id) == scripts.second.end())
|
if (scripts.second.find(tmp.id) == scripts.second.end())
|
||||||
|
|
@ -1013,7 +1026,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
switch (m_script->command)
|
switch (m_script->command)
|
||||||
{
|
{
|
||||||
case SCRIPT_COMMAND_TALK:
|
case SCRIPT_COMMAND_TALK: // 0
|
||||||
{
|
{
|
||||||
if (!pSource)
|
if (!pSource)
|
||||||
{
|
{
|
||||||
|
|
@ -1072,11 +1085,11 @@ void ScriptAction::HandleScriptStep()
|
||||||
pSource->MonsterYellToZone(textId, m_script->talk.language, unitTarget);
|
pSource->MonsterYellToZone(textId, m_script->talk.language, unitTarget);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break; // must be already checked at load
|
break; // must be already checked at load
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_EMOTE:
|
case SCRIPT_COMMAND_EMOTE: // 1
|
||||||
{
|
{
|
||||||
if (LogIfNotUnit(pSource))
|
if (LogIfNotUnit(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1084,7 +1097,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
((Unit*)pSource)->HandleEmote(m_script->emote.emoteId);
|
((Unit*)pSource)->HandleEmote(m_script->emote.emoteId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_FIELD_SET:
|
case SCRIPT_COMMAND_FIELD_SET: // 2
|
||||||
// TODO
|
// TODO
|
||||||
if (!source)
|
if (!source)
|
||||||
{
|
{
|
||||||
|
|
@ -1100,7 +1113,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
source->SetUInt32Value(m_script->setField.fieldId, m_script->setField.fieldValue);
|
source->SetUInt32Value(m_script->setField.fieldId, m_script->setField.fieldValue);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_MOVE_TO:
|
case SCRIPT_COMMAND_MOVE_TO: // 3
|
||||||
{
|
{
|
||||||
if (LogIfNotUnit(pSource))
|
if (LogIfNotUnit(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1131,7 +1144,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_FLAG_SET:
|
case SCRIPT_COMMAND_FLAG_SET: // 4
|
||||||
// TODO
|
// TODO
|
||||||
if (!source)
|
if (!source)
|
||||||
{
|
{
|
||||||
|
|
@ -1147,7 +1160,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
source->SetFlag(m_script->setFlag.fieldId, m_script->setFlag.fieldValue);
|
source->SetFlag(m_script->setFlag.fieldId, m_script->setFlag.fieldValue);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_FLAG_REMOVE:
|
case SCRIPT_COMMAND_FLAG_REMOVE: // 5
|
||||||
// TODO
|
// TODO
|
||||||
if (!source)
|
if (!source)
|
||||||
{
|
{
|
||||||
|
|
@ -1163,7 +1176,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
source->RemoveFlag(m_script->removeFlag.fieldId, m_script->removeFlag.fieldValue);
|
source->RemoveFlag(m_script->removeFlag.fieldId, m_script->removeFlag.fieldValue);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_TELEPORT_TO:
|
case SCRIPT_COMMAND_TELEPORT_TO: // 6
|
||||||
{
|
{
|
||||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
|
|
@ -1172,7 +1185,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
pPlayer->TeleportTo(m_script->teleportTo.mapId, m_script->x, m_script->y, m_script->z, m_script->o);
|
pPlayer->TeleportTo(m_script->teleportTo.mapId, m_script->x, m_script->y, m_script->z, m_script->o);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
case SCRIPT_COMMAND_QUEST_EXPLORED: // 7
|
||||||
{
|
{
|
||||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
|
|
@ -1206,20 +1219,35 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
case SCRIPT_COMMAND_KILL_CREDIT: // 8
|
||||||
{
|
{
|
||||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
uint32 creatureEntry = m_script->killCredit.creatureEntry;
|
||||||
|
WorldObject* pRewardSource = pSource && pSource->GetTypeId() == TYPEID_UNIT ? pSource : (pTarget && pTarget->GetTypeId() == TYPEID_UNIT ? pTarget : NULL);
|
||||||
|
|
||||||
|
// dynamic effect, take entry of reward Source
|
||||||
|
if (!creatureEntry)
|
||||||
|
{
|
||||||
|
if (pRewardSource)
|
||||||
|
creatureEntry = pRewardSource->GetEntry();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u called for dynamic killcredit without creature partner, skipping.", m_table, m_script->id, m_script->command);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_script->killCredit.isGroupCredit)
|
if (m_script->killCredit.isGroupCredit)
|
||||||
pPlayer->RewardPlayerAndGroupAtEvent(m_script->killCredit.creatureEntry, pSource);
|
pPlayer->RewardPlayerAndGroupAtEvent(creatureEntry, pRewardSource);
|
||||||
else
|
else
|
||||||
pPlayer->KilledMonsterCredit(m_script->killCredit.creatureEntry);
|
pPlayer->KilledMonsterCredit(creatureEntry, pRewardSource ? pRewardSource->GetObjectGuid() : ObjectGuid());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: // 9
|
||||||
{
|
{
|
||||||
GameObject* pGo = NULL;
|
GameObject* pGo = NULL;
|
||||||
uint32 time_to_despawn = m_script->respawnGo.despawnDelay < 5 ? 5 : m_script->respawnGo.despawnDelay;
|
uint32 time_to_despawn = m_script->respawnGo.despawnDelay < 5 ? 5 : m_script->respawnGo.despawnDelay;
|
||||||
|
|
@ -1257,14 +1285,14 @@ void ScriptAction::HandleScriptStep()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pGo->isSpawned())
|
if (pGo->isSpawned())
|
||||||
break; //gameobject already spawned
|
break; //gameobject already spawned
|
||||||
|
|
||||||
pGo->SetLootState(GO_READY);
|
pGo->SetLootState(GO_READY);
|
||||||
pGo->SetRespawnTime(time_to_despawn); //despawn object in ? seconds
|
pGo->SetRespawnTime(time_to_despawn); //despawn object in ? seconds
|
||||||
pGo->Refresh();
|
pGo->Refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: // 10
|
||||||
{
|
{
|
||||||
if (!pSource)
|
if (!pSource)
|
||||||
{
|
{
|
||||||
|
|
@ -1286,8 +1314,8 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
case SCRIPT_COMMAND_OPEN_DOOR: // 11
|
||||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
case SCRIPT_COMMAND_CLOSE_DOOR: // 12
|
||||||
{
|
{
|
||||||
GameObject* pDoor;
|
GameObject* pDoor;
|
||||||
uint32 time_to_reset = m_script->changeDoor.resetDelay < 15 ? 15 : m_script->changeDoor.resetDelay;
|
uint32 time_to_reset = m_script->changeDoor.resetDelay < 15 ? 15 : m_script->changeDoor.resetDelay;
|
||||||
|
|
@ -1323,7 +1351,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
if (m_script->command == SCRIPT_COMMAND_OPEN_DOOR && pDoor->GetGoState() != GO_STATE_READY ||
|
if (m_script->command == SCRIPT_COMMAND_OPEN_DOOR && pDoor->GetGoState() != GO_STATE_READY ||
|
||||||
m_script->command == SCRIPT_COMMAND_CLOSE_DOOR && pDoor->GetGoState() == GO_STATE_READY)
|
m_script->command == SCRIPT_COMMAND_CLOSE_DOOR && pDoor->GetGoState() == GO_STATE_READY)
|
||||||
break; // to be opened door already open, or to be closed door already closed
|
break; // to be opened door already open, or to be closed door already closed
|
||||||
|
|
||||||
pDoor->UseDoorOrButton(time_to_reset);
|
pDoor->UseDoorOrButton(time_to_reset);
|
||||||
|
|
||||||
|
|
@ -1332,7 +1360,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_ACTIVATE_OBJECT:
|
case SCRIPT_COMMAND_ACTIVATE_OBJECT: // 13
|
||||||
{
|
{
|
||||||
if (LogIfNotUnit(pSource))
|
if (LogIfNotUnit(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1342,7 +1370,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
((GameObject*)pTarget)->Use((Unit*)pSource);
|
((GameObject*)pTarget)->Use((Unit*)pSource);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_REMOVE_AURA:
|
case SCRIPT_COMMAND_REMOVE_AURA: // 14
|
||||||
{
|
{
|
||||||
if (LogIfNotUnit(pSource))
|
if (LogIfNotUnit(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1350,7 +1378,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
((Unit*)pSource)->RemoveAurasDueToSpell(m_script->removeAura.spellId);
|
((Unit*)pSource)->RemoveAurasDueToSpell(m_script->removeAura.spellId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CAST_SPELL:
|
case SCRIPT_COMMAND_CAST_SPELL: // 15
|
||||||
{
|
{
|
||||||
if (LogIfNotUnit(pSource))
|
if (LogIfNotUnit(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1362,7 +1390,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_PLAY_SOUND: // TODO
|
case SCRIPT_COMMAND_PLAY_SOUND: // 16 // TODO
|
||||||
{
|
{
|
||||||
if (!pSource)
|
if (!pSource)
|
||||||
{
|
{
|
||||||
|
|
@ -1398,7 +1426,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CREATE_ITEM:
|
case SCRIPT_COMMAND_CREATE_ITEM: // 17
|
||||||
{
|
{
|
||||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
|
|
@ -1409,7 +1437,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_DESPAWN_SELF:
|
case SCRIPT_COMMAND_DESPAWN_SELF: // 18
|
||||||
{
|
{
|
||||||
// TODO - Remove this check after a while
|
// TODO - Remove this check after a while
|
||||||
if (pTarget && pTarget->GetTypeId() != TYPEID_UNIT && pSource && pSource->GetTypeId() == TYPEID_UNIT)
|
if (pTarget && pTarget->GetTypeId() != TYPEID_UNIT && pSource && pSource->GetTypeId() == TYPEID_UNIT)
|
||||||
|
|
@ -1425,7 +1453,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_PLAY_MOVIE:
|
case SCRIPT_COMMAND_PLAY_MOVIE: // 19
|
||||||
{
|
{
|
||||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
|
|
@ -1435,7 +1463,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MOVEMENT:
|
case SCRIPT_COMMAND_MOVEMENT: // 20
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1458,7 +1486,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_SET_ACTIVEOBJECT:
|
case SCRIPT_COMMAND_SET_ACTIVEOBJECT: // 21
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1466,7 +1494,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
((Creature*)pSource)->SetActiveObjectState(m_script->activeObject.activate);
|
((Creature*)pSource)->SetActiveObjectState(m_script->activeObject.activate);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_SET_FACTION:
|
case SCRIPT_COMMAND_SET_FACTION: // 22
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1478,7 +1506,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL:
|
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL: // 23
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1497,7 +1525,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL:
|
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL: // 24
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1516,7 +1544,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_SET_RUN:
|
case SCRIPT_COMMAND_SET_RUN: // 25
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1525,7 +1553,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_ATTACK_START:
|
case SCRIPT_COMMAND_ATTACK_START: // 26
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1545,7 +1573,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_GO_LOCK_STATE:
|
case SCRIPT_COMMAND_GO_LOCK_STATE: // 27
|
||||||
{
|
{
|
||||||
if (LogIfNotGameObject(pSource))
|
if (LogIfNotGameObject(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1570,7 +1598,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
else if (m_script->goLockState.lockState & 0x08)
|
else if (m_script->goLockState.lockState & 0x08)
|
||||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT);
|
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT);
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_STAND_STATE:
|
case SCRIPT_COMMAND_STAND_STATE: // 28
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1579,7 +1607,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
((Unit*)pSource)->SetStandState(m_script->standState.stand_state);
|
((Unit*)pSource)->SetStandState(m_script->standState.stand_state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MODIFY_NPC_FLAGS:
|
case SCRIPT_COMMAND_MODIFY_NPC_FLAGS: // 29
|
||||||
{
|
{
|
||||||
if (LogIfNotCreature(pSource))
|
if (LogIfNotCreature(pSource))
|
||||||
break;
|
break;
|
||||||
|
|
@ -1601,7 +1629,7 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_SEND_TAXI_PATH:
|
case SCRIPT_COMMAND_SEND_TAXI_PATH: // 30
|
||||||
{
|
{
|
||||||
// only Player
|
// only Player
|
||||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,14 @@ enum ScriptCommand // resSource, resTar
|
||||||
// dataint = text entry from db_script_string -table. dataint2-4 optional for random selected texts.
|
// dataint = text entry from db_script_string -table. dataint2-4 optional for random selected texts.
|
||||||
SCRIPT_COMMAND_EMOTE = 1, // resSource = Unit, resTarget = Unit/none
|
SCRIPT_COMMAND_EMOTE = 1, // resSource = Unit, resTarget = Unit/none
|
||||||
// datalong1 = emote_id
|
// datalong1 = emote_id
|
||||||
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong3 = field_id, datalong2 = value
|
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong = field_id, datalong2 = value
|
||||||
SCRIPT_COMMAND_MOVE_TO = 3, // resSource = Creature, datalong2 = travel_speed*100, x/y/z
|
SCRIPT_COMMAND_MOVE_TO = 3, // resSource = Creature, datalong2 = travel_speed*100, x/y/z
|
||||||
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: teleport unit to position
|
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: teleport unit to position
|
||||||
SCRIPT_COMMAND_FLAG_SET = 4, // source = any, datalong3 = field_id, datalong2 = bitmask
|
SCRIPT_COMMAND_FLAG_SET = 4, // source = any, datalong = field_id, datalong2 = bitmask
|
||||||
SCRIPT_COMMAND_FLAG_REMOVE = 5, // source = any, datalong3 = field_id, datalong2 = bitmask
|
SCRIPT_COMMAND_FLAG_REMOVE = 5, // source = any, datalong = field_id, datalong2 = bitmask
|
||||||
SCRIPT_COMMAND_TELEPORT_TO = 6, // source or target with Player, datalong2 = map_id, x/y/z
|
SCRIPT_COMMAND_TELEPORT_TO = 6, // source or target with Player, datalong2 = map_id, x/y/z
|
||||||
SCRIPT_COMMAND_QUEST_EXPLORED = 7, // one from source or target must be Player, another GO/Creature, datalong3=quest_id, datalong2=distance or 0
|
SCRIPT_COMMAND_QUEST_EXPLORED = 7, // one from source or target must be Player, another GO/Creature, datalong=quest_id, datalong2=distance or 0
|
||||||
SCRIPT_COMMAND_KILL_CREDIT = 8, // source or target with Player, datalong3 = creature entry, datalong2 = bool (0=personal credit, 1=group credit)
|
SCRIPT_COMMAND_KILL_CREDIT = 8, // source or target with Player, datalong = creature entry (or 0 for target-entry), datalong2 = bool (0=personal credit, 1=group credit)
|
||||||
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any, datalong=db_guid, datalong2=despawn_delay
|
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any, datalong=db_guid, datalong2=despawn_delay
|
||||||
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any, datalong=creature entry, datalong2=despawn_delay
|
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any, datalong=creature entry, datalong2=despawn_delay
|
||||||
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = summon active
|
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = summon active
|
||||||
|
|
@ -67,7 +67,7 @@ enum ScriptCommand // resSource, resTar
|
||||||
// datalong=spellid
|
// datalong=spellid
|
||||||
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = cast triggered
|
// data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = cast triggered
|
||||||
SCRIPT_COMMAND_PLAY_SOUND = 16, // resSource = WorldObject, target=any/player, datalong (sound_id), datalong2 (bitmask: 0/1=anyone/target, 0/2=with distance dependent, so 1|2 = 3 is target with distance dependent)
|
SCRIPT_COMMAND_PLAY_SOUND = 16, // resSource = WorldObject, target=any/player, datalong (sound_id), datalong2 (bitmask: 0/1=anyone/target, 0/2=with distance dependent, so 1|2 = 3 is target with distance dependent)
|
||||||
SCRIPT_COMMAND_CREATE_ITEM = 17, // source or target must be player, datalong3 = item entry, datalong2 = amount
|
SCRIPT_COMMAND_CREATE_ITEM = 17, // source or target must be player, datalong = item entry, datalong2 = amount
|
||||||
SCRIPT_COMMAND_DESPAWN_SELF = 18, // resSource = Creature, datalong = despawn delay
|
SCRIPT_COMMAND_DESPAWN_SELF = 18, // resSource = Creature, datalong = despawn delay
|
||||||
SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id
|
SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id
|
||||||
SCRIPT_COMMAND_MOVEMENT = 20, // resSource = Creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)
|
SCRIPT_COMMAND_MOVEMENT = 20, // resSource = Creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11989"
|
#define REVISION_NR "11990"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue