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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..