Skip to content

Commit

Permalink
V5! Material you and other things
Browse files Browse the repository at this point in the history
  • Loading branch information
helloyanis committed Oct 17, 2023
1 parent 1e506e8 commit f0c3722
Show file tree
Hide file tree
Showing 15 changed files with 303 additions and 239 deletions.
9 changes: 8 additions & 1 deletion src/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 8
versionName = "4.4"
versionName = "5"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -36,7 +36,12 @@ android {
}
buildFeatures {
viewBinding = true
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.0"
}

}

dependencies {
Expand All @@ -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")

}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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<TextView>(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<TextView>(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<TextView>(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<TextView>(R.id.blackskullvalue).text = str4 + "G needed"
binding.root.findViewById<TextView>(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<TextView>(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<TextView>(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<TextView>(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<TextView>(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<TextView>(R.id.blackskullvalue).text = String.format(
"%,.0f",
double*6000
) + "G needed\n" + String.format(
"%,.0f",
double*4050
)+ "G lost from death by player."

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ class TrainFragment : Fragment() {

private fun updateoutput(){
binding.root.findViewById<TextView>(R.id.str0).text = ""
binding.root.findViewById<TextView>(R.id.str1).text = ""
binding.root.findViewById<TextView>(R.id.str2).text = ""
binding.root.findViewById<TextView>(R.id.str3).text = ""
binding.root.findViewById<TextView>(R.id.str4).text = ""
binding.root.findViewById<TextView>(R.id.str5).text = ""
//binding.root.findViewById<TextView>(R.id.str1).text = ""
//binding.root.findViewById<TextView>(R.id.str2).text = ""
//binding.root.findViewById<TextView>(R.id.str3).text = ""
//binding.root.findViewById<TextView>(R.id.str4).text = ""
//binding.root.findViewById<TextView>(R.id.str5).text = ""
val baseLevelValue = binding.root.findViewById<EditText>(R.id.baselevel).text.toString()
val statValue = binding.root.findViewById<EditText>(R.id.stat).text.toString()
val weaponAtkValue = binding.root.findViewById<EditText>(R.id.weaponatk).text.toString()
Expand Down Expand Up @@ -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[]

Expand Down Expand Up @@ -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()*/
Expand Down Expand Up @@ -443,45 +438,45 @@ 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()*/
}!
""".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()*/
Expand All @@ -490,23 +485,9 @@ class TrainFragment : Fragment() {
""".trimIndent()
}
binding.root.findViewById<TextView>(R.id.str0).text = str0
binding.root.findViewById<TextView>(R.id.str1).text = str1
binding.root.findViewById<TextView>(R.id.str2).text = str2
binding.root.findViewById<TextView>(R.id.str3).text = str3
binding.root.findViewById<TextView>(R.id.str4).text = str4
binding.root.findViewById<TextView>(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<EditText>(R.id.stat).text.toString().toDouble()
Expand Down Expand Up @@ -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
}
Expand All @@ -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<TextView>(R.id.str0).text = str0
binding.root.findViewById<TextView>(R.id.str1).text = str1
binding.root.findViewById<TextView>(R.id.str2).text = str2
binding.root.findViewById<TextView>(R.id.str3).text = str3
binding.root.findViewById<TextView>(R.id.str4).text = str4
binding.root.findViewById<TextView>(R.id.str5).text = ""
}

@SuppressLint("SetTextI18n")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.helloyanis.rucoycalculator.ui.train

import androidx.lifecycle.ViewModel
import kotlin.math.pow

class TrainViewModel : ViewModel() {

Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions src/app/src/main/res/drawable/stat_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M80,760L80,680L480,680L480,760L80,760ZM80,560L80,480L280,480L280,560L80,560ZM80,360L80,280L280,280L280,360L80,360ZM824,760L670,606Q646,623 617.5,631.5Q589,640 560,640Q477,640 418.5,581.5Q360,523 360,440Q360,357 418.5,298.5Q477,240 560,240Q643,240 701.5,298.5Q760,357 760,440Q760,469 751.5,497.5Q743,526 726,550L880,704L824,760ZM560,560Q610,560 645,525Q680,490 680,440Q680,390 645,355Q610,320 560,320Q510,320 475,355Q440,390 440,440Q440,490 475,525Q510,560 560,560Z"/>
</vector>
Loading

0 comments on commit f0c3722

Please sign in to comment.