EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Add/remove classes from items (database) (https://www.eqemulator.org/forums/showthread.php?t=37722)

Nydosa 01-10-2014 04:28 PM

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!

Uleat 01-10-2014 04:47 PM

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

NatedogEZ 01-10-2014 04:49 PM

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

Nydosa 01-10-2014 08:05 PM

Awesome! Thanks guys.

Maceblade 01-11-2014 02:38 PM

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.

Kingly_Krab 01-11-2014 06:36 PM

Quote:

Originally Posted by Maceblade (Post 227583)
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.

Nydosa 01-12-2014 02:28 AM

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.

Maceblade 01-12-2014 07:47 PM

You are right my apologies DO NOT use what I posted.

nilbog 01-21-2014 01:08 PM

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.

Kingly_Krab 01-21-2014 01:47 PM

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.



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

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