Skip to content

Commit

Permalink
Added option to disable recycling of Power Cubes, issue broo2s#20
Browse files Browse the repository at this point in the history
  • Loading branch information
o4kapuk committed Oct 6, 2013
1 parent 23a0239 commit 745a51b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ def main():
edit.prepare_to_insert()
edit.add_line(' :skip_item_shader')
edit.save()

edit = edit_cls('PowerCubeDetailsUiCreator')
edit.find_method_def('addActionButtons')
edit.find_line(r' invoke-super .*', where='down')
edit.prepare_to_insert()
edit.add_invoke_entry('PowerCubeDetailsUiCreator_onActionButtonsTableCreated', 'p1')
edit.save()

#modify shader code before compiling it
edit = edit_cls('ShaderUtils')
Expand Down
15 changes: 15 additions & 0 deletions res/analyzer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ broot.ingress.mod.Entry:
Mod_ShowAgentTab: [null, Z]
AssetFinder_onGetAssetPath: [null, Lcom/badlogic/gdx/files/FileHandle;, $String]
PortalInfoDialog_onStatsTableCreated: [null, V, $PortalInfoDialog, $Table]
PowerCubeDetailsUiCreator_onActionButtonsTableCreated: [null, V, $Table]
PortalInfoDialog_onPlayerLocationChanged: [null, V]
ScannerStateManager_onEnablePortalVectors: [null, Z]
PlayerModelUtils_onGetDefaultResonatorToDeploy: [null, Ljava/util/Map;, Ljava/util/TreeMap;]
Expand Down Expand Up @@ -609,6 +610,14 @@ com.nianticproject.ingress.common.inventory.ui.BaseItemDetailsUiCreator:
- [by_string, false, true, '"DROP"']
- [by_string, false, true, '"RECYCLE"']

com.nianticproject.ingress.common.inventory.ui.PowerCubeDetailsUiCreator:
methods:
addActionButtons: [b, V, $Table, $Skin, $Stage]

find:
- [by_string, false, true, '" XM"']
- [by_string, false, true, '"USE"']

com.nianticproject.ingress.common.inventory.ItemActionHandler:
methods:
drop: [a, V, $GameEntity]
Expand Down Expand Up @@ -664,6 +673,12 @@ com.nianticproject.ingress.ui.CommsAdapter:

find_by_string: "MMM dd"

com.nianticproject.ingress.content.CommsLoader:
find_by_string: "CommsLoader.deserializeNoneOnFail"

com.nianticproject.ingress.content.CommsData:
find_by_string: "Massive plext in CommsData"

### FRAMEWORK
android.view.View:
is_real_name: true
Expand Down
8 changes: 8 additions & 0 deletions src/broot/ingress/mod/AboutModActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ public void clicked(InputEvent event, float x, float y) {
updateUiTweaksValues(true);
}
});
uiTweaksItem.addButton("Allow Cubes recyling", "", new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Config.enablePowerCubesRecycle = !Config.enablePowerCubesRecycle;
updateUiTweaksValues(true);
}
});
addItem(uiTweaksItem);

addItem(uiVariantItem = new ListItem(skin, "UI variant", "", "Toggle", new ClickListener() {
Expand Down Expand Up @@ -358,6 +365,7 @@ private void updateUiTweaksValues(boolean save) {
}
uiTweaksItem.buttons.get(8).setText(gpsLockLabel);
uiTweaksItem.buttons.get(9).setText(Config.changePortalInfoDialog ? "ON" : "OFF");
uiTweaksItem.buttons.get(10).setText(Config.enablePowerCubesRecycle ? "ON" : "OFF");
}

private void updateUiVariantValue() {
Expand Down
12 changes: 12 additions & 0 deletions src/broot/ingress/mod/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ public static void PortalInfoDialog_onStatsTableCreated(PortalInfoDialog dialog,
t.add(portalInfoDistLabel = new Label("", style)).left().expandX();
}

public static void PowerCubeDetailsUiCreator_onActionButtonsTableCreated(Table t) {
if (Config.enablePowerCubesRecycle) {
return;
}

List<Cell> cells = new ArrayList<Cell>(t.getCells());
t.clear();
t.add((Actor) cells.get(0).getWidget()).left().size(com.esotericsoftware.tablelayout.Value.percentWidth(0.29F), com.esotericsoftware.tablelayout.Value.percentWidth(0.12F));
t.add((Actor) cells.get(1).getWidget()).left().size(com.esotericsoftware.tablelayout.Value.percentWidth(0.29F), com.esotericsoftware.tablelayout.Value.percentWidth(0.12F));
t.row();
}

public static void PortalInfoDialog_onPlayerLocationChanged() {
if (!Config.changePortalInfoDialog) {
return;
Expand Down
3 changes: 3 additions & 0 deletions src/broot/ingress/mod/util/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class Config {
public static boolean vibration;
public static boolean keepScreenOn;
public static boolean changePortalInfoDialog;
public static boolean enablePowerCubesRecycle;

public static UiVariant uiVariant;

Expand Down Expand Up @@ -73,6 +74,7 @@ public static void load() {
vibration = prefs.getBoolean("vibration", true);
keepScreenOn = prefs.getBoolean("keepScreenOn", false);
changePortalInfoDialog = prefs.getBoolean("changePortalInfoDialog", true);
enablePowerCubesRecycle = prefs.getBoolean("enablePowerCubesRecycle", true);

uiVariant = UiVariant.byName.get(prefs.getString("uiVariant", "auto"));
if (uiVariant == null) {
Expand Down Expand Up @@ -115,6 +117,7 @@ public static void save() {
e.putBoolean("vibration", vibration);
e.putBoolean("keepScreenOn", keepScreenOn);
e.putBoolean("changePortalInfoDialog", changePortalInfoDialog);
e.putBoolean("enablePowerCubesRecycle", enablePowerCubesRecycle);

e.putString("uiVariant", uiVariant.name);

Expand Down

0 comments on commit 745a51b

Please sign in to comment.