Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: C:/workspace/L2_GameServer/java/config/l2jmods.properties
- ===================================================================
- +
- +# ---------------------------------------------------------------------------
- +# Religion System By x.v3ndetta@yahoo.com
- +# ---------------------------------------------------------------------------
- +# Religion System is Something Really Unique. You Must Have Full Knowledge of What You Are Doing When Activating It.
- +# Religion System Work With TvT Events , CTF , DM , KOTH And Others.
- +
- +# Enable V3ndetta Religion System?
- +ReligionSystemEnable = False
- +
- +# Set The Religion Name of The First Religion.
- +FirstReligionName = Demons
- +
- +# Set The Religion Name of The Second Religion.
- +SecondReligionName = Angels
- +
- +# Set All The New Characters Heroes , On Their Creation?
- +NewCharSetHero = False
- +
- +# Set The Name Color of The First Religion
- +# Values Must Be In RGB
- +FirstReligionNameColor =
- +
- +# Set The Name Color of The Second Religion
- +# Values Must Be In RGB
- +SecondReligionNameColor =
- +
- +# Allow Reward for Each PvP?
- +AllowPvPReward = False
- +
- +# Set The Item You Want as a Reward
- +PvPRewardID = 57
- +
- +# Set The Amount of The Reward
- +PvPRewardAmount = 1
- +
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameservermodel/L2Character.java
- ===================================================================
- if (!isTeleporting())
- {
- setIsPendingRevive(false);
- + if ((this instanceof L2PcInstance) && (((L2PcInstance) this).isdemon() && Config.RELIGION_SYSTEM_ENABLE))
- + {
- + teleToLocation(73056, 142127, -3798);
- + } else
- + {
- + if ((this instanceof L2PcInstance) && (((L2PcInstance) this).isangel() && Config.RELIGION_SYSTEM_ENABLE))
- + {
- + teleToLocation(72954, 143363, -3798);
- + }
- + }
- setIsDead(false);
- boolean restorefull = false;
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- // Set Hero status if it applies
- if (Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(activeChar.getObjectId()))
- activeChar.setHero(true);
- + if (Config.RELIGION_SYSTEM_NEW_CHAR_SET_HERO)
- + {
- + if(!activeChar.isHero())
- + activeChar.setHero(true);
- + }
- +
- setPledgeClass(activeChar);
- boolean showClanNotice = false;
- @@ -324,6 +336,21 @@
- notifyPartner(activeChar,activeChar.getPartnerId());
- }
- if (activeChar.isCursedWeaponEquipped())
- {
- CursedWeaponsManager.getInstance().getCursedWeapon(activeChar.getCursedWeaponEquippedId()).cursedOnLogin();
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- // Character Character SQL String Definitions:
- private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=? WHERE charId=?";
- - private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot FROM characters WHERE charId=?";
- + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,demon=?,angel=? WHERE charId=?";
- + private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,demon,angel FROM characters WHERE charId=?";
- // Character Teleport Bookmark:
- private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
- @@ -524,6 +524,9 @@
- private boolean _noble = false;
- private boolean _hero = false;
- + private boolean _isdemon = false;
- + private boolean _isangel = false;
- +
- /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
- private L2Npc _lastFolkNpc = null;
- @@ -5469,6 +5472,27 @@
- // sendPacket(msg);
- return;
- }
- + if (Config.RELIGION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP && Config.RELIGION_SYSTEM_ENABLE)
- + {
- + if ((isangel() && targetPlayer.isangel()) || (isdemon() && targetPlayer.isdemon()))
- + {
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + } else
- + {
- + int itemReward = Config.RELIGION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
- + int idReward = Config.RELIGION_SYSTEM_PVP_ITEM_REWARD_ID;
- + addItem("Loot", idReward, itemReward, this, true);
- + sendMessage("You Won " + itemReward + " " + idReward + " From Your Kill.");
- + }
- + }
- + // pvp?
- + if (checkIfPvP(target) || (isdemon() && targetPlayer.isangel()) || (isangel() && targetPlayer.isdemon()))
- + {
- + increasePvpKills();
- + return;
- + }
- // If in duel and you kill (only can kill l2summon), do nothing
- if (isInDuel() && targetPlayer.isInDuel()) return;
- @@ -5558,6 +5582,11 @@
- */
- public void increasePkKillsAndKarma(int targLVL)
- {
- + if (Config.RELIGION_SYSTEM_ENABLE)
- + {
- + return;
- + }
- +
- int baseKarma = Config.KARMA_MIN_KARMA;
- int newKarma = baseKarma;
- int karmaLimit = Config.KARMA_MAX_KARMA;
- @@ -5629,11 +5658,19 @@
- public void updatePvPStatus()
- {
- +
- + if (!isangel() || !isdemon())
- + {
- + return;
- + }
- +
- if (isInsideZone(ZONE_PVP)) return;
- setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
- if (getPvpFlag() == 0)
- startPvPFlag();
- +
- +
- }
- public void updatePvPStatus(L2Character target)
- @@ -5643,6 +5680,14 @@
- if (player_target == null)
- return;
- + if (target instanceof L2PcInstance)
- + {
- + player_target = (L2PcInstance) target;
- + }
- + if (player_target.isangel() || player_target.isdemon())
- + {
- + return;
- + }
- if ((isInDuel() && player_target.getDuelId() == getDuelId())) return;
- if ((!isInsideZone(ZONE_PVP) || !player_target.isInsideZone(ZONE_PVP)) && player_target.getKarma() == 0)
- {
- @@ -5655,6 +5700,7 @@
- }
- }
- +
- /**
- * Restore the specified % of experience this L2PcInstance has
- * lost and sends a Server->Client StatusUpdate packet.<BR><BR>
- @@ -7018,6 +7064,8 @@
- player.setOnlineTime(rset.getLong("onlinetime"));
- player.setNewbie(rset.getInt("newbie"));
- player.setNoble(rset.getInt("nobless")==1);
- + player.setdemon(rset.getInt("demon") == 1 ? true : false);
- + player.setangel(rset.getInt("angel") == 1 ? true : false);
- player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
- if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
- @@ -7450,7 +7498,9 @@
- statement.setString(50, getName());
- statement.setLong(51, getDeathPenaltyBuffLevel());
- statement.setInt(52, getBookMarkSlot());
- - statement.setInt(53, getObjectId());
- + statement.setInt(53, isdemon() ? 1 : 0);
- + statement.setInt(54, isangel() ? 1 : 0);
- + statement.setInt(55, getObjectId());
- statement.execute();
- statement.close();
- @@ -8254,6 +8304,16 @@
- @Override
- public boolean isAutoAttackable(L2Character attacker)
- {
- +
- + if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).isdemon())
- + {
- + return true;
- + }
- + if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).isangel())
- + {
- + return true;
- + }
- +
- // Check if the attacker isn't the L2PcInstance Pet
- if (attacker == this || attacker == getPet())
- return false;
- @@ -8651,7 +8711,7 @@
- // Check if this is offensive magic skill
- if (skill.isOffensive())
- {
- if ((isInsidePeaceZone(this, target)) && !getAccessLevel().allowPeaceAttack())
- {
- // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
- sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- @@ -9056,6 +9116,12 @@
- */
- public boolean checkPvpSkill(L2Object target, L2Skill skill, boolean srcIsSummon)
- {
- +
- + if (isangel() || isdemon())
- + {
- + return true;
- + }
- +
- // check for PC->PC Pvp status
- if (
- target != null && // target not null and
- @@ -10010,6 +10076,27 @@
- sendPacket(sl);
- }
- + public boolean isdemon()
- + {
- + return _isdemon;
- + }
- +
- + public boolean isangel()
- + {
- + return _isangel;
- + }
- +
- + public void setdemon(boolean value)
- + {
- + _isdemon = value;
- + }
- +
- + public void setangel(boolean value)
- + {
- + _isangel = value;
- + }
- +
- +
- /**
- * 1. Add the specified class ID as a subclass (up to the maximum number of <b>three</b>)
- * for this character.<BR>
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2World.java
- ===================================================================
- /** HashMap(String Player name, L2PcInstance) containing all the players in game */
- private Map<String, L2PcInstance> _allPlayers;
- + private Map<String, L2PcInstance> _allkoofPlayers;
- + private Map<String, L2PcInstance> _allnoobPlayers;
- +
- /** L2ObjectHashMap(L2Object) containing all visible objects */
- private Map<Integer, L2Object> _allObjects;
- @@ -79,6 +82,8 @@
- {
- //_allGms = new FastMap<String, L2PcInstance>();
- _allPlayers = new FastMap<String, L2PcInstance>().setShared(true);
- + _allkoofPlayers = new FastMap<String, L2PcInstance>().setShared(true);
- + _allnoobPlayers = new FastMap<String, L2PcInstance>().setShared(true);
- _petsInstance = new FastMap<Integer, L2PetInstance>().setShared(true);
- _allObjects = new FastMap<Integer, L2Object>().setShared(true);
- @@ -224,6 +229,16 @@
- return _allPlayers;
- }
- + public Collection<L2PcInstance> getAllkoofPlayers()
- + {
- + return _allkoofPlayers.values();
- + }
- +
- + public Collection<L2PcInstance> getAllnoobPlayers()
- + {
- + return _allnoobPlayers.values();
- + }
- +
- /**
- * Return how many players are online.<BR><BR>
- *
- @@ -234,6 +249,16 @@
- return _allPlayers.size();
- }
- + public int getAllkoofPlayersCount()
- + {
- + return _allkoofPlayers.size();
- + }
- +
- + public int getAllnoobPlayersCount()
- + {
- + return _allnoobPlayers.size();
- + }
- +
- /**
- * Return the player instance corresponding to the given name.<BR><BR>
- *
- @@ -335,6 +360,14 @@
- tmp.closeNetConnection();
- return;
- }
- + if (((L2PcInstance) object).isdemon())
- + {
- + _allkoofPlayers.put(player.getName().toLowerCase(), player);
- + }
- + else if (((L2PcInstance) object).isangel())
- + {
- + _allnoobPlayers.put(player.getName().toLowerCase(), player);
- + }
- _allPlayers.put(player.getName().toLowerCase(), player);
- }
- }
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- _log.config("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);
- long serverLoadEnd = System.currentTimeMillis();
- _log.info("Server Loaded in " + ((serverLoadEnd - serverLoadStart) / 1000) + " seconds");
- +
- }
- public static void main(String[] args) throws Exception
- @@ -557,5 +558,18 @@
- {
- _log.info("Telnet server is currently disabled.");
- }
- + if (Config.RELIGION_SYSTEM_ENABLE)
- + {
- + System.out.println("####################################");
- + System.out.println("## Religion System is Activated. ##");
- + System.out.println("####################################");
- + }
- + else
- + {
- + System.out.println("###################################");
- + System.out.println("## Religion System is Disabled. ##");
- + System.out.println("###################################");
- + }
- +
- }
- }
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java
- ===================================================================
- public static boolean OFFLINE_SET_NAME_COLOR;
- public static int OFFLINE_NAME_COLOR;
- public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
- + public static boolean RELIGION_SYSTEM_ENABLE;
- + public static String RELIGION_SYSTEM_FIRST_NAME;
- + public static String RELIGION_SYSTEM_SECOND_NAME;
- + public static boolean RELIGION_SYSTEM_NEW_CHAR_SET_HERO;
- + public static int RELIGION_SYSTEM_FIRST_NAME_COLOR;
- + public static int RELIGION_SYSTEM_SECOND_NAME_COLOR;
- + public static boolean RELIGION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP;
- + public static int RELIGION_SYSTEM_PVP_ITEM_REWARD_ID;
- + public static int RELIGION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
- -
- //--------------------------------------------------
- // NPC Settings
- //--------------------------------------------------
- @@ -1932,6 +1961,36 @@
- OFFLINE_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("OfflineNameColor", "808080"));
- L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(L2JModSettings.getProperty("EnableManaPotionSupport", "false"));
- + RELIGION_SYSTEM_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("ReligionSystemEnable", "False"));
- + RELIGION_SYSTEM_FIRST_NAME = L2JModSettings.getProperty("FirstReligionName", "Demons");
- + RELIGION_SYSTEM_SECOND_NAME = L2JModSettings.getProperty("SecondReligionName", "Angels");
- + RELIGION_SYSTEM_NEW_CHAR_SET_HERO = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharSetHero", "False"));
- + RELIGION_SYSTEM_FIRST_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("FirstReligionNameColor", ""));
- + RELIGION_SYSTEM_SECOND_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("SecondReligionNameColor", ""));
- + RELIGION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP = Boolean.parseBoolean(L2JModSettings.getProperty("AllowPvPReward", "False"));
- + RELIGION_SYSTEM_PVP_ITEM_REWARD_ID = Integer.parseInt(L2JModSettings.getProperty("PvPRewardID", "57"));
- + RELIGION_SYSTEM_PVP_ITEM_REWARD_AMOUNT = Integer.parseInt(L2JModSettings.getProperty("PvPRewardAmount", "1"));
- }
- catch (Exception e)
- {
- Index: C:/workspace/L2_GameServer/java/net/sf/l2j/model/actor/instance/L2ReligionInstance.java
- ===================================================================
- /*
- * 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 com.l2scoria.gameserver.model.actor.instance;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.util.StringTokenizer;
- import java.util.logging.Logger;
- import com.l2scoria.Config;
- import com.l2scoria.util.database.L2DatabaseFactory;
- import com.l2scoria.gameserver.ai.CtrlIntention;
- import com.l2scoria.gameserver.model.L2World;
- import com.l2scoria.gameserver.network.serverpackets.ActionFailed;
- import com.l2scoria.gameserver.network.serverpackets.MyTargetSelected;
- import com.l2scoria.gameserver.network.serverpackets.NpcHtmlMessage;
- import com.l2scoria.gameserver.network.serverpackets.SocialAction;
- import com.l2scoria.gameserver.network.serverpackets.ValidateLocation;
- import com.l2scoria.gameserver.templates.L2NpcTemplate;
- import com.l2scoria.util.random.Rnd;
- public class L2ReligionInstance extends L2FolkInstance
- {
- public L2ReligionInstance(int objectId, L2NpcTemplate template)
- {
- super(objectId, template);
- }
- private final static Logger _log = Logger.getLogger(L2ReligionInstance.class.getName());
- @Override
- public void onBypassFeedback(L2PcInstance player, String command)
- {
- player.sendPacket(new ActionFailed());
- StringTokenizer st = new StringTokenizer(command, " ");
- String actualCommand = st.nextToken();
- String val = "";
- if (st.countTokens() >= 1)
- {
- val = st.nextToken();
- }
- else if (actualCommand.equalsIgnoreCase("levelup"))
- {
- setTarget(player);
- int lvl = player.getLevel();
- if (val.equalsIgnoreCase("1"))
- {
- long addexp = 0;
- addexp = player.getStat().getExpForLevel(lvl + 1) - player.getStat().getExp();
- player.getStat().addExp(addexp);
- player.broadcastKarma();
- player.sendMessage("level Up was Successfull.");
- } else
- {
- NpcHtmlMessage html = new NpcHtmlMessage(1);
- html.setFile("data/html/mods/Faction/levelup.htm");
- html.replace("%lvl%", String.valueOf(player.getLevel()));
- sendHtmlMessage(player, html);
- }
- } else if (actualCommand.equalsIgnoreCase("setangel"))
- {
- setTarget(player);
- if (player.isangel())
- {
- player.sendMessage("You Are Allready a " + Config.RELIGION_SYSTEM_SECOND_NAME + " religion ");
- player.sendPacket(new ActionFailed());
- } else
- {
- if (player.isdemon())
- {
- player.sendMessage("You Can't Change Religion.");
- player.sendPacket(new ActionFailed());
- } else
- {
- {
- player.setangel(true);
- Connection connection = null;
- try
- {
- connection = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
- statement.setString(1, player.getName());
- ResultSet rset = statement.executeQuery();
- int objId = 0;
- if (rset.next())
- {
- objId = rset.getInt(1);
- }
- rset.close();
- statement.close();
- if (objId == 0)
- {
- connection.close();
- return;
- }
- statement = connection.prepareStatement("UPDATE characters SET angel=1 WHERE obj_id=?");
- statement.setInt(1, objId);
- statement.execute();
- statement.close();
- connection.close();
- } catch (Exception e)
- {
- _log.info("could not set angel status of char:");
- } finally
- {
- try
- {
- connection.close();
- } catch (Exception e)
- {
- }
- }
- System.out.println("##Religion Engine## : player " + player.getName() + " Has Choose " + Config.RELIGION_SYSTEM_SECOND_NAME + " Faction");
- if (player.isangel() == true)
- {
- player.broadcastUserInfo();
- player.sendMessage("You Are fighiting Now for " + Config.RELIGION_SYSTEM_SECOND_NAME + " Faction ");
- player.getAppearance().setNameColor(Config.RELIGION_SYSTEM_SECOND_NAME_COLOR);
- player.setTitle(Config.RELIGION_SYSTEM_SECOND_NAME);
- player.teleToLocation(-83995, 243373, -3755);
- }
- }
- }
- }
- } else if (actualCommand.equalsIgnoreCase("setdemon"))
- {
- setTarget(player);
- if (player.isdemon())
- {
- player.sendMessage("You Are Allready a " + Config.RELIGION_SYSTEM_SECOND_NAME + " religion ");
- player.sendPacket(new ActionFailed());
- } else
- {
- if (player.isangel())
- {
- player.sendMessage("You Can't Change Religion.");
- player.sendPacket(new ActionFailed());
- } else
- {
- {
- player.setdemon(true);
- Connection connection = null;
- try
- {
- connection = L2DatabaseFactory.getInstance().getConnection();
- PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
- statement.setString(1, player.getName());
- ResultSet rset = statement.executeQuery();
- int objId = 0;
- if (rset.next())
- {
- objId = rset.getInt(1);
- }
- rset.close();
- statement.close();
- if (objId == 0)
- {
- connection.close();
- return;
- }
- statement = connection.prepareStatement("UPDATE characters SET demon=1 WHERE obj_id=?");
- statement.setInt(1, objId);
- statement.execute();
- statement.close();
- connection.close();
- } catch (Exception e)
- {
- _log.info("could not set demon status of char:");
- } finally
- {
- try
- {
- connection.close();
- } catch (Exception e)
- {
- }
- }
- System.out.println("##Religion Engine## : player " + player.getName() + " Has Choose " + Config.RELIGION_SYSTEM_FIRST_NAME + " Faction");
- if (player.isangel() == true)
- {
- player.broadcastUserInfo();
- player.sendMessage("You Are fighiting Now for " + Config.RELIGION_SYSTEM_FIRST_NAME + " Faction ");
- player.getAppearance().setNameColor(Config.RELIGION_SYSTEM_FIRST_NAME_COLOR);
- player.setTitle(Config.RELIGION_SYSTEM_FIRST_NAME);
- player.teleToLocation(-83995, 243373, -3755);
- }
- }
- }
- }
- }
- else
- {
- super.onBypassFeedback(player, command);
- }
- }
- @Override
- public void onAction(L2PcInstance player)
- {
- if (this != player.getTarget())
- {
- player.setTarget(this);
- player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
- player.sendPacket(new ValidateLocation(this));
- } else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false))
- {
- SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
- broadcastPacket(sa);
- player.setLastFolkNPC(this);
- showMessageWindow(player);
- player.sendPacket(new ActionFailed());
- } else
- {
- player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
- player.sendPacket(new ActionFailed());
- }
- }
- private void showMessageWindow(L2PcInstance player)
- {
- NpcHtmlMessage html = new NpcHtmlMessage(1);
- html.setFile("data/html/mods/Religion/religion.htm");
- html.replace("%objectId%", String.valueOf(getObjectId()));
- html.replace("%npcname%", getName());
- player.sendPacket(html);
- }
- private void sendHtmlMessage(L2PcInstance player, NpcHtmlMessage html)
- {
- html.replace("%objectId%", String.valueOf(getObjectId()));
- html.replace("%npcname%", getName());
- html.replace("%npcId%", String.valueOf(getNpcId()));
- player.sendPacket(html);
- }
- }
- Index: C:/workspace/L2_DataPatc/data/mods/Religion/religion.htm
- ===================================================================
- <html><title>Religion Manager</title>
- <body>
- <center>
- <font color="LEVEL">Choose Your Religion</font><br>
- <br>
- <a action="bypass -h npc_%objectId%_setdemon">Join The Demons Faction</a><br>
- <br>
- <a action="bypass -h npc_%objectId%_setangel">Join The Angels Faction</a><br>
- <br>
- <br>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement