Jump to content
  • 0

Another Error.


Question

Posted (edited)

My error:

 C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\head-src\com\l2jfrozen\gameserver\model\actor\instance\L2DonateShopInstance.java:928: error: method replace in class NpcHtmlMessage cannot be applied to given types;
    [javac] 					html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
    [javac] 					    ^
    [javac]   required: String,String
    [javac]   found: String,int
    [javac]   reason: actual argument int cannot be converted to String by method invocation conversion
    

 

The actual lines:

case 11:
				String htmContent11 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page4.htm");
				html.setHtml(htmContent11);
				html.replace("%objectId%", String.valueOf(this.getObjectId()));
				html.replace("%charname%", player.getName());
				if (rhand != null && rhand.isAugmented() && rhand.getAugmentation() != null && rhand.getAugmentation().getSkill() != null && rhand.getAugmentation().getSkill().getLevel() >= 1)
				{
					html.replace("%level%", rhand.getAugmentation().getSkill().getLevel());
				}
				html.replace("%level%", "None");
				player.sendPacket(html);
				break;
			

I know what the error is I see it but I dont know how to fix it. Any help?

Edited by sotid

13 answers to this question

Recommended Posts

  • 0
Posted

Try this one:

ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

 

            if (item != null && item.isAugmented() && item.getAugmentation() != null && item.getAugmentation().getSkill() != null && item.getAugmentation().getSkill().getLevel() >= 1)
                html.replace("%level%", item.getAugmentation().getSkill().getLevel());
            html.replace("%level%", "None");

  • 0
Posted

try to add .toString()

at 

 html.replace("%level%", item.getAugmentation().getSkill().getLevel());

 

final

 html.replace("%level%", item.getAugmentation().getSkill().getLevel().toString());

  • 0
Posted
31 minutes ago, @IcathiaLord said:

Try this one:

ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

 

            if (item != null && item.isAugmented() && item.getAugmentation() != null && item.getAugmentation().getSkill() != null && item.getAugmentation().getSkill().getLevel() >= 1)
                html.replace("%level%", item.getAugmentation().getSkill().getLevel());
            html.replace("%level%", "None"); 

case 11:
				String htmContent11 = HtmCache.getInstance().getHtm("data/html/mods/donate/augment/active/page4.htm");
				html.setHtml(htmContent11);
				html.replace("%objectId%", String.valueOf(this.getObjectId()));
				html.replace("%charname%", player.getName());
				ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
				if (item != null && item.isAugmented() && item.getAugmentation() != null && item.getAugmentation().getSkill() != null && item.getAugmentation().getSkill().getLevel() >= 1)
				{
					 html.replace("%level%", item.getAugmentation().getSkill().getLevel());
				}
				html.replace("%level%", "None");
				player.sendPacket(html);
				break;
			

like this?
I get error.

http://prntscr.com/mcj9v3

  • 0
Posted (edited)

Integer.toString(int)

 

Explanation : replace only accepts Strings, not int. Therefore you have to cast your int into a String.

 

aCis NpcHtmlMessage allow to directly use int as parameter, because there are replace for the most used datatypes.

 

	public void replace(String pattern, String value)
	{
		_html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
	}
	
	public void replace(String pattern, int value)
	{
		_html = _html.replaceAll(pattern, Integer.toString(value));
	}
	
	public void replace(String pattern, long value)
	{
		_html = _html.replaceAll(pattern, Long.toString(value));
	}
	
	public void replace(String pattern, double value)
	{
		_html = _html.replaceAll(pattern, Double.toString(value));
	}

If you haven't that, you are forced to do it whenever and wherever you need it. Which is extremely redundant, subject to make errors, and increase amount of code.

 

PS : you got your solution on your question, you already have an exemple :

 

html.replace("%objectId%", String.valueOf(this.getObjectId()));

On aCis or wherever clean pack, you would have :

html.replace("%objectId%", getObjectId());
Edited by Tryskell
  • 0
Posted (edited)

ah tryskel is right i confuzed .net with java sorry String.valueOf is the fix :)

about the others just retype the code its encoding issue if you want send me private teamviewer i can retype the code for you and help you solve it 

Edited by DenArt Designs
  • 0
Posted

Sorry, the code i posted was for aCis.

As tryskell said String.valueOf is the solution , so the code must be

html.replace("%level%", String.valueOf(rhand.getAugmentation().getSkill().getLevel()));

  • Like 1
  • 0
Posted (edited)

Thank you all I used this and finally works.

 

html.replace("%level%", Integer.toString(rhand.getAugmentation().getSkill().getLevel()));

 

 

Please dont lock the topic , I will post another error later so I wont spam with topics.

Edited by sotid
  • 0
Posted

Next error as promised. :D
 

Error:

[javac] Compiling 911 source files to C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\build\classes
    [javac] C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\head-src\com\l2jfrozen\gameserver\model\L2Party.java:681: error: cannot find symbol
    [javac] 			member.addItem("Party", itemid, count, player, true);
    [javac] 			                        ^
    [javac]   symbol:   variable itemid
    [javac]   location: class L2Party
    [javac] 1 error

 

Actual lines:

public void distributeAdena(L2PcInstance player, int itemId, long itemCount, L2Character target)
	{
		// Get all the party members
		List<L2PcInstance> membersList = getPartyMembers();

		// Check the number of party members that must be rewarded
		// (The party member must be in range to receive its reward)
		List<L2PcInstance> ToReward = FastList.newInstance();

		for(L2PcInstance member : membersList)
		{
			if(!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
			{
				continue;
			}
			ToReward.add(member);
		}

		// Avoid null exceptions, if any
		if (ToReward.isEmpty())
			return;

		// Now we can actually distribute the adena reward
		// (Total adena split by the number of party members that are in range and must be rewarded)
		long count = itemCount / ToReward.size();

		for(L2PcInstance member : ToReward)
		{
			member.addItem("Party", itemid, count, player, true);
		}
		FastList.recycle((FastList<?>) ToReward);
	}

 

I dont get why I get this error , other lines of the same java use itemid before I tried to edit anything.
Anyway the code I used:

 

  • 0
Posted
1 hour ago, DenArt Designs said:

make it itemId not itemid

Thanks , of that was a big oof...

Now what? Do I have to add something in pcinstance?

 

[javac] C:\Users\User\workspace - pvp - Copy\Stable_1004\gameserver\head-src\com\l2jfrozen\gameserver\model\L2Party.java:680: error: no suitable method found for addItem(String,int,long,L2PcInstance,boolean)
    [javac] 			member.addItem("Party", itemId, count, player, true);
    [javac] 			      ^
    [javac]     method L2PcInstance.addItem(String,int,int,L2Object,boolean) is not applicable
    [javac]       (actual argument long cannot be converted to int by method invocation conversion)
    [javac]     method L2PcInstance.addItem(String,L2ItemInstance,L2Object,boolean) is not applicable
    [javac]       (actual and formal argument lists differ in length)
    [javac] 1 error

 

  • 0
Posted (edited)

Thanks again!

On 1/30/2019 at 1:56 PM, wongerlt said:

try this

member.addItem("Party", itemId , (int) count, player, true);

 

 

Lock it!

Edited by sotid
Guest
This topic is now closed to further replies.


  • Posts

    • Lineage 2 Interlude L2OFF Server Based on H5 Files   Are you looking to start your own Lineage 2 server? This is your chance! I’m selling a 100% functional server based on Official L2OFF H5 files, adapted to the Interlude version. Main Features: Based on official L2OFF H5 files, perfectly configured for Interlude. Includes the full source code, allowing you to fully customize the server to fit your needs. Fully working events, such as: TvT (Team vs. Team) CTF (Capture the Flag) Tons of custom content added, keeping the balance and original essence of the game. Why choose this project? The server is fully functional and optimized, ready to launch. You can test the server before purchasing, with access to a GM character to explore all features. Comes with everything you need to make your project a success, both technically and in terms of content. Interested? Feel free to contact me! If you need more information or would like to schedule a test, I’m happy to answer any questions.   Auto Create Accounts Client Test Server: DOWNLOAD   Price: 600 usd Source price: send pm. Discord: Guytis#6760 Skype: gustavoorellano@hotmail.com  
    • Website: https://l2aurum.com/  Discord: https://discord.gg/l2aurum   Hello Everyone,  finally, the moment has arrived: I'm launching my own server, L2Aurum!   L2Aurum x300 Closed Beta Test - Start: 17.02.2025  [20:00 GMT+2] Grand Opening 21.02.2025 [20:00 GMT+2]     Experience Rates: x300 Skill Points Rates: x300 Adena Drop: x300 Premium Accounts: x2 Drop Rates: x1 Spoil Rates: x1 Quest Rates: x1 Only one account per player, no dualboxing allowed. Everything is earned through gameplay, no pay-to-win mechanics. No server wipes—your progress is permanent. Fair play is a priority, with no room for corruption. All players are treated equally, no special favors.     Buffs slots: 26+4, all buffs in NPC and Scheme System. Custom Armors: Aurum Apella Armor Custom Weapons: Aurum Weapon Custom Accessories: +300 P.Def & M.Def Tattoos: Mage & Fighter & Custom Shirts Custom Jewels: New Grand Bosses Auto Farm is FREE for everyone. Status Noblesse: Barakiel. Player Spawn Protection: 10 seconds. Geodata e Panthodes: ENABLED. All Commands are visible in .menu. System 2 Bishop Per Party: ENABLED. Boss Protect - Anti-Zerg: ENABLED.     Siege Duration: 2 hours (120 minutes). Siege Period: Every 7 days. Castle Reward: 100E Per Castle. Available Castles: Rune Aden Giran Giran Siege: Every Friday 20:00 GMT +2. Aden Siege: Every Saturday 20:00 GMT +2. Rune Siege: Every Sunday 20:00 GMT +2. Main Clan: 40 Members max. Royal Clan: 12 Members max. Knight Clan: 7 Members max. Alliance: You can have only 1.     Epic Boss Valakas: Monday 22:30 (GMT+2) Zaken: Tuesday | Thursday 22:30 (GMT+2) Queen Ant: Monday | Wednesday 22:30 (GMT+2) Baium: Friday 22:30 (GMT+2) Antharas: Saturday 22:30 (GMT+2) Orfen: Tuesday | Thursday | Saturday 18:30 (GMT+2) Core: Monday | Wednesday | Friday | Sunday 18:30 (GMT+2)   Raid Boss  Flame Of Splendor Barakiel Last Hit: Every Day Respawn 3-4 hours Ember: Every Day Respawn 3-4 hours Lilith: Every Day Respawn 3-4 hours Anakim: Every Day Respawn 3-4 hours Queen Shyeed: Every Day Respawn 3-4 hours Golkonda: Every Day Respawn 3-4 hours Shuriel: Every Day Respawn 3-4 hours Varka's Hero Shadith: Every Day Respawn 3-4 hours Ketra's Hero Hekaton: Every Day Respawn 3-4 hours Varka's Mos: Every Day Respawn 3-4 hours Chief Horus: Every Day Respawn 3-4 hours Ketra's Tayer: Every Day Respawn 3-4 hours Chief Brakki: Every Day Respawn 3-4 hours Sailren: Every Day Respawn 02:00   🥳🥳🥳🥳 I would like to chat personally with all of you over on our Discord and discuss any suggestions or feedback you might have.      Website: https://l2aurum.com/  Discord: https://discord.gg/l2aurum
  • Topics

×
×
  • Create New...