Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2014, 04:28 PM
Nydosa's Avatar
Nydosa
Sarnak
 
Join Date: Jan 2013
Posts: 61
Default Add/remove classes from items (database)

I am hoping someone can help me figure out an easy way to either add or remove a class from the bitmask 'classes' in the items table. Is there another way of getting Navicat to look and edit classes based on the bitmask?

For example, how could you add 'warrior', =1, to every item, but exclude the one it's already on?

I'm trying to avoid making items all/all here, even though that would be much easier.

Thank you!
Reply With Quote
  #2  
Old 01-10-2014, 04:47 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Add: where 'slots' & 1 = 0 set 'slots' = 'slots' | 1

Remove: where 'slots' & 1 = 1 set 'slots' = 'slots' ^ 1


Someone with more sql experience may want to translate that. My sql from memory is horrible.


EDIT: fixed Add error
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #3  
Old 01-10-2014, 04:49 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Select * from items where classes & 1

Inside navicat will find all items that can be used by warriors even the multi class items

Google bitwise operators to find how to use them in sql it should help a lot
Reply With Quote
  #4  
Old 01-10-2014, 08:05 PM
Nydosa's Avatar
Nydosa
Sarnak
 
Join Date: Jan 2013
Posts: 61
Default

Awesome! Thanks guys.
Reply With Quote
  #5  
Old 01-11-2014, 02:38 PM
Maceblade
Hill Giant
 
Join Date: Jun 2010
Posts: 231
Default

Code:
UPDATE items SET classes = 1 where classes > 1;
Would literally make every item in the game warrior useable and not look at the ones its already capable of wearing.
Reply With Quote
  #6  
Old 01-11-2014, 06:36 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,595
Default

Quote:
Originally Posted by Maceblade View Post
Code:
UPDATE items SET classes = 1 where classes > 1;
Would literally make every item in the game warrior useable and not look at the ones its already capable of wearing.
That would make Warriors the only ones capable of using any item in the game.
Reply With Quote
  #7  
Old 01-12-2014, 02:28 AM
Nydosa's Avatar
Nydosa
Sarnak
 
Join Date: Jan 2013
Posts: 61
Default

Yeah - just for anyone's reference in the future, the correct code is:
---
Add: where 'slots' & 1 = 0 set 'slots' = 'slots' | 1

Remove: where 'slots' & 1 = 1 set 'slots' = 'slots' ^ 1
---

This will add/remove warrior. Classes beyond warrior, or races beyond human, would go by the item table number (2,4,8...).

Very useful code for those who want to expand class/race restrictions, but don't want to make items all/all.
Reply With Quote
  #8  
Old 01-12-2014, 07:47 PM
Maceblade
Hill Giant
 
Join Date: Jun 2010
Posts: 231
Default

You are right my apologies DO NOT use what I posted.
Reply With Quote
  #9  
Old 01-21-2014, 01:08 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default

Correct, you need to use bitmasks in sql.

Step #1. Back up, back up, back up.

Step #2. Science!

Somewhat recently I went through and removed gnomes and halflings pal/sk/rng respectively.

Here's the thread with some explanation and sql example for people in the future that might want to see a select/update example.
http://www.project1999.com/forums/sh...494#post785494

I hope it helps.
__________________
https://www.project1999.com
Reply With Quote
  #10  
Old 01-21-2014, 01:47 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,595
Default

I use this.
Code:
SELECT * FROM items WHERE classes & [class bitmask];
Example, items that Berserkers use.
Code:
SELECT * FROM items WHERE classes & 32768;
Here's a wiki for you, Nydosa, on bitwise operators.
Code:
Operator    Meaning
&           Bitwise AND.
|           Bitwise OR.
^           Bitwise exclusive OR.
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 11:23 PM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3