/*
* 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.
ElmoreLab Harbor - Eternal C1 x1:
✅ https://harbor.elmorelab.com
ElmoreLab Harbor - Eternal C1 x1 - is an exclusive server of the Eternal C1 chronicles from the top project ElmoreLab Harbor.
A unique server of its kind, on which everyone will have maximum pleasure, such as oldschool players who dream of nostalgia and to feel the warmest and classic C1 chronicles, as well as experienced players who are tired of thousands unbalanced servers of late chronicles.
Due to the professional corrections of the balance system and the HONEST gameplay system - on this server, EVERY player will feel like in their own, warm and cozy Harbor C1.
Let's return to the origins of L2 - back to 2004 in C1! ❤️
⭐ Server characteristics:
STRICTLY 1 window, NO BOXES
Bans for RMT and bots/cheats
No donations with benefits
Unique and high-quality PTS-build from Master Toma
Professional corrections and full class-balance
Reworked economy and closed all abuses
Improved animations and all aspects of the game
Exclusive HD-client with high-quality textures
Experienced administration and management
Fixed all bugs, geodata, exploits and holes
Maximum sociality due to the 1-box system
Discovering, exploring and researching
Big online
International server
Nostalgia and oldschool-feelings
Rates: x1
Server start: 14.02.2025
The server is at the final stages of development and preparation for release. Information on the server will be updated, soon the patchnotes and changes/edits will be posted.
Don't miss the legendary and epic experience on the best server in the last 20 years! ❤️
Join our C1-forum with a lot of information about server and active discussions.
⭐ Website:
https://harbor.elmorelab.com
✅ Forum:
https://forum-harbor.elmorelab.com
💥 Telegram:
https://t.me/l2harbor
https://t.me/l2harbor_chat
⚡ Discord:
https://discord.gg/harborelmorelab
yeah ok, if you say what is fuctional 100% i can't say something different 😛
but if someone find hard to compile it or get vs and all that things i have here one more simple way here to put overlay in your own server or to change your window name with few money.
I've been using this for 2 years now with no issues from Discord. I don't use ogg.dll either. This one works with any l2.exe too; I don’t see any difference between them.
hmm.. ok i just see that, is different code first of all. My sources is totally different based in other way, with else libraries.
I have access to modify everything even to make the clock to stop show how many time users play in server.
1) so maybe keep some personal info more hide.
2) i dont use ogg.dll
3) i create it and give it ready + support to install it.
Plus what is mine can working with what ever .exe you want not just l2 with same simple method.
And i am sure if you try this source to compile it, after 3 hours discord will like shadowban your API too
thats my source
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.