The client hash (0x5547E0) has no overrides. Hashing the power id SafeMode must give the real power token for 4.8. Source types are now keyed by the effect's own token, which keeps the SafeModeA/B override in EffectsBase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.6 KiB
Java
62 lines
2.6 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
// https://www.magicbane.com
|
|
|
|
|
|
package engine.db.handlers;
|
|
|
|
import engine.gameManager.DbManager;
|
|
import engine.gameManager.PowersManager;
|
|
import engine.mbEnums;
|
|
import engine.objects.Mob;
|
|
import engine.powers.EffectsBase;
|
|
import org.pmw.tinylog.Logger;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.ResultSet;
|
|
import java.util.HashSet;
|
|
|
|
public class dbPowerHandler extends dbHandlerBase {
|
|
|
|
public dbPowerHandler() {
|
|
this.localClass = Mob.class;
|
|
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
|
}
|
|
|
|
public static void addAllSourceTypes() {
|
|
|
|
try (Connection connection = DbManager.getConnection();
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_sourcetype")) {
|
|
|
|
ResultSet rs = preparedStatement.executeQuery();
|
|
String IDString, source;
|
|
EffectsBase effectsBase;
|
|
int token;
|
|
|
|
while (rs.next()) {
|
|
IDString = rs.getString("IDString");
|
|
|
|
// The effect's own token: INVIS-D and SafeMode send the SafeModeB/A action tokens
|
|
effectsBase = PowersManager.getEffectByIDString(IDString);
|
|
token = (effectsBase != null) ? effectsBase.getToken() : DbManager.hasher.SBStringHash(IDString);
|
|
|
|
source = rs.getString("source").replace("-", "").trim();
|
|
mbEnums.EffectSourceType effectSourceType = mbEnums.EffectSourceType.GetEffectSourceType(source);
|
|
|
|
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
|
|
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
|
|
|
|
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
|
|
}
|
|
} catch (Exception e) {
|
|
Logger.error(e);
|
|
}
|
|
}
|
|
|
|
}
|