diff --git a/src/app/build.gradle.kts b/src/app/build.gradle.kts index 3b954c0..c08b1b1 100644 --- a/src/app/build.gradle.kts +++ b/src/app/build.gradle.kts @@ -13,7 +13,7 @@ android { minSdk = 24 targetSdk = 34 versionCode = 8 - versionName = "4.4" + versionName = "5" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } @@ -36,7 +36,12 @@ android { } buildFeatures { viewBinding = true + compose = true } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.0" + } + } dependencies { @@ -58,5 +63,7 @@ dependencies { implementation("androidx.datastore:datastore-preferences-rxjava2:1.0.0") implementation("androidx.datastore:datastore-preferences-rxjava3:1.0.0") implementation("com.google.android.play:core-ktx:1.8.1") + implementation("androidx.compose.material3:material3:1.0.1") + implementation("androidx.compose.material3:material3-window-size-class:1.0.1") } \ No newline at end of file diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt index 542490b..bf9bf36 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/MainActivity.kt @@ -12,6 +12,7 @@ import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController +import com.google.android.material.color.DynamicColors import com.helloyanis.rucoycalculator.databinding.ActivityMainBinding class MainActivity : AppCompatActivity() { @@ -22,6 +23,7 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + DynamicColors.applyToActivitiesIfAvailable(this.application) val repositoryUrl = "https://api.github.com/repos/helloyanis/rucoy-calculator" //GitHubReleaseChecker(this, repositoryUrl).execute() binding = ActivityMainBinding.inflate(layoutInflater) diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/skull/SkullFragment.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/skull/SkullFragment.kt index e4a08b6..a8385bc 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/skull/SkullFragment.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/skull/SkullFragment.kt @@ -21,6 +21,7 @@ import com.helloyanis.rucoycalculator.MainActivity import com.helloyanis.rucoycalculator.MainActivity.Companion.dataStore import com.helloyanis.rucoycalculator.R import com.helloyanis.rucoycalculator.databinding.SkullBinding +import com.helloyanis.rucoycalculator.ui.train.Formulas import kotlinx.coroutines.launch @@ -102,30 +103,50 @@ class SkullFragment : Fragment() { preferences[BASE_LEVEL_KEY] = baseLevelValue } } - val str1 = if((double*150).toString().substringAfter(".").length==1){ - (double*150).toString().substringBefore(".") - }else { - (double*150).toString() - } - binding.root.findViewById(R.id.yellowskullvalue).text = str1 + "G needed" - val str2 = if((150*4*double).toString().substringAfter(".").length==1){ - (150*4*double).toString().substringBefore(".") - }else { - (150*4*double).toString() - } - binding.root.findViewById(R.id.orangeskullvalue).text = str2 + "G needed" - val str3 = if((150*13*double).toString().substringAfter(".").length==1){ - (150*13*double).toString().substringBefore(".") - }else { - (150*13*double).toString() - } - binding.root.findViewById(R.id.redskullvalue).text = str3 + "G needed" - val str4 = if((double*50).toString().substringAfter(".").length==1){ - (((4-3)*(4-3))*double*4050).toString().substringBefore(".") - }else { - (150*40*double).toString() - } - binding.root.findViewById(R.id.blackskullvalue).text = str4 + "G needed" + binding.root.findViewById(R.id.mainstat).text = "❤️ "+String.format( + "%,.0f", + 100+double*15 + ) + " HP\n🪄" + String.format( + "%,.0f", + 100+double*20 + )+ " MP\n💪 Level " + String.format("%,.0f", double) + " is at " + String.format("%,.0f", Formulas.exp_Calc(double)) + " exp!\n" + + "✨ You need " + String.format("%,.0f", (Formulas.exp_Calc(double + 1) - Formulas.exp_Calc(double))) + " experience to reach level " + String.format("%,.0f", double + 1) + "!" + + binding.root.findViewById(R.id.whiteskullvalue).text = String.format( + "%,.0f", + double*150 + ) + "G needed\n" + String.format( + "%,.0f", + double*50 + )+ "G lost from death by player." + binding.root.findViewById(R.id.yellowskullvalue).text = String.format( + "%,.0f", + double*150 + ) + "G needed\n" + String.format( + "%,.0f", + double*150 + )+ "G lost from death by player." + binding.root.findViewById(R.id.orangeskullvalue).text = String.format( + "%,.0f", + double*600 + ) + "G needed\n" + String.format( + "%,.0f", + double*450 + )+ "G lost from death by player." + binding.root.findViewById(R.id.redskullvalue).text = String.format( + "%,.0f", + double*1950 + ) + "G needed\n" + String.format( + "%,.0f", + double*1350 + )+ "G lost from death by player." + binding.root.findViewById(R.id.blackskullvalue).text = String.format( + "%,.0f", + double*6000 + ) + "G needed\n" + String.format( + "%,.0f", + double*4050 + )+ "G lost from death by player." } } diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt index 23962cd..fef8d85 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainFragment.kt @@ -243,11 +243,11 @@ class TrainFragment : Fragment() { private fun updateoutput(){ binding.root.findViewById(R.id.str0).text = "" - binding.root.findViewById(R.id.str1).text = "" - binding.root.findViewById(R.id.str2).text = "" - binding.root.findViewById(R.id.str3).text = "" - binding.root.findViewById(R.id.str4).text = "" - binding.root.findViewById(R.id.str5).text = "" + //binding.root.findViewById(R.id.str1).text = "" + //binding.root.findViewById(R.id.str2).text = "" + //binding.root.findViewById(R.id.str3).text = "" + //binding.root.findViewById(R.id.str4).text = "" + //binding.root.findViewById(R.id.str5).text = "" val baseLevelValue = binding.root.findViewById(R.id.baselevel).text.toString() val statValue = binding.root.findViewById(R.id.stat).text.toString() val weaponAtkValue = binding.root.findViewById(R.id.weaponatk).text.toString() @@ -338,11 +338,6 @@ class TrainFragment : Fragment() { val max_raw_crit_damage: Double = max_raw_crit_damage_Calc(max_raw_damage) var accuracy = 0.0 var str0="" - var str1="" - var str2="" - var str3="" - var str4="" - var str5="" //An index variable for mobs[] @@ -409,7 +404,7 @@ class TrainFragment : Fragment() { }! """.trimIndent() - str3 = """ + str0+= """ ${ "⏱️ Average time to kill " + mobs.get(pos + 1).mob_name /*+ mobs.get(pos + 1) .getEmoji_code()*/ @@ -443,34 +438,34 @@ class TrainFragment : Fragment() { newpos ) if (new_max_damage >= 1 && !checked) { //if you can already deal damage to the next mob - str5 = + str0+= "💥 You can deal " + new_max_damage.toInt() + " max damage to " + mobs.get( newpos - ).mob_name /*+ mobs.get(newpos).getEmoji_code()*/ + "!" //part of output + ).mob_name /*+ mobs.get(newpos).getEmoji_code()*/ + "!\n" //part of output alrdealdamage = true } else if (new_max_damage > 1 && !alrdealdamage && !dealdamage) { //if you cant deal damage to the next mob yet, you can deal damage in a certain amount of stats! - str5 = + str0 += "💥 You can deal " + new_max_damage.toInt() + " max damage to " + mobs.get( newpos ).mob_name /*+ mobs.get(newpos) - .getEmoji_code()*/ + " in " + statadd + " stats!" //part of output + .getEmoji_code()*/ + " in " + statadd + " stats!\n" //part of output dealdamage = true } checked = true statadd++ } if (checknextmob) { - str1 = + str0+= """${"🔥 Max. Damage: " + max_damage.toInt() + " " /*+ */} Tickrate: ${tickrate.toInt()} / 3600 """ - str2 = """ + str0 += """ ${ "⏱️ Average time to kill " + mobs.get(pos).mob_name /*+ mobs.get(pos) .getEmoji_code()*/ }: ${time.toInt() / 60} min. ${time.toInt() % 60} sec. """.trimIndent() - str4 = """ + str0 += """ ${ "💪 You need $statadd stats to train effectively on " + mobs.get(newpos) .mob_name /*+ mobs.get(newpos).getEmoji_code()*/ @@ -478,10 +473,10 @@ class TrainFragment : Fragment() { """.trimIndent() } else { - str1 = + str0 += """${"⏬ Min. Damage (Auto): " + min_damage.toInt() + " " /*+ slime_lord_emoji*/} ⏫ Max. Damage (Auto): ${max_damage.toInt()} """ - str2 = """ + str0 += """ ${ "⏱️ Average time to kill " + mobs.get(pos).mob_name /*+ mobs.get(pos) .getEmoji_code()*/ @@ -490,23 +485,9 @@ class TrainFragment : Fragment() { """.trimIndent() } binding.root.findViewById(R.id.str0).text = str0 - binding.root.findViewById(R.id.str1).text = str1 - binding.root.findViewById(R.id.str2).text = str2 - binding.root.findViewById(R.id.str3).text = str3 - binding.root.findViewById(R.id.str4).text = str4 - binding.root.findViewById(R.id.str5).text = str5 } private fun ptrain(){ - val str0: String // You can power train effectively on... - - val str1: String // Max Damage... Tickrate... - - val str2: String // Average time to kill... - - var str3 = "" // You need... stats to train effectively on... - - var str4 = "" // You can deal... max damage to... - + var str0: String // You can power train effectively on... var classEmoji = "" val stat1 = binding.root.findViewById(R.id.stat).text.toString().toDouble() @@ -619,11 +600,11 @@ class TrainFragment : Fragment() { newpos ) if (new_max_damage >= 1 && !checked) { //if you can already deal damage to the next mob - str4 = + str0 += "💥 You can deal " + new_max_damage.toInt() + " max damage to " + mobs[newpos].mob_name /*+ mobs[newpos].getEmoji_code()*/ + "!" //part of output alrdealdamage = true } else if (new_max_damage > 1 && !alrdealdamage && !dealdamage) { //if you cant deal damage to the next mob yet, you can deal damage in a certain amount of stats! - str4 = + str0 += "🔥 You can deal " + new_max_damage.toInt() + " max damage to " + mobs[newpos].mob_name /*+ mobs[newpos].getEmoji_code()*/ + " in " + statadd + " stats!" //part of output dealdamage = true } @@ -635,35 +616,30 @@ class TrainFragment : Fragment() { //Building remaining Strings if (checknextmob) { - str1 = + str0 += """${"⏫Max. Damage: " + max_damage.toInt() + " • "} 💫 Tickrate: ${powertickrate.toInt()} / ${maxtickrate.toInt()} """ - str2 = + str0 += """ ${"⏱️ Average time to kill " + mobs[pos].mob_name /*+ mobs[pos].getEmoji_code()*/}: ${time.toInt() / 60} min. ${time.toInt() % 60} sec. """.trimIndent() - str3 = + str0 += """ ${"⏏️ You need " + statadd + " stats to power train effectively on " + mobs[newpos].mob_name /*+ mobs[newpos].getEmoji_code()*/}! """.trimIndent() } else { - str1 = + str0 += """${"⏬ Min. Damage (Auto): " + min_damage.toInt() + " • "} ⏫ Max. Damage (Auto): ${max_damage.toInt()} """ - str2 = + str0 += """ ${"⏱️ Average time to kill " + mobs[pos].mob_name /*+ mobs[pos].getEmoji_code()*/}: ${time.toInt() / 60} min. ${time.toInt() % 60} sec. """.trimIndent() } binding.root.findViewById(R.id.str0).text = str0 - binding.root.findViewById(R.id.str1).text = str1 - binding.root.findViewById(R.id.str2).text = str2 - binding.root.findViewById(R.id.str3).text = str3 - binding.root.findViewById(R.id.str4).text = str4 - binding.root.findViewById(R.id.str5).text = "" } @SuppressLint("SetTextI18n") diff --git a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainViewModel.kt b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainViewModel.kt index 1c2c503..322aaea 100644 --- a/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainViewModel.kt +++ b/src/app/src/main/java/com/helloyanis/rucoycalculator/ui/train/TrainViewModel.kt @@ -1,6 +1,7 @@ package com.helloyanis.rucoycalculator.ui.train import androidx.lifecycle.ViewModel +import kotlin.math.pow class TrainViewModel : ViewModel() { @@ -115,7 +116,7 @@ object Formulas { } fun exp_Calc(base: Double): Double { - return Math.pow(base, base / 1000 + 3) + return base.pow(base / 1000 + 3) } fun stat0to54_Calc(stat: Double): Double { diff --git a/src/app/src/main/res/drawable/stat_info.xml b/src/app/src/main/res/drawable/stat_info.xml new file mode 100644 index 0000000..974b2ec --- /dev/null +++ b/src/app/src/main/res/drawable/stat_info.xml @@ -0,0 +1,10 @@ + + + diff --git a/src/app/src/main/res/layout/skull.xml b/src/app/src/main/res/layout/skull.xml index 99ff261..c1b6fa1 100644 --- a/src/app/src/main/res/layout/skull.xml +++ b/src/app/src/main/res/layout/skull.xml @@ -5,94 +5,139 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/src/main/res/layout/train.xml b/src/app/src/main/res/layout/train.xml index d5c9ce9..48de749 100644 --- a/src/app/src/main/res/layout/train.xml +++ b/src/app/src/main/res/layout/train.xml @@ -17,47 +17,7 @@ android:layout_height="wrap_content" android:text="TextView" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/trainstylespinner" /> - - - - - - - - - - + app:layout_constraintTop_toBottomOf="@+id/classspinner" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/baselevellabel" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/statlabel" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/weaponatklabel" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tickhelp" /> + app:layout_constraintTop_toBottomOf="@+id/divider2" + app:layout_constraintTop_toTopOf="parent" />