Fix TC compile

This commit is contained in:
Rochet2
2015-06-04 12:30:43 +03:00
parent 7397c98a61
commit 3aa6d0544b
5 changed files with 70 additions and 24 deletions

View File

@@ -279,7 +279,14 @@ namespace LuaCreature
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
if (const SpellInfo* info = sSpellMgr->GetSpellInfo(spell))
Eluna::Push(L, info->GetCategory() && creature->GetSpellHistory()->HasCooldown(spell));
else
Eluna::Push(L, false);
#else
Eluna::Push(L, creature->HasCategoryCooldown(spell)); Eluna::Push(L, creature->HasCategoryCooldown(spell));
#endif
return 1; return 1;
} }
@@ -328,7 +335,11 @@ namespace LuaCreature
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
Eluna::Push(L, creature->GetSpellHistory()->HasCooldown(spellId));
#else
Eluna::Push(L, creature->HasSpellCooldown(spellId)); Eluna::Push(L, creature->HasSpellCooldown(spellId));
#endif
return 1; return 1;
} }
@@ -565,7 +576,11 @@ namespace LuaCreature
{ {
uint32 spell = Eluna::CHECKVAL<uint32>(L, 2); uint32 spell = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
Eluna::Push(L, creature->GetSpellHistory()->GetRemainingCooldown(spell));
#else
Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell)); Eluna::Push(L, creature->GetCreatureSpellCooldownDelay(spell));
#endif
return 1; return 1;
} }

View File

@@ -45,6 +45,7 @@
#include "WeatherMgr.h" #include "WeatherMgr.h"
#include "Battleground.h" #include "Battleground.h"
#include "revision.h" #include "revision.h"
#include "SpellHistory.h"
#else #else
#include "Config/Config.h" #include "Config/Config.h"
#include "AggressorAI.h" #include "AggressorAI.h"

View File

@@ -2093,6 +2093,16 @@ namespace LuaGlobalFunctions
// Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value // Stack: {nodes}, mountA, mountH, price, pathid, {nodes}, node, key, value
} }
TaxiPathNodeEntry entry; TaxiPathNodeEntry entry;
#ifdef TRINITY
// mandatory
entry.MapID = Eluna::CHECKVAL<uint32>(L, start);
entry.LocX = Eluna::CHECKVAL<float>(L, start + 1);
entry.LocY = Eluna::CHECKVAL<float>(L, start + 2);
entry.LocZ = Eluna::CHECKVAL<float>(L, start + 3);
// optional
entry.Flags = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.Delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
#else
// mandatory // mandatory
entry.mapid = Eluna::CHECKVAL<uint32>(L, start); entry.mapid = Eluna::CHECKVAL<uint32>(L, start);
entry.x = Eluna::CHECKVAL<float>(L, start + 1); entry.x = Eluna::CHECKVAL<float>(L, start + 1);
@@ -2101,6 +2111,7 @@ namespace LuaGlobalFunctions
// optional // optional
entry.actionFlag = Eluna::CHECKVAL<uint32>(L, start + 4, 0); entry.actionFlag = Eluna::CHECKVAL<uint32>(L, start + 4, 0);
entry.delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0); entry.delay = Eluna::CHECKVAL<uint32>(L, start + 5, 0);
#endif
nodes.push_back(entry); nodes.push_back(entry);
@@ -2130,17 +2141,26 @@ namespace LuaGlobalFunctions
for (std::list<TaxiPathNodeEntry>::iterator it = nodes.begin(); it != nodes.end(); ++it) for (std::list<TaxiPathNodeEntry>::iterator it = nodes.begin(); it != nodes.end(); ++it)
{ {
TaxiPathNodeEntry& entry = *it; TaxiPathNodeEntry& entry = *it;
entry.path = pathId;
TaxiNodesEntry* nodeEntry = new TaxiNodesEntry(); TaxiNodesEntry* nodeEntry = new TaxiNodesEntry();
#ifdef TRINITY
entry.PathID = pathId;
nodeEntry->ID = index;
nodeEntry->map_id = entry.MapID;
nodeEntry->x = entry.LocX;
nodeEntry->y = entry.LocY;
nodeEntry->z = entry.LocZ;
#else
entry.path = pathId;
nodeEntry->ID = index; nodeEntry->ID = index;
nodeEntry->map_id = entry.mapid; nodeEntry->map_id = entry.mapid;
nodeEntry->MountCreatureID[0] = mountH;
nodeEntry->MountCreatureID[1] = mountA;
nodeEntry->x = entry.x; nodeEntry->x = entry.x;
nodeEntry->y = entry.y; nodeEntry->y = entry.y;
nodeEntry->z = entry.z; nodeEntry->z = entry.z;
#endif
nodeEntry->MountCreatureID[0] = mountH;
nodeEntry->MountCreatureID[1] = mountA;
sTaxiNodesStore.SetEntry(nodeId, nodeEntry); sTaxiNodesStore.SetEntry(nodeId, nodeEntry);
entry.index = nodeId++; entry.NodeIndex = nodeId++;
sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry)); sTaxiPathNodesByPath[pathId].set(index++, new TaxiPathNodeEntry(entry));
} }
if (startNode >= nodeId) if (startNode >= nodeId)

View File

@@ -483,7 +483,6 @@ ElunaRegister<Player> PlayerMethods[] =
{ "GetSkillPermBonusValue", &LuaPlayer::GetSkillPermBonusValue }, // :GetSkillPermBonusValue(skill) - Returns current permanent bonus { "GetSkillPermBonusValue", &LuaPlayer::GetSkillPermBonusValue }, // :GetSkillPermBonusValue(skill) - Returns current permanent bonus
{ "GetSkillTempBonusValue", &LuaPlayer::GetSkillTempBonusValue }, // :GetSkillTempBonusValue(skill) - Returns current temp bonus { "GetSkillTempBonusValue", &LuaPlayer::GetSkillTempBonusValue }, // :GetSkillTempBonusValue(skill) - Returns current temp bonus
{ "GetReputationRank", &LuaPlayer::GetReputationRank }, // :GetReputationRank(faction) - Returns the reputation rank with given faction { "GetReputationRank", &LuaPlayer::GetReputationRank }, // :GetReputationRank(faction) - Returns the reputation rank with given faction
{ "GetSpellCooldowns", &LuaPlayer::GetSpellCooldowns }, // :GetSpellCooldowns() - Gets a table where spellIDs are the keys and values are cooldowns
{ "GetDrunkValue", &LuaPlayer::GetDrunkValue }, // :GetDrunkValue() - Returns the current drunkness value { "GetDrunkValue", &LuaPlayer::GetDrunkValue }, // :GetDrunkValue() - Returns the current drunkness value
{ "GetBattlegroundId", &LuaPlayer::GetBattlegroundId }, // :GetBattlegroundId() - Returns the player's current battleground ID { "GetBattlegroundId", &LuaPlayer::GetBattlegroundId }, // :GetBattlegroundId() - Returns the player's current battleground ID
{ "GetBattlegroundTypeId", &LuaPlayer::GetBattlegroundTypeId }, // :GetBattlegroundTypeId() - Returns the player's current battleground type ID { "GetBattlegroundTypeId", &LuaPlayer::GetBattlegroundTypeId }, // :GetBattlegroundTypeId() - Returns the player's current battleground type ID

View File

@@ -199,7 +199,11 @@ namespace LuaPlayer
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
Eluna::Push(L, player->GetSpellHistory()->HasCooldown(spellId));
#else
Eluna::Push(L, player->HasSpellCooldown(spellId)); Eluna::Push(L, player->HasSpellCooldown(spellId));
#endif
return 1; return 1;
} }
@@ -783,7 +787,11 @@ namespace LuaPlayer
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
#ifdef TRINITY
Eluna::Push(L, player->GetSpellHistory()->GetRemainingCooldown(spellId));
#else
Eluna::Push(L, uint32(player->GetSpellCooldownDelay(spellId))); Eluna::Push(L, uint32(player->GetSpellCooldownDelay(spellId)));
#endif
return 1; return 1;
} }
@@ -938,24 +946,6 @@ namespace LuaPlayer
return 1; return 1;
} }
int GetSpellCooldowns(Eluna* /*E*/, lua_State* L, Player* player)
{
lua_newtable(L);
int tbl = lua_gettop(L);
uint32 i = 0;
for (SpellCooldowns::const_iterator it = player->GetSpellCooldownMap().begin(); it != player->GetSpellCooldownMap().end(); ++it)
{
++i;
Eluna::Push(L, it->first);
Eluna::Push(L, uint32(it->second.end));
lua_settable(L, tbl);
}
lua_settop(L, tbl);
return 1;
}
int GetSkillTempBonusValue(Eluna* /*E*/, lua_State* L, Player* player) int GetSkillTempBonusValue(Eluna* /*E*/, lua_State* L, Player* player)
{ {
uint32 skill = Eluna::CHECKVAL<uint32>(L, 2); uint32 skill = Eluna::CHECKVAL<uint32>(L, 2);
@@ -3133,7 +3123,11 @@ namespace LuaPlayer
{ {
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
bool update = Eluna::CHECKVAL<bool>(L, 3, true); bool update = Eluna::CHECKVAL<bool>(L, 3, true);
#ifdef TRINITY
player->GetSpellHistory()->ResetCooldown(spellId, update);
#else
player->RemoveSpellCooldown(spellId, update); player->RemoveSpellCooldown(spellId, update);
#endif
return 0; return 0;
} }
@@ -3141,7 +3135,16 @@ namespace LuaPlayer
{ {
uint32 category = Eluna::CHECKVAL<uint32>(L, 2); uint32 category = Eluna::CHECKVAL<uint32>(L, 2);
bool update = Eluna::CHECKVAL<bool>(L, 3, true); bool update = Eluna::CHECKVAL<bool>(L, 3, true);
#ifdef TRINITY
player->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
return spellInfo && spellInfo->GetCategory() == 1248;
}, true);
#else
player->RemoveSpellCategoryCooldown(category, update); player->RemoveSpellCategoryCooldown(category, update);
#endif
return 0; return 0;
} }
@@ -3150,7 +3153,11 @@ namespace LuaPlayer
*/ */
int ResetAllCooldowns(Eluna* /*E*/, lua_State* /*L*/, Player* player) int ResetAllCooldowns(Eluna* /*E*/, lua_State* /*L*/, Player* player)
{ {
#ifdef TRINITY
player->GetSpellHistory()->ResetAllCooldowns();
#else
player->RemoveAllSpellCooldown(); player->RemoveAllSpellCooldown();
#endif
return 0; return 0;
} }
@@ -3159,7 +3166,11 @@ namespace LuaPlayer
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2); uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
Unit* target = Eluna::CHECKOBJ<Unit>(L, 3); Unit* target = Eluna::CHECKOBJ<Unit>(L, 3);
#ifdef TRINITY
target->GetSpellHistory()->ResetCooldown(spellId, true);
#else
player->SendClearCooldown(spellId, target); player->SendClearCooldown(spellId, target);
#endif
return 0; return 0;
} }
/** /**