/* * Patch for filter_var() */ if(!function_exists('filter_var')){ define('FILTER_VALIDATE_IP', 'ip'); define('FILTER_FLAG_IPV4', 'ipv4'); define('FILTER_FLAG_IPV6', 'ipv6'); define('FILTER_VALIDATE_EMAIL', 'email'); define('FILTER_FLAG_EMAIL_UNICODE', 'unicode'); function filter_var($variable, $filter, $option = false){ if($filter == 'ip'){ if($option == 'ipv4'){ if(preg_match("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } if($option == 'ipv6'){ if(preg_match("/\s*(([:.]{0,7}[0-9a-fA-F]{0,4}){1,8})\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } if($filter == 'email'){ if($option == 'unicode' || $option == false){ if(preg_match("/\s*(\S*@\S*\.\S*)\s*/", $variable, $matches)){ $variable = $matches[1]; return $variable; } } } } }
Index: C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java
===================================================================
--- C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java (revision 3148)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java (working copy)
@@ -507,8 +507,21 @@
- public static boolean CUSTOM_TELEPORT_TABLE;
- public static boolean CUSTOM_DROPLIST_TABLE;
- public static boolean CUSTOM_MERCHANT_TABLES;
+ public static boolean CHARTITLESTART;
+ public static String CHARTITLE;
Index: C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java
(revision 3148)
@@ -507,8 +507,21 @@
- public static boolean CUSTOM_TELEPORT_TABLE;
- public static boolean CUSTOM_DROPLIST_TABLE;
- public static boolean CUSTOM_MERCHANT_TABLES;
+ public static boolean CHARTITLESTART;
+ public static String CHARTITLE;
public final class Config
{
protected static final Logger _log = Logger.getLogger(Config.class.getName());
...itd
public final class Config
{
/** Custom Starting Level*/
public static boolean ALLOW_CREATE_LVL;
protected static final Logger _log = Logger.getLogger(Config.class.getName());
...itd
// other
try
{
Properties otherSettings = new Properties();
InputStream is = new FileInputStream(new File(OTHER_CONFIG_FILE));
otherSettings.load(is);
is.close();
DEEPBLUE_DROP_RULES=Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules","True"));
...itd
DEEPBLUE_DROP_RULES=Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules","True"));
// other
try
{
Properties otherSettings = new Properties();
InputStream is = new FileInputStream(new File(OTHER_CONFIG_FILE));
otherSettings.load(is);
is.close();
ALLOW_CREATE_LVL = Boolean.parseBoolean(otherSettings.getProperty("CostumStartLvl", "False"));
DEEPBLUE_DROP_RULES = Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules", "True"));
... itd
// cSdddddddddddd
private String _name;
private int _race;
private byte _sex;
private int _classId;
private int _int;
private int _str;
private int _con;
private int _men;
private int _dex;
private int _wit;
private byte _hairStyle;
private byte _hairColor;
private byte _face;
private long _exp;
@Override
protected void readImpl()
{
_name = readS();
_race = readD();
_sex = (byte)readD();
_classId = readD();
_int = readD();
_str = readD();
_con = readD();
_men = readD();
_dex = readD();
_wit = readD();
_hairStyle = (byte)readD();
_hairColor = (byte)readD();
_face = (byte)readD();
_exp = 804219972;
}
newChar.setXYZInvisible(template.spawnX, template.spawnY, template.spawnZ);
if(Config.ALLOW_CREATE_LVL)
{
newChar.removeExpAndSp(newChar.getExp(), 0);
newChar.addExpAndSp(_exp, 0);
}
# Zezwalaj na custom początkowy poziom nowych postaci, docelowo = false
# Gdy wpiszesz True , każda nowa postać otrzyma automatycznie 75 poziom
CostumStartLvl = False
/*
* This program 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.
*
* This program 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GameServer;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
public class VoiceInfo implements IVoicedCommandHandler
{
private static String[] VOICED_COMMANDS =
{ "donate" };
/* (non-Javadoc)
* @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
*/
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
String htmFile = "data/html/custom/donate.htm";
String htmContent = HtmCache.getInstance().getHtm(htmFile);
if (htmContent != null)
{
NpcHtmlMessage infoHtml = new NpcHtmlMessage(1);
infoHtml.setHtml(htmContent);
activeChar.sendPacket(infoHtml);
}
else
{
activeChar.sendMessage("Przepraszamy,ale " + htmFile + " ! jest tymczasowo niedostępny!");
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
{ "donate" };
String htmFile = "data/html/custom/donate.htm";
}
else
{
activeChar.sendMessage("Przepraszamy, ale " + htmFile + " ! jest tymczasowo niedostępny!");
}
return true;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Donate;
private VoicedCommandHandler()
{
registerVoicedCommandHandler(new Donate());
else
{
sm = new SystemMessage(SystemMessageId.S1_S2_SUCCESSFULLY_ENCHANTED);
sm.addNumber(item.getEnchantLevel());
sm.addItemName(item.getItemId());
activeChar.sendPacket(sm);
}
item.setEnchantLevel(item.getEnchantLevel()+1);
item.updateDatabase();
}
}
item.setEnchantLevel(item.getEnchantLevel()+1);
if (scrollTemplate.isBlessed())
{
// blessed enchant - clear enchant value
sm = new SystemMessage(SystemMessageId.BLESSED_ENCHANT_FAILED);
activeChar.sendPacket(sm);
item.setEnchantLevel(0);
item.updateDatabase();
activeChar.sendPacket(new EnchantResult(3, 0, 0));
a teraz zmieniamy wartość na tę która nas interesuje (proponuje tu użyć wartości safe enchantu)item.setEnchantLevel(0);
//--------------------------------------------------
// L2J Property File Definitions
//--------------------------------------------------
public static final String CHARACTER_CONFIG_FILE = "./config/Character.properties";
public static final String NAZWA_CONFIG_FILE = "./config/NAZWA.properties";
public static final String MATIM_CONFIG_FILE = "./config/matim.properties";
/**
* This class initializes all global variables for configuration.<br>
* If the key doesn't appear in properties file, a default value is set by this class.
* @see CONFIGURATION_FILE (properties file) for configuring your server.
*/
public static void load()
{
if(Server.serverMode == Server.MODE_GAMESERVER)
{
_log.info("Loading GameServer Configuration Files...");
InputStream is = null;
try
{
try
{
...itd
........
throw new Error("MinProtocolRevision is bigger than MaxProtocolRevision in server configuration file.");
}
}
catch (Exception e)
{
e.printStackTrace();
throw new Error("Failed to Load "+CONFIGURATION_FILE+" File.");
}
// Load matim Properties file (if exists)
try
{
Properties matimSettings = new Properties();
is = new FileInputStream(new File(MATIM_CONFIG_FILE));
matimSettings.load(is);
//Tutaj dodajemy Lokacje Configa . Np :
CHAR_TITLE = Boolean.parseBoolean(matimSettings.getProperty("CharTitle", "false"));
}
catch (Exception e)
{
e.printStackTrace();
throw new Error("Failed to Load "+PVP_CONFIG_FILE+" File.");
}
ackage com.l2jfree.gameserver.handler.itemhandlers;
import com.l2jfree.Config;
import com.l2jfree.gameserver.handler.IItemHandler;
import com.l2jfree.gameserver.GameServer;
import com.l2jfree.gameserver.cache.HtmCache;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfree.gameserver.handler.IItemHandler;
import com.l2jfree.gameserver.model.L2ItemInstance;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.model.actor.instance.L2PlayableInstance;
public class Matim implements IItemHandler
{
private static final int[] ITEM_IDS = { ID_Przedmiotu! };
public void useItem(L2PlayableInstance playable, L2ItemInstance item)
{
if (!(playable instanceof L2PcInstance))
return;
L2PcInstance activeChar = (L2PcInstance)playable;
int itemId = item.getItemId();
if (itemId == ID_Przedmiotu)
{
String htmFile = "data/html/Custom/Matim.htm";
String htmContent = HtmCache.getInstance().getHtm(htmFile);
NpcHtmlMessage infoHtml = new NpcHtmlMessage(1);
infoHtml.setHtml(htmContent);
activeChar.sendPacket(infoHtml);
}
}
public int[] getItemIds()
{
return ITEM_IDS;
}
}
public class Matim implements IItemHandler
private static final int[] ITEM_IDS = { ID_Przedmiotu! };
if (itemId == ID_Przedmiotu)
registerItemHandler(new Matim());
import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot;
import net.sf.l2j.gameserver.skills.Stats;
// Consume Soul shots if player has enough of them
int saSSCount = (int) activeChar.getStat().calcStat(Stats.SOULSHOT_COUNT, 0, null, null);
int SSCount = saSSCount == 0 ? weaponItem.getSoulShotCount() : saSSCount;
if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), SSCount, null, false))
{
if (activeChar.getAutoSoulShot().containsKey(itemId))
{
activeChar.removeAutoSoulShot(itemId);
activeChar.sendPacket(new ExAutoSoulShot(itemId, 0));
SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
sm.addString(item.getItem().getName());
activeChar.sendPacket(sm);
}
else
activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SOULSHOTS));
return;
}
import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot;
// Consume Blessed SpiritShot if player has enough of them
if (!activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false))
{
if (activeChar.getAutoSoulShot().containsKey(itemId))
{
activeChar.removeAutoSoulShot(itemId);
activeChar.sendPacket(new ExAutoSoulShot(itemId, 0));
SystemMessage sm = new SystemMessage(SystemMessageId.AUTO_USE_OF_S1_CANCELLED);
sm.addString(item.getItem().getName());
activeChar.sendPacket(sm);
}
else
activeChar.sendPacket(new SystemMessage(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS));
return;
}
:if (item.isEquipable())
{
if (activeChar.isDisarmed())
return;
if (!((L2Equip) item.getItem()).allowEquip(activeChar))
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));
return;
}
}
if (activeChar.getClassId().getId() == 88)
{
if (item.getItemType() == L2ArmorType.MAGIC)
{
activeChar.sendPacket(new +SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));
return;
}
}
if (activeChar.getClassId().getId() == 88)
if (item.getItemType() == L2ArmorType.MAGIC)
activeChar.sendPacket(new +SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP))
- Czyli wyśle wiadomość systemową, że nie może założyć tego itemu
- W ten sposób dana klasa nie może zakładać armorów danego typu.
return;
if (item.getItemType() == L2WeaponType.BOW)
- lukif (item.getItemType() == L2WeaponType.DAGGER)
- sztyletif (item.getItemType() == L2WeaponType.SWORD)
- miecz // Add karma to attacker and increase its PK counter
setPvpKills(getPvpKills() + 1);
addItem("Loot", 57, 1000, this, true);
sendMessage("Wygrałeś 1000 adeny za PvPl!");
public void increasePvpKills()
{
addItem("Loot", 57, 1000, this, true);
sendMessage("Wygrałeś 1000 adeny za PvPl!");
// Add karma to attacker and increase its PK counter
setPkKills(getPkKills() + 1);
setKarma(getKarma() + newKarma);
private static final int[] ITEM_IDS = { 736, 1830, 1829, 1538, 3958, 5858, 5859,
7117,7118,7119,7120,7121,7122,7123,7124,
7125,7126,7127,7128,7129,7130,7131,7132,
7133,7134,7135,7554,7555,7556,7557,7558,
7559,7618,7619};
private static final int[] ITEM_IDS = { 736, 1830, 1829, 1538, 3958, 5858, 5859,
7117,7118,7119,7120,7121,7122,7123,7124,
7125,7126,7127,7128,7129,7130,7131,7132,
7133,7134,7135,7554,7555,7556,7557,7558,
7559,7618,7619,1234};
case 7619 :
_activeChar.teleToLocation(108275,-53785,-2524, true); // Varka Silenos Village
break;
case 1234 :
_activeChar.teleToLocation(X,Y,Z, true);
break;
// Custom Starting Level
/** Custom
* Starting
* Level
*/
/**
* <ol>
* <li>Something
* <li>Again
* <li>Once Again
* </ol>
*/
/**
*
* @author Matim
*
*/
public static final int ADENA_ID = 57;
public static final int ANCIENT_ADENA_ID = 5575;
public static final long MAX_ADENA = 99900000000L;
ifor (L2ItemInstance item : _items)
{
if ((!allowAdena && item.getItemId() == 57))
continue;
if ((!allowAncientAdena && item.getItemId() == 5575))
continue;
update `weapon` set `price` = 0; update `etcitem` set `price` = 0; update `armor` set `price` = 0
co spowoduje że przedmioty do sklepu będą oddawane za darmojava/net/sf/l2j/gameserver/model/actor/instance/
I tworzymy nowy plik:L2CraftManagerInstance.java
2. Wklejamy do niego:public static final int ADENA_ID = 57;
W tej linijce jest ID przedmiotu za które Craft Manager będzie krafcił nam itemki. W tym przypadku jest to ID 57 czyli Adenapublic static final int ITEMS_PER_PAGE = 5;
Zaś ta linijka mówi nam ile itemków będzie wyświetlanych na 1 stronie. W tym przypadku jest to 5return "data/html/NPCCRAFTER/" + pom + ".htm";
Ta linijka mówi nam gdzie ma być wstawiony plik HTM naszego Craft Managerajava/net/sf/l2j/Config.java
i szukamy takich linijek:public static int OFFLINE_NAME_COLOR;
public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
U mnie są to "617" i "618"public static int CRAFT_MANAGER_PRICE_MULTIPLIER;
public static int CRAFT_MANAGER_DEFAULT_PRICE;
public static boolean CRAFT_MANAGER_DWARVEN_CRAFT;
public static boolean CRAFT_MANAGER_COMMON_CRAFT;
public static boolean CRAFT_MANAGER_CRYSTALLIZE;
public static int CRAFT_MANAGER_PRICE;
Potem szukamy:BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
I nad nimi dodajemy:CRAFT_MANAGER_PRICE_MULTIPLIER = Integer.parseInt(L2JModSettings.getProperty("CraftManagerPriceMultiplier", "1"));
CRAFT_MANAGER_DEFAULT_PRICE = Integer.parseInt(L2JModSettings.getProperty("CraftManagerDefaultPrice", "50000"));
CRAFT_MANAGER_DWARVEN_CRAFT = Boolean.parseBoolean(L2JModSettings.getProperty("CraftManagerDwarvenCraft", "True"));
CRAFT_MANAGER_COMMON_CRAFT = Boolean.parseBoolean(L2JModSettings.getProperty("CraftManagerCommonCraft", "True"));
CRAFT_MANAGER_CRYSTALLIZE = Boolean.parseBoolean(L2JModSettings.getProperty("CraftManagerCrystallize", "True"));
CRAFT_MANAGER_PRICE = Integer.parseInt(L2JModSettings.getProperty("CraftManagerPrice", "2"));
4. Teraz idziemy do:java/config/l2jmods.properties
I na samym dole dodajemy:# ---------------------------------------------------------------------------
# Npc Crafter
# ---------------------------------------------------------------------------
# Czy Craft Manager może krafcić zwykłe itemy ?
# Domyślnie: True
CraftManagerDwarvenCraft = True
# Czy Craft Manager może krafcić common itemy ?
# Domyślnie: True
CraftManagerCommonCraft = True
# Czy Craft Manager może krystalizować itemy ?
# Domyślnie: True
CraftManagerCrystallize = True
# Tutaj podaj ile razy więcej Craft Manager bedzię brał rzeczy za 1 craft
# Np. na recipe AM trzeba 200 DMP jeżeli tutaj bedzie podane 2 to trzeba bedzię 2 razy więcej czyli 400 DMP
# Domyślnie: 1
CraftManagerPriceMultiplier = 1
# Domyślna cena u Craft Managera
# Domyślnie: 50000
CraftManagerDefaultPrice = 50000
# Nie ustawiaj tej opcji za wysokiej bo Craft Manager będzie za drogi !
# Domyślnie: 2
CraftManagerPrice = 2
5. Teraz idziemy do:java/net/sf/l2j/gameserver/model/
Otwieramy plik L2Multisell.java i na samym dole mamy @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final L2Multisell _instance = new L2Multisell();
}
}
Dodajemy tam takie coś:public void separateAndSend(int parseInt, L2PcInstance player, boolean b,
double taxRate) {}}
Całość ma wyglądać tak: @SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final L2Multisell _instance = new L2Multisell();
}
public void separateAndSend(int parseInt, L2PcInstance player, boolean b,
double taxRate) {}}
Po dodaniu można skompilować już GAMESERVERgameserver/data/html/
Tworzymy folder o nazwie:NPCCRAFTER
I tworzymy plik:9999.htm
W nim piszemy coś takiego:<html><body>
Ivan:
[br /]
<font color="CCCC00">Witaj przybyszu! Mozesz u mnie krystalizowac i krafcic rozne rzeczy.</font></br>
<center>
<table width=240>
<tr>
<td><button value="Crystallize" action="bypass -h npc_%objectId%_Crystallize" width=120 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
<td><button value="Manufacture" action="bypass -h npc_%objectId%_Manufacture" width=120 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"></td>
</tr>
</table>
</center>[br /]
<center><img src="L2Font-e.mini_logo-e" width=250 height=85></center>
</body>
</html>
I zapisujemy. Możemy już skompilować DATAPACKAINSERT INTO `custom_npc` VALUES (
"9999", "30300", "Ivan", "1", "Craft Manager", "1", "LineageNPC.clear_npc", "7", "16", "70", "male", "L2CraftManager", "40", "4765", "2569", "4", "3", "40", "31", "24", "10", "65", "20", "0", "0", "1597", "2367", "4567", "1276", "798", "0", "1500", "0", "0", "0", "40", "120", "0", "1", "0", "0", "LAST_HIT", "0", "0", "0", "fighter", "false" );
I wciskamy Enter gdy wszystko zrobi poprawnie odpalamy nasz serwer i wpisujemy //spawn 9999