EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   share bank dupe prevent (https://www.eqemulator.org/forums/showthread.php?t=29596)

tsowl 09-19-2009 04:26 AM

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);


cavedude 09-27-2009 12:39 PM

Added to revision 995.


All times are GMT -4. The time now is 05:13 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.