mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-13 08:15:20 +07:00
Committing ParserMapper and RunesMapper implementation
Deprecated, but a good start if ever moved forward with
This commit is contained in:
parent
dedc07799e
commit
257a8d3b40
36
core/src/main/java/com/riiablo/table/parser/RunesMapper.java
Normal file
36
core/src/main/java/com/riiablo/table/parser/RunesMapper.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.riiablo.table.parser;
|
||||
|
||||
import io.netty.util.AsciiString;
|
||||
|
||||
import com.riiablo.logger.LogManager;
|
||||
import com.riiablo.logger.Logger;
|
||||
import com.riiablo.table.ParserMapper;
|
||||
|
||||
@Deprecated
|
||||
public final class RunesMapper implements ParserMapper<RunesParser> {
|
||||
private static final Logger log = LogManager.getLogger(RunesMapper.class);
|
||||
|
||||
private static final int PREFIX_LENGTH = "RUNEWORD".length();
|
||||
|
||||
@Override
|
||||
public int map(RunesParser parser, final String recordName) {
|
||||
final String idString = recordName.substring(PREFIX_LENGTH);
|
||||
final int oldId = Integer.parseInt(idString);
|
||||
final int newId;
|
||||
if (oldId == 22) {
|
||||
// Delerium
|
||||
newId = 2718;
|
||||
} else if (oldId == 95) {
|
||||
// Passion / Patience duplicate
|
||||
final CharSequence Rune_Name = parser.parser().token(-1, parser.fieldIds[1]);
|
||||
newId = AsciiString.contentEqualsIgnoreCase(Rune_Name, "Passion")
|
||||
? 95
|
||||
: 96;
|
||||
} else {
|
||||
newId = oldId;
|
||||
}
|
||||
|
||||
if (oldId != newId) log.debug("{}: {} -> {}", recordName, oldId, newId);
|
||||
return newId;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.riiablo.table;
|
||||
|
||||
/**
|
||||
* @deprecated unused -- attempt to create automatic mapping of txt parser records to indexes
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ParserMapper<P extends Parser<?>> {
|
||||
int map(P parser, String recordName);
|
||||
}
|
Loading…
Reference in New Issue
Block a user