View Single Post
  #1  
Old 09-19-2009, 04:26 AM
tsowl
Fire Beetle
 
Join Date: Jul 2004
Posts: 8
Default share bank dupe prevent

there are two ways to dupe items with shared bank

zone/inventory.cpp
Code:
	if (!src_inst && (src_slot_id<4000 || src_slot_id>4009)) {
		if (GetClientVersion() != EQClientSoF)  // SoF client sends invalid slots regularly for an unknown use, so don't warn them about this.
			Message(13, "Error: Server found no item in slot %i (->%i), Deleting Item!", src_slot_id, dst_slot_id);

		LogFile->write(EQEMuLog::Debug, "Error: Server found no item in slot %i (->%i), Deleting Item!", src_slot_id, dst_slot_id);
-		this->DeleteItemInInventory(dst_slot_id,0,true);
+		this->DeleteItemInInventory(src_slot_id,0,true);
		return false;
	}
	//verify shared bank transactions in the database
	if(src_inst && src_slot_id >= 2500 && src_slot_id <= 2550) {
		if(!database.VerifyInventory(account_id, src_slot_id, src_inst)) {
			LogFile->write(EQEMuLog::Error, "Player %s on account %s was found exploiting the shared bank. They have been banned until further review.\n", account_name, GetName());
			DeleteItemInInventory(dst_slot_id,0,true);
			return(false);
		}
+		if(src_slot_id >= 2500 && src_slot_id <= 2501 && src_inst->IsType(ItemClassContainer)){
+			for (uint8 idx=0; idx<10; idx++) {
+				const ItemInst* baginst = src_inst->GetItem(idx);
+				if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(src_slot_id, idx), baginst)){
+					DeleteItemInInventory(Inventory::CalcSlotId(src_slot_id, idx),0,false);
+				}
+			}
+		}
	}
+	if(dst_inst && dst_slot_id >= 2500 && dst_slot_id <= 2550) {
+		if(!database.VerifyInventory(account_id, dst_slot_id, dst_inst)) {
+			LogFile->write(EQEMuLog::Error, "Player %s on account %s was found exploting the shared bank. They have been banned until further review.\n", account_name, GetName());
+			DeleteItemInInventory(src_slot_id,0,true);
+			return(false);
+		}
+		if(dst_slot_id >= 2500 && dst_slot_id <= 2501 && dst_inst->IsType(ItemClassContainer)){
+			for (uint8 idx=0; idx<10; idx++) {
+				const ItemInst* baginst = dst_inst->GetItem(idx);
+				if(baginst && !database.VerifyInventory(account_id, Inventory::CalcSlotId(dst_slot_id, idx), baginst)){
+					DeleteItemInInventory(Inventory::CalcSlotId(dst_slot_id, idx),0,false);
+				}
+			}
+		}
+	}

common/shareddb.cpp (change not necessary)
Code:
-				ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND slotid>=%i AND slotid<%i",
-					char_id, base_slot_id, (base_slot_id+10)), errbuf);*/
+				ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM sharedbank WHERE acctid=%i AND slotid>=%i AND slotid<%i",
+					account_id, base_slot_id, (base_slot_id+10)), errbuf);
Reply With Quote