Anonymous

Module:Constants: Difference between revisions

From Melvor Idle
Amend various functions for v1.0 data format
(fixed getSkillName with new formatting)
(Amend various functions for v1.0 data format)
Line 10: Line 10:
   ["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus", skills = {'Combat'} },
   ["MeleeStrengthBonus"] = { text = "{V}% Melee Strength Bonus", skills = {'Combat'} },
   ["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters", skills = {'Combat'} },
   ["DamageToDungeonMonsters"] = { text = "{V}% Damage To Dungeon Monsters", skills = {'Combat'} },
   ["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP", skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming', 'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility', 'Summoning'} }, -- TODO Astrology
   ["GlobalMasteryXP"] = { text = "{V}% Global Mastery XP", skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming', 'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility', 'Summoning', 'Astrology'} },
   ["ChanceRandomPotionHerblore"] = { text = "{V}% chance to gain a second potion of a random tier", skills = {'Herblore'} },
   ["ChanceRandomPotionHerblore"] = { text = "{V}% chance to gain a second potion of a random tier", skills = {'Herblore'} },
   ["FlatPrayerCostReduction"] = { text = "{V} Prayer Point Cost for Prayers", inverseSign = true, skills = {'Prayer'} },
   ["FlatPrayerCostReduction"] = { text = "{V} Prayer Point Cost for Prayers", inverseSign = true, skills = {'Prayer'} },
Line 276: Line 276:
   ["masteryToken"] = { text = "Grants Mastery Pool XP equal to {V}% of the maximum Mastery Pool XP for the respective skill",
   ["masteryToken"] = { text = "Grants Mastery Pool XP equal to {V}% of the maximum Mastery Pool XP for the respective skill",
     skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming',
     skills = {'Woodcutting', 'Fishing', 'Firemaking', 'Cooking', 'Mining', 'Smithing', 'Thieving', 'Farming',
             'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility', 'Summoning'} }, -- TODO Astrology
             'Fletching', 'Crafting', 'Runecrafting', 'Herblore', 'Agility', 'Summoning', 'Astrology'} },
   ["MinThievingGP"] = { text = "{V}% minimum GP from Thieving", skills = {'Thieving'} },
   ["MinThievingGP"] = { text = "{V}% minimum GP from Thieving", skills = {'Thieving'} },
   ["RunecraftingEssencePreservation"] = { text = "{V}% chance to preserve resources when Runecrafting runes", skills = {'Runecrafting'} },
   ["RunecraftingEssencePreservation"] = { text = "{V}% chance to preserve resources when Runecrafting runes", skills = {'Runecrafting'} },
Line 284: Line 284:
   ["AfflictionChance"] = { text = "{V}% chance to apply affliction when attacking", skills = {'Combat'} },
   ["AfflictionChance"] = { text = "{V}% chance to apply affliction when attacking", skills = {'Combat'} },
   ["allowLootContainerStacking"] = { text = "Items other than bones stack within the loot container", skills = {'Combat'} },
   ["allowLootContainerStacking"] = { text = "Items other than bones stack within the loot container", skills = {'Combat'} },
   ["BaseStardustDropQty"] = { text = "{V}% to base drop quantity of Stardust and Golden Stardust from Astrology", skills = {''} }, -- TODO Astrology
   ["BaseStardustDropQty"] = { text = "{V}% to base drop quantity of Stardust and Golden Stardust from Astrology", skills = {'Astrology'} },
   ["BleedReflectChance"] = { text = "{V}% chance to inflict a bleed that does 100% of the attack's damage to attackers when hit", skills = {'Combat'} },
   ["BleedReflectChance"] = { text = "{V}% chance to inflict a bleed that does 100% of the attack's damage to attackers when hit", skills = {'Combat'} },
   ["ChanceForDiamondFiremaking"] = { text = "{V}% chance to receive a Diamond per action in Firemaking (Cannot be doubled)", skills = {'Firemaking'} },
   ["ChanceForDiamondFiremaking"] = { text = "{V}% chance to receive a Diamond per action in Firemaking (Cannot be doubled)", skills = {'Firemaking'} },
Line 390: Line 390:


function p.getEquipmentSlotName(id)
function p.getEquipmentSlotName(id)
   for slotName, i in Shared.skpairs(ConstantData.equipmentSlot) do
   return type(id) == 'number' and ConstantData.equipmentSlot[id] or 'Invalid'
    if i == id then
      return slotName
    end
  end
  return 'Invalid'
end
end


Line 403: Line 398:


function p.getCombatStyleName(styleNum)
function p.getCombatStyleName(styleNum)
   for name, num in Shared.skpairs(ConstantData.attackType) do
   if type(styleNum) == 'number' then
    if num == styleNum then
  local styleName = ConstantData.attackType[styleNum]
      return name
  if styleName ~= nil then
    return Shared.titleCase(styleName)
     end
     end
   end
   end
Line 412: Line 408:


function p.getSlayerTierName(tier)
function p.getSlayerTierName(tier)
   for name, num in Shared.skpairs(ConstantData.slayerTier) do
   return type(tier) == 'number' and ConstantData.slayerTier[tier] or "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]"
    if num == tier then
      return name
    end
  end
  return "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]"
end
end