mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-12-17 23:27:11 +01:00
first changes
This commit is contained in:
29
src/game.cpp
29
src/game.cpp
@@ -1866,6 +1866,11 @@ void Game::playerUseItemEx(uint32_t playerId, const Position& fromPos, uint8_t f
|
||||
return;
|
||||
}
|
||||
|
||||
bool isHotkey = (fromPos.x == 0xFFFF && fromPos.y == 0 && fromPos.z == 0);
|
||||
if (isHotkey && !g_config.getBoolean(ConfigManager::AIMBOT_HOTKEY_ENABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Thing* thing = internalGetThing(player, fromPos, fromStackPos, fromSpriteId, STACKPOS_USEITEM);
|
||||
if (!thing) {
|
||||
player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
|
||||
@@ -1934,7 +1939,7 @@ void Game::playerUseItemEx(uint32_t playerId, const Position& fromPos, uint8_t f
|
||||
player->resetIdleTime();
|
||||
player->setNextActionTask(nullptr);
|
||||
|
||||
g_actions->useItemEx(player, fromPos, toPos, toStackPos, item);
|
||||
g_actions->useItemEx(player, fromPos, toPos, toStackPos, item, isHotkey);
|
||||
}
|
||||
|
||||
void Game::playerUseItem(uint32_t playerId, const Position& pos, uint8_t stackPos,
|
||||
@@ -1945,6 +1950,11 @@ void Game::playerUseItem(uint32_t playerId, const Position& pos, uint8_t stackPo
|
||||
return;
|
||||
}
|
||||
|
||||
bool isHotkey = (pos.x == 0xFFFF && pos.y == 0 && pos.z == 0);
|
||||
if (isHotkey && !g_config.getBoolean(ConfigManager::AIMBOT_HOTKEY_ENABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Thing* thing = internalGetThing(player, pos, stackPos, spriteId, STACKPOS_USEITEM);
|
||||
if (!thing) {
|
||||
player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
|
||||
@@ -1989,7 +1999,7 @@ void Game::playerUseItem(uint32_t playerId, const Position& pos, uint8_t stackPo
|
||||
player->resetIdleTime();
|
||||
player->setNextActionTask(nullptr);
|
||||
|
||||
g_actions->useItem(player, pos, index, item);
|
||||
g_actions->useItem(player, pos, index, item, isHotkey);
|
||||
}
|
||||
|
||||
void Game::playerUseWithCreature(uint32_t playerId, const Position& fromPos, uint8_t fromStackPos, uint32_t creatureId, uint16_t spriteId)
|
||||
@@ -2004,13 +2014,16 @@ void Game::playerUseWithCreature(uint32_t playerId, const Position& fromPos, uin
|
||||
return;
|
||||
}
|
||||
|
||||
if (creature->getPlayer()) {
|
||||
player->sendCancelMessage(RETURNVALUE_DIRECTPLAYERSHOOT);
|
||||
if (!Position::areInRange<7, 5, 0>(creature->getPosition(), player->getPosition())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Position::areInRange<7, 5, 0>(creature->getPosition(), player->getPosition())) {
|
||||
return;
|
||||
bool isHotkey = (fromPos.x == 0xFFFF && fromPos.y == 0 && fromPos.z == 0);
|
||||
if (!g_config.getBoolean(ConfigManager::AIMBOT_HOTKEY_ENABLED)) {
|
||||
if (creature->getPlayer() || isHotkey) {
|
||||
player->sendCancelMessage(RETURNVALUE_DIRECTPLAYERSHOOT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Thing* thing = internalGetThing(player, fromPos, fromStackPos, spriteId, STACKPOS_USEITEM);
|
||||
@@ -2081,7 +2094,7 @@ void Game::playerUseWithCreature(uint32_t playerId, const Position& fromPos, uin
|
||||
player->resetIdleTime();
|
||||
player->setNextActionTask(nullptr);
|
||||
|
||||
g_actions->useItemEx(player, fromPos, creature->getPosition(), creature->getParent()->getThingIndex(creature), item, creature);
|
||||
g_actions->useItemEx(player, fromPos, creature->getPosition(), creature->getParent()->getThingIndex(creature), item, isHotkey, creature);
|
||||
}
|
||||
|
||||
void Game::playerCloseContainer(uint32_t playerId, uint8_t cid)
|
||||
@@ -2874,7 +2887,7 @@ void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit)
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->canWear(outfit.lookType)) {
|
||||
if (player->canWear(outfit.lookType, outfit.lookAddons)) {
|
||||
player->defaultOutfit = outfit;
|
||||
|
||||
if (player->hasCondition(CONDITION_OUTFIT)) {
|
||||
|
||||
Reference in New Issue
Block a user