Go Back   EQEmulator Home > EQEmulator Forums > Misc > Misc::Off Topic

Misc::Off Topic Want to talk about something that has nothing to do with EverQuest or the emulator? Post here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 10-22-2011, 07:42 PM
revloc02c's Avatar
revloc02c
Hill Giant
 
Join Date: Aug 2010
Location: UT
Posts: 215
Default

I did it more because I found the problem interesting rather than the solution being useful (and the problem was rather intriguing...some say I'm a geek that way). But since it's done I might as well post it:
Code:
-- ----------------------------
-- Function structure for `fn_displayClasses`
-- ----------------------------
DROP FUNCTION IF EXISTS `fn_displayClasses`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `fn_displayClasses`(classes int) RETURNS varchar(128) CHARSET utf8
BEGIN
	-- receives bitmask number for classes and converts it to a list of classes
	DECLARE classList VARCHAR(128);
	SET classList = "";

	IF (classes & 1) = 1 THEN
		SET classList = CONCAT(classList, "Warrior, ");
	END IF;
	IF (classes & 2) = 2 THEN
		SET classList = CONCAT(classList, "Cleric, ");
	END IF;
	IF (classes & 4) = 4 THEN
		SET classList = CONCAT(classList, "Paladin, ");
	END IF;
	IF (classes & 8) = 8 THEN
		SET classList = CONCAT(classList, "Ranger, ");
	END IF;
	IF (classes & 16) = 16 THEN
		SET classList = CONCAT(classList, "Shadow Knight, ");
	END IF;
	IF (classes & 32) = 32 THEN
		SET classList = CONCAT(classList, "Druid, ");
	END IF;
	IF (classes & 64) = 64 THEN
		SET classList = CONCAT(classList, "Monk, ");
	END IF;
	IF (classes & 128) = 128 THEN
		SET classList = CONCAT(classList, "Bard, ");
	END IF;
	IF (classes & 256) = 256 THEN
		SET classList = CONCAT(classList, "Rogue, ");
	END IF;
	IF (classes & 512) = 512 THEN
		SET classList = CONCAT(classList, "Shaman, ");
	END IF;
	IF (classes & 1024) = 1024 THEN
		SET classList = CONCAT(classList, "Necromancer, ");
	END IF;
	IF (classes & 2048) = 2048 THEN
		SET classList = CONCAT(classList, "Wizard, ");
	END IF;
	IF (classes & 4096) = 4096 THEN
		SET classList = CONCAT(classList, "Magician, ");
	END IF;
	IF (classes & 8192) = 8192 THEN
		SET classList = CONCAT(classList, "Enchanter, ");
	END IF;
	IF (classes & 16384) = 16384 THEN
		SET classList = CONCAT(classList, "Beastlord, ");
	END IF;
	IF (classes & 32768) = 32768 THEN
		SET classList = CONCAT(classList, "Berserker, ");
	END IF;

	RETURN classList;

END
;;
DELIMITER ;
I write and run a lot of SQL queries, so having a function that displays classes is something I will use. Didn't really need it, but it was fun to figure out. Maybe someone will want to use it...for something. Cheers.
Reply With Quote
 


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 06:25 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