Перейти к содержанию

GаmeOver

Постоялец
  • Публикаций

    327
  • Зарегистрирован

  • Посещение

  • Победитель дней

    8
  • Отзывы

    0%

Весь контент GаmeOver

  1. Мне дали файл l2factionInstance в одном вот что /* * 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 java.sql.Connection; import java.sql.PreparedStatement; import java.util.StringTokenizer; import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.base.Experience; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; import net.sf.l2j.gameserver.network.serverpackets.CreatureSay; import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; import net.sf.l2j.gameserver.network.serverpackets.SocialAction; import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation; import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse; import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate; import net.sf.l2j.util.StringUtil; import net.sf.l2j.util.Rnd; public final class L2FactionInstance extends L2NpcInstance { public L2FactionInstance(int objectId, L2NpcTemplate template) { super(objectId, template); } @Override public void onBypassFeedback(L2PcInstance player, String command) { StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); int val = 0; if (st.countTokens() >= 1) val = Integer.valueOf(st.nextToken()); if (actualCommand.equalsIgnoreCase("setfaction")) { int team1Supports = L2World.getInstance().getTeam1Supports(); int team2Supports = L2World.getInstance().getTeam2Supports(); int team1Count = L2World.getInstance().getAllteam1Players().size(); int team2Count = L2World.getInstance().getAllteam2Players().size(); if (player.getAdena() >= Config.FACTION_CHANGE_PRICE || player.getFactionId() == 0) { switch (val) { case 1: switch (player.getFactionId()) { case 1: player.sendMessage("Ты и так играешь за " + Config.FACTION_TEAM1_NAME + " фракцию."); player.sendPacket(ActionFailed.STATIC_PACKET); return; case 2: if (team1Count >= team2Count) { player.sendMessage("За фракцию " + Config.FACTION_TEAM1_NAME + " играет много человек."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team1Supports > team2Supports) { player.sendMessage("За фракцию " + Config.FACTION_TEAM1_NAME + " играет много саппорт классов. Выбери другую фрацкию."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam2().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam1().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] Пока-пока, предатель."); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Добро пожаловать к нам."); break; default: if (team1Count > team2Count) { player.sendMessage("За фракцию " + Config.FACTION_TEAM1_NAME + " играет много человек."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } L2World.getInstance().getAllTeam1().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Добро пожаловать в нашу фракцию."); break; } if (player.getParty() != null) player.getParty().removePartyMember(player); player.getAppearance().setNameColor(Config.FACTION_TEAM1_COLOR); if (!player.isVip()) player.getAppearance().setTitleColor(Config.FACTION_TEAM1_COLOR); else player.getAppearance().setTitleColor(0x00CCFF); player.broadcastUserInfo(); if (Config.FACTION_ENABLE_SPEAKS) { broadcastPacket(new CreatureSay(getObjectId(), 0, String.valueOf(getName()), Config.FACTION_TEAM1_NPC_VC.replace("%n", player.getName().toString()))); player.broadcastPacket(new CreatureSay(player.getObjectId(), 0, player.getName(), Config.FACTION_TEAM1_PLAYER_VC.replace("%n", player.getName().toString()))); } break; case 2: switch (player.getFactionId()) { case 1: if (team2Count >= team1Count) { player.sendMessage("За фракцию " + Config.FACTION_TEAM2_NAME + " играет много человек."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team2Supports > team1Supports) { player.sendMessage("За фракцию " + Config.FACTION_TEAM2_NAME + " играет много саппорт классов. Выбери другую фрацкию."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam1().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam2().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Пока-пока, предатель."); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] Добро пожаловать в нашу фракцию."); break; case 2: player.sendMessage("Ты и так играешь за " + Config.FACTION_TEAM2_NAME + " фракцию."); player.sendPacket(ActionFailed.STATIC_PACKET); return; default: if (team2Count > team1Count) { player.sendMessage("За фракцию " + Config.FACTION_TEAM2_NAME + " играет много саппорт классов. Выбери другую фрацкию."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } L2World.getInstance().getAllTeam2().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] Добро пожаловать в нашу фракцию."); break; } if (player.getParty() != null) player.getParty().removePartyMember(player); player.getAppearance().setNameColor(Config.FACTION_TEAM2_COLOR); if (!player.isVip()) player.getAppearance().setTitleColor(Config.FACTION_TEAM2_COLOR); else player.getAppearance().setTitleColor(0x00CCFF); player.broadcastUserInfo(); if (Config.FACTION_ENABLE_SPEAKS) { broadcastPacket(new CreatureSay(getObjectId(), 0, String.valueOf(getName()), Config.FACTION_TEAM2_NPC_VC.replace("%n", player.getName().toString()))); player.broadcastPacket(new CreatureSay(player.getObjectId(), 0, player.getName(), Config.FACTION_TEAM2_PLAYER_VC.replace("%n", player.getName().toString()))); } break; default: return; } } else { player.sendMessage("Не хватает денег для перехода в другую фракцию."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } player.broadcastPacket(new SocialAction(player, 3)); MagicSkillUse MSU = new MagicSkillUse(player, player, 2024, 1, 1, 0); player.broadcastPacket(MSU); Connection connection = null; try { connection = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE characters SET factionId=? WHERE char_name=?"); statement.setInt(1, val); statement.setString(2, player.getName()); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { System.out.println("Couldn't set player faction:" + val + " " + e); } finally{try{connection.close();}catch (Exception e){}} player.setFactionId(val); player.broadcastUserInfo(); if (player.getLevel() < 5) player.addExpAndSp(Experience.LEVEL[Config.FACTION_START_LVL], 0); } 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(this, Rnd.get(); broadcastPacket(sa); player.setCurrentFolkNPC(this); showMessageWindow(player); player.sendPacket(ActionFailed.STATIC_PACKET); } else { player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); player.sendPacket(ActionFailed.STATIC_PACKET); } } private void showMessageWindow(L2PcInstance player) { NpcHtmlMessage html = new NpcHtmlMessage(1); final StringBuilder strBuffer = StringUtil.startAppend(3500, "<html><title>Менеджер фракций</title><body><center>"); int _team1_on = L2World.getInstance().getAllteam1Players().size(); int _team2_on = L2World.getInstance().getAllteam2Players().size(); if (player.getFactionId() < 1) { strBuffer.append("<font color=\"LEVEL\">%charname%</font> добро пожаловать в наш уникальный мир.<br>"); strBuffer.append("Выбери фракцию за которую хочешь сражаться.<br>"); strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>"); } else { strBuffer.append("Ты играешь за <font color=\"LEVEL\">%faction%</font> фракцию.<br>"); if (Config.FACTION_CHANGE_PRICE > 0) strBuffer.append("Цена за смену фракции <font color=\"LEVEL\">" + Config.FACTION_CHANGE_PRICE + " Adena</font><br>"); if (player.isVip()) strBuffer.append("Но с Vip игроков я не беру денег."); strBuffer.append("Доступные фракции:<br><br><br>"); } switch (player.getFactionId()) { case 1: strBuffer.append("<button value=\"" + Config.FACTION_TEAM2_NAME + " [Игроков: "+_team2_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 2\" width=95 height=21 back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\">"); break; case 2: strBuffer.append("<button value=\"" + Config.FACTION_TEAM1_NAME + " [Игроков: "+_team1_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 1\" width=95 height=21 back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\">"); break; default: strBuffer.append("<button value=\"" + Config.FACTION_TEAM1_NAME + " [Игроков: "+_team1_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 1\" width=95 height=21 back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\">"); strBuffer.append("<button value=\"" + Config.FACTION_TEAM2_NAME + " [Игроков: "+_team2_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 2\" width=95 height=21 back=\"L2UI_CH3.bigbutton_down\" fore=\"L2UI_CH3.bigbutton\">"); break; } strBuffer.append("</center></body></html>"); html.setHtml(strBuffer.toString()); if (player.getFactionId() == 1) html.replace("%faction%", Config.FACTION_TEAM1_NAME); else if (player.getFactionId() == 2) html.replace("%faction%", Config.FACTION_TEAM2_NAME); else html.replace("%faction%", "Нет фракции"); html.replace("%objectId%", String.valueOf(getObjectId())); html.replace("%npcname%", getName()); html.replace("%charname%", player.getName()); player.sendPacket(html); } } А во втаром вот что /* * 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 java.sql.Connection; import java.sql.PreparedStatement; import java.util.StringTokenizer; import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.base.Experience; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; import net.sf.l2j.gameserver.network.serverpackets.CreatureSay; import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; import net.sf.l2j.gameserver.network.serverpackets.SocialAction; import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation; import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse; import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate; import net.sf.l2j.util.StringUtil; import net.sf.l2j.util.Rnd; public final class L2FactionInstance extends L2NpcInstance { public L2FactionInstance(int objectId, L2NpcTemplate template) { super(objectId, template); } @Override public void onBypassFeedback(L2PcInstance player, String command) { StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); int val = 0; if (st.countTokens() >= 1) val = Integer.valueOf(st.nextToken()); if (actualCommand.equalsIgnoreCase("setfaction")) { int team1Supports = L2World.getInstance().getTeam1Supports(); int team2Supports = L2World.getInstance().getTeam2Supports(); int team3Supports = L2World.getInstance().getTeam3Supports(); int team1Count = L2World.getInstance().getAllteam1Players().size(); int team2Count = L2World.getInstance().getAllteam2Players().size(); int team3Count = L2World.getInstance().getAllteam3Players().size(); if (player.getAdena() >= Config.FACTION_CHANGE_PRICE || player.getFactionId() == 0) { switch (val) { case 1: switch (player.getFactionId()) { case 1: player.sendMessage("You already belong to " + Config.FACTION_TEAM1_NAME + " faction."); player.sendPacket(ActionFailed.STATIC_PACKET); return; case 2: if (team1Count >= team2Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM1_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team1Supports > team2Supports) { player.sendMessage("Too many support classes in " + Config.FACTION_TEAM1_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam2().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam1().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] Bye bye, traitor!"); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Welcome to our new hero!"); break; case 3: if (team1Count >= team3Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM1_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team1Supports > team3Supports) { player.sendMessage("Too many support classes in " + Config.FACTION_TEAM1_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam3().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam1().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM3_NAME + "] Bye bye, traitor!"); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Welcome to our new hero!"); break; default: if (team1Count > team2Count || team1Count > team3Count ) { player.sendMessage("Too many players in " + Config.FACTION_TEAM1_NAME + " faction. Please select another faction."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } L2World.getInstance().getAllTeam1().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Welcome to our new hero!"); break; } if (player.getParty() != null) player.getParty().removePartyMember(player); player.getAppearance().setNameColor(Config.FACTION_TEAM1_COLOR); if (!player.isVip()) player.getAppearance().setTitleColor(Config.FACTION_TEAM1_COLOR); else player.getAppearance().setTitleColor(0x00CCFF); player.broadcastUserInfo(); if (Config.FACTION_ENABLE_SPEAKS) { broadcastPacket(new CreatureSay(getObjectId(), 0, String.valueOf(getName()), Config.FACTION_TEAM1_NPC_VC.replace("%n", player.getName().toString()))); player.broadcastPacket(new CreatureSay(player.getObjectId(), 0, player.getName(), Config.FACTION_TEAM1_PLAYER_VC.replace("%n", player.getName().toString()))); } break; case 2: switch (player.getFactionId()) { case 1: if (team2Count >= team1Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM2_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team2Supports > team1Supports) { player.sendMessage("Too many support classes in " + Config.FACTION_TEAM2_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam1().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam2().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] Goodbye!"); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] For Faction Glory!"); break; case 2: player.sendMessage("You already belong to " + Config.FACTION_TEAM2_NAME + " faction."); player.sendPacket(ActionFailed.STATIC_PACKET); return; case 3: if (team2Count >= team3Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM2_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team2Supports > team3Supports) { player.sendMessage("Too many support classes in " + Config.FACTION_TEAM2_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam3().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam2().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM3_NAME + "] Goodbye!"); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] For Faction Glory!"); break; default: if (team2Count > team1Count || team2Count > team3Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM2_NAME + " faction. Please select another faction."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } L2World.getInstance().getAllTeam2().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] For Faction Glory!"); break; } if (player.getParty() != null) player.getParty().removePartyMember(player); player.getAppearance().setNameColor(Config.FACTION_TEAM2_COLOR); if (!player.isVip()) player.getAppearance().setTitleColor(Config.FACTION_TEAM2_COLOR); else player.getAppearance().setTitleColor(0x00CCFF); player.broadcastUserInfo(); if (Config.FACTION_ENABLE_SPEAKS) { broadcastPacket(new CreatureSay(getObjectId(), 0, String.valueOf(getName()), Config.FACTION_TEAM2_NPC_VC.replace("%n", player.getName().toString()))); player.broadcastPacket(new CreatureSay(player.getObjectId(), 0, player.getName(), Config.FACTION_TEAM2_PLAYER_VC.replace("%n", player.getName().toString()))); } break; case 3: switch (player.getFactionId()) { case 1: if (team3Count >= team1Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM3_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team3Supports > team1Supports) { player.sendMessage("Too many support classes in " + Config.FACTION_TEAM3_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam1().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam3().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM1_NAME + "] We will miss you!"); player.sendMessage("[" + Config.FACTION_TEAM3_NAME + "] New warriors is always welcome!"); break; case 2: if (team3Count >= team2Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM3_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (Config.FACTION_ENABLE_CLASS_BLNC && (player.getClassId().getId() == 15 || player.getClassId().getId() == 16 || player.getClassId().getId() == 17 || player.getClassId().getId() == 29 || player.getClassId().getId() == 30 || player.getClassId().getId() == 42 || player.getClassId().getId() == 43 || player.getClassId().getId() == 112 || player.getClassId().getId() == 105 || player.getClassId().getId() == 98 || player.getClassId().getId() == 97) && team3Supports > team2Supports) { player.sendMessage("Too many support classes in " + Config.FACTION_TEAM3_NAME + " faction. Come back later."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } if (!player.isVip()) player.reduceAdena("pay", Config.FACTION_CHANGE_PRICE, player, true); L2World.getInstance().getAllTeam2().remove(player.getName().toLowerCase()); L2World.getInstance().getAllTeam3().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM2_NAME + "] We will miss you!"); player.sendMessage("[" + Config.FACTION_TEAM3_NAME + "] New warriors is always welcome!"); break; case 3: player.sendMessage("You already belong to " + Config.FACTION_TEAM3_NAME + " faction."); player.sendPacket(ActionFailed.STATIC_PACKET); return; default: if (team3Count > team1Count || team3Count > team2Count) { player.sendMessage("Too many players in " + Config.FACTION_TEAM3_NAME + " faction. Please select another faction."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } L2World.getInstance().getAllTeam3().put(player.getName().toLowerCase(),player); player.sendMessage("[" + Config.FACTION_TEAM3_NAME + "] New warriors is always welcome!"); break; } if (player.getParty() != null) player.getParty().removePartyMember(player); player.getAppearance().setNameColor(Config.FACTION_TEAM3_COLOR); if (!player.isVip()) player.getAppearance().setTitleColor(Config.FACTION_TEAM3_COLOR); else player.getAppearance().setTitleColor(0x00CCFF); player.broadcastUserInfo(); if (Config.FACTION_ENABLE_SPEAKS) { broadcastPacket(new CreatureSay(getObjectId(), 0, String.valueOf(getName()), Config.FACTION_TEAM3_NPC_VC.replace("%n", player.getName().toString()))); player.broadcastPacket(new CreatureSay(player.getObjectId(), 0, player.getName(), Config.FACTION_TEAM3_PLAYER_VC.replace("%n", player.getName().toString()))); } break; default: return; } } else { player.sendMessage("Not enought adena."); player.sendPacket(ActionFailed.STATIC_PACKET); return; } player.broadcastPacket(new SocialAction(player, 3)); MagicSkillUse MSU = new MagicSkillUse(player, player, 2024, 1, 1, 0); player.broadcastPacket(MSU); Connection connection = null; try { connection = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE characters SET factionId=? WHERE char_name=?"); statement.setInt(1, val); statement.setString(2, player.getName()); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { System.out.println("Couldn't set player faction:" + val + " " + e); } finally{try{connection.close();}catch (Exception e){}} player.setFactionId(val); player.broadcastUserInfo(); if (player.getLevel() < 5) player.addExpAndSp(Experience.LEVEL[Config.FACTION_START_LVL], 0); } 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(this, Rnd.get(); broadcastPacket(sa); player.setCurrentFolkNPC(this); showMessageWindow(player); player.sendPacket(ActionFailed.STATIC_PACKET); } else { player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); player.sendPacket(ActionFailed.STATIC_PACKET); } } private void showMessageWindow(L2PcInstance player) { NpcHtmlMessage html = new NpcHtmlMessage(1); final StringBuilder strBuffer = StringUtil.startAppend(3500, "<html><title>Faction Manager</title><body><center>"); int _team1_on = L2World.getInstance().getAllteam1Players().size(); int _team2_on = L2World.getInstance().getAllteam2Players().size(); int _team3_on = L2World.getInstance().getAllteam3Players().size(); if (player.getFactionId() < 1) { strBuffer.append("Welcome to Triple Faction World, <font color=\"LEVEL\">%charname%</font>.<br>"); strBuffer.append("This is the place, to chose your destiny!<br>"); strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>"); } else { strBuffer.append("You belong to: <font color=\"LEVEL\">%faction%</font> faction.<br>"); if (Config.FACTION_CHANGE_PRICE > 0) strBuffer.append("Price for changing faction: <font color=\"LEVEL\">" + Config.FACTION_CHANGE_PRICE + " Adena</font><br>"); if (player.isVip()) strBuffer.append("But as you're VIP, I won't take any Adenas from you."); strBuffer.append("Currently available factions to chose:<br>"); strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>"); } switch (player.getFactionId()) { case 1: strBuffer.append("<button value=\"" + Config.FACTION_TEAM2_NAME + " [On: "+_team2_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 2\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); strBuffer.append("<button value=\"" + Config.FACTION_TEAM3_NAME + " [On: "+_team3_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 3\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); break; case 2: strBuffer.append("<button value=\"" + Config.FACTION_TEAM1_NAME + " [On: "+_team1_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 1\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); strBuffer.append("<button value=\"" + Config.FACTION_TEAM3_NAME + " [On: "+_team3_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 3\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); break; case 3: strBuffer.append("<button value=\"" + Config.FACTION_TEAM1_NAME + " [On: "+_team1_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 1\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); strBuffer.append("<button value=\"" + Config.FACTION_TEAM2_NAME + " [On: "+_team2_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 2\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); break; default: strBuffer.append("<button value=\"" + Config.FACTION_TEAM1_NAME + " [On: "+_team1_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 1\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); strBuffer.append("<button value=\"" + Config.FACTION_TEAM2_NAME + " [On: "+_team2_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 2\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); strBuffer.append("<button value=\"" + Config.FACTION_TEAM3_NAME + " [On: "+_team3_on+"]\" action=\"bypass -h npc_%objectId%_setfaction 3\" width=170 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"); break; } strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>"); strBuffer.append("</center></body></html>"); html.setHtml(strBuffer.toString()); if (player.getFactionId() == 1) html.replace("%faction%", Config.FACTION_TEAM1_NAME); else if (player.getFactionId() == 2) html.replace("%faction%", Config.FACTION_TEAM2_NAME); else if (player.getFactionId() == 3) html.replace("%faction%", Config.FACTION_TEAM3_NAME); else html.replace("%faction%", "No Faction"); html.replace("%objectId%", String.valueOf(getObjectId())); html.replace("%npcname%", getName()); html.replace("%charname%", player.getName()); player.sendPacket(html); } } Прокатит ли просто замену сделать?
  2. Скажи мне свой скайп или Vk Обсудим там.
  3. в любом случае ты будешь переписывать мобов,аи, шопы и тд х) Всмысле? то биш через datapack? или же через ядро?
  4. Нет не с нуля, а взять Гве которую выложили не давно в шару с фиксами от Centra вроде.
  5. Ув.Друзья, проблема такава. У Меня было Gve (Старое там было 3 фракции) Так как я не особо знаю яву, я скачал гве более обновленые (недавно выложенные в шару) Но там всего 2 фракции. Как мне заново вернуть 3 фракцию? кто то знает? + дам.
  6. Я то написал вам, но идеи у меня хорошие Так сказать (Игрокам не будет время скучать)
  7. Только одного понять не могу, какая разница на какой версии написан гве? на последней акис, которая в шаре, или на 2013? кто то может сказать ? я просто не могу понять.
  8. Ну, по немногу, делать, думаю норм будет все
  9. То есть вы отошли от дела, из-за того что не захотели писать квесты свои ? Вопрос, вы делали GvE из самого начала с нуля? или скачали из шары и доделали ?
  10. Это да, ну самое главное что буду знать что это мое не скачиное из шарое готовое ) а мое
  11. Что именно вы имете введу под словом но все загнулось после написания основ на перезаселении локаций, городов и прочей монотонной работе
  12. Уже ответил, куча идей есть. С продуманный сюжетом )
  13. В том то и дело, идей у меня куче( плагиатить оригенальный гве я не буду) есть масса идей. Почему и создал тему.
  14. Ну вообщем тема вот такая. Есть ли смысл убивать время, и делать ГВЕ? или это уже гиблое дело? Прошу проинформировать. Заранее спасибо
  15. Тема еще актуальна, что вы можете сказать о данной сборке ? http://forummaxi.ru/topic/65665-%D1%81%D0%B1%D0%BE%D1%80%D0%BA%D0%B0-interlude-%D0%BE%D1%81%D0%BD%D0%BE%D0%B2%D0%B0-acis-%D0%BF%D1%80%D0%B8%D0%B2%D0%B0%D1%82%D0%BD%D0%B0%D1%8F-%D0%B2%D0%B5%D1%82%D0%BA%D0%B0%D0%B7%D0%B0-%D0%BA%D0%BE%D0%BF%D0%B5%D0%B9%D0%BA%D0%B8/page-3?do=findComment&comment=624099 (не реклама) (извините если это нельзя делать по правилам форума)
  16. Тема еще актуальна, так как я не большой знаток всех фишек (кодеров) Мне лично не хочеться что бы меня слили на открытии)) Будьте любезны опытные люди, обьесните. И да.. я тоже не могу понять зачем 64 битку ставить
  17. Это я знаю, ну для теста для начала надо мне ее запустить, настроить под свое, добавить Нпц и т.д.а потом уже на VDS
  18. Ответ был дан в тексте о теме, не чайно поставил 32 битку.
  19. Спасибо за краткий и четкий ответ, + дал.
  20. GаmeOver

    Нужен патч

    Отпиши в ЛС .
  21. GаmeOver

    Сборочка х100

    Отпиши в ЛС помогу решить проблему.
  22. Можно как то по конкретней ? почему хуже или лучше других сборок ? и т.д? ваш ответ понятен, но хочу услышать более больше информации.
×
×
  • Создать...