mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10498] Arrange case SCRIPT_COMMAND_* so that they come in correct order.
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
167b7bfeac
commit
d7216b0991
2 changed files with 93 additions and 93 deletions
184
src/game/Map.cpp
184
src/game/Map.cpp
|
|
@ -2396,6 +2396,62 @@ void Map::ScriptsProcess()
|
|||
pSource->TeleportTo(step.script->teleportTo.mapId, step.script->x, step.script->y, step.script->z, step.script->o);
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
||||
{
|
||||
if (!source)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for NULL source.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for NULL target.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
// when script called for item spell casting then target == (unit or GO) and source is player
|
||||
WorldObject* worldObject;
|
||||
Player* player;
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for non-creature, non-gameobject or non-player (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
worldObject = (WorldObject*)source;
|
||||
player = (Player*)target;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for non-creature, non-gameobject or non-player (TypeId: %u), skipping.", step.script->id, target->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
if (source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for non-player (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
worldObject = (WorldObject*)target;
|
||||
player = (Player*)source;
|
||||
}
|
||||
|
||||
// quest id and flags checked at script loading
|
||||
if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
|
||||
(step.script->questExplored.distance == 0 || worldObject->IsWithinDistInMap(player, float(step.script->questExplored.distance))))
|
||||
player->AreaExploredOrEventHappens(step.script->questExplored.questId);
|
||||
else
|
||||
player->FailQuest(step.script->questExplored.questId);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
||||
{
|
||||
// accept player in any one from target/source arg
|
||||
|
|
@ -2425,42 +2481,6 @@ void Map::ScriptsProcess()
|
|||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
||||
{
|
||||
if (!step.script->summonCreature.creatureEntry)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for NULL creature.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!source)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for NULL world object.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!source->isType(TYPEMASK_WORLDOBJECT))
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for non-WorldObject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
WorldObject* summoner = (WorldObject*)source;
|
||||
|
||||
float x = step.script->x;
|
||||
float y = step.script->y;
|
||||
float z = step.script->z;
|
||||
float o = step.script->o;
|
||||
|
||||
Creature* pCreature = summoner->SummonCreature(step.script->summonCreature.creatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->summonCreature.despawnDelay);
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON (script id %u) failed for creature (entry: %u).", step.script->id, step.script->summonCreature.creatureEntry);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
||||
{
|
||||
if (!step.script->respawnGo.goGuid) // gameobject not specified
|
||||
|
|
@ -2514,6 +2534,42 @@ void Map::ScriptsProcess()
|
|||
go->GetMap()->Add(go);
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
||||
{
|
||||
if (!step.script->summonCreature.creatureEntry)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for NULL creature.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!source)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for NULL world object.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!source->isType(TYPEMASK_WORLDOBJECT))
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (script id %u) call for non-WorldObject (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
WorldObject* summoner = (WorldObject*)source;
|
||||
|
||||
float x = step.script->x;
|
||||
float y = step.script->y;
|
||||
float z = step.script->z;
|
||||
float o = step.script->o;
|
||||
|
||||
Creature* pCreature = summoner->SummonCreature(step.script->summonCreature.creatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->summonCreature.despawnDelay);
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON (script id %u) failed for creature (entry: %u).", step.script->id, step.script->summonCreature.creatureEntry);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
||||
{
|
||||
if (!step.script->openDoor.goGuid) // door not specified
|
||||
|
|
@ -2615,62 +2671,6 @@ void Map::ScriptsProcess()
|
|||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
||||
{
|
||||
if (!source)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for NULL source.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for NULL target.", step.script->id);
|
||||
break;
|
||||
}
|
||||
|
||||
// when script called for item spell casting then target == (unit or GO) and source is player
|
||||
WorldObject* worldObject;
|
||||
Player* player;
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for non-creature, non-gameobject or non-player (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
worldObject = (WorldObject*)source;
|
||||
player = (Player*)target;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for non-creature, non-gameobject or non-player (TypeId: %u), skipping.", step.script->id, target->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
if (source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_QUEST_EXPLORED (script id %u) call for non-player (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
worldObject = (WorldObject*)target;
|
||||
player = (Player*)source;
|
||||
}
|
||||
|
||||
// quest id and flags checked at script loading
|
||||
if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
|
||||
(step.script->questExplored.distance == 0 || worldObject->IsWithinDistInMap(player, float(step.script->questExplored.distance))))
|
||||
player->AreaExploredOrEventHappens(step.script->questExplored.questId);
|
||||
else
|
||||
player->FailQuest(step.script->questExplored.questId);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_ACTIVATE_OBJECT:
|
||||
{
|
||||
if (!source)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue