Jump to content
  • 0

[HELP] Augment shop for interlude


Question

Posted

063dcc8a5bcfdefce4912b9963fd87b7888.png

 

 

.../L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java.error.log

Error on: /lproject/L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java.error.log
Line: -1 - Column: -1

no main method in custom.AugmentShop.AugmentShop

 

.../L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java:

package custom.AugmentShop;

import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.model.quest.QuestState;
import com.l2jfrozen.gameserver.model.Inventory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import com.l2jfrozen.util.database.L2DatabaseFactory;
import java.util.logging.Level;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;

/**
* 
* @author adapted by Samar 2011 RUSSIA
* 
*/
public class AugmentShop extends Quest
{
private final static int ITEM_ID = 57;
private final static int ITEM_COUNT = 1000000;
private final static String qn = "AugmentShop";
private final static int NPC = 91000;

public AugmentShop(int questId, String name, String descr) 
{
	super(questId, name, descr);
	addFirstTalkId(NPC);
	addStartNpc(NPC);
	addTalkId(NPC);
}

@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
	String htmltext = "";

	if (event.equalsIgnoreCase("active"))
	{
		htmltext = "active.htm";
	}

	else if (event.equalsIgnoreCase("passive"))
	{
		htmltext = "passive.htm";
	}

	else if (event.equalsIgnoreCase("chance"))
	{
		htmltext = "chance.htm";
	}

	else
	{

		updateAugment(player, Integer.parseInt(event.substring(0,5)), Integer.parseInt(event.substring(6,10)), Integer.parseInt(event.substring(11,13)));
	}


	return htmltext;
}

@Override
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState qs = player.getQuestState(qn);
	if (qs == null)
		qs = newQuestState(player);
	htmltext = "main.htm";
	return htmltext;
}

public static void main(String[] args)
{
	new AugmentShop(-1, qn, "AugmentShop");
}


private static void updateAugment(L2PcInstance player, int attributes, int skill, int level)
{
	L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
	if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)

	{
		player.sendMessage("You have to equip a weapon.");
		return;
	}

	if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented())
	{
		player.sendMessage("The weapon is already augmented.");
		return;
	}

	if (player.getInventory().getInventoryItemCount(ITEM_ID, -1) < ITEM_COUNT)
	{
		player.sendMessage("You dont have enough item.");
		return;
	}

	Connection con = null;
	try
	{
		player.destroyItemByItemId("Consume", ITEM_ID, ITEM_COUNT, player, true);
		con = L2DatabaseFactory.getInstance().getConnection();
		PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
		statement.setInt(1, item.getObjectId());

			statement.setInt(2, attributes*65536+1);
			statement.setInt(3, skill);
			statement.setInt(4, level);

		statement.executeUpdate();
		player.sendMessage("Succesfully augmented. You have to relog now.");
		statement.close();

	}
	catch (Exception e)
	{
		_log.log(Level.SEVERE, "Could not augment item: "+item.getObjectId()+" ", e);
	}
	finally
	{
	try
	{

		/*L2DatabaseFactory.close(con);*/
		con.close();
		}
		catch (Exception e)
		{
		}
	}
}


}

 

Maybe someone can help me to solve this error?

13 answers to this question

Recommended Posts

  • 0
Posted

Try to remove

package custom.AugmentShop;

and try to put

import sys

btw i think imports are not written by this way

Ps basic imports are

import sys
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from com.l2jfrozen.gameserver.datatables import SkillTable
from com.l2jfrozen.util.database import L2DatabaseFactory
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest

  • 0
Posted

This is java

check if you have all the { closed

try to move the main function to the end of the class

blind ?

look at photo -> import scripts

  • 0
Posted

Try to remove

package custom.AugmentShop;

and try to put

import sys

btw i think imports are not written by this way

Ps basic imports are

import sys
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
from java.util import Iterator
from com.l2jfrozen.gameserver.datatables import SkillTable
from com.l2jfrozen.util.database import L2DatabaseFactory
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest

 

 

 

 

 

 

Still get error

===================================================================-[ Scripts ]
start loading Individual AI
start loading Group template AI
Nobless Trader (66666) Enabled...
Clan Manager (66667) Enabled...
----------
1. ERROR in /AugmentShop.java (at line 1)
import sys
       ^^^
The import sys cannot be resolved
----------
2. ERROR in /AugmentShop.java (at line 2)
from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance
^^^^
Syntax error on token "from", . expected
----------
3. ERROR in /AugmentShop.java (at line 2)
from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance
                                          ^^^^^^^^
Syntax error on token "instance", ; expected after this token
----------
4. ERROR in /AugmentShop.java (at line 2)
from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance
                                                          ^^^^^^^^^^^^^
The import L2NpcInstance cannot be resolved
----------
5. ERROR in /AugmentShop.java (at line 3)
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
^^^^
Syntax error on token "from", . expected
----------
6. ERROR in /AugmentShop.java (at line 3)
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
                                          ^^^^^^^^
Syntax error on token "instance", ; expected after this token
----------
7. ERROR in /AugmentShop.java (at line 3)
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
                                                          ^^^^^^^^^^^^
The import L2PcInstance cannot be resolved
----------
8. ERROR in /AugmentShop.java (at line 4)
from com.l2jfrozen.gameserver.model.quest import Quest
^^^^
Syntax error on token "from", . expected
----------
9. ERROR in /AugmentShop.java (at line 4)
from com.l2jfrozen.gameserver.model.quest import Quest
                                    ^^^^^
Syntax error on token "quest", ; expected after this token
----------
10. ERROR in /AugmentShop.java (at line 4)
from com.l2jfrozen.gameserver.model.quest import Quest
                                                 ^^^^^
The import Quest cannot be resolved
----------
11. ERROR in /AugmentShop.java (at line 5)
from com.l2jfrozen.gameserver.model.quest import QuestState
^^^^
Syntax error on token "from", . expected
----------
12. ERROR in /AugmentShop.java (at line 5)
from com.l2jfrozen.gameserver.model.quest import QuestState
                                    ^^^^^
Syntax error on token "quest", ; expected after this token
----------
13. ERROR in /AugmentShop.java (at line 5)
from com.l2jfrozen.gameserver.model.quest import QuestState
                                                 ^^^^^^^^^^
The import QuestState cannot be resolved
----------
14. ERROR in /AugmentShop.java (at line 6)
from com.l2jfrozen.gameserver.model import Inventory
^^^^
Syntax error on token "from", . expected
----------
15. ERROR in /AugmentShop.java (at line 6)
from com.l2jfrozen.gameserver.model import Inventory
                              ^^^^^
Syntax error on token "model", ; expected after this token
----------
16. ERROR in /AugmentShop.java (at line 6)
from com.l2jfrozen.gameserver.model import Inventory
                                           ^^^^^^^^^
The import Inventory cannot be resolved
----------
17. ERROR in /AugmentShop.java (at line 7)
from java.sql import Connection
^^^^
Syntax error on token "from", . expected
----------
18. ERROR in /AugmentShop.java (at line 7)
from java.sql import Connection
          ^^^
Syntax error on token "sql", ; expected after this token
----------
19. ERROR in /AugmentShop.java (at line 7)
from java.sql import Connection
                     ^^^^^^^^^^
The import Connection cannot be resolved
----------
20. ERROR in /AugmentShop.java (at line 8)
from java.sql import PreparedStatement
^^^^
Syntax error on token "from", . expected
----------
21. ERROR in /AugmentShop.java (at line 8)
from java.sql import PreparedStatement
          ^^^
Syntax error on token "sql", ; expected after this token
----------
22. ERROR in /AugmentShop.java (at line 8)
from java.sql import PreparedStatement
                     ^^^^^^^^^^^^^^^^^
The import PreparedStatement cannot be resolved
----------
23. ERROR in /AugmentShop.java (at line 9)
from com.l2jfrozen.util.database import L2DatabaseFactory
^^^^
Syntax error on token "from", . expected
----------
24. ERROR in /AugmentShop.java (at line 9)
from com.l2jfrozen.util.database import L2DatabaseFactory
                        ^^^^^^^^
Syntax error on token "database", ; expected after this token
----------
25. ERROR in /AugmentShop.java (at line 9)
from com.l2jfrozen.util.database import L2DatabaseFactory
                                        ^^^^^^^^^^^^^^^^^
The import L2DatabaseFactory cannot be resolved
----------
26. ERROR in /AugmentShop.java (at line 10)
from java.util.logging import Level
^^^^
Syntax error on token "from", . expected
----------
27. ERROR in /AugmentShop.java (at line 10)
from java.util.logging import Level
               ^^^^^^^
Syntax error on token "logging", ; expected after this token
----------
28. ERROR in /AugmentShop.java (at line 10)
from java.util.logging import Level
                              ^^^^^
The import Level cannot be resolved
----------
29. ERROR in /AugmentShop.java (at line 11)
from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance
^^^^
Syntax error on token "from", . expected
----------
30. ERROR in /AugmentShop.java (at line 11)
from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance
                                          ^^^^^^^^
Syntax error on token "instance", ; expected after this token
----------
31. ERROR in /AugmentShop.java (at line 11)
from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance
                                                          ^^^^^^^^^^^^^^
Syntax error on token "L2ItemInstance", ; expected after this token
----------
32. ERROR in /AugmentShop.java (at line 11)
from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance
                                                          ^^^^^^^^^^^^^^
The import L2ItemInstance cannot be resolved
----------
33. ERROR in /AugmentShop.java (at line 18)
public class AugmentShop extends Quest
                                 ^^^^^
Quest cannot be resolved to a type
----------
34. ERROR in /AugmentShop.java (at line 28)
addFirstTalkId(NPC);
^^^^^^^^^^^^^^
The method addFirstTalkId(int) is undefined for the type AugmentShop
----------
35. ERROR in /AugmentShop.java (at line 29)
addStartNpc(NPC);
^^^^^^^^^^^
The method addStartNpc(int) is undefined for the type AugmentShop
----------
36. ERROR in /AugmentShop.java (at line 30)
addTalkId(NPC);
^^^^^^^^^
The method addTalkId(int) is undefined for the type AugmentShop
----------
37. ERROR in /AugmentShop.java (at line 34)
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
                                       ^^^^^^^^^^^^^
L2NpcInstance cannot be resolved to a type
----------
38. ERROR in /AugmentShop.java (at line 34)
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
                                                          ^^^^^^^^^^^^
L2PcInstance cannot be resolved to a type
----------
39. ERROR in /AugmentShop.java (at line 64)
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
                          ^^^^^^^^^^^^^
L2NpcInstance cannot be resolved to a type
----------
40. ERROR in /AugmentShop.java (at line 64)
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
                                             ^^^^^^^^^^^^
L2PcInstance cannot be resolved to a type
----------
41. ERROR in /AugmentShop.java (at line 67)
QuestState qs = player.getQuestState(qn);
^^^^^^^^^^
QuestState cannot be resolved to a type
----------
42. ERROR in /AugmentShop.java (at line 80)
private static void updateAugment(L2PcInstance player, int attributes, int skill, int level)
                                  ^^^^^^^^^^^^
L2PcInstance cannot be resolved to a type
----------
43. ERROR in /AugmentShop.java (at line 82)
L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
^^^^^^^^^^^^^^
L2ItemInstance cannot be resolved to a type
----------
44. ERROR in /AugmentShop.java (at line 82)
L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
                                                             ^^^^^^^^^
Inventory cannot be resolved to a variable
----------
45. ERROR in /AugmentShop.java (at line 83)
if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)
                                           ^^^^^^^^^
Inventory cannot be resolved to a variable
----------
46. ERROR in /AugmentShop.java (at line 90)
if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented())
                                           ^^^^^^^^^
Inventory cannot be resolved to a variable
----------
47. ERROR in /AugmentShop.java (at line 102)
Connection con = null;
^^^^^^^^^^
Connection cannot be resolved to a type
----------
48. ERROR in /AugmentShop.java (at line 106)
con = L2DatabaseFactory.getInstance().getConnection();
      ^^^^^^^^^^^^^^^^^
L2DatabaseFactory cannot be resolved
----------
49. ERROR in /AugmentShop.java (at line 107)
PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
^^^^^^^^^^^^^^^^^
PreparedStatement cannot be resolved to a type
----------
50. ERROR in /AugmentShop.java (at line 121)
_log.log(Level.SEVERE, "Could not augment item: "+item.getObjectId()+" ", e);
^^^^
_log cannot be resolved
----------
51. ERROR in /AugmentShop.java (at line 121)
_log.log(Level.SEVERE, "Could not augment item: "+item.getObjectId()+" ", e);
         ^^^^^
Level cannot be resolved to a variable
----------
51 problems (51 errors)Syntax error on token "from", . expected
Syntax error on token "instance", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "instance", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "quest", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "quest", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "model", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "sql", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "sql", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "database", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "logging", ; expected after this token
Syntax error on token "from", . expected
Syntax error on token "instance", ; expected after this token
Syntax error on token "L2ItemInstance", ; expected after this token
Quest cannot be resolved to a type
The import sys cannot be resolved
The import L2NpcInstance cannot be resolved
The import L2PcInstance cannot be resolved
The import Quest cannot be resolved
The import QuestState cannot be resolved
The import Inventory cannot be resolved
The import Connection cannot be resolved
The import PreparedStatement cannot be resolved
The import L2DatabaseFactory cannot be resolved
The import Level cannot be resolved
The import L2ItemInstance cannot be resolved
L2NpcInstance cannot be resolved to a type
L2PcInstance cannot be resolved to a type
L2NpcInstance cannot be resolved to a type
L2PcInstance cannot be resolved to a type
L2PcInstance cannot be resolved to a type
The method addFirstTalkId(int) is undefined for the type AugmentShop
The method addStartNpc(int) is undefined for the type AugmentShop
The method addTalkId(int) is undefined for the type AugmentShop
QuestState cannot be resolved to a type
L2ItemInstance cannot be resolved to a type
Inventory cannot be resolved to a variable
Inventory cannot be resolved to a variable
Inventory cannot be resolved to a variable
Connection cannot be resolved to a type
L2DatabaseFactory cannot be resolved
PreparedStatement cannot be resolved to a type
_log cannot be resolved
Level cannot be resolved to a variable
Failed executing script: /lproject/L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java. See AugmentShop.java.error.log for details.
Replaced: SagasSuperclass with a new version
Compiled Scripts Cache is disabled.
[FeanorScriptEngine] Loading Packages ...
[FeanorScriptEngine] No Packages Loaded ...
===============================================================-[ Game Server ]

 

 

 

.../L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java

import sys
from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
from com.l2jfrozen.gameserver.model.quest import Quest
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model import Inventory
from java.sql import Connection
from java.sql import PreparedStatement
from com.l2jfrozen.util.database import L2DatabaseFactory
from java.util.logging import Level
from com.l2jfrozen.gameserver.model.actor.instance import L2ItemInstance

/**
* 
* @author adapted by Samar 2011 RUSSIA
* 
*/
public class AugmentShop extends Quest
{
private final static int ITEM_ID = 57;
private final static int ITEM_COUNT = 1000000;
private final static String qn = "AugmentShop";
private final static int NPC = 91000;

public AugmentShop(int questId, String name, String descr) 
{
	super(questId, name, descr);
	addFirstTalkId(NPC);
	addStartNpc(NPC);
	addTalkId(NPC);
}

@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
	String htmltext = "";

	if (event.equalsIgnoreCase("active"))
	{
		htmltext = "active.htm";
	}

	else if (event.equalsIgnoreCase("passive"))
	{
		htmltext = "passive.htm";
	}

	else if (event.equalsIgnoreCase("chance"))
	{
		htmltext = "chance.htm";
	}

	else
	{

		updateAugment(player, Integer.parseInt(event.substring(0,5)), Integer.parseInt(event.substring(6,10)), Integer.parseInt(event.substring(11,13)));
	}


	return htmltext;
}

@Override
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState qs = player.getQuestState(qn);
	if (qs == null)
		qs = newQuestState(player);
	htmltext = "main.htm";
	return htmltext;
}

public static void main(String[] args)
{
	new AugmentShop(-1, qn, "AugmentShop");
}


private static void updateAugment(L2PcInstance player, int attributes, int skill, int level)
{
	L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
	if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)

	{
		player.sendMessage("You have to equip a weapon.");
		return;
	}

	if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented())
	{
		player.sendMessage("The weapon is already augmented.");
		return;
	}

	if (player.getInventory().getInventoryItemCount(ITEM_ID, -1) < ITEM_COUNT)
	{
		player.sendMessage("You dont have enough item.");
		return;
	}

	Connection con = null;
	try
	{
		player.destroyItemByItemId("Consume", ITEM_ID, ITEM_COUNT, player, true);
		con = L2DatabaseFactory.getInstance().getConnection();
		PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
		statement.setInt(1, item.getObjectId());

			statement.setInt(2, attributes*65536+1);
			statement.setInt(3, skill);
			statement.setInt(4, level);

		statement.executeUpdate();
		player.sendMessage("Succesfully augmented. You have to relog now.");
		statement.close();

	}
	catch (Exception e)
	{
		_log.log(Level.SEVERE, "Could not augment item: "+item.getObjectId()+" ", e);
	}
	finally
	{
	try
	{

		/*L2DatabaseFactory.close(con);*/
		con.close();
		}
		catch (Exception e)
		{
		}
	}
}


}

 

Got even more errors :/

  • 0
Posted

u trolling? or dont know that u can use java scripts?

u blind? or cant see ".java"?

anyways, gl with your problems

stupid? its in scripts, you must use the correct imports/methods

  • 0
Posted

import sys is for jython script, it's a java script.

 

B00D, try to keep a "friendly" chat, it's not like adenaman insulted you or is even wrong. And even if you were right, you don't have to insult ppl. You're the one "stupid" and "blind" in the story.

 

Revert all B00D stuff. If not already made, you should follow that link : it will allow you to see java errors in  java DP scripts. You will be able to get rid of errors really easily directly on Eclipse.

 

Script seems correct, I would say you got error with package.

 

package custom.AugmentShop;

  • 0
Posted

import sys is for jython script, it's a java script.

 

B00D, try to keep a "friendly" chat, it's not like adenaman insulted you or is even wrong. And even if you were right, you don't have to insult ppl. You're the one "stupid" and "blind" in the story.

 

Revert all B00D stuff. If not already made, you should follow that link : it will allow you to see java errors in  java DP scripts. You will be able to get rid of errors really easily directly on Eclipse.

 

Script seems correct, I would say you got error with package.

 

package custom.AugmentShop;

by the way he has this into scripts, its a jscript. If he put it into java and then into imports then , yes , it must be like this

  • 0
Posted

by the way he has this into scripts, its a jscript. If he put it into java and then into imports then , yes , it must be like this

 

I dunno since when you stopped L2J dev, but since around 2 or 3 years, a java engine has been implemented for scripts.

 

That's one of the reason on aCis (Interlude pack by the way, as Frozen) I decided to port all python scripts to java scripts (all quests, Ais, etc can be ported from python to java).

 

And yes, it's on -beep-ing scripts folder. You can have java on scripts.

 

Time to checkout latest versions ? :P.

 

PS : "scripts" folder was named "jscript" before. It means it has been reworked, because from the time of "jscript" only python was possible. That time is gone, since 2-3 years (perhaps even more).

  • 0
Posted

063dcc8a5bcfdefce4912b9963fd87b7888.png

 

 

.../L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java.error.log

Error on: /lproject/L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java.error.log
Line: -1 - Column: -1

no main method in custom.AugmentShop.AugmentShop

 

.../L2jFrozen_GameServer/gameserver/data/scripts/custom/AugmentShop/AugmentShop.java:

package custom.AugmentShop;

import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.model.quest.QuestState;
import com.l2jfrozen.gameserver.model.Inventory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import com.l2jfrozen.util.database.L2DatabaseFactory;
import java.util.logging.Level;
import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;

/**
* 
* @author adapted by Samar 2011 RUSSIA
* 
*/
public class AugmentShop extends Quest
{
private final static int ITEM_ID = 57;
private final static int ITEM_COUNT = 1000000;
private final static String qn = "AugmentShop";
private final static int NPC = 91000;

public AugmentShop(int questId, String name, String descr) 
{
	super(questId, name, descr);
	addFirstTalkId(NPC);
	addStartNpc(NPC);
	addTalkId(NPC);
}

@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
	String htmltext = "";

	if (event.equalsIgnoreCase("active"))
	{
		htmltext = "active.htm";
	}

	else if (event.equalsIgnoreCase("passive"))
	{
		htmltext = "passive.htm";
	}

	else if (event.equalsIgnoreCase("chance"))
	{
		htmltext = "chance.htm";
	}

	else
	{

		updateAugment(player, Integer.parseInt(event.substring(0,5)), Integer.parseInt(event.substring(6,10)), Integer.parseInt(event.substring(11,13)));
	}


	return htmltext;
}

@Override
public String onFirstTalk(L2NpcInstance npc, L2PcInstance player)
{
	String htmltext = "";
	QuestState qs = player.getQuestState(qn);
	if (qs == null)
		qs = newQuestState(player);
	htmltext = "main.htm";
	return htmltext;
}

public static void main(String[] args)
{
	new AugmentShop(-1, qn, "AugmentShop");
}


private static void updateAugment(L2PcInstance player, int attributes, int skill, int level)
{
	L2ItemInstance item = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
	if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null)

	{
		player.sendMessage("You have to equip a weapon.");
		return;
	}

	if (player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).isAugmented())
	{
		player.sendMessage("The weapon is already augmented.");
		return;
	}

	if (player.getInventory().getInventoryItemCount(ITEM_ID, -1) < ITEM_COUNT)
	{
		player.sendMessage("You dont have enough item.");
		return;
	}

	Connection con = null;
	try
	{
		player.destroyItemByItemId("Consume", ITEM_ID, ITEM_COUNT, player, true);
		con = L2DatabaseFactory.getInstance().getConnection();
		PreparedStatement statement = con.prepareStatement("REPLACE INTO augmentations VALUES(?,?,?,?)");
		statement.setInt(1, item.getObjectId());

			statement.setInt(2, attributes*65536+1);
			statement.setInt(3, skill);
			statement.setInt(4, level);

		statement.executeUpdate();
		player.sendMessage("Succesfully augmented. You have to relog now.");
		statement.close();

	}
	catch (Exception e)
	{
		_log.log(Level.SEVERE, "Could not augment item: "+item.getObjectId()+" ", e);
	}
	finally
	{
	try
	{

		/*L2DatabaseFactory.close(con);*/
		con.close();
		}
		catch (Exception e)
		{
		}
	}
}


}

 

Maybe someone can help me to solve this error?

 

So okey everythings alright with imports, but why it writes "no main method in custom.AugmentShop.AugmentShop"? There is a main method

  • 0
Posted
2 hours ago, imcreator said:

I have same problem. No main method? Anyone solved this?

 

27 minutes ago, imcreator said:

I have same problem. No main method? Anyone solved this?

 

26 minutes ago, imcreator said:

up

 

lol with that spam. 

 

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...