12-16-2011, 04:33 PM
как добавить Премиум акаунт в комюнити lucid-team??
а дело то собственно вот в чем:
есть скрипт премиум акаунта:
переделал его так:
но в результате при запуске сервера выдет ошибку импорта:
что я не так сделал?
а дело то собственно вот в чем:
есть скрипт премиум акаунта:
Код:
package services;
import java.sql.SQLException;
import java.util.Date;
import l2lt.Config;
import l2lt.database.L2DatabaseFactory;
import l2lt.database.mysql;
import l2lt.extensions.scripts.Functions;
import l2lt.extensions.scripts.ScriptFile;
import l2lt.gameserver.cache.Msg;
import l2lt.gameserver.model.L2Player;
import l2lt.gameserver.model.items.L2ItemInstance;
import l2lt.gameserver.templates.L2Item;
import l2lt.gameserver.xml.ItemTemplates;
import l2lt.util.Files;
import l2lt.util.Log;
public class RateBonus extends Functions implements ScriptFile
{
public void list()
{
L2Player player = (L2Player) getSelf();
String html;
if(player.getNetConnection().getBonus() == 1)
{
html = Files.read("data/scripts/services/RateBonus.htm", player);
String add = new String();
for(int i = 0; i < Config.SERVICES_RATE_BONUS_DAYS.length; i++)
add += "<a action=\"bypass -h scripts_services.RateBonus:get " + i + "\">" //
+ (int) (Config.SERVICES_RATE_BONUS_VALUE[i] * 100 - 100) + //
"% for " + Config.SERVICES_RATE_BONUS_DAYS[i] + //
" days - " + Config.SERVICES_RATE_BONUS_PRICE[i] + //
" " + ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]).getName() + "</a><br>";
html = html.replaceFirst("%toreplace%", add);
}
else if(player.getNetConnection().getBonus() > 1)
{
long endtime = player.getNetConnection().getBonusExpire();
if(endtime >= 0)
html = Files.read("data/scripts/services/RateBonusAlready.htm", player).replaceFirst("endtime", new Date(endtime * 1000L).toString());
else
html = Files.read("data/scripts/services/RateBonusInfinite.htm", player);
}
else
html = Files.read("data/scripts/services/RateBonusNo.htm", player);
show(html, player);
}
public void get(String[] param)
{
L2Player player = (L2Player) getSelf();
int i = Integer.parseInt(param[0]);
L2Item item = ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]);
L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
if(pay != null && pay.getCount() >= Config.SERVICES_RATE_BONUS_PRICE[i])
{
player.getInventory().destroyItem(pay, Config.SERVICES_RATE_BONUS_PRICE[i], true);
Log.add(player.getName() + "|" + player.getObjectId() + "|rate bonus|" + Config.SERVICES_RATE_BONUS_VALUE[i] + "|" + Config.SERVICES_RATE_BONUS_DAYS[i] + "|", "services");
try
{
mysql.setEx(L2DatabaseFactory.getInstanceLogin(), "UPDATE `accounts` SET `bonus`=?,`bonus_expire`=UNIX_TIMESTAMP()+" + Config.SERVICES_RATE_BONUS_DAYS[i] + "*24*60*60 WHERE `login`=?", Config.SERVICES_RATE_BONUS_VALUE[i], player.getAccountName());
}
catch(SQLException e)
{
e.printStackTrace();
}
player.getNetConnection().setBonus(Config.SERVICES_RATE_BONUS_VALUE[i]);
player.getNetConnection().setBonusExpire(System.currentTimeMillis() / 1000 + Config.SERVICES_RATE_BONUS_DAYS[i] * 24 * 60 * 60);
player.restoreBonus();
if(player.getParty() != null)
player.getParty().recalculatePartyData();
show(Files.read("data/scripts/services/RateBonusGet.htm", player), player);
}
else if(Config.SERVICES_RATE_BONUS_ITEM[i] == 57)
player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
else
player.sendPacket(Msg.INCORRECT_ITEM_COUNT);
}
public void howtogetcol()
{
show("data/scripts/services/howtogetcol.htm", (L2Player) getSelf());
}
public void onLoad()
{
System.out.println("Loaded Service: Rate bonus");
}
public void onReload()
{}
public void onShutdown()
{}
}
переделал его так:
Код:
package services;
import java.sql.SQLException;
import java.util.Date;
import com.lucid.Config;
import com.lucid.database.L2DatabaseFactory;
import com.lucid.database.mysql;
import com.lucid.extensions.scripts.Functions;
import com.lucid.extensions.scripts.ScriptFile;
import com.lucid.gameserver.cache.Msg;
import com.lucid.gameserver.model.L2Player;
import com.lucid.gameserver.model.items.L2ItemInstance;
import com.lucid.gameserver.templates.L2Item;
import com.lucid.gameserver.xml.ItemTemplates;
import com.lucid.util.Files;
import com.lucid.util.Log;
public class RateBonus extends Functions implements ScriptFile
{
public void list()
{
L2Player player = (L2Player) getSelf();
String html;
if(player.getNetConnection().getBonus() == 1)
{
html = Files.read("data/scripts/services/RateBonus.htm", player);
String add = new String();
for(int i = 0; i < Config.SERVICES_RATE_BONUS_DAYS.length; i++)
add += "<a action=\"bypass -h scripts_services.RateBonus:get " + i + "\">" //
+ (int) (Config.SERVICES_RATE_BONUS_VALUE[i] * 100 - 100) + //
"% for " + Config.SERVICES_RATE_BONUS_DAYS[i] + //
" days - " + Config.SERVICES_RATE_BONUS_PRICE[i] + //
" " + ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]).getName() + "</a><br>";
html = html.replaceFirst("%toreplace%", add);
}
else if(player.getNetConnection().getBonus() > 1)
{
long endtime = player.getNetConnection().getBonusExpire();
if(endtime >= 0)
html = Files.read("data/scripts/services/RateBonusAlready.htm", player).replaceFirst("endtime", new Date(endtime * 1000L).toString());
else
html = Files.read("data/scripts/services/RateBonusInfinite.htm", player);
}
else
html = Files.read("data/scripts/services/RateBonusNo.htm", player);
show(html, player);
}
public void get(String[] param)
{
L2Player player = (L2Player) getSelf();
int i = Integer.parseInt(param[0]);
L2Item item = ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]);
L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
if(pay != null && pay.getCount() >= Config.SERVICES_RATE_BONUS_PRICE[i])
{
player.getInventory().destroyItem(pay, Config.SERVICES_RATE_BONUS_PRICE[i], true);
Log.add(player.getName() + "|" + player.getObjectId() + "|rate bonus|" + Config.SERVICES_RATE_BONUS_VALUE[i] + "|" + Config.SERVICES_RATE_BONUS_DAYS[i] + "|", "services");
try
{
mysql.setEx(L2DatabaseFactory.getInstanceLogin(), "UPDATE `accounts` SET `bonus`=?,`bonus_expire`=UNIX_TIMESTAMP()+" + Config.SERVICES_RATE_BONUS_DAYS[i] + "*24*60*60 WHERE `login`=?", Config.SERVICES_RATE_BONUS_VALUE[i], player.getAccountName());
}
catch(SQLException e)
{
e.printStackTrace();
}
player.getNetConnection().setBonus(Config.SERVICES_RATE_BONUS_VALUE[i]);
player.getNetConnection().setBonusExpire(System.currentTimeMillis() / 1000 + Config.SERVICES_RATE_BONUS_DAYS[i] * 24 * 60 * 60);
player.restoreBonus();
if(player.getParty() != null)
player.getParty().recalculatePartyData();
show(Files.read("data/scripts/services/RateBonusGet.htm", player), player);
}
else if(Config.SERVICES_RATE_BONUS_ITEM[i] == 57)
player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
else
player.sendPacket(Msg.INCORRECT_ITEM_COUNT);
}
public void howtogetcol()
{
show("data/scripts/services/howtogetcol.htm", (L2Player) getSelf());
}
public void onLoad()
{
System.out.println("Loaded Service: Rate bonus");
}
public void onReload()
{}
public void onShutdown()
{}
}
но в результате при запуске сервера выдет ошибку импорта:
Код:
----------
1. ERROR in /RateBonus.java (at line 7)
import com.lucid.database.L2DatabaseFactory;
^^^^^^^^^^^^^^^^^^
The import com.lucid.database cannot be resolved
----------
2. ERROR in /RateBonus.java (at line 8)
import com.lucid.database.mysql;
^^^^^^^^^^^^^^^^^^
The import com.lucid.database cannot be resolved
----------
3. ERROR in /RateBonus.java (at line 9)
import com.lucid.extensions.scripts.Functions;
^^^^^^^^^^^^^^^^^^^^
The import com.lucid.extensions cannot be resolved
----------
4. ERROR in /RateBonus.java (at line 10)
import com.lucid.extensions.scripts.ScriptFile;
^^^^^^^^^^^^^^^^^^^^
The import com.lucid.extensions cannot be resolved
----------
5. ERROR in /RateBonus.java (at line 11)
import com.lucid.gameserver.cache.Msg;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import com.lucid.gameserver.cache.Msg cannot be resolved
----------
6. ERROR in /RateBonus.java (at line 12)
import com.lucid.gameserver.model.L2Player;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import com.lucid.gameserver.model.L2Player cannot be resolved
----------
7. ERROR in /RateBonus.java (at line 13)
import com.lucid.gameserver.model.items.L2ItemInstance;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import com.lucid.gameserver.model.items cannot be resolved
----------
8. ERROR in /RateBonus.java (at line 14)
import com.lucid.gameserver.templates.L2Item;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import com.lucid.gameserver.templates.L2Item cannot be resolved
----------
9. ERROR in /RateBonus.java (at line 15)
import com.lucid.gameserver.xml.ItemTemplates;
^^^^^^^^^^^^^^^^^^^^^^^^
The import com.lucid.gameserver.xml cannot be resolved
----------
10. ERROR in /RateBonus.java (at line 16)
import com.lucid.util.Files;
^^^^^^^^^^^^^^^^^^^^
The import com.lucid.util.Files cannot be resolved
----------
11. ERROR in /RateBonus.java (at line 17)
import com.lucid.util.Log;
^^^^^^^^^^^^^^^^^^
The import com.lucid.util.Log cannot be resolved
----------
12. ERROR in /RateBonus.java (at line 19)
public class RateBonus extends Functions implements ScriptFile
^^^^^^^^^
Functions cannot be resolved to a type
----------
13. ERROR in /RateBonus.java (at line 19)
public class RateBonus extends Functions implements ScriptFile
^^^^^^^^^^
ScriptFile cannot be resolved to a type
----------
14. ERROR in /RateBonus.java (at line 23)
L2Player player = (L2Player) getSelf();
^^^^^^^^
L2Player cannot be resolved to a type
----------
15. ERROR in /RateBonus.java (at line 23)
L2Player player = (L2Player) getSelf();
^^^^^^^^
L2Player cannot be resolved to a type
----------
16. ERROR in /RateBonus.java (at line 23)
L2Player player = (L2Player) getSelf();
^^^^^^^
The method getSelf() is undefined for the type RateBonus
----------
17. ERROR in /RateBonus.java (at line 27)
html = Files.read("data/scripts/services/RateBonus.htm", player);
^^^^^
Files cannot be resolved
----------
18. ERROR in /RateBonus.java (at line 30)
for(int i = 0; i < Config.SERVICES_RATE_BONUS_DAYS.length; i++)
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_DAYS cannot be resolved or is not a field
----------
19. ERROR in /RateBonus.java (at line 32)
+ (int) (Config.SERVICES_RATE_BONUS_VALUE[i] * 100 - 100) + //
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_VALUE cannot be resolved or is not a field
----------
20. ERROR in /RateBonus.java (at line 33)
"% for " + Config.SERVICES_RATE_BONUS_DAYS[i] + //
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_DAYS cannot be resolved or is not a field
----------
21. ERROR in /RateBonus.java (at line 34)
" days - " + Config.SERVICES_RATE_BONUS_PRICE[i] + //
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_PRICE cannot be resolved or is not a field
----------
22. ERROR in /RateBonus.java (at line 35)
" " + ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]).getName() + "</a><br>";
^^^^^^^^^^^^^
ItemTemplates cannot be resolved
----------
23. ERROR in /RateBonus.java (at line 35)
" " + ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]).getName() + "</a><br>";
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_ITEM cannot be resolved or is not a field
----------
24. ERROR in /RateBonus.java (at line 43)
html = Files.read("data/scripts/services/RateBonusAlready.htm", player).replaceFirst("endtime", new Date(endtime * 1000L).toString());
^^^^^
Files cannot be resolved
----------
25. ERROR in /RateBonus.java (at line 45)
html = Files.read("data/scripts/services/RateBonusInfinite.htm", player);
^^^^^
Files cannot be resolved
----------
26. ERROR in /RateBonus.java (at line 48)
html = Files.read("data/scripts/services/RateBonusNo.htm", player);
^^^^^
Files cannot be resolved
----------
27. ERROR in /RateBonus.java (at line 54)
L2Player player = (L2Player) getSelf();
^^^^^^^^
L2Player cannot be resolved to a type
----------
28. ERROR in /RateBonus.java (at line 54)
L2Player player = (L2Player) getSelf();
^^^^^^^^
L2Player cannot be resolved to a type
----------
29. ERROR in /RateBonus.java (at line 54)
L2Player player = (L2Player) getSelf();
^^^^^^^
The method getSelf() is undefined for the type RateBonus
----------
30. ERROR in /RateBonus.java (at line 58)
L2Item item = ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]);
^^^^^^
L2Item cannot be resolved to a type
----------
31. ERROR in /RateBonus.java (at line 58)
L2Item item = ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]);
^^^^^^^^^^^^^
ItemTemplates cannot be resolved
----------
32. ERROR in /RateBonus.java (at line 58)
L2Item item = ItemTemplates.getInstance().getTemplate(Config.SERVICES_RATE_BONUS_ITEM[i]);
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_ITEM cannot be resolved or is not a field
----------
33. ERROR in /RateBonus.java (at line 59)
L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
^^^^^^^^^^^^^^
L2ItemInstance cannot be resolved to a type
----------
34. ERROR in /RateBonus.java (at line 60)
if(pay != null && pay.getCount() >= Config.SERVICES_RATE_BONUS_PRICE[i])
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_PRICE cannot be resolved or is not a field
----------
35. ERROR in /RateBonus.java (at line 62)
player.getInventory().destroyItem(pay, Config.SERVICES_RATE_BONUS_PRICE[i], true);
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_PRICE cannot be resolved or is not a field
----------
36. ERROR in /RateBonus.java (at line 63)
Log.add(player.getName() + "|" + player.getObjectId() + "|rate bonus|" + Config.SERVICES_RATE_BONUS_VALUE[i] + "|" + Config.SERVICES_RATE_BONUS_DAYS[i] + "|", "services");
^^^
Log cannot be resolved
----------
37. ERROR in /RateBonus.java (at line 63)
Log.add(player.getName() + "|" + player.getObjectId() + "|rate bonus|" + Config.SERVICES_RATE_BONUS_VALUE[i] + "|" + Config.SERVICES_RATE_BONUS_DAYS[i] + "|", "services");
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_VALUE cannot be resolved or is not a field
----------
38. ERROR in /RateBonus.java (at line 63)
Log.add(player.getName() + "|" + player.getObjectId() + "|rate bonus|" + Config.SERVICES_RATE_BONUS_VALUE[i] + "|" + Config.SERVICES_RATE_BONUS_DAYS[i] + "|", "services");
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_DAYS cannot be resolved or is not a field
----------
39. ERROR in /RateBonus.java (at line 66)
mysql.setEx(L2DatabaseFactory.getInstanceLogin(), "UPDATE `accounts` SET `bonus`=?,`bonus_expire`=UNIX_TIMESTAMP()+" + Config.SERVICES_RATE_BONUS_DAYS[i] + "*24*60*60 WHERE `login`=?", Config.SERVICES_RATE_BONUS_VALUE[i], player.getAccountName());
^^^^^
mysql cannot be resolved
----------
40. ERROR in /RateBonus.java (at line 66)
mysql.setEx(L2DatabaseFactory.getInstanceLogin(), "UPDATE `accounts` SET `bonus`=?,`bonus_expire`=UNIX_TIMESTAMP()+" + Config.SERVICES_RATE_BONUS_DAYS[i] + "*24*60*60 WHERE `login`=?", Config.SERVICES_RATE_BONUS_VALUE[i], player.getAccountName());
^^^^^^^^^^^^^^^^^
L2DatabaseFactory cannot be resolved
----------
41. ERROR in /RateBonus.java (at line 66)
mysql.setEx(L2DatabaseFactory.getInstanceLogin(), "UPDATE `accounts` SET `bonus`=?,`bonus_expire`=UNIX_TIMESTAMP()+" + Config.SERVICES_RATE_BONUS_DAYS[i] + "*24*60*60 WHERE `login`=?", Config.SERVICES_RATE_BONUS_VALUE[i], player.getAccountName());
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_DAYS cannot be resolved or is not a field
----------
42. ERROR in /RateBonus.java (at line 66)
mysql.setEx(L2DatabaseFactory.getInstanceLogin(), "UPDATE `accounts` SET `bonus`=?,`bonus_expire`=UNIX_TIMESTAMP()+" + Config.SERVICES_RATE_BONUS_DAYS[i] + "*24*60*60 WHERE `login`=?", Config.SERVICES_RATE_BONUS_VALUE[i], player.getAccountName());
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_VALUE cannot be resolved or is not a field
----------
43. ERROR in /RateBonus.java (at line 72)
player.getNetConnection().setBonus(Config.SERVICES_RATE_BONUS_VALUE[i]);
^^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_VALUE cannot be resolved or is not a field
----------
44. ERROR in /RateBonus.java (at line 73)
player.getNetConnection().setBonusExpire(System.currentTimeMillis() / 1000 + Config.SERVICES_RATE_BONUS_DAYS[i] * 24 * 60 * 60);
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_DAYS cannot be resolved or is not a field
----------
45. ERROR in /RateBonus.java (at line 77)
show(Files.read("data/scripts/services/RateBonusGet.htm", player), player);
^^^^^
Files cannot be resolved
----------
46. ERROR in /RateBonus.java (at line 79)
else if(Config.SERVICES_RATE_BONUS_ITEM[i] == 57)
^^^^^^^^^^^^^^^^^^^^^^^^
SERVICES_RATE_BONUS_ITEM cannot be resolved or is not a field
----------
47. ERROR in /RateBonus.java (at line 80)
player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
^^^
Msg cannot be resolved to a variable
----------
48. ERROR in /RateBonus.java (at line 82)
player.sendPacket(Msg.INCORRECT_ITEM_COUNT);
^^^
Msg cannot be resolved to a variable
----------
49. ERROR in /RateBonus.java (at line 87)
show("data/scripts/services/howtogetcol.htm", (L2Player) getSelf());
^^^^
The method show(String, L2Player) is undefined for the type RateBonus
----------
50. ERROR in /RateBonus.java (at line 87)
show("data/scripts/services/howtogetcol.htm", (L2Player) getSelf());
^^^^^^^^
L2Player cannot be resolved to a type
----------
51. ERROR in /RateBonus.java (at line 87)
show("data/scripts/services/howtogetcol.htm", (L2Player) getSelf());
^^^^^^^
The method getSelf() is undefined for the type RateBonus
----------