Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2ReligionManagerInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2ReligionManagerInstance.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2ReligionManagerInstance.java (revision 0)
- @@ -0,0 +1,82 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
- +/**
- + *
- + * @author Anarchy
- + */
- +public class L2ReligionManagerInstance extends L2NpcInstance
- +{
- + public static String religion1name = "Xristianoi"; // This is nothing, it will be deleted after next update.
- + public static String religion2name = "Mousoulmanoi"; // This is nothing, it will be deleted after next update.
- + public L2ReligionManagerInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance player, String command)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(1);
- + if (command.equals("setReligion1"))
- + {
- + if (!player.isReligion1() && !player.isReligion2())
- + {
- + player.setReligion1(true);
- + player.sendMessage("You have successfully selected your religion.");
- + }
- + else
- + {
- + player.sendMessage("You have already selected your religion.");
- + }
- + }
- + if (command.equals("setReligion2"))
- + {
- + if (!player.isReligion1() && !player.isReligion2())
- + {
- + player.setReligion2(true);
- + player.sendMessage("You have successfully selected your religion.");
- + }
- + else
- + {
- + player.sendMessage("You have already selected your religion.");
- + }
- + }
- + }
- +
- + @Override
- + public String getHtmlPath(int npcId, int val)
- + {
- + String pom = "";
- + if (val == 0)
- + {
- + pom = "" + npcId;
- + }
- + else
- + {
- + pom = npcId + "-" + val;
- + }
- +
- + return "data/html/religion/" + pom + ".htm";
- + }
- +}
- Index: java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/GameServer.java (revision 76)
- +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -167,6 +167,7 @@
- GmListTable.getInstance();
- RaidBossPointsManager.getInstance();
- L2PetDataTable.getInstance().loadPetsData();
- + ReligionLeaders.getInstance();
- printSection("Clans");
- ClanTable.getInstance();
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 76)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -42,8 +42,10 @@
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.actor.L2Character;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.SkillDat;
- import net.sf.l2j.gameserver.model.entity.ClanHall;
- import net.sf.l2j.gameserver.model.entity.Couple;
- +import net.sf.l2j.gameserver.model.entity.ReligionWars;
- import net.sf.l2j.gameserver.model.entity.Siege;
- import net.sf.l2j.gameserver.model.quest.Quest;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- @@ -84,7 +86,49 @@
- protected void runImpl()
- {
- L2PcInstance activeChar = getClient().getActiveChar();
- -
- +
- + ReligionWars wars = new ReligionWars();
- + if (activeChar.isReligion1())
- + {
- + wars._religion1players.add(activeChar);
- + }
- + if (activeChar.isReligion2())
- + {
- + wars._religion2players.add(activeChar);
- + }
- + if (!activeChar.isReligion1Leader())
- + {
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + activeChar.removeSkill(leaderskill, true);
- + }
- + if (!activeChar.isReligion2Leader())
- + {
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + activeChar.removeSkill(leaderskill, true);
- + }
- + if (activeChar.isReligion1Leader())
- + {
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + activeChar.addSkill(leaderskill, true);
- + }
- + if (activeChar.isReligion2Leader())
- + {
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + activeChar.addSkill(leaderskill, true);
- + }
- + if (activeChar.isReligion1Leader() || activeChar.isReligion2Leader())
- + {
- + wars.setLeadersColors();
- + }
- + if (activeChar.isReligion1())
- + {
- + activeChar.setTitle("Religion 1");
- + }
- + if (activeChar.isReligion2())
- + {
- + activeChar.setTitle("Religion 2");
- + }
- +
- if (activeChar == null)
- {
- _log.warning("EnterWorld failed! activeChar is null...");
- Index: java/net/sf/l2j/gameserver/ReligionLeaders.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/ReligionLeaders.java (revision 0)
- +++ java/net/sf/l2j/gameserver/ReligionLeaders.java (revision 0)
- @@ -0,0 +1,56 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver;
- +
- +import net.sf.l2j.gameserver.model.entity.ReligionWars;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class ReligionLeaders
- +{
- +
- + public static ReligionLeaders getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final ReligionLeaders _instance = new ReligionLeaders();
- + }
- +
- + private ReligionLeaders()
- + {
- + ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
- + {
- + public void run()
- + {
- + ReligionWars wars = new ReligionWars();
- +
- + if (wars._religion1players.isEmpty() || wars._religion2players.isEmpty())
- + {
- + return;
- + }
- +
- + wars.setReligionsLeaders();
- + }
- + }, 86400000, 86400000); // Every 24 hours.
- + }
- +}
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 76)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -70,6 +70,7 @@
- import net.sf.l2j.gameserver.datatables.SkillTreeTable;
- import net.sf.l2j.gameserver.handler.IItemHandler;
- import net.sf.l2j.gameserver.handler.ItemHandler;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal;
- import net.sf.l2j.gameserver.instancemanager.CastleManager;
- import net.sf.l2j.gameserver.instancemanager.CoupleManager;
- import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
- @@ -214,6 +215,14 @@
- */
- public final class L2PcInstance extends L2Playable
- {
- + // Religions.
- + public boolean _religion1 = false;
- + public boolean _religion2 = false;
- + public boolean _religion1leader = false;
- + public boolean _religion2leader = false;
- + public boolean _inReligionWar = false;
- + public int plgetx = 0, plgety = 0, plgetz = 0;
- +
- // Character Skill SQL String Definitions:
- private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
- private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
- @@ -228,8 +237,8 @@
- // Character SQL String Definitions:
- private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,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=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,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=? WHERE obj_id=?";
- - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, 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 FROM characters WHERE obj_id=?";
- + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,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=?,religion1=?,religion2=?,religion1leader=?,religion2leader=? WHERE obj_id=?";
- + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, 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,religion1,religion2,religion1leader,religion2leader FROM characters WHERE obj_id=?";
- // Character Subclass SQL String Definitions:
- private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
- @@ -4467,6 +4476,24 @@
- stopWaterTask();
- + if (_inReligionWar)
- + {
- + try
- + {
- + Thread.sleep(1000);
- + }
- + catch (InterruptedException e)
- + { }
- + doRevive();
- + L2Skill skill = SkillTable.getInstance().getInfo(1323, 1);
- + skill.getEffects(this, this);
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + if (isReligion1Leader() || isReligion2Leader())
- + {
- + leaderskill.getEffects(this, this);
- + }
- + }
- +
- if (isPhoenixBlessed())
- reviveRequest(this, null, false);
- else if (isAffected(CharEffectList.EFFECT_FLAG_CHARM_OF_COURAGE) && this.isInSiege())
- @@ -4599,13 +4626,26 @@
- if (isInDuel() && targetPlayer.isInDuel()) return;
- // If in Arena, do nothing
- - if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
- + if ((isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP)) && (!_inReligionWar && !targetPlayer._inReligionWar))
- return;
- +
- + if ((isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP) && (_inReligionWar && targetPlayer._inReligionWar)))
- + {
- + increasePvpKillsBy2();
- + return;
- + }
- // Check if it's pvp
- if ((checkIfPvP(target) && targetPlayer.getPvpFlag() != 0)
- || (isInsideZone(ZONE_PVP) && targetPlayer.isInsideZone(ZONE_PVP)))
- + {
- + if (_inReligionWar && targetPlayer._inReligionWar)
- + {
- + increasePvpKillsBy2();
- + return;
- + }
- increasePvpKills();
- + }
- // Target player doesn't have pvp flag set
- else
- {
- @@ -4617,6 +4657,11 @@
- && getPledgeType() != L2Clan.SUBUNIT_ACADEMY)
- {
- // 'Both way war' -> 'PvP Kill'
- + if (_inReligionWar && targetPlayer._inReligionWar)
- + {
- + increasePvpKillsBy2();
- + return;
- + }
- increasePvpKills();
- return;
- }
- @@ -4625,10 +4670,23 @@
- if (targetPlayer.getKarma() > 0)
- {
- if (Config.KARMA_AWARD_PK_KILL)
- + {
- + if (_inReligionWar && targetPlayer._inReligionWar)
- + {
- + increasePvpKillsBy2();
- + return;
- + }
- +
- increasePvpKills();
- + }
- }
- - else if (targetPlayer.getPvpFlag() == 0)
- + else if (targetPlayer.getPvpFlag() == 0 && (!_inReligionWar && !targetPlayer._inReligionWar))
- increasePkKillsAndKarma(targetPlayer.getLevel());
- +
- + if (targetPlayer.getPvpFlag() == 0 && (_inReligionWar && targetPlayer._inReligionWar))
- + {
- + increasePvpKillsBy2();
- + }
- }
- }
- @@ -4636,6 +4694,12 @@
- * Increase the pvp kills count and send the info to the player
- *
- */
- + public void increasePvpKillsBy2()
- + {
- + addItem("Religion Reward", 3470, 1, this, true);
- + setPvpKills(getPvpKills() + 2);
- + sendPacket(new UserInfo(this));
- + }
- public void increasePvpKills()
- {
- // Add karma to attacker and increase its PK counter
- @@ -5190,7 +5254,6 @@
- public void setClan(L2Clan clan)
- {
- _clan = clan;
- - setTitle("");
- if (clan == null)
- {
- @@ -5885,6 +5948,10 @@
- player.setOnlineTime(rset.getLong("onlinetime"));
- player.setNewbie(rset.getInt("newbie")==1);
- player.setNoble(rset.getInt("nobless")==1);
- + player.setReligion1(rset.getInt("religion1")==1);
- + player.setReligion2(rset.getInt("religion2")==1);
- + player.setReligion1Leader(rset.getInt("religion1leader")==1);
- + player.setReligion2Leader(rset.getInt("religion2leader")==1);
- player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
- if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
- @@ -6352,7 +6419,11 @@
- statement.setLong(47, getClanCreateExpiryTime());
- statement.setString(48, getName());
- statement.setLong(49, getDeathPenaltyBuffLevel());
- - statement.setInt(50, getObjectId());
- + statement.setInt(50, isReligion1() ? 1 : 0);
- + statement.setInt(51, isReligion2() ? 1 : 0);
- + statement.setInt(52, isReligion1Leader() ? 1 : 0);
- + statement.setInt(53, isReligion2Leader() ? 1 : 0);
- + statement.setInt(54, getObjectId());
- statement.execute();
- statement.close();
- @@ -11189,4 +11260,45 @@
- break;
- }*/
- }
- + public boolean isReligion1()
- + {
- + return _religion1;
- + }
- +
- + public boolean isReligion2()
- + {
- + return _religion2;
- + }
- +
- + public void setReligion1(boolean i)
- + {
- + setTitle("Religion 1");
- + _religion1 = i;
- + }
- +
- + public void setReligion2(boolean i)
- + {
- + setTitle("Religion 2");
- + _religion2 = i;
- + }
- +
- + public boolean isReligion1Leader()
- + {
- + return _religion1leader;
- + }
- +
- + public boolean isReligion2Leader()
- + {
- + return _religion2leader;
- + }
- +
- + public void setReligion1Leader(boolean i)
- + {
- + _religion1leader = i;
- + }
- +
- + public void setReligion2Leader(boolean i)
- + {
- + _religion2leader = i;
- + }
- }
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 76)
- +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
- @@ -68,6 +68,7 @@
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTest;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminReligion;
- public class AdminCommandHandler
- {
- @@ -131,6 +132,7 @@
- registerAdminCommandHandler(new AdminTest());
- registerAdminCommandHandler(new AdminUnblockIp());
- registerAdminCommandHandler(new AdminZone());
- + registerAdminCommandHandler(new AdminReligion());
- }
- public void registerAdminCommandHandler(IAdminCommandHandler handler)
- Index: java/net/sf/l2j/gameserver/model/entity/ReligionWars.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/entity/ReligionWars.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/entity/ReligionWars.java (revision 0)
- @@ -0,0 +1,220 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.model.entity;
- +
- +import java.util.Vector;
- +
- +import net.sf.l2j.gameserver.Announcements;
- +import net.sf.l2j.gameserver.datatables.SkillTable;
- +import net.sf.l2j.gameserver.model.L2Skill;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +/**
- + *
- + * @author Anarchy
- + */
- +public class ReligionWars
- +{
- + public static Vector<L2PcInstance> _religion1players = new Vector<L2PcInstance>();
- + public static Vector<L2PcInstance> _religion2players = new Vector<L2PcInstance>();
- + public static boolean _religionWarActive = false;
- + public static int rel1x = 149960,
- + rel1y = 46759,
- + rel1z = -3413,
- + rel2x = 148959,
- + rel2y = 46752,
- + rel2z = -3415,
- + toppvps1 = 0,
- + toppvps2 = 0;
- +
- + public void setLeadersColors()
- + {
- + for (L2PcInstance leader : _religion1players)
- + {
- + if (leader.isReligion1Leader())
- + {
- + leader.getAppearance().setNameColor(0x0000FF);
- + leader.broadcastUserInfo();
- + }
- + }
- + for (L2PcInstance leader : _religion2players)
- + {
- + if (leader.isReligion2Leader())
- + {
- + leader.getAppearance().setNameColor(0xFF0000);
- + leader.broadcastUserInfo();
- + }
- + }
- + }
- + public void setReligionsLeaders()
- + {
- + for (L2PcInstance leader : _religion1players)
- + {
- + if (leader.isReligion1Leader())
- + {
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + leader.removeSkill(leaderskill, true);
- + toppvps1 = 0;
- + leader.setReligion1Leader(false);
- + }
- + }
- + for (L2PcInstance leader : _religion2players)
- + {
- + if (leader.isReligion2Leader())
- + {
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + leader.removeSkill(leaderskill, true);
- + toppvps2 = 0;
- + leader.setReligion2Leader(false);
- + }
- + }
- + for (L2PcInstance player : _religion1players)
- + {
- + if (player.getPvpKills() > toppvps1)
- + {
- + player.setReligion1Leader(true);
- + toppvps1 = player.getPvpKills();
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + player.addSkill(leaderskill, true);
- + if (!_religionWarActive)
- + {
- + setLeadersColors();
- + }
- + player.sendMessage("You are now your religion leader!");
- + }
- + }
- + for (L2PcInstance player : _religion2players)
- + {
- + if (player.getPvpKills() > toppvps2)
- + {
- + player.setReligion2Leader(true);
- + toppvps2 = player.getPvpKills();
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + player.addSkill(leaderskill, true);
- + if (!_religionWarActive)
- + {
- + setLeadersColors();
- + }
- + player.sendMessage("You are now your religion leader!");
- + }
- + }
- + }
- + public void warningAnnounces()
- + {
- + Announcements.getInstance().announceToAll("A religion war is starting!");
- + Announcements.getInstance().announceToAll("Be prepared, you will be teleported to your base in a while!");
- + }
- + public void teleportPlayersToBase()
- + {
- + _religionWarActive = true;
- + getPosition();
- + for (L2PcInstance player : _religion1players)
- + {
- + if (!player.isReligion1Leader())
- + {
- + player.getAppearance().setNameColor(0x0000FF);
- + player.broadcastUserInfo();
- + }
- + player.teleToLocation(rel1x, rel1y, rel1z);
- + player.sendMessage("You have been teleported to your base.");
- + player._inReligionWar = true;
- + L2Skill skill = SkillTable.getInstance().getInfo(1323, 1);
- + skill.getEffects(player, player);
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + if (player.isReligion1Leader())
- + {
- + leaderskill.getEffects(player, player);
- + player.getAppearance().setNameColor(0x000000);
- + player.broadcastUserInfo();
- + }
- + }
- + for (L2PcInstance player : _religion2players)
- + {
- + if (!player.isReligion2Leader())
- + {
- + player.getAppearance().setNameColor(0x0000FF);
- + player.broadcastUserInfo();
- + }
- + player.teleToLocation(rel2x, rel2y, rel2z);
- + player.sendMessage("You have been teleported to your base.");
- + player._inReligionWar = true;
- + L2Skill skill = SkillTable.getInstance().getInfo(1323, 1);
- + skill.getEffects(player, player);
- + L2Skill leaderskill = SkillTable.getInstance().getInfo(7029, 1);
- + if (player.isReligion2Leader())
- + {
- + leaderskill.getEffects(player, player);
- + player.getAppearance().setNameColor(0x000000);
- + player.broadcastUserInfo();
- + }
- + }
- + }
- + public void getPosition()
- + {
- + for (L2PcInstance player : _religion1players)
- + {
- + player.plgetx = player.getX();
- + player.plgety = player.getY();
- + player.plgetz = player.getZ();
- + }
- + for (L2PcInstance player : _religion2players)
- + {
- + player.plgetx = player.getX();
- + player.plgety = player.getY();
- + player.plgetz = player.getZ();
- + }
- + }
- + public void teleportBack()
- + {
- + _religionWarActive = false;
- + Announcements.getInstance().announceToAll("The war has ended.");
- + for (L2PcInstance player : _religion1players)
- + {
- + player.teleToLocation(player.plgetx, player.plgety, player.plgetz);
- + player.sendMessage("You have been teleported back to where you were. The war has ended.");
- + if (!player.isReligion1Leader())
- + {
- + player.getAppearance().setNameColor(0xFFFFFF);
- + }
- + player.plgetx = 0;
- + player.plgety = 0;
- + player.plgetz = 0;
- + if (player.isReligion1Leader())
- + {
- + setLeadersColors();
- + }
- + player._inReligionWar = false;
- + }
- + for (L2PcInstance player : _religion2players)
- + {
- + player.teleToLocation(player.plgetx, player.plgety, player.plgetz);
- + player.sendMessage("You have been teleported back to where you were. The war has ended.");
- + if (!player.isReligion2Leader())
- + {
- + player.getAppearance().setNameColor(0xFFFFFF);
- + }
- + player.plgetx = 0;
- + player.plgety = 0;
- + player.plgetz = 0;
- + if (player.isReligion2Leader())
- + {
- + setLeadersColors();
- + }
- + player._inReligionWar = false;
- + }
- + }
- +}
- Index: java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (revision 76)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (working copy)
- @@ -25,6 +25,7 @@
- import net.sf.l2j.gameserver.SevenSignsFestival;
- import net.sf.l2j.gameserver.model.L2Party;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.entity.ReligionWars;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- @@ -49,6 +50,16 @@
- if (player == null)
- return;
- +
- + ReligionWars wars = new ReligionWars();
- + if (player.isReligion1() && wars._religion1players.contains(player));
- + {
- + wars._religion1players.remove(player);
- + }
- + if (player.isReligion2() && wars._religion2players.contains(player));
- + {
- + wars._religion2players.remove(player);
- + }
- player.getInventory().updateDatabase();
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminReligion.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminReligion.java (revision 0)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminReligion.java (revision 0)
- @@ -0,0 +1,90 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.handler.admincommandhandlers;
- +
- +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.entity.ReligionWars;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class AdminReligion implements IAdminCommandHandler
- +{
- + private final String[] ADMIN_COMMANDS = { "admin_startreligionwar", "admin_stopreligionwar", "admin_warnreligionwar", "admin_setreligionsleaders" };
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + ReligionWars wars = new ReligionWars();
- + if (command.equals("admin_startreligionwar"))
- + {
- + if (wars._religionWarActive)
- + {
- + activeChar.sendMessage("You can't run 2 another religion wars at the same time.");
- + return false;
- + }
- + if (wars._religion1players.isEmpty() || wars._religion2players.isEmpty())
- + {
- + activeChar.sendMessage("There are not enough religion players online.");
- + return false;
- + }
- +
- + wars.teleportPlayersToBase();
- + return true;
- + }
- + if (command.equals("admin_stopreligionwar"))
- + {
- + if (!wars._religionWarActive)
- + {
- + activeChar.sendMessage("There is not religion war active.");
- + return false;
- + }
- +
- + wars.teleportBack();
- + return true;
- + }
- + if (command.equals("admin_warnreligionwar"))
- + {
- + if (wars._religionWarActive)
- + {
- + activeChar.sendMessage("You can't warn the players while the war is running.");
- + return false;
- + }
- +
- + wars.warningAnnounces();
- + return true;
- + }
- + if (command.equals("admin_setreligionsleaders"))
- + {
- + if (wars._religion1players.isEmpty() || wars._religion2players.isEmpty())
- + {
- + activeChar.sendMessage("Cannot set a leader for each religion because there are not enough religion players online.");
- + return false;
- + }
- +
- + wars.setReligionsLeaders();
- + return true;
- + }
- +
- + return true;
- + }
- + public String[] getAdminCommandList()
- + {
- + return ADMIN_COMMANDS;
- + }
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement