Addition of castle war info.

Contributed by Serenitty.
This commit is contained in:
MobiusDevelopment 2021-11-21 01:24:53 +00:00
parent 59807f0f6f
commit 78f0312064
5 changed files with 133 additions and 12 deletions

View File

@ -14,12 +14,12 @@ CREATE TABLE IF NOT EXISTS `castle` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT IGNORE INTO `castle` VALUES
(1,'Gludio','NEUTRAL',0,0,'true',0,'false',0),
(2,'Dion','NEUTRAL',0,0,'true',0,'false',0),
(3,'Giran','NEUTRAL',0,0,'true',0,'false',0),
(4,'Oren','NEUTRAL',0,0,'true',0,'false',0),
(5,'Aden','NEUTRAL',0,0,'true',0,'false',0);
-- (1,'Gludio','NEUTRAL',0,0,'true',0,'false',0),
-- (2,'Dion','NEUTRAL',0,0,'true',0,'false',0),
(3,'Giran','NEUTRAL',0,0,'true',0,'false',0),
-- (4,'Oren','NEUTRAL',0,0,'true',0,'false',0),
-- (5,'Aden','NEUTRAL',0,0,'true',0,'false',0),
-- (6,'Innadril','NEUTRAL',0,0,'true',0,'false',0),
-- (7,'Goddard','NEUTRAL',0,0,'true',0,'false',0),
(7,'Goddard','NEUTRAL',0,0,'true',0,'false',0);
-- (8,'Rune','NEUTRAL',0,0,'true',0,'false',0),
-- (9,'Schuttgart','NEUTRAL',0,0,'true',0,'false',0);

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/SiegeSchedule.xsd">
<schedule castleId="1" castleName="Gludio" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" />
<schedule castleId="2" castleName="Dion" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" />
<schedule castleId="3" castleName="Giran" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" />
<schedule castleId="4" castleName="Oren" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" />
<schedule castleId="5" castleName="Aden" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" />
<!-- <schedule castleId="1" castleName="Gludio" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" /> -->
<!-- <schedule castleId="2" castleName="Dion" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" /> -->
<schedule castleId="3" castleName="Giran" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" />
<!-- <schedule castleId="4" castleName="Oren" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" /> -->
<!-- <schedule castleId="5" castleName="Aden" siegeEnabled="true" day="SUNDAY" hour="16" maxConcurrent="5" /> -->
<schedule castleId="7" castleName="Goddard" siegeEnabled="true" day="TUESDAY" hour="16" maxConcurrent="5" />
</list>

View File

@ -42,6 +42,7 @@ import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivate
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionCancel;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionEnchant;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionPutItem;
import org.l2jmobius.gameserver.network.clientpackets.castlewar.ExMCWCastleInfo;
import org.l2jmobius.gameserver.network.clientpackets.classchange.ExRequestClassChange;
import org.l2jmobius.gameserver.network.clientpackets.classchange.ExRequestClassChangeVerifying;
import org.l2jmobius.gameserver.network.clientpackets.collection.RequestCollectionCloseUI;
@ -558,7 +559,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_RANKING_CHAR_SPAWN_BUFFZONE_NPC(0x184, null, ConnectionState.IN_GAME),
EX_RANKING_CHAR_BUFFZONE_NPC_POSITION(0x185, null, ConnectionState.IN_GAME),
EX_PLEDGE_MERCENARY_RECRUIT_INFO_SET(0x186, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_INFO(0x187, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_INFO(0x187, ExMCWCastleInfo::new, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_INFO(0x188, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_ATTACKER_LIST(0x189, null, ConnectionState.IN_GAME),
EX_MERCENARY_CASTLEWAR_CASTLE_SIEGE_DEFENDER_LIST(0x18A, null, ConnectionState.IN_GAME),

View File

@ -0,0 +1,48 @@
/*
* 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 org.l2jmobius.gameserver.network.clientpackets.castlewar;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.CastleManager;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.castlewar.ExMercenaryCastleWarCastleInfo;
/**
* @author Serenitty
*/
public class ExMCWCastleInfo implements IClientIncomingPacket
{
private int _castleId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_castleId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final var castle = CastleManager.getInstance().getCastleById(_castleId);
if (castle != null)
{
client.sendPacket(new ExMercenaryCastleWarCastleInfo(castle));
}
}
}

View File

@ -0,0 +1,71 @@
/*
* 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 org.l2jmobius.gameserver.network.serverpackets.castlewar;
import java.util.Calendar;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.TaxType;
import org.l2jmobius.gameserver.model.siege.Castle;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Serenitty
*/
public class ExMercenaryCastleWarCastleInfo implements IClientOutgoingPacket
{
private final Castle _castle;
public ExMercenaryCastleWarCastleInfo(Castle castle)
{
_castle = castle;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_MERCENARY_CASTLEWAR_CASTLE_INFO.writeId(packet);
packet.writeD(_castle.getResidenceId());
final var clan = _castle.getOwner();
if (clan != null)
{
packet.writeD(clan.getId());
packet.writeD(clan.getCrestId());
packet.writeString(clan.getName());
packet.writeString(clan.getLeaderName());
}
else
{
packet.writeD(0);
packet.writeD(0);
packet.writeString("");
packet.writeString("");
}
packet.writeD(_castle.getTaxPercent(TaxType.BUY));
packet.writeQ((long) (_castle.getTreasury() * _castle.getTaxRate(TaxType.BUY)));
packet.writeQ((long) (_castle.getTreasury() + (_castle.getTreasury() * _castle.getTaxRate(TaxType.BUY))));
final Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(_castle.getSiegeDate().getTimeInMillis());
packet.writeD((int) (cal.getTimeInMillis() / 1000));
return true;
}
}