Bind spell functions

master
Eduardo Bart 12 years ago
parent fb1c495a4c
commit ad0ed2b1a9

@ -63,6 +63,7 @@ GameChargeableItems = 19
GameOfflineTrainingTime = 20 GameOfflineTrainingTime = 20
GamePurseSlot = 21 GamePurseSlot = 21
GameFormatCreatureName = 22 GameFormatCreatureName = 22
GameSpellList = 23
TextColors = { TextColors = {
red = '#f55e5e', --'#c83200' red = '#f55e5e', --'#c83200'

@ -334,6 +334,7 @@ namespace Otc
GameOfflineTrainingTime = 20, GameOfflineTrainingTime = 20,
GamePurseSlot = 21, GamePurseSlot = 21,
GameFormatCreatureName = 22, GameFormatCreatureName = 22,
GameSpellList = 23,
// 23-50 unused yet // 23-50 unused yet
// 51-100 reserved to be defined in lua // 51-100 reserved to be defined in lua
LastGameFeature = 101 LastGameFeature = 101

@ -1157,6 +1157,7 @@ void Game::setClientVersion(int version)
if(version >= 870) { if(version >= 870) {
enableFeature(Otc::GameDoubleExperience); enableFeature(Otc::GameDoubleExperience);
enableFeature(Otc::GamePlayerMounts); enableFeature(Otc::GamePlayerMounts);
enableFeature(Otc::GameSpellList);
} }
if(version >= 910) { if(version >= 910) {

@ -448,6 +448,16 @@ void LocalPlayer::setOfflineTrainingTime(double offlineTrainingTime)
} }
} }
void LocalPlayer::setSpells(const std::vector<int>& spells)
{
if(m_spells != spells) {
std::vector<int> oldSpells = m_spells;
m_spells = spells;
callLuaField("onSpellsChange", spells, oldSpells);
}
}
double LocalPlayer::getWalkPing() double LocalPlayer::getWalkPing()
{ {
if(m_lastWalkPings.empty()) if(m_lastWalkPings.empty())

@ -59,6 +59,7 @@ public:
void setBaseSpeed(double baseSpeed); void setBaseSpeed(double baseSpeed);
void setRegenerationTime(double regenerationTime); void setRegenerationTime(double regenerationTime);
void setOfflineTrainingTime(double offlineTrainingTime); void setOfflineTrainingTime(double offlineTrainingTime);
void setSpells(const std::vector<int>& spells);
int getStates() { return m_states; } int getStates() { return m_states; }
int getSkillLevel(Otc::Skill skill) { return m_skillsLevel[skill]; } int getSkillLevel(Otc::Skill skill) { return m_skillsLevel[skill]; }
@ -83,6 +84,7 @@ public:
double getBaseSpeed() { return m_baseSpeed; } double getBaseSpeed() { return m_baseSpeed; }
double getRegenerationTime() { return m_regenerationTime; } double getRegenerationTime() { return m_regenerationTime; }
double getOfflineTrainingTime() { return m_offlineTrainingTime; } double getOfflineTrainingTime() { return m_offlineTrainingTime; }
std::vector<int> getSpells() { return m_spells; }
ItemPtr getInventoryItem(Otc::InventorySlot inventory) { return m_inventoryItems[inventory]; } ItemPtr getInventoryItem(Otc::InventorySlot inventory) { return m_inventoryItems[inventory]; }
bool hasSight(const Position& pos); bool hasSight(const Position& pos);
@ -125,6 +127,7 @@ private:
std::array<int, Otc::LastSkill> m_skillsLevel; std::array<int, Otc::LastSkill> m_skillsLevel;
std::array<int, Otc::LastSkill> m_skillsBaseLevel; std::array<int, Otc::LastSkill> m_skillsBaseLevel;
std::array<int, Otc::LastSkill> m_skillsLevelPercent; std::array<int, Otc::LastSkill> m_skillsLevelPercent;
std::vector<int> m_spells;
bool m_known; bool m_known;
int m_states; int m_states;

@ -856,13 +856,15 @@ void ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg)
{ {
bool premium = msg->getU8(); // premium bool premium = msg->getU8(); // premium
int vocation = msg->getU8(); // vocation int vocation = msg->getU8(); // vocation
int spellCount = msg->getU16(); int spellCount = msg->getU16();
for(int i=0;i<spellCount;++i) { std::vector<int> spells;
int spellId = msg->getU8(); // spell id - TODO: add to local player for(int i=0;i<spellCount;++i)
} spells.push_back(msg->getU8()); // spell id
m_localPlayer->setPremium(premium); m_localPlayer->setPremium(premium);
m_localPlayer->setVocation(vocation); m_localPlayer->setVocation(vocation);
m_localPlayer->setSpells(spells);
} }
void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg) void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
@ -963,19 +965,25 @@ void ProtocolGame::parsePlayerCancelAttack(const InputMessagePtr& msg)
void ProtocolGame::parseSpellCooldown(const InputMessagePtr& msg) void ProtocolGame::parseSpellCooldown(const InputMessagePtr& msg)
{ {
msg->getU8(); // spell id int spellId = msg->getU8();
msg->getU32(); // cooldown int delay = msg->getU32();
g_lua.callGlobalField("g_game", "onSpellCooldown", delay);
} }
void ProtocolGame::parseSpellGroupCooldown(const InputMessagePtr& msg) void ProtocolGame::parseSpellGroupCooldown(const InputMessagePtr& msg)
{ {
msg->getU8(); // group id int groupId = msg->getU8();
msg->getU32(); // cooldown int delay = msg->getU32();
g_lua.callGlobalField("g_game", "onSpellGroupCooldown", groupId, delay);
} }
void ProtocolGame::parseMultiUseCooldown(const InputMessagePtr& msg) void ProtocolGame::parseMultiUseCooldown(const InputMessagePtr& msg)
{ {
msg->getU32(); // cooldown int delay = msg->getU32();
g_lua.callGlobalField("g_game", "onMultiUseCooldown", delay);
} }
void ProtocolGame::parseTalk(const InputMessagePtr& msg) void ProtocolGame::parseTalk(const InputMessagePtr& msg)

Loading…
Cancel
Save