game/lib/utils/item_utils.dart

81 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import '../game/enums.dart';
import '../game/config.dart';
class ItemUtils {
static Color getRarityColor(ItemRarity rarity) {
switch (rarity) {
case ItemRarity.normal:
return ThemeConfig.rarityNormal;
case ItemRarity.magic:
return ThemeConfig.rarityMagic;
case ItemRarity.rare:
return ThemeConfig.rarityRare;
case ItemRarity.legendary:
return ThemeConfig.rarityLegendary;
case ItemRarity.unique:
return ThemeConfig.rarityUnique;
}
}
static String getIconPath(EquipmentSlot slot) {
switch (slot) {
case EquipmentSlot.weapon:
return 'assets/images/icons/weapons/sword_02.png';
case EquipmentSlot.shield:
return 'assets/images/icons/subweapons/shield_01.png';
case EquipmentSlot.armor:
return 'assets/images/icons/armors/armor_02.png';
case EquipmentSlot.accessory:
return 'assets/images/icons/accessories/ring_02.png';
case EquipmentSlot.consumable:
return 'assets/images/icons/potions/potion_blue.png';
}
}
static String getSlotLabel(EquipmentSlot slot) {
switch (slot) {
case EquipmentSlot.weapon:
return 'MAIN';
case EquipmentSlot.shield:
return 'SUB';
case EquipmentSlot.armor:
return 'ARMOR';
case EquipmentSlot.accessory:
return 'ACCESSORY';
case EquipmentSlot.consumable:
return 'ITEM';
}
}
static String getSlotName(EquipmentSlot slot) {
switch (slot) {
case EquipmentSlot.weapon:
return 'Main Weapon';
case EquipmentSlot.shield:
return 'Subweapon';
case EquipmentSlot.armor:
return 'Armor';
case EquipmentSlot.accessory:
return 'Accessory';
case EquipmentSlot.consumable:
return 'Item';
}
}
static String getBorderPath(ItemRarity rarity) {
switch (rarity) {
case ItemRarity.normal:
return 'assets/images/icons/borders/border_000.png';
case ItemRarity.magic:
return 'assets/images/icons/borders/border_001.png';
case ItemRarity.rare:
return 'assets/images/icons/borders/border_004.png';
case ItemRarity.legendary:
return 'assets/images/icons/borders/border_005.png';
case ItemRarity.unique:
return 'assets/images/icons/borders/border_014.png';
}
}
}