Faction system.

This commit is contained in:
mobius
2015-01-12 19:00:41 +00:00
parent 4c2db62a63
commit aee828896f
22 changed files with 483 additions and 10 deletions

View File

@ -18,6 +18,7 @@
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.PartyMatchRoom;
import com.l2jserver.gameserver.model.PartyMatchRoomList;
@ -69,6 +70,13 @@ public final class AnswerJoinPartyRoom extends L2GameClientPacket
return;
}
if (Config.FACTION_SYSTEM_ENABLED && ((player.isEvil() && partner.isGood()) || (player.isGood() && partner.isEvil())))
{
player.sendMessage("You cannot party with different team members.");
player.setActiveRequester(null);
return;
}
// If answer is positive, join the requester's PartyRoom.
if ((_answer == 1) && !partner.isRequestExpired())
{

View File

@ -18,6 +18,7 @@
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
@ -75,6 +76,14 @@ public final class AnswerTradeRequest extends L2GameClientPacket
return;
}
if (Config.FACTION_SYSTEM_ENABLED && ((player.isEvil() && partner.isGood()) || (player.isGood() && partner.isEvil())))
{
player.sendPacket(new TradeDone(0));
player.sendMessage("You cannot trade with different team members.");
player.setActiveRequester(null);
return;
}
if ((_response == 1) && !partner.isRequestExpired())
{
player.startTrade(partner);

View File

@ -295,6 +295,10 @@ public final class CharacterCreate extends L2GameClientPacket
Location createLoc = new Location(Config.CUSTOM_STARTING_LOC_X, Config.CUSTOM_STARTING_LOC_Y, Config.CUSTOM_STARTING_LOC_Z);
newChar.setXYZInvisible(createLoc.getX(), createLoc.getY(), createLoc.getZ());
}
else if (Config.FACTION_SYSTEM_ENABLED)
{
newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ());
}
else
{
Location createLoc = template.getCreationPoint();

View File

@ -388,6 +388,25 @@ public class EnterWorld extends L2GameClientPacket
activeChar.sendPacket(new ExUnReadMailCount(activeChar));
}
// Faction System
if (Config.FACTION_SYSTEM_ENABLED)
{
if (activeChar.isGood())
{
activeChar.getAppearance().setNameColor(Config.FACTION_GOOD_NAME_COLOR);
activeChar.getAppearance().setTitleColor(Config.FACTION_GOOD_NAME_COLOR);
activeChar.sendMessage("Welcome " + activeChar.getName() + ", you are fighting for the " + Config.FACTION_GOOD_TEAM_NAME + " faction.");
activeChar.sendPacket(new ExShowScreenMessage("Welcome " + activeChar.getName() + ", you are fighting for the " + Config.FACTION_GOOD_TEAM_NAME + " faction.", 10000));
}
else if (activeChar.isEvil())
{
activeChar.getAppearance().setNameColor(Config.FACTION_EVIL_NAME_COLOR);
activeChar.getAppearance().setTitleColor(Config.FACTION_EVIL_NAME_COLOR);
activeChar.sendMessage("Welcome " + activeChar.getName() + ", you are fighting for the " + Config.FACTION_EVIL_TEAM_NAME + " faction.");
activeChar.sendPacket(new ExShowScreenMessage("Welcome " + activeChar.getName() + ", you are fighting for the " + Config.FACTION_EVIL_TEAM_NAME + " faction.", 10000));
}
}
Quest.playerEnter(activeChar);
// Send Quest List

View File

@ -82,6 +82,11 @@ public final class RequestDuelStart extends L2GameClientPacket
activeChar.sendPacket(msg);
return;
}
else if (Config.FACTION_SYSTEM_ENABLED && ((activeChar.isEvil() && targetChar.isGood()) || (activeChar.isGood() && targetChar.isEvil())))
{
activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
return;
}
// Duel is a party duel
if (_partyDuel == 1)

View File

@ -18,6 +18,7 @@
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -97,6 +98,11 @@ public final class RequestFriendInvite extends L2GameClientPacket
activeChar.sendPacket(sm);
return;
}
if (Config.FACTION_SYSTEM_ENABLED && ((friend.isEvil() && activeChar.isGood()) || (friend.isGood() && activeChar.isEvil())))
{
activeChar.sendMessage("You cannot have a friend of the opposing faction.");
return;
}
// Friend request sent.
activeChar.onTransactionRequest(friend);
friend.sendPacket(new FriendAddRequest(activeChar.getName()));

View File

@ -120,6 +120,15 @@ public final class RequestPrivateStoreBuy extends L2GameClientPacket
return;
}
if (Config.FACTION_SYSTEM_ENABLED)
{
if ((storePlayer.isEvil() && player.isGood()) || (storePlayer.isGood() && player.isEvil()))
{
player.sendMessage("You cant buy from different faction members.");
return;
}
}
TradeList storeList = storePlayer.getSellList();
if (storeList == null)
{

View File

@ -139,6 +139,15 @@ public final class RequestPrivateStoreSell extends L2GameClientPacket
return;
}
if (Config.FACTION_SYSTEM_ENABLED)
{
if ((storePlayer.isEvil() && player.isGood()) || (storePlayer.isGood() && player.isEvil()))
{
player.sendMessage("You cant sell on different faction members.");
return;
}
}
// Update offline trade record, if realtime saving is enabled
if (Config.OFFLINE_TRADE_ENABLE && Config.STORE_OFFLINE_TRADE_IN_REALTIME && ((storePlayer.getClient() == null) || storePlayer.getClient().isDetached()))
{

View File

@ -190,6 +190,12 @@ public final class TradeRequest extends L2GameClientPacket
return;
}
if (Config.FACTION_SYSTEM_ENABLED && ((player.isEvil() && partner.isGood()) || (player.isGood() && partner.isEvil())))
{
player.sendMessage("You cannot trade with different team members.");
return;
}
player.onTransactionRequest(partner);
partner.sendPacket(new SendTradeRequest(player.getObjectId()));
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_REQUESTED_A_TRADE_WITH_C1);

View File

@ -18,6 +18,7 @@
*/
package com.l2jserver.gameserver.network.clientpackets.friend;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.BlockList;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -100,6 +101,11 @@ public final class RequestFriendInvite extends L2GameClientPacket
activeChar.sendPacket(sm);
return;
}
if (Config.FACTION_SYSTEM_ENABLED && ((friend.isEvil() && activeChar.isGood()) || (friend.isGood() && activeChar.isEvil())))
{
activeChar.sendMessage("You cannot have a friend of the opposing faction.");
return;
}
// Friend request sent.
activeChar.onTransactionRequest(friend);
friend.sendPacket(new FriendAddRequest(activeChar.getName()));

View File

@ -18,6 +18,7 @@
*/
package com.l2jserver.gameserver.network.clientpackets.mentoring;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
@ -53,6 +54,12 @@ public class RequestMenteeAdd extends L2GameClientPacket
return;
}
if (Config.FACTION_SYSTEM_ENABLED && ((mentor.isEvil() && mentee.isGood()) || (mentor.isGood() && mentee.isEvil())))
{
mentor.sendMessage("You cannot mentor a member of the opposing faction.");
return;
}
if (ConfirmMenteeAdd.validate(mentor, mentee))
{
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OFFERED_TO_BECOME_S1_S_MENTOR).addCharName(mentee));