Search in sources :

Example 31 with TrackedRuntimeException

use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.

the class SpiderExploding method attackProc.

@Override
public int attackProc(@NonNull Char enemy, int damage) {
    try {
        Plant plant = (Plant) PLantClasses[getKind()].newInstance();
        plant.pos = enemy.getPos();
        plant.effect(enemy.getPos(), enemy);
        die(this);
    } catch (Exception e) {
        throw new TrackedRuntimeException(e);
    }
    return damage;
}
Also used : Plant(com.watabou.pixeldungeon.plants.Plant) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException)

Example 32 with TrackedRuntimeException

use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.

the class WndSaveSlotSelect method onSelect.

protected void onSelect(int index) {
    final InterstitialPoint returnTo = this;
    if (saving) {
        try {
            Dungeon.save();
            slot = slotNameFromIndexAndMod(index);
            SaveUtils.copySaveToSlot(slot, Dungeon.heroClass);
        } catch (Exception e) {
            throw new TrackedRuntimeException(e);
        }
    }
    Game.softPaused = true;
    slot = getSlotToLoad(index);
    if (PixelDungeon.donated() < 1) {
        Ads.displaySaveAndLoadAd(returnTo);
    } else {
        returnToWork(true);
    }
}
Also used : TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) InterstitialPoint(com.watabou.noosa.InterstitialPoint) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException)

Example 33 with TrackedRuntimeException

use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.

the class Bundle method put.

public void put(String key, String[] array) {
    try {
        JSONArray jsonArray = new JSONArray();
        for (int i = 0; i < array.length; i++) {
            jsonArray.put(i, array[i]);
        }
        data.put(key, jsonArray);
    } catch (JSONException e) {
        throw new TrackedRuntimeException("key:" + key, e);
    }
}
Also used : TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException)

Example 34 with TrackedRuntimeException

use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.

the class Bundle method put.

public void put(String key, Bundlable object) {
    if (object != null && !object.dontPack()) {
        try {
            Bundle bundle = new Bundle();
            bundle.put(CLASS_NAME, object.getClass().getName());
            object.storeInBundle(bundle);
            BundleHelper.Pack(object, bundle);
            data.put(key, bundle.data);
        } catch (JSONException e) {
            throw new TrackedRuntimeException("key:" + key, e);
        }
    }
}
Also used : TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) JSONException(org.json.JSONException)

Example 35 with TrackedRuntimeException

use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.

the class PredesignedLevel method createMobs.

@Override
protected void createMobs() {
    try {
        if (mLevelDesc.has("mobs")) {
            JSONArray mobsDesc = mLevelDesc.getJSONArray("mobs");
            for (int i = 0; i < mobsDesc.length(); ++i) {
                JSONObject mobDesc = mobsDesc.optJSONObject(i);
                int x = mobDesc.getInt("x");
                int y = mobDesc.getInt("y");
                if (Actor.findChar(cell(x, y)) != null) {
                    continue;
                }
                if (cellValid(x, y)) {
                    String kind = mobDesc.getString("kind");
                    Mob mob = MobFactory.mobByName(kind);
                    mob.fromJson(mobDesc);
                    mob.setPos(cell(x, y));
                    spawnMob(mob);
                }
            }
        }
    } catch (JSONException e) {
        throw new TrackedRuntimeException("bad mob description", e);
    } catch (Exception e) {
        throw new TrackedRuntimeException(e);
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) TrackedRuntimeException(com.nyrds.android.util.TrackedRuntimeException) JSONException(org.json.JSONException)

Aggregations

TrackedRuntimeException (com.nyrds.android.util.TrackedRuntimeException)41 JSONException (org.json.JSONException)24 JSONArray (org.json.JSONArray)15 JSONObject (org.json.JSONObject)10 IOException (java.io.IOException)5 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)4 Item (com.watabou.pixeldungeon.items.Item)3 SuppressLint (android.annotation.SuppressLint)2 Pushing (com.watabou.pixeldungeon.effects.Pushing)2 Bitmap (android.graphics.Bitmap)1 Nullable (android.support.annotation.Nullable)1 FakeLastLevel (com.nyrds.pixeldungeon.levels.FakeLastLevel)1 GutsLevel (com.nyrds.pixeldungeon.levels.GutsLevel)1 IceCavesBossLevel (com.nyrds.pixeldungeon.levels.IceCavesBossLevel)1 IceCavesLevel (com.nyrds.pixeldungeon.levels.IceCavesLevel)1 NecroBossLevel (com.nyrds.pixeldungeon.levels.NecroBossLevel)1 NecroLevel (com.nyrds.pixeldungeon.levels.NecroLevel)1 PredesignedLevel (com.nyrds.pixeldungeon.levels.PredesignedLevel)1 RandomLevel (com.nyrds.pixeldungeon.levels.RandomLevel)1 ShadowLordLevel (com.nyrds.pixeldungeon.levels.ShadowLordLevel)1