Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2003, 12:47 PM
Eglin
Hill Giant
 
Join Date: Nov 2003
Posts: 168
Default diff - #findskill

A quick and dirty patch to add a "#findskill" command that mimics the functionality of #findspell or #finditem. Queries from a db table directly, rather than dumping into sharedmem at bootup.
Code:
diff -rubB ./eqemu/NewSource/common/database.cpp ./pristine-11-10/NewSource/common/database.cpp
--- ./eqemu/NewSource/common/database.cpp	Tue Nov 11 19:34:57 2003
+++ ./pristine-11-10/NewSource/common/database.cpp	Sun Nov  9 13:16:12 2003
@@ -6693,30 +6693,3 @@
 		DebugBreak();
 	}
 }
-
-bool Database::GetSkill(const char* name, std::map<int,std::string> &skills)
-{
-	char errbuf[MYSQL_ERRMSG_SIZE];
-	std::string query = "SELECT id,name FROM skillnames WHERE name like '%";
-	query += name;
-	query += "%'";
-	MYSQL_RES *result;
-	MYSQL_ROW row;
-	if(!RunQuery(query.c_str(), query.length(), errbuf, &result))
-	{
-		cerr << "Error in GetSkill query '" << query << "' " << errbuf << endl;
-		return false;
-	}
-	while((row = mysql_fetch_row(result)))
-	{
-		skills.insert(pair<int,std::string>(atoi(row[0]),row[1]));
-	}
-	mysql_free_result(result);
-	if(mysql_errno(&mysql))
-	{
-		cerr << "MySQL error while fetching GetSkill query results:'" << mysql_error(&mysql) << "' " << errbuf << endl;
-		return false;
-	}
-	return true;
-}
-
diff -rubB ./eqemu/NewSource/common/database.h ./pristine-11-10/NewSource/common/database.h
--- ./eqemu/NewSource/common/database.h	Tue Nov 11 18:39:16 2003
+++ ./pristine-11-10/NewSource/common/database.h	Sun Nov  9 13:16:04 2003
@@ -41,7 +41,6 @@
 #include "../zone/faction.h"
 #include "../zone/message.h"
 #include <string>
-#include <map>
 #ifdef GUILDWARS
 #include <map>
 #include <list>
@@ -262,8 +261,6 @@
 	bool	GetCharacterInfoForLogin(const char* name, uint32* character_id = 0, char* current_zone = 0, PlayerProfile_Struct* pp = 0, Inventory* inv = 0, uint32* pplen = 0, PlayerAA_Struct* aa = 0, uint32* aalen = 0, uint32* guilddbid = 0, int8* guildrank = 0);
 	bool	GetCharacterInfoForLogin_result(MYSQL_RES* result, uint32* character_id = 0, char* current_zone = 0, PlayerProfile_Struct* pp = 0, Inventory* inv = 0, uint32* pplen = 0, PlayerAA_Struct* aa = 0, uint32* aalen = 0, uint32* guilddbid = 0, int8* guildrank = 0);
 	bool	SetLocalPassword(uint32 accid, const char* password);
-	bool	GetSkill(const char* name, std::map<int,std::string> &skills);
-
 
 	bool	InsertNewsPost(int8 type,char* logone,char* logtwo,int32 levelone,int32 leveltwo);
 	
diff -rubB ./eqemu/NewSource/common/dbcore.h ./pristine-11-10/NewSource/common/dbcore.h
--- ./eqemu/NewSource/common/dbcore.h	Tue Nov 11 14:29:51 2003
+++ ./pristine-11-10/NewSource/common/dbcore.h	Sun Nov  9 13:15:58 2003
@@ -26,10 +26,10 @@
 	void	ping();
 protected:
 	bool	Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, int32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false);
-	MYSQL	mysql;
 private:
 	bool	Open(int32* errnum = 0, char* errbuf = 0);
 
+	MYSQL	mysql;
 	Mutex	MDatabase;
 	eStatus pStatus;
 
diff -rubB ./eqemu/NewSource/zone/command.cpp ./pristine-11-10/NewSource/zone/command.cpp
--- ./eqemu/NewSource/zone/command.cpp	Tue Nov 11 19:34:21 2003
+++ ./pristine-11-10/NewSource/zone/command.cpp	Sun Nov  9 13:15:11 2003
@@ -36,8 +36,6 @@
 
 #include <string.h>
 #include <stdlib.h>
-#include <vector>
-#include <utility>
 
 #ifdef WIN32
 #define strcasecmp _stricmp
@@ -301,7 +299,6 @@
 		command_add("itemsearch","[search criteria] - Search for an item",10,command_itemsearch) ||
 		command_add("search",NULL,0,command_itemsearch) ||
 		command_add("finditem",NULL,0,command_itemsearch) ||
-		command_add("findskill","[search criteria] - Search for a skill id number",0,command_findskill) ||
 		command_add("datarate","[rate] - Query/set datarate",0,command_datarate)
 	)
 	{
@@ -4443,25 +4440,6 @@
 		else
 			c->Message(0, "%i items found", count);
 #endif
-	}
-}
-
-void command_findskill(Client *c, const Seperator *sep)
-{
-	if (sep->arg[1][0] == 0)
-	{
-		c->Message(0, "Usage: #findskill [search string]");
-		return;
-	}
-	std::map<int,std::string> skills;
-	if(!database.GetSkill(sep->argplus[1], skills) || 0 == skills.size())
-	{
-		c->Message(0, "Skill %s not found", sep->argplus[1]);
-		return;
-	}
-	for(std::map<int,std::string>::const_iterator i = skills.begin(); i != skills.end(); ++i)
-	{
-		c->Message(0, "  %i: %s", i->first, i->second.c_str());
 	}
 }
 
diff -rubB ./eqemu/NewSource/zone/command.h ./pristine-11-10/NewSource/zone/command.h
--- ./eqemu/NewSource/zone/command.h	Tue Nov 11 14:20:52 2003
+++ ./pristine-11-10/NewSource/zone/command.h	Sun Nov  9 13:15:07 2003
@@ -202,7 +202,6 @@
 void command_d1(Client *c, const Seperator *sep);
 void command_summonitem(Client *c, const Seperator *sep);
 void command_itemsearch(Client *c, const Seperator *sep);
-void command_findskill(Client *c, const Seperator *sep);
 void command_datarate(Client *c, const Seperator *sep);
 void command_setaaxp(Client *c, const Seperator *sep);
 void command_setaapts(Client *c, const Seperator *sep);
skillnames.sql:
Code:
CREATE TABLE skillnames (id tinyint(3) NOT NULL, name varchar(255) NOT NULL default '', PRIMARY KEY (id), ) TYPE=MyISAM;

INSERT INTO skillnames VALUES (0,'1H Blunt');
INSERT INTO skillnames VALUES (1,'1H Slashing');
INSERT INTO skillnames VALUES (2,'2H Blunt');
INSERT INTO skillnames VALUES (3,'2H Slashing');
INSERT INTO skillnames VALUES (4,'Abjuration');
INSERT INTO skillnames VALUES (5,'Alteration');
INSERT INTO skillnames VALUES (6,'Apply Poison');
INSERT INTO skillnames VALUES (7,'Archery');
INSERT INTO skillnames VALUES (8,'Backstab');
INSERT INTO skillnames VALUES (9,'Bind Wound');
INSERT INTO skillnames VALUES (10,'Bash');
INSERT INTO skillnames VALUES (11,'Block');
INSERT INTO skillnames VALUES (12,'Brass Instruments');
INSERT INTO skillnames VALUES (13,'Channeling');
INSERT INTO skillnames VALUES (14,'Conjuration');
INSERT INTO skillnames VALUES (15,'Defense');
INSERT INTO skillnames VALUES (16,'Disarm');
INSERT INTO skillnames VALUES (17,'Disarm Traps');
INSERT INTO skillnames VALUES (18,'Divination');
INSERT INTO skillnames VALUES (19,'Dodge');
INSERT INTO skillnames VALUES (20,'Double Attack');
INSERT INTO skillnames VALUES (21,'Dragon Punch');
INSERT INTO skillnames VALUES (22,'Duel Wield');
INSERT INTO skillnames VALUES (23,'Eagle Strike');
INSERT INTO skillnames VALUES (24,'Evocation');
INSERT INTO skillnames VALUES (25,'Feign Death');
INSERT INTO skillnames VALUES (26,'Flying Kick');
INSERT INTO skillnames VALUES (27,'Forage');
INSERT INTO skillnames VALUES (28,'Hand To Hand');
INSERT INTO skillnames VALUES (29,'Hide');
INSERT INTO skillnames VALUES (30,'Kick');
INSERT INTO skillnames VALUES (31,'Meditate');
INSERT INTO skillnames VALUES (32,'Mend');
INSERT INTO skillnames VALUES (33,'Offense');
INSERT INTO skillnames VALUES (34,'Parry');
INSERT INTO skillnames VALUES (35,'Pick Lock');
INSERT INTO skillnames VALUES (36,'Piercing');
INSERT INTO skillnames VALUES (37,'Riposte');
INSERT INTO skillnames VALUES (38,'Round Kick');
INSERT INTO skillnames VALUES (39,'Safe Fall');
INSERT INTO skillnames VALUES (40,'Sense Heading');
INSERT INTO skillnames VALUES (41,'Sing');
INSERT INTO skillnames VALUES (42,'Sneak');
INSERT INTO skillnames VALUES (43,'Specialize Abjure');
INSERT INTO skillnames VALUES (44,'Specialize Alteration');
INSERT INTO skillnames VALUES (45,'Specialize Conjuration');
INSERT INTO skillnames VALUES (46,'Specialize Divinatation');
INSERT INTO skillnames VALUES (47,'Specialize Evocation');
INSERT INTO skillnames VALUES (48,'Pick Pockets');
INSERT INTO skillnames VALUES (49,'Stringed Instruments');
INSERT INTO skillnames VALUES (50,'Swimming');
INSERT INTO skillnames VALUES (51,'Throwing');
INSERT INTO skillnames VALUES (52,'Tiger Claw');
INSERT INTO skillnames VALUES (53,'Tracking');
INSERT INTO skillnames VALUES (54,'Wind Instruments');
INSERT INTO skillnames VALUES (55,'Fishing');
INSERT INTO skillnames VALUES (56,'Make Poison');
INSERT INTO skillnames VALUES (57,'Tinkering');
INSERT INTO skillnames VALUES (58,'Research');
INSERT INTO skillnames VALUES (59,'Alchemy');
INSERT INTO skillnames VALUES (60,'Baking');
INSERT INTO skillnames VALUES (61,'Tailoring');
INSERT INTO skillnames VALUES (62,'Sense Traps');
INSERT INTO skillnames VALUES (63,'Blacksmithing');
INSERT INTO skillnames VALUES (64,'Fletching');
INSERT INTO skillnames VALUES (65,'Brewing');
INSERT INTO skillnames VALUES (66,'Alcohol Tolerance');
INSERT INTO skillnames VALUES (67,'Begging');
INSERT INTO skillnames VALUES (68,'Jewelry Making');
INSERT INTO skillnames VALUES (69,'Pottery');
INSERT INTO skillnames VALUES (70,'Percussion Instruments');
INSERT INTO skillnames VALUES (71,'Intimidation');
INSERT INTO skillnames VALUES (72,'Berserking');
INSERT INTO skillnames VALUES (73,'Taunt');
Reply With Quote
  #2  
Old 11-11-2003, 01:48 PM
mattmeck
Guest
 
Posts: n/a
Default

This is realy usefull, I can think of a lot of instances where this would have come in handy. Like right after my wife cleans my desk and i have no clue where she put my lists for one :lol:
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:29 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3