VIP 杀气丶 发布于2022年1月12日 00:47 VIP 分享 发布于2022年1月12日 00:47 package seidhe.NewbieManager; import ru.catssoftware.gameserver.model.quest.Quest; import ru.catssoftware.gameserver.model.quest.QuestState; import ru.catssoftware.L2DatabaseFactory; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.model.actor.instance.L2NpcInstance; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; /** * @ author : Seidhe * @ date 05.09.2015 * NewbieManager for lucera. */ public class NewbieManager extends Quest { private static String qn = "NewbieManager"; private static int NEWBIE_Wings = 4037; // ID Крыльев private static int NEWBIE_Helm = 57; // ID Шлема private static int NEWBIE_Tattoo = 4037; // ID Тату private static int NPC_ID = 50030; // ID NPC public NewbieManager() { super(-1,qn,"custom"); } @Override public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player) { String []args = event.split(" "); if(args[0].startsWith("add_bonus")) { Connection con = null; ResultSet rset = null; try { con = L2DatabaseFactory.getInstance().getConnection(con); PreparedStatement statement = con.prepareStatement("SELECT isNewbie FROM `_newbie` WHERE charId=?"); statement.setInt(1,player.getObjectId()); rset = statement.executeQuery(); int isN=0; while(rset.next()) { isN= rset.getInt("isNewbie"); } if(isN==1){ statement = con.prepareStatement("REPLACE INTO _newbie VALUES(?,?)"); statement.setInt(1, player.getObjectId()); statement.setInt(2, 0); player.getInventory().addItem("Newbie_Bonus", NEWBIE_Wings, 1, player, player); player.getInventory().addItem("Newbie_Bonus", NEWBIE_Helm, 1, player, player); player.getInventory().addItem("Newbie_Bonus", NEWBIE_Tattoo, 1, player, player); statement.executeQuery(); player.sendMessage("Желаю удачи, новичёк!"); statement.close(); } else if (isN==0) { player.sendMessage("Вы уже получили награду"); return "hello.htm"; } } catch (Exception e) { e.printStackTrace(); } } return "hello.htm"; } @Override public String onFirstTalk(L2NpcInstance npc, L2PcInstance player) { return onTalk(npc, player); } @Override public String onTalk(L2NpcInstance npc, L2PcInstance player) { QuestState qs = player.getQuestState(qn); if(qs==null) qs = newQuestState(player); return "hello.htm"; } public static void main(String[] args) { NewbieManager ps = new NewbieManager(); ps.addFirstTalkId(NPC_ID); ps.addStartNpc(NPC_ID); ps.addTalkId(NPC_ID); _log.info("========================================"); _log.info("=== Newbie Manager by Seidhe LOADING ==="); _log.info("========================================"); } } 引用 意见的链接 分享到其他站点 更多分享选项...
已推荐帖子
参与讨论
你可以现在发布并稍后注册。 如果你有帐户,现在就登录发布帖子。