mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 18:46:37 +00:00
Added trade hack detection code
This commit is contained in:
@@ -855,6 +855,7 @@ public:
|
||||
void SetConsumption(int32 in_hunger, int32 in_thirst);
|
||||
|
||||
bool CheckTradeLoreConflict(Client* other);
|
||||
bool CheckTradeNonDroppable();
|
||||
void LinkDead();
|
||||
void Insight(uint32 t_id);
|
||||
bool CheckDoubleAttack();
|
||||
|
||||
+20
-1
@@ -13287,7 +13287,6 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
|
||||
other->trade->state = TradeCompleting;
|
||||
trade->state = TradeCompleting;
|
||||
|
||||
// should we do this for NoDrop items as well?
|
||||
if (CheckTradeLoreConflict(other) || other->CheckTradeLoreConflict(this)) {
|
||||
Message_StringID(13, TRADE_CANCEL_LORE);
|
||||
other->Message_StringID(13, TRADE_CANCEL_LORE);
|
||||
@@ -13296,6 +13295,26 @@ void Client::Handle_OP_TradeAcceptClick(const EQApplicationPacket *app)
|
||||
other->trade->Reset();
|
||||
trade->Reset();
|
||||
}
|
||||
else if (CheckTradeNonDroppable()) {
|
||||
Message_StringID(13, TRADE_HAS_BEEN_CANCELLED);
|
||||
other->Message_StringID(13, TRADE_HAS_BEEN_CANCELLED);
|
||||
this->FinishTrade(this);
|
||||
other->FinishTrade(other);
|
||||
other->trade->Reset();
|
||||
trade->Reset();
|
||||
Message(15, "Hacking activity detected in trade transaction.");
|
||||
// TODO: query (this) as a hacker
|
||||
}
|
||||
else if (other->CheckTradeNonDroppable()) {
|
||||
Message_StringID(13, TRADE_HAS_BEEN_CANCELLED);
|
||||
other->Message_StringID(13, TRADE_HAS_BEEN_CANCELLED);
|
||||
this->FinishTrade(this);
|
||||
other->FinishTrade(other);
|
||||
other->trade->Reset();
|
||||
trade->Reset();
|
||||
other->Message(15, "Hacking activity detected in trade transaction.");
|
||||
// TODO: query (other) as a hacker
|
||||
}
|
||||
else {
|
||||
// Audit trade to database for both trade streams
|
||||
other->trade->LogTrade();
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
#define MEMBER_OF_YOUR_GUILD 1429
|
||||
#define OFFICER_OF_YOUR_GUILD 1430
|
||||
#define LEADER_OF_YOUR_GUILD 1431
|
||||
#define TRADE_HAS_BEEN_CANCELLED 1449
|
||||
#define RECEIVED_PLATINUM 1452 //You receive %1 Platinum from %2.
|
||||
#define RECEIVED_GOLD 1453 //You receive %1 Gold from %2.
|
||||
#define RECEIVED_SILVER 1454 //You receive %1 Silver from %2.
|
||||
|
||||
+27
-13
@@ -967,23 +967,37 @@ bool Client::CheckTradeLoreConflict(Client* other)
|
||||
{
|
||||
if (!other)
|
||||
return true;
|
||||
// Move each trade slot into free inventory slot
|
||||
for (int16 i = EQEmu::legacy::TRADE_BEGIN; i <= EQEmu::legacy::TRADE_END; i++){
|
||||
const EQEmu::ItemInstance* inst = m_inv[i];
|
||||
|
||||
if (inst && inst->GetItem()) {
|
||||
if (other->CheckLoreConflict(inst->GetItem()))
|
||||
return true;
|
||||
}
|
||||
for (int16 index = EQEmu::legacy::TRADE_BEGIN; index <= EQEmu::legacy::TRADE_END; ++index) {
|
||||
const EQEmu::ItemInstance* inst = m_inv[index];
|
||||
if (!inst || !inst->GetItem())
|
||||
continue;
|
||||
|
||||
if (other->CheckLoreConflict(inst->GetItem()))
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int16 i = EQEmu::legacy::TRADE_BAGS_BEGIN; i <= EQEmu::legacy::TRADE_BAGS_END; i++){
|
||||
const EQEmu::ItemInstance* inst = m_inv[i];
|
||||
for (int16 index = EQEmu::legacy::TRADE_BAGS_BEGIN; index <= EQEmu::legacy::TRADE_BAGS_END; ++index) {
|
||||
const EQEmu::ItemInstance* inst = m_inv[index];
|
||||
if (!inst || !inst->GetItem())
|
||||
continue;
|
||||
|
||||
if (inst && inst->GetItem()) {
|
||||
if (other->CheckLoreConflict(inst->GetItem()))
|
||||
return true;
|
||||
}
|
||||
if (other->CheckLoreConflict(inst->GetItem()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Client::CheckTradeNonDroppable()
|
||||
{
|
||||
for (int16 index = EQEmu::legacy::TRADE_BEGIN; index <= EQEmu::legacy::TRADE_END; ++index){
|
||||
const EQEmu::ItemInstance* inst = m_inv[index];
|
||||
if (!inst)
|
||||
continue;
|
||||
|
||||
if (!inst->IsDroppable())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user