Skip to content

Commit

Permalink
Fixed GM tool legion view
Browse files Browse the repository at this point in the history
  • Loading branch information
neon-dev committed Jun 26, 2024
1 parent 68a5091 commit 9c6cc2e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
15 changes: 5 additions & 10 deletions game-server/data/handlers/consolecommands/Guild.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.aionemu.gameserver.model.team.legion.Legion;
import com.aionemu.gameserver.model.team.legion.LegionMemberEx;
import com.aionemu.gameserver.network.aion.serverpackets.SM_GM_SHOW_LEGION_INFO;
import com.aionemu.gameserver.network.aion.serverpackets.SM_LEGION_MEMBERLIST;
import com.aionemu.gameserver.network.aion.serverpackets.SM_GM_SHOW_LEGION_MEMBERLIST;
import com.aionemu.gameserver.services.LegionService;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.chathandlers.ConsoleCommand;
Expand All @@ -15,30 +15,25 @@
import com.aionemu.gameserver.world.World;

/**
* @author Yeats.
* @author Yeats
*/
public class Guild extends ConsoleCommand {

public Guild() {
super("guild");
super("guild", "Displays info about given player's legion.");
}

@Override
protected void execute(Player admin, String... params) {

Player target = null;
if (params.length > 0)
target = World.getInstance().getPlayer(params[0]);
if (target == null && admin.getTarget() instanceof Player player)
target = player;
Player target = params.length > 0 ? World.getInstance().getPlayer(params[0]) : null;
if (target != null) {
Legion legion = target.getLegion();
if (target.getLegion() != null) {
PacketSendUtility.sendPacket(admin, new SM_GM_SHOW_LEGION_INFO(legion));
List<LegionMemberEx> allMembers = LegionService.getInstance().loadLegionMemberExList(legion, null);
SplitList<LegionMemberEx> legionMemberSplitList = new FixedElementCountSplitList<>(allMembers, true, 80);
legionMemberSplitList.forEach(part -> PacketSendUtility.sendPacket(admin,
new SM_LEGION_MEMBERLIST(part, part.isFirst(), part.isLast())));
new SM_GM_SHOW_LEGION_MEMBERLIST(part, part.isFirst(), part.isLast())));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@
import java.util.List;

import com.aionemu.gameserver.model.team.legion.LegionMemberEx;
import com.aionemu.gameserver.services.player.PlayerService;

/**
* @author Yeats.
* @author Yeats
*/
public class SM_GM_SHOW_LEGION_MEMBERLIST extends SM_LEGION_MEMBERLIST {

public SM_GM_SHOW_LEGION_MEMBERLIST(List<LegionMemberEx> legionMembers, boolean isFirst, boolean isLast) {
super(legionMembers, isFirst, isLast);
}

@Override
protected void writeLegionMember(LegionMemberEx legionMember) {
writeD(legionMember.getObjectId());
writeS(legionMember.getName());
writeC(legionMember.getPlayerClass().getClassId());
writeC(PlayerService.getOrLoadPlayerCommonData(legionMember.getObjectId()).getGender().getGenderId());
writeD(legionMember.getLevel());
writeC(legionMember.getRank().getRankId());
writeD(legionMember.getWorldId());
writeC(legionMember.isOnline() ? 1 : 0);
writeS(legionMember.getSelfIntro());
writeS(legionMember.getNickname());
writeD(legionMember.isOnline() ? 0 : legionMember.getLastOnlineEpochSeconds());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,24 @@ protected void writeImpl(AionConnection con) {
int size = legionMembers.size();
writeC(isFirst ? 1 : 0);
writeH(isLast ? -size : size);
for (LegionMemberEx legionMember : legionMembers) {
writeD(legionMember.getObjectId());
writeS(legionMember.getName());
writeC(legionMember.getPlayerClass().getClassId());
writeD(legionMember.getLevel());
writeC(legionMember.getRank().getRankId());
writeD(legionMember.getWorldId());
writeC(legionMember.isOnline() ? 1 : 0);
writeS(legionMember.getSelfIntro());
writeS(legionMember.getNickname());
writeD(legionMember.isOnline() ? 0 : legionMember.getLastOnlineEpochSeconds());
for (LegionMemberEx legionMember : legionMembers)
writeLegionMember(legionMember);
}

House house = HousingService.getInstance().findActiveHouse(legionMember.getObjectId());
writeD(house == null ? 0 : house.getAddress().getId());
writeD(house == null ? 0 : house.getDoorState().getId());
writeD(NetworkConfig.GAMESERVER_ID); // TODO: add to account model? displays server number for each away player in region field
}
protected void writeLegionMember(LegionMemberEx legionMember) {
writeD(legionMember.getObjectId());
writeS(legionMember.getName());
writeC(legionMember.getPlayerClass().getClassId());
writeD(legionMember.getLevel());
writeC(legionMember.getRank().getRankId());
writeD(legionMember.getWorldId());
writeC(legionMember.isOnline() ? 1 : 0);
writeS(legionMember.getSelfIntro());
writeS(legionMember.getNickname());
writeD(legionMember.isOnline() ? 0 : legionMember.getLastOnlineEpochSeconds());
House house = HousingService.getInstance().findActiveHouse(legionMember.getObjectId());
writeD(house == null ? 0 : house.getAddress().getId());
writeD(house == null ? 0 : house.getDoorState().getId());
writeD(NetworkConfig.GAMESERVER_ID); // displays server number for each away player in region field
}
}

0 comments on commit 9c6cc2e

Please sign in to comment.