Перейти к содержанию
Авторизация  
GаmeOver

Добавить 3 фракцию

Рекомендуемые сообщения

Ув.Друзья, проблема такава.

У Меня было Gve (Старое там было 3 фракции)

Так как я не особо знаю яву, я скачал гве более обновленые (недавно выложенные в шару)

Но там всего 2 фракции.

Как мне заново вернуть 3 фракцию? кто то знает? + дам.

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

без кода не скажу точно, но  на мысль наведу, поищи реализацию этого гве и там смотри как те 2 фракции реализованы. Самый простой вариант пробиться туда - из конфигов х)просто проследи цепочку отконфигов самого гве (к примеру название фракции) и оно выведет тебя прямиком на реализацию этой фичи. ну а там, в зависимости от написанного кода, уже допилишь 3ю по тому же принципу.

Изменено пользователем ChaoticBD

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

без кода не скажу точно, но  на мысль наведу, поищи реализацию этого гве и там смотри как те 2 фракции реализованы. Самый простой вариант пробиться туда - из конфигов х)просто проследи цепочку отконфигов самого гве (к примеру название фракции) и оно выведет тебя прямиком на реализацию этой фичи. ну а там, в зависимости от написанного кода, уже допилишь 3ю по тому же принципу.

Скажи мне свой скайп или Vk

Обсудим там.

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

В ядре ищи подобие fractionmanager что отвечает за выдачу фракции и на основе сделай 3

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

В ядре ищи подобие fractionmanager что отвечает за выдачу фракции и на основе сделай 3

Мне дали файл 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.
 *
 */
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(8));
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.
 *
 */
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(8));
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 реализованны 3 фракции, собственно ее и используй х) попробуй и увидишь чего не хватает во 2 и далее уже допишешь

Изменено пользователем ChaoticBD

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...