Implement purchasing debuff potions. Fixes #1321

This commit is contained in:
Phillip Thelen 2020-07-20 18:16:27 +02:00
parent 6bc2365232
commit a5ce77ff72
13 changed files with 27 additions and 7 deletions

View file

@ -162,7 +162,7 @@ android {
multiDexEnabled true
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
versionCode 2482
versionCode 2485
versionName "2.7.1"
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#801A181D" />
<corners android:radius="@dimen/bar_radius"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -24,7 +24,7 @@
android:layout_width="@dimen/avatar_header_width"
android:layout_height="@dimen/avatar_header_height"
android:layout_gravity="center_vertical"
android:layout_marginEnd="32dp"
android:layout_marginEnd="20dp"
android:contentDescription="@string/sidebar_avatar"
app:showBackground="true"
app:showMount="true"

View file

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/bar_padding"
android:orientation="horizontal">
<ImageView

View file

@ -64,9 +64,9 @@
<dimen name="mount_image_width">81dp</dimen>
<dimen name="mount_image_height">99dp</dimen>
<dimen name="shop_height">124dp</dimen>
<dimen name="bar_icon_padding">6dp</dimen>
<dimen name="bar_icon_padding">4dp</dimen>
<dimen name="task_text_padding">16dp</dimen>
<dimen name="header_bar_spacing">3dp</dimen>
<dimen name="header_bar_spacing">9dp</dimen>
<dimen name="bar_size_slim">13dp</dimen>
<dimen name="spacing_small">4dp</dimen>

View file

@ -76,6 +76,9 @@ interface ApiService {
@POST("user/buy-quest/{key}")
fun purchaseQuest(@Path("key") key: String): Flowable<HabitResponse<Void>>
@POST("user/buy-special-spell/{key}")
fun purchaseSpecialSpell(@Path("key") key: String): Flowable<HabitResponse<Void>>
@POST("user/sell/{type}/{key}")
fun sellItem(@Path("type") itemType: String, @Path("key") itemKey: String): Flowable<HabitResponse<User>>

View file

@ -61,6 +61,7 @@ interface ApiClient {
fun purchaseMysterySet(itemKey: String): Flowable<Any>
fun purchaseQuest(key: String): Flowable<Any>
fun purchaseSpecialSpell(key: String): Flowable<Any>
fun validateSubscription(request: SubscriptionValidationRequest): Flowable<Any>
fun validateNoRenewSubscription(request: PurchaseValidationRequest): Flowable<Any>
fun cancelSubscription(): Flowable<Any>

View file

@ -70,6 +70,7 @@ interface InventoryRepository : BaseRepository {
fun purchaseHourglassItem(purchaseType: String, key: String): Flowable<Any>
fun purchaseQuest(key: String): Flowable<Any>
fun purchaseSpecialSpell(key: String): Flowable<Any>
fun purchaseItem(purchaseType: String, key: String, purchaseQuantity: Int): Flowable<Any>

View file

@ -370,6 +370,10 @@ class ApiClientImpl//private OnHabitsAPIResult mResultListener;
return apiService.purchaseQuest(key).compose(configureApiCallObserver())
}
override fun purchaseSpecialSpell(key: String): Flowable<Any> {
return apiService.purchaseSpecialSpell(key).compose(configureApiCallObserver())
}
override fun sellItem(itemType: String, itemKey: String): Flowable<User> {
return apiService.sellItem(itemType, itemKey).compose(configureApiCallObserver())
}

View file

@ -280,6 +280,10 @@ class InventoryRepositoryImpl(localRepository: InventoryLocalRepository, apiClie
return apiClient.purchaseQuest(key)
}
override fun purchaseSpecialSpell(key: String): Flowable<Any> {
return apiClient.purchaseSpecialSpell(key)
}
override fun purchaseItem(purchaseType: String, key: String, purchaseQuantity: Int): Flowable<Any> {
return apiClient.purchaseItem(purchaseType, key, purchaseQuantity)
}

View file

@ -57,7 +57,7 @@ open class ShopItem : RealmObject() {
var level: Int? = null
val isTypeItem: Boolean
get() = "eggs" == purchaseType || "hatchingPotions" == purchaseType || "food" == purchaseType || "armoire" == purchaseType || "potion" == purchaseType
get() = "eggs" == purchaseType || "hatchingPotions" == purchaseType || "food" == purchaseType || "armoire" == purchaseType || "potion" == purchaseType || "debuffPotion" == purchaseType
val isTypeQuest: Boolean
get() = "quests" == purchaseType

View file

@ -143,7 +143,7 @@ class ValueBar(context: Context, attrs: AttributeSet?) : FrameLayout(context, at
progressBar.setBackgroundResource(R.drawable.layout_rounded_bg_light_gray)
} else {
textColor = context.getThemeColor(R.attr.textColorPrimaryDark)
progressBar.setBackgroundResource(R.drawable.layout_rounded_bg_primary)
progressBar.setBackgroundResource(R.drawable.layout_rounded_bg_header_bar)
}
valueTextView.setTextColor(textColor)
descriptionTextView.setTextColor(textColor)

View file

@ -299,6 +299,8 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
}
} else if (shopItem.purchaseType == "quests" && shopItem.currency == "gold") {
observable = inventoryRepository.purchaseQuest(shopItem.key)
} else if (shopItem.purchaseType == "debuffPotion") {
observable = inventoryRepository.purchaseSpecialSpell(shopItem.key)
} else if (shopItem.purchaseType == "card") {
purchaseCardAction?.invoke(shopItem)
dismiss()