mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[10496] Re-work struct ScriptInfo and use union for data fields.
Enumerate SCRIPT_COMMAND_* and move it away from world.h Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
1753942154
commit
cb877e1281
5 changed files with 319 additions and 179 deletions
148
src/game/Map.cpp
148
src/game/Map.cpp
|
|
@ -2223,26 +2223,26 @@ void Map::ScriptsProcess()
|
||||||
// flag_buddy_as_target 0x04
|
// flag_buddy_as_target 0x04
|
||||||
|
|
||||||
// If target is player (and not already the source) but should be the source
|
// If target is player (and not already the source) but should be the source
|
||||||
if (target && target->GetTypeId() == TYPEID_PLAYER && step.script->data_flags & 0x01)
|
if (target && target->GetTypeId() == TYPEID_PLAYER && step.script->talk.flags & 0x01)
|
||||||
{
|
{
|
||||||
if (source->GetTypeId() != TYPEID_PLAYER)
|
if (source->GetTypeId() != TYPEID_PLAYER)
|
||||||
pSource = (WorldObject*)target;
|
pSource = (WorldObject*)target;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If step has a buddy entry defined, search for it.
|
// If step has a buddy entry defined, search for it.
|
||||||
if (step.script->datalong2)
|
if (step.script->talk.creatureEntry)
|
||||||
{
|
{
|
||||||
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->datalong2, true, step.script->datalong3);
|
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->talk.creatureEntry, true, step.script->talk.searchRadius);
|
||||||
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pBuddy, u_check);
|
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pBuddy, u_check);
|
||||||
|
|
||||||
Cell::VisitGridObjects(pSource, searcher, step.script->datalong3);
|
Cell::VisitGridObjects(pSource, searcher, step.script->talk.searchRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If buddy found, then use it
|
// If buddy found, then use it
|
||||||
if (pBuddy)
|
if (pBuddy)
|
||||||
{
|
{
|
||||||
// pBuddy can be target of talk
|
// pBuddy can be target of talk
|
||||||
if (step.script->data_flags & 0x04)
|
if (step.script->talk.flags & 0x04)
|
||||||
{
|
{
|
||||||
target = (Object*)pBuddy;
|
target = (Object*)pBuddy;
|
||||||
}
|
}
|
||||||
|
|
@ -2250,49 +2250,49 @@ void Map::ScriptsProcess()
|
||||||
{
|
{
|
||||||
// If not target of talk, then set pBuddy as source
|
// If not target of talk, then set pBuddy as source
|
||||||
// Useless when source is already flagged to be player, and should maybe produce error.
|
// Useless when source is already flagged to be player, and should maybe produce error.
|
||||||
if (!(step.script->data_flags & 0x01))
|
if (!(step.script->talk.flags & 0x01))
|
||||||
pSource = (WorldObject*)pBuddy;
|
pSource = (WorldObject*)pBuddy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we should talk to the original source instead of target
|
// If we should talk to the original source instead of target
|
||||||
if (step.script->data_flags & 0x02)
|
if (step.script->talk.flags & 0x02)
|
||||||
target = source;
|
target = source;
|
||||||
|
|
||||||
uint64 unit_target = target ? target->GetGUID() : 0;
|
uint64 unit_target = target ? target->GetGUID() : 0;
|
||||||
|
|
||||||
switch(step.script->datalong)
|
switch(step.script->talk.chatType)
|
||||||
{
|
{
|
||||||
case CHAT_TYPE_SAY:
|
case CHAT_TYPE_SAY:
|
||||||
pSource->MonsterSay(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
pSource->MonsterSay(step.script->talk.textId, LANG_UNIVERSAL, unit_target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_YELL:
|
case CHAT_TYPE_YELL:
|
||||||
pSource->MonsterYell(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
pSource->MonsterYell(step.script->talk.textId, LANG_UNIVERSAL, unit_target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_TEXT_EMOTE:
|
case CHAT_TYPE_TEXT_EMOTE:
|
||||||
pSource->MonsterTextEmote(step.script->dataint, unit_target);
|
pSource->MonsterTextEmote(step.script->talk.textId, unit_target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_BOSS_EMOTE:
|
case CHAT_TYPE_BOSS_EMOTE:
|
||||||
pSource->MonsterTextEmote(step.script->dataint, unit_target, true);
|
pSource->MonsterTextEmote(step.script->talk.textId, unit_target, true);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_WHISPER:
|
case CHAT_TYPE_WHISPER:
|
||||||
if (!unit_target || !IS_PLAYER_GUID(unit_target))
|
if (!unit_target || !IS_PLAYER_GUID(unit_target))
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid or non-player, skipping.", step.script->id, step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid or non-player, skipping.", step.script->id, step.script->talk.chatType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pSource->MonsterWhisper(step.script->dataint, unit_target);
|
pSource->MonsterWhisper(step.script->talk.textId, unit_target);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_BOSS_WHISPER:
|
case CHAT_TYPE_BOSS_WHISPER:
|
||||||
if (!unit_target || !IS_PLAYER_GUID(unit_target))
|
if (!unit_target || !IS_PLAYER_GUID(unit_target))
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid or non-player, skipping.", step.script->id, step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid or non-player, skipping.", step.script->id, step.script->talk.chatType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pSource->MonsterWhisper(step.script->dataint, unit_target, true);
|
pSource->MonsterWhisper(step.script->talk.textId, unit_target, true);
|
||||||
break;
|
break;
|
||||||
case CHAT_TYPE_ZONE_YELL:
|
case CHAT_TYPE_ZONE_YELL:
|
||||||
pSource->MonsterYellToZone(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
pSource->MonsterYellToZone(step.script->talk.textId, LANG_UNIVERSAL, unit_target);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break; // must be already checked at load
|
break; // must be already checked at load
|
||||||
|
|
@ -2312,7 +2312,7 @@ void Map::ScriptsProcess()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
((Creature *)source)->HandleEmote(step.script->datalong);
|
((Creature *)source)->HandleEmote(step.script->emote.emoteId);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_FIELD_SET:
|
case SCRIPT_COMMAND_FIELD_SET:
|
||||||
if (!source)
|
if (!source)
|
||||||
|
|
@ -2321,14 +2321,14 @@ void Map::ScriptsProcess()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
|
if (step.script->setField.fieldId <= OBJECT_FIELD_ENTRY || step.script->setField.fieldId >= source->GetValuesCount())
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_FIELD_SET (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).",
|
sLog.outError("SCRIPT_COMMAND_FIELD_SET (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).",
|
||||||
step.script->id, step.script->datalong, source->GetValuesCount(), source->GetTypeId());
|
step.script->id, step.script->setField.fieldId, source->GetValuesCount(), source->GetTypeId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
source->SetUInt32Value(step.script->datalong, step.script->datalong2);
|
source->SetUInt32Value(step.script->setField.fieldId, step.script->setField.fieldValue);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_MOVE_TO:
|
case SCRIPT_COMMAND_MOVE_TO:
|
||||||
if (!source)
|
if (!source)
|
||||||
|
|
@ -2343,7 +2343,7 @@ void Map::ScriptsProcess()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
((Unit*)source)->MonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2 );
|
((Unit*)source)->MonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->moveTo.travelTime);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_FLAG_SET:
|
case SCRIPT_COMMAND_FLAG_SET:
|
||||||
if (!source)
|
if (!source)
|
||||||
|
|
@ -2351,14 +2351,14 @@ void Map::ScriptsProcess()
|
||||||
sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id %u) call for NULL object.", step.script->id);
|
sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id %u) call for NULL object.", step.script->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
|
if (step.script->setFlag.fieldId <= OBJECT_FIELD_ENTRY || step.script->setFlag.fieldId >= source->GetValuesCount())
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).",
|
sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).",
|
||||||
step.script->id, step.script->datalong, source->GetValuesCount(), source->GetTypeId());
|
step.script->id, step.script->setFlag.fieldId, source->GetValuesCount(), source->GetTypeId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
source->SetFlag(step.script->datalong, step.script->datalong2);
|
source->SetFlag(step.script->setFlag.fieldId, step.script->setFlag.fieldValue);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_FLAG_REMOVE:
|
case SCRIPT_COMMAND_FLAG_REMOVE:
|
||||||
if (!source)
|
if (!source)
|
||||||
|
|
@ -2366,14 +2366,14 @@ void Map::ScriptsProcess()
|
||||||
sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id %u) call for NULL object.", step.script->id);
|
sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id %u) call for NULL object.", step.script->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount())
|
if (step.script->removeFlag.fieldId <= OBJECT_FIELD_ENTRY || step.script->removeFlag.fieldId >= source->GetValuesCount())
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).",
|
sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).",
|
||||||
step.script->id, step.script->datalong, source->GetValuesCount(), source->GetTypeId());
|
step.script->id, step.script->removeFlag.fieldId, source->GetValuesCount(), source->GetTypeId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
source->RemoveFlag(step.script->datalong, step.script->datalong2);
|
source->RemoveFlag(step.script->removeFlag.fieldId, step.script->removeFlag.fieldValue);
|
||||||
break;
|
break;
|
||||||
case SCRIPT_COMMAND_TELEPORT_TO:
|
case SCRIPT_COMMAND_TELEPORT_TO:
|
||||||
{
|
{
|
||||||
|
|
@ -2393,7 +2393,7 @@ void Map::ScriptsProcess()
|
||||||
|
|
||||||
Player* pSource = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
Player* pSource = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
||||||
|
|
||||||
pSource->TeleportTo(step.script->datalong, step.script->x, step.script->y, step.script->z, step.script->o);
|
pSource->TeleportTo(step.script->teleportTo.mapId, step.script->x, step.script->y, step.script->z, step.script->o);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
case SCRIPT_COMMAND_KILL_CREDIT:
|
||||||
|
|
@ -2414,20 +2414,20 @@ void Map::ScriptsProcess()
|
||||||
|
|
||||||
Player* pSource = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
Player* pSource = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
||||||
|
|
||||||
if (step.script->datalong2)
|
if (step.script->killCredit.isGroupCredit)
|
||||||
{
|
{
|
||||||
pSource->RewardPlayerAndGroupAtEvent(step.script->datalong, pSource);
|
pSource->RewardPlayerAndGroupAtEvent(step.script->killCredit.creatureEntry, pSource);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pSource->KilledMonsterCredit(step.script->datalong);
|
pSource->KilledMonsterCredit(step.script->killCredit.creatureEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
||||||
{
|
{
|
||||||
if (!step.script->datalong) // creature not specified
|
if (!step.script->summonCreature.creatureEntry)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for NULL creature.", step.script->id);
|
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for NULL creature.", step.script->id);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2452,10 +2452,10 @@ void Map::ScriptsProcess()
|
||||||
float z = step.script->z;
|
float z = step.script->z;
|
||||||
float o = step.script->o;
|
float o = step.script->o;
|
||||||
|
|
||||||
Creature* pCreature = summoner->SummonCreature(step.script->datalong, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->datalong2);
|
Creature* pCreature = summoner->SummonCreature(step.script->summonCreature.creatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->summonCreature.despawnDelay);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON (script id %u) failed for creature (entry: %u).", step.script->id, step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON (script id %u) failed for creature (entry: %u).", step.script->id, step.script->summonCreature.creatureEntry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2463,7 +2463,7 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
if (!step.script->datalong) // gameobject not specified
|
if (!step.script->respawnGo.goGuid) // gameobject not specified
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) call for NULL gameobject.", step.script->id);
|
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) call for NULL gameobject.", step.script->id);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2484,15 +2484,15 @@ void Map::ScriptsProcess()
|
||||||
WorldObject* summoner = (WorldObject*)source;
|
WorldObject* summoner = (WorldObject*)source;
|
||||||
|
|
||||||
GameObject *go = NULL;
|
GameObject *go = NULL;
|
||||||
int32 time_to_despawn = step.script->datalong2<5 ? 5 : (int32)step.script->datalong2;
|
int32 time_to_despawn = step.script->respawnGo.despawnDelay < 5 ? 5 : step.script->respawnGo.despawnDelay;
|
||||||
|
|
||||||
MaNGOS::GameObjectWithDbGUIDCheck go_check(*summoner,step.script->datalong);
|
MaNGOS::GameObjectWithDbGUIDCheck go_check(*summoner, step.script->respawnGo.goGuid);
|
||||||
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(summoner, go, go_check);
|
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(summoner, go, go_check);
|
||||||
Cell::VisitGridObjects(summoner, checker, GetVisibilityDistance());
|
Cell::VisitGridObjects(summoner, checker, GetVisibilityDistance());
|
||||||
|
|
||||||
if (!go)
|
if (!go)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->respawnGo.goGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2501,7 +2501,7 @@ void Map::ScriptsProcess()
|
||||||
go->GetGoType()==GAMEOBJECT_TYPE_BUTTON ||
|
go->GetGoType()==GAMEOBJECT_TYPE_BUTTON ||
|
||||||
go->GetGoType()==GAMEOBJECT_TYPE_TRAP)
|
go->GetGoType()==GAMEOBJECT_TYPE_TRAP)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) can not be used with gameobject of type %u (guid: %u).", step.script->id, uint32(go->GetGoType()), step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) can not be used with gameobject of type %u (guid: %u).", step.script->id, uint32(go->GetGoType()), step.script->respawnGo.goGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2516,7 +2516,7 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
case SCRIPT_COMMAND_OPEN_DOOR:
|
||||||
{
|
{
|
||||||
if (!step.script->datalong) // door not specified
|
if (!step.script->openDoor.goGuid) // door not specified
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) call for NULL door.", step.script->id);
|
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) call for NULL door.", step.script->id);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2537,15 +2537,15 @@ void Map::ScriptsProcess()
|
||||||
Unit* caster = (Unit*)source;
|
Unit* caster = (Unit*)source;
|
||||||
|
|
||||||
GameObject *door = NULL;
|
GameObject *door = NULL;
|
||||||
int32 time_to_close = step.script->datalong2 < 15 ? 15 : (int32)step.script->datalong2;
|
int32 time_to_close = step.script->openDoor.resetDelay < 15 ? 15 : step.script->openDoor.resetDelay;
|
||||||
|
|
||||||
MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster, step.script->datalong);
|
MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster, step.script->openDoor.goGuid);
|
||||||
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(caster, door, go_check);
|
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(caster, door, go_check);
|
||||||
Cell::VisitGridObjects(caster, checker, GetVisibilityDistance());
|
Cell::VisitGridObjects(caster, checker, GetVisibilityDistance());
|
||||||
|
|
||||||
if (!door)
|
if (!door)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->openDoor.goGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2567,7 +2567,7 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
case SCRIPT_COMMAND_CLOSE_DOOR:
|
||||||
{
|
{
|
||||||
if (!step.script->datalong) // guid for door not specified
|
if (!step.script->closeDoor.goGuid) // guid for door not specified
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) call for NULL door.", step.script->id);
|
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) call for NULL door.", step.script->id);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2588,15 +2588,15 @@ void Map::ScriptsProcess()
|
||||||
Unit* caster = (Unit*)source;
|
Unit* caster = (Unit*)source;
|
||||||
|
|
||||||
GameObject *door = NULL;
|
GameObject *door = NULL;
|
||||||
int32 time_to_open = step.script->datalong2 < 15 ? 15 : (int32)step.script->datalong2;
|
int32 time_to_open = step.script->closeDoor.resetDelay < 15 ? 15 : step.script->closeDoor.resetDelay;
|
||||||
|
|
||||||
MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster, step.script->datalong);
|
MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster, step.script->closeDoor.goGuid);
|
||||||
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(caster, door, go_check);
|
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectWithDbGUIDCheck> checker(caster, door, go_check);
|
||||||
Cell::VisitGridObjects(caster, checker, GetVisibilityDistance());
|
Cell::VisitGridObjects(caster, checker, GetVisibilityDistance());
|
||||||
|
|
||||||
if (!door)
|
if (!door)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->datalong);
|
sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->closeDoor.goGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR)
|
if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR)
|
||||||
|
|
@ -2664,10 +2664,10 @@ void Map::ScriptsProcess()
|
||||||
|
|
||||||
// quest id and flags checked at script loading
|
// quest id and flags checked at script loading
|
||||||
if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
|
if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
|
||||||
(step.script->datalong2 == 0 || worldObject->IsWithinDistInMap(player, float(step.script->datalong2))))
|
(step.script->questExplored.distance == 0 || worldObject->IsWithinDistInMap(player, float(step.script->questExplored.distance))))
|
||||||
player->AreaExploredOrEventHappens(step.script->datalong);
|
player->AreaExploredOrEventHappens(step.script->questExplored.questId);
|
||||||
else
|
else
|
||||||
player->FailQuest(step.script->datalong);
|
player->FailQuest(step.script->questExplored.questId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2706,21 +2706,21 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_REMOVE_AURA:
|
case SCRIPT_COMMAND_REMOVE_AURA:
|
||||||
{
|
{
|
||||||
Object* cmdTarget = step.script->datalong2 ? source : target;
|
Object* cmdTarget = step.script->removeAura.isSourceTarget ? source : target;
|
||||||
|
|
||||||
if (!cmdTarget)
|
if (!cmdTarget)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_REMOVE_AURA (script id %u) call for NULL %s.", step.script->id, step.script->datalong2 ? "source" : "target");
|
sLog.outError("SCRIPT_COMMAND_REMOVE_AURA (script id %u) call for NULL %s.", step.script->id, step.script->removeAura.isSourceTarget ? "source" : "target");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmdTarget->isType(TYPEMASK_UNIT))
|
if (!cmdTarget->isType(TYPEMASK_UNIT))
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_REMOVE_AURA (script id %u) %s isn't unit (TypeId: %u), skipping.", step.script->id, step.script->datalong2 ? "source" : "target",cmdTarget->GetTypeId());
|
sLog.outError("SCRIPT_COMMAND_REMOVE_AURA (script id %u) %s isn't unit (TypeId: %u), skipping.", step.script->id, step.script->removeAura.isSourceTarget ? "source" : "target",cmdTarget->GetTypeId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
((Unit*)cmdTarget)->RemoveAurasDueToSpell(step.script->datalong);
|
((Unit*)cmdTarget)->RemoveAurasDueToSpell(step.script->removeAura.spellId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CAST_SPELL:
|
case SCRIPT_COMMAND_CAST_SPELL:
|
||||||
|
|
@ -2731,40 +2731,40 @@ void Map::ScriptsProcess()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object* cmdTarget = step.script->datalong2 & 0x01 ? source : target;
|
Object* cmdTarget = step.script->castSpell.flags & 0x01 ? source : target;
|
||||||
|
|
||||||
if (!cmdTarget)
|
if (!cmdTarget)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) call for NULL %s.", step.script->id, step.script->datalong2 & 0x01 ? "source" : "target");
|
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) call for NULL %s.", step.script->id, step.script->castSpell.flags & 0x01 ? "source" : "target");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmdTarget->isType(TYPEMASK_UNIT))
|
if (!cmdTarget->isType(TYPEMASK_UNIT))
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) %s isn't unit (TypeId: %u), skipping.", step.script->id, step.script->datalong2 & 0x01 ? "source" : "target",cmdTarget->GetTypeId());
|
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) %s isn't unit (TypeId: %u), skipping.", step.script->id, step.script->castSpell.flags & 0x01 ? "source" : "target", cmdTarget->GetTypeId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* spellTarget = (Unit*)cmdTarget;
|
Unit* spellTarget = (Unit*)cmdTarget;
|
||||||
|
|
||||||
Object* cmdSource = step.script->datalong2 & 0x02 ? target : source;
|
Object* cmdSource = step.script->castSpell.flags & 0x02 ? target : source;
|
||||||
|
|
||||||
if (!cmdSource)
|
if (!cmdSource)
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) call for NULL %s.", step.script->id, step.script->datalong2 & 0x02 ? "target" : "source");
|
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) call for NULL %s.", step.script->id, step.script->castSpell.flags & 0x02 ? "target" : "source");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmdSource->isType(TYPEMASK_UNIT))
|
if (!cmdSource->isType(TYPEMASK_UNIT))
|
||||||
{
|
{
|
||||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) %s isn't unit (TypeId: %u), skipping.", step.script->id, step.script->datalong2 & 0x02 ? "target" : "source", cmdSource->GetTypeId());
|
sLog.outError("SCRIPT_COMMAND_CAST_SPELL (script id %u) %s isn't unit (TypeId: %u), skipping.", step.script->id, step.script->castSpell.flags & 0x02 ? "target" : "source", cmdSource->GetTypeId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* spellSource = (Unit*)cmdSource;
|
Unit* spellSource = (Unit*)cmdSource;
|
||||||
|
|
||||||
//TODO: when GO cast implemented, code below must be updated accordingly to also allow GO spell cast
|
//TODO: when GO cast implemented, code below must be updated accordingly to also allow GO spell cast
|
||||||
spellSource->CastSpell(spellTarget,step.script->datalong,false);
|
spellSource->CastSpell(spellTarget, step.script->castSpell.spellId, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2787,7 +2787,7 @@ void Map::ScriptsProcess()
|
||||||
// bitmask: 0/1=anyone/target, 0/2=with distance dependent
|
// bitmask: 0/1=anyone/target, 0/2=with distance dependent
|
||||||
Player* pTarget = NULL;
|
Player* pTarget = NULL;
|
||||||
|
|
||||||
if (step.script->datalong2 & 1)
|
if (step.script->playSound.flags & 1)
|
||||||
{
|
{
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
|
|
@ -2805,10 +2805,10 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
|
|
||||||
// bitmask: 0/1=anyone/target, 0/2=with distance dependent
|
// bitmask: 0/1=anyone/target, 0/2=with distance dependent
|
||||||
if (step.script->datalong2 & 2)
|
if (step.script->playSound.flags & 2)
|
||||||
pSource->PlayDistanceSound(step.script->datalong, pTarget);
|
pSource->PlayDistanceSound(step.script->playSound.soundId, pTarget);
|
||||||
else
|
else
|
||||||
pSource->PlayDirectSound(step.script->datalong, pTarget);
|
pSource->PlayDirectSound(step.script->playSound.soundId, pTarget);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2829,8 +2829,8 @@ void Map::ScriptsProcess()
|
||||||
|
|
||||||
Player* pReceiver = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
Player* pReceiver = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
||||||
|
|
||||||
if (Item* pItem = pReceiver->StoreNewItemInInventorySlot(step.script->datalong, step.script->datalong2))
|
if (Item* pItem = pReceiver->StoreNewItemInInventorySlot(step.script->createItem.itemEntry, step.script->createItem.amount))
|
||||||
pReceiver->SendNewItem(pItem, step.script->datalong2, true, false);
|
pReceiver->SendNewItem(pItem, step.script->createItem.amount, true, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2851,7 +2851,7 @@ void Map::ScriptsProcess()
|
||||||
|
|
||||||
Creature* pCreature = target && target->GetTypeId() == TYPEID_UNIT ? (Creature*)target : (Creature*)source;
|
Creature* pCreature = target && target->GetTypeId() == TYPEID_UNIT ? (Creature*)target : (Creature*)source;
|
||||||
|
|
||||||
pCreature->ForcedDespawn(step.script->datalong);
|
pCreature->ForcedDespawn(step.script->despawn.despawnDelay);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2872,7 +2872,7 @@ void Map::ScriptsProcess()
|
||||||
|
|
||||||
Player* pReceiver = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
Player* pReceiver = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source;
|
||||||
|
|
||||||
pReceiver->SendMovieStart(step.script->datalong);
|
pReceiver->SendMovieStart(step.script->playMovie.movieId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2893,7 +2893,7 @@ void Map::ScriptsProcess()
|
||||||
WorldObject* pSource = (WorldObject*)source;
|
WorldObject* pSource = (WorldObject*)source;
|
||||||
Creature* pMover = NULL;
|
Creature* pMover = NULL;
|
||||||
|
|
||||||
if (!step.script->datalong2) // No buddy defined, so try use source (or target where source is player)
|
if (!step.script->movement.creatureEntry) // No buddy defined, so try use source (or target where source is player)
|
||||||
{
|
{
|
||||||
if (pSource->GetTypeId() != TYPEID_UNIT)
|
if (pSource->GetTypeId() != TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
|
|
@ -2906,10 +2906,10 @@ void Map::ScriptsProcess()
|
||||||
}
|
}
|
||||||
else // If step has a buddy entry defined, search for it
|
else // If step has a buddy entry defined, search for it
|
||||||
{
|
{
|
||||||
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->datalong2, true, step.script->datalong3);
|
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSource, step.script->movement.creatureEntry, true, step.script->movement.searchRadius);
|
||||||
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pMover, u_check);
|
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pMover, u_check);
|
||||||
|
|
||||||
Cell::VisitGridObjects(pSource, searcher, step.script->datalong3);
|
Cell::VisitGridObjects(pSource, searcher, step.script->movement.searchRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pMover)
|
if (!pMover)
|
||||||
|
|
@ -2921,7 +2921,7 @@ void Map::ScriptsProcess()
|
||||||
// Consider add additional checks for cases where creature should not change movementType
|
// Consider add additional checks for cases where creature should not change movementType
|
||||||
// (pet? in combat? already using same MMgen as script try to apply?)
|
// (pet? in combat? already using same MMgen as script try to apply?)
|
||||||
|
|
||||||
switch(step.script->datalong)
|
switch(step.script->movement.movementType)
|
||||||
{
|
{
|
||||||
case IDLE_MOTION_TYPE:
|
case IDLE_MOTION_TYPE:
|
||||||
pMover->GetMotionMaster()->MoveIdle();
|
pMover->GetMotionMaster()->MoveIdle();
|
||||||
|
|
|
||||||
|
|
@ -4408,12 +4408,12 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
tmp.id = fields[0].GetUInt32();
|
tmp.id = fields[0].GetUInt32();
|
||||||
tmp.delay = fields[1].GetUInt32();
|
tmp.delay = fields[1].GetUInt32();
|
||||||
tmp.command = fields[2].GetUInt32();
|
tmp.command = fields[2].GetUInt32();
|
||||||
tmp.datalong = fields[3].GetUInt32();
|
tmp.raw.data[0] = fields[3].GetUInt32();
|
||||||
tmp.datalong2 = fields[4].GetUInt32();
|
tmp.raw.data[1] = fields[4].GetUInt32();
|
||||||
tmp.datalong3 = fields[5].GetUInt32();
|
tmp.raw.data[2] = fields[5].GetUInt32();
|
||||||
tmp.datalong4 = fields[6].GetUInt32();
|
tmp.raw.data[3] = fields[6].GetUInt32();
|
||||||
tmp.data_flags = fields[7].GetUInt32();
|
tmp.raw.data[4] = fields[7].GetUInt32();
|
||||||
tmp.dataint = fields[8].GetInt32();
|
tmp.raw.data[5] = fields[8].GetInt32();
|
||||||
tmp.x = fields[9].GetFloat();
|
tmp.x = fields[9].GetFloat();
|
||||||
tmp.y = fields[10].GetFloat();
|
tmp.y = fields[10].GetFloat();
|
||||||
tmp.z = fields[11].GetFloat();
|
tmp.z = fields[11].GetFloat();
|
||||||
|
|
@ -4424,29 +4424,29 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
{
|
{
|
||||||
case SCRIPT_COMMAND_TALK:
|
case SCRIPT_COMMAND_TALK:
|
||||||
{
|
{
|
||||||
if (tmp.datalong > CHAT_TYPE_ZONE_YELL)
|
if (tmp.talk.chatType > CHAT_TYPE_ZONE_YELL)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.datalong, tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.talk.chatType, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmp.datalong2 && !GetCreatureTemplate(tmp.datalong2))
|
if (tmp.talk.creatureEntry && !GetCreatureTemplate(tmp.talk.creatureEntry))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but this creature_template does not exist.", tablename, tmp.datalong2, tmp.id);
|
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but this creature_template does not exist.", tablename, tmp.talk.creatureEntry, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmp.datalong2 && !tmp.datalong3)
|
if (tmp.talk.creatureEntry && !tmp.talk.searchRadius)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.datalong2, tmp.id, tmp.datalong3);
|
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_TALK for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.talk.creatureEntry, tmp.id, tmp.talk.searchRadius);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmp.dataint == 0)
|
if (tmp.talk.textId == 0)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.dataint, tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.talk.textId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmp.dataint < MIN_DB_SCRIPT_STRING_ID || tmp.dataint >= MAX_DB_SCRIPT_STRING_ID)
|
if (tmp.talk.textId < MIN_DB_SCRIPT_STRING_ID || tmp.talk.textId >= MAX_DB_SCRIPT_STRING_ID)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.dataint, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id);
|
sLog.outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", tablename, tmp.talk.textId, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4456,9 +4456,9 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
|
|
||||||
case SCRIPT_COMMAND_EMOTE:
|
case SCRIPT_COMMAND_EMOTE:
|
||||||
{
|
{
|
||||||
if(!sEmotesStore.LookupEntry(tmp.datalong))
|
if (!sEmotesStore.LookupEntry(tmp.emote.emoteId))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",tablename,tmp.datalong,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tablename, tmp.emote.emoteId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -4466,15 +4466,15 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
|
|
||||||
case SCRIPT_COMMAND_TELEPORT_TO:
|
case SCRIPT_COMMAND_TELEPORT_TO:
|
||||||
{
|
{
|
||||||
if(!sMapStore.LookupEntry(tmp.datalong))
|
if (!sMapStore.LookupEntry(tmp.teleportTo.mapId))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",tablename,tmp.datalong,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tablename, tmp.teleportTo.mapId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
|
if (!MaNGOS::IsValidMapCoord(tmp.x, tmp.y, tmp.z, tmp.o))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",tablename,tmp.x,tmp.y,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tablename, tmp.x, tmp.y, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -4482,9 +4482,9 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
|
|
||||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
case SCRIPT_COMMAND_KILL_CREDIT:
|
||||||
{
|
{
|
||||||
if (!GetCreatureTemplate(tmp.datalong))
|
if (!GetCreatureTemplate(tmp.killCredit.creatureEntry))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",tablename,tmp.datalong,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;
|
||||||
|
|
@ -4492,15 +4492,15 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
|
|
||||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
||||||
{
|
{
|
||||||
if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
|
if (!MaNGOS::IsValidMapCoord(tmp.x, tmp.y, tmp.z, tmp.o))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",tablename,tmp.x,tmp.y,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tablename, tmp.x, tmp.y, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!GetCreatureTemplate(tmp.datalong))
|
if (!GetCreatureTemplate(tmp.summonCreature.creatureEntry))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",tablename,tmp.datalong,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tablename, tmp.summonCreature.creatureEntry, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -4508,17 +4508,17 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
|
|
||||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
GameObjectData const* data = GetGOData(tmp.datalong);
|
GameObjectData const* data = GetGOData(tmp.GetGOGuid());
|
||||||
if(!data)
|
if(!data)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",tablename,tmp.datalong,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, tmp.GetGOGuid(), tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
||||||
if(!info)
|
if(!info)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",tablename,tmp.datalong,data->id,tmp.id);
|
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, tmp.GetGOGuid(), data->id, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4528,7 +4528,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
info->type==GAMEOBJECT_TYPE_BUTTON ||
|
info->type==GAMEOBJECT_TYPE_BUTTON ||
|
||||||
info->type==GAMEOBJECT_TYPE_TRAP )
|
info->type==GAMEOBJECT_TYPE_TRAP )
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",tablename,info->id,tmp.id);
|
sLog.outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, info->id, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -4536,23 +4536,23 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
case SCRIPT_COMMAND_OPEN_DOOR:
|
||||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
case SCRIPT_COMMAND_CLOSE_DOOR:
|
||||||
{
|
{
|
||||||
GameObjectData const* data = GetGOData(tmp.datalong);
|
GameObjectData const* data = GetGOData(tmp.GetGOGuid());
|
||||||
if(!data)
|
if(!data)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",tablename,tmp.datalong,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", tablename, tmp.GetGOGuid(), (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
||||||
if(!info)
|
if(!info)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",tablename,tmp.datalong,data->id,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id);
|
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", tablename, tmp.GetGOGuid(), data->id, (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( info->type!=GAMEOBJECT_TYPE_DOOR)
|
if( info->type!=GAMEOBJECT_TYPE_DOOR)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u",tablename,info->id,(tmp.command==SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"),tmp.id);
|
sLog.outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", tablename, info->id, (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4560,16 +4560,16 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
||||||
{
|
{
|
||||||
Quest const* quest = GetQuestTemplate(tmp.datalong);
|
Quest const* quest = GetQuestTemplate(tmp.questExplored.questId);
|
||||||
if(!quest)
|
if(!quest)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",tablename,tmp.datalong,tmp.id);
|
sLog.outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tablename, tmp.questExplored.questId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",tablename,tmp.datalong,tmp.id);
|
sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tablename, tmp.questExplored.questId, tmp.id);
|
||||||
|
|
||||||
// this will prevent quest completing without objective
|
// this will prevent quest completing without objective
|
||||||
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
|
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
|
||||||
|
|
@ -4577,24 +4577,24 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
// continue; - quest objective requirement set and command can be allowed
|
// continue; - quest objective requirement set and command can be allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
if(float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE)
|
if (float(tmp.questExplored.distance) > DEFAULT_VISIBILITY_DISTANCE)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
|
sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
|
||||||
tablename,tmp.datalong2,tmp.id);
|
tablename, tmp.questExplored.distance, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tmp.datalong2 && float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE)
|
if (tmp.questExplored.distance && float(tmp.questExplored.distance) > DEFAULT_VISIBILITY_DISTANCE)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
|
sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
|
||||||
tablename,tmp.datalong2,tmp.id,DEFAULT_VISIBILITY_DISTANCE);
|
tablename, tmp.questExplored.distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tmp.datalong2 && float(tmp.datalong2) < INTERACTION_DISTANCE)
|
if (tmp.questExplored.distance && float(tmp.questExplored.distance) < INTERACTION_DISTANCE)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
|
sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
|
||||||
tablename,tmp.datalong2,tmp.id,INTERACTION_DISTANCE);
|
tablename, tmp.questExplored.distance, tmp.id, INTERACTION_DISTANCE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4603,48 +4603,48 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
|
|
||||||
case SCRIPT_COMMAND_REMOVE_AURA:
|
case SCRIPT_COMMAND_REMOVE_AURA:
|
||||||
{
|
{
|
||||||
if(!sSpellStore.LookupEntry(tmp.datalong))
|
if (!sSpellStore.LookupEntry(tmp.removeAura.spellId))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||||
tablename,tmp.datalong,tmp.id);
|
tablename, tmp.removeAura.spellId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(tmp.datalong2 & ~0x1) // 1 bits (0,1)
|
if (tmp.removeAura.isSourceTarget & ~0x1) // 1 bits (0,1)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||||
tablename,tmp.datalong2,tmp.id);
|
tablename, tmp.removeAura.isSourceTarget, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CAST_SPELL:
|
case SCRIPT_COMMAND_CAST_SPELL:
|
||||||
{
|
{
|
||||||
if(!sSpellStore.LookupEntry(tmp.datalong))
|
if (!sSpellStore.LookupEntry(tmp.castSpell.spellId))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||||
tablename,tmp.datalong,tmp.id);
|
tablename, tmp.castSpell.spellId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(tmp.datalong2 & ~0x3) // 2 bits
|
if (tmp.castSpell.flags & ~0x3) // 2 bits
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
sLog.outErrorDb("Table `%s` using unknown flags in datalong2 (%u)i n SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||||
tablename,tmp.datalong2,tmp.id);
|
tablename, tmp.castSpell.flags, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_CREATE_ITEM:
|
case SCRIPT_COMMAND_CREATE_ITEM:
|
||||||
{
|
{
|
||||||
if (!GetItemPrototype(tmp.datalong))
|
if (!GetItemPrototype(tmp.createItem.itemEntry))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
|
sLog.outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
|
||||||
tablename, tmp.datalong, tmp.id);
|
tablename, tmp.createItem.itemEntry, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!tmp.datalong2)
|
if (!tmp.createItem.amount)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
|
sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
|
||||||
tablename, tmp.datalong2, tmp.id);
|
tablename, tmp.createItem.amount, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -4656,30 +4656,30 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_PLAY_MOVIE:
|
case SCRIPT_COMMAND_PLAY_MOVIE:
|
||||||
{
|
{
|
||||||
if (!sMovieStore.LookupEntry(tmp.datalong))
|
if (!sMovieStore.LookupEntry(tmp.playMovie.movieId))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` use non-existing movie_id (id: %u) in SCRIPT_COMMAND_PLAY_MOVIE for script id %u",
|
sLog.outErrorDb("Table `%s` use non-existing movie_id (id: %u) in SCRIPT_COMMAND_PLAY_MOVIE for script id %u",
|
||||||
tablename, tmp.datalong, tmp.id);
|
tablename, tmp.playMovie.movieId, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_MOVEMENT:
|
case SCRIPT_COMMAND_MOVEMENT:
|
||||||
{
|
{
|
||||||
if (tmp.datalong >= MAX_DB_MOTION_TYPE)
|
if (tmp.movement.movementType >= MAX_DB_MOTION_TYPE)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_MOVEMENT has invalid MovementType %u for script id %u",
|
sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_MOVEMENT has invalid MovementType %u for script id %u",
|
||||||
tablename, tmp.datalong, tmp.id);
|
tablename, tmp.movement.movementType, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmp.datalong2 && !GetCreatureTemplate(tmp.datalong2))
|
if (tmp.movement.creatureEntry && !GetCreatureTemplate(tmp.movement.creatureEntry))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOVEMENT for script id %u, but this creature_template does not exist.", tablename, tmp.datalong2, tmp.id);
|
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOVEMENT for script id %u, but this creature_template does not exist.", tablename, tmp.movement.creatureEntry, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tmp.datalong2 && !tmp.datalong3)
|
if (tmp.movement.creatureEntry && !tmp.movement.searchRadius)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOVEMENT for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.datalong2, tmp.id, tmp.datalong3);
|
sLog.outErrorDb("Table `%s` has datalong2 = %u in SCRIPT_COMMAND_MOVEMENT for script id %u, but search radius is too small (datalong3 = %u).", tablename, tmp.movement.creatureEntry, tmp.id, tmp.movement.searchRadius);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9063,11 +9063,11 @@ void ObjectMgr::CheckScriptTexts(ScriptMapMap const& scripts,std::set<int32>& id
|
||||||
{
|
{
|
||||||
case SCRIPT_COMMAND_TALK:
|
case SCRIPT_COMMAND_TALK:
|
||||||
{
|
{
|
||||||
if(!GetMangosStringLocale (itrM->second.dataint))
|
if(!GetMangosStringLocale (itrM->second.talk.textId))
|
||||||
sLog.outErrorDb( "Table `db_script_string` is missing string id %u, used in database script id %u.", itrM->second.dataint, itrMM->first);
|
sLog.outErrorDb( "Table `db_script_string` is missing string id %u, used in database script id %u.", itrM->second.talk.textId, itrMM->first);
|
||||||
|
|
||||||
if (ids.find(itrM->second.dataint) != ids.end())
|
if (ids.find(itrM->second.talk.textId) != ids.end())
|
||||||
ids.erase(itrM->second.dataint);
|
ids.erase(itrM->second.talk.textId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,21 +69,190 @@ struct GameTele
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap;
|
typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap;
|
||||||
|
|
||||||
|
enum eScriptCommand
|
||||||
|
{
|
||||||
|
SCRIPT_COMMAND_TALK = 0, // source = WorldObject, target = any/none, datalong (see enum ChatType for supported CHAT_TYPE_'s)
|
||||||
|
// datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
|
||||||
|
// data_flags = flag_target_player_as_source = 0x01
|
||||||
|
// flag_original_source_as_target = 0x02
|
||||||
|
// flag_buddy_as_target = 0x04
|
||||||
|
// dataint = text entry from db_script_string -table
|
||||||
|
SCRIPT_COMMAND_EMOTE = 1, // source = unit, datalong = emote_id
|
||||||
|
SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong = field_id, datalong2 = value
|
||||||
|
SCRIPT_COMMAND_MOVE_TO = 3, // source = Creature, datalong2 = time, x/y/z
|
||||||
|
SCRIPT_COMMAND_FLAG_SET = 4, // source = any, datalong = 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, datalong = map_id, x/y/z
|
||||||
|
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, datalong = creature entry, datalong2 = bool (0=personal credit, 1=group credit)
|
||||||
|
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any (summoner), datalong=db_guid, datalong2=despawn_delay
|
||||||
|
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any (summoner), datalong=creature entry, datalong2=despawn_delay
|
||||||
|
SCRIPT_COMMAND_OPEN_DOOR = 11, // source = unit, datalong=db_guid, datalong2=reset_delay
|
||||||
|
SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = unit, datalong=db_guid, datalong2=reset_delay
|
||||||
|
SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = unit, target=GO
|
||||||
|
SCRIPT_COMMAND_REMOVE_AURA = 14, // source (datalong2!=0) or target (datalong==0) unit, datalong = spell_id
|
||||||
|
SCRIPT_COMMAND_CAST_SPELL = 15, // source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s
|
||||||
|
SCRIPT_COMMAND_PLAY_SOUND = 16, // source = any object, 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, datalong = item entry, datalong2 = amount
|
||||||
|
SCRIPT_COMMAND_DESPAWN_SELF = 18, // source or target must be creature, datalong = despawn delay
|
||||||
|
SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id
|
||||||
|
SCRIPT_COMMAND_MOVEMENT = 20, // source or target must be creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)
|
||||||
|
// datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
|
||||||
|
};
|
||||||
|
|
||||||
struct ScriptInfo
|
struct ScriptInfo
|
||||||
{
|
{
|
||||||
uint32 id;
|
uint32 id;
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
uint32 command;
|
uint32 command;
|
||||||
uint32 datalong;
|
|
||||||
uint32 datalong2;
|
union
|
||||||
uint32 datalong3;
|
{
|
||||||
uint32 datalong4;
|
struct // SCRIPT_COMMAND_TALK (0)
|
||||||
uint32 data_flags;
|
{
|
||||||
int32 dataint;
|
uint32 chatType; // datalong
|
||||||
|
uint32 creatureEntry; // datalong2
|
||||||
|
uint32 searchRadius; // datalong3
|
||||||
|
uint32 unused1; // datalong4
|
||||||
|
uint32 flags; // data_flags
|
||||||
|
int32 textId; // dataint
|
||||||
|
} talk;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_EMOTE (1)
|
||||||
|
{
|
||||||
|
uint32 emoteId; // datalong
|
||||||
|
} emote;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_FIELD_SET (2)
|
||||||
|
{
|
||||||
|
uint32 fieldId; // datalong
|
||||||
|
uint32 fieldValue; // datalong2
|
||||||
|
} setField;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_MOVE_TO (3)
|
||||||
|
{
|
||||||
|
uint32 unused1; // datalong
|
||||||
|
uint32 travelTime; // datalong2
|
||||||
|
} moveTo;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_FLAG_SET (4)
|
||||||
|
{
|
||||||
|
uint32 fieldId; // datalong
|
||||||
|
uint32 fieldValue; // datalong2
|
||||||
|
} setFlag;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_FLAG_REMOVE (5)
|
||||||
|
{
|
||||||
|
uint32 fieldId; // datalong
|
||||||
|
uint32 fieldValue; // datalong2
|
||||||
|
} removeFlag;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_TELEPORT_TO (6)
|
||||||
|
{
|
||||||
|
uint32 mapId; // datalong
|
||||||
|
} teleportTo;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_QUEST_EXPLORED (7)
|
||||||
|
{
|
||||||
|
uint32 questId; // datalong
|
||||||
|
uint32 distance; // datalong2
|
||||||
|
} questExplored;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_KILL_CREDIT (8)
|
||||||
|
{
|
||||||
|
uint32 creatureEntry; // datalong
|
||||||
|
uint32 isGroupCredit; // datalong2
|
||||||
|
} killCredit;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (9)
|
||||||
|
{
|
||||||
|
uint32 goGuid; // datalong
|
||||||
|
int32 despawnDelay; // datalong2
|
||||||
|
} respawnGo;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (10)
|
||||||
|
{
|
||||||
|
uint32 creatureEntry; // datalong
|
||||||
|
uint32 despawnDelay; // datalong2
|
||||||
|
} summonCreature;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_OPEN_DOOR (11)
|
||||||
|
{
|
||||||
|
uint32 goGuid; // datalong
|
||||||
|
int32 resetDelay; // datalong2
|
||||||
|
} openDoor;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_CLOSE_DOOR (12)
|
||||||
|
{
|
||||||
|
uint32 goGuid; // datalong
|
||||||
|
int32 resetDelay; // datalong2
|
||||||
|
} closeDoor;
|
||||||
|
|
||||||
|
// SCRIPT_COMMAND_ACTIVATE_OBJECT (13)
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_REMOVE_AURA (14)
|
||||||
|
{
|
||||||
|
uint32 spellId; // datalong
|
||||||
|
uint32 isSourceTarget; // datalong2
|
||||||
|
} removeAura;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_CAST_SPELL (15)
|
||||||
|
{
|
||||||
|
uint32 spellId; // datalong
|
||||||
|
uint32 flags; // datalong2
|
||||||
|
} castSpell;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_PLAY_SOUND (16)
|
||||||
|
{
|
||||||
|
uint32 soundId; // datalong
|
||||||
|
uint32 flags; // datalong2
|
||||||
|
} playSound;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_CREATE_ITEM (17)
|
||||||
|
{
|
||||||
|
uint32 itemEntry; // datalong
|
||||||
|
uint32 amount; // datalong2
|
||||||
|
} createItem;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_DESPAWN_SELF (18)
|
||||||
|
{
|
||||||
|
uint32 despawnDelay; // datalong
|
||||||
|
} despawn;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_PLAY_MOVIE (19)
|
||||||
|
{
|
||||||
|
uint32 movieId; // datalong
|
||||||
|
} playMovie;
|
||||||
|
|
||||||
|
struct // SCRIPT_COMMAND_MOVEMENT (20)
|
||||||
|
{
|
||||||
|
uint32 movementType; // datalong
|
||||||
|
uint32 creatureEntry; // datalong2
|
||||||
|
uint32 searchRadius; // datalong3
|
||||||
|
} movement;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32 data[6];
|
||||||
|
} raw;
|
||||||
|
};
|
||||||
|
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float z;
|
float z;
|
||||||
float o;
|
float o;
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
uint32 GetGOGuid() const
|
||||||
|
{
|
||||||
|
switch(command)
|
||||||
|
{
|
||||||
|
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: return respawnGo.goGuid;
|
||||||
|
case SCRIPT_COMMAND_OPEN_DOOR: return openDoor.goGuid;
|
||||||
|
case SCRIPT_COMMAND_CLOSE_DOOR: return closeDoor.goGuid;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::multimap<uint32, ScriptInfo> ScriptMap;
|
typedef std::multimap<uint32, ScriptInfo> ScriptMap;
|
||||||
|
|
|
||||||
|
|
@ -392,35 +392,6 @@ enum RealmZone
|
||||||
REALM_ZONE_CN5_8 = 37 // basic-Latin at create, any at login
|
REALM_ZONE_CN5_8 = 37 // basic-Latin at create, any at login
|
||||||
};
|
};
|
||||||
|
|
||||||
// DB scripting commands
|
|
||||||
#define SCRIPT_COMMAND_TALK 0 // source = WorldObject, target = any/none, datalong (see enum ChatType for supported CHAT_TYPE_'s)
|
|
||||||
// datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
|
|
||||||
// data_flags = flag_target_player_as_source = 0x01
|
|
||||||
// flag_original_source_as_target = 0x02
|
|
||||||
// flag_buddy_as_target = 0x04
|
|
||||||
// dataint = text entry from db_script_string -table
|
|
||||||
#define SCRIPT_COMMAND_EMOTE 1 // source = unit, datalong = emote_id
|
|
||||||
#define SCRIPT_COMMAND_FIELD_SET 2 // source = any, datalong = field_id, datalong2 = value
|
|
||||||
#define SCRIPT_COMMAND_MOVE_TO 3 // source = Creature, datalong2 = time, x/y/z
|
|
||||||
#define SCRIPT_COMMAND_FLAG_SET 4 // source = any, datalong = field_id, datalong2 = bitmask
|
|
||||||
#define SCRIPT_COMMAND_FLAG_REMOVE 5 // source = any, datalong = field_id, datalong2 = bitmask
|
|
||||||
#define SCRIPT_COMMAND_TELEPORT_TO 6 // source or target with Player, datalong = map_id, x/y/z
|
|
||||||
#define SCRIPT_COMMAND_QUEST_EXPLORED 7 // one from source or target must be Player, another GO/Creature, datalong=quest_id, datalong2=distance or 0
|
|
||||||
#define SCRIPT_COMMAND_KILL_CREDIT 8 // source or target with Player, datalong = creature entry, datalong2 = bool (0=personal credit, 1=group credit)
|
|
||||||
#define SCRIPT_COMMAND_RESPAWN_GAMEOBJECT 9 // source = any (summoner), datalong=db_guid, datalong2=despawn_delay
|
|
||||||
#define SCRIPT_COMMAND_TEMP_SUMMON_CREATURE 10 // source = any (summoner), datalong=creature entry, datalong2=despawn_delay
|
|
||||||
#define SCRIPT_COMMAND_OPEN_DOOR 11 // source = unit, datalong=db_guid, datalong2=reset_delay
|
|
||||||
#define SCRIPT_COMMAND_CLOSE_DOOR 12 // source = unit, datalong=db_guid, datalong2=reset_delay
|
|
||||||
#define SCRIPT_COMMAND_ACTIVATE_OBJECT 13 // source = unit, target=GO
|
|
||||||
#define SCRIPT_COMMAND_REMOVE_AURA 14 // source (datalong2!=0) or target (datalong==0) unit, datalong = spell_id
|
|
||||||
#define SCRIPT_COMMAND_CAST_SPELL 15 // source/target cast spell at target/source (script->datalong2: 0: s->t 1: s->s 2: t->t 3: t->s
|
|
||||||
#define SCRIPT_COMMAND_PLAY_SOUND 16 // source = any object, 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)
|
|
||||||
#define SCRIPT_COMMAND_CREATE_ITEM 17 // source or target must be player, datalong = item entry, datalong2 = amount
|
|
||||||
#define SCRIPT_COMMAND_DESPAWN_SELF 18 // source or target must be creature, datalong = despawn delay
|
|
||||||
#define SCRIPT_COMMAND_PLAY_MOVIE 19 // target can only be a player, datalog = movie id
|
|
||||||
#define SCRIPT_COMMAND_MOVEMENT 20 // source or target must be creature. datalong = MovementType (0:idle, 1:random or 2:waypoint)
|
|
||||||
// datalong2 = creature entry (searching for a buddy, closest to source), datalong3 = creature search radius
|
|
||||||
|
|
||||||
/// Storage class for commands issued for delayed execution
|
/// Storage class for commands issued for delayed execution
|
||||||
struct CliCommandHolder
|
struct CliCommandHolder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10495"
|
#define REVISION_NR "10496"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue