Faction guards.
This commit is contained in:
parent
6c78bb3be3
commit
227f42cf73
7
trunk/dist/game/config/Custom.properties
vendored
7
trunk/dist/game/config/Custom.properties
vendored
@ -657,10 +657,17 @@ GoodNameColor = 00FF00
|
||||
# Default: 0000FF
|
||||
EvilNameColor = 0000FF
|
||||
|
||||
# Enable faction guards.
|
||||
# The npc template must have faction as clan.
|
||||
# Test guard ids 31033(Good), 31036(Evil).
|
||||
# Default: True
|
||||
EnableFactionGuards = True
|
||||
|
||||
# Disable chat between factions.
|
||||
# Default: True
|
||||
EnableFactionChat = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Premium System (VIP)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
20
trunk/dist/game/data/stats/npcs/31000-31100.xml
vendored
20
trunk/dist/game/data/stats/npcs/31000-31100.xml
vendored
@ -1212,7 +1212,7 @@
|
||||
<height normal="24" />
|
||||
</collision>
|
||||
</npc>
|
||||
<npc id="31033" level="80" type="L2Guard" name="Sentinel">
|
||||
<npc id="31033" level="99" type="L2Guard" name="Sentinel">
|
||||
<!-- Confirmed CT2.5 -->
|
||||
<parameters>
|
||||
<param name="NoFnHi" value="1" />
|
||||
@ -1223,7 +1223,7 @@
|
||||
<sex>MALE</sex>
|
||||
<equipment rhand="276" /> <!-- rhand: Elven Bow -->
|
||||
<stats str="40" int="21" dex="30" wit="20" con="43" men="20">
|
||||
<vitals hp="3290.11306877694" hpRegen="8.5" mp="1674.8" mpRegen="3" />
|
||||
<vitals hp="13290.11306877694" hpRegen="8.5" mp="11674.8" mpRegen="3" />
|
||||
<attack physical="970.537548504614" magical="662.751329129412" random="10" critical="8" accuracy="0" attackSpeed="253" reuseDelay="1500" type="BOW" range="1100" distance="10" width="0" />
|
||||
<defence physical="341.375" magical="249.80341" />
|
||||
<attribute>
|
||||
@ -1248,7 +1248,11 @@
|
||||
<skill id="4416" level="15" /> <!--Elves -->
|
||||
</skill_list>
|
||||
<ex_crt_effect>true</ex_crt_effect>
|
||||
<ai aggroRange="1000" clanHelpRange="300" />
|
||||
<ai aggroRange="1000" clanHelpRange="300">
|
||||
<clan_list>
|
||||
<clan>GOOD</clan>
|
||||
</clan_list>
|
||||
</ai>
|
||||
<collision>
|
||||
<radius normal="8" />
|
||||
<height normal="23.5" />
|
||||
@ -1338,7 +1342,7 @@
|
||||
<height normal="19" />
|
||||
</collision>
|
||||
</npc>
|
||||
<npc id="31036" level="80" type="L2Guard" name="Centurion">
|
||||
<npc id="31036" level="99" type="L2Guard" name="Centurion">
|
||||
<!-- Confirmed CT2.5 -->
|
||||
<parameters>
|
||||
<param name="NoFnHi" value="1" />
|
||||
@ -1349,7 +1353,7 @@
|
||||
<sex>MALE</sex>
|
||||
<equipment rhand="273" /> <!-- rhand: Composite Bow -->
|
||||
<stats str="40" int="21" dex="30" wit="20" con="43" men="20">
|
||||
<vitals hp="3290.11306877694" hpRegen="8.5" mp="1674.8" mpRegen="3" />
|
||||
<vitals hp="13290.11306877694" hpRegen="8.5" mp="11674.8" mpRegen="3" />
|
||||
<attack physical="970.537548504614" magical="662.751329129412" random="10" critical="8" accuracy="0" attackSpeed="253" reuseDelay="1500" type="BOW" range="1100" distance="10" width="0" />
|
||||
<defence physical="341.375" magical="249.80341" />
|
||||
<attribute>
|
||||
@ -1374,7 +1378,11 @@
|
||||
<skill id="4416" level="17" /> <!--Orcs -->
|
||||
</skill_list>
|
||||
<ex_crt_effect>true</ex_crt_effect>
|
||||
<ai aggroRange="1000" clanHelpRange="300" />
|
||||
<ai aggroRange="1000" clanHelpRange="300">
|
||||
<clan_list>
|
||||
<clan>EVIL</clan>
|
||||
</clan_list>
|
||||
</ai>
|
||||
<collision>
|
||||
<radius normal="8" />
|
||||
<height normal="27" />
|
||||
|
@ -831,6 +831,7 @@ public final class Config
|
||||
public static String FACTION_EVIL_TEAM_NAME;
|
||||
public static int FACTION_GOOD_NAME_COLOR;
|
||||
public static int FACTION_EVIL_NAME_COLOR;
|
||||
public static boolean FACTION_GUARDS_ENABLED;
|
||||
public static boolean FACTION_SPECIFIC_CHAT;
|
||||
public static boolean PREMIUM_SYSTEM_ENABLED;
|
||||
public static float PREMIUM_RATE_XP;
|
||||
@ -2651,6 +2652,7 @@ public final class Config
|
||||
FACTION_EVIL_TEAM_NAME = CustomSettings.getString("EvilTeamName", "Evil");
|
||||
FACTION_GOOD_NAME_COLOR = Integer.decode("0x" + CustomSettings.getString("GoodNameColor", "00FF00"));
|
||||
FACTION_EVIL_NAME_COLOR = Integer.decode("0x" + CustomSettings.getString("EvilNameColor", "0000FF"));
|
||||
FACTION_GUARDS_ENABLED = CustomSettings.getBoolean("EnableFactionGuards", true);
|
||||
FACTION_SPECIFIC_CHAT = Boolean.valueOf(CustomSettings.getBoolean("EnableFactionChat", true));
|
||||
|
||||
PREMIUM_SYSTEM_ENABLED = CustomSettings.getBoolean("EnablePremiumSystem", false);
|
||||
|
@ -209,6 +209,10 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
// Check if the actor is a L2GuardInstance
|
||||
if (me instanceof L2GuardInstance)
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && (player != null) && ((player.isGood() && me.getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && me.getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
return GeoData.getInstance().canSeeTarget(me, player);
|
||||
}
|
||||
// Check if the L2PcInstance target has karma (=PK)
|
||||
if ((player != null) && (player.getKarma() > 0))
|
||||
{
|
||||
|
@ -73,11 +73,15 @@ public class L2GuardInstance extends L2Attackable
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True if hte attacker is a L2MonsterInstance.
|
||||
* Return True if the attacker is a L2MonsterInstance.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoAttackable(L2Character attacker)
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && attacker.isPlayer() && ((attacker.getActingPlayer().isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (attacker.getActingPlayer().isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return attacker instanceof L2MonsterInstance;
|
||||
}
|
||||
|
||||
@ -151,6 +155,13 @@ public class L2GuardInstance extends L2Attackable
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
interact = false;
|
||||
// TODO: Fix normal targeting
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
|
||||
}
|
||||
|
||||
// Check if the L2PcInstance already target the L2GuardInstance
|
||||
if (getObjectId() != player.getTargetId())
|
||||
{
|
||||
|
@ -8733,16 +8733,14 @@ public final class L2PcInstance extends L2Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && skill.isBad()) && ((isGood() && target.getActingPlayer().isGood()) || (isEvil() && target.getActingPlayer().isEvil())))
|
||||
// Faction System Guards
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && (target instanceof L2GuardInstance))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && !skill.isBad()) && ((isGood() && target.getActingPlayer().isEvil()) || (isEvil() && target.getActingPlayer().isGood())))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
if (skill.isBad() && ((isGood() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME)) || (isEvil() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME))))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// skills can be used on Walls and Doors only during siege
|
||||
@ -9164,6 +9162,16 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
}
|
||||
|
||||
// Faction System
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if ((isGood() && target.getActingPlayer().isGood()) || (isEvil() && target.getActingPlayer().isEvil()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// On retail, it is impossible to debuff a "peaceful" player.
|
||||
if ((targetPlayer.getPvpFlag() == 0) && (targetPlayer.getKarma() == 0))
|
||||
{
|
||||
|
@ -59,6 +59,21 @@ public class GuardKnownList extends AttackableKnownList
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Faction system
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((object.getActingPlayer().isGood() && getActiveChar().getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (object.getActingPlayer().isEvil() && getActiveChar().getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine(getActiveChar().getObjectId() + ": Enemy faction " + object.getObjectId() + " entered scan range");
|
||||
}
|
||||
|
||||
// Set the L2GuardInstance Intention to AI_INTENTION_ACTIVE
|
||||
if (getActiveChar().getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
|
||||
{
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((Config.GUARD_ATTACK_AGGRO_MOB && getActiveChar().isInActiveRegion()) && object.isMonster())
|
||||
{
|
||||
|
@ -46,9 +46,11 @@ import com.l2jserver.gameserver.model.PcCondOverride;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2BlockInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
@ -1184,6 +1186,18 @@ public final class Skill implements IIdentifiable
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && (target instanceof L2GuardInstance))
|
||||
{
|
||||
if (player.isGood() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (player.isEvil() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user