Welcome to AC Web.
Results 1 to 10 of 10
  1. #1

    Arrow [RELEASE] Add new function to '.lookup item' command


    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Well,

    I found myself working with the '.lo item' command, and since you cannot find items by linking them on chat (shift-click item) I added it.







    I want to share with you in case, someone needs it:

    1. Open 'cs_lookup.cpp' file (inside Trinity Core project (solution)).
    2. Press 'Ctrl + F' to open the Find window.
    3. Search for:
      Code:
      // converting string that we try to find to lower case
              if (!Utf8toWStr(namePart, wNamePart))
      You should see something like this:
      Code:
              std::string namePart = args;
              std::wstring wNamePart;
      
              // converting string that we try to find to lower case
              if (!Utf8toWStr(namePart, wNamePart))
                  return false;
    4. Now let's add the conversion in case we linking the Item to lookup.
      Add these lines in the code:
      Code:
              //  if item is linked item (shift-click) then extract [name] without []!
              if (args[0] == '|')
              {
                  char* extract = strstr((char*)args, "[");
                  char* extracted = strtok(extract + 1, "]");
      
                  namePart = extracted;
              }
    5. Your code now should look like this:
      Code:
              std::string namePart = args;
              std::wstring wNamePart;
      
              //  if item is linked item (shift-click) then extract [name] without []!
              if (args[0] == '|')
              {
                  char* extract = strstr((char*)args, "[");
                  char* extracted = strtok(extract + 1, "]");
      
                  namePart = extracted;
              }
      
              // converting string that we try to find to lower case
              if (!Utf8toWStr(namePart, wNamePart))
                  return false;
    6. Compile your solution and execute your server, now you can '.lo item' by linking an item (shift-click item).



    List of molinita's releases:
    Last edited by molinita; 07-01-2020 at 06:10 PM.

  2. #2


    Join Date
    Dec 2019
    Location
    cybermist2.github.io
    Posts
    190
    Very nice, thank you for sharing.

  3. #3
    Quote Originally Posted by Cyber Mist View Post
    Very nice, thank you for sharing.
    You're welcome.

  4. #4
    Light of the Crusade

    Join Date
    Dec 2010
    Location
    Light's Hope
    Posts
    1,410
    It would be helpful to specify the file you're editing rather than search through the whole solution.

    Nonetheless good one!

  5. #5
    Quote Originally Posted by Nerc View Post
    It would be helpful to specify the file you're editing rather than search through the whole solution.

    Nonetheless good one!
    Well, Ctrl+F just takes few seconds to find it. But good advice indeed, Ima add it. I think file name is 'cs_misc.cpp'

    - - - Updated - - -

    File name added.

    'cs_lookup.cpp'
    Last edited by molinita; 04-11-2020 at 09:07 PM.

  6. #6
    +rep from me! good job!

  7. #7
    Quote Originally Posted by revolve1 View Post
    +rep from me! good job!
    I'm glad you found this useful.

  8. #8
    <Dev>

    Join Date
    Mar 2013
    Location
    https://deathshrine.com
    Posts
    786
    Have not tested it myself, will do it later. How does it function if your server has custom items with different color codes, like |cffFF0000Bow of Wrath|r?

  9. #9
    Quote Originally Posted by Zeraax View Post
    Have not tested it myself, will do it later. How does it function if your server has custom items with different color codes, like |cffFF0000Bow of Wrath|r?
    I've not tested that, but it should work indeed, because the item name extraction is exactly the same.

  10. #10


    Join Date
    Dec 2019
    Location
    cybermist2.github.io
    Posts
    190

    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Quote Originally Posted by Zeraax View Post
    Have not tested it myself, will do it later. How does it function if your server has custom items with different color codes, like |cffFF0000Bow of Wrath|r?
    Should work

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •