Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bug Reports

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 07-28-2012, 05:20 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

I always forget to check for 'null' values on new stuff..usually that is already done...

I also changed the pointer reference when I was trying to figure this out..it currently works, but it could have the other way as well... (didn't check it.)


This is an ALPHA patch as well since it more proof of concept than a finished product.

[CSD Patch 2]
Code:
Index: client_packet.cpp
===================================================================
--- client_packet.cpp	(revision 2173)
+++ client_packet.cpp	(working copy)
@@ -3278,6 +3278,8 @@
 	return;
 }
 
+// 'CSD 11' - Added checks for illegal bagslot swaps..should help with certain cheats
+// - If a player has used a cheat that allows illegal item placement, they could beomce bugged at some point (especially lore items.)
 void Client::Handle_OP_MoveItem(const EQApplicationPacket *app)
 {
 	if(!CharacterID())
@@ -3291,6 +3293,7 @@
 	}
 
 	MoveItem_Struct* mi = (MoveItem_Struct*)app->pBuffer;
+
 	if(spellend_timer.Enabled() && casting_spell_id && !IsBardSong(casting_spell_id))
 	{
 		if(mi->from_slot != mi->to_slot && (mi->from_slot < 30 || mi->from_slot > 39) && IsValidSlot(mi->from_slot) && IsValidSlot(mi->to_slot))
@@ -3310,6 +3313,58 @@
 			return;
 		}
 	}
+
+	//* REMOVE OR REMARK OUT BEGIN FOR ALLOWING ILLEGAL BAGSLOT USE
+	bool hackflag = false;
+
+	if (mi->from_slot >=251 && mi->from_slot <=340) {
+		if (mi->from_slot > 330)
+			hackflag = true; // why are we moving from a cursor bagslot when you can't open it?
+		else {			
+			sint16 from_invslot = this->m_inv.CalcSlotId(mi->from_slot);
+			const ItemInst *from_invslotitem = GetInv().GetItem(from_invslot); 
+
+			if (!from_invslotitem) { // trying to move from bag slots when parent inventory slot is empty
+				hackflag = true;
+			}
+			else if (from_invslotitem->GetItem()->ItemClass==1) { // checking the parent inventory slot for container
+				if (this->m_inv.CalcBagIdx(mi->from_slot) > (from_invslotitem->GetItem()->BagSlots - 1))
+					hackflag = true; // trying to move from slots beyond parent container size
+			}
+			else { // trying to move from bag slots when inventory slot item is not a container
+				hackflag = true;
+			}
+		}
+	}
+
+	if (mi->to_slot >= 251 && mi->to_slot <=340) {
+		if (mi->to_slot > 330)
+			hackflag = true; // why are we moving to a cursor bagslot when you can't open it?
+		else {
+			sint16 to_invslot = this->m_inv.CalcSlotId(mi->to_slot);
+			const ItemInst *to_invslotitem = GetInv().GetItem(to_invslot);
+
+			if (!to_invslotitem) { // trying to move into bag slots when parent inventory slot is empty
+				hackflag = true;
+			}
+			else if (to_invslotitem->GetItem()->ItemClass==1) { // checking the parent inventory slot for container
+				if (this->m_inv.CalcBagIdx(mi->from_slot) > (to_invslotitem->GetItem()->BagSlots - 1))
+					hackflag = true; // trying to move into slots beyond parent container size
+			}
+			else { // trying to move into bag slots when inventory slot item is not a container
+				hackflag = true;
+			}
+		}
+	}
+
+	if (hackflag) {
+		Message(13, "Hack attempt detected: Illegal use of inventory bagslots!");
+		// TODO: Decide whether to log player as hacker
+		// Kick();
+		// return;
+	}
+	// REMOVE OR REMARK OUT END FOR ALLOWING ILLEGAL BAGSLOT USE */
+
 	SwapItem(mi);
 	return;
 }

Still looking for feedback
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:00 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3