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

View File

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

View File

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