This commit is contained in:
6
trunk/dist/game/data/scripts/custom/events/Wedding/Accepted.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Accepted.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
Congratulations you are married!
|
||||
</body>
|
||||
</html>
|
||||
7
trunk/dist/game/data/scripts/custom/events/Wedding/Adena.html
vendored
Normal file
7
trunk/dist/game/data/scripts/custom/events/Wedding/Adena.html
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You don't have enough adena for marriage.<br>
|
||||
<font color="LEVEL">You need %fee% Adena.</font>
|
||||
</body>
|
||||
</html>
|
||||
6
trunk/dist/game/data/scripts/custom/events/Wedding/Already.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Already.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
Go away, you are already married!
|
||||
</body>
|
||||
</html>
|
||||
10
trunk/dist/game/data/scripts/custom/events/Wedding/Ask.html
vendored
Normal file
10
trunk/dist/game/data/scripts/custom/events/Wedding/Ask.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
Your partner %player% asked to marry you.<br>
|
||||
<center>
|
||||
<a action="bypass -h Quest Wedding accept">Accept Wedding</a><br>
|
||||
<a action="bypass -h Quest Wedding decline">Decline Wedding</a><br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
6
trunk/dist/game/data/scripts/custom/events/Wedding/Declined.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Declined.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
The request of marriage was declined.
|
||||
</body>
|
||||
</html>
|
||||
16
trunk/dist/game/data/scripts/custom/events/Wedding/Instructions.html
vendored
Normal file
16
trunk/dist/game/data/scripts/custom/events/Wedding/Instructions.html
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
In order to get married you first have to be engaged.<br>
|
||||
To get engaged simply target your desired partner and type in the command ".engage" without the quotes.<br>
|
||||
For this to work, you both need to be on each other's friends list.<br>
|
||||
To do this, you need to type "/friendinvite PlayerName" without the quotes where PlayerName is the name of your partner.<br>
|
||||
Once engaged, you ask me to get married.<br>
|
||||
You both have to be wearing Formal Wear in order for this to work as well as the wedding will cost %fee% Adena.<br>
|
||||
Once married, you can use the command ".gotolove" without the quotes, to teleport to your partner at anytime.<br>
|
||||
If you wish to divorce, simply type the command ".divorce" without the quotes.<br>
|
||||
<center>
|
||||
<a action="bypass -h Quest Wedding start">Back</a><br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
7
trunk/dist/game/data/scripts/custom/events/Wedding/NoFormal.html
vendored
Normal file
7
trunk/dist/game/data/scripts/custom/events/Wedding/NoFormal.html
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You are not wearing formal wear, go get formal wear and come back later.<br>
|
||||
If dont know where get it, then <font color="LEVEL">Trader Alexis</font> in Aden town can help you.
|
||||
</body>
|
||||
</html>
|
||||
6
trunk/dist/game/data/scripts/custom/events/Wedding/NoPartner.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/NoPartner.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You don't have partner, you need to be engaged before you can marry.
|
||||
</body>
|
||||
</html>
|
||||
6
trunk/dist/game/data/scripts/custom/events/Wedding/NotFound.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/NotFound.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
No partner found, your friend must be online.
|
||||
</body>
|
||||
</html>
|
||||
6
trunk/dist/game/data/scripts/custom/events/Wedding/Requested.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/Requested.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You requested %player% to marry you.
|
||||
</body>
|
||||
</html>
|
||||
20
trunk/dist/game/data/scripts/custom/events/Wedding/Start.html
vendored
Normal file
20
trunk/dist/game/data/scripts/custom/events/Wedding/Start.html
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
I understand that you want to get married? Marriage is an expensive ceremony!<br>
|
||||
Are you sure you want to go ahead with it?<br>
|
||||
<center>
|
||||
<a action="bypass -h Quest Wedding ask">I want to marry</a>
|
||||
</center>
|
||||
<br>
|
||||
Instructions:<br>
|
||||
In order to get married you first have to be engaged.<br>
|
||||
To get engaged simply target your desired partner and type in the command ".engage" without the quotes.<br>
|
||||
For this to work, you both need to be on each other's friends list.<br>
|
||||
To do this, you need to type "/friendinvite PlayerName" without the quotes where PlayerName is the name of your partner.<br>
|
||||
Once engaged, you ask me to get married.<br>
|
||||
You both have to be wearing Formal wear in order for this to work as well as the wedding will cost %fee% Adena.<br>
|
||||
Once married, you can use the command ".gotolove" without the quotes, to teleport to your partner at anytime.<br>
|
||||
If you wish to divorce, simply type the command ".divorce" without the quotes.
|
||||
</body>
|
||||
</html>
|
||||
6
trunk/dist/game/data/scripts/custom/events/Wedding/WaitForPartner.html
vendored
Normal file
6
trunk/dist/game/data/scripts/custom/events/Wedding/WaitForPartner.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Andromeda:<br>
|
||||
You asked your partner to marry you, wait till your partner accepted or declined your request.
|
||||
</body>
|
||||
</html>
|
||||
211
trunk/dist/game/data/scripts/custom/events/Wedding/Wedding.java
vendored
Normal file
211
trunk/dist/game/data/scripts/custom/events/Wedding/Wedding.java
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J DataPack
|
||||
*
|
||||
* This file is part of L2J DataPack.
|
||||
*
|
||||
* L2J DataPack 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.
|
||||
*
|
||||
* L2J DataPack 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.events.Wedding;
|
||||
|
||||
import ai.npc.AbstractNpcAI;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.instancemanager.CoupleManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Couple;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* Wedding AI.
|
||||
* @author Zoey76
|
||||
*/
|
||||
public final class Wedding extends AbstractNpcAI
|
||||
{
|
||||
// NPC
|
||||
private static final int MANAGER_ID = 50007;
|
||||
// Item
|
||||
private static final int FORMAL_WEAR = 6408;
|
||||
|
||||
public Wedding()
|
||||
{
|
||||
super(Wedding.class.getSimpleName(), "custom/events");
|
||||
addFirstTalkId(MANAGER_ID);
|
||||
addTalkId(MANAGER_ID);
|
||||
addStartNpc(MANAGER_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
if (player.getPartnerId() == 0)
|
||||
{
|
||||
return "NoPartner.html";
|
||||
}
|
||||
|
||||
final L2PcInstance partner = L2World.getInstance().getPlayer(player.getPartnerId());
|
||||
if ((partner == null) || !partner.isOnline())
|
||||
{
|
||||
return "NotFound.html";
|
||||
}
|
||||
|
||||
if (player.isMarried())
|
||||
{
|
||||
return "Already.html";
|
||||
}
|
||||
|
||||
if (player.isMarryAccepted())
|
||||
{
|
||||
return "WaitForPartner.html";
|
||||
}
|
||||
|
||||
String htmltext = null;
|
||||
if (player.isMarryRequest())
|
||||
{
|
||||
if (!isWearingFormalWear(player) || !isWearingFormalWear(partner))
|
||||
{
|
||||
htmltext = sendHtml(partner, "NoFormal.html", null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setMarryRequest(false);
|
||||
partner.setMarryRequest(false);
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Ask.html");
|
||||
htmltext = htmltext.replaceAll("%player%", partner.getName());
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "ask":
|
||||
{
|
||||
if (!isWearingFormalWear(player) || !isWearingFormalWear(partner))
|
||||
{
|
||||
htmltext = sendHtml(partner, "NoFormal.html", null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setMarryAccepted(true);
|
||||
partner.setMarryRequest(true);
|
||||
|
||||
sendHtml(partner, "Ask.html", "%player%", player.getName());
|
||||
|
||||
htmltext = getHtm(player.getHtmlPrefix(), "Requested.html");
|
||||
htmltext = htmltext.replaceAll("%player%", partner.getName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "accept":
|
||||
{
|
||||
if (!isWearingFormalWear(player) || !isWearingFormalWear(partner))
|
||||
{
|
||||
htmltext = sendHtml(partner, "NoFormal.html", null, null);
|
||||
}
|
||||
else if ((player.getAdena() < Config.L2JMOD_WEDDING_PRICE) || (partner.getAdena() < Config.L2JMOD_WEDDING_PRICE))
|
||||
{
|
||||
htmltext = sendHtml(partner, "Adena.html", "%fee%", String.valueOf(Config.L2JMOD_WEDDING_PRICE));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.reduceAdena("Wedding", Config.L2JMOD_WEDDING_PRICE, player.getLastFolkNPC(), true);
|
||||
partner.reduceAdena("Wedding", Config.L2JMOD_WEDDING_PRICE, player.getLastFolkNPC(), true);
|
||||
|
||||
// Accept the wedding request
|
||||
player.setMarryAccepted(true);
|
||||
Couple couple = CoupleManager.getInstance().getCouple(player.getCoupleId());
|
||||
couple.marry();
|
||||
|
||||
// Messages to the couple
|
||||
player.sendMessage("Congratulations you are married!");
|
||||
player.setMarried(true);
|
||||
player.setMarryRequest(false);
|
||||
partner.sendMessage("Congratulations you are married!");
|
||||
partner.setMarried(true);
|
||||
partner.setMarryRequest(false);
|
||||
|
||||
// Wedding march
|
||||
player.broadcastPacket(new MagicSkillUse(player, player, 2230, 1, 1, 0));
|
||||
partner.broadcastPacket(new MagicSkillUse(partner, partner, 2230, 1, 1, 0));
|
||||
|
||||
// Fireworks
|
||||
Skill skill = CommonSkill.LARGE_FIREWORK.getSkill();
|
||||
if (skill != null)
|
||||
{
|
||||
player.doCast(skill);
|
||||
partner.doCast(skill);
|
||||
}
|
||||
|
||||
Broadcast.toAllOnlinePlayers("Congratulations to " + player.getName() + " and " + partner.getName() + "! They have been married.");
|
||||
|
||||
htmltext = sendHtml(partner, "Accepted.html", null, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "decline":
|
||||
{
|
||||
player.setMarryRequest(false);
|
||||
partner.setMarryRequest(false);
|
||||
player.setMarryAccepted(false);
|
||||
partner.setMarryAccepted(false);
|
||||
|
||||
player.sendMessage("You declined your partner's marriage request.");
|
||||
partner.sendMessage("Your partner declined your marriage request.");
|
||||
|
||||
htmltext = sendHtml(partner, "Declined.html", null, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
final String htmltext = getHtm(player.getHtmlPrefix(), "Start.html");
|
||||
return htmltext.replaceAll("%fee%", String.valueOf(Config.L2JMOD_WEDDING_PRICE));
|
||||
}
|
||||
|
||||
private String sendHtml(L2PcInstance player, String fileName, String regex, String replacement)
|
||||
{
|
||||
String html = getHtm(player.getHtmlPrefix(), fileName);
|
||||
if ((regex != null) && (replacement != null))
|
||||
{
|
||||
html = html.replaceAll(regex, replacement);
|
||||
}
|
||||
player.sendPacket(new NpcHtmlMessage(html));
|
||||
return html;
|
||||
}
|
||||
|
||||
private static boolean isWearingFormalWear(L2PcInstance player)
|
||||
{
|
||||
if (Config.L2JMOD_WEDDING_FORMALWEAR)
|
||||
{
|
||||
final L2ItemInstance formalWear = player.getChestArmorInstance();
|
||||
return (formalWear != null) && (formalWear.getId() == FORMAL_WEAR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Wedding();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user