Addition of faction system (Good vs Evil).
This commit is contained in:
@@ -71,6 +71,7 @@ CREATE TABLE IF NOT EXISTS characters (
|
||||
power_grade decimal(11,0) DEFAULT NULL,
|
||||
nobless decimal(1,0) NOT NULL DEFAULT 0,
|
||||
subpledge int(1) NOT NULL DEFAULT 0,
|
||||
faction int(1) NOT NULL DEFAULT 0,
|
||||
last_recom_date decimal(20,0) NOT NULL DEFAULT 0,
|
||||
lvl_joined_academy int(1) NOT NULL DEFAULT 0,
|
||||
apprentice int(1) NOT NULL DEFAULT 0,
|
||||
|
||||
@@ -49,6 +49,9 @@ CREATE TABLE `custom_npc`(
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT ignore INTO custom_npc values
|
||||
('500', '30115', 'Jurek', '1', 'Faction Manager', '1', 'NPC.a_mageguild_master_MHuman', '8.00', '24.00', '70', 'male', 'Folk', '40', '3862', '1493', '11.85', '2.78', '40', '43', '30', '21', '20', '10', '0', '0', '1314', '470', '780', '382', '278', '0', '333', '0', '0', '0', '55', '132', null, '0', '1', '0', 'LAST_HIT'),
|
||||
('501', '31033', 'Sentinel', '1', ' ', '1', 'NPC.a_guard_MElf', '8.00', '23.50', '80', 'male', 'Guard', '1100', '4551', '1859', '13.43', '3.09', '40', '43', '30', '21', '20', '10', '0', '0', '4031', '576', '1144', '468', '249', '1000', '333', '276', '0', '0', '55', '176', 'Good', '500', '1', '0', 'LAST_HIT'),
|
||||
('502', '31036', 'Centurion', '1', ' ', '1', 'NPC.e_guard_MOrc', '8.00', '27.00', '80', 'male', 'Guard', '1100', '4551', '1859', '13.43', '3.09', '40', '43', '30', '21', '20', '10', '0', '0', '4031', '576', '1144', '468', '249', '1000', '333', '273', '0', '0', '55', '176', 'Evil', '500', '1', '0', 'LAST_HIT'),
|
||||
('31288', '31228', 'Roy the Cat', '1', 'Class Master', '1', 'Monster.cat_the_cat', '9.00', '16.00', '70', 'male', 'ClassMaster', '40', '3862', '1493', '11.85', '2.78', '40', '43', '30', '21', '20', '10', '490', '10', '1335', '470', '780', '382', '278', '0', '333', '0', '0', '0', '88', '132', null, '0', '0', '0', 'LAST_HIT'),
|
||||
('50000', '31228', 'Dom the Cat', '1', 'Merchant', '1', 'Monster.cat_the_cat', '9.00', '16.00', '70', 'male', 'Merchant', '40', '3862', '1493', '11.85', '2.78', '40', '43', '30', '21', '20', '10', '490', '10', '1335', '470', '780', '382', '278', '0', '333', '0', '0', '0', '88', '132', null, '0', '0', '0', 'LAST_HIT'),
|
||||
('50007', '31324', 'Andromeda', '1', 'Wedding Manager', '1', 'NPC.a_casino_FDarkElf', '8.00', '23.00', '70', 'female', 'WeddingManager', '40', '3862', '1493', '500', '500', '40', '43', '30', '21', '20', '10', '0', '0', '9999', '9999', '999', '999', '278', '0', '333', '316', '0', '0', '55', '132', null, '0', '1', '0', 'LAST_HIT'),
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Faction System (Good vs Evil)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable faction system.
|
||||
# Default: False
|
||||
EnableFactionSystem = False
|
||||
|
||||
# Starting location for all players.
|
||||
# Default: 85332,16199,-1252
|
||||
StartingLocation = 85332,16199,-1252
|
||||
|
||||
# Spawn location for faction manager NPC.
|
||||
# Default: 85712,15974,-1260,26808
|
||||
ManagerSpawnLocation = 85712,15974,-1260,26808
|
||||
|
||||
# Good base location.
|
||||
# Default: 45306,48878,-3058
|
||||
GoodBaseLocation = 45306,48878,-3058
|
||||
|
||||
# Evil base location.
|
||||
# Default: -44037,-113283,-237
|
||||
EvilBaseLocation = -44037,-113283,-237
|
||||
|
||||
# Good team name.
|
||||
# Default: Good
|
||||
GoodTeamName = Good
|
||||
|
||||
# Evil team name.
|
||||
# Default: Evil
|
||||
EvilTeamName = Evil
|
||||
|
||||
# Good name color.
|
||||
# Default: 00FF00
|
||||
GoodNameColor = 00FF00
|
||||
|
||||
# Evil name color.
|
||||
# Default: 0000FF
|
||||
EvilNameColor = 0000FF
|
||||
|
||||
# Enable faction guards.
|
||||
# The NPC template must have faction as clan.
|
||||
# Default: True
|
||||
EnableFactionGuards = True
|
||||
|
||||
# Upon death, respawn at faction base.
|
||||
# Default: True
|
||||
RespawnAtFactionBase = True
|
||||
|
||||
# Upon selecting faction, players become nobless.
|
||||
# Default: False
|
||||
FactionAutoNobless = False
|
||||
|
||||
# Disallow chat between factions.
|
||||
# Default: True
|
||||
EnableFactionChat = True
|
||||
|
||||
# Prohibit login when faction has more online players.
|
||||
# Default: True
|
||||
BalanceOnlinePlayers = True
|
||||
|
||||
# Online player exceed limit (used by setting above).
|
||||
# Default: 20
|
||||
BalancePlayerExceedLimit = 20
|
||||
@@ -0,0 +1,4 @@
|
||||
<html><body>Sentinel:<br>
|
||||
You must use extreme caution, sir! There have been reports of roaming thugs in this area, who think nothing of killing for the sheer pleasure of it. Please let me know if you see any of them. My bow will protect you from these murderers.<br>
|
||||
May the divine protection of Eva be with you always.
|
||||
</body></html>
|
||||
@@ -0,0 +1,3 @@
|
||||
<html><body>Centurion:<br>
|
||||
I am sworn by the will of Paagrio to destroy all evildoers! If you see any of them, tell me. My bow will put an end to their treachery!
|
||||
</body></html>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<html><title>Restriction</title></head><body>It seems that there are currently more %more% than %less% players online.<br>
|
||||
Try selecting an opposing faction character or wait for some %more% players to logout.
|
||||
</body></html>
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package custom.FactionSystem;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class FactionSystem extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int MANAGER = 500;
|
||||
// Other
|
||||
private static final String[] TEXTS =
|
||||
{
|
||||
Config.FACTION_GOOD_TEAM_NAME + " or " + Config.FACTION_EVIL_TEAM_NAME + "?",
|
||||
"Select your faction!",
|
||||
"The choice is yours!"
|
||||
};
|
||||
|
||||
private FactionSystem()
|
||||
{
|
||||
super(-1, "custom");
|
||||
|
||||
addSpawnId(MANAGER);
|
||||
addStartNpc(MANAGER);
|
||||
addTalkId(MANAGER);
|
||||
addFirstTalkId(MANAGER);
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
addSpawn(MANAGER, Config.FACTION_MANAGER_LOCATION, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, Player player)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "selectGoodFaction":
|
||||
{
|
||||
if (Config.FACTION_BALANCE_ONLINE_PLAYERS && (World.getInstance().getAllGoodPlayers().size() >= (World.getInstance().getAllEvilPlayers().size() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
String htmltext = getHtmlText("onlinelimit.html");
|
||||
htmltext = htmltext.replace("%name%", player.getName());
|
||||
htmltext = htmltext.replace("%more%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
htmltext = htmltext.replace("%less%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
return htmltext;
|
||||
}
|
||||
if (Config.FACTION_AUTO_NOBLESS)
|
||||
{
|
||||
player.setNoble(true);
|
||||
}
|
||||
player.setGood();
|
||||
player.getAppearance().setNameColor(Config.FACTION_GOOD_NAME_COLOR);
|
||||
player.getAppearance().setTitleColor(Config.FACTION_GOOD_NAME_COLOR);
|
||||
player.setTitle(Config.FACTION_GOOD_TEAM_NAME);
|
||||
player.sendMessage("You are now fighting for the " + Config.FACTION_GOOD_TEAM_NAME + " faction.");
|
||||
player.teleToLocation(Config.FACTION_GOOD_BASE_LOCATION, true);
|
||||
broadcastMessageToFaction(Config.FACTION_GOOD_TEAM_NAME, Config.FACTION_GOOD_TEAM_NAME + " faction grows stronger with the arrival of " + player.getName() + ".");
|
||||
World.addFactionPlayerToWorld(player);
|
||||
break;
|
||||
}
|
||||
case "selectEvilFaction":
|
||||
{
|
||||
if (Config.FACTION_BALANCE_ONLINE_PLAYERS && (World.getInstance().getAllEvilPlayers().size() >= (World.getInstance().getAllGoodPlayers().size() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
|
||||
{
|
||||
String htmltext = getHtmlText("onlinelimit.html");
|
||||
htmltext = htmltext.replace("%name%", player.getName());
|
||||
htmltext = htmltext.replace("%more%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
htmltext = htmltext.replace("%less%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
return htmltext;
|
||||
}
|
||||
if (Config.FACTION_AUTO_NOBLESS)
|
||||
{
|
||||
player.setNoble(true);
|
||||
}
|
||||
player.setEvil();
|
||||
player.getAppearance().setNameColor(Config.FACTION_EVIL_NAME_COLOR);
|
||||
player.getAppearance().setTitleColor(Config.FACTION_EVIL_NAME_COLOR);
|
||||
player.setTitle(Config.FACTION_EVIL_TEAM_NAME);
|
||||
player.sendMessage("You are now fighting for the " + Config.FACTION_EVIL_TEAM_NAME + " faction.");
|
||||
player.teleToLocation(Config.FACTION_EVIL_BASE_LOCATION, true);
|
||||
broadcastMessageToFaction(Config.FACTION_EVIL_TEAM_NAME, Config.FACTION_EVIL_TEAM_NAME + " faction grows stronger with the arrival of " + player.getName() + ".");
|
||||
World.addFactionPlayerToWorld(player);
|
||||
break;
|
||||
}
|
||||
case "SPEAK":
|
||||
{
|
||||
if (npc != null)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), getRandomEntry(TEXTS)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(Npc npc, Player player)
|
||||
{
|
||||
String htmltext = getHtmlText("manager.html");
|
||||
htmltext = htmltext.replace("%name%", player.getName());
|
||||
htmltext = htmltext.replace("%good%", Config.FACTION_GOOD_TEAM_NAME);
|
||||
htmltext = htmltext.replace("%evil%", Config.FACTION_EVIL_TEAM_NAME);
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
if (npc.getNpcId() == MANAGER)
|
||||
{
|
||||
startQuestTimer("SPEAK", 10000, npc, null, true);
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
private void broadcastMessageToFaction(String factionName, String message)
|
||||
{
|
||||
if (factionName.equals(Config.FACTION_GOOD_TEAM_NAME))
|
||||
{
|
||||
for (Player player : World.getInstance().getAllGoodPlayers())
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : World.getInstance().getAllEvilPlayers())
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FactionSystem();
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<html><body>Faction Manager:<br>
|
||||
What will your destiny be %name%?<br1>
|
||||
Will you choose to be %good%? ...or maybe %evil%?<br>
|
||||
<a action="bypass -h Quest FactionSystem selectGoodFaction">"I choose %good%!"</a><br>
|
||||
<a action="bypass -h Quest FactionSystem selectEvilFaction">"I choose %evil%!"</a>
|
||||
</body></html>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<html><body>Faction Manager:<br>
|
||||
I am sorry %name%.<br1>
|
||||
It seems that there are currently more %more% than %less% players online.<br>
|
||||
Try selecting the opposing faction or wait for some %more% players to logout.
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user