This commit is contained in:
OTCv8
2020-08-15 20:06:04 +02:00
parent 929ab400ed
commit cf931af49e
21 changed files with 87 additions and 1541 deletions

View File

@@ -1384,7 +1384,14 @@ void Game::mount(bool mount)
{
if(!canPerformGameAction())
return;
m_protocolGame->sendMountStatus(mount);
m_protocolGame->sendOutfitExtensionStatus(mount ? 1 : 0);
}
void Game::setOutfitExtensions(int mount, int wings, int aura, int shader)
{
if (!canPerformGameAction())
return;
m_protocolGame->sendOutfitExtensionStatus(mount, wings, aura, shader);
}
void Game::requestItemInfo(const ItemPtr& item, int index)

View File

@@ -282,6 +282,7 @@ public:
// 870 only
void equipItem(const ItemPtr& item);
void mount(bool mount);
void setOutfitExtensions(int mount, int wings, int aura, int shader);
// 910 only
void requestItemInfo(const ItemPtr& item, int index);

View File

@@ -279,6 +279,7 @@ void Client::registerLuaFunctions()
g_lua.bindSingletonFunction("g_game", "requestQuestLine", &Game::requestQuestLine, &g_game);
g_lua.bindSingletonFunction("g_game", "equipItem", &Game::equipItem, &g_game);
g_lua.bindSingletonFunction("g_game", "mount", &Game::mount, &g_game);
g_lua.bindSingletonFunction("g_game", "setOutfitExtensions", &Game::setOutfitExtensions, &g_game);
g_lua.bindSingletonFunction("g_game", "requestItemInfo", &Game::requestItemInfo, &g_game);
g_lua.bindSingletonFunction("g_game", "ping", &Game::ping, &g_game);
g_lua.bindSingletonFunction("g_game", "setPingDelay", &Game::setPingDelay, &g_game);
@@ -488,8 +489,10 @@ void Client::registerLuaFunctions()
g_lua.bindClassStaticFunction<Creature>("create", []{ return CreaturePtr(new Creature); });
g_lua.bindClassMemberFunction<Creature>("getId", &Creature::getId);
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
g_lua.bindClassMemberFunction<Creature>("setName", &Creature::setName);
g_lua.bindClassMemberFunction<Creature>("setManaPercent", &LocalPlayer::setManaPercent);
g_lua.bindClassMemberFunction<Creature>("getManaPercent", &LocalPlayer::getManaPercent);
g_lua.bindClassMemberFunction<Creature>("setHealthPercent", &Creature::setHealthPercent);
g_lua.bindClassMemberFunction<Creature>("getHealthPercent", &Creature::getHealthPercent);
g_lua.bindClassMemberFunction<Creature>("getSpeed", &Creature::getSpeed);
g_lua.bindClassMemberFunction<Creature>("setSpeed", &Creature::setSpeed);

View File

@@ -84,9 +84,9 @@ bool luavalue_cast(int index, Outfit& outfit)
}
if (g_game.getFeature(Otc::GameWingsAndAura)) {
g_lua.getField("wings", index);
outfit.setMount(g_lua.popInteger());
outfit.setWings(g_lua.popInteger());
g_lua.getField("aura", index);
outfit.setMount(g_lua.popInteger());
outfit.setAura(g_lua.popInteger());
}
//if (g_game.getFeature(Otc::GameOutfitShaders)) {
g_lua.getField("shader", index);

View File

@@ -828,15 +828,24 @@ void ProtocolGame::sendChangeOutfit(const Outfit& outfit)
send(msg);
}
void ProtocolGame::sendMountStatus(bool mount)
void ProtocolGame::sendOutfitExtensionStatus(int mount, int wings, int aura, int shader)
{
if(g_game.getFeature(Otc::GamePlayerMounts)) {
if(g_game.getFeature(Otc::GamePlayerMounts) || g_game.getFeature(Otc::GameWingsAndAura) || g_game.getFeature(Otc::GameWingsAndAura)) {
OutputMessagePtr msg(new OutputMessage);
msg->addU8(Proto::ClientMount);
msg->addU8(mount);
if (g_game.getFeature(Otc::GamePlayerMounts)) {
msg->addU8(mount);
}
if (g_game.getFeature(Otc::GameWingsAndAura)) {
msg->addU8(wings);
msg->addU8(aura);
}
if (g_game.getFeature(Otc::GameOutfitShaders)) {
msg->addU8(shader);
}
send(msg);
} else {
g_logger.error("ProtocolGame::sendMountStatus does not support the current protocol.");
g_logger.error("ProtocolGame::sendOutfitExtensionStatus does not support the current protocol.");
}
}