Rename and clean up MapleAlliance
This commit is contained in:
@@ -45,8 +45,8 @@ import net.server.Server;
|
|||||||
import net.server.audit.locks.MonitoredLockType;
|
import net.server.audit.locks.MonitoredLockType;
|
||||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||||
import net.server.coordinator.world.InviteCoordinator;
|
import net.server.coordinator.world.InviteCoordinator;
|
||||||
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.GuildPackets;
|
import net.server.guild.GuildPackets;
|
||||||
import net.server.guild.MapleAlliance;
|
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.guild.MapleGuildCharacter;
|
import net.server.guild.MapleGuildCharacter;
|
||||||
import net.server.services.task.channel.FaceExpressionService;
|
import net.server.services.task.channel.FaceExpressionService;
|
||||||
@@ -5008,7 +5008,7 @@ public class Character extends AbstractCharacterObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleAlliance getAlliance() {
|
public Alliance getAlliance() {
|
||||||
if (mgc != null) {
|
if (mgc != null) {
|
||||||
try {
|
try {
|
||||||
return Server.getInstance().getAlliance(getGuild().getAllianceId());
|
return Server.getInstance().getAlliance(getGuild().getAllianceId());
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import net.server.audit.locks.factory.MonitoredWriteLockFactory;
|
|||||||
import net.server.channel.Channel;
|
import net.server.channel.Channel;
|
||||||
import net.server.coordinator.session.IpAddresses;
|
import net.server.coordinator.session.IpAddresses;
|
||||||
import net.server.coordinator.session.SessionCoordinator;
|
import net.server.coordinator.session.SessionCoordinator;
|
||||||
import net.server.guild.MapleAlliance;
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.guild.MapleGuildCharacter;
|
import net.server.guild.MapleGuildCharacter;
|
||||||
import net.server.task.*;
|
import net.server.task.*;
|
||||||
@@ -108,7 +108,7 @@ public class Server {
|
|||||||
private final Map<Client, Long> inLoginState = new HashMap<>(100);
|
private final Map<Client, Long> inLoginState = new HashMap<>(100);
|
||||||
|
|
||||||
private final PlayerBuffStorage buffStorage = new PlayerBuffStorage();
|
private final PlayerBuffStorage buffStorage = new PlayerBuffStorage();
|
||||||
private final Map<Integer, MapleAlliance> alliances = new HashMap<>(100);
|
private final Map<Integer, Alliance> alliances = new HashMap<>(100);
|
||||||
private final Map<Integer, NewYearCardRecord> newyears = new HashMap<>();
|
private final Map<Integer, NewYearCardRecord> newyears = new HashMap<>();
|
||||||
private final List<Client> processDiseaseAnnouncePlayers = new LinkedList<>();
|
private final List<Client> processDiseaseAnnouncePlayers = new LinkedList<>();
|
||||||
private final List<Client> registeredDiseaseAnnouncePlayers = new LinkedList<>();
|
private final List<Client> registeredDiseaseAnnouncePlayers = new LinkedList<>();
|
||||||
@@ -963,7 +963,7 @@ public class Server {
|
|||||||
return subnetInfo;
|
return subnetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleAlliance getAlliance(int id) {
|
public Alliance getAlliance(int id) {
|
||||||
synchronized (alliances) {
|
synchronized (alliances) {
|
||||||
if (alliances.containsKey(id)) {
|
if (alliances.containsKey(id)) {
|
||||||
return alliances.get(id);
|
return alliances.get(id);
|
||||||
@@ -972,7 +972,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAlliance(int id, MapleAlliance alliance) {
|
public void addAlliance(int id, Alliance alliance) {
|
||||||
synchronized (alliances) {
|
synchronized (alliances) {
|
||||||
if (!alliances.containsKey(id)) {
|
if (!alliances.containsKey(id)) {
|
||||||
alliances.put(id, alliance);
|
alliances.put(id, alliance);
|
||||||
@@ -982,7 +982,7 @@ public class Server {
|
|||||||
|
|
||||||
public void disbandAlliance(int id) {
|
public void disbandAlliance(int id) {
|
||||||
synchronized (alliances) {
|
synchronized (alliances) {
|
||||||
MapleAlliance alliance = alliances.get(id);
|
Alliance alliance = alliances.get(id);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
for (Integer gid : alliance.getGuilds()) {
|
for (Integer gid : alliance.getGuilds()) {
|
||||||
guilds.get(gid).setAllianceId(0);
|
guilds.get(gid).setAllianceId(0);
|
||||||
@@ -993,7 +993,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void allianceMessage(int id, Packet packet, int exception, int guildex) {
|
public void allianceMessage(int id, Packet packet, int exception, int guildex) {
|
||||||
MapleAlliance alliance = alliances.get(id);
|
Alliance alliance = alliances.get(id);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
for (Integer gid : alliance.getGuilds()) {
|
for (Integer gid : alliance.getGuilds()) {
|
||||||
if (guildex == gid) {
|
if (guildex == gid) {
|
||||||
@@ -1008,7 +1008,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean addGuildtoAlliance(int aId, int guildId) {
|
public boolean addGuildtoAlliance(int aId, int guildId) {
|
||||||
MapleAlliance alliance = alliances.get(aId);
|
Alliance alliance = alliances.get(aId);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
alliance.addGuild(guildId);
|
alliance.addGuild(guildId);
|
||||||
guilds.get(guildId).setAllianceId(aId);
|
guilds.get(guildId).setAllianceId(aId);
|
||||||
@@ -1018,7 +1018,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeGuildFromAlliance(int aId, int guildId) {
|
public boolean removeGuildFromAlliance(int aId, int guildId) {
|
||||||
MapleAlliance alliance = alliances.get(aId);
|
Alliance alliance = alliances.get(aId);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
alliance.removeGuild(guildId);
|
alliance.removeGuild(guildId);
|
||||||
guilds.get(guildId).setAllianceId(0);
|
guilds.get(guildId).setAllianceId(0);
|
||||||
@@ -1028,7 +1028,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setAllianceRanks(int aId, String[] ranks) {
|
public boolean setAllianceRanks(int aId, String[] ranks) {
|
||||||
MapleAlliance alliance = alliances.get(aId);
|
Alliance alliance = alliances.get(aId);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
alliance.setRankTitle(ranks);
|
alliance.setRankTitle(ranks);
|
||||||
return true;
|
return true;
|
||||||
@@ -1037,7 +1037,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setAllianceNotice(int aId, String notice) {
|
public boolean setAllianceNotice(int aId, String notice) {
|
||||||
MapleAlliance alliance = alliances.get(aId);
|
Alliance alliance = alliances.get(aId);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
alliance.setNotice(notice);
|
alliance.setNotice(notice);
|
||||||
return true;
|
return true;
|
||||||
@@ -1046,7 +1046,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean increaseAllianceCapacity(int aId, int inc) {
|
public boolean increaseAllianceCapacity(int aId, int inc) {
|
||||||
MapleAlliance alliance = alliances.get(aId);
|
Alliance alliance = alliances.get(aId);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
alliance.increaseCapacity(inc);
|
alliance.increaseCapacity(inc);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ import client.Client;
|
|||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
import net.packet.InPacket;
|
import net.packet.InPacket;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.GuildPackets;
|
import net.server.guild.GuildPackets;
|
||||||
import net.server.guild.MapleAlliance;
|
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.guild.MapleGuildCharacter;
|
import net.server.guild.MapleGuildCharacter;
|
||||||
import tools.PacketCreator;
|
import tools.PacketCreator;
|
||||||
@@ -40,7 +40,7 @@ public final class AllianceOperationHandler extends AbstractPacketHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void handlePacket(InPacket p, Client c) {
|
public final void handlePacket(InPacket p, Client c) {
|
||||||
MapleAlliance alliance = null;
|
Alliance alliance = null;
|
||||||
Character chr = c.getPlayer();
|
Character chr = c.getPlayer();
|
||||||
|
|
||||||
if (chr.getGuild() == null) {
|
if (chr.getGuild() == null) {
|
||||||
@@ -81,7 +81,7 @@ public final class AllianceOperationHandler extends AbstractPacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapleAlliance.removeGuildFromAlliance(chr.getGuild().getAllianceId(), chr.getGuildId(), chr.getWorld());
|
Alliance.removeGuildFromAlliance(chr.getGuild().getAllianceId(), chr.getGuildId(), chr.getWorld());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x03: // Send Invite
|
case 0x03: // Send Invite
|
||||||
@@ -90,7 +90,7 @@ public final class AllianceOperationHandler extends AbstractPacketHandler {
|
|||||||
if (alliance.getGuilds().size() == alliance.getCapacity()) {
|
if (alliance.getGuilds().size() == alliance.getCapacity()) {
|
||||||
chr.dropMessage(5, "Your alliance cannot comport any more guilds at the moment.");
|
chr.dropMessage(5, "Your alliance cannot comport any more guilds at the moment.");
|
||||||
} else {
|
} else {
|
||||||
MapleAlliance.sendInvitation(c, guildName, alliance.getId());
|
Alliance.sendInvitation(c, guildName, alliance.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -108,7 +108,7 @@ public final class AllianceOperationHandler extends AbstractPacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MapleAlliance.answerInvitation(c.getPlayer().getId(), guild.getName(), alliance.getId(), true)) {
|
if (!Alliance.answerInvitation(c.getPlayer().getId(), guild.getName(), alliance.getId(), true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ public final class AllianceOperationHandler extends AbstractPacketHandler {
|
|||||||
alliance.saveToDB();
|
alliance.saveToDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeLeaderAllianceRank(MapleAlliance alliance, Character newLeader) {
|
private void changeLeaderAllianceRank(Alliance alliance, Character newLeader) {
|
||||||
MapleGuildCharacter lmgc = alliance.getLeader();
|
MapleGuildCharacter lmgc = alliance.getLeader();
|
||||||
Character leader = newLeader.getWorldServer().getPlayerStorage().getCharacterById(lmgc.getId());
|
Character leader = newLeader.getWorldServer().getPlayerStorage().getCharacterById(lmgc.getId());
|
||||||
leader.getMGC().setAllianceRank(2);
|
leader.getMGC().setAllianceRank(2);
|
||||||
@@ -213,7 +213,7 @@ public final class AllianceOperationHandler extends AbstractPacketHandler {
|
|||||||
alliance.dropMessage("'" + newLeader.getName() + "' has been appointed as the new head of this Alliance.");
|
alliance.dropMessage("'" + newLeader.getName() + "' has been appointed as the new head of this Alliance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changePlayerAllianceRank(MapleAlliance alliance, Character chr, boolean raise) {
|
private void changePlayerAllianceRank(Alliance alliance, Character chr, boolean raise) {
|
||||||
int newRank = chr.getAllianceRank() + (raise ? -1 : 1);
|
int newRank = chr.getAllianceRank() + (raise ? -1 : 1);
|
||||||
if(newRank < 3 || newRank > 5) return;
|
if(newRank < 3 || newRank > 5) return;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import client.Character;
|
|||||||
import client.Client;
|
import client.Client;
|
||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
import net.packet.InPacket;
|
import net.packet.InPacket;
|
||||||
import net.server.guild.MapleAlliance;
|
import net.server.guild.Alliance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
@@ -38,9 +38,9 @@ public final class DenyAllianceRequestHandler extends AbstractPacketHandler {
|
|||||||
|
|
||||||
Character chr = c.getWorldServer().getPlayerStorage().getCharacterByName(inviterName);
|
Character chr = c.getWorldServer().getPlayerStorage().getCharacterByName(inviterName);
|
||||||
if (chr != null) {
|
if (chr != null) {
|
||||||
MapleAlliance alliance = chr.getAlliance();
|
Alliance alliance = chr.getAlliance();
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
MapleAlliance.answerInvitation(c.getPlayer().getId(), guildName, alliance.getId(), false);
|
Alliance.answerInvitation(c.getPlayer().getId(), guildName, alliance.getId(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ import net.AbstractPacketHandler;
|
|||||||
import net.packet.InPacket;
|
import net.packet.InPacket;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
||||||
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.GuildPackets;
|
import net.server.guild.GuildPackets;
|
||||||
import net.server.guild.MapleAlliance;
|
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.guild.MapleGuildResponse;
|
import net.server.guild.MapleGuildResponse;
|
||||||
import net.server.world.MapleParty;
|
import net.server.world.MapleParty;
|
||||||
@@ -224,7 +224,7 @@ public final class GuildOperationHandler extends AbstractPacketHandler {
|
|||||||
Server.getInstance().setGuildEmblem(mc.getGuildId(), bg, bgcolor, logo, logocolor);
|
Server.getInstance().setGuildEmblem(mc.getGuildId(), bg, bgcolor, logo, logocolor);
|
||||||
|
|
||||||
if (mc.getGuild() != null && mc.getGuild().getAllianceId() > 0) {
|
if (mc.getGuild() != null && mc.getGuild().getAllianceId() > 0) {
|
||||||
MapleAlliance alliance = mc.getAlliance();
|
Alliance alliance = mc.getAlliance();
|
||||||
Server.getInstance().allianceMessage(alliance.getId(), GuildPackets.getGuildAlliances(alliance, c.getWorld()), -1, -1);
|
Server.getInstance().allianceMessage(alliance.getId(), GuildPackets.getGuildAlliances(alliance, c.getWorld()), -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ import net.server.channel.CharacterIdChannelPair;
|
|||||||
import net.server.coordinator.session.Hwid;
|
import net.server.coordinator.session.Hwid;
|
||||||
import net.server.coordinator.session.SessionCoordinator;
|
import net.server.coordinator.session.SessionCoordinator;
|
||||||
import net.server.coordinator.world.EventRecallCoordinator;
|
import net.server.coordinator.world.EventRecallCoordinator;
|
||||||
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.GuildPackets;
|
import net.server.guild.GuildPackets;
|
||||||
import net.server.guild.MapleAlliance;
|
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.world.MaplePartyCharacter;
|
import net.server.world.MaplePartyCharacter;
|
||||||
import net.server.world.PartyOperation;
|
import net.server.world.PartyOperation;
|
||||||
@@ -280,9 +280,9 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
|||||||
c.sendPacket(GuildPackets.showGuildInfo(player));
|
c.sendPacket(GuildPackets.showGuildInfo(player));
|
||||||
int allianceId = player.getGuild().getAllianceId();
|
int allianceId = player.getGuild().getAllianceId();
|
||||||
if (allianceId > 0) {
|
if (allianceId > 0) {
|
||||||
MapleAlliance newAlliance = server.getAlliance(allianceId);
|
Alliance newAlliance = server.getAlliance(allianceId);
|
||||||
if (newAlliance == null) {
|
if (newAlliance == null) {
|
||||||
newAlliance = MapleAlliance.loadAlliance(allianceId);
|
newAlliance = Alliance.loadAlliance(allianceId);
|
||||||
if (newAlliance != null) {
|
if (newAlliance != null) {
|
||||||
server.addAlliance(allianceId, newAlliance);
|
server.addAlliance(allianceId, newAlliance);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import java.util.List;
|
|||||||
* @author XoticStory
|
* @author XoticStory
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
*/
|
*/
|
||||||
public class MapleAlliance {
|
public class Alliance {
|
||||||
final private List<Integer> guilds = new LinkedList<>();
|
final private List<Integer> guilds = new LinkedList<>();
|
||||||
|
|
||||||
private int allianceId = -1;
|
private int allianceId = -1;
|
||||||
@@ -52,7 +52,7 @@ public class MapleAlliance {
|
|||||||
private String notice = "";
|
private String notice = "";
|
||||||
private String[] rankTitles = new String[5];
|
private String[] rankTitles = new String[5];
|
||||||
|
|
||||||
public MapleAlliance(String name, int id) {
|
public Alliance(String name, int id) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
allianceId = id;
|
allianceId = id;
|
||||||
String[] ranks = {"Master", "Jr. Master", "Member", "Member", "Member"};
|
String[] ranks = {"Master", "Jr. Master", "Member", "Member", "Member"};
|
||||||
@@ -109,7 +109,7 @@ public class MapleAlliance {
|
|||||||
return mcl;
|
return mcl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapleAlliance createAlliance(MapleParty party, String name) {
|
public static Alliance createAlliance(MapleParty party, String name) {
|
||||||
List<Character> guildMasters = getPartyGuildMasters(party);
|
List<Character> guildMasters = getPartyGuildMasters(party);
|
||||||
if (guildMasters.size() != 2) {
|
if (guildMasters.size() != 2) {
|
||||||
return null;
|
return null;
|
||||||
@@ -119,7 +119,7 @@ public class MapleAlliance {
|
|||||||
for (Character mc : guildMasters) {
|
for (Character mc : guildMasters) {
|
||||||
guilds.add(mc.getGuildId());
|
guilds.add(mc.getGuildId());
|
||||||
}
|
}
|
||||||
MapleAlliance alliance = MapleAlliance.createAllianceOnDb(guilds, name);
|
Alliance alliance = Alliance.createAllianceOnDb(guilds, name);
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
alliance.setCapacity(guilds.size());
|
alliance.setCapacity(guilds.size());
|
||||||
for (Integer g : guilds) {
|
for (Integer g : guilds) {
|
||||||
@@ -152,7 +152,7 @@ public class MapleAlliance {
|
|||||||
return alliance;
|
return alliance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapleAlliance createAllianceOnDb(List<Integer> guilds, String name) {
|
public static Alliance createAllianceOnDb(List<Integer> guilds, String name) {
|
||||||
// will create an alliance, where the first guild listed is the leader and the alliance name MUST BE already checked for unicity.
|
// will create an alliance, where the first guild listed is the leader and the alliance name MUST BE already checked for unicity.
|
||||||
|
|
||||||
int id = -1;
|
int id = -1;
|
||||||
@@ -178,14 +178,14 @@ public class MapleAlliance {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MapleAlliance(name, id);
|
return new Alliance(name, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapleAlliance loadAlliance(int id) {
|
public static Alliance loadAlliance(int id) {
|
||||||
if (id <= 0) {
|
if (id <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
MapleAlliance alliance = new MapleAlliance(null, -1);
|
Alliance alliance = new Alliance(null, -1);
|
||||||
try (Connection con = DatabaseConnection.getConnection()) {
|
try (Connection con = DatabaseConnection.getConnection()) {
|
||||||
|
|
||||||
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM alliance WHERE id = ?")) {
|
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM alliance WHERE id = ?")) {
|
||||||
@@ -292,7 +292,7 @@ public class MapleAlliance {
|
|||||||
|
|
||||||
public static boolean removeGuildFromAlliance(int allianceId, int guildId, int worldId) {
|
public static boolean removeGuildFromAlliance(int allianceId, int guildId, int worldId) {
|
||||||
Server srv = Server.getInstance();
|
Server srv = Server.getInstance();
|
||||||
MapleAlliance alliance = srv.getAlliance(allianceId);
|
Alliance alliance = srv.getAlliance(allianceId);
|
||||||
|
|
||||||
if (alliance.getLeader().getGuildId() == guildId) {
|
if (alliance.getLeader().getGuildId() == guildId) {
|
||||||
return false;
|
return false;
|
||||||
@@ -365,7 +365,7 @@ public class GuildPackets {
|
|||||||
p.writeInt(guild.getAllianceId());
|
p.writeInt(guild.getAllianceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet getAllianceInfo(MapleAlliance alliance) {
|
public static Packet getAllianceInfo(Alliance alliance) {
|
||||||
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
||||||
p.writeByte(0x0C);
|
p.writeByte(0x0C);
|
||||||
p.writeByte(1);
|
p.writeByte(1);
|
||||||
@@ -383,7 +383,7 @@ public class GuildPackets {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet updateAllianceInfo(MapleAlliance alliance, int world) {
|
public static Packet updateAllianceInfo(Alliance alliance, int world) {
|
||||||
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
||||||
p.writeByte(0x0F);
|
p.writeByte(0x0F);
|
||||||
p.writeInt(alliance.getId());
|
p.writeInt(alliance.getId());
|
||||||
@@ -403,7 +403,7 @@ public class GuildPackets {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet getGuildAlliances(MapleAlliance alliance, int worldId) {
|
public static Packet getGuildAlliances(Alliance alliance, int worldId) {
|
||||||
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
||||||
p.writeByte(0x0D);
|
p.writeByte(0x0D);
|
||||||
p.writeInt(alliance.getGuilds().size());
|
p.writeInt(alliance.getGuilds().size());
|
||||||
@@ -413,7 +413,7 @@ public class GuildPackets {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet addGuildToAlliance(MapleAlliance alliance, int newGuild, Client c) {
|
public static Packet addGuildToAlliance(Alliance alliance, int newGuild, Client c) {
|
||||||
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
||||||
p.writeByte(0x12);
|
p.writeByte(0x12);
|
||||||
p.writeInt(alliance.getId());
|
p.writeInt(alliance.getId());
|
||||||
@@ -471,7 +471,7 @@ public class GuildPackets {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Packet removeGuildFromAlliance(MapleAlliance alliance, int expelledGuild, int worldId) {
|
public static Packet removeGuildFromAlliance(Alliance alliance, int expelledGuild, int worldId) {
|
||||||
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
OutPacket p = OutPacket.create(SendOpcode.ALLIANCE_OPERATION);
|
||||||
p.writeByte(0x10);
|
p.writeByte(0x10);
|
||||||
p.writeInt(alliance.getId());
|
p.writeInt(alliance.getId());
|
||||||
|
|||||||
@@ -634,8 +634,8 @@ public class MapleGuild {
|
|||||||
|
|
||||||
public void disbandGuild() {
|
public void disbandGuild() {
|
||||||
if (allianceId > 0) {
|
if (allianceId > 0) {
|
||||||
if (!MapleAlliance.removeGuildFromAlliance(allianceId, id, world)) {
|
if (!Alliance.removeGuildFromAlliance(allianceId, id, world)) {
|
||||||
MapleAlliance.disbandAlliance(allianceId);
|
Alliance.disbandAlliance(allianceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ import constants.string.LanguageConstants;
|
|||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
import net.server.channel.Channel;
|
import net.server.channel.Channel;
|
||||||
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
||||||
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.GuildPackets;
|
import net.server.guild.GuildPackets;
|
||||||
import net.server.guild.MapleAlliance;
|
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.world.MapleParty;
|
import net.server.world.MapleParty;
|
||||||
import net.server.world.MaplePartyCharacter;
|
import net.server.world.MaplePartyCharacter;
|
||||||
@@ -417,7 +417,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void upgradeAlliance() {
|
public void upgradeAlliance() {
|
||||||
MapleAlliance alliance = Server.getInstance().getAlliance(c.getPlayer().getGuild().getAllianceId());
|
Alliance alliance = Server.getInstance().getAlliance(c.getPlayer().getGuild().getAllianceId());
|
||||||
alliance.increaseCapacity(1);
|
alliance.increaseCapacity(1);
|
||||||
|
|
||||||
Server.getInstance().allianceMessage(alliance.getId(), GuildPackets.getGuildAlliances(alliance, c.getWorld()), -1, -1);
|
Server.getInstance().allianceMessage(alliance.getId(), GuildPackets.getGuildAlliances(alliance, c.getWorld()), -1, -1);
|
||||||
@@ -427,15 +427,15 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void disbandAlliance(Client c, int allianceId) {
|
public void disbandAlliance(Client c, int allianceId) {
|
||||||
MapleAlliance.disbandAlliance(allianceId);
|
Alliance.disbandAlliance(allianceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBeUsedAllianceName(String name) {
|
public boolean canBeUsedAllianceName(String name) {
|
||||||
return MapleAlliance.canBeUsedAllianceName(name);
|
return Alliance.canBeUsedAllianceName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleAlliance createAlliance(String name) {
|
public Alliance createAlliance(String name) {
|
||||||
return MapleAlliance.createAlliance(getParty(), name);
|
return Alliance.createAlliance(getParty(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAllianceCapacity() {
|
public int getAllianceCapacity() {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import net.server.channel.Channel;
|
|||||||
import net.server.channel.handlers.PlayerInteractionHandler;
|
import net.server.channel.handlers.PlayerInteractionHandler;
|
||||||
import net.server.channel.handlers.SummonDamageHandler.SummonAttackEntry;
|
import net.server.channel.handlers.SummonDamageHandler.SummonAttackEntry;
|
||||||
import net.server.channel.handlers.WhisperHandler;
|
import net.server.channel.handlers.WhisperHandler;
|
||||||
import net.server.guild.MapleAlliance;
|
import net.server.guild.Alliance;
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.guild.MapleGuildSummary;
|
import net.server.guild.MapleGuildSummary;
|
||||||
import net.server.world.MapleParty;
|
import net.server.world.MapleParty;
|
||||||
@@ -2685,7 +2685,7 @@ public class PacketCreator {
|
|||||||
MapleGuild mg = Server.getInstance().getGuild(chr.getGuildId());
|
MapleGuild mg = Server.getInstance().getGuild(chr.getGuildId());
|
||||||
guildName = mg.getName();
|
guildName = mg.getName();
|
||||||
|
|
||||||
MapleAlliance alliance = Server.getInstance().getAlliance(chr.getGuild().getAllianceId());
|
Alliance alliance = Server.getInstance().getAlliance(chr.getGuild().getAllianceId());
|
||||||
if (alliance != null) {
|
if (alliance != null) {
|
||||||
allianceName = alliance.getName();
|
allianceName = alliance.getName();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user