Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2015, 10:47 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default Pickpocketing weapons

So I'm not much of a programmer. Let me just add that up front...

I've had reports of rogues being able to pickpocket weapons right off an NPC. In an effort to try to fix it, I've come up with the following in zone/npc.cpp:

Code:
bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false;
                                int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow);
                                bool is_weapon = ((item->ItemType == ItemType1HSlash) == true) || ((item->ItemType == ItemType2HSlash) == true) || ((item->ItemType == ItemType1HPiercing) == true) || ((item->ItemType == ItemType1HBlunt) == true) || ((item->ItemType == ItemType2HBlunt) == true) || ((item->ItemType == ItemType2HPiercing) == true);
                                if (/*!Equipped(item->ID) &&*/
                                        !item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != INVALID_INDEX && is_weapon == false
Now, I realize it's entirely likely I haven't done anything but add useless lines of code here. Can somebody with more than zero skills let me know if what I put here will work?

Also, I'm sure there's a better way than checking against all the weapon types, so if there's something more efficient please do tell.

Thanks!
Reply With Quote
  #2  
Old 07-17-2015, 11:30 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

The best way to see if this will work is compile it in your own source and test it.
Reply With Quote
  #3  
Old 07-17-2015, 11:33 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Should change is_weapon into a ternary like how is_arrow is written above would look like this... (hopefully no typos here... I just woke up :p)

Code:
bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false;
                                int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow);
                                bool is_weapon = (item->ItemType == ItemType1HSlash || item->ItemType == ItemType2HSlash || item->ItemType == ItemType1HPiercing || item->ItemType == ItemType1HBlunt || item->ItemType == ItemType2HBlunt || item->ItemType == ItemType2HPiercing) ? true : false;
				if (/*!Equipped(item->ID) &&*/
                                        !item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != INVALID_INDEX && !is_weapon
Reply With Quote
  #4  
Old 07-18-2015, 12:30 AM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

Thanks! I knew there had to be a better way. I just basically monkeyed through the syntax until it compiled.
Reply With Quote
Reply


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 08:56 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