New pvp modes to combat controls

This commit is contained in:
Sam
2013-11-19 00:50:00 +01:00
parent c98439ae65
commit 4d656f8bd1
15 changed files with 210 additions and 25 deletions

View File

@@ -51,6 +51,7 @@ Game::Game()
m_canReportBugs = false;
m_fightMode = Otc::FightBalanced;
m_chaseMode = Otc::DontChase;
m_pvpMode = Otc::WhiteDove;
m_safeFight = true;
}
@@ -76,6 +77,7 @@ void Game::resetGameStates()
m_canReportBugs = false;
m_fightMode = Otc::FightBalanced;
m_chaseMode = Otc::DontChase;
m_pvpMode = Otc::WhiteDove;
m_safeFight = true;
m_followingCreature = nullptr;
m_attackingCreature = nullptr;
@@ -176,7 +178,7 @@ void Game::processGameStart()
m_online = true;
// synchronize fight modes with the server
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight, m_pvpMode);
// NOTE: the entire map description and local player information is not known yet (bot call is allowed here)
enableBotCall();
@@ -239,15 +241,17 @@ void Game::processPlayerHelpers(int helpers)
g_lua.callGlobalField("g_game", "onPlayerHelpersUpdate", helpers);
}
void Game::processPlayerModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeMode)
void Game::processPlayerModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeMode, Otc::PVPModes pvpMode)
{
m_fightMode = fightMode;
m_chaseMode = chaseMode;
m_safeFight = safeMode;
m_pvpMode = pvpMode;
g_lua.callGlobalField("g_game", "onFightModeChange", fightMode);
g_lua.callGlobalField("g_game", "onChaseModeChange", chaseMode);
g_lua.callGlobalField("g_game", "onSafeFightChange", safeMode);
g_lua.callGlobalField("g_game", "onPVPModeChange", pvpMode);
}
void Game::processPing()
@@ -1195,7 +1199,7 @@ void Game::setChaseMode(Otc::ChaseModes chaseMode)
if(m_chaseMode == chaseMode)
return;
m_chaseMode = chaseMode;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight, m_pvpMode);
g_lua.callGlobalField("g_game", "onChaseModeChange", chaseMode);
}
@@ -1206,7 +1210,7 @@ void Game::setFightMode(Otc::FightModes fightMode)
if(m_fightMode == fightMode)
return;
m_fightMode = fightMode;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight, m_pvpMode);
g_lua.callGlobalField("g_game", "onFightModeChange", fightMode);
}
@@ -1217,10 +1221,21 @@ void Game::setSafeFight(bool on)
if(m_safeFight == on)
return;
m_safeFight = on;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight, m_pvpMode);
g_lua.callGlobalField("g_game", "onSafeFightChange", on);
}
void Game::setPVPMode(Otc::PVPModes pvpMode)
{
if(!canPerformGameAction())
return;
if(m_pvpMode == pvpMode)
return;
m_pvpMode = pvpMode;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight, m_pvpMode);
g_lua.callGlobalField("g_game", "onPVPModeChange", pvpMode);
}
void Game::inspectNpcTrade(const ItemPtr& item)
{
if(!canPerformGameAction() || !item)