Compare commits
255
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a6a131bbf | ||
|
|
3909ddb3ba | ||
|
|
dbc26b8243 | ||
|
|
93a4acb108 | ||
|
|
9c1c4e02a9 | ||
|
|
00aa06c5f1 | ||
|
|
f3578f82e6 | ||
|
|
85ee1faf4a | ||
|
|
b72c8e8ce3 | ||
|
|
77a89b8f8a | ||
|
|
a9a9b6a8ac | ||
|
|
fab77a0dbb | ||
|
|
e83e0def2e | ||
|
|
ebcc721d43 | ||
|
|
ff6d236ea7 | ||
|
|
41a9c19001 | ||
|
|
187ef18ac2 | ||
|
|
93304e3eb7 | ||
|
|
b1f14c4beb | ||
|
|
1b2c073886 | ||
|
|
f20a5bb881 | ||
|
|
394ba5a165 | ||
|
|
c35e689d1b | ||
|
|
a9b6fcb9ee | ||
|
|
8eeb539f16 | ||
|
|
a863902370 | ||
|
|
12f8139d1e | ||
|
|
4f25e7e24f | ||
|
|
5860a263d9 | ||
|
|
1460ddb975 | ||
|
|
5326126dcb | ||
|
|
e6a8cdd5e2 | ||
|
|
0dc8eeee90 | ||
|
|
e719d13c8c | ||
|
|
9ee2592ec7 | ||
|
|
720b97dc69 | ||
|
|
177917a8c8 | ||
|
|
a1323e5d17 | ||
|
|
760b2c3df1 | ||
|
|
31f8b5a294 | ||
|
|
3498cc370f | ||
|
|
66dd7b5f90 | ||
|
|
5cc979e2f3 | ||
|
|
1bcf307f94 | ||
|
|
cdf67f4ce5 | ||
|
|
67f2dce2fd | ||
|
|
162f28d874 | ||
|
|
c6ab1b5468 | ||
|
|
d17db3a1fd | ||
|
|
9428436883 | ||
|
|
62dfb8a42e | ||
|
|
c6647a99b8 | ||
|
|
a11797c5e4 | ||
|
|
84a124bb52 | ||
|
|
b296742de0 | ||
|
|
c0560ece47 | ||
|
|
89fd647870 | ||
|
|
07da5cb77c | ||
|
|
aaf84d13f8 | ||
|
|
fd1bb0def7 | ||
|
|
3223eae7b6 | ||
|
|
d836f80805 | ||
|
|
1a6dcf3f57 | ||
|
|
dce48f3d66 | ||
|
|
10d98f32b6 | ||
|
|
acdf6db91a | ||
|
|
0ee7269c8f | ||
|
|
4b888b3d92 | ||
|
|
f0ed15baf0 | ||
|
|
6c882a7788 | ||
|
|
11e03e0051 | ||
|
|
6e47b80d23 | ||
|
|
a3d3c32b07 | ||
|
|
3a27f2f4c8 | ||
|
|
1638804f1f | ||
|
|
362958c0f1 | ||
|
|
74720956a1 | ||
|
|
58e1f4d70b | ||
|
|
c871c253b1 | ||
|
|
547b101c60 | ||
|
|
b9ccbe219f | ||
|
|
c31409d26f | ||
|
|
00d6e4f819 | ||
|
|
dc9f33dc7b | ||
|
|
3d45f26611 | ||
|
|
8554bad731 | ||
|
|
b2a8fe357e | ||
|
|
08ac0b8d8d | ||
|
|
23bf491d4b | ||
|
|
76d22abd0b | ||
|
|
e4e8086e41 | ||
|
|
63116551bc | ||
|
|
d06ce44bd5 | ||
|
|
387f75766f | ||
|
|
2a18b96d23 | ||
|
|
bf2174fbe5 | ||
|
|
462f6725b6 | ||
|
|
ed09bffc87 | ||
|
|
218de2bb70 | ||
|
|
c90961b691 | ||
|
|
1b5b904a8f | ||
|
|
ed219efb92 | ||
|
|
4d704d3ab0 | ||
|
|
11076ff586 | ||
|
|
6b22e624f6 | ||
|
|
a81f90238b | ||
|
|
e7c2e827b9 | ||
|
|
82aa2f9b77 | ||
|
|
d9cc2d2a56 | ||
|
|
28e3769d1e | ||
|
|
e092d764bd | ||
|
|
27c0a852e9 | ||
|
|
bf6ad69d4c | ||
|
|
0b4b270d2f | ||
|
|
4b63493b73 | ||
|
|
9b6c8af171 | ||
|
|
4c7421cd62 | ||
|
|
7662069100 | ||
|
|
adb10e34f3 | ||
|
|
bd0d814142 | ||
|
|
06364a2b9e | ||
|
|
afb6d3e8a3 | ||
|
|
a48ff5851c | ||
|
|
ede21f8d54 | ||
|
|
d08190cbff | ||
|
|
cd50ca4309 | ||
|
|
97c118ae1a | ||
|
|
8878f07628 | ||
|
|
dee30d8121 | ||
|
|
5087465ecb | ||
|
|
39844251b0 | ||
|
|
8c983eadff | ||
|
|
7efe5209aa | ||
|
|
95cf5fa209 | ||
|
|
adde3fc3a8 | ||
|
|
b7089e88d3 | ||
|
|
da63d9d926 | ||
|
|
c8a5224c75 | ||
|
|
d4618ae4b9 | ||
|
|
0591b9d41f | ||
|
|
52c5f51613 | ||
|
|
f8b9c97730 | ||
|
|
c7fa537cfb | ||
|
|
e0e8296339 | ||
|
|
e677ca9f33 | ||
|
|
c19f6df690 | ||
|
|
3ed7f7c3fb | ||
|
|
6b10374adb | ||
|
|
0a65ea61e7 | ||
|
|
6500659c1f | ||
|
|
480887a78f | ||
|
|
05ac2d0a90 | ||
|
|
bbac9ce6b9 | ||
|
|
5b9866f704 | ||
|
|
4a6e4d2a85 | ||
|
|
b7ef3de527 | ||
|
|
4bfb866abe | ||
|
|
23d2b595d9 | ||
|
|
7d30fd2b96 | ||
|
|
93d5976c1e | ||
|
|
260bc453d1 | ||
|
|
5a619db9bd | ||
|
|
d622406912 | ||
|
|
a5e2b69ae3 | ||
|
|
56686944af | ||
|
|
aa957f41af | ||
|
|
9336305334 | ||
|
|
bc9c5224d0 | ||
|
|
eda27b2e9c | ||
|
|
c5d6b382f8 | ||
|
|
ae0d182e2e | ||
|
|
ad78d152f7 | ||
|
|
000ccdaf0a | ||
|
|
57249727de | ||
|
|
d6c49d0793 | ||
|
|
2fa58c4f38 | ||
|
|
c361c2a78a | ||
|
|
4d862355be | ||
|
|
52028e0e97 | ||
|
|
3e4e13a8ae | ||
|
|
0ceea002d5 | ||
|
|
7d8f4049b9 | ||
|
|
dbefaa7ead | ||
|
|
9c1ec1069f | ||
|
|
f36c980eb9 | ||
|
|
cb1a7f014d | ||
|
|
e729bc9541 | ||
|
|
c97a6f555a | ||
|
|
95a104e397 | ||
|
|
e7ad83cc60 | ||
|
|
821b7264ec | ||
|
|
0bf3456119 | ||
|
|
ff7bd7a699 | ||
|
|
a028bebafd | ||
|
|
789d9a3bb6 | ||
|
|
8e19b66a9b | ||
|
|
975845375f | ||
|
|
74b37063bf | ||
|
|
c2fee2290d | ||
|
|
f7c8c44ebb | ||
|
|
91b2ff6e62 | ||
|
|
8293f552b1 | ||
|
|
a84336fc31 | ||
|
|
3951114eb7 | ||
|
|
f24877e9ce | ||
|
|
b81b83570a | ||
|
|
2417073a4d | ||
|
|
ebc0b7a89e | ||
|
|
3d6bfcf48f | ||
|
|
a5864b74f8 | ||
|
|
de8896ff4e | ||
|
|
e579912733 | ||
|
|
c7b4404c36 | ||
|
|
f1de7d413a | ||
|
|
cc6f5f5f25 | ||
|
|
19bf75ade8 | ||
|
|
73eacc3779 | ||
|
|
69f3504ee9 | ||
|
|
bd89b5e975 | ||
|
|
186eea3099 | ||
|
|
5e0badef17 | ||
|
|
ea24d493fd | ||
|
|
d12d040def | ||
|
|
491a9dbae9 | ||
|
|
1e0372c40d | ||
|
|
d2f6344846 | ||
|
|
47cb824b3f | ||
|
|
7d8117173f | ||
|
|
2f076d3215 | ||
|
|
1a0b8c1d35 | ||
|
|
887db109c1 | ||
|
|
d8b7f74cd1 | ||
|
|
b81b4f0e0a | ||
|
|
0b4e0d65a9 | ||
|
|
2f837ace1e | ||
|
|
319d68d15e | ||
|
|
2224d811eb | ||
|
|
9ec97ce448 | ||
|
|
f13b8b5d3e | ||
|
|
633f5837dc | ||
|
|
3238cfa0ff | ||
|
|
83b1503cee | ||
|
|
6854fad222 | ||
|
|
56dd3cfa95 | ||
|
|
f81a1acb20 | ||
|
|
4ed5744707 | ||
|
|
085f2816a9 | ||
|
|
0526fdef2f | ||
|
|
093ee9f59a | ||
|
|
1d56b138a5 | ||
|
|
419ce3f49c | ||
|
|
a27f257f80 | ||
|
|
8eee7ca23e | ||
|
|
28cf0d2232 | ||
|
|
e12a8a3c7c |
@@ -32,14 +32,10 @@ public class dbBuildingLocationHandler extends dbHandlerBase {
|
|||||||
ArrayList<BuildingLocation> buildingLocations = new ArrayList<>();
|
ArrayList<BuildingLocation> buildingLocations = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(
|
PreparedStatement preparedStatement = connection.prepareStatement("select `ID`, `BuildingID`, `type`, `slot`, `unknown`, `locX`, `locY`, `locZ`, `w`, `rotX`, `rotY`, `rotZ` from static_building_location " +
|
||||||
"SELECT MIN(ID), BuildingID, slot, MIN(type), MIN(unknown), MIN(locX), MIN(locY), MIN(locZ), " +
|
"where type = 6 or type = 8 " +
|
||||||
"MIN(w), MIN(rotX), MIN(rotY), MIN(rotZ) " +
|
"GROUP BY buildingID, slot " +
|
||||||
"FROM static_building_location " +
|
"ORDER BY buildingID, slot ASC;")) {
|
||||||
"WHERE type IN (6, 8) " +
|
|
||||||
"GROUP BY BuildingID, slot " +
|
|
||||||
"ORDER BY BuildingID, slot ASC;"
|
|
||||||
)) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
buildingLocations = getObjectsFromRs(rs, 20);
|
buildingLocations = getObjectsFromRs(rs, 20);
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
public boolean updateSiegesWithstood(City city, int value) {
|
public boolean updateSiegesWithstood(City city, int value) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_city` SET `siegesWithstood`=?"
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_city` SET `name`=?"
|
||||||
+ " WHERE `UID` = ?")) {
|
+ " WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
preparedStatement.setInt(1, value);
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ public abstract class dbHandlerBase {
|
|||||||
|
|
||||||
int id = rs.getInt(1);
|
int id = rs.getInt(1);
|
||||||
|
|
||||||
if (id == 883640)
|
|
||||||
Logger.info("hit");
|
|
||||||
|
|
||||||
if (DbManager.inCache(localObjectType, id)) {
|
if (DbManager.inCache(localObjectType, id)) {
|
||||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ package engine.gameManager;
|
|||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.server.login.LoginServer;
|
import engine.server.login.LoginServer;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
|
import engine.wpak.EffectsParser;
|
||||||
|
import engine.wpak.PowersParser;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -164,6 +166,14 @@ public enum ConfigManager {
|
|||||||
Logger.info("Compiling regex");
|
Logger.info("Compiling regex");
|
||||||
|
|
||||||
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
regex.put(MB_LOGIN_FNAME_REGEX, Pattern.compile(MB_LOGIN_FNAME_REGEX.getValue()));
|
||||||
|
|
||||||
|
Logger.info("Loading WPAK data");
|
||||||
|
|
||||||
|
|
||||||
|
EffectsParser.parseWpakFile();
|
||||||
|
PowersParser.parseWpakFile();
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3022,5 +3022,62 @@ public class mbEnums {
|
|||||||
PREFIX,
|
PREFIX,
|
||||||
SUFFIX;
|
SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PowerType {
|
||||||
|
None,
|
||||||
|
SPELL,
|
||||||
|
SKILL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CostType {
|
||||||
|
NONE,
|
||||||
|
HEALTH,
|
||||||
|
MANA,
|
||||||
|
STAMINA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AreaType {
|
||||||
|
NONE,
|
||||||
|
SPHERE,
|
||||||
|
POINTBLANK,
|
||||||
|
LINE,
|
||||||
|
CONE,
|
||||||
|
WALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ExcludeType {
|
||||||
|
NONE,
|
||||||
|
CASTER,
|
||||||
|
GROUP,
|
||||||
|
GUILD,
|
||||||
|
NATION,
|
||||||
|
PLAYERS,
|
||||||
|
ALLBUTGROUP,
|
||||||
|
ALLBUTPETS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CastingModeType {
|
||||||
|
NONE,
|
||||||
|
COMBAT,
|
||||||
|
NONCOMBAT,
|
||||||
|
BOTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TargetSelectType {
|
||||||
|
NONE,
|
||||||
|
CLICK,
|
||||||
|
GROUP,
|
||||||
|
GUILD,
|
||||||
|
NEARBYMOBS,
|
||||||
|
NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CategoryToPowerType {
|
||||||
|
None,
|
||||||
|
GreaterThanOrEqualTo,
|
||||||
|
GreaterThan,
|
||||||
|
Always
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ import engine.mbEnums.BuildingGroup;
|
|||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.ClaimAssetMsg;
|
import engine.net.client.msg.ClaimAssetMsg;
|
||||||
import engine.net.client.msg.ClientNetMsg;
|
import engine.net.client.msg.ClientNetMsg;
|
||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.objects.Blueprint;
|
||||||
import engine.objects.*;
|
import engine.objects.Building;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
@@ -110,9 +111,9 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
// Can't claim a tree if your guild already owns one
|
// Can't claim a tree if your guild already owns one
|
||||||
// *** Refactor : Send error to player here
|
// *** Refactor : Send error to player here
|
||||||
|
|
||||||
if(blueprint.getBuildingGroup() == BuildingGroup.TOL && !validateTreeClaim(sourcePlayer)){
|
if ((sourcePlayer.getGuild().isNation()) &&
|
||||||
|
(blueprint.getBuildingGroup() == BuildingGroup.TOL))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
// Process the transfer of the building(s)
|
// Process the transfer of the building(s)
|
||||||
|
|
||||||
@@ -134,24 +135,4 @@ public class ClaimAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateTreeClaim(PlayerCharacter sourcePlayer) {
|
|
||||||
|
|
||||||
if(sourcePlayer.guild.equals(Guild.getErrantGuild())) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Errant Players Cannot Claim Cities!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sourcePlayer.guild.getOwnedCity() != null) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Your Guild Already Owns A City!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!GuildStatusController.isGuildLeader(sourcePlayer.getGuildStatus())) {
|
|
||||||
ErrorPopupMsg.sendErrorMsg(sourcePlayer, "Only A Guild Leader Can Claim A Tree Of Life!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -528,15 +528,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cityObject.warehouse != null) {
|
if (cityObject.warehouse != null) {
|
||||||
if(cityObject.warehouse.building != null) {
|
|
||||||
//warehosue has a building already, warehouse still should exist
|
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 50, ""); //"You can only have one warehouse"
|
PlaceAssetMsg.sendPlaceAssetError(origin, 50, ""); //"You can only have one warehouse"
|
||||||
return false;
|
return false;
|
||||||
}else{
|
|
||||||
//warehouse has no building and needs a cleanup
|
|
||||||
DbManager.WarehouseQueries.DELETE_WAREHOUSE(cityObject.warehouse);
|
|
||||||
cityObject.warehouse = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the warehouse object and it's entry in the database
|
// Create the warehouse object and it's entry in the database
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class WorldServer {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws IOException {
|
||||||
|
|
||||||
WorldServer worldServer;
|
WorldServer worldServer;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,259 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak;
|
||||||
|
|
||||||
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.wpak.data.EffectEntry;
|
||||||
|
import engine.wpak.data.EffectModifier;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class EffectsParser {
|
||||||
|
|
||||||
|
public static String effectsPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Effects.cfg";
|
||||||
|
public static HashMap<String, EffectEntry> effect_data = new HashMap<>();
|
||||||
|
private static final Pattern EFFECT_REGEX = Pattern.compile("(?<=EFFECTBEGIN)(.+?)(?=EFFECTEND)", Pattern.DOTALL);
|
||||||
|
private static final Pattern SOURCE_REGEX = Pattern.compile("(?<=SOURCEBEGIN)(.+?)(?=SOURCEEND)", Pattern.DOTALL);
|
||||||
|
private static final Pattern MODS_REGEX = Pattern.compile("(?<=MODSBEGIN)(.+?)(?=MODSEND)", Pattern.DOTALL);
|
||||||
|
private static final Pattern CONDITIONS_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
||||||
|
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*"); // Regex ignores spaces within quotes
|
||||||
|
|
||||||
|
public static void parseWpakFile() {
|
||||||
|
|
||||||
|
// Read .wpak file from disk
|
||||||
|
|
||||||
|
byte[] fileData = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileData = Files.readAllBytes(Paths.get(effectsPath));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
String fileContents = new String(fileData);
|
||||||
|
|
||||||
|
// Iterate over effect entries from .wpak data
|
||||||
|
|
||||||
|
Matcher matcher = EFFECT_REGEX.matcher(fileContents);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
EffectEntry effectEntry = parseEffectEntry(matcher.group());
|
||||||
|
effect_data.put(effectEntry.effect_id, effectEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static EffectEntry parseEffectEntry(String effectData) {
|
||||||
|
|
||||||
|
EffectEntry effectEntry = new EffectEntry();
|
||||||
|
|
||||||
|
// Remove all lines that contain a # and leading/trailing blank lines
|
||||||
|
|
||||||
|
effectData = effectData.replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", "");
|
||||||
|
effectData = effectData.trim();
|
||||||
|
|
||||||
|
// Parse effect entry header
|
||||||
|
|
||||||
|
String firstLine;
|
||||||
|
ArrayList<String> effectHeader = new ArrayList<>();
|
||||||
|
|
||||||
|
// Some effects exist without sources/mods or conditions
|
||||||
|
// (ACID "MOB" 0)
|
||||||
|
|
||||||
|
if (effectData.indexOf('\n') > 0)
|
||||||
|
firstLine = effectData.substring(0, effectData.indexOf('\n'));
|
||||||
|
else
|
||||||
|
firstLine = effectData;
|
||||||
|
|
||||||
|
Matcher matcher = STRSPLIT_REGEX.matcher(firstLine);
|
||||||
|
|
||||||
|
while (matcher.find())
|
||||||
|
effectHeader.add(matcher.group().trim());
|
||||||
|
|
||||||
|
effectEntry.effect_id = effectHeader.get(0);
|
||||||
|
effectEntry.effect_name = effectHeader.get(1);
|
||||||
|
effectEntry.effect_name = effectEntry.effect_name.replaceAll("\"", "");
|
||||||
|
|
||||||
|
// Some effect mods have no icon
|
||||||
|
// (SEEINVIS-SHADE "See Invis")
|
||||||
|
|
||||||
|
if (effectHeader.size() == 3)
|
||||||
|
effectEntry.icon = Integer.parseInt(effectHeader.get(2));
|
||||||
|
else
|
||||||
|
effectEntry.icon = 0;
|
||||||
|
|
||||||
|
// Parse source entries
|
||||||
|
|
||||||
|
matcher = SOURCE_REGEX.matcher(effectData);
|
||||||
|
|
||||||
|
while (matcher.find())
|
||||||
|
effectEntry.sources.add(matcher.group().trim());
|
||||||
|
|
||||||
|
// Parse modifier entries
|
||||||
|
|
||||||
|
matcher = MODS_REGEX.matcher(effectData);
|
||||||
|
|
||||||
|
// Iterate effect entries from .wpak config data
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
EffectModifier effectModifier = parseModEntry(matcher.group());
|
||||||
|
effectEntry.mods.add(effectModifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse Conditions
|
||||||
|
|
||||||
|
matcher = CONDITIONS_REGEX.matcher(effectData);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
String[] conditions = matcher.group().trim().split("\n");
|
||||||
|
|
||||||
|
for (String condition : conditions) {
|
||||||
|
String[] parameters = condition.trim().split("\\s+");
|
||||||
|
effectEntry.conditions.put(parameters[0], Float.parseFloat(parameters[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return effectEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static EffectModifier parseModEntry(String modData) {
|
||||||
|
|
||||||
|
EffectModifier effectModifier = new EffectModifier();
|
||||||
|
|
||||||
|
String[] modEntries = modData.trim().split("\n");
|
||||||
|
|
||||||
|
for (String modEntry : modEntries) {
|
||||||
|
|
||||||
|
ArrayList<String> modValues = new ArrayList<>();
|
||||||
|
Matcher matcher = STRSPLIT_REGEX.matcher(modEntry.trim());
|
||||||
|
|
||||||
|
while (matcher.find())
|
||||||
|
modValues.add(matcher.group().trim());
|
||||||
|
|
||||||
|
effectModifier.type = mbEnums.ModType.valueOf(modValues.get(0).trim());
|
||||||
|
|
||||||
|
switch (effectModifier.type) {
|
||||||
|
case BladeTrails: // No parm modifiers
|
||||||
|
case ImmuneToAttack:
|
||||||
|
case ImmuneToPowers:
|
||||||
|
case Ambidexterity:
|
||||||
|
case Silenced:
|
||||||
|
case IgnorePassiveDefense:
|
||||||
|
case Stunned:
|
||||||
|
case PowerCostHealth:
|
||||||
|
case Charmed:
|
||||||
|
case Fly:
|
||||||
|
case CannotMove:
|
||||||
|
case CannotTrack:
|
||||||
|
case CannotAttack:
|
||||||
|
case CannotCast:
|
||||||
|
case SpireBlock:
|
||||||
|
case Invisible:
|
||||||
|
case SeeInvisible:
|
||||||
|
break;
|
||||||
|
case AnimOverride:
|
||||||
|
effectModifier.min = Float.parseFloat(modValues.get(1).trim());
|
||||||
|
effectModifier.max = Float.parseFloat(modValues.get(2).trim());
|
||||||
|
break;
|
||||||
|
case Health:
|
||||||
|
case Mana:
|
||||||
|
case Stamina:
|
||||||
|
effectModifier.min = Float.parseFloat(modValues.get(1).trim());
|
||||||
|
effectModifier.max = Float.parseFloat(modValues.get(2).trim());
|
||||||
|
effectModifier.scale = Float.parseFloat(modValues.get(3).trim());
|
||||||
|
// Parameter 4 is always 0.
|
||||||
|
effectModifier.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(5).trim());
|
||||||
|
effectModifier.arg1 = modValues.get(6).trim();
|
||||||
|
break;
|
||||||
|
case Attr:
|
||||||
|
case Resistance:
|
||||||
|
case Skill:
|
||||||
|
case HealthRecoverRate:
|
||||||
|
case ManaRecoverRate:
|
||||||
|
case StaminaRecoverRate:
|
||||||
|
case DamageShield:
|
||||||
|
case HealthFull:
|
||||||
|
case ManaFull:
|
||||||
|
case StaminaFull:
|
||||||
|
case Slay:
|
||||||
|
case Fade:
|
||||||
|
case Durability:
|
||||||
|
effectModifier.min = Float.parseFloat(modValues.get(1).trim());
|
||||||
|
effectModifier.scale = Float.parseFloat(modValues.get(2).trim());
|
||||||
|
effectModifier.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
|
||||||
|
|
||||||
|
if (modValues.size() > 4)
|
||||||
|
effectModifier.arg1 = modValues.get(4).trim(); // Some HeathFull entries do not have an argument
|
||||||
|
break;
|
||||||
|
case MeleeDamageModifier:
|
||||||
|
case OCV:
|
||||||
|
case DCV:
|
||||||
|
case AttackDelay:
|
||||||
|
case AdjustAboveDmgCap:
|
||||||
|
case DamageCap:
|
||||||
|
case ArmorPiercing:
|
||||||
|
case Speed:
|
||||||
|
case PowerDamageModifier:
|
||||||
|
case DR:
|
||||||
|
case PassiveDefense:
|
||||||
|
case MaxDamage:
|
||||||
|
case Value:
|
||||||
|
case WeaponSpeed:
|
||||||
|
case MinDamage:
|
||||||
|
case PowerCost:
|
||||||
|
case Block:
|
||||||
|
case Parry:
|
||||||
|
case Dodge:
|
||||||
|
case ScanRange:
|
||||||
|
case ScaleHeight:
|
||||||
|
case ScaleWidth:
|
||||||
|
case WeaponRange:
|
||||||
|
effectModifier.min = Float.parseFloat(modValues.get(1).trim());
|
||||||
|
effectModifier.scale = Float.parseFloat(modValues.get(2).trim());
|
||||||
|
effectModifier.compoundCurveType = mbEnums.CompoundCurveType.valueOf(modValues.get(3).trim());
|
||||||
|
break;
|
||||||
|
case ItemName:
|
||||||
|
case BlockedPowerType:
|
||||||
|
case ImmuneTo:
|
||||||
|
case BlackMantle:
|
||||||
|
effectModifier.arg1 = modValues.get(1).trim();
|
||||||
|
|
||||||
|
// Some BlockedPowerType entries have only one argument
|
||||||
|
|
||||||
|
if (modValues.size() > 2)
|
||||||
|
effectModifier.arg2 = modValues.get(2).trim();
|
||||||
|
break;
|
||||||
|
case NoMod:
|
||||||
|
case ConstrainedAmbidexterity:
|
||||||
|
case ProtectionFrom:
|
||||||
|
case ExclusiveDamageCap:
|
||||||
|
case IgnoreDamageCap:
|
||||||
|
effectModifier.arg1 = modValues.get(1).trim();
|
||||||
|
break;
|
||||||
|
case WeaponProc:
|
||||||
|
effectModifier.min = Float.parseFloat(modValues.get(1).trim());
|
||||||
|
effectModifier.arg1 = modValues.get(2).trim();
|
||||||
|
effectModifier.scale = Float.parseFloat(modValues.get(3).trim());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Logger.error("Unhandled type: " + effectModifier.type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return effectModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak;
|
||||||
|
|
||||||
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.wpak.data.PowerActionEntry;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class PowerActionParser {
|
||||||
|
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*");
|
||||||
|
private static final Pattern POWER_ACTION_REGEX = Pattern.compile("(?<=POWERACTIONBEGIN)(.+?)(?=POWERACTIONEND)", Pattern.DOTALL);
|
||||||
|
private static final String powerActionPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/PowerActions.cfg";
|
||||||
|
|
||||||
|
public static void parseWpakFile() {
|
||||||
|
|
||||||
|
// Read .wpak file from disk
|
||||||
|
|
||||||
|
byte[] fileData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileData = Files.readAllBytes(Paths.get(powerActionPath));
|
||||||
|
} catch (
|
||||||
|
IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileContents = new String(fileData);
|
||||||
|
|
||||||
|
// Iterate over power entries from .wpak data
|
||||||
|
|
||||||
|
Matcher matcher = POWER_ACTION_REGEX.matcher(fileContents);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
|
||||||
|
PowerActionEntry powerActionEntry = parsePowerActionEntry(matcher.group().trim());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PowerActionEntry parsePowerActionEntry(String powerActionData) {
|
||||||
|
|
||||||
|
PowerActionEntry powerActionEntry = new PowerActionEntry();
|
||||||
|
|
||||||
|
return powerActionEntry;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,316 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak;
|
||||||
|
|
||||||
|
import engine.gameManager.ConfigManager;
|
||||||
|
import engine.mbEnums;
|
||||||
|
import engine.wpak.data.*;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class PowersParser {
|
||||||
|
|
||||||
|
private static final Pattern POWER_REGEX = Pattern.compile("(?<=POWERBEGIN)(.+?)(?=POWEREND)", Pattern.DOTALL);
|
||||||
|
private static final Pattern STRSPLIT_REGEX = Pattern.compile("([^\"]\\S*|\"[^\"]*\")\\s*");
|
||||||
|
private static final Pattern CONDITION_REGEX = Pattern.compile("(?<=CONDITIONBEGIN)(.+?)(?=CONDITIONEND)", Pattern.DOTALL);
|
||||||
|
private static final String powersPath = ConfigManager.DEFAULT_DATA_DIR + "wpak/Powers.cfg";
|
||||||
|
|
||||||
|
public static void parseWpakFile() {
|
||||||
|
|
||||||
|
// Read .wpak file from disk
|
||||||
|
|
||||||
|
byte[] fileData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fileData = Files.readAllBytes(Paths.get(powersPath));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
String fileContents = new String(fileData);
|
||||||
|
|
||||||
|
// Iterate over power entries from .wpak data
|
||||||
|
|
||||||
|
Matcher matcher = POWER_REGEX.matcher(fileContents);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
|
||||||
|
PowerEntry powerEntry = parsePowerEntry(matcher.group().trim());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PowerEntry parsePowerEntry(String powerData) {
|
||||||
|
|
||||||
|
PowerEntry powerEntry = new PowerEntry();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
StringBuilder conditionString = new StringBuilder();
|
||||||
|
StringBuilder powerString = new StringBuilder();
|
||||||
|
|
||||||
|
int endPos = 0;
|
||||||
|
|
||||||
|
// Separate out any conditions from the power data
|
||||||
|
|
||||||
|
Matcher matcher = CONDITION_REGEX.matcher(powerData);
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
conditionString.append(matcher.group().trim());
|
||||||
|
powerString.append(powerData, endPos, matcher.start());
|
||||||
|
endPos = matcher.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
powerString.append(powerData.substring(endPos));
|
||||||
|
|
||||||
|
// Cleanup dangling tags and lines that contain a # and leading/trailing blank lines
|
||||||
|
|
||||||
|
powerString = new StringBuilder(powerString.toString().replaceAll("CONDITIONBEGINCONDITIONEND", ""));
|
||||||
|
powerString = new StringBuilder(powerString.toString().replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", ""));
|
||||||
|
|
||||||
|
conditionString = new StringBuilder(conditionString.toString().replaceAll("(?m)^(\\s*#.*|\\s*)\r?\n?", ""));
|
||||||
|
|
||||||
|
// Parse header line in power data
|
||||||
|
|
||||||
|
String[] lineData = powerString.toString().trim().split("\n");
|
||||||
|
ArrayList<String> powerHeader = new ArrayList<>();
|
||||||
|
|
||||||
|
String headerString = lineData[0];
|
||||||
|
headerString = headerString.replace("\n", " ");
|
||||||
|
|
||||||
|
matcher = STRSPLIT_REGEX.matcher(headerString);
|
||||||
|
|
||||||
|
while (matcher.find())
|
||||||
|
powerHeader.add(matcher.group().trim());
|
||||||
|
|
||||||
|
java.util.Iterator<String> iterator = powerHeader.iterator();
|
||||||
|
|
||||||
|
powerEntry.power_id = iterator.next();
|
||||||
|
powerEntry.power = iterator.next().replaceAll("\"", "");
|
||||||
|
|
||||||
|
PowerData power = new PowerData();
|
||||||
|
power.power_type = mbEnums.PowerType.valueOf(iterator.next());
|
||||||
|
power.icon = Integer.parseInt(iterator.next());
|
||||||
|
power.powerBase = iterator.next().replaceAll("\"", "");
|
||||||
|
powerEntry.powers.add(power);
|
||||||
|
|
||||||
|
String nextValue = iterator.next();
|
||||||
|
|
||||||
|
// Account for second definition
|
||||||
|
|
||||||
|
if (nextValue.equals("SPELL") || nextValue.equals("SKILL")) {
|
||||||
|
power = new PowerData();
|
||||||
|
power.power_type = mbEnums.PowerType.valueOf(nextValue);
|
||||||
|
power.icon = Integer.parseInt(iterator.next());
|
||||||
|
power.powerBase = iterator.next().replaceAll("\"", "");
|
||||||
|
powerEntry.powers.add(power);
|
||||||
|
powerEntry.target_type = mbEnums.PowerTargetType.valueOf(iterator.next());
|
||||||
|
} else
|
||||||
|
powerEntry.target_type = mbEnums.PowerTargetType.valueOf(nextValue);
|
||||||
|
|
||||||
|
powerEntry.range = Integer.parseInt(iterator.next());
|
||||||
|
powerEntry.areaType = mbEnums.AreaType.valueOf(iterator.next());
|
||||||
|
powerEntry.areaRange = Integer.parseInt(iterator.next());
|
||||||
|
powerEntry.excludeType = mbEnums.ExcludeType.valueOf(iterator.next());
|
||||||
|
powerEntry.costType = mbEnums.CostType.valueOf(iterator.next());
|
||||||
|
powerEntry.cost = Float.parseFloat(iterator.next());
|
||||||
|
powerEntry.difficulty = Float.parseFloat(iterator.next());
|
||||||
|
powerEntry.precision = Float.parseFloat(iterator.next());
|
||||||
|
powerEntry.init_time = Float.parseFloat(iterator.next().replaceAll("(\\.0)+$", ""));
|
||||||
|
powerEntry.release_time = Float.parseFloat(iterator.next());
|
||||||
|
powerEntry.recycle_time = Float.parseFloat(iterator.next());
|
||||||
|
powerEntry.hitRollYN = Integer.parseInt(iterator.next());
|
||||||
|
powerEntry.castingMode = mbEnums.CastingModeType.valueOf(iterator.next());
|
||||||
|
powerEntry.initAmin = Integer.parseInt(iterator.next());
|
||||||
|
powerEntry.releaseAnim = Integer.parseInt(iterator.next());
|
||||||
|
powerEntry.targetSelect = mbEnums.TargetSelectType.valueOf(iterator.next());
|
||||||
|
|
||||||
|
// Process key value pairs after header
|
||||||
|
|
||||||
|
iterator = Arrays.stream(lineData).iterator();
|
||||||
|
iterator.next(); // Ignore header
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
|
||||||
|
String lineValue = iterator.next();
|
||||||
|
String[] lineValues = lineValue.split("=");
|
||||||
|
String key = lineValues[0].trim();
|
||||||
|
ActionEntry actionEntry;
|
||||||
|
String[] arguments;
|
||||||
|
Matcher matcher1;
|
||||||
|
ArrayList<String> args;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case "ACTION":
|
||||||
|
actionEntry = new ActionEntry();
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
|
||||||
|
if (powerEntry.power_id.equals("HNT-050"))
|
||||||
|
Logger.error("debug");
|
||||||
|
|
||||||
|
actionEntry.effect_id = arguments[0];
|
||||||
|
actionEntry.minTrains = Integer.parseInt(arguments[1]);
|
||||||
|
actionEntry.maxTrains = Integer.parseInt(arguments[2]);
|
||||||
|
actionEntry.duration = Float.parseFloat(arguments[3]);
|
||||||
|
actionEntry.curve = mbEnums.CompoundCurveType.valueOf(arguments[4]);
|
||||||
|
actionEntry.stackingCategory = arguments[5];
|
||||||
|
actionEntry.stackingPriority = Integer.parseInt(arguments[6]);
|
||||||
|
actionEntry.categoryToPower = mbEnums.CategoryToPowerType.valueOf(arguments[7]);
|
||||||
|
powerEntry.actionEntries.add(actionEntry);
|
||||||
|
break;
|
||||||
|
case "MaxLevel":
|
||||||
|
powerEntry.maxLevel = Integer.parseInt(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "HateValue":
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
powerEntry.hateValue = Integer.parseInt(arguments[0]);
|
||||||
|
|
||||||
|
// Not all entries have a curve. Defaults to DefaultFlat;
|
||||||
|
|
||||||
|
if (arguments.length > 1)
|
||||||
|
powerEntry.hateCurve = mbEnums.CompoundCurveType.valueOf(arguments[1]);
|
||||||
|
break;
|
||||||
|
case "LOOPANIMID":
|
||||||
|
powerEntry.loopAnimID = Integer.parseInt(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "GRANTOVERRIDEVAR":
|
||||||
|
powerEntry.grantOverrideVar = lineValues[1].trim();
|
||||||
|
break;
|
||||||
|
case "DESCRIPTION":
|
||||||
|
powerEntry.description.add(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "CATEGORY":
|
||||||
|
powerEntry.category = lineValues[1].trim();
|
||||||
|
break;
|
||||||
|
case "CURVE":
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
powerEntry.curves.put(arguments[0], mbEnums.CompoundCurveType.valueOf(arguments[1]));
|
||||||
|
break;
|
||||||
|
case "EQPREREQ":
|
||||||
|
EquipmentPreReq equipmentPreReq = new EquipmentPreReq();
|
||||||
|
matcher1 = STRSPLIT_REGEX.matcher(lineValues[1].trim());
|
||||||
|
args = new ArrayList<>();
|
||||||
|
|
||||||
|
while (matcher1.find())
|
||||||
|
args.add(matcher1.group().trim());
|
||||||
|
|
||||||
|
equipmentPreReq.slot = mbEnums.EquipSlotType.valueOf(args.get(0));
|
||||||
|
equipmentPreReq.skill = args.get(1).replaceAll("\"", "");
|
||||||
|
equipmentPreReq.level = Integer.parseInt(args.get(2));
|
||||||
|
powerEntry.equipmentPreReq = equipmentPreReq;
|
||||||
|
break;
|
||||||
|
case "CANCASTWHILEMOVING":
|
||||||
|
powerEntry.canCastWhileMoving = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "CANCASTWHILEFLYING":
|
||||||
|
powerEntry.canCastWhileFlying = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "BLADETRAILS":
|
||||||
|
powerEntry.bladeTrails = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "EFFECTPREREQ":
|
||||||
|
EffectDescription effectPreReq = new EffectDescription();
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
effectPreReq.effect_id = arguments[9];
|
||||||
|
effectPreReq.level = Integer.parseInt(arguments[1]);
|
||||||
|
effectPreReq.message = arguments[2];
|
||||||
|
powerEntry.effectPreReqs.add(effectPreReq);
|
||||||
|
break;
|
||||||
|
case "MONSTERTYPERESTRICTS":
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
for (String restriction : arguments)
|
||||||
|
powerEntry.monsterRestricts.add(mbEnums.MonsterType.valueOf(restriction.trim()));
|
||||||
|
break;
|
||||||
|
case "MONSTERTYPEPREREQS":
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
for (String restriction : arguments)
|
||||||
|
powerEntry.monsterPrereqs.add(mbEnums.MonsterType.valueOf(restriction.trim()));
|
||||||
|
break;
|
||||||
|
case "SHOULDCHECKPATH":
|
||||||
|
powerEntry.shouldCheckPath = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "STICKY":
|
||||||
|
powerEntry.sticky = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "PULSEINFO":
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
powerEntry.pulseCycle = Integer.parseInt(arguments[0]);
|
||||||
|
powerEntry.pulseDuration = Integer.parseInt(arguments[1]);
|
||||||
|
break;
|
||||||
|
case "MAXNUMMOBTARGETS":
|
||||||
|
powerEntry.maxMobTargets = Integer.parseInt(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "MAXNUMPLAYERTARGETS":
|
||||||
|
powerEntry.maxPlayerTargets = Integer.parseInt(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "ISADMINPOWER":
|
||||||
|
powerEntry.isAdminPower = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "ISPROJECTILE":
|
||||||
|
powerEntry.isProjectile = Boolean.parseBoolean(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "CASTERSPULSEPARTICLE":
|
||||||
|
powerEntry.casterPulseParticle = Integer.parseInt(lineValues[1].trim());
|
||||||
|
break;
|
||||||
|
case "TARGETEFFECTPREREQS_ORED":
|
||||||
|
EffectDescription preReq = new EffectDescription();
|
||||||
|
arguments = lineValues[1].trim().split("\\s+");
|
||||||
|
preReq.effect_id = arguments[0];
|
||||||
|
preReq.level = Integer.parseInt(arguments[1]);
|
||||||
|
powerEntry.targetEffectPrereqs.add(preReq);
|
||||||
|
break;
|
||||||
|
case "SOUNDS": // Values not parsed
|
||||||
|
case "APPLYDAMAGESELF":
|
||||||
|
case "APPLYDAMAGECASTER":
|
||||||
|
case "APPLYDAMAGEOTHER":
|
||||||
|
case "APPLYDAMAGETARGET":
|
||||||
|
case "APPLYEFFECTSELF":
|
||||||
|
case "APPLYEFFECTOTHER":
|
||||||
|
case "APPLYEFFECTCASTER":
|
||||||
|
case "APPLYEFFECTTARGET":
|
||||||
|
case "FIZZLEOTHER":
|
||||||
|
case "FIZZLESELF":
|
||||||
|
case "INITSTRING":
|
||||||
|
case "SUCCESSOTHER":
|
||||||
|
case "SUCCESSSELF":
|
||||||
|
case "WEAROFFEFFECTOTHER":
|
||||||
|
case "WEAROFFEFFECTSELF":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Logger.error("Unhandled variable type:" + key + " for power: " + powerEntry.power_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse power conditions
|
||||||
|
|
||||||
|
if (conditionString.toString().isEmpty() == false) {
|
||||||
|
String[] conditions = conditionString.toString().split("\n");
|
||||||
|
|
||||||
|
for (String condition : conditions) {
|
||||||
|
String[] parameters = condition.trim().split("\\s+");
|
||||||
|
powerEntry.conditions.put(parameters[0], Float.parseFloat(parameters[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error(powerEntry.power_id + " " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return powerEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import engine.mbEnums;
|
||||||
|
|
||||||
|
public class ActionEntry {
|
||||||
|
|
||||||
|
public String effect_id;
|
||||||
|
public int minTrains;
|
||||||
|
public int maxTrains;
|
||||||
|
public float duration;
|
||||||
|
public String stackingCategory;
|
||||||
|
public mbEnums.CompoundCurveType curve;
|
||||||
|
public int stackingPriority;
|
||||||
|
public mbEnums.CategoryToPowerType categoryToPower;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
public class EffectDescription {
|
||||||
|
public String effect_id;
|
||||||
|
public int level;
|
||||||
|
public String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class EffectEntry {
|
||||||
|
public String effect_id;
|
||||||
|
public String effect_name;
|
||||||
|
public int icon;
|
||||||
|
public HashSet<String> sources = new HashSet<>();
|
||||||
|
public ArrayList<EffectModifier> mods = new ArrayList<>();
|
||||||
|
public HashMap<String, Float> conditions = new HashMap<>();
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import engine.mbEnums;
|
||||||
|
|
||||||
|
public class EffectModifier {
|
||||||
|
public mbEnums.ModType type;
|
||||||
|
public float min;
|
||||||
|
public float max;
|
||||||
|
public float scale;
|
||||||
|
public mbEnums.CompoundCurveType compoundCurveType;
|
||||||
|
public String arg1; // ItemName "Masterwork" ""
|
||||||
|
public String arg2; // ItemName "" "of the Defender"
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import engine.mbEnums;
|
||||||
|
|
||||||
|
public class EquipmentPreReq {
|
||||||
|
|
||||||
|
public mbEnums.EquipSlotType slot;
|
||||||
|
public String skill;
|
||||||
|
public int level;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class PowerActionEntry {
|
||||||
|
|
||||||
|
public String action_id;
|
||||||
|
public String action_type;
|
||||||
|
public ArrayList<EffectDescription> effects;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import engine.mbEnums;
|
||||||
|
|
||||||
|
public class PowerData {
|
||||||
|
public mbEnums.PowerType power_type;
|
||||||
|
public int icon;
|
||||||
|
public String powerBase;
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2024
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
package engine.wpak.data;
|
||||||
|
|
||||||
|
import engine.mbEnums;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class PowerEntry {
|
||||||
|
public String power_id;
|
||||||
|
public String power;
|
||||||
|
public ArrayList<PowerData> powers = new ArrayList<>();
|
||||||
|
public mbEnums.PowerTargetType target_type;
|
||||||
|
public int range;
|
||||||
|
public mbEnums.AreaType areaType;
|
||||||
|
public int areaRange;
|
||||||
|
public mbEnums.ExcludeType excludeType;
|
||||||
|
public mbEnums.CostType costType;
|
||||||
|
public float cost;
|
||||||
|
public float difficulty;
|
||||||
|
public float precision;
|
||||||
|
public float init_time;
|
||||||
|
public float release_time;
|
||||||
|
public float recycle_time;
|
||||||
|
public int hitRollYN;
|
||||||
|
public mbEnums.CastingModeType castingMode;
|
||||||
|
public int initAmin;
|
||||||
|
public int releaseAnim;
|
||||||
|
public mbEnums.TargetSelectType targetSelect;
|
||||||
|
|
||||||
|
// Additional key/value type power entries
|
||||||
|
|
||||||
|
public ArrayList<ActionEntry> actionEntries = new ArrayList<>();
|
||||||
|
public int maxLevel;
|
||||||
|
public int hateValue;
|
||||||
|
public mbEnums.CompoundCurveType hateCurve = mbEnums.CompoundCurveType.DefaultFlat;
|
||||||
|
public int loopAnimID;
|
||||||
|
public String grantOverrideVar;
|
||||||
|
public ArrayList<String> description = new ArrayList<>();
|
||||||
|
public HashMap<String, mbEnums.CompoundCurveType> curves = new HashMap<>();
|
||||||
|
public String category;
|
||||||
|
public boolean canCastWhileMoving = false;
|
||||||
|
public boolean bladeTrails = false;
|
||||||
|
public ArrayList<EffectDescription> effectPreReqs = new ArrayList<>();
|
||||||
|
public EquipmentPreReq equipmentPreReq;
|
||||||
|
public EnumSet<mbEnums.MonsterType> monsterRestricts = EnumSet.noneOf(mbEnums.MonsterType.class);
|
||||||
|
public EnumSet<mbEnums.MonsterType> monsterPrereqs = EnumSet.noneOf(mbEnums.MonsterType.class);
|
||||||
|
public boolean shouldCheckPath = false;
|
||||||
|
public boolean sticky = false;
|
||||||
|
public int pulseCycle;
|
||||||
|
public int pulseDuration;
|
||||||
|
public int maxMobTargets;
|
||||||
|
public int maxPlayerTargets;
|
||||||
|
public boolean isAdminPower = false;
|
||||||
|
public int casterPulseParticle;
|
||||||
|
public ArrayList<EffectDescription> targetEffectPrereqs = new ArrayList<>();
|
||||||
|
public boolean canCastWhileFlying = false;
|
||||||
|
public boolean isProjectile = false;
|
||||||
|
public HashMap<String, Float> conditions = new HashMap<>();
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user