Emm, can you write easier? What should i change? This?
Code:addGameTask(&Game::playerSetFightModes, player->getID(), fightMode, rawChaseMode != 0, rawSecureMode != 0);
sendFightModes();
Emm, can you write easier? What should i change? This?
Code:addGameTask(&Game::playerSetFightModes, player->getID(), fightMode, rawChaseMode != 0, rawSecureMode != 0);
sendFightModes();
and 1.2? i want it to stay opennedEmm where did you even get that code haha?
Well if you always want it to be "on" then just change this; forgottenserver/protocolgame.cpp at 68ab2c606782fe9a38c5a0013a0df25588cabe26 · otland/forgottenserver · GitHub
To true, then here; forgottenserver/protocolgame.cpp at 68ab2c606782fe9a38c5a0013a0df25588cabe26 · otland/forgottenserver · GitHub
WriteC++:sendFightModes();
and 1.2? i want it to stay openned
it didn't work for my idk ( i have tfs 1.2 with protocolgame.cpp / protocolgamebase.cpp and their .h ) and id didn't work for me at all :S tried too many times and idk what do you mean with this xD can you explain more ?Most likely the same, if you encounter any diffrences just quote this post.
still there?Most likely the same, if you encounter any diffrences just quote this post.
Is there any function to check the status of the secure mode? Thx
it didn't work for my idk ( i have tfs 1.2 with protocolgame.cpp / protocolgamebase.cpp and their .h ) and id didn't work for me at all :S tried too many times and idk what do you mean with this xD can you explain more ?
Bump
still there?
no there is no errors but i found some lines in another places let me show you me my secure mode codes and its places,otland/forgottenserver
Any errors when you compile? Any errors when you start the server?
Otherwise you have to check if there are any differences with the code.
Make sure to read the rules; OtLand - The Official Rules for OTLand
void ProtocolGame::parseFightModes(NetworkMessage& msg)
{
uint8_t rawFightMode = msg.getByte(); // 1 - offensive, 2 - balanced, 3 - defensive
uint8_t rawChaseMode = msg.getByte(); // 0 - stand while fightning, 1 - chase opponent
uint8_t rawSecureMode = msg.getByte(); // 0 - can't attack unmarked, 1 - can attack unmarked
// uint8_t rawPvpMode = msg.getByte(); // pvp mode introduced in 10.0
chaseMode_t chaseMode;
if (rawChaseMode == 1) {
chaseMode = CHASEMODE_FOLLOW;
} else {
chaseMode = CHASEMODE_STANDSTILL;
}
fightMode_t fightMode;
if (rawFightMode == 1) {
fightMode = FIGHTMODE_ATTACK;
} else if (rawFightMode == 2) {
fightMode = FIGHTMODE_BALANCED;
} else {
fightMode = FIGHTMODE_DEFENSE;
}
addGameTask(&Game::playerSetFightModes, player->getID(), fightMode, chaseMode, rawSecureMode != 0);
}
void ProtocolGame::sendFightModes()
{
NetworkMessage msg;
msg.addByte(0xA7);
msg.addByte(player->fightMode);
msg.addByte(player->chaseMode);
msg.addByte(player->secureMode);
msg.addByte(PVP_MODE_DOVE);
writeToOutputBuffer(msg);
}
void sendFightModes();
secureMode = false;
void Game::playerSetFightModes(uint32_t playerId, fightMode_t fightMode, chaseMode_t chaseMode, bool secureMode)
{
Player* player = getPlayerByID(playerId);
if (!player) {
return;
}
player->setFightMode(fightMode);
player->setChaseMode(chaseMode);
player->setSecureMode(secureMode);
}
void playerSetFightModes(uint32_t playerId, fightMode_t fightMode, chaseMode_t chaseMode, bool secureMode);
bool hasSecureMode() const {
return secureMode;
}