mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[7305] Allow use datalong2 not only for set target for DB script cast but also caster (1 bit set target (target/source), 2 bit set caster (source/target))
This commit is contained in:
parent
a47330e3e4
commit
49255a062b
4 changed files with 43 additions and 6 deletions
|
|
@ -2189,24 +2189,40 @@ void World::ScriptsProcess()
|
|||
break;
|
||||
}
|
||||
|
||||
Object* cmdTarget = step.script->datalong2 ? source : target;
|
||||
Object* cmdTarget = step.script->datalong2 & 0x01 ? source : target;
|
||||
|
||||
if(!cmdTarget)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL call for NULL %s.",step.script->datalong2 ? "source" : "target");
|
||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL call for NULL %s.",step.script->datalong2 & 0x01 ? "source" : "target");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!cmdTarget->isType(TYPEMASK_UNIT))
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL %s isn't unit (TypeId: %u), skipping.",step.script->datalong2 ? "source" : "target",cmdTarget->GetTypeId());
|
||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL %s isn't unit (TypeId: %u), skipping.",step.script->datalong2 & 0x01 ? "source" : "target",cmdTarget->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
Unit* spellTarget = (Unit*)cmdTarget;
|
||||
|
||||
Object* cmdSource = step.script->datalong2 & 0x02 ? target : source;
|
||||
|
||||
if(!cmdSource)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL call for NULL %s.",step.script->datalong2 & 0x02 ? "target" : "source");
|
||||
break;
|
||||
}
|
||||
|
||||
if(!cmdSource->isType(TYPEMASK_UNIT))
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_CAST_SPELL %s isn't unit (TypeId: %u), skipping.",step.script->datalong2 & 0x02 ? "target" : "source", cmdSource->GetTypeId());
|
||||
break;
|
||||
}
|
||||
|
||||
Unit* spellSource = (Unit*)cmdSource;
|
||||
|
||||
//TODO: when GO cast implemented, code below must be updated accordingly to also allow GO spell cast
|
||||
((Unit*)source)->CastSpell(spellTarget,step.script->datalong,false);
|
||||
spellSource->CastSpell(spellTarget,step.script->datalong,false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue