/*
* Copyright (C) 2004-2013 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J DataPack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package custom.Services;import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.sql.Connection;import java.sql.PreparedStatement;import java.util.logging.Logger;import com.l2jserver.commons.database.pool.impl.ConnectionFactory;import com.l2jserver.gameserver.data.sql.impl.CharNameTable;import com.l2jserver.gameserver.data.sql.impl.ClanTable;import com.l2jserver.gameserver.model.actor.L2Npc;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;import com.l2jserver.gameserver.model.olympiad.OlympiadManager;import com.l2jserver.gameserver.model.quest.Quest;import com.l2jserver.gameserver.model.quest.QuestState;import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;/**
* @author Colet , Tradução OuTSide
*/publicclassServices extends Quest{publicstatic final Logger _log =Logger.getLogger(Services.class.getName());// NPC Idint servicesNpc =9013;// Noble Itemsint nobleItemId =57;long nobleItemCount =1;// PK Reduce Itemsint pkReduceItemId =57;long pkReduceItemCount =1000;// Change Name Itemsint changeNameItemId =57;long changeNameItemCount =1000000;
boolean logNameChanges =true;// Change Clan Name Itemsint changeClanNameItemId =57;long changeClanNameItemCount =50000;
boolean logClanNameChanges =true;int clanMinLevel =5;// Clan Level Itemsint[] clanLevelItemsId ={57,// Level 5 to 657,// Level 6 to 757,// Level 7 to 857,// Level 8 to 957,// Level 9 to 1057// Level 10 to 11};long[] clanLevelItemsCount ={6,// Level 5 to 67,// Level 6 to 78,// Level 7 to 89,// Level 8 to 910,// Level 9 to 1011// Level 10 to 11};// Clan Reputation Points Itemsint clanReputationPointsItemId =57;long clanReputationPointsItemCount =5;// Change Gender Itemsint changeGenderItemId =57;long changeGenderItemCount =50;publicServices(int questId,String name,String descr){
super(questId, name, descr);
addStartNpc(servicesNpc);
addFirstTalkId(servicesNpc);
addTalkId(servicesNpc);}publicstaticvoid main(String[] args){newServices(-1,Services.class.getSimpleName(),"custom");}publicString onFirstTalk(L2Npc npc, L2PcInstance player){if(player.getQuestState(getName())==null){
newQuestState(player);}elseif(player.isInCombat()){return"Services-Blocked.htm";}elseif(player.getPvpFlag()==1){return"Services-Blocked.htm";}elseif(player.getKarma()!=0){return"Services-Blocked.htm";}elseif(OlympiadManager.getInstance().isRegistered(player)){return"Services-Blocked.htm";}return"Services.htm";}publicString onAdvEvent(String event, L2Npc npc, L2PcInstance player){String htmlText = event;QuestState st = player.getQuestState(getName());if(event.equals("setNoble")){if(!player.isNoble()){if(st.getQuestItemsCount(nobleItemId)>= nobleItemCount){
st.takeItems(nobleItemId, nobleItemCount);
player.setNoble(true);
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));
player.broadcastUserInfo();return"NoblesseServices-Success.htm";}else{return"NoblesseServices-NoItems.htm";}}else{return"NoblesseServices-AlredyNoble.htm";}}elseif(event.equals("levelUpClan")){if(!player.isClanLeader()){return"ClanLevelUp-NoLeader.htm";}else{if(player.getClan().getLevel()==11){return"ClanLevelUp-MaxLevel.htm";}else{if(((player.getClan().getLevel()<=1)||(player.getClan().getLevel()==2)||(player.getClan().getLevel()==3)||(player.getClan().getLevel()==4))){
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}elseif(player.getClan().getLevel()==5){if(st.getQuestItemsCount(clanLevelItemsId[0])>= clanLevelItemsCount[0]){
st.takeItems(clanLevelItemsId[0], clanLevelItemsCount[0]);
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}else{return"ClanLevelUp-NoItems.htm";}}elseif(player.getClan().getLevel()==6){if(st.getQuestItemsCount(clanLevelItemsId[1])>= clanLevelItemsCount[1]){
st.takeItems(clanLevelItemsId[1], clanLevelItemsCount[1]);
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}else{return"ClanLevelUp-NoItems.htm";}}elseif(player.getClan().getLevel()==7){if(st.getQuestItemsCount(clanLevelItemsId[2])>= clanLevelItemsCount[2]){
st.takeItems(clanLevelItemsId[2], clanLevelItemsCount[2]);
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}else{return"ClanLevelUp-NoItems.htm";}}elseif(player.getClan().getLevel()==8){if(st.getQuestItemsCount(clanLevelItemsId[3])>= clanLevelItemsCount[3]){
st.takeItems(clanLevelItemsId[3], clanLevelItemsCount[3]);
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}else{return"ClanLevelUp-NoItems.htm";}}elseif(player.getClan().getLevel()==9){if(st.getQuestItemsCount(clanLevelItemsId[4])>= clanLevelItemsCount[4]){
st.takeItems(clanLevelItemsId[4], clanLevelItemsCount[4]);
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}else{return"ClanLevelUp-NoItems.htm";}}elseif(player.getClan().getLevel()==10){if(st.getQuestItemsCount(clanLevelItemsId[5])>= clanLevelItemsCount[5]){
st.takeItems(clanLevelItemsId[5], clanLevelItemsCount[5]);
player.getClan().setLevel(player.getClan().getLevel()+1);
player.getClan().broadcastClanStatus();
player.sendMessage("Seu clan é agora nível "+ player.getClan().getLevel()+".");
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));return"ClanLevelUp.htm";}else{return"ClanLevelUp-NoItems.htm";}}try(Connection con =ConnectionFactory.getInstance().getConnection();PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_level=? WHERE clan_id=?")){
statement.setInt(1, player.getClan().getLevel());
statement.setInt(2, player.getClan().getClanId());
statement.execute();
statement.close();}catch(Exception e){
_log.info("Error updating clan level for player "+ player.getName()+". Error: "+ e);}
player.getClan().broadcastClanStatus();return"ClanLevelUp.htm";}}}elseif(event.equals("changeGender")){if(st.getQuestItemsCount(changeGenderItemId)>= changeGenderItemCount){
st.takeItems(changeGenderItemId, changeGenderItemCount);
player.getAppearance().setSex(player.getAppearance().getSex()?false:true);
player.setTarget(player);
player.broadcastPacket(newMagicSkillUse(player,5103,1,1000,0));
player.broadcastUserInfo();return"ChangeGender-Success.htm";}else{return"ChangeGender-NoItems.htm";}}elseif(event.startsWith("changeName")){try{String newName = event.substring(11);if(st.getQuestItemsCount(changeNameItemId)>= changeNameItemCount){if(newName ==null){return"ChangeName.htm";}else{if(!newName.matches("^[a-zA-Z0-9]+$")){
player.sendMessage("Nome incorreto. Por favor, tente novamente.");return"ChangeName.htm";}elseif(newName.equals(player.getName())){
player.sendMessage("Por favor, escolha um nome diferente.");return"ChangeName.htm";}elseif(CharNameTable.getInstance().doesCharNameExist(newName)){
player.sendMessage("O nome "+ newName +" já existe.");return"ChangeName.htm";}else{if(logNameChanges){String fileName ="log/Services/Name Change - "+ player.getName()+".txt";newFile(fileName);FileWriter fileText =newFileWriter(fileName);BufferedWriter fileContent =newBufferedWriter(fileText);
fileContent.write("Character name change info:\r\n\r\nCharacter original name: "+ player.getName()+"\r\nCharacter new name: "+ newName);
fileContent.close();}
st.takeItems(changeNameItemId, changeNameItemCount);
player.setName(newName);
player.store();
player.sendMessage("Seu novo nome do personagem é "+ newName);
player.broadcastUserInfo();return"ChangeName-Success.htm";}}}else{return"ChangeName-NoItems.htm";}}catch(Exception e){
player.sendMessage("Por favor, insira um nome correto.");return"ChangeName.htm";}}elseif(event.startsWith("reducePks")){try{String pkReduceString = event.substring(10);int pkReduceCount =Integer.parseInt(pkReduceString);if(player.getPkKills()!=0){if(pkReduceCount ==0){
player.sendMessage("Por favor, coloque um valor mais alto.");return"PkServices.htm";}else{if(st.getQuestItemsCount(pkReduceItemId)>= pkReduceItemCount){
st.takeItems(pkReduceItemId, pkReduceItemCount * pkReduceCount);
player.setPkKills(player.getPkKills()- pkReduceCount);
player.sendMessage("Você limpou com sucesso "+ pkReduceCount +" PKs.");
player.broadcastUserInfo();return"PkServices-Success.htm";}else{return"PkServices-NoItems.htm";}}}else{return"PkServices-NoPks.htm";}}catch(Exception e){
player.sendMessage("Valor incorreto. Por favor, tente novamente.");return"PkServices.htm";}}elseif(event.startsWith("changeClanName")){if(player.getClan()==null){return"ChangeClanName-NoClan.htm";}else{try{String newClanName = event.substring(15);if(st.getQuestItemsCount(changeClanNameItemId)>= changeClanNameItemCount){if(newClanName ==null){return"ChangeClanName.htm";}else{if(!player.isClanLeader()){
player.sendMessage("Apenas o líder do clã pode mudar o nome do clan.");return"ChangeClanName.htm";}elseif(player.getClan().getLevel()< clanMinLevel){
player.sendMessage("Seu clan deve ter pelo menos nível "+ clanMinLevel +" para mudar o nome.");return"ChangeClanName.htm";}elseif(!newClanName.matches("^[a-zA-Z0-9]+$")){
player.sendMessage("Nome incorreto. Por favor, tente novamente.");return"ChangeClanName.htm";}elseif(newClanName.equals(player.getClan().getName())){
player.sendMessage("Por favor, escolha um nome diferente.");return"ChangeClanName.htm";}elseif(null!=ClanTable.getInstance().getClanByName(newClanName)){
player.sendMessage("O nome "+ newClanName +" já existe.");return"ChangeClanName.htm";}else{if(logClanNameChanges){String fileName ="log/Services/Clan Name Change - "+ player.getClan().getName()+".txt";newFile(fileName);FileWriter fileText =newFileWriter(fileName);BufferedWriter fileContent =newBufferedWriter(fileText);
fileContent.write("Clan name change info:\r\n\r\nClan original name: "+ player.getClan().getName()+"\r\nClan new name: "+ newClanName +"\r\nClan Leader: "+ player.getName());
fileContent.close();}
st.takeItems(changeNameItemId, changeNameItemCount);
player.getClan().setName(newClanName);try(Connection con =ConnectionFactory.getInstance().getConnection();PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_name=? WHERE clan_id=?")){
statement.setString(1, newClanName);
statement.setInt(2, player.getClan().getClanId());
statement.execute();
statement.close();}catch(Exception e){
_log.info("Error updating clan name for player "+ player.getName()+". Error: "+ e);}
player.sendMessage("O novo nome do clan é "+ newClanName);
player.getClan().broadcastClanStatus();return"ChangeClanName-Success.htm";}}}else{return"ChangeClanName-NoItems.htm";}}catch(Exception e){
player.sendMessage("Por favor, insira um nome correto.");return"ChangeClanName.htm";}}}elseif(event.startsWith("setReputationPoints")){try{String reputationPointsString = event.substring(20);int reputationPointsCount =Integer.parseInt(reputationPointsString);if(player.getClan()==null){return"ClanReputationPoints-NoClan.htm";}elseif(!player.isClanLeader()){return"ClanReputationPoints-NoLeader.htm";}else{if(reputationPointsCount ==0){
player.sendMessage("Por favor, coloque um valor mais alto.");return"ClanReputationPoints.htm";}else{if(st.getQuestItemsCount(clanReputationPointsItemId)>= clanReputationPointsItemCount){
st.takeItems(clanReputationPointsItemId, clanReputationPointsItemCount * reputationPointsCount);
player.getClan().addReputationScore(player.getClan().getReputationScore()+ reputationPointsCount,true);
player.getClan().broadcastClanStatus();return"ClanReputationPoints-Success.htm";}else{return"ClanReputationPoints-NoItems.htm";}}}}catch(Exception e){
player.sendMessage("Valor incorreto. Por favor, tente novamente.");return"ClanReputationPoints.htm";}}return htmlText;}}
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.
❖Items that are sent by physical delivery are sent using someone else's data. That is, if you are not able to accept the parcel, we will not be able to return it. Please keep this in mind.
READY IN STOCK
PAYMENT SYSTEMS
4x4 io, Weststein, Paysafecard, Paysend, Genome, Conotoxia, Mybrocard, Payz Silver, Pockit UK, NagaPay, Volet com, SpectroCoin, SwissMoney, Yuh, Lydia / Sumeria, Ka.App, Wittix, Western Union, MyGuava, Xapo Bank, Bunq on emulator (DE, NL, FR, ES, IE ibans), Revolut on emulator (UK/EU), ICard, BlackCatCard, Vivid DE, Bankera, Bitsa, Wise EU/UK, N26 DE/ES on emulator, Skrill, Neteller, Trasta, Wirex, Lama, Paysera, Moneyjar
CRYPTOEXCHANGE
BINGX com, Bybit LVL 2, KuCoin, Binance LVL 2, Mexc, Latoken, Poloniex, Bitmart, Kraken, WhiteBit, Quppy, Nexo, Gate, OKX, Paybis, Paxful, Huobi (HTX), xcoins com, Bit2Me
BUSINESS ACCOUNTS
Stripe, Payoneer EU, Wise Business UK/EU, Revolut Business EU/UK, N26 Business DE, Wallester Business EU, Kraken Business Pro, Monzo Business, Vivid Business, Zen Business EU, Millennium Business PL, AirWallex EU/UK, Finom business, PayPal business, Payset business
NATIONAL BANKS / BANKS
BBVA, CommerzBank, ING, Santander, Kaspi Bank, Sberbank, AlfaBank, Tbank, Raiffeisen, mBank, Paribas, Bereke Bank, Kapital Bank
DISCORD :
utchiha_market
telegram :
https://t.me/utchiha_market
SELLIX STORE :
https://utchihamkt.mysellix.io/
Join our server for more products :
https://discord.gg/hood-services
https://campsite.bio/utchihaamkt
Question
criss22
HI all..I have code for Service Manager. But in ServiceManager.java i have some errors. (i think it's not for last rev. of L2jServer) and
i want to know how i can modify few lines for good function in game.
This is errors in GameServer.bat
http://
and here it`s code for ServiceManager.java
Thank's.
8 answers to this question
Recommended Posts
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.