/* * 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: java/com/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
===================================================================
--- java/com/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 4388)
+++ java/com/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (working copy)
@@ -18,6 +18,7 @@
import com.l2j.Config;
import com.l2j.gameserver.datatables.CharTemplateTable;
import com.l2j.gameserver.datatables.SkillTreeTable;
+import com.l2j.gameserver.model.L2ItemInstance;
import com.l2j.gameserver.model.L2PledgeSkillLearn;
import com.l2j.gameserver.model.base.ClassId;
import com.l2j.gameserver.model.base.ClassType;
@@ -289,7 +290,7 @@
* If they both exist, remove both unique items and continue with adding the
* sub-class.
*/
- if (allowAddition && !Config.ALT_GAME_SUBCLASS_WITHOUT_QUESTS)
+ if (allowAddition && (!Config.ALT_GAME_SUBCLASS_WITHOUT_QUESTS && haveSubItem(player)))
allowAddition = (checkQuests(player) || player.getIsSubclassAllowed());
if (allowAddition && isValidNewSubClass(player, paramOne, false))
@@ -612,6 +613,17 @@
return Race.Kamael;
}
+
+ public boolean haveSubItem(L2PcInstance player)
+ {
+ L2ItemInstance[] inventory = player.getInventory().getItems();
+ for (L2ItemInstance i : inventory)
+ {
+ if (i.getItemId() == 57) // tutaj ustaw sobie wymagany item
+ return true;
+ }
+ return false;
+ }
public final ClassType getVillageMasterTeachType()
{