-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
531 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package plugin.api; | ||
|
||
import java.util.HashMap; | ||
|
||
public enum MiniMenuAction { | ||
WALK_HERE(60), | ||
NPC_1(17), | ||
NPC_2(16), | ||
NPC_3(4), | ||
NPC_4(19), | ||
NPC_5(2), | ||
NPC_EXAMINE(1007), | ||
PLAYER_1(30), | ||
PLAYER_BLOCK(34), | ||
PLAYER_TRADE(29), | ||
PLAYER_REQ_ASSIST(37), | ||
PLAYER_FOLLOW(31), | ||
PLAYER_5(57), | ||
OBJ_1(47), | ||
OBJ_EQUIP(5), | ||
OBJ_4(35), | ||
OBJ_OPERATE(23), | ||
OBJ_5(58), | ||
OBJ_EXAMINE(1002), | ||
OBJSTACK_1(18), | ||
OBJSTACK_2(20), | ||
LOC_1(42), | ||
LOC_2(50), | ||
LOC_3(49), | ||
LOC_4(46), | ||
LOC_5(1001), | ||
LOC_EXAMINE(1004) | ||
; | ||
|
||
public final short actionCode; | ||
public static HashMap<Integer, MiniMenuAction> actionCodeMap = new HashMap<>(); | ||
|
||
MiniMenuAction(int actionCode) { | ||
this.actionCode = (short) actionCode; | ||
} | ||
|
||
static { | ||
for (MiniMenuAction a : values()) { | ||
actionCodeMap.put((int) a.actionCode, a); | ||
} | ||
} | ||
|
||
public static MiniMenuAction forActionCode(short actionCode) { | ||
return actionCodeMap.get((int) actionCode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package plugin.api; | ||
|
||
import rt4.JagString; | ||
import rt4.MiniMenu; | ||
|
||
/** | ||
* Convenience wrapper for mini menu entries | ||
* @author ceikry | ||
*/ | ||
public class MiniMenuEntry { | ||
int index; | ||
public MiniMenuEntry(int index) { | ||
this.index = index; | ||
} | ||
|
||
public String getSubject() { | ||
return MiniMenu.opBases[index].toString(); | ||
} | ||
|
||
public void setSubject(String name) { | ||
MiniMenu.opBases[index] = JagString.of(name); | ||
} | ||
|
||
public long getSubjectIndex() { | ||
return MiniMenu.keys[index]; | ||
} | ||
|
||
public MiniMenuType getType() { | ||
if (getSubject().length() < 11) return MiniMenuType.TILE; | ||
|
||
String color = getSubject().substring(5,11); | ||
if (color.equals("00ffff")) return MiniMenuType.LOCATION; | ||
if (color.equals("ffff00")) return MiniMenuType.NPC; | ||
if (color.equals("ffffff")) return MiniMenuType.PLAYER; | ||
if (color.equals("ff9040")) return MiniMenuType.OBJ; | ||
else return MiniMenuType.TILE; | ||
} | ||
|
||
public String getVerb() { | ||
return MiniMenu.ops[index].toString(); | ||
} | ||
|
||
public void setVerb(String verb) { | ||
MiniMenu.ops[index] = JagString.of(verb); | ||
} | ||
|
||
public int getIntArg1() { | ||
return MiniMenu.intArgs1[index]; | ||
} | ||
|
||
public int getIntArg2() { | ||
return MiniMenu.intArgs2[index]; | ||
} | ||
|
||
public int getCursor() { | ||
return MiniMenu.cursors[index]; | ||
} | ||
|
||
public MiniMenuAction getAction() { | ||
int actionCode = MiniMenu.actions[index]; | ||
if (isStrictlySecondary()) actionCode -= 2000; | ||
return MiniMenuAction.forActionCode((short) actionCode); | ||
} | ||
|
||
public short getActionCode() { | ||
return MiniMenu.actions[index]; | ||
} | ||
|
||
public void setAction(MiniMenuAction action) { | ||
MiniMenu.actions[index] = action.actionCode; | ||
} | ||
|
||
public void toggleStrictlySecondary() { | ||
if (isStrictlySecondary()) MiniMenu.actions[index] -= 2000; | ||
else MiniMenu.actions[index] += 2000; | ||
} | ||
|
||
public boolean isStrictlySecondary() { | ||
return MiniMenu.actions[index] >= 2000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package plugin.api; | ||
|
||
public enum MiniMenuType { | ||
NPC, | ||
PLAYER, | ||
LOCATION, | ||
TILE, | ||
OBJ, | ||
OBJSTACK | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.