Skip to content

Commit

Permalink
Initial work on Palico Weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephMichels committed Jul 11, 2016
1 parent 50a08b5 commit 3b13dd3
Show file tree
Hide file tree
Showing 67 changed files with 1,255 additions and 478 deletions.
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
android:label=""
android:screenOrientation="portrait"/>

<activity android:name="com.ghstudios.android.ui.list.PalicoActivity"
android:screenOrientation="portrait"/>

<activity android:name="com.ghstudios.android.ui.detail.PalicoWeaponDetailActivity"
android:screenOrientation="portrait"/>

<!-- MONSTER LIST SECTION -->
<activity
android:name="com.ghstudios.android.ui.list.MonsterListActivity"
Expand Down
Binary file added app/src/main/assets/icons_weapons/blunt1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/blunt8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/assets/icons_weapons/cutting8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 139 additions & 0 deletions app/src/main/java/com/ghstudios/android/data/classes/PalicoWeapon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package com.ghstudios.android.data.classes;

/**
* Created by Joseph on 7/9/2016.
*/
public class PalicoWeapon {
private long _id;
private int attackMelee;
private int attackRanged;
private boolean blunt;
private int balance;
private int elementMelee;
private int elementRanged;
private String element;
private int affinityMelee;
private int affinityRanged;
private int defense;
private int creation_cost;
int sharpness;
Item item;

public Item getItem(){
return this.item;
}

public void setItem(Item i){item=i;}

public int getSharpness() {
return sharpness;
}

public void setSharpness(int sharpness) {
this.sharpness = sharpness;
}


public long getId() {
return _id;
}

public void setId(long _id) {
this._id = _id;
}

public int getAttackMelee() {
return attackMelee;
}

public void setAttackMelee(int attackMelee) {
this.attackMelee = attackMelee;
}

public int getAttackRanged() {
return attackRanged;
}

public void setAttackRanged(int attackRanged) {
this.attackRanged = attackRanged;
}

public boolean isBlunt() {
return blunt;
}

public void setBlunt(boolean blunt) {
this.blunt = blunt;
}

public int getBalance() {
return balance;
}

public String getBalanceString(){
switch (balance){
case 0:return "[Balanced]";
case 1:return "[Melee+]";
default:return "[Boomerang+]";
}
}
public void setBalance(int balance) {
this.balance = balance;
}

public int getElementMelee() {
return elementMelee;
}

public void setElementMelee(int elementMelee) {
this.elementMelee = elementMelee;
}

public int getElementRanged() {
return elementRanged;
}

public void setElementRanged(int elementRanged) {
this.elementRanged = elementRanged;
}

public String getElement() {
return element;
}

public void setElement(String element) {
this.element = element;
}

public int getAffinityMelee() {
return affinityMelee;
}

public void setAffinityMelee(int affinityMelee) {
this.affinityMelee = affinityMelee;
}

public int getAffinityRanged() {
return affinityRanged;
}

public void setAffinityRanged(int affinityRanged) {
this.affinityRanged = affinityRanged;
}

public int getDefense() {
return defense;
}

public void setDefense(int defense) {
this.defense = defense;
}

public int getCreation_cost() {
return creation_cost;
}

public void setCreation_cost(int creation_cost) {
this.creation_cost = creation_cost;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,18 @@ public WeaponCursor queryWeaponTree(long id) {
return mHelper.queryWeapons(idArray);

}

public PalicoWeaponCursor queryPalicoWeapons(){
return mHelper.queryPalicoWeapons();
}

public PalicoWeapon getPalicoWeapon(long id){
PalicoWeaponCursor cursor = mHelper.queryPalicoWeapon(id);
cursor.moveToFirst();
PalicoWeapon w = cursor.getWeapon();
cursor.close();
return w;
}

/********************************* WISHLIST QUERIES ******************************************/
/* Get a Cursor that has a list of all Wishlists */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.util.Xml;

import com.ghstudios.android.data.classes.ASBSession;
import com.ghstudios.android.data.classes.PalicoWeapon;
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;

import org.xmlpull.v1.XmlPullParserFactory;
Expand Down Expand Up @@ -2670,6 +2671,8 @@ private SQLiteQueryBuilder builderWeapon() {
return QB;
}



/**
* ****************************** WEAPON TREE QUERIES *****************************************
*/
Expand Down Expand Up @@ -2779,6 +2782,72 @@ private SQLiteQueryBuilder builderWeaponTreeChild() {
QB.setProjectionMap(projectionMap);
return QB;
}
/**
* ****************************** PALICO WEAPON QUERIES *****************************************
*/

public PalicoWeaponCursor queryPalicoWeapons() {

QueryHelper qh = new QueryHelper();
qh.Columns = null;
qh.Table = S.TABLE_PALICO_WEAPONS;
qh.Selection = null;
qh.SelectionArgs = null;
qh.GroupBy = null;
qh.Having = null;
qh.OrderBy = S.COLUMN_ITEMS_RARITY;
qh.Limit = null;

return new PalicoWeaponCursor(wrapJoinHelper(builderPalicoWeapon(), qh));
}

public PalicoWeaponCursor queryPalicoWeapon(long id){
QueryHelper qh = new QueryHelper();
qh.Columns = null;
qh.Table = S.TABLE_PALICO_WEAPONS;
qh.Selection = "w."+S.COLUMN_PALICO_WEAPONS_ID + "=?";
qh.SelectionArgs = new String[]{Long.toString(id)};
qh.GroupBy = null;
qh.Having = null;
qh.OrderBy = S.COLUMN_ITEMS_RARITY;
qh.Limit = null;
return new PalicoWeaponCursor(wrapJoinHelper(builderPalicoWeapon(), qh));
}

private SQLiteQueryBuilder builderPalicoWeapon() {
String w = "w";
String i = "i";

HashMap<String, String> projectionMap = new HashMap<String, String>();

projectionMap.put("_id", w + "." + S.COLUMN_PALICO_WEAPONS_ID + " AS " + "_id");
projectionMap.put(S.COLUMN_PALICO_WEAPONS_CREATION_COST, w + "." + S.COLUMN_PALICO_WEAPONS_CREATION_COST);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_ATTACK_MELEE, w + "." + S.COLUMN_PALICO_WEAPONS_ATTACK_MELEE);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_ATTACK_RANGED, w + "." + S.COLUMN_PALICO_WEAPONS_ATTACK_RANGED);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_ELEMENT, w + "." + S.COLUMN_PALICO_WEAPONS_ELEMENT);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_ELEMENT_MELEE, w + "." + S.COLUMN_PALICO_WEAPONS_ELEMENT_MELEE);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_ELEMENT_RANGED, w + "." + S.COLUMN_PALICO_WEAPONS_ELEMENT_RANGED);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_BLUNT, w + "." + S.COLUMN_PALICO_WEAPONS_BLUNT);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_BALANCE, w + "." + S.COLUMN_PALICO_WEAPONS_BALANCE);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_DEFENSE, w + "." + S.COLUMN_PALICO_WEAPONS_DEFENSE);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_SHARPNESS, w + "." + S.COLUMN_PALICO_WEAPONS_SHARPNESS);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_AFFINITY_MELEE, w + "." + S.COLUMN_PALICO_WEAPONS_AFFINITY_MELEE);
projectionMap.put(S.COLUMN_PALICO_WEAPONS_AFFINITY_RANGED, w + "." + S.COLUMN_PALICO_WEAPONS_AFFINITY_RANGED);

projectionMap.put(S.COLUMN_ITEMS_NAME, i + "." + S.COLUMN_ITEMS_NAME);
projectionMap.put(S.COLUMN_ITEMS_RARITY, i + "." + S.COLUMN_ITEMS_RARITY);
projectionMap.put(S.COLUMN_ITEMS_DESCRIPTION, i + "." + S.COLUMN_ITEMS_DESCRIPTION);
projectionMap.put(S.COLUMN_ITEMS_ICON_NAME, i + "." + S.COLUMN_ITEMS_ICON_NAME);

//Create new querybuilder
SQLiteQueryBuilder QB = new SQLiteQueryBuilder();

QB.setTables(S.TABLE_PALICO_WEAPONS + " AS w" + " LEFT OUTER JOIN " + S.TABLE_ITEMS + " AS i" + " ON " + "w." +
S.COLUMN_PALICO_WEAPONS_ID + " = " + "i." + S.COLUMN_ITEMS_ID);

QB.setProjectionMap(projectionMap);
return QB;
}

/**
* ****************************** WISHLIST QUERIES *****************************************
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.ghstudios.android.data.database;

import android.database.Cursor;
import android.database.CursorWrapper;

import com.ghstudios.android.data.classes.Item;
import com.ghstudios.android.data.classes.PalicoWeapon;

/**
* Created by Joseph on 7/9/2016.
*/
public class PalicoWeaponCursor extends CursorWrapper {

public PalicoWeaponCursor(Cursor cursor) {
super(cursor);
}

public PalicoWeapon getWeapon(){
if (isBeforeFirst() || isAfterLast())
return null;

PalicoWeapon weapon = new PalicoWeapon();
weapon.setId(getLong(getColumnIndex(S.COLUMN_PALICO_WEAPONS_ID)));
weapon.setCreation_cost(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_CREATION_COST)));
weapon.setAttackMelee(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_ATTACK_MELEE)));
weapon.setAttackRanged(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_ATTACK_RANGED)));
weapon.setElement(getString(getColumnIndex(S.COLUMN_PALICO_WEAPONS_ELEMENT)));
weapon.setElementMelee(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_ELEMENT_MELEE)));
weapon.setElementRanged(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_ELEMENT_RANGED)));
weapon.setDefense(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_DEFENSE)));
weapon.setSharpness(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_SHARPNESS)));
weapon.setAffinityMelee(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_AFFINITY_MELEE)));
weapon.setAffinityRanged(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_AFFINITY_RANGED)));
weapon.setBlunt(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_BLUNT))==1);
weapon.setBalance(getInt(getColumnIndex(S.COLUMN_PALICO_WEAPONS_BALANCE)));

Item i = new Item();
i.setId(getLong(getColumnIndex(S.COLUMN_ITEMS_ID)));
i.setName(getString(getColumnIndex(S.COLUMN_ITEMS_NAME)));
i.setRarity(getInt(getColumnIndex(S.COLUMN_ITEMS_RARITY)));
i.setDescription(getString(getColumnIndex(S.COLUMN_ITEMS_DESCRIPTION)));
i.setFileLocation(getString(getColumnIndex(S.COLUMN_ITEMS_ICON_NAME)));

weapon.setItem(i);
return weapon;
}
}
16 changes: 16 additions & 0 deletions app/src/main/java/com/ghstudios/android/data/database/S.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,22 @@ public class S {
static final String COLUMN_WEAPONS_TREE_DEPTH = "tree_depth";
static final String COLUMN_WEAPONS_PARENT_ID = "parent_id";

// Weapons
static final String TABLE_PALICO_WEAPONS = "palico_weapons";
static final String COLUMN_PALICO_WEAPONS_ID = "_id";
static final String COLUMN_PALICO_WEAPONS_CREATION_COST = "creation_cost";
static final String COLUMN_PALICO_WEAPONS_ATTACK_MELEE = "attack_melee";
static final String COLUMN_PALICO_WEAPONS_ATTACK_RANGED = "attack_ranged";
static final String COLUMN_PALICO_WEAPONS_ELEMENT = "element";
static final String COLUMN_PALICO_WEAPONS_ELEMENT_MELEE = "element_melee";
static final String COLUMN_PALICO_WEAPONS_ELEMENT_RANGED = "element_ranged";
static final String COLUMN_PALICO_WEAPONS_DEFENSE = "defense";
static final String COLUMN_PALICO_WEAPONS_SHARPNESS = "sharpness";
static final String COLUMN_PALICO_WEAPONS_AFFINITY_MELEE = "affinity_melee";
static final String COLUMN_PALICO_WEAPONS_AFFINITY_RANGED = "affinity_ranged";
static final String COLUMN_PALICO_WEAPONS_BLUNT = "blunt";
static final String COLUMN_PALICO_WEAPONS_BALANCE = "balance";

// Horn Melodies
static final String TABLE_HORN_MELODIES = "horn_melodies";
static final String COLUMN_HORN_MELODIES_ID = "_id";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.ghstudios.android.loader;

import android.content.Context;
import android.database.Cursor;

import com.ghstudios.android.data.database.DataManager;
import com.ghstudios.android.data.database.PalicoWeaponCursor;

/**
* Created by Joseph on 7/10/2016.
*/
public class PalicoWeaponListCursorLoader extends SQLiteCursorLoader {

public PalicoWeaponListCursorLoader(Context context) {
super(context);
}

@Override
protected Cursor loadCursor() {
PalicoWeaponCursor cursor = DataManager.get(getContext()).queryPalicoWeapons();
return cursor;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.ghstudios.android.ui.ClickListeners;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.ghstudios.android.ui.detail.PalicoWeaponDetailActivity;

/**
* Created by Joseph on 7/10/2016.
*/
public class PalicoWeaponClickListener implements View.OnClickListener {
private Context c;
private Long id;

public PalicoWeaponClickListener(Context context, Long id) {
super();
this.id = id;
this.c = context;
}

@Override
public void onClick(View v) {
Intent i = new Intent(c, PalicoWeaponDetailActivity.class);
i.putExtra(PalicoWeaponDetailActivity.EXTRA_WEAPON_ID, id);
c.startActivity(i);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void onPause() {
}

@Override
protected MenuSection getSelectedSection() {
protected int getSelectedSection() {
return MenuSection.ARMOR_SET_BUILDER;
}

Expand Down
Loading

0 comments on commit 3b13dd3

Please sign in to comment.