Jump to content
  • 0

Top Enchant Npc


Question

Posted

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.

3 answers to this question

Recommended Posts

  • 0
Posted

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();

  • 0
Posted (edited)

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...