Skip to content

Commit

Permalink
chore: Update to the 1.81 Wakfu version
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlyRien committed Oct 4, 2023
1 parent 61a5994 commit 5b5e4d6
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 106 deletions.
18 changes: 1 addition & 17 deletions autobuilder/src/main/kotlin/me/chosante/autobuilder/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds

private val logger = KotlinLogging.logger {}
const val VERSION = "1.80.1.11"
const val VERSION = "1.81.1.13"

fun main(args: Array<String>) = WakfuAutobuild().main(args)

Expand Down Expand Up @@ -164,13 +164,6 @@ class WakfuAutobuild :
.splitPair(delimiter = ":")
.toTargetStat(MASTERY_CRITICAL)

private val masteryZoneWanted: TargetStat? by option(
names = arrayOf("--mastery-zone", "--maitrise-zone"),
help = "Number of zone mastery wanted. $additionalHelpOnStats"
)
.splitPair(delimiter = ":")
.toTargetStat(MASTERY_ZONE)

private val masteryWaterWanted: TargetStat? by option(
names = arrayOf("--mastery-water", "--maitrise-eau"),
help = "Number of water mastery wanted. $additionalHelpOnStats"
Expand Down Expand Up @@ -339,13 +332,6 @@ class WakfuAutobuild :
.splitPair(delimiter = ":")
.toTargetStat(MASTERY_DISTANCE)

private val masterySingleTargetWanted: TargetStat? by option(
names = arrayOf("--mastery-single-target", "--maitrise-monocible"),
help = "Number of single target mastery wanted. $additionalHelpOnStats"
)
.splitPair(delimiter = ":")
.toTargetStat(MASTERY_SINGLE_TARGET)

private val hpWanted: TargetStat? by option(
names = arrayOf("--hp", "--pdv", "--health-points", "--points-de-vie"),
help = "Number of health points wanted. $additionalHelpOnStats"
Expand Down Expand Up @@ -395,13 +381,11 @@ class WakfuAutobuild :
masteryFireWanted,
masteryWaterWanted,
masteryWindWanted,
masteryZoneWanted,
masteryMeleeWanted,
masteryBerserkWanted,
masteryHealingWanted,
masteryBackWanted,
masteryCriticalWanted,
masterySingleTargetWanted,
masteryDistanceWanted,
resistanceCriticalWanted,
resistanceBackWanted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ import me.chosante.autobuilder.domain.skills.StrengthCharacteristic.Hp
import me.chosante.autobuilder.domain.skills.StrengthCharacteristic.MasteryDistance
import me.chosante.autobuilder.domain.skills.StrengthCharacteristic.MasteryElementary
import me.chosante.autobuilder.domain.skills.StrengthCharacteristic.MasteryMelee
import me.chosante.autobuilder.domain.skills.StrengthCharacteristic.MasterySingleTarget
import me.chosante.autobuilder.domain.skills.StrengthCharacteristic.MasteryZone

data class Strength(
override val maxPointsToAssign: Int,
val masteryElementary: MasteryElementary = MasteryElementary(0),
val masterySingleTarget: MasterySingleTarget = MasterySingleTarget(0),
val masteryZone: MasteryZone = MasteryZone(0),
val masteryMelee: MasteryMelee = MasteryMelee(0),
val masteryDistance: MasteryDistance = MasteryDistance(0),
val hp: Hp = Hp(0)
Expand All @@ -27,10 +23,8 @@ data class Strength(
override fun getCharacteristics(): List<SkillCharacteristic> {
return listOf(
masteryElementary,
masteryZone,
masteryMelee,
masteryDistance,
masterySingleTarget,
hp
)
}
Expand Down Expand Up @@ -58,40 +52,20 @@ sealed class StrengthCharacteristic(
name = "Mastery Elementary"
)

class MasterySingleTarget(pointsAssigned: Int) :
StrengthCharacteristic(
pointsAssigned = pointsAssigned,
maxPointsAssignable = 20,
unitValue = 8,
unitType = UnitType.FIXED,
characteristic = Characteristic.MASTERY_SINGLE_TARGET,
name = "Mastery Single Target"
)

class MasteryDistance(pointsAssigned: Int) :
StrengthCharacteristic(
pointsAssigned = pointsAssigned,
maxPointsAssignable = 20,
maxPointsAssignable = 40,
unitValue = 8,
unitType = UnitType.FIXED,
characteristic = Characteristic.MASTERY_DISTANCE,
name = "Mastery Distance"
)

class MasteryZone(pointsAssigned: Int) :
StrengthCharacteristic(
pointsAssigned = pointsAssigned,
maxPointsAssignable = 20,
unitValue = 8,
unitType = UnitType.FIXED,
characteristic = Characteristic.MASTERY_ZONE,
name = "Mastery Zone"
)

class MasteryMelee(pointsAssigned: Int) :
StrengthCharacteristic(
pointsAssigned = pointsAssigned,
maxPointsAssignable = 20,
maxPointsAssignable = 40,
unitValue = 8,
unitType = UnitType.FIXED,
characteristic = Characteristic.MASTERY_MELEE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ fun computeCharacteristicsValues(
eachCharacteristicValueLineByEquipment
.mapValues { (_, values) -> values.sum() }

val numberOfSetWith4ElementsOrMore = buildCombination.equipments
.filter { it.level <= 35 && it.equipmentSetId !in listOf(0, 568, 567, 569) }
.groupingBy { it.equipmentSetId }
.eachCount()
.count { it.value >= 4 }

val edgeCasesCharacteristicsGivenByEquipment = mapOf(
Characteristic.ACTION_POINT to (characteristicsGivenByEquipmentCombination[Characteristic.MAX_ACTION_POINT]
?: 0),
Expand All @@ -100,7 +94,6 @@ fun computeCharacteristicsValues(
characteristicGivenBySkillsFixedValues,
edgeCasesCharacteristicsGivenByEquipment,
characterBaseCharacteristics,
mapOf(Characteristic.ACTION_POINT to numberOfSetWith4ElementsOrMore)
)

val actualCharacteristics = sumOfCharacteristicFixedValues.mapValues { (key, value) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ object WakfuBestBuildFinderAlgorithm {
}

return try {
val mutationProbability = 0.07
val numberOfIndividualsInPopulation = 50000
val mutationProbability = 0.02
val numberOfIndividualsInPopulation = 5000
val isLowLevel = params.character.level <= 35
GeneticAlgorithm(
population = generateRandomPopulations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ private fun SkillCharacteristic.toZenithWakfuAptitudeId(): Int {
is IntelligenceCharacteristic.HealReceivedPercentage -> 4
is IntelligenceCharacteristic.HpPercentageAsArmor -> 5
is StrengthCharacteristic.MasteryElementary -> 6
is StrengthCharacteristic.MasterySingleTarget -> 7
is StrengthCharacteristic.MasteryZone -> 8
is StrengthCharacteristic.MasteryMelee -> 9
is StrengthCharacteristic.MasteryDistance -> 10
is StrengthCharacteristic.Hp -> 11
Expand Down
1 change: 0 additions & 1 deletion autobuilder/src/main/resources/equipments-v1.80.1.11.json

This file was deleted.

1 change: 1 addition & 0 deletions autobuilder/src/main/resources/equipments-v1.81.1.13.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import me.chosante.common.Characteristic.MASTERY_ELEMENTARY_FIRE
import me.chosante.common.Characteristic.MASTERY_ELEMENTARY_WATER
import me.chosante.common.Characteristic.MASTERY_ELEMENTARY_WIND
import me.chosante.common.Characteristic.MASTERY_HEALING
import me.chosante.common.Characteristic.MASTERY_SINGLE_TARGET
import me.chosante.common.Characteristic.MASTERY_ZONE
import me.chosante.common.Characteristic.MOVEMENT_POINT
import me.chosante.common.Characteristic.RANGE
import me.chosante.common.Characteristic.RESISTANCE_ELEMENTARY
Expand Down Expand Up @@ -102,7 +100,6 @@ class ScoringTest {
characteristics = mapOf(
ACTION_POINT to 1,
HP to 115,
MASTERY_SINGLE_TARGET to 30,
MASTERY_DISTANCE to 30,
CRITICAL_HIT to 3
)
Expand All @@ -112,7 +109,6 @@ class ScoringTest {
ACTION_POINT to 1,
HP to 118,
DODGE to 20,
MASTERY_ZONE to 25,
MASTERY_DISTANCE to 25,
CRITICAL_HIT to 7
)
Expand All @@ -136,7 +132,6 @@ class ScoringTest {
), equipment(
characteristics = mapOf(
MASTERY_DISTANCE to 20,
MASTERY_SINGLE_TARGET to 20,
MASTERY_BACK to -20,
HP to 98,
CRITICAL_HIT to 2,
Expand Down Expand Up @@ -167,11 +162,9 @@ class ScoringTest {
HP to 5020,
CRITICAL_HIT to 45,
MASTERY_DISTANCE to 634,
MASTERY_ZONE to 25,
DODGE to 55,
LOCK to -40,
CONTROL to 2,
MASTERY_SINGLE_TARGET to 50,
MASTERY_ELEMENTARY to 10,
MASTERY_BACK to -20
)
Expand All @@ -192,7 +185,6 @@ class ScoringTest {
equipment(
name = "Casque Bouftou Impérial",
level = 17,
equipmentSetId = 1,
characteristics = mapOf(
INITIATIVE to 6,
HP to 20,
Expand All @@ -203,7 +195,6 @@ class ScoringTest {
equipment(
name = "Amulette du Piou Royal",
level = 32,
equipmentSetId = 2,
characteristics = mapOf(
DODGE to 10,
HP to 30,
Expand All @@ -214,7 +205,6 @@ class ScoringTest {
equipment(
name = "Plastron Bouftou Impérial",
level = 20,
equipmentSetId = 1,
characteristics = mapOf(
CONTROL to 1,
HP to 20,
Expand All @@ -225,7 +215,6 @@ class ScoringTest {
equipment(
name = "Anneau Bouftou Impérial",
level = 17,
equipmentSetId = 1,
characteristics = mapOf(
HP to 12,
MASTERY_ELEMENTARY to 8,
Expand All @@ -234,7 +223,6 @@ class ScoringTest {
equipment(
name = "Anneau de Satisfaction",
level = 20,
equipmentSetId = 0,
characteristics = mapOf(
HP to -50,
ACTION_POINT to 1,
Expand All @@ -244,7 +232,6 @@ class ScoringTest {
equipment(
name = "Pantoufle Piou Royal",
level = 30,
equipmentSetId = 2,
characteristics = mapOf(
MASTERY_HEALING to 15,
HP to 22,
Expand All @@ -255,7 +242,6 @@ class ScoringTest {
equipment(
name = "Kapioutte Royale",
level = 30,
equipmentSetId = 2,
characteristics = mapOf(
CRITICAL_HIT to 4,
HP to 24,
Expand All @@ -266,7 +252,6 @@ class ScoringTest {
equipment(
name = "Epaulettes Bouftou Impérial",
level = 19,
equipmentSetId = 1,
characteristics = mapOf(
HP to 15,
DODGE to 7,
Expand All @@ -276,7 +261,6 @@ class ScoringTest {
), equipment(
name = "Cordon du Piou Royal",
level = 32,
equipmentSetId = 2,
characteristics = mapOf(
HP to 28,
DODGE to 10,
Expand Down Expand Up @@ -388,13 +372,11 @@ class ScoringTest {

private fun equipment(
name: String = "name",
equipmentSetId: Int = 0,
level: Int = 100,
characteristics: Map<Characteristic, Int>
) =
Equipment(
equipmentId = 0,
equipmentSetId = equipmentSetId,
level = level,
name = name,
rarity = Rarity.RARE,
Expand Down
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.0" apply false
kotlin("plugin.serialization") version "1.9.0" apply false
kotlin("jvm") version "1.9.10" apply false
kotlin("plugin.serialization") version "1.9.10" apply false
}
3 changes: 0 additions & 3 deletions common-lib/src/main/kotlin/me/chosante/common/Equipment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ enum class ItemType {
@Serializable
data class Equipment(
val equipmentId: Int,
val equipmentSetId: Int,
val level: Int,
val name: String,
val rarity: Rarity,
Expand All @@ -46,7 +45,6 @@ data class Equipment(

@Serializable
enum class Characteristic {
MASTERY_ZONE,
MASTERY_ELEMENTARY,
MASTERY_ELEMENTARY_ONE_RANDOM_ELEMENT,
MASTERY_ELEMENTARY_TWO_RANDOM_ELEMENT,
Expand All @@ -61,7 +59,6 @@ enum class Characteristic {
MASTERY_MELEE,
MASTERY_BERSERK,
MASTERY_HEALING,
MASTERY_SINGLE_TARGET,
RESISTANCE_CRITICAL,
RESISTANCE_BACK,
RESISTANCE_ELEMENTARY,
Expand Down
2 changes: 1 addition & 1 deletion equipments-extractor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repositories {
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation(platform("org.junit:junit-bom:5.9.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
implementation("com.github.kittinunf.fuel:fuel-coroutines:2.3.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ fun extractData(wakfuData: WakfuData): List<Equipment> {
val rarity = rarityIdToRarity.getValue(equipment.definition.item.baseParameters.rarity)

val itemTypeId = equipment.definition.item.baseParameters.itemTypeId
val itemSetId = equipment.definition.item.baseParameters.itemSetId
val itemType: ItemType = itemTypeIdToTypeName[itemTypeId] ?: continue

if (itemType == ItemType.MOUNTS) {
Expand Down Expand Up @@ -170,7 +169,6 @@ fun extractData(wakfuData: WakfuData): List<Equipment> {

val outputDict = Equipment(
equipmentId = itemId,
equipmentSetId = itemSetId,
level = level,
name = name,
rarity = rarity,
Expand All @@ -189,7 +187,6 @@ private fun String.toCharacteristic(): Pair<Characteristic, Int> {
val value = match.groupValues[1].toInt()
val characteristic = when (val statName = match.groupValues[2].trim()) {
"Quantité Récolte Herboriste" -> Characteristic.HERBALIST_HARVEST_QUANTITY_PERCENTAGE
"Maîtrise Zone" -> Characteristic.MASTERY_ZONE
"PA max" -> Characteristic.MAX_ACTION_POINT
"Quantité Récolte Mineur" -> Characteristic.MINER_HARVEST_QUANTITY_PERCENTAGE
"Esquive" -> Characteristic.DODGE
Expand Down Expand Up @@ -219,7 +216,6 @@ private fun String.toCharacteristic(): Pair<Characteristic, Int> {
"Résistance Critique" -> Characteristic.RESISTANCE_CRITICAL
"Résistance Élémentaire", "Résistance élémentaire" -> Characteristic.RESISTANCE_ELEMENTARY
"Initiative" -> Characteristic.INITIATIVE
"Maîtrise Monocible" -> Characteristic.MASTERY_SINGLE_TARGET
"Maîtrise Soin" -> Characteristic.MASTERY_HEALING
"Portée" -> Characteristic.RANGE
"Quantité Récolte Pêcheur" -> Characteristic.FISHERMAN_HARVEST_QUANTITY_PERCENTAGE
Expand All @@ -228,7 +224,7 @@ private fun String.toCharacteristic(): Pair<Characteristic, Int> {
"Maîtrise Berserk" -> Characteristic.MASTERY_BERSERK
"Quantité Récolte Forestier" -> Characteristic.LUMBERJACK_HARVEST_QUANTITY_PERCENTAGE
"Armure reçue" -> Characteristic.RECEIVED_ARMOR_PERCENTAGE
"Coup Critique" -> Characteristic.CRITICAL_HIT
"Coup critique" -> Characteristic.CRITICAL_HIT
"Points de Vie" -> Characteristic.HP
"Maîtrise Élémentaire" -> Characteristic.MASTERY_ELEMENTARY
"Volonté" -> Characteristic.WILLPOWER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package me.chosante.equipmentextractor
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.json.Json
import me.chosante.common.Equipment
import me.chosante.equipmentextractor.dataretriever.getWakfuFilesLatestVersion
import me.chosante.equipmentextractor.dataretriever.getWakfuRawData
import me.chosante.equipmentextractor.dataretriever.wakfuAPILatestVersion
import java.io.File

suspend fun main() {
val latestWakfuVersion = getWakfuFilesLatestVersion().version
val latestWakfuVersion = wakfuAPILatestVersion()
val wakfuRawData = getWakfuRawData(latestWakfuVersion)
val equipments = extractData(wakfuRawData)
File("autobuilder/src/main/resources","equipments-v$latestWakfuVersion.json")
Expand Down
Loading

0 comments on commit 5b5e4d6

Please sign in to comment.