mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-15 06:50:31 +01:00
rewrite random loot
This commit is contained in:
parent
f593baf868
commit
cd13872ed8
|
@ -172,7 +172,7 @@ local FISHING_BOBBER_ENTITY={
|
|||
self.prize = fishing_setting.prizes["fish"][math.random(1,#fishing_setting.prizes["fish"])]
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
self.prize = fishing_setting.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
|
||||
self.prize = fishing_setting.func.get_loot()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -167,19 +167,16 @@ local FISHING_BOBBER_SHARK_ENTITY={
|
|||
|
||||
self.randomtime = math.random(1,5)*10
|
||||
local chance = math.random(1, 100)
|
||||
--if 1 you catch a treasure, maybe ...
|
||||
--if 1 you catch a treasure
|
||||
if chance == 1 then
|
||||
--You are lucky ? :)
|
||||
if math.random(1, 100) <= fishing_setting.settings["treasure_chance"] and fishing_setting.settings["treasure_enable"] then
|
||||
self.prize = fishing_setting.prizes["treasure"][math.random(1,#fishing_setting.prizes["treasure"])]
|
||||
else
|
||||
self.prize = fishing_setting.prizes["stuff"][math.random(1,#fishing_setting.prizes["stuff"])]
|
||||
end
|
||||
elseif chance <= fishing_setting.settings["fish_chance"] then
|
||||
self.prize = fishing_setting.prizes["shark"][math.random(1,#fishing_setting.prizes["shark"])]
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
self.prize = fishing_setting.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
|
||||
self.prize = fishing_setting.func.get_loot()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -107,6 +107,22 @@ function fishing_setting.func.hungry_random()
|
|||
end
|
||||
|
||||
|
||||
|
||||
function fishing_setting.func.get_loot()
|
||||
local c = math.random(1, 67)
|
||||
for i in pairs(fishing_setting.prizes["stuff"]) do
|
||||
local min = fishing_setting.prizes["stuff"][i][5]
|
||||
local chance = fishing_setting.prizes["stuff"][i][6]
|
||||
local max = min + chance - 1
|
||||
if c <= max and c >= min then
|
||||
return fishing_setting.prizes["stuff"][i]
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Show notification when a player catches treasure
|
||||
function fishing_setting.func.notify(f_name, treasure)
|
||||
local title = fishing_setting.func.S("Lucky %s, he caught the treasure, %s!"):format(f_name, treasure[4])
|
||||
|
|
|
@ -12,27 +12,27 @@ fishing_setting.prizes["shark"] = {
|
|||
}
|
||||
|
||||
|
||||
-- Here's what you can prizes
|
||||
local plants = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..)
|
||||
{"default", "stick", 0, "a Twig."},
|
||||
{"mobs", "rat", 0, "a Rat."},
|
||||
{"flowers", "seaweed", 0, "some Seaweed."},
|
||||
{"seaplants", "kelpgreen", 0, "a Green Kelp."},
|
||||
{"farming", "string", 0, "a String."},
|
||||
{"trunks", "twig_1", 0, "a Twig."}
|
||||
}
|
||||
fishing_setting.prizes["plants"] = fishing_setting.func.ignore_mod(plants)
|
||||
|
||||
local stuff = {
|
||||
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole."},
|
||||
{"3d_armor", "boots_wood", "random", "some very old Boots."},
|
||||
{"maptools", "gold_coin", 0, "a Gold Coin."},
|
||||
{"3d_armor", "helmet_diamond", "random", "a very old Helmet."},
|
||||
{"shields", "shield_enhanced_cactus", "random", "a very old Shield."},
|
||||
{"default", "sword_bronze", "random", "a very old Sword."},
|
||||
{"default", "sword_mese", "random", "a very old Sword."},
|
||||
{"default", "sword_nyan", "random", "a very old Sword."}
|
||||
-- mod item wear message ("You caught "..) nrmin chance (1/67)
|
||||
{"flowers", "seaweed", 0, "some Seaweed.", 1, 5},
|
||||
{"farming", "string", 0, "a String.", 6, 5},
|
||||
{"trunks", "twig_1", 0, "a Twig.", 11, 5},
|
||||
{"mobs", "rat", 0, "a Rat.", 16, 5},
|
||||
{"default", "stick", 0, "a Twig.", 21, 5},
|
||||
{"seaplants", "kelpgreen", 0, "a Green Kelp.", 26, 5},
|
||||
{"3d_armor", "boots_steel", "random", "some very old Boots.", 31, 2},
|
||||
{"3d_armor", "leggings_gold", "random", "some very old Leggings.", 33, 5},
|
||||
{"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 38, 5},
|
||||
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 43, 10},
|
||||
{"3d_armor", "boots_wood", "random", "some very old Boots.", 53, 5},
|
||||
{"maptools", "gold_coin", 0, "a Gold Coin.", 58, 1},
|
||||
{"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 59, 1},
|
||||
{"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 60, 2},
|
||||
{"default", "sword_bronze", "random", "a very old Sword.", 62, 2},
|
||||
{"default", "sword_mese", "random", "a very old Sword.", 64, 2},
|
||||
{"default", "sword_nyan", "random", "a very old Sword.", 66, 2},
|
||||
-- nom mod nom item durabilité message dans le chat -- fin 67
|
||||
-- de l'objet
|
||||
}
|
||||
fishing_setting.prizes["stuff"] = fishing_setting.func.ignore_mod(stuff)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user