Jump to content
  • 0

Top Enchant Npc


Eleven

Question

Hello McX!

Im using aCis 401 and i tryed to adapt a Top Enchant Manager from an older revision. thats my code.

image.png.12f9ed13a834716cdbdfa3c1d68ccb01.png

 

In order to make it work i had to make some changes in ItemData.java. Check bellow

 

image.png.a763015b59e21cf31d4ececa0374746d.png

 

Is that the correct way? Everything seems to work fine but i want to make sure that is not affected anything else. 

 

Thanks in advance.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Well, let's just ignore almost everything and stick to your only change. You don't have to loop through all the weapons in order to get the item name. You also don't have to change your weapons map from temporary variable to a constant (public static). Since your only concern is the item name you can just make it like

final Item itemTemplate = ItemData.getInstance().getTemplate(id here);

final String itemName = itemTemplate.getName();

Link to comment
Share on other sites

  • 0

If the point is only to retrieve item name to put it in a NpcHtmlMessage, you can use the client option "&#"+itemId + ";". Obviously it only works if you properly edited client to reflect what names are on the server, but it's by far the cheapest option.

 

So you only

 

String weaponName = "&#" + rs.getInt("itemId") + ";";

or even better, you integrate it directly into your ret String and you put your different rs.get methods directly into String (you can then delete the first 7 lines, for loop included, and keep only ret +=).

Edited by Tryskell
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...