Browse Source

Charter template id is stored not ordinal

combat-2
MagicBot 7 months ago
parent
commit
3c4d8239db
  1. 2
      src/engine/db/archive/GuildRecord.java
  2. 4
      src/engine/db/handlers/dbGuildHandler.java
  3. 6
      src/engine/gameManager/ChatManager.java
  4. 5
      src/engine/net/client/handlers/ChangeGuildLeaderHandler.java
  5. 4
      src/engine/net/client/handlers/ChangeRankHandler.java
  6. 2
      src/engine/net/client/handlers/GuildCreationFinalizeHandler.java
  7. 4
      src/engine/net/client/handlers/InviteToGuildHandler.java
  8. 2
      src/engine/net/client/msg/WhoResponseMsg.java
  9. 4
      src/engine/net/client/msg/guild/GuildInfoMsg.java
  10. 4
      src/engine/net/client/msg/guild/GuildListMsg.java
  11. 2
      src/engine/objects/City.java
  12. 16
      src/engine/objects/Guild.java

2
src/engine/db/archive/GuildRecord.java

@ -89,7 +89,7 @@ public class GuildRecord extends DataRecord { @@ -89,7 +89,7 @@ public class GuildRecord extends DataRecord {
guildRecord.guildHash = guildRecord.guild.getHash();
guildRecord.guildID = guildRecord.guild.getObjectUUID();
guildRecord.guildName = guildRecord.guild.getName();
mbEnums.GuildCharterType guildCharterType = mbEnums.GuildCharterType.getGuildTypeFromInt(guildRecord.guild.getCharter());
mbEnums.GuildCharterType guildCharterType = guild.charter;
guildRecord.charterName = guildCharterType.name;
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());

4
src/engine/db/handlers/dbGuildHandler.java

@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase { @@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase {
preparedStatement.setInt(6, guildTag.symbolColor);
preparedStatement.setInt(7, guildTag.backgroundDesign);
preparedStatement.setInt(8, guildTag.symbol);
preparedStatement.setInt(9, g.getCharter());
preparedStatement.setInt(9, g.charter.templateID);
preparedStatement.setString(10, g.getLeadershipType());
preparedStatement.setString(11, g.getMotto());
@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase { @@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase {
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
preparedStatement.setInt(6, g.getGuildTag().symbol);
preparedStatement.setInt(7, g.getCharter());
preparedStatement.setInt(7, g.charter.templateID);
preparedStatement.setString(8, g.getMOTD());
preparedStatement.setString(9, g.getICMOTD());
preparedStatement.setString(10, "");

6
src/engine/gameManager/ChatManager.java

@ -339,8 +339,8 @@ public enum ChatManager { @@ -339,8 +339,8 @@ public enum ChatManager {
chatGuildMsg.setSourceID(sender.getObjectUUID());
chatGuildMsg.setSourceName(sender.getFirstName());
chatGuildMsg.setUnknown03(WorldServer.worldMapID); // Server ID
chatGuildMsg.setUnknown04(sender.getGuild() != null ? sender.getGuild()
.getCharter() : 0); // Charter?
Guild guild1 = sender.getGuild();
chatGuildMsg.setUnknown04(sender.getGuild() != null ? guild1.charter.ordinal() : 0); // Charter?
chatGuildMsg.setUnknown05(GuildStatusController.getTitle(sender.getGuildStatus())); // Title?
chatGuildMsg.setUnknown06(sender.race.getRaceType().getCharacterSex().equals(mbEnums.CharacterSex.MALE) ? 1 : 2); // isMale?, seen 1 and 2
@ -490,7 +490,7 @@ public enum ChatManager { @@ -490,7 +490,7 @@ public enum ChatManager {
msg.setName(sender.getFirstName());
msg.setGuildTitle(GuildStatusController.getTitle(sender.getGuildStatus()));
msg.setGuildUUID(guild.getObjectUUID());
msg.setCharter(guild.getCharter());
msg.setCharter(guild.charter.ordinal());
// Send dispatch to each player

5
src/engine/net/client/handlers/ChangeGuildLeaderHandler.java

@ -67,18 +67,13 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler { @@ -67,18 +67,13 @@ public class ChangeGuildLeaderHandler extends AbstractClientMsgHandler {
if (!Guild.sameGuild(sourcePlayer.getGuild(), targetPlayer.getGuild()))
return false;
//updateSource will generate a new promote/demote screen for sourcePlayer
//updateTarget will sync guild info for the target and all players in range
String targetName = null;
boolean isMale = true;
boolean updateTarget;
mbEnums.GuildCharterType t = mbEnums.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
if (!DbManager.GuildQueries.SET_GUILD_LEADER(targetPlayer.getObjectUUID(), glGuild.getObjectUUID())) {
ChatManager.chatGuildError(sourcePlayer, "Failed to change guild leader!");
return false;

4
src/engine/net/client/handlers/ChangeRankHandler.java

@ -21,6 +21,7 @@ import engine.net.client.msg.ClientNetMsg; @@ -21,6 +21,7 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.guild.ChangeRankMsg;
import engine.net.client.msg.guild.GuildInfoMsg;
import engine.net.client.msg.guild.GuildListMsg;
import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter;
@ -60,7 +61,8 @@ public class ChangeRankHandler extends AbstractClientMsgHandler { @@ -60,7 +61,8 @@ public class ChangeRankHandler extends AbstractClientMsgHandler {
boolean isMale;
if (msg.getPreviousRank() != msg.getNewRank()) {
mbEnums.GuildCharterType t = mbEnums.GuildCharterType.getGuildTypeFromInt(sourcePlayer.getGuild().getCharter());
Guild guild = sourcePlayer.getGuild();
mbEnums.GuildCharterType t = mbEnums.GuildCharterType.getGuildTypeFromInt(guild.charter.ordinal());
if (targetPlayer != null) {
targetPlayer.setGuildTitle(msg.getNewRank());

2
src/engine/net/client/handlers/GuildCreationFinalizeHandler.java

@ -96,7 +96,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler { @@ -96,7 +96,7 @@ public class GuildCreationFinalizeHandler extends AbstractClientMsgHandler {
int leadershipType = ((msg.getICVoteFlag() << 1) | msg.getMemberVoteFlag());
newGuild = new Guild(msg.getName(), null, charterType.ordinal(),
newGuild = new Guild(msg.getName(), null, charterType,
charterType.getLeadershipType(leadershipType), msg.getGuildTag(),
StringUtils.truncate(msg.getMotto(), 120));

4
src/engine/net/client/handlers/InviteToGuildHandler.java

@ -23,6 +23,7 @@ import engine.net.client.ClientConnection; @@ -23,6 +23,7 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.ErrorPopupMsg;
import engine.net.client.msg.guild.InviteToGuildMsg;
import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter;
@ -85,7 +86,8 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { @@ -85,7 +86,8 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
return true;
}
mbEnums.GuildCharterType guildCharterType = mbEnums.GuildCharterType.values()[sourcePlayer.getGuild().getCharter()];
Guild guild = sourcePlayer.getGuild();
mbEnums.GuildCharterType guildCharterType = guild.charter;
if (guildCharterType == null) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, GuildManager.NO_CHARTER_FOUND);

2
src/engine/net/client/msg/WhoResponseMsg.java

@ -243,7 +243,7 @@ public class WhoResponseMsg extends ClientNetMsg { @@ -243,7 +243,7 @@ public class WhoResponseMsg extends ClientNetMsg {
writer.put((byte) 1); // Send Guild Info
writer.put((byte) 1); // SkipPartTwo
writer.putString(guild.getName());
writer.putInt(guild.getCharter()); // Charter Type
writer.putInt(guild.charter.ordinal()); // Charter Type
writer.putInt(GuildStatusController.getTitle(pc.getGuildStatus()));
writer.putString("what"); // City?, Skip if SkipPartTwo = 0x00
} else {

4
src/engine/net/client/msg/guild/GuildInfoMsg.java

@ -289,7 +289,7 @@ class GuildInfoMessageType4 extends GuildInfoMessageType { @@ -289,7 +289,7 @@ class GuildInfoMessageType4 extends GuildInfoMessageType {
writer.putString(nation.getName());
writer.putInt(GuildStatusController.getRank(pc.getGuildStatus()));
writer.putInt(GuildStatusController.getTitle(pc.getGuildStatus()));
writer.putInt(g.getCharter());
writer.putInt(g.charter.ordinal());
writer.putString(cityName); //Shows City Name FUCK
AbstractCharacter guildLeader;
String guildLeaderName = "";
@ -392,7 +392,7 @@ class GuildInfoMessageType5 extends GuildInfoMessageType { @@ -392,7 +392,7 @@ class GuildInfoMessageType5 extends GuildInfoMessageType {
writer.putInt(GuildStatusController.getRank(pc.getGuildStatus())); //Rank
writer.putInt(GuildStatusController.getTitle(pc.getGuildStatus())); //Title
writer.putInt(g.getCharter());
writer.putInt(g.charter.ordinal());
if (g.getNation().equals(Guild.getErrantNation()))
writer.putString("Errant");

4
src/engine/net/client/msg/guild/GuildListMsg.java

@ -125,7 +125,7 @@ class GuildListMessageType1 extends GuildListMessageType { @@ -125,7 +125,7 @@ class GuildListMessageType1 extends GuildListMessageType {
@Override
void _serialize(ByteBufferWriter writer) {
mbEnums.GuildCharterType gt = mbEnums.GuildCharterType.getGuildTypeFromInt(g.getCharter());
mbEnums.GuildCharterType gt = g.charter;
writer.putInt(1);
writer.putInt(gt.ordinal()); //Charter Type
@ -209,7 +209,7 @@ class GuildListMessageType2 extends GuildListMessageType { @@ -209,7 +209,7 @@ class GuildListMessageType2 extends GuildListMessageType {
writer.putInt(2); //PAD
writer.putInt(pc.getLevel());
writer.putInt(g.getCharter());
writer.putInt(g.charter.ordinal());
//TODO Get Guild History from the DB
//ArrayList<GuildHistory> history = DbManager.GuildQueries.GET_GUILD_HISTORY_OF_PLAYER((int)pc.getPlayerUUID());

2
src/engine/objects/City.java

@ -205,7 +205,7 @@ public class City extends AbstractWorldObject { @@ -205,7 +205,7 @@ public class City extends AbstractWorldObject {
else
writer.putString(guildRuler.getFirstName() + ' ' + guildRuler.getLastName());
writer.putInt(rulingGuild.getCharter());
writer.putInt(rulingGuild.charter.ordinal());
writer.putInt(0); // always 00000000
writer.put(city.isSafeHold);

16
src/engine/objects/Guild.java

@ -38,7 +38,7 @@ public class Guild extends AbstractWorldObject { @@ -38,7 +38,7 @@ public class Guild extends AbstractWorldObject {
private static Guild errantNation;
private final String name;
private final GuildTag guildTag;
private final int charter;
public final GuildCharterType charter;
private final String leadershipType; // Have to see how this is sent to the client
private final int repledgeMin;
private final int repledgeMax;
@ -71,7 +71,7 @@ public class Guild extends AbstractWorldObject { @@ -71,7 +71,7 @@ public class Guild extends AbstractWorldObject {
/**
* No Id Constructor
*/
public Guild(String name, Guild nat, int charter,
public Guild(String name, Guild nat, GuildCharterType charter,
String leadershipType, GuildTag gt, String motto) {
super();
this.name = name;
@ -100,7 +100,7 @@ public class Guild extends AbstractWorldObject { @@ -100,7 +100,7 @@ public class Guild extends AbstractWorldObject {
/**
* Normal Constructor
*/
public Guild(String name, Guild nat, int charter,
public Guild(String name, Guild nat, GuildCharterType charter,
String leadershipType, GuildTag gt, int newUUID) {
super(newUUID);
this.name = name;
@ -134,7 +134,7 @@ public class Guild extends AbstractWorldObject { @@ -134,7 +134,7 @@ public class Guild extends AbstractWorldObject {
DbObjectType objectType;
this.name = rs.getString("name");
this.charter = rs.getInt("charter");
this.charter = GuildCharterType.templateLookup.get(rs.getInt("charter"));
this.leadershipType = rs.getString("leadershipType");
this.guildTag = new GuildTag(rs.getInt("backgroundColor01"),
@ -311,7 +311,7 @@ public class Guild extends AbstractWorldObject { @@ -311,7 +311,7 @@ public class Guild extends AbstractWorldObject {
public static Guild getErrantGuild() {
if (Guild.errantGuild == null)
Guild.errantGuild = new Guild("None", Guild.getErrantNation(), 0,
Guild.errantGuild = new Guild("None", Guild.getErrantNation(), GuildCharterType.NONE,
"Anarchy", GuildTag.ERRANT, 0);
return Guild.errantGuild;
@ -319,7 +319,7 @@ public class Guild extends AbstractWorldObject { @@ -319,7 +319,7 @@ public class Guild extends AbstractWorldObject {
public static Guild getErrantNation() {
if (Guild.errantNation == null)
Guild.errantNation = new Guild("None", null, 10, "Despot Rule", GuildTag.ERRANT, 0);
Guild.errantNation = new Guild("None", null, GuildCharterType.NONE, "Despot Rule", GuildTag.ERRANT, 0);
return Guild.errantNation;
}
@ -456,10 +456,6 @@ public class Guild extends AbstractWorldObject { @@ -456,10 +456,6 @@ public class Guild extends AbstractWorldObject {
return this.guildTag;
}
public int getCharter() {
return charter;
}
/*
* Utils
*/

Loading…
Cancel
Save