Rename and clean up MapleGuildResponse

This commit is contained in:
P0nk
2021-09-09 21:35:34 +02:00
parent 803911c10f
commit f8b5f713f3
3 changed files with 12 additions and 12 deletions

View File

@@ -32,7 +32,7 @@ import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchChec
import net.server.guild.Alliance;
import net.server.guild.Guild;
import net.server.guild.GuildPackets;
import net.server.guild.MapleGuildResponse;
import net.server.guild.GuildResponse;
import net.server.world.MapleParty;
import net.server.world.World;
import tools.PacketCreator;
@@ -108,7 +108,7 @@ public final class GuildOperationHandler extends AbstractPacketHandler {
}
String targetName = p.readString();
MapleGuildResponse mgr = Guild.sendInvitation(c, targetName);
GuildResponse mgr = Guild.sendInvitation(c, targetName);
if (mgr != null) {
c.sendPacket(mgr.getPacket(targetName));
} else {} // already sent invitation, do nothing

View File

@@ -707,13 +707,13 @@ public class Guild {
this.guildMessage(GuildPackets.updateGP(this.id, this.gp));
}
public static MapleGuildResponse sendInvitation(Client c, String targetName) {
public static GuildResponse sendInvitation(Client c, String targetName) {
Character mc = c.getChannelServer().getPlayerStorage().getCharacterByName(targetName);
if (mc == null) {
return MapleGuildResponse.NOT_IN_CHANNEL;
return GuildResponse.NOT_IN_CHANNEL;
}
if (mc.getGuildId() > 0) {
return MapleGuildResponse.ALREADY_IN_GUILD;
return GuildResponse.ALREADY_IN_GUILD;
}
Character sender = c.getPlayer();
@@ -721,25 +721,25 @@ public class Guild {
mc.sendPacket(GuildPackets.guildInvite(sender.getGuildId(), sender.getName()));
return null;
} else {
return MapleGuildResponse.MANAGING_INVITE;
return GuildResponse.MANAGING_INVITE;
}
}
public static boolean answerInvitation(int targetId, String targetName, int guildId, boolean answer) {
MapleInviteResult res = InviteCoordinator.answerInvite(InviteType.GUILD, targetId, guildId, answer);
MapleGuildResponse mgr;
GuildResponse mgr;
Character sender = res.from;
switch (res.result) {
case ACCEPTED:
return true;
case DENIED:
mgr = MapleGuildResponse.DENIED_INVITE;
mgr = GuildResponse.DENIED_INVITE;
break;
default:
mgr = MapleGuildResponse.NOT_FOUND_INVITE;
mgr = GuildResponse.NOT_FOUND_INVITE;
}
if (mgr != null && sender != null) {

View File

@@ -23,17 +23,17 @@ package net.server.guild;
import net.packet.Packet;
public enum MapleGuildResponse {
public enum GuildResponse {
NOT_IN_CHANNEL(0x2a),
ALREADY_IN_GUILD(0x28),
NOT_IN_GUILD(0x2d),
NOT_FOUND_INVITE(0x2e),
MANAGING_INVITE(0x36),
DENIED_INVITE(0x37);
private final int value;
MapleGuildResponse(int val) {
GuildResponse(int val) {
value = val;
}