Faction balance online players.
This commit is contained in:
@@ -59,6 +59,8 @@ public class CharSelectInfoPackage
|
||||
private String _htmlPrefix = null;
|
||||
private int _vitalityPoints = 0;
|
||||
private int _accessLevel = 0;
|
||||
private boolean _isGood = false;
|
||||
private boolean _isEvil = false;
|
||||
private final PlayerVariables _vars;
|
||||
|
||||
/**
|
||||
@@ -103,6 +105,28 @@ public class CharSelectInfoPackage
|
||||
_accessLevel = level;
|
||||
}
|
||||
|
||||
public boolean isGood()
|
||||
{
|
||||
return _isGood;
|
||||
}
|
||||
|
||||
public void setGood()
|
||||
{
|
||||
_isGood = true;
|
||||
_isEvil = false;
|
||||
}
|
||||
|
||||
public boolean isEvil()
|
||||
{
|
||||
return _isEvil;
|
||||
}
|
||||
|
||||
public void setEvil()
|
||||
{
|
||||
_isGood = false;
|
||||
_isEvil = true;
|
||||
}
|
||||
|
||||
public int getClanId()
|
||||
{
|
||||
return _clanId;
|
||||
|
@@ -28,6 +28,7 @@ import com.l2jserver.gameserver.datatables.SecondaryAuthData;
|
||||
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jserver.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jserver.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.events.Containers;
|
||||
import com.l2jserver.gameserver.model.events.EventDispatcher;
|
||||
@@ -126,6 +127,28 @@ public class CharacterSelect extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_BALANCE_ONLINE_PLAYERS)
|
||||
{
|
||||
if (info.isGood() && (L2World.getInstance().getAllGoodPlayersCount() >= ((L2World.getInstance().getAllEvilPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT))))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "data/html/mods/Faction/ExceededOnlineLimit.htm");
|
||||
msg.replace("%more%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
msg.replace("%less%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
if (info.isEvil() && (L2World.getInstance().getAllEvilPlayersCount() >= ((L2World.getInstance().getAllGoodPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT))))
|
||||
{
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
msg.setFile(info.getHtmlPrefix(), "data/html/mods/Faction/ExceededOnlineLimit.htm");
|
||||
msg.replace("%more%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
msg.replace("%less%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
client.sendPacket(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// The L2PcInstance must be created here, so that it can be attached to the L2GameClient
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
|
@@ -132,6 +132,11 @@ public abstract class AbstractHtmlPacket extends L2GameServerPacket
|
||||
public final void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.clearHtmlActions(getScope());
|
||||
|
||||
if (_disabledValidation)
|
||||
|
@@ -307,6 +307,16 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
charInfopackage.setY(chardata.getInt("y"));
|
||||
charInfopackage.setZ(chardata.getInt("z"));
|
||||
|
||||
final int faction = chardata.getInt("faction");
|
||||
if (faction == 1)
|
||||
{
|
||||
charInfopackage.setGood();
|
||||
}
|
||||
if (faction == 2)
|
||||
{
|
||||
charInfopackage.setEvil();
|
||||
}
|
||||
|
||||
if (Config.L2JMOD_MULTILANG_ENABLE)
|
||||
{
|
||||
String lang = chardata.getString("language");
|
||||
|
Reference in New Issue
Block a user