Merge pull request #628 from HabitRPG/avatar_transformations

Show avatar transformations
This commit is contained in:
Phillip Thelen 2016-09-20 13:22:28 +02:00 committed by GitHub
commit 6c86a83023
5 changed files with 124 additions and 51 deletions

View file

@ -0,0 +1,3 @@
ALTER TABLE Buffs ADD COLUMN seafoam bool;
ALTER TABLE Buffs ADD COLUMN spookySparkles bool;
ALTER TABLE Buffs ADD COLUMN shinySeed bool;

View file

@ -7,5 +7,5 @@ public class HabitDatabase {
public static final String NAME = "Habitica"; public static final String NAME = "Habitica";
public static final int VERSION = 26; public static final int VERSION = 27;
} }

View file

@ -248,6 +248,7 @@ public class AvatarView extends View {
case HAIR_MUSTACHE: case HAIR_MUSTACHE:
case HAIR_BEARD: case HAIR_BEARD:
case EYEWEAR: case EYEWEAR:
case VISUAL_BUFF:
case HEAD: case HEAD:
case HEAD_ACCESSORY: case HEAD_ACCESSORY:
case HAIR_FLOWER: case HAIR_FLOWER:
@ -451,14 +452,15 @@ public class AvatarView extends View {
HAIR_MUSTACHE(11), HAIR_MUSTACHE(11),
HAIR_BEARD(12), HAIR_BEARD(12),
EYEWEAR(13), EYEWEAR(13),
HEAD(14), VISUAL_BUFF(14),
HEAD_ACCESSORY(15), HEAD(15),
HAIR_FLOWER(16), HEAD_ACCESSORY(16),
SHIELD(17), HAIR_FLOWER(17),
WEAPON(18), SHIELD(18),
MOUNT_HEAD(19), WEAPON(19),
ZZZ(20), MOUNT_HEAD(20),
PET(21); ZZZ(21),
PET(22);
final int order; final int order;

View file

@ -16,6 +16,15 @@ public class Buffs extends BasicStats {
@Column @Column
private Boolean streaks; private Boolean streaks;
@Column
private Boolean seafoam;
@Column
private Boolean spookySparkles;
@Column
private Boolean shinySeed;
public Buffs() { public Buffs() {
this(false, false); this(false, false);
} }
@ -33,6 +42,30 @@ public class Buffs extends BasicStats {
this.snowball = snowball; this.snowball = snowball;
} }
public Boolean getSeafoam() {
return seafoam != null ? seafoam : Boolean.FALSE;
}
public void setSeafoam(Boolean seafoam) {
this.seafoam = seafoam;
}
public Boolean getSpookySparkles() {
return spookySparkles != null ? spookySparkles : Boolean.FALSE;
}
public void setSpookySparkles(Boolean spookySparkles) {
this.spookySparkles = spookySparkles;
}
public Boolean getShinySeed() {
return shinySeed != null ? shinySeed : Boolean.FALSE;
}
public void setShinySeed(Boolean shinySeed) {
this.shinySeed = shinySeed;
}
public Boolean getStreaks() { public Boolean getStreaks() {
return streaks != null ? streaks : Boolean.FALSE; return streaks != null ? streaks : Boolean.FALSE;
} }

View file

@ -440,6 +440,33 @@ public class HabitRPGUser extends BaseModel {
Preferences prefs = getPreferences(); Preferences prefs = getPreferences();
Outfit outfit = (prefs.getCostume()) ? getItems().getGear().getCostume() : getItems().getGear().getEquipped(); Outfit outfit = (prefs.getCostume()) ? getItems().getGear().getCostume() : getItems().getGear().getEquipped();
boolean hasVisualBuffs = false;
if(stats != null && stats.getBuffs() != null){
Buffs buffs = stats.getBuffs();
if(buffs.getSnowball()){
layerMap.put(AvatarView.LayerType.VISUAL_BUFF, "snowman");
hasVisualBuffs = true;
}
if(buffs.getSeafoam()){
layerMap.put(AvatarView.LayerType.VISUAL_BUFF, "seafoam_star");
hasVisualBuffs = true;
}
if(buffs.getShinySeed()){
layerMap.put(AvatarView.LayerType.VISUAL_BUFF, "avatar_floral_"+stats.get_class());
hasVisualBuffs = true;
}
if(buffs.getSpookySparkles()){
layerMap.put(AvatarView.LayerType.VISUAL_BUFF, "ghost");
hasVisualBuffs = true;
}
}
if(!hasVisualBuffs) {
if (!TextUtils.isEmpty(prefs.getChair())) { if (!TextUtils.isEmpty(prefs.getChair())) {
layerMap.put(AvatarView.LayerType.CHAIR, prefs.getChair()); layerMap.put(AvatarView.LayerType.CHAIR, prefs.getChair());
} }
@ -495,6 +522,14 @@ public class HabitRPGUser extends BaseModel {
layerMap.put(AvatarView.LayerType.HAIR_FLOWER, "hair_flower_" + hair.getFlower()); layerMap.put(AvatarView.LayerType.HAIR_FLOWER, "hair_flower_" + hair.getFlower());
} }
} }
} else {
Hair hair = prefs.getHair();
// Show flower all the time!
if (hair != null && hair.isAvailable(hair.getFlower())) {
layerMap.put(AvatarView.LayerType.HAIR_FLOWER, "hair_flower_" + hair.getFlower());
}
}
if (prefs.getSleep()) { if (prefs.getSleep()) {
layerMap.put(AvatarView.LayerType.ZZZ, "zzz"); layerMap.put(AvatarView.LayerType.ZZZ, "zzz");