View Single Post
  #5  
Old 05-02-2016, 04:16 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Quote:
After testing some more,I found that bard's songs could cause bugs ("you missed a note" instead of "your spell fizzle"), not sure for tanks tomes but better remove it too ..
Not exactly sure what you mean by this statement.


Quote:
Also when you put 65535 as item.class for spells scroll it shows ingame on it with all classes and a bunch of 255 for those that can't use it.
`item`.`classes` is a bitmask of the allowed classes and not an actual class value.

By changing `item`.`class` .. you are altering what classes can 'access' the item..but, not what classes can use the spell. This would explain the '255'
values you are seeing and is not unexpected.

To properly create a bitmask (in this case,) you would take the class id and subtract 1 (since it is a 1-based index,) then left bit-shift 1 by that
amount. Finally, you would bitwise-or each value to attain the final result.

Code:
int final_bitmask = 0;
int warrior_id = 1, warrior_bit = 0;
int paladin_id = 3, paladin_bit = 0;
int shadowknight_id = 5, shadowknight_bit = 0;

warrior_bit = (1 << (warrior_id - 1)); // 1 << 0 = 1
paladin_bit = (1 << (paladin_id - 1)); // 1 << 2 = 4
shadowknight_bit = (1 << (shadowknight_bit - 1)); // 1 << 4 = 16

final_bitmask = (warrior_bit | paladin_bit | shadowknight_bit); // 1 | 4 | 16 = 21

[(final_bitmask == 21) = true]

Code:
update items, spells_new set classes=classes+4096 WHERE
items.scrolleffect = spells_new.id AND
items.classes <> 4096 AND
spells_new.classes13 = 255 AND
items.`Name` LIKE '%spell:%'
Scenario:

`item`.`classes` = 4097 (warrior and magician)

[update triggered because `classes` > 4096]
4097 + 4096 = 8193 (warrior and enchanter)


Also, by setting the item to be usable by class '4096' where `classes13` = 255, you only allow them access to the item, not the spell.

You would need to change `classes13`to a usable level for them to be able to use the actual spell and not just the item.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote