mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +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
|
|
@ -3793,6 +3793,21 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
}
|
}
|
||||||
|
|
||||||
case SCRIPT_COMMAND_REMOVE_AURA:
|
case SCRIPT_COMMAND_REMOVE_AURA:
|
||||||
|
{
|
||||||
|
if(!sSpellStore.LookupEntry(tmp.datalong))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u",
|
||||||
|
tablename,tmp.datalong,tmp.id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(tmp.datalong2 & ~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",
|
||||||
|
tablename,tmp.datalong2,tmp.id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SCRIPT_COMMAND_CAST_SPELL:
|
case SCRIPT_COMMAND_CAST_SPELL:
|
||||||
{
|
{
|
||||||
if(!sSpellStore.LookupEntry(tmp.datalong))
|
if(!sSpellStore.LookupEntry(tmp.datalong))
|
||||||
|
|
@ -3801,6 +3816,12 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
tablename,tmp.datalong,tmp.id);
|
tablename,tmp.datalong,tmp.id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(tmp.datalong2 & ~0x3) // 2 bits
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2189,24 +2189,40 @@ void World::ScriptsProcess()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object* cmdTarget = step.script->datalong2 ? source : target;
|
Object* cmdTarget = step.script->datalong2 & 0x01 ? source : target;
|
||||||
|
|
||||||
if(!cmdTarget)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cmdTarget->isType(TYPEMASK_UNIT))
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* spellTarget = (Unit*)cmdTarget;
|
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
|
//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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ enum RealmZone
|
||||||
#define SCRIPT_COMMAND_CLOSE_DOOR 12 // 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_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_REMOVE_AURA 14 // source (datalong2!=0) or target (datalong==0) unit, datalong = spell_id
|
||||||
#define SCRIPT_COMMAND_CAST_SPELL 15 // 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
|
||||||
|
|
||||||
/// 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 "7304"
|
#define REVISION_NR "7305"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue