mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[11984] Add new SCRIPT_COMMAND_SEND_TAXI_PATH to trigger a taxi path
Idea for this patch by Klark20 (maybe he also was the author of this patch as well, I cannot check in this moment) Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
99986d7881
commit
4e6fbf5e9e
4 changed files with 52 additions and 1 deletions
|
|
@ -251,3 +251,5 @@ Where "A -> B" means that the command is executed from A with B as target.
|
||||||
29 SCRIPT_COMMAND_MODIFY_NPC_FLAGS resultingSource = Creature
|
29 SCRIPT_COMMAND_MODIFY_NPC_FLAGS resultingSource = Creature
|
||||||
* datalong=NPCFlags
|
* datalong=NPCFlags
|
||||||
* datalong2= 0x00=toggle, 0x01=add, 0x02=remove
|
* datalong2= 0x00=toggle, 0x01=add, 0x02=remove
|
||||||
|
30 SCRIPT_COMMAND_SEND_TAXI_PATH resultingTarget or Source must be Player
|
||||||
|
* datalong = taxi path id
|
||||||
|
|
|
||||||
|
|
@ -536,6 +536,38 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SCRIPT_COMMAND_SEND_TAXI_PATH:
|
||||||
|
{
|
||||||
|
if (!sTaxiPathStore.LookupEntry(tmp.sendTaxiPath.taxiPathId))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SEND_TAXI_PATH for script id %u, but this taxi path does not exist.", tablename, tmp.sendTaxiPath.taxiPathId, tmp.id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Check if this taxi path can be triggered with a spell
|
||||||
|
if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
|
||||||
|
{
|
||||||
|
uint32 taxiSpell = 0;
|
||||||
|
for (uint32 i = 1; i < sSpellStore.GetNumRows() && taxiSpell == 0; ++i)
|
||||||
|
{
|
||||||
|
if (SpellEntry const* spell = sSpellStore.LookupEntry(i))
|
||||||
|
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
|
{
|
||||||
|
if (spell->Effect[j] == SPELL_EFFECT_SEND_TAXI && spell->EffectMiscValue[j] == tmp.sendTaxiPath.taxiPathId)
|
||||||
|
{
|
||||||
|
taxiSpell = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taxiSpell)
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `%s` has datalong = %u in SCRIPT_COMMAND_SEND_TAXI_PATH for script id %u, but this taxi path can be triggered by spell %u.", tablename, tmp.sendTaxiPath.taxiPathId, tmp.id, taxiSpell);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scripts.second.find(tmp.id) == scripts.second.end())
|
if (scripts.second.find(tmp.id) == scripts.second.end())
|
||||||
|
|
@ -1523,6 +1555,16 @@ void ScriptAction::HandleScriptStep()
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SCRIPT_COMMAND_SEND_TAXI_PATH:
|
||||||
|
{
|
||||||
|
// only Player
|
||||||
|
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||||
|
if (!pPlayer)
|
||||||
|
break;
|
||||||
|
|
||||||
|
pPlayer->ActivateTaxiPathTo(m_script->sendTaxiPath.taxiPathId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u unknown command used.", m_table, m_script->id, m_script->command);
|
sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u unknown command used.", m_table, m_script->id, m_script->command);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ enum ScriptCommand // resSource, resTar
|
||||||
SCRIPT_COMMAND_MODIFY_NPC_FLAGS = 29, // resSource = Creature
|
SCRIPT_COMMAND_MODIFY_NPC_FLAGS = 29, // resSource = Creature
|
||||||
// datalong=NPCFlags
|
// datalong=NPCFlags
|
||||||
// datalong2:0x00=toggle, 0x01=add, 0x02=remove
|
// datalong2:0x00=toggle, 0x01=add, 0x02=remove
|
||||||
|
SCRIPT_COMMAND_SEND_TAXI_PATH = 30, // datalong = taxi path id (source or target must be player)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK
|
#define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK
|
||||||
|
|
@ -283,6 +284,12 @@ struct ScriptInfo
|
||||||
uint32 change_flag; // datalong2
|
uint32 change_flag; // datalong2
|
||||||
} npcFlag;
|
} npcFlag;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32 taxiPathId; // datalong
|
||||||
|
uint32 empty;
|
||||||
|
} sendTaxiPath;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 data[2];
|
uint32 data[2];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11983"
|
#define REVISION_NR "11984"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue