rendered paste bodyIndex: branches/1_7_stable/src/game/Chat.cpp===================================================================--- branches/1_7_stable/src/game/Chat.cpp (revision 1839)+++ branches/1_7_stable/src/game/Chat.cpp (working copy)@@ -525,6 +525,7 @@ { "reloadaccounts", 'z', &ChatHandler::HandleReloadAccountsCommand, "Reloads accounts on logon server.", NULL, 0, 0, 0 }, { "lookupitem", 'l', &ChatHandler::HandleLookupItemCommand, "Looks up item string x.", NULL, 0, 0, 0 }, { "lookupcreature", 'l', &ChatHandler::HandleLookupCreatureCommand, "Looks up item string x.", NULL, 0, 0, 0 },+ { "lookupspell", 'l', &ChatHandler::HandleLookupSpellCommand, "Looks up spell string x.", NULL, 0, 0, 0 }, { "reloadscripts", 'w', &ChatHandler::HandleReloadScriptsCommand, "Reloads GM Scripts", NULL, 0, 0, 0 }, { "silentplayer", 't', &ChatHandler::HandleSilentPlayerCommand, "Player cannot chat for x minutes <duration> (default 5 minutes)", NULL, 0, 0, 0 }, { "changepassword", 'z', &ChatHandler::HandleChangePasswordCommand, "Changes your accounts password.", NULL, 0, 0, 0 },Index: branches/1_7_stable/src/game/Level1.cpp===================================================================--- branches/1_7_stable/src/game/Level1.cpp (revision 1839)+++ branches/1_7_stable/src/game/Level1.cpp (working copy)@@ -218,6 +218,40 @@ return true; } +char* extractKeyFromLink(char* text, char const* linkType)+{+ // skip empty+ if(!text && !*text)+ return NULL;++ // return non link case+ if(text[0]!='|')+ return strtok(text, " ");++ // [name] Shift-click form |color|linkType:key|h[name]|h|r+ // or+ // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r++ char* check = strtok(text, "|");+ if(!check)+ return NULL; ++ char* cLinkType = strtok(NULL, ":"); + if(!cLinkType)+ return NULL; ++ if(strcmp(cLinkType,linkType) != 0)+ {+ strtok(NULL, " "); + return NULL;+ }++ char* cKey = strtok(NULL, ":|"); + strtok(NULL, "]"); + strtok(NULL, " "); + return cKey;+}+ bool ChatHandler::HandleAddInvItemCommand(const char *args, WorldSession *m_session) { if(strlen(args) < 1)@@ -226,6 +260,12 @@ } int itemid = atoi(strtok((char*)args, " "));++ if (itemid == 0)+ {+ itemid = atoi(extractKeyFromLink((char*)args,"Hitem"));+ }+ uint32 count = 1; char *cCount = strtok(NULL, "\n"); if(cCount) count = atoi(cCount);Index: branches/1_7_stable/src/game/Level3.cpp===================================================================--- branches/1_7_stable/src/game/Level3.cpp (revision 1839)+++ branches/1_7_stable/src/game/Level3.cpp (working copy)@@ -2650,9 +2650,9 @@ string x = string(args); transform(x.begin(), x.end(), x.begin(), towlower);- if(x.length() < 4)+ if(x.length() < 2) {- RedSystemMessage(m_session, "Your search string must be at least 5 characters long.");+ RedSystemMessage(m_session, "Your search string must be at least 2 characters long."); return true; } @@ -2667,12 +2667,50 @@ it = itr->Get(); if(FindXinYString(x, it->lowercase_name)) {- // Print out the name in a cool highlighted fashion- SendHighlightedName(m_session, it->Name1, it->lowercase_name, x, it->ItemId, true);+ //query db for quality... ffs i wish quality function workd.+ QueryResult *result = WorldDatabase.Query("SELECT `Quality` FROM `items` WHERE `entry` = %u",it->ItemId);+ Field *quality = result->Fetch();+ uint32 iquality = quality[0].GetUInt32();+ // Print out the name in linked colour format..... + switch (iquality)+ {+ case 0:+ SystemMessage(m_session,"%u - |cff9d9d9d|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;++ case 1:+ SystemMessage(m_session,"%u - |cffffffff|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;++ case 2:+ SystemMessage(m_session,"%u - |cff1eff00|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;++ case 3:+ SystemMessage(m_session,"%u - |cff0070dd|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;++ case 4:+ SystemMessage(m_session,"%u - |cffa335ee|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;++ case 5:+ SystemMessage(m_session,"%u - |cffff8000|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;++ case 6:+ SystemMessage(m_session,"%u - |cffe6cc80|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break; ++ default:+ SystemMessage(m_session,"%u - |cffff0000|Hitem:%u:0:0:0:0:0:0:0|h[%s]|h|r",it->ItemId,it->ItemId,it->Name1);+ break;+ }+ ++count;- if(count == 25)+ if(count == 255) {- RedSystemMessage(m_session, "More than 25 results returned. aborting.");+ RedSystemMessage(m_session, "More than 255 results returned. aborting."); break; } }@@ -2728,6 +2766,36 @@ return true; } +bool ChatHandler::HandleLookupSpellCommand(const char* args, WorldSession *m_session)+{+ WorldPacket data;+ + if(!*args)+ return false;++ char spl[100];+ strcpy(spl,"%");+ strcat(spl,(char*)args);+ strcat(spl,"%");++ QueryResult *result = WorldDatabase.Query("SELECT `ID`,`Name`,`Rank` FROM `spells112` WHERE `Name` LIKE '%s' ORDER BY `ID` ASC",spl);+ SystemMessage(m_session,"|cffcc9966 ID: - Name: - Attribute:|r");++ if (result)+ {+ do+ {+ Field *fields = result->Fetch();+ SystemMessage(m_session,"|cffff6060 [%s]|r - [%s] - [%s]",fields[0].GetString(),fields[1].GetString(),fields[2].GetString());++ } while (result->NextRow());++ delete result;+ }++ SystemMessage(m_session,"|cffff0000[Matches for keyword: %s]",(char*)args);+ return true;+} bool ChatHandler::HandleReloadAccountsCommand(const char * args, WorldSession * m_session) { BlueSystemMessage(m_session, "Instructing logonserver to reload accounts...");