Pledge v3 addition.

This commit is contained in:
MobiusDevelopment 2022-05-23 21:41:12 +00:00
parent 662bbf51f5
commit 42039fadd5
14 changed files with 699 additions and 9 deletions

View File

@ -19,6 +19,7 @@ CREATE TABLE IF NOT EXISTS `clan_data` (
`char_penalty_expiry_time` bigint(13) unsigned NOT NULL DEFAULT '0',
`dissolving_expiry_time` bigint(13) unsigned NOT NULL DEFAULT '0',
`new_leader_id` INT(10) unsigned NOT NULL DEFAULT '0',
`exp` INT,
PRIMARY KEY (`clan_id`),
KEY `ally_id` (`ally_id`),
KEY `leader_id` (`leader_id`),

View File

@ -156,9 +156,10 @@ public class AdminPledge implements IAdminCommandHandler
}
final int level = Integer.parseInt(param);
if ((level >= 0) && (level < 12))
if ((level >= 0) && (level <= (Clan.EXP_TABLE.length - 1)))
{
clan.changeLevel(level);
clan.setExp(Clan.EXP_TABLE[level]);
for (Player member : clan.getOnlineMembers(0))
{
member.broadcastUserInfo(UserInfoType.RELATION, UserInfoType.CLAN);

View File

@ -297,6 +297,11 @@ public class Attackable extends Npc
if ((killer != null) && (killer.getActingPlayer() != null))
{
if ((killer.getClan() != null) && (Rnd.get(100) < 2))
{
killer.getClan().addExp(1);
}
// Delayed notification
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableKill(killer.getActingPlayer(), this, killer.isSummon()), this);
}

View File

@ -82,6 +82,8 @@ import org.l2jmobius.gameserver.network.serverpackets.PledgeSkillList.SubPledgeS
import org.l2jmobius.gameserver.network.serverpackets.PledgeSkillListAdd;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
import org.l2jmobius.gameserver.network.serverpackets.pledgeV3.ExPledgeLevelUp;
import org.l2jmobius.gameserver.network.serverpackets.pledgeV3.ExPledgeV3Info;
import org.l2jmobius.gameserver.network.serverpackets.pledgebonus.ExPledgeBonusMarkReset;
import org.l2jmobius.gameserver.util.EnumIntBitmask;
import org.l2jmobius.gameserver.util.Util;
@ -91,7 +93,7 @@ public class Clan implements IIdentifiable, INamable
private static final Logger LOGGER = Logger.getLogger(Clan.class.getName());
// SQL queries
private static final String INSERT_CLAN_DATA = "INSERT INTO clan_data (clan_id,clan_name,clan_level,hasCastle,blood_alliance_count,blood_oath_count,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,new_leader_id) values (?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String INSERT_CLAN_DATA = "INSERT INTO clan_data (clan_id,clan_name,clan_level,hasCastle,blood_alliance_count,blood_oath_count,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id,new_leader_id,exp) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String SELECT_CLAN_DATA = "SELECT * FROM clan_data where clan_id=?";
// Ally Penalty Types
@ -119,6 +121,21 @@ public class Clan implements IIdentifiable, INamable
/** Clan subunit type of Order of Knights B-2 */
public static final int SUBUNIT_KNIGHT4 = 2002;
public static final int[] EXP_TABLE =
{
0,
100,
1000,
5000,
100000,
500000,
1500000,
4500000,
7500000,
11000000,
14500000
};
private String _name;
private int _clanId;
private ClanMember _leader;
@ -154,6 +171,7 @@ public class Clan implements IIdentifiable, INamable
private int _reputationScore = 0;
private int _rank = 0;
private int _exp = 0;
private String _notice;
private boolean _noticeEnabled = false;
@ -974,7 +992,7 @@ public class Clan implements IIdentifiable, INamable
public void updateClanInDB()
{
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=?,exp=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
ps.setInt(2, _allyId);
@ -985,7 +1003,8 @@ public class Clan implements IIdentifiable, INamable
ps.setLong(7, _charPenaltyExpiryTime);
ps.setLong(8, _dissolvingExpiryTime);
ps.setInt(9, _newLeaderId);
ps.setInt(10, _clanId);
ps.setInt(10, _exp);
ps.setInt(11, _clanId);
ps.execute();
}
catch (Exception e)
@ -1027,6 +1046,7 @@ public class Clan implements IIdentifiable, INamable
ps.setInt(11, _crestLargeId);
ps.setInt(12, _allyCrestId);
ps.setInt(13, _newLeaderId);
ps.setInt(14, _exp);
ps.execute();
}
catch (Exception e)
@ -1098,6 +1118,7 @@ public class Clan implements IIdentifiable, INamable
setCrestLargeId(clanData.getInt("crest_large_id"));
setAllyCrestId(clanData.getInt("ally_crest_id"));
_exp = clanData.getInt("exp");
setReputationScore(clanData.getInt("reputation_score"));
setAuctionBiddedAt(clanData.getInt("auction_bid_at"), false);
setNewLeaderId(clanData.getInt("new_leader_id"), false);
@ -2463,6 +2484,7 @@ public class Clan implements IIdentifiable, INamable
updateClanInDB();
}
// Unused?
public boolean levelUpClan(Player player)
{
if (!player.isClanLeader())
@ -2612,6 +2634,7 @@ public class Clan implements IIdentifiable, INamable
}
// notify all the members about it
broadcastToOnlineMembers(new ExPledgeLevelUp(level));
broadcastToOnlineMembers(new SystemMessage(SystemMessageId.YOUR_CLAN_S_LEVEL_HAS_INCREASED));
broadcastToOnlineMembers(new PledgeShowInfoUpdate(this));
}
@ -3040,4 +3063,31 @@ public class Clan implements IIdentifiable, INamable
vars.storeMe();
}
}
public int getExp()
{
return _exp;
}
public void addExp(int value)
{
if ((_exp + value) < EXP_TABLE[EXP_TABLE.length - 1])
{
_exp += value;
broadcastToOnlineMembers(new ExPledgeV3Info(_exp, getRank(), getNotice(), isNoticeEnabled()));
}
final int nextLevel = getLevel() + 1;
if ((nextLevel < EXP_TABLE.length) && ((EXP_TABLE[Math.max(0, nextLevel)]) <= _exp))
{
changeLevel(_level + 1);
}
}
public void setExp(int value)
{
_exp = value;
broadcastToOnlineMembers(new ExPledgeV3Info(_exp, getRank(), getNotice(), isNoticeEnabled()));
updateClanInDB();
}
}

View File

@ -96,6 +96,11 @@ import org.l2jmobius.gameserver.network.clientpackets.pet.ExEvolvePet;
import org.l2jmobius.gameserver.network.clientpackets.pet.ExPetEquipItem;
import org.l2jmobius.gameserver.network.clientpackets.pet.ExPetUnequipItem;
import org.l2jmobius.gameserver.network.clientpackets.pet.RequestExAcquirePetSkill;
import org.l2jmobius.gameserver.network.clientpackets.pledgeV3.RequestExPledgeEnemyDelete;
import org.l2jmobius.gameserver.network.clientpackets.pledgeV3.RequestExPledgeEnemyInfoList;
import org.l2jmobius.gameserver.network.clientpackets.pledgeV3.RequestExPledgeEnemyRegister;
import org.l2jmobius.gameserver.network.clientpackets.pledgeV3.RequestExPledgeV3Info;
import org.l2jmobius.gameserver.network.clientpackets.pledgeV3.RequestExPledgeV3SetAnnounce;
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusOpen;
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusReward;
import org.l2jmobius.gameserver.network.clientpackets.pledgebonus.RequestPledgeBonusRewardList;
@ -599,14 +604,14 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_PVP_RANKING_MY_INFO(0x1C2, RequestPvpRankingMyInfo::new, ConnectionState.IN_GAME),
EX_PVP_RANKING_LIST(0x1C3, RequestPvpRankingList::new, ConnectionState.IN_GAME),
EX_ACQUIRE_PET_SKILL(0x1C4, RequestExAcquirePetSkill::new, ConnectionState.IN_GAME),
EX_PLEDGE_V3_INFO(0x1C5, null, ConnectionState.IN_GAME),
EX_PLEDGE_ENEMY_INFO_LIST(0x1C6, null, ConnectionState.IN_GAME),
EX_PLEDGE_ENEMY_REGISTER(0x1C7, null, ConnectionState.IN_GAME),
EX_PLEDGE_ENEMY_DELETE(0x1C8, null, ConnectionState.IN_GAME),
EX_PLEDGE_V3_INFO(0x1C5, RequestExPledgeV3Info::new, ConnectionState.IN_GAME),
EX_PLEDGE_ENEMY_INFO_LIST(0x1C6, RequestExPledgeEnemyInfoList::new, ConnectionState.IN_GAME),
EX_PLEDGE_ENEMY_REGISTER(0x1C7, RequestExPledgeEnemyRegister::new, ConnectionState.IN_GAME),
EX_PLEDGE_ENEMY_DELETE(0x1C8, RequestExPledgeEnemyDelete::new, ConnectionState.IN_GAME),
EX_PK_PENALTY_LIST(0x1C9, null, ConnectionState.IN_GAME),
EX_PK_PENALTY_LIST_ONLY_LOC(0x1CA, null, ConnectionState.IN_GAME),
EX_TRY_PET_EXTRACT_SYSTEM(0x1CB, null, ConnectionState.IN_GAME),
EX_PLEDGE_V3_SET_ANNOUNCE(0x1CC, null, ConnectionState.IN_GAME),
EX_PLEDGE_V3_SET_ANNOUNCE(0x1CC, RequestExPledgeV3SetAnnounce::new, ConnectionState.IN_GAME),
EX_MAX(0x1CD, null, ConnectionState.IN_GAME);
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@ -0,0 +1,105 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.clan.ClanMember;
import org.l2jmobius.gameserver.model.clan.ClanPrivilege;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
public class RequestExPledgeEnemyDelete implements IClientIncomingPacket
{
private String _pledgeName;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_pledgeName = packet.readS();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final Clan playerClan = player.getClan();
if (playerClan == null)
{
return;
}
final Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
if (clan == null)
{
player.sendMessage("No such clan.");
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if (!playerClan.isAtWarWith(clan.getId()))
{
player.sendMessage("You aren't at war with this clan.");
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Check if player who does the request has the correct rights to do it
if (!player.hasClanPrivilege(ClanPrivilege.CL_PLEDGE_WAR))
{
player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
return;
}
for (ClanMember member : playerClan.getMembers())
{
if ((member == null) || (member.getPlayer() == null))
{
continue;
}
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(member.getPlayer()))
{
player.sendPacket(SystemMessageId.THE_CLAN_WAR_CANNOT_BE_STOPPED_BECAUSE_SOMEONE_FROM_YOUR_CLAN_IS_STILL_ENGAGED_IN_BATTLE);
return;
}
}
// Reduce reputation.
playerClan.takeReputationScore(500);
ClanTable.getInstance().deleteClanWars(playerClan.getId(), clan.getId());
for (Player member : playerClan.getOnlineMembers(0))
{
member.broadcastUserInfo();
}
for (Player member : clan.getOnlineMembers(0))
{
member.broadcastUserInfo();
}
}
}

View File

@ -0,0 +1,56 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.pledgeV3.ExPledgeEnemyInfoList;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class RequestExPledgeEnemyInfoList implements IClientIncomingPacket
{
private int _playerClan;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_playerClan = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final Clan clan = ClanTable.getInstance().getClan(_playerClan);
if ((clan != null) && (clan.getClanMember(player.getObjectId()) != null))
{
player.sendPacket(new ExPledgeEnemyInfoList(clan));
}
}
}

View File

@ -0,0 +1,136 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.enums.ClanWarState;
import org.l2jmobius.gameserver.enums.UserInfoType;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.clan.ClanMember;
import org.l2jmobius.gameserver.model.clan.ClanPrivilege;
import org.l2jmobius.gameserver.model.clan.ClanWar;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public class RequestExPledgeEnemyRegister implements IClientIncomingPacket
{
private String _pledgeName;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_pledgeName = packet.readString();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final Clan clanDeclaringWar = player.getClan();
if (clanDeclaringWar == null)
{
return;
}
if (!player.hasClanPrivilege(ClanPrivilege.CL_PLEDGE_WAR))
{
client.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (clanDeclaringWar.getWarCount() >= 30)
{
client.sendPacket(SystemMessageId.A_DECLARATION_OF_WAR_AGAINST_MORE_THAN_30_CLANS_CAN_T_BE_MADE_AT_THE_SAME_TIME);
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
final Clan clanDeclaredWar = ClanTable.getInstance().getClanByName(_pledgeName);
if (clanDeclaredWar == null)
{
client.sendPacket(new SystemMessage(SystemMessageId.A_CLAN_WAR_CANNOT_BE_DECLARED_AGAINST_A_CLAN_THAT_DOES_NOT_EXIST));
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (clanDeclaredWar == clanDeclaringWar)
{
client.sendPacket(new SystemMessage(SystemMessageId.FOOL_YOU_CANNOT_DECLARE_WAR_AGAINST_YOUR_OWN_CLAN));
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if ((clanDeclaringWar.getAllyId() == clanDeclaredWar.getAllyId()) && (clanDeclaringWar.getAllyId() != 0))
{
client.sendPacket(new SystemMessage(SystemMessageId.A_DECLARATION_OF_CLAN_WAR_AGAINST_AN_ALLIED_CLAN_CAN_T_BE_MADE));
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (clanDeclaredWar.getDissolvingExpiryTime() > System.currentTimeMillis())
{
client.sendPacket(new SystemMessage(SystemMessageId.A_CLAN_WAR_CAN_NOT_BE_DECLARED_AGAINST_A_CLAN_THAT_IS_BEING_DISSOLVED));
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
final ClanWar clanWar = clanDeclaringWar.getWarWith(clanDeclaredWar.getId());
if (clanWar != null)
{
if (clanWar.getClanWarState(clanDeclaringWar) == ClanWarState.WIN)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_CAN_T_DECLARE_A_WAR_BECAUSE_THE_21_DAY_PERIOD_HASN_T_PASSED_AFTER_A_DEFEAT_DECLARATION_WITH_THE_S1_CLAN);
sm.addString(clanDeclaredWar.getName());
client.sendPacket(sm);
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_ALREADY_BEEN_AT_WAR_WITH_THE_S1_CLAN_5_DAYS_MUST_PASS_BEFORE_YOU_CAN_DECLARE_WAR_AGAIN);
sm.addString(clanDeclaredWar.getName());
client.sendPacket(sm);
client.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
final ClanWar newClanWar = new ClanWar(clanDeclaringWar, clanDeclaredWar);
ClanTable.getInstance().storeClanWars(newClanWar);
for (ClanMember member : clanDeclaringWar.getMembers())
{
if ((member != null) && member.isOnline())
{
member.getPlayer().broadcastUserInfo(UserInfoType.CLAN);
}
}
for (ClanMember member : clanDeclaredWar.getMembers())
{
if ((member != null) && member.isOnline())
{
member.getPlayer().broadcastUserInfo(UserInfoType.CLAN);
}
}
}
}

View File

@ -0,0 +1,59 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.PledgeReceiveWarList;
import org.l2jmobius.gameserver.network.serverpackets.pledgeV3.ExPledgeClassicRaidInfo;
import org.l2jmobius.gameserver.network.serverpackets.pledgeV3.ExPledgeV3Info;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class RequestExPledgeV3Info implements IClientIncomingPacket
{
private int _page;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_page = packet.readC();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
if (player.getClan() == null)
{
return;
}
player.sendPacket(new ExPledgeV3Info(player.getClan().getExp(), player.getClan().getRank(), player.getClan().getNotice(), player.getClan().isNoticeEnabled()));
player.sendPacket(new PledgeReceiveWarList(player.getClan(), _page));
player.sendPacket(new ExPledgeClassicRaidInfo(player));
}
}

View File

@ -0,0 +1,61 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.pledgeV3.ExPledgeV3Info;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class RequestExPledgeV3SetAnnounce implements IClientIncomingPacket
{
private String _announce;
private boolean _enterWorldShow;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_announce = packet.readString();
_enterWorldShow = packet.readC() == 1;
return true;
}
@Override
public void run(GameClient client)
{
final Player activeChar = client.getPlayer();
if (activeChar == null)
{
return;
}
final Clan clan = activeChar.getClan();
if (clan == null)
{
return;
}
clan.setNotice(_announce);
clan.setNoticeEnabled(_enterWorldShow);
clan.broadcastToOnlineMembers(new ExPledgeV3Info(clan.getExp(), clan.getRank(), clan.getNotice(), clan.isNoticeEnabled()));
}
}

View File

@ -0,0 +1,60 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class ExPledgeClassicRaidInfo implements IClientOutgoingPacket
{
private final Clan _clan;
public ExPledgeClassicRaidInfo(Player player)
{
_clan = player.getClan();
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_CLASSIC_RAID_INFO.writeId(packet);
if (_clan == null)
{
packet.writeD(0);
}
else
{
final int stage = GlobalVariablesManager.getInstance().getInt(GlobalVariablesManager.MONSTER_ARENA_VARIABLE + _clan.getId(), 0);
packet.writeD(stage);
// Skill rewards.
packet.writeD(5);
for (int i = 1; i <= 5; i++)
{
packet.writeD(1867);
packet.writeD(i);
}
}
return true;
}
}

View File

@ -0,0 +1,58 @@
/*
* 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.pledgeV3;
import java.util.List;
import java.util.stream.Collectors;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.ClanWarState;
import org.l2jmobius.gameserver.model.clan.Clan;
import org.l2jmobius.gameserver.model.clan.ClanWar;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Written by Berezkin Nikolay, on 04.05.2021
*/
public class ExPledgeEnemyInfoList implements IClientOutgoingPacket
{
private final Clan _playerClan;
private final List<ClanWar> _warList;
public ExPledgeEnemyInfoList(Clan playerClan)
{
_playerClan = playerClan;
_warList = playerClan.getWarList().values().stream().filter(it -> (it.getClanWarState(playerClan) == ClanWarState.MUTUAL) || (it.getAttackerClanId() == playerClan.getId())).collect(Collectors.toList());
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_ENEMY_INFO_LIST.writeId(packet);
packet.writeD(_warList.size());
for (ClanWar war : _warList)
{
final Clan clan = war.getOpposingClan(_playerClan);
packet.writeD(clan.getRank());
packet.writeD(clan.getId());
packet.writeString(clan.getName());
packet.writeString(clan.getLeaderName());
}
return true;
}
}

View File

@ -0,0 +1,42 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Written by Berezkin Nikolay, on 08.05.2021
*/
public class ExPledgeLevelUp implements IClientOutgoingPacket
{
private final int _level;
public ExPledgeLevelUp(int level)
{
_level = level;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_LEVEL_UP.writeId(packet);
packet.writeD(_level);
return true;
}
}

View File

@ -0,0 +1,51 @@
/*
* 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.pledgeV3;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Written by Berezkin Nikolay, on 04.05.2021 22 C0 00 00 00 00 00 00 00 00 00
*/
public class ExPledgeV3Info implements IClientOutgoingPacket
{
private final int _points;
private final int _rank;
private final String _announce;
private final boolean _isShowOnEnter;
public ExPledgeV3Info(int points, int rank, String announce, boolean isShowOnEnter)
{
_points = points;
_rank = rank;
_announce = announce;
_isShowOnEnter = isShowOnEnter;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PLEDGE_V3_INFO.writeId(packet);
packet.writeD(_points);
packet.writeD(_rank);
packet.writeString(_announce);
packet.writeC(_isShowOnEnter ? 1 : 0);
return true;
}
}