bind rule violations/bug report functions
This commit is contained in:
parent
45d3097504
commit
42ba5b7a2a
|
@ -43,6 +43,7 @@ void Game::resetGameStates()
|
||||||
{
|
{
|
||||||
m_dead = false;
|
m_dead = false;
|
||||||
m_serverBeat = 50;
|
m_serverBeat = 50;
|
||||||
|
m_canReportBugs = false;
|
||||||
m_fightMode = Otc::FightBalanced;
|
m_fightMode = Otc::FightBalanced;
|
||||||
m_chaseMode = Otc::DontChase;
|
m_chaseMode = Otc::DontChase;
|
||||||
m_safeFight = true;
|
m_safeFight = true;
|
||||||
|
@ -56,6 +57,7 @@ void Game::resetGameStates()
|
||||||
}
|
}
|
||||||
m_containers.clear();
|
m_containers.clear();
|
||||||
m_vips.clear();
|
m_vips.clear();
|
||||||
|
m_gmActions.clear();
|
||||||
|
|
||||||
m_worldName = "";
|
m_worldName = "";
|
||||||
}
|
}
|
||||||
|
@ -105,13 +107,14 @@ void Game::processLoginWait(const std::string& message, int time)
|
||||||
g_lua.callGlobalField("g_game", "onLoginWait", message, time);
|
g_lua.callGlobalField("g_game", "onLoginWait", message, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat)
|
void Game::processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, bool canReportBugs)
|
||||||
{
|
{
|
||||||
// reset the new game state
|
// reset the new game state
|
||||||
resetGameStates();
|
resetGameStates();
|
||||||
|
|
||||||
m_localPlayer = localPlayer;
|
m_localPlayer = localPlayer;
|
||||||
m_serverBeat = serverBeat;
|
m_serverBeat = serverBeat;
|
||||||
|
m_canReportBugs = canReportBugs;
|
||||||
|
|
||||||
// synchronize fight modes with the server
|
// synchronize fight modes with the server
|
||||||
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
|
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
|
||||||
|
@ -154,6 +157,34 @@ void Game::processDeath(int penality)
|
||||||
g_lua.callGlobalField("g_game", "onDeath", penality);
|
g_lua.callGlobalField("g_game", "onDeath", penality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::processGMActions(const std::vector<uint8>& actions)
|
||||||
|
{
|
||||||
|
m_gmActions = actions;
|
||||||
|
g_lua.callGlobalField("g_game", "onGMActions", actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::processPlayerStats(double health, double maxHealth,
|
||||||
|
double freeCapacity, double experience,
|
||||||
|
double level, double levelPercent,
|
||||||
|
double mana, double maxMana,
|
||||||
|
double magicLevel, double magicLevelPercent,
|
||||||
|
double soul, double stamina)
|
||||||
|
{
|
||||||
|
if(!m_localPlayer) {
|
||||||
|
logTraceError("there is no local player");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_localPlayer->setHealth(health, maxHealth);
|
||||||
|
m_localPlayer->setFreeCapacity(freeCapacity);
|
||||||
|
m_localPlayer->setExperience(experience);
|
||||||
|
m_localPlayer->setLevel(level, levelPercent);
|
||||||
|
m_localPlayer->setMana(mana, maxMana);
|
||||||
|
m_localPlayer->setMagicLevel(magicLevel, magicLevelPercent);
|
||||||
|
m_localPlayer->setStamina(stamina);
|
||||||
|
m_localPlayer->setSoul(soul);
|
||||||
|
}
|
||||||
|
|
||||||
void Game::processPing()
|
void Game::processPing()
|
||||||
{
|
{
|
||||||
g_lua.callGlobalField("g_game", "onPing");
|
g_lua.callGlobalField("g_game", "onPing");
|
||||||
|
@ -287,6 +318,26 @@ void Game::processCloseChannel(int channelId)
|
||||||
g_lua.callGlobalField("g_game", "onCloseChannel", channelId);
|
g_lua.callGlobalField("g_game", "onCloseChannel", channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::processRuleViolationChannel(int channelId)
|
||||||
|
{
|
||||||
|
g_lua.callGlobalField("g_game", "onRuleViolationChannel", channelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::processRuleViolationRemove(const std::string& name)
|
||||||
|
{
|
||||||
|
g_lua.callGlobalField("g_game", "onRuleViolationRemove", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::processRuleViolationCancel(const std::string& name)
|
||||||
|
{
|
||||||
|
g_lua.callGlobalField("g_game", "onRuleViolationCancel", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::processRuleViolationLock()
|
||||||
|
{
|
||||||
|
g_lua.callGlobalField("g_game", "onRuleViolationLock");
|
||||||
|
}
|
||||||
|
|
||||||
void Game::processVipAdd(uint id, const std::string& name, bool online)
|
void Game::processVipAdd(uint id, const std::string& name, bool online)
|
||||||
{
|
{
|
||||||
m_vips[id] = Vip(name, online);
|
m_vips[id] = Vip(name, online);
|
||||||
|
@ -299,6 +350,16 @@ void Game::processVipStateChange(uint id, bool online)
|
||||||
g_lua.callGlobalField("g_game", "onVipStateChange", id, online);
|
g_lua.callGlobalField("g_game", "onVipStateChange", id, online);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::processTutorialHint(int id)
|
||||||
|
{
|
||||||
|
g_lua.callGlobalField("g_game", "onTutorialHint", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::processAutomapFlag(const Position& pos, int icon, const std::string& message)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int>>& outfitList)
|
void Game::processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int>>& outfitList)
|
||||||
{
|
{
|
||||||
CreaturePtr virtualCreature = CreaturePtr(new Creature);
|
CreaturePtr virtualCreature = CreaturePtr(new Creature);
|
||||||
|
@ -919,6 +980,25 @@ void Game::editList(int listId, uint id, const std::string& text)
|
||||||
m_protocolGame->sendEditList(listId, id, text);
|
m_protocolGame->sendEditList(listId, id, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::reportBug(const std::string& comment)
|
||||||
|
{
|
||||||
|
if(!canPerformGameAction())
|
||||||
|
return;
|
||||||
|
m_protocolGame->sendBugReport(comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::reportRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
||||||
|
{
|
||||||
|
if(!canPerformGameAction())
|
||||||
|
return;
|
||||||
|
m_protocolGame->sendRuleVilation(target, reason, action, comment, statement, statementId, ipBanishment);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game::debugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d)
|
||||||
|
{
|
||||||
|
m_protocolGame->sendDebugReport(a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
void Game::requestQuestLog()
|
void Game::requestQuestLog()
|
||||||
{
|
{
|
||||||
if(!canPerformGameAction())
|
if(!canPerformGameAction())
|
||||||
|
|
|
@ -51,10 +51,11 @@ protected:
|
||||||
void processLogin();
|
void processLogin();
|
||||||
void processLogout();
|
void processLogout();
|
||||||
|
|
||||||
void processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat);
|
void processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, bool canReportBugs);
|
||||||
void processGameEnd();
|
void processGameEnd();
|
||||||
void processDeath(int penality);
|
void processDeath(int penality);
|
||||||
|
|
||||||
|
void processGMActions(const std::vector<uint8>& actions);
|
||||||
void processPlayerStats(double health, double maxHealth,
|
void processPlayerStats(double health, double maxHealth,
|
||||||
double freeCapacity, double experience,
|
double freeCapacity, double experience,
|
||||||
double level, double levelPercent,
|
double level, double levelPercent,
|
||||||
|
@ -86,10 +87,20 @@ protected:
|
||||||
void processOpenOwnPrivateChannel(int channelId, const std::string& name);
|
void processOpenOwnPrivateChannel(int channelId, const std::string& name);
|
||||||
void processCloseChannel(int channelId);
|
void processCloseChannel(int channelId);
|
||||||
|
|
||||||
|
// rule violations
|
||||||
|
void processRuleViolationChannel(int channelId);
|
||||||
|
void processRuleViolationRemove(const std::string& name);
|
||||||
|
void processRuleViolationCancel(const std::string& name);
|
||||||
|
void processRuleViolationLock();
|
||||||
|
|
||||||
// vip related
|
// vip related
|
||||||
void processVipAdd(uint id, const std::string& name, bool online);
|
void processVipAdd(uint id, const std::string& name, bool online);
|
||||||
void processVipStateChange(uint id, bool online);
|
void processVipStateChange(uint id, bool online);
|
||||||
|
|
||||||
|
// tutorial hint
|
||||||
|
void processTutorialHint(int id);
|
||||||
|
void processAutomapFlag(const Position& pos, int icon, const std::string& message);
|
||||||
|
|
||||||
// outfit
|
// outfit
|
||||||
void processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int>>& outfitList);
|
void processOpenOutfitWindow(const Outfit& currentOufit, const std::vector<std::tuple<int, std::string, int>>& outfitList);
|
||||||
|
|
||||||
|
@ -209,11 +220,17 @@ public:
|
||||||
void editText(uint id, const std::string& text);
|
void editText(uint id, const std::string& text);
|
||||||
void editList(int listId, uint id, const std::string& text);
|
void editList(int listId, uint id, const std::string& text);
|
||||||
|
|
||||||
|
// reports
|
||||||
|
void reportBug(const std::string& comment);
|
||||||
|
void reportRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||||
|
void debugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d);
|
||||||
|
|
||||||
// questlog related
|
// questlog related
|
||||||
void requestQuestLog();
|
void requestQuestLog();
|
||||||
void requestQuestLine(int questId);
|
void requestQuestLine(int questId);
|
||||||
|
|
||||||
bool canPerformGameAction();
|
bool canPerformGameAction();
|
||||||
|
bool canReportBugs() { return m_canReportBugs; }
|
||||||
bool checkBotProtection();
|
bool checkBotProtection();
|
||||||
|
|
||||||
bool isOnline() { return !!m_localPlayer; }
|
bool isOnline() { return !!m_localPlayer; }
|
||||||
|
@ -231,6 +248,7 @@ public:
|
||||||
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
|
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
|
||||||
int getProtocolVersion() { return PROTOCOL; }
|
int getProtocolVersion() { return PROTOCOL; }
|
||||||
std::string getWorldName() { return m_worldName; }
|
std::string getWorldName() { return m_worldName; }
|
||||||
|
std::vector<uint8> getGMActions() { return m_gmActions; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setAttackingCreature(const CreaturePtr& creature);
|
void setAttackingCreature(const CreaturePtr& creature);
|
||||||
|
@ -248,6 +266,8 @@ private:
|
||||||
Otc::FightModes m_fightMode;
|
Otc::FightModes m_fightMode;
|
||||||
Otc::ChaseModes m_chaseMode;
|
Otc::ChaseModes m_chaseMode;
|
||||||
bool m_safeFight;
|
bool m_safeFight;
|
||||||
|
bool m_canReportBugs;
|
||||||
|
std::vector<uint8> m_gmActions;
|
||||||
std::string m_worldName;
|
std::string m_worldName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,7 @@ void OTClient::registerLuaFunctions()
|
||||||
g_lua.bindClassStaticFunction("g_game", "requestQuestLog", std::bind(&Game::requestQuestLog, &g_game));
|
g_lua.bindClassStaticFunction("g_game", "requestQuestLog", std::bind(&Game::requestQuestLog, &g_game));
|
||||||
g_lua.bindClassStaticFunction("g_game", "requestQuestLine", std::bind(&Game::requestQuestLine, &g_game, std::placeholders::_1));
|
g_lua.bindClassStaticFunction("g_game", "requestQuestLine", std::bind(&Game::requestQuestLine, &g_game, std::placeholders::_1));
|
||||||
g_lua.bindClassStaticFunction("g_game", "canPerformGameAction", std::bind(&Game::canPerformGameAction, &g_game));
|
g_lua.bindClassStaticFunction("g_game", "canPerformGameAction", std::bind(&Game::canPerformGameAction, &g_game));
|
||||||
|
g_lua.bindClassStaticFunction("g_game", "canReportBugs", std::bind(&Game::canReportBugs, &g_game));
|
||||||
g_lua.bindClassStaticFunction("g_game", "checkBotProtection", std::bind(&Game::checkBotProtection, &g_game));
|
g_lua.bindClassStaticFunction("g_game", "checkBotProtection", std::bind(&Game::checkBotProtection, &g_game));
|
||||||
g_lua.bindClassStaticFunction("g_game", "isOnline", std::bind(&Game::isOnline, &g_game));
|
g_lua.bindClassStaticFunction("g_game", "isOnline", std::bind(&Game::isOnline, &g_game));
|
||||||
g_lua.bindClassStaticFunction("g_game", "isDead", std::bind(&Game::isDead, &g_game));
|
g_lua.bindClassStaticFunction("g_game", "isDead", std::bind(&Game::isDead, &g_game));
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace Proto {
|
||||||
|
|
||||||
enum GameServerOpts {
|
enum GameServerOpts {
|
||||||
GameServerInitGame = 10,
|
GameServerInitGame = 10,
|
||||||
GameServerGMActions = 11, // deprecated in last tibia?
|
GameServerGMActions = 11,
|
||||||
GameServerLoginError = 20,
|
GameServerLoginError = 20,
|
||||||
GameServerLoginAdvice = 21,
|
GameServerLoginAdvice = 21,
|
||||||
GameServerLoginWait = 22,
|
GameServerLoginWait = 22,
|
||||||
|
@ -101,7 +101,7 @@ namespace Proto {
|
||||||
GameServerCloseTrade = 127,
|
GameServerCloseTrade = 127,
|
||||||
GameServerAmbient = 130,
|
GameServerAmbient = 130,
|
||||||
GameServerGraphicalEffect = 131,
|
GameServerGraphicalEffect = 131,
|
||||||
GameServerTextEffect = 132, // deprecated in last tibia
|
GameServerTextEffect = 132,
|
||||||
GameServerMissleEffect = 133,
|
GameServerMissleEffect = 133,
|
||||||
GameServerMarkCreature = 134,
|
GameServerMarkCreature = 134,
|
||||||
GameServerTrappers = 135,
|
GameServerTrappers = 135,
|
||||||
|
@ -118,18 +118,16 @@ namespace Proto {
|
||||||
GameServerPlayerSkills = 161,
|
GameServerPlayerSkills = 161,
|
||||||
GameServerPlayerState = 162,
|
GameServerPlayerState = 162,
|
||||||
GameServerClearTarget = 163,
|
GameServerClearTarget = 163,
|
||||||
#if PROTOCOL>=870
|
|
||||||
GameServerSpellDelay = 164,
|
GameServerSpellDelay = 164,
|
||||||
GameServerSpellGroupDelay = 165,
|
GameServerSpellGroupDelay = 165,
|
||||||
#endif
|
|
||||||
GameServerTalk = 170,
|
GameServerTalk = 170,
|
||||||
GameServerChannels = 171,
|
GameServerChannels = 171,
|
||||||
GameServerOpenChannel = 172,
|
GameServerOpenChannel = 172,
|
||||||
GameServerOpenPrivateChannel = 173,
|
GameServerOpenPrivateChannel = 173,
|
||||||
GameServerRuleViolationChannel = 174, // deprecated in last tibia
|
GameServerRuleViolationChannel = 174,
|
||||||
GameServerRuleViolationRemove = 175, // deprecated in last tibia
|
GameServerRuleViolationRemove = 175,
|
||||||
GameServerRuleViolationCancel = 176, // deprecated in last tibia
|
GameServerRuleViolationCancel = 176,
|
||||||
GameServerRuleViolationLock = 177, // deprecated in last tibia
|
GameServerRuleViolationLock = 177,
|
||||||
GameServerOpenOwnChannel = 178,
|
GameServerOpenOwnChannel = 178,
|
||||||
GameServerCloseChannel = 179,
|
GameServerCloseChannel = 179,
|
||||||
GameServerTextMessage = 180,
|
GameServerTextMessage = 180,
|
||||||
|
@ -216,8 +214,9 @@ namespace Proto {
|
||||||
#endif
|
#endif
|
||||||
ClientAddVip = 220,
|
ClientAddVip = 220,
|
||||||
ClientRemoveVip = 221,
|
ClientRemoveVip = 221,
|
||||||
//ClientBugReport = 230,
|
ClientBugReport = 230,
|
||||||
//ClientErrorFileEntry = 232,
|
ClientRuleViolation= 231,
|
||||||
|
ClientDebugReport = 232,
|
||||||
ClientRequestQuestLog = 240,
|
ClientRequestQuestLog = 240,
|
||||||
ClientRequestQuestLine = 241,
|
ClientRequestQuestLine = 241,
|
||||||
//ClientRuleViolationReport = 242,
|
//ClientRuleViolationReport = 242,
|
||||||
|
|
|
@ -98,6 +98,9 @@ public:
|
||||||
void sendChangeOutfit(const Outfit& outfit);
|
void sendChangeOutfit(const Outfit& outfit);
|
||||||
void sendAddVip(const std::string& name);
|
void sendAddVip(const std::string& name);
|
||||||
void sendRemoveVip(uint playerId);
|
void sendRemoveVip(uint playerId);
|
||||||
|
void sendBugReport(const std::string& comment);
|
||||||
|
void sendRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);
|
||||||
|
void sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d);
|
||||||
void sendRequestQuestLog();
|
void sendRequestQuestLog();
|
||||||
void sendRequestQuestLine(int questId);
|
void sendRequestQuestLine(int questId);
|
||||||
|
|
||||||
|
@ -153,12 +156,18 @@ private:
|
||||||
void parsePlayerSkills(InputMessage& msg);
|
void parsePlayerSkills(InputMessage& msg);
|
||||||
void parsePlayerState(InputMessage& msg);
|
void parsePlayerState(InputMessage& msg);
|
||||||
void parsePlayerCancelAttack(InputMessage& msg);
|
void parsePlayerCancelAttack(InputMessage& msg);
|
||||||
|
void parseSpellDelay(InputMessage& msg);
|
||||||
|
void parseSpellGroupDelay(InputMessage& msg);
|
||||||
void parseCreatureSpeak(InputMessage& msg);
|
void parseCreatureSpeak(InputMessage& msg);
|
||||||
void parseChannelList(InputMessage& msg);
|
void parseChannelList(InputMessage& msg);
|
||||||
void parseOpenChannel(InputMessage& msg);
|
void parseOpenChannel(InputMessage& msg);
|
||||||
void parseOpenPrivateChannel(InputMessage& msg);
|
void parseOpenPrivateChannel(InputMessage& msg);
|
||||||
void parseOpenOwnPrivateChannel(InputMessage& msg);
|
void parseOpenOwnPrivateChannel(InputMessage& msg);
|
||||||
void parseCloseChannel(InputMessage& msg);
|
void parseCloseChannel(InputMessage& msg);
|
||||||
|
void parseRuleViolationChannel(InputMessage& msg);
|
||||||
|
void parseRuleViolationRemove(InputMessage& msg);
|
||||||
|
void parseRuleViolationCancel(InputMessage& msg);
|
||||||
|
void parseRuleViolationLock(InputMessage& msg);
|
||||||
void parseOpenTrade(InputMessage& msg);
|
void parseOpenTrade(InputMessage& msg);
|
||||||
void parseCloseTrade(InputMessage&);
|
void parseCloseTrade(InputMessage&);
|
||||||
void parseTextMessage(InputMessage& msg);
|
void parseTextMessage(InputMessage& msg);
|
||||||
|
|
|
@ -188,10 +188,10 @@ void ProtocolGame::parseMessage(InputMessage& msg)
|
||||||
break;
|
break;
|
||||||
#if PROTOCOL>=870
|
#if PROTOCOL>=870
|
||||||
case Proto::GameServerSpellDelay:
|
case Proto::GameServerSpellDelay:
|
||||||
|
parseSpellDelay(msg);
|
||||||
|
break;
|
||||||
case Proto::GameServerSpellGroupDelay:
|
case Proto::GameServerSpellGroupDelay:
|
||||||
msg.getU16(); // spell id
|
parseSpellGroupDelay(msg);
|
||||||
msg.getU16(); // cooldown
|
|
||||||
msg.getU8(); // unknown
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case Proto::GameServerTalk:
|
case Proto::GameServerTalk:
|
||||||
|
@ -207,15 +207,16 @@ void ProtocolGame::parseMessage(InputMessage& msg)
|
||||||
parseOpenPrivateChannel(msg);
|
parseOpenPrivateChannel(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerRuleViolationChannel:
|
case Proto::GameServerRuleViolationChannel:
|
||||||
msg.getU16();
|
parseRuleViolationChannel(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerRuleViolationRemove:
|
case Proto::GameServerRuleViolationRemove:
|
||||||
msg.getString();
|
parseRuleViolationRemove(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerRuleViolationCancel:
|
case Proto::GameServerRuleViolationCancel:
|
||||||
msg.getString();
|
parseRuleViolationCancel(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerRuleViolationLock:
|
case Proto::GameServerRuleViolationLock:
|
||||||
|
parseRuleViolationLock(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerOpenOwnChannel:
|
case Proto::GameServerOpenOwnChannel:
|
||||||
parseOpenOwnPrivateChannel(msg);
|
parseOpenOwnPrivateChannel(msg);
|
||||||
|
@ -277,19 +278,20 @@ void ProtocolGame::parseInitGame(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint playerId = msg.getU32();
|
uint playerId = msg.getU32();
|
||||||
int serverBeat = msg.getU16();
|
int serverBeat = msg.getU16();
|
||||||
msg.getU8(); // can report bugs, ignored
|
bool canReportBugs = msg.getU8();
|
||||||
|
|
||||||
m_localPlayer = LocalPlayerPtr(new LocalPlayer);
|
m_localPlayer = LocalPlayerPtr(new LocalPlayer);
|
||||||
m_localPlayer->setId(playerId);
|
m_localPlayer->setId(playerId);
|
||||||
|
|
||||||
g_game.processGameStart(m_localPlayer, serverBeat);
|
g_game.processGameStart(m_localPlayer, serverBeat, canReportBugs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseGMActions(InputMessage& msg)
|
void ProtocolGame::parseGMActions(InputMessage& msg)
|
||||||
{
|
{
|
||||||
// not used
|
std::vector<uint8> actions;
|
||||||
for(int i = 0; i < Proto::NumViolationReasons; ++i)
|
for(int i = 0; i < Proto::NumViolationReasons; ++i)
|
||||||
msg.getU8();
|
actions.push_back(msg.getU8());
|
||||||
|
g_game.processGMActions(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseLoginError(InputMessage& msg)
|
void ProtocolGame::parseLoginError(InputMessage& msg)
|
||||||
|
@ -754,19 +756,12 @@ void ProtocolGame::parsePlayerStats(InputMessage& msg)
|
||||||
double soul = msg.getU8();
|
double soul = msg.getU8();
|
||||||
double stamina = msg.getU16();
|
double stamina = msg.getU16();
|
||||||
|
|
||||||
if(!m_localPlayer) {
|
g_game.processPlayerStats(health, maxHealth,
|
||||||
logTraceError("there is no local player");
|
freeCapacity, experience,
|
||||||
return;
|
level, levelPercent,
|
||||||
}
|
mana, maxMana,
|
||||||
|
magicLevel, magicLevelPercent,
|
||||||
m_localPlayer->setHealth(health, maxHealth);
|
soul, stamina);
|
||||||
m_localPlayer->setFreeCapacity(freeCapacity);
|
|
||||||
m_localPlayer->setExperience(experience);
|
|
||||||
m_localPlayer->setLevel(level, levelPercent);
|
|
||||||
m_localPlayer->setMana(mana, maxMana);
|
|
||||||
m_localPlayer->setMagicLevel(magicLevel, magicLevelPercent);
|
|
||||||
m_localPlayer->setStamina(stamina);
|
|
||||||
m_localPlayer->setSoul(soul);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
||||||
|
@ -801,9 +796,25 @@ void ProtocolGame::parsePlayerCancelAttack(InputMessage& msg)
|
||||||
g_game.processAttackCancel();
|
g_game.processAttackCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProtocolGame::parseSpellDelay(InputMessage& msg)
|
||||||
|
{
|
||||||
|
msg.getU16(); // spell id
|
||||||
|
msg.getU16(); // cooldown
|
||||||
|
msg.getU8(); // unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::parseSpellGroupDelay(InputMessage& msg)
|
||||||
|
{
|
||||||
|
msg.getU16(); // spell id
|
||||||
|
msg.getU16(); // cooldown
|
||||||
|
msg.getU8(); // unknown
|
||||||
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
|
void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getU32(); // unkSpeak
|
msg.getU32(); // unknown
|
||||||
|
|
||||||
std::string name = msg.getString();
|
std::string name = msg.getString();
|
||||||
int level = msg.getU16();
|
int level = msg.getU16();
|
||||||
int serverType = msg.getU8();
|
int serverType = msg.getU8();
|
||||||
|
@ -888,6 +899,33 @@ void ProtocolGame::parseCloseChannel(InputMessage& msg)
|
||||||
g_game.processCloseChannel(channelId);
|
g_game.processCloseChannel(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ProtocolGame::parseRuleViolationChannel(InputMessage& msg)
|
||||||
|
{
|
||||||
|
int channelId = msg.getU16();
|
||||||
|
|
||||||
|
g_game.processRuleViolationChannel(channelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::parseRuleViolationRemove(InputMessage& msg)
|
||||||
|
{
|
||||||
|
std::string name = msg.getString();
|
||||||
|
|
||||||
|
g_game.processRuleViolationRemove(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::parseRuleViolationCancel(InputMessage& msg)
|
||||||
|
{
|
||||||
|
std::string name = msg.getString();
|
||||||
|
|
||||||
|
g_game.processRuleViolationCancel(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::parseRuleViolationLock(InputMessage& msg)
|
||||||
|
{
|
||||||
|
g_game.processRuleViolationLock();
|
||||||
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseTextMessage(InputMessage& msg)
|
void ProtocolGame::parseTextMessage(InputMessage& msg)
|
||||||
{
|
{
|
||||||
int type = msg.getU8();
|
int type = msg.getU8();
|
||||||
|
@ -989,8 +1027,8 @@ void ProtocolGame::parseVipLogout(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseTutorialHint(InputMessage& msg)
|
void ProtocolGame::parseTutorialHint(InputMessage& msg)
|
||||||
{
|
{
|
||||||
// ignored
|
int id = msg.getU8(); // tutorial id
|
||||||
msg.getU8(); // tutorial id
|
g_game.processTutorialHint(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseAutomapFlag(InputMessage& msg)
|
void ProtocolGame::parseAutomapFlag(InputMessage& msg)
|
||||||
|
|
|
@ -601,6 +601,39 @@ void ProtocolGame::sendRemoveVip(uint playerId)
|
||||||
send(msg);
|
send(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::sendBugReport(const std::string& comment)
|
||||||
|
{
|
||||||
|
OutputMessage msg;
|
||||||
|
msg.addU8(Proto::ClientBugReport);
|
||||||
|
msg.addString(comment);
|
||||||
|
send(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::sendRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
||||||
|
{
|
||||||
|
OutputMessage msg;
|
||||||
|
msg.addU8(Proto::ClientRuleViolation);
|
||||||
|
msg.addString(target);
|
||||||
|
msg.addU8(reason);
|
||||||
|
msg.addU8(action);
|
||||||
|
msg.addString(comment);
|
||||||
|
msg.addString(statement);
|
||||||
|
msg.addU16(statementId);
|
||||||
|
msg.addU8(ipBanishment);
|
||||||
|
send(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtocolGame::sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d)
|
||||||
|
{
|
||||||
|
OutputMessage msg;
|
||||||
|
msg.addU8(Proto::ClientDebugReport);
|
||||||
|
msg.addString(a);
|
||||||
|
msg.addString(b);
|
||||||
|
msg.addString(c);
|
||||||
|
msg.addString(d);
|
||||||
|
send(msg);
|
||||||
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendRequestQuestLog()
|
void ProtocolGame::sendRequestQuestLog()
|
||||||
{
|
{
|
||||||
OutputMessage msg;
|
OutputMessage msg;
|
||||||
|
|
Loading…
Reference in New Issue