游戏melvor的个人平衡补丁
;((main) => {
const script = document.createElement('script')
script.textContent = `try { (${main})(); } catch (e) { console.log(e); }`
document.body.appendChild(script).parentNode.removeChild(script)
})(() => {
function hackSmith() {
startSmithing = function (clicked = false) {
if (!idleChecker(CONSTANTS.skill.Smithing)) {
if (selectedSmith !== null) {
if (clicked && isSmithing && currentSmith === selectedSmith) {
clearTimeout(smithingTimeout)
isSmithing = false
currentSmith = null
$('#skill-nav-name-5').removeClass('text-success')
smithingArtisanMenu.stopProgressBar()
clearOffline()
} else if (
skillLevel[CONSTANTS.skill.Smithing] >=
smithingItems[selectedSmith].level
) {
let item = smithingItems[selectedSmith].itemID
let smithCheck = checkSmithingReq(item)
if (!smithCheck) {
notifyPlayer(
CONSTANTS.skill.Smithing,
getLangString('TOASTS', 'MATERIALS_REQUIRED_TO_SMITH'),
'danger'
)
clearOffline()
} else {
if (
SETTINGS.general.pushNotificationOffline &&
(offline.skill === null ||
scheduledPushNotifications['offlineSkill'] === '')
)
sendPushNotification(
`offlineSkill`,
templateLangString('PUSH_NOTIFICATIONS', 'OFFLINE_CAP', {
username,
}),
64800000
)
game.activeSkill = ActiveSkills.OTHER
offline.skill = CONSTANTS.skill.Smithing
offline.action = selectedSmith
offline.timestamp = new Date().getTime()
saveData('offline')
isSmithing = true
currentSmith = selectedSmith
smithInterval = 500
smithInterval = calculateSkillInterval(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
$('#skill-nav-name-5').addClass('text-success')
smithingArtisanMenu.startProgressBar(smithInterval)
smithingTimeout = setTimeout(function () {
let smithCheck = checkSmithingReq(item)
if (!smithCheck) {
notifyPlayer(
CONSTANTS.skill.Smithing,
getLangString('TOASTS', 'MATERIALS_REQUIRED_TO_SMITH'),
'danger'
)
clearOffline()
} else {
let actionStat = SmithingStats.SmithingActions
let madeStat = SmithingStats.TotalItemsSmithed
let useStat = SmithingStats.BarsUsed
let preserveStat = SmithingStats.BarsPreserved
if (smithingItems[selectedSmith].smithingID < 9) {
actionStat = SmithingStats.SmeltingActions
madeStat = SmithingStats.TotalBarsSmelted
useStat = SmithingStats.OresUsed
preserveStat = SmithingStats.OresPreserved
}
let qtyToAdd = 1
if (
items[smithingItems[selectedSmith].itemID].smithingQty !=
undefined
)
qtyToAdd =
items[smithingItems[selectedSmith].itemID].smithingQty
if (
checkSummoningSynergyActive(
3,
17,
true,
getTimePerActionModifierMastery(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
) &&
rollPercentage(playerModifiers.summoningSynergy_3_17)
)
qtyToAdd++
let chanceToDouble = 0
chanceToDouble += calculateChanceToDouble(
CONSTANTS.skill.Smithing,
false,
0,
selectedSmith,
smithingItems[selectedSmith].itemID,
true,
smithInterval
)
if (rollPercentage(chanceToDouble)) qtyToAdd *= 2
if (
herbloreBonuses[11].bonus[0] === 0 &&
herbloreBonuses[11].charges > 0 &&
(smithingItems[selectedSmith].itemID ===
CONSTANTS.item.Silver_Bar ||
smithingItems[selectedSmith].itemID ===
CONSTANTS.item.Gold_Bar)
) {
if (
checkSummoningSynergyActive(
17,
18,
true,
getTimePerActionModifierMastery(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
)
)
qtyToAdd *= 2
}
let bankItem = addItemToBank(item, qtyToAdd)
if (!bankItem && !ignoreBankFull) startSmithing(true)
else {
let preserveChance = calculateSkillPreservationChance(
CONSTANTS.skill.Smithing,
smithingItems[selectedSmith].smithingID,
item,
true,
getTimePerActionModifierMastery(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
)
const preserveResources = rollPercentage(preserveChance)
if (preserveResources)
notifyPlayer(
CONSTANTS.skill.Smithing,
getLangString('MISC_STRING', '2'),
'info'
)
for (let i = 0; i < smithReqCheck.length; i++) {
const qtyToUse = getSmithingRecipeQty(
smithingItems[selectedSmith].itemID,
smithReqCheck[i].reqID,
false
)
if (preserveResources) {
game.stats.Smithing.add(useStat, qtyToUse)
} else {
updateItemInBank(
smithReqCheck[i].bankID,
items[item].smithReq[smithReqCheck[i].reqID].id,
-qtyToUse
)
game.stats.Smithing.add(preserveStat, qtyToUse)
}
}
if (
smithingItems[selectedSmith].itemID ===
CONSTANTS.item.Silver_Bar
) {
let goldQty = 1
if (
checkSummoningSynergyActive(
17,
18,
false,
getTimePerActionModifierMastery(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
)
)
goldQty *= 2
if (
rollPercentage(
playerModifiers.increasedSeeingGoldChance -
playerModifiers.decreasedSeeingGoldChance
)
) {
addItemToBank(CONSTANTS.item.Gold_Bar, goldQty)
game.stats.Smithing.add(
SmithingStats.TotalBarsSmelted,
goldQty
)
}
if (
herbloreBonuses[11].bonus[0] === 0 &&
herbloreBonuses[11].charges > 0
)
updateHerbloreBonuses(herbloreBonuses[11].itemID)
}
let xpToAdd = items[item].smithingXP
if (
playerModifiers.summoningSynergy_17_19 > 0 &&
smithingRecipeContainsItem(item, CONSTANTS.item.Coal_Ore)
)
checkSummoningSynergyActive(
17,
19,
true,
getTimePerActionModifierMastery(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
)
else
checkSummoningSynergyActive(
10,
17,
true,
getTimePerActionModifierMastery(
CONSTANTS.skill.Smithing,
smithInterval,
smithingItems[selectedSmith].smithingID
)
)
addXP(CONSTANTS.skill.Smithing, xpToAdd)
removeGloveCharge(CONSTANTS.shop.gloves.Smithing)
addMasteryXP(
CONSTANTS.skill.Smithing,
smithingItems[selectedSmith].smithingID,
smithInterval
)
rollForPet(5, smithInterval)
rollForPet(
21,
smithInterval *
(1 +
getMasteryPoolProgress(CONSTANTS.skill.Smithing) /
100),
false,
CONSTANTS.skill.Smithing
)
game.stats.Smithing.inc(actionStat)
game.stats.Smithing.add(madeStat, qtyToAdd)
dropRingHalfA(smithingItems[selectedSmith].level)
rollAllPossibleSummoningMarks(
CONSTANTS.skill.Smithing,
smithInterval
)
game.stats.Smithing.add(
SmithingStats.TimeSpent,
smithInterval
)
updateSkillWindow(CONSTANTS.skill.Smithing)
updateTutorialTaskProgress(
{
itemID: item,
qty: qtyToAdd,
},
{},
{}
)
isSmithing = false
$('#skill-nav-name-5').removeClass('text-success')
updateSmithingChances(selectedSmith)
startSmithing()
}
}
}, smithInterval)
}
}
}
}
}
}
window.hackInstalled = false;
function hackGame() {
if (!window.hackInstalled && game && items && trees && Firemaking && agilityObstacles && AstrologyDefaults) {
hackGame = function () {}
//装备: 近战武器攻击间隔减少到60%
alert(1111)
window.hackInstalled = true;
items
.filter((t) => t.category == 'Combat' && t.type == 'Weapon')
.forEach((t) => {
let stats = t.equipmentStats.filter((n) => n.key == 'attackSpeed')
if (stats.length) {
stats[0].value = Math.floor(stats[0].value * 0.7)
}
})
//装备: 远程武器攻击间隔减少到60%
items
.filter((t) => t.category == 'Combat' && t.type == 'Ranged Weapon')
.forEach((t) => {
let stats = t.equipmentStats.filter((n) => n.key == 'attackSpeed')
if (stats.length) {
stats[0].value = Math.floor(stats[0].value * 0.7)
}
})
//装备: 魔法武器
// items.filter(t=>t.category== 'Combat' && (t.type=='Magic Wand' || t.type=='Magic Staff'))
//砍树
trees.forEach((n, i) => (n.interval = 1000))
// 钓鱼
items
.filter((t) => t.category == 'Fishing')
.forEach((t) => {
t.maxFishingInterval = 1200
t.minFishingInterval = 700
})
//生火
Firemaking.recipes.forEach((t) => (t.baseInterval = 1000))
//烹饪
items
.filter((t) => t.category == 'Cooking')
.forEach((t) => {
t.cookingInterval = 1000
})
//采矿
game.mining.baseInterval = 1000
//锻造
hackSmith()
//盗窃
game.thieving.baseInterval = 1000
//农务
//弓匠
//制造
//符文锻造
//草药
//灵巧
agilityObstacles.forEach((t) => {
t.interval = 1000
})
//召唤
items
.filter((t) => t.category == 'Summoning' && t.type == 'Familiar')
.forEach((t) => {
t.summoningQty = 250
t.summoningXP = 5
})
//星象
AstrologyDefaults.interval = 500
AstrologyDefaults.goldenStardustChance = 7
AstrologyDefaults.stardustChance = 7
//生火魔法
}
else if(!window.hackInstalled){
hackGame()
}
}
setTimeout(hackGame, 5000)
})