Fixed baseSpeed not being parsed (10.59+)
This commit is contained in:
parent
26fb35fd4d
commit
63f95317a2
|
@ -696,6 +696,15 @@ void Creature::setSpeed(uint16 speed)
|
||||||
callLuaField("onSpeedChange", m_speed, oldSpeed);
|
callLuaField("onSpeedChange", m_speed, oldSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Creature::setBaseSpeed(double baseSpeed)
|
||||||
|
{
|
||||||
|
if(m_baseSpeed != baseSpeed) {
|
||||||
|
double oldBaseSpeed = m_baseSpeed;
|
||||||
|
m_baseSpeed = baseSpeed;
|
||||||
|
|
||||||
|
callLuaField("onBaseSpeedChange", baseSpeed, oldBaseSpeed);
|
||||||
|
}
|
||||||
|
}
|
||||||
void Creature::setSkull(uint8 skull)
|
void Creature::setSkull(uint8 skull)
|
||||||
{
|
{
|
||||||
m_skull = skull;
|
m_skull = skull;
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
void setOutfitColor(const Color& color, int duration);
|
void setOutfitColor(const Color& color, int duration);
|
||||||
void setLight(const Light& light) { m_light = light; }
|
void setLight(const Light& light) { m_light = light; }
|
||||||
void setSpeed(uint16 speed);
|
void setSpeed(uint16 speed);
|
||||||
|
void setBaseSpeed(double baseSpeed);
|
||||||
void setSkull(uint8 skull);
|
void setSkull(uint8 skull);
|
||||||
void setShield(uint8 shield);
|
void setShield(uint8 shield);
|
||||||
void setEmblem(uint8 emblem);
|
void setEmblem(uint8 emblem);
|
||||||
|
@ -82,6 +83,7 @@ public:
|
||||||
Outfit getOutfit() { return m_outfit; }
|
Outfit getOutfit() { return m_outfit; }
|
||||||
Light getLight() { return m_light; }
|
Light getLight() { return m_light; }
|
||||||
uint16 getSpeed() { return m_speed; }
|
uint16 getSpeed() { return m_speed; }
|
||||||
|
double getBaseSpeed() { return m_baseSpeed; }
|
||||||
uint8 getSkull() { return m_skull; }
|
uint8 getSkull() { return m_skull; }
|
||||||
uint8 getShield() { return m_shield; }
|
uint8 getShield() { return m_shield; }
|
||||||
uint8 getEmblem() { return m_emblem; }
|
uint8 getEmblem() { return m_emblem; }
|
||||||
|
@ -147,6 +149,7 @@ protected:
|
||||||
Outfit m_outfit;
|
Outfit m_outfit;
|
||||||
Light m_light;
|
Light m_light;
|
||||||
int m_speed;
|
int m_speed;
|
||||||
|
double m_baseSpeed;
|
||||||
uint8 m_skull;
|
uint8 m_skull;
|
||||||
uint8 m_shield;
|
uint8 m_shield;
|
||||||
uint8 m_emblem;
|
uint8 m_emblem;
|
||||||
|
|
|
@ -507,16 +507,6 @@ void LocalPlayer::setPremium(bool premium)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::setBaseSpeed(double baseSpeed)
|
|
||||||
{
|
|
||||||
if(m_baseSpeed != baseSpeed) {
|
|
||||||
double oldBaseSpeed = m_baseSpeed;
|
|
||||||
m_baseSpeed = baseSpeed;
|
|
||||||
|
|
||||||
callLuaField("onBaseSpeedChange", baseSpeed, oldBaseSpeed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LocalPlayer::setRegenerationTime(double regenerationTime)
|
void LocalPlayer::setRegenerationTime(double regenerationTime)
|
||||||
{
|
{
|
||||||
if(m_regenerationTime != regenerationTime) {
|
if(m_regenerationTime != regenerationTime) {
|
||||||
|
|
|
@ -59,7 +59,6 @@ public:
|
||||||
void setInventoryItem(Otc::InventorySlot inventory, const ItemPtr& item);
|
void setInventoryItem(Otc::InventorySlot inventory, const ItemPtr& item);
|
||||||
void setVocation(int vocation);
|
void setVocation(int vocation);
|
||||||
void setPremium(bool premium);
|
void setPremium(bool premium);
|
||||||
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);
|
void setSpells(const std::vector<int>& spells);
|
||||||
|
@ -84,7 +83,6 @@ public:
|
||||||
double getBaseMagicLevel() { return m_baseMagicLevel; }
|
double getBaseMagicLevel() { return m_baseMagicLevel; }
|
||||||
double getSoul() { return m_soul; }
|
double getSoul() { return m_soul; }
|
||||||
double getStamina() { return m_stamina; }
|
double getStamina() { return m_stamina; }
|
||||||
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; }
|
std::vector<int> getSpells() { return m_spells; }
|
||||||
|
@ -162,7 +160,6 @@ private:
|
||||||
double m_baseMagicLevel;
|
double m_baseMagicLevel;
|
||||||
double m_soul;
|
double m_soul;
|
||||||
double m_stamina;
|
double m_stamina;
|
||||||
double m_baseSpeed;
|
|
||||||
double m_regenerationTime;
|
double m_regenerationTime;
|
||||||
double m_offlineTrainingTime;
|
double m_offlineTrainingTime;
|
||||||
};
|
};
|
||||||
|
|
|
@ -238,9 +238,7 @@ void Client::registerLuaFunctions()
|
||||||
g_lua.bindSingletonFunction("g_game", "getChaseMode", &Game::getChaseMode, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getChaseMode", &Game::getChaseMode, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "getFightMode", &Game::getFightMode, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getFightMode", &Game::getFightMode, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "getPVPMode", &Game::getPVPMode, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getPVPMode", &Game::getPVPMode, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "setUnjustifiedPoints", &Game::setUnjustifiedPoints, &g_game);
|
|
||||||
g_lua.bindSingletonFunction("g_game", "getUnjustifiedPoints", &Game::getUnjustifiedPoints, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getUnjustifiedPoints", &Game::getUnjustifiedPoints, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "setOpenPvpSituations", &Game::setOpenPvpSituations, &g_game);
|
|
||||||
g_lua.bindSingletonFunction("g_game", "getOpenPvpSituations", &Game::getOpenPvpSituations, &g_game);
|
g_lua.bindSingletonFunction("g_game", "getOpenPvpSituations", &Game::getOpenPvpSituations, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "isSafeFight", &Game::isSafeFight, &g_game);
|
g_lua.bindSingletonFunction("g_game", "isSafeFight", &Game::isSafeFight, &g_game);
|
||||||
g_lua.bindSingletonFunction("g_game", "inspectNpcTrade", &Game::inspectNpcTrade, &g_game);
|
g_lua.bindSingletonFunction("g_game", "inspectNpcTrade", &Game::inspectNpcTrade, &g_game);
|
||||||
|
@ -444,6 +442,7 @@ void Client::registerLuaFunctions()
|
||||||
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
|
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
|
||||||
g_lua.bindClassMemberFunction<Creature>("getHealthPercent", &Creature::getHealthPercent);
|
g_lua.bindClassMemberFunction<Creature>("getHealthPercent", &Creature::getHealthPercent);
|
||||||
g_lua.bindClassMemberFunction<Creature>("getSpeed", &Creature::getSpeed);
|
g_lua.bindClassMemberFunction<Creature>("getSpeed", &Creature::getSpeed);
|
||||||
|
g_lua.bindClassMemberFunction<Creature>("getBaseSpeed", &Creature::getBaseSpeed);
|
||||||
g_lua.bindClassMemberFunction<Creature>("getSkull", &Creature::getSkull);
|
g_lua.bindClassMemberFunction<Creature>("getSkull", &Creature::getSkull);
|
||||||
g_lua.bindClassMemberFunction<Creature>("getShield", &Creature::getShield);
|
g_lua.bindClassMemberFunction<Creature>("getShield", &Creature::getShield);
|
||||||
g_lua.bindClassMemberFunction<Creature>("getEmblem", &Creature::getEmblem);
|
g_lua.bindClassMemberFunction<Creature>("getEmblem", &Creature::getEmblem);
|
||||||
|
@ -630,7 +629,6 @@ void Client::registerLuaFunctions()
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getStamina", &LocalPlayer::getStamina);
|
g_lua.bindClassMemberFunction<LocalPlayer>("getStamina", &LocalPlayer::getStamina);
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getOfflineTrainingTime", &LocalPlayer::getOfflineTrainingTime);
|
g_lua.bindClassMemberFunction<LocalPlayer>("getOfflineTrainingTime", &LocalPlayer::getOfflineTrainingTime);
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getRegenerationTime", &LocalPlayer::getRegenerationTime);
|
g_lua.bindClassMemberFunction<LocalPlayer>("getRegenerationTime", &LocalPlayer::getRegenerationTime);
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getBaseSpeed", &LocalPlayer::getBaseSpeed);
|
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getBaseMagicLevel", &LocalPlayer::getBaseMagicLevel);
|
g_lua.bindClassMemberFunction<LocalPlayer>("getBaseMagicLevel", &LocalPlayer::getBaseMagicLevel);
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getTotalCapacity", &LocalPlayer::getTotalCapacity);
|
g_lua.bindClassMemberFunction<LocalPlayer>("getTotalCapacity", &LocalPlayer::getTotalCapacity);
|
||||||
g_lua.bindClassMemberFunction<LocalPlayer>("getInventoryItem", &LocalPlayer::getInventoryItem);
|
g_lua.bindClassMemberFunction<LocalPlayer>("getInventoryItem", &LocalPlayer::getInventoryItem);
|
||||||
|
|
|
@ -1004,11 +1004,19 @@ void ProtocolGame::parseCreatureOutfit(const InputMessagePtr& msg)
|
||||||
void ProtocolGame::parseCreatureSpeed(const InputMessagePtr& msg)
|
void ProtocolGame::parseCreatureSpeed(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
uint id = msg->getU32();
|
uint id = msg->getU32();
|
||||||
|
|
||||||
|
int baseSpeed = -1;
|
||||||
|
if(g_game.getClientVersion() >= 1059)
|
||||||
|
baseSpeed = msg->getU16();
|
||||||
|
|
||||||
int speed = msg->getU16();
|
int speed = msg->getU16();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
if(creature)
|
if(creature) {
|
||||||
creature->setSpeed(speed);
|
creature->setSpeed(speed);
|
||||||
|
if(baseSpeed != -1)
|
||||||
|
creature->setBaseSpeed(baseSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
// some servers has a bug in get spectators and sends unknown creatures updates
|
// some servers has a bug in get spectators and sends unknown creatures updates
|
||||||
// so this code is disabled
|
// so this code is disabled
|
||||||
|
|
Loading…
Reference in New Issue