Skip to content

Commit

Permalink
Reorganization of Method headers
Browse files Browse the repository at this point in the history
Each core now has its own method directory, this makes it a lot easier and cleaner to both maintain and add new methods

When adding new methods, they should be defined in both the LuaFunctions.cpp and the respective Method.h file. Please also add the registry entry to the other cores' method registry, so we know what's implemented or not.

When a method is not implemented, it should point to a nullptr in the registry.
  • Loading branch information
Foereaper committed Jul 26, 2023
1 parent 33d8e37 commit 88a6d9f
Show file tree
Hide file tree
Showing 61 changed files with 37,689 additions and 1,153 deletions.
80 changes: 0 additions & 80 deletions CMakeLists.txt

This file was deleted.

23 changes: 23 additions & 0 deletions AuraMethods.h → CMangos/AuraMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,28 @@ namespace LuaAura
Eluna::CHECKOBJ<ElunaObject>(L, 1)->Invalidate();
return 0;
}

ElunaRegister<Aura> AuraMethodsOverride[] =
{
// Getters
{ "GetCaster", &LuaAura::GetCaster },
{ "GetCasterGUID", &LuaAura::GetCasterGUID },
{ "GetCasterLevel", &LuaAura::GetCasterLevel },
{ "GetDuration", &LuaAura::GetDuration },
{ "GetMaxDuration", &LuaAura::GetMaxDuration },
{ "GetAuraId", &LuaAura::GetAuraId },
{ "GetStackAmount", &LuaAura::GetStackAmount },
{ "GetOwner", &LuaAura::GetOwner },

// Setters
{ "SetDuration", &LuaAura::SetDuration },
{ "SetMaxDuration", &LuaAura::SetMaxDuration },
{ "SetStackAmount", &LuaAura::SetStackAmount },

// Other
{ "Remove", &LuaAura::Remove },

{ NULL, NULL }
};
};
#endif
25 changes: 25 additions & 0 deletions BattleGroundMethods.h → CMangos/BattleGroundMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,30 @@ namespace LuaBattleGround
Eluna::Push(L, bg->GetStatus());
return 1;
}

ElunaRegister<BattleGround> BattleGroundMethodsOverride[] =
{
// Getters
{ "GetName", &LuaBattleGround::GetName },
{ "GetAlivePlayersCountByTeam", &LuaBattleGround::GetAlivePlayersCountByTeam },
{ "GetMap", &LuaBattleGround::GetMap },
{ "GetBonusHonorFromKillCount", &LuaBattleGround::GetBonusHonorFromKillCount },
{ "GetBracketId", &LuaBattleGround::GetBracketId },
{ "GetEndTime", &LuaBattleGround::GetEndTime },
{ "GetFreeSlotsForTeam", &LuaBattleGround::GetFreeSlotsForTeam },
{ "GetInstanceId", &LuaBattleGround::GetInstanceId },
{ "GetMapId", &LuaBattleGround::GetMapId },
{ "GetTypeId", &LuaBattleGround::GetTypeId },
{ "GetMaxLevel", &LuaBattleGround::GetMaxLevel },
{ "GetMinLevel", &LuaBattleGround::GetMinLevel },
{ "GetMaxPlayers", &LuaBattleGround::GetMaxPlayers },
{ "GetMinPlayers", &LuaBattleGround::GetMinPlayers },
{ "GetMaxPlayersPerTeam", &LuaBattleGround::GetMaxPlayersPerTeam },
{ "GetMinPlayersPerTeam", &LuaBattleGround::GetMinPlayersPerTeam },
{ "GetWinner", &LuaBattleGround::GetWinner },
{ "GetStatus", &LuaBattleGround::GetStatus },

{ NULL, NULL }
};
};
#endif
14 changes: 14 additions & 0 deletions CorpseMethods.h → CMangos/CorpseMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,19 @@ namespace LuaCorpse
corpse->SaveToDB();
return 0;
}

ElunaRegister<Corpse> CorpseMethodsOverride[] =
{
// Getters
{ "GetOwnerGUID", &LuaCorpse::GetOwnerGUID },
{ "GetGhostTime", &LuaCorpse::GetGhostTime },
{ "GetType", &LuaCorpse::GetType },

// Other
{ "ResetGhostTime", &LuaCorpse::ResetGhostTime },
{ "SaveToDB", &LuaCorpse::SaveToDB },

{ NULL, NULL }
};
};
#endif
96 changes: 96 additions & 0 deletions CreatureMethods.h → CMangos/CreatureMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -1499,5 +1499,101 @@ namespace LuaCreature
#endif
return 1;
}

ElunaRegister<Creature> CreatureMethodsOverride[] =
{
// Getters
{ "GetAITarget", &LuaCreature::GetAITarget },
{ "GetAITargets", &LuaCreature::GetAITargets },
{ "GetAITargetsCount", &LuaCreature::GetAITargetsCount },
{ "GetHomePosition", &LuaCreature::GetHomePosition },
{ "GetCorpseDelay", &LuaCreature::GetCorpseDelay },
{ "GetCreatureSpellCooldownDelay", &LuaCreature::GetCreatureSpellCooldownDelay },
{ "GetScriptId", &LuaCreature::GetScriptId },
{ "GetAIName", &LuaCreature::GetAIName },
{ "GetScriptName", &LuaCreature::GetScriptName },
{ "GetAttackDistance", &LuaCreature::GetAttackDistance },
{ "GetAggroRange", &LuaCreature::GetAggroRange },
{ "GetDefaultMovementType", &LuaCreature::GetDefaultMovementType },
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
{ "GetWanderRadius", &LuaCreature::GetWanderRadius },
{ "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
{ "GetWaypointPath", &LuaCreature::GetWaypointPath },
{ "GetLootMode", &LuaCreature::GetLootMode },
{ "GetLootRecipient", &LuaCreature::GetLootRecipient },
{ "GetLootRecipientGroup", &LuaCreature::GetLootRecipientGroup },
{ "GetNPCFlags", &LuaCreature::GetNPCFlags },
{ "GetExtraFlags", &LuaCreature::GetExtraFlags },
{ "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue },
{ "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow },
{ "GetCreatureFamily", &LuaCreature::GetCreatureFamily },

// Setters
{ "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth },
{ "SetHover", &LuaCreature::SetHover },
{ "SetDisableGravity", &LuaCreature::SetDisableGravity },
{ "SetAggroEnabled", &LuaCreature::SetAggroEnabled },
{ "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance },
{ "SetNoSearchAssistance", &LuaCreature::SetNoSearchAssistance },
{ "SetDefaultMovementType", &LuaCreature::SetDefaultMovementType },
{ "SetRespawnDelay", &LuaCreature::SetRespawnDelay },
{ "SetWanderRadius", &LuaCreature::SetWanderRadius },
{ "SetInCombatWithZone", &LuaCreature::SetInCombatWithZone },
{ "SetDisableReputationGain", &LuaCreature::SetDisableReputationGain },
{ "SetLootMode", &LuaCreature::SetLootMode },
{ "SetNPCFlags", &LuaCreature::SetNPCFlags },
{ "SetReactState", &LuaCreature::SetReactState },
{ "SetDeathState", &LuaCreature::SetDeathState },
{ "SetWalk", &LuaCreature::SetWalk },
{ "SetHomePosition", &LuaCreature::SetHomePosition },
{ "SetEquipmentSlots", &LuaCreature::SetEquipmentSlots },

// Boolean
{ "IsRegeneratingHealth", &LuaCreature::IsRegeneratingHealth },
{ "IsDungeonBoss", &LuaCreature::IsDungeonBoss },
{ "IsWorldBoss", &LuaCreature::IsWorldBoss },
{ "IsRacialLeader", &LuaCreature::IsRacialLeader },
{ "IsCivilian", &LuaCreature::IsCivilian },
{ "IsTrigger", &LuaCreature::IsTrigger },
{ "IsGuard", &LuaCreature::IsGuard },
{ "IsElite", &LuaCreature::IsElite },
{ "IsInEvadeMode", &LuaCreature::IsInEvadeMode },
{ "HasCategoryCooldown", &LuaCreature::HasCategoryCooldown },
{ "CanWalk", &LuaCreature::CanWalk },
{ "CanSwim", &LuaCreature::CanSwim },
{ "CanAggro", &LuaCreature::CanAggro },
{ "CanStartAttack", &LuaCreature::CanStartAttack },
{ "HasSearchedAssistance", &LuaCreature::HasSearchedAssistance },
{ "IsTappedBy", &LuaCreature::IsTappedBy },
{ "HasLootRecipient", &LuaCreature::HasLootRecipient },
{ "CanAssistTo", &LuaCreature::CanAssistTo },
{ "IsTargetableForAttack", &LuaCreature::IsTargetableForAttack },
{ "CanCompleteQuest", &LuaCreature::CanCompleteQuest },
{ "IsReputationGainDisabled", &LuaCreature::IsReputationGainDisabled },
{ "IsDamageEnoughForLootingAndReward", &LuaCreature::IsDamageEnoughForLootingAndReward },
{ "HasLootMode", &LuaCreature::HasLootMode },
{ "HasSpell", &LuaCreature::HasSpell },
{ "HasQuest", &LuaCreature::HasQuest },
{ "HasSpellCooldown", &LuaCreature::HasSpellCooldown },
{ "CanFly", &LuaCreature::CanFly },

// Other
{ "FleeToGetAssistance", &LuaCreature::FleeToGetAssistance },
{ "CallForHelp", &LuaCreature::CallForHelp },
{ "CallAssistance", &LuaCreature::CallAssistance },
{ "RemoveCorpse", &LuaCreature::RemoveCorpse },
{ "DespawnOrUnsummon", &LuaCreature::DespawnOrUnsummon },
{ "Respawn", &LuaCreature::Respawn },
{ "AttackStart", &LuaCreature::AttackStart },
{ "AddLootMode", &LuaCreature::AddLootMode },
{ "ResetLootMode", &LuaCreature::ResetLootMode },
{ "RemoveLootMode", &LuaCreature::RemoveLootMode },
{ "SaveToDB", &LuaCreature::SaveToDB },
{ "SelectVictim", &LuaCreature::SelectVictim },
{ "MoveWaypoint", &LuaCreature::MoveWaypoint },
{ "UpdateEntry", &LuaCreature::UpdateEntry },

{ NULL, NULL }
};
};
#endif
26 changes: 26 additions & 0 deletions ElunaQueryMethods.h → CMangos/ElunaQueryMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,32 @@ namespace LuaQuery
lua_settop(L, tbl);
return 1;
}

ElunaRegister<ElunaQuery> QueryMethodsOverride[] =
{
// Getters
{ "GetColumnCount", &LuaQuery::GetColumnCount },
{ "GetRowCount", &LuaQuery::GetRowCount },
{ "GetRow", &LuaQuery::GetRow },
{ "GetBool", &LuaQuery::GetBool },
{ "GetUInt8", &LuaQuery::GetUInt8 },
{ "GetUInt16", &LuaQuery::GetUInt16 },
{ "GetUInt32", &LuaQuery::GetUInt32 },
{ "GetUInt64", &LuaQuery::GetUInt64 },
{ "GetInt8", &LuaQuery::GetInt8 },
{ "GetInt16", &LuaQuery::GetInt16 },
{ "GetInt32", &LuaQuery::GetInt32 },
{ "GetInt64", &LuaQuery::GetInt64 },
{ "GetFloat", &LuaQuery::GetFloat },
{ "GetDouble", &LuaQuery::GetDouble },
{ "GetString", &LuaQuery::GetString },

// Boolean
{ "NextRow", &LuaQuery::NextRow },
{ "IsNull", &LuaQuery::IsNull },

{ NULL, NULL }
};
};
#undef RESULT

Expand Down
32 changes: 32 additions & 0 deletions GameObjectMethods.h → CMangos/GameObjectMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,37 @@ namespace LuaGameObject
go->SetRespawnTime(respawn);
return 0;
}

ElunaRegister<GameObject> GameObjectMethodsOverride[] =
{
// Getters
{ "GetDisplayId", &LuaGameObject::GetDisplayId },
{ "GetGoState", &LuaGameObject::GetGoState },
{ "GetLootState", &LuaGameObject::GetLootState },
{ "GetLootRecipient", &LuaGameObject::GetLootRecipient },
{ "GetLootRecipientGroup", &LuaGameObject::GetLootRecipientGroup },
{ "GetDBTableGUIDLow", &LuaGameObject::GetDBTableGUIDLow },

// Setters
{ "SetGoState", &LuaGameObject::SetGoState },
{ "SetLootState", &LuaGameObject::SetLootState },
{ "SetRespawnTime", &LuaGameObject::SetRespawnTime },

// Boolean
{ "IsTransport", &LuaGameObject::IsTransport },
{ "IsDestructible", nullptr }, // Not implemented
{ "IsActive", &LuaGameObject::IsActive },
{ "HasQuest", &LuaGameObject::HasQuest },
{ "IsSpawned", &LuaGameObject::IsSpawned },

// Other
{ "RemoveFromWorld", &LuaGameObject::RemoveFromWorld },
{ "UseDoorOrButton", &LuaGameObject::UseDoorOrButton },
{ "Despawn", &LuaGameObject::Despawn },
{ "Respawn", &LuaGameObject::Respawn },
{ "SaveToDB", &LuaGameObject::SaveToDB },

{ NULL, NULL }
};
};
#endif
Loading

0 comments on commit 88a6d9f

Please sign in to comment.