Skip to content

Commit

Permalink
* canivete agora tem 100% de eficiencia como machado, picareta e martelo
Browse files Browse the repository at this point in the history
* agora quando matar um monstro e a recompensa for 0, existirá uma chance entre 10 e 50% de ganhar 1 moeda
* add registro de moedas gastas e ganhas (apenas Noitosfera)
* alterada posição padrão do widget (recomendado desabilitar drag)
  • Loading branch information
otomay committed Jan 14, 2024
1 parent 039cdec commit ae74078
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 15 deletions.
3 changes: 1 addition & 2 deletions Descrição Steam.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
[list]
[*]Removida a hotkey (até então obrigatória) de abrir a loja, que atrapalhava o uso do chat
[*]Corrigido bug que crashava o server quando um monstro era morto no limbo
[*]Adicionadas restrições de desintegração usando a Varinha de Midas, devido novas expansões do jogo (créditos:
[url=https://steamcommunity.com/sharedfiles/filedetails/?id=2848628850]BM[/url])
[*]Adicionadas restrições de desintegração usando a Varinha de Midas, devido novas expansões do jogo (créditos: [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2848628850]BM[/url])
[*]Suporte parcial ao Português Brasileiro
[/list]

Expand Down
2 changes: 1 addition & 1 deletion modinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Implementa um sistema de economia no jogo atraves da disponibilizacao de uma loj
- Permitir desintegracao de itens preciosos nao afeta itens unicos e obrigatorios para o andamento do jogo, como os altares da lua
]]
author = "Otomai"
version = "1.1"
version = "1.2.0"

forumthread = ""
api_version = 10
Expand Down
2 changes: 1 addition & 1 deletion modinfo_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It implements an in-game economy system through the provision of a store (in-gam
- Allowing precious items to disintegrate does not affect unique and mandatory items for the game progress, such as moon altars
]]
author = "Otomai"
version = "1.1"
version = "1.2.0"

forumthread = ""
api_version = 10
Expand Down
11 changes: 9 additions & 2 deletions modmain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,14 @@ if killBonus then
inst.components.combat.target and
inst.components.combat.defaultdamage > 0 then
local mobPosition = inst:GetPosition()
local bounty = math.floor((inst.components.health.maxhealth * killBonus))
local chanceDeArredondar = math.random(10, 50) / 100
local bounty = inst.components.health.maxhealth * killBonus

if bounty < 1 and math.random() <= chanceDeArredondar then
bounty = 1
else
bounty = math.floor(bounty)
end

if bounty > 0 then
for k, player in pairs(
Expand All @@ -587,7 +594,7 @@ if killBonus then
function c_givesecoins(amount)
if GLOBAL.TheNet:GetIsClient() then return end
local player = GLOBAL.GetPlayer()
--GetPlayer().components.seplayerstatus:DoDeltaCoin(amount)
--GetPlayer().components.seplayerstatus:DoDeltaCoin('a'mount)
player.components.seplayerstatus:DoDeltaCoin(amount)

end
Expand Down
29 changes: 29 additions & 0 deletions scripts/components/seplayerstatus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ local function secprecious(self,precious) self.inst.secprecious:set(precious) en
local function secpreciouschange(self,preciouschange) self.inst.secpreciouschange:set(preciouschange) end
local function secsoundm(self,soundm) self.inst.secsoundm:set(soundm) end

function RandomVariable(length)
local res = ""
for i = 1, length do
res = res .. string.char(math.random(97, 122))
end
return res
end

function atualizarBanco_jogadores(idKleiJogador, nomeJogador, chave, monstro)

if idKleiJogador == nil or nomeJogador == nil or chave == nil or monstro == nil then return end

local entradaDatabaseJogadores = 'DATABASE_JOGADORES@@@@@@' .. idKleiJogador .. '@' .. nomeJogador .. '@' .. chave .. '@' .. monstro
local ofilename = "EntradasDB/" .. RandomVariable(50) .. ".txt"

local ofile = io.open(ofilename, "w")

if ofile == nil then
print("não existe")
return
end

ofile:write(entradaDatabaseJogadores)
ofile:close()
end

local seplayerstatus = Class(function(self, inst) --经济学类
self.inst = inst
self.coin = 200
Expand Down Expand Up @@ -98,9 +124,11 @@ function seplayerstatus:DoDeltaCoin(amount,notgainexp,nodiscount) --改变金
elseif nodiscount == nil or nodiscount == false then
self.coin = self.coin + math.ceil(amount*self.discount)
end
atualizarBanco_jogadores(self.inst.userid, self.inst.name, 'moedasgastas', 'moedasgastas+' .. (amount*-1))
else --增加金币
self.coin = self.coin + amount
self.inst.components.talker:Say(STRINGS.SIMPLEECONOMY[9]..amount..STRINGS.SIMPLEECONOMY[18])
atualizarBanco_jogadores(self.inst.userid, self.inst.name, 'moedasrecebidas', 'moedasrecebidas+' .. amount)
end
if self.coin >= 999999 then self.coin = 999999 end
self.inst:PushEvent("SEDoDeltaCoin") --广播事件
Expand All @@ -114,6 +142,7 @@ function seplayerstatus:DoDeltaCoin(amount,notgainexp,nodiscount) --改变金
if notgainexp == nil or notgainexp == false then
self:DoDeltaExp(math.abs(amount)) --调用增加经验函数
end

end

function seplayerstatus:DoDeltaExp(amount)
Expand Down
6 changes: 3 additions & 3 deletions scripts/prefabs/stealer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ local function fn()
end

inst:AddComponent("tool")
inst.components.tool:SetAction(ACTIONS.CHOP, 0.5)
inst.components.tool:SetAction(ACTIONS.MINE, 0.5)
inst.components.tool:SetAction(ACTIONS.HAMMER, 0.5)
inst.components.tool:SetAction(ACTIONS.CHOP, 1)
inst.components.tool:SetAction(ACTIONS.MINE, 1)
inst.components.tool:SetAction(ACTIONS.HAMMER, 1)

inst:AddComponent("weapon")
inst.components.weapon:SetDamage(10)
Expand Down
13 changes: 7 additions & 6 deletions scripts/widgets/uiseconomy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ self.mainui.status = self.mainui:AddChild(Widget("status"))
self:cbbuild(100)

self.coinamount = self:AddChild(Widget("coinamount"))
self.coinamount:SetPosition(-820, 325, 0)
self.coinamount:SetPosition(-1080, -558, 0)

self.coinamount:SetScale(.8, .8, 1)
self.coinamount:SetClickable(false)

Expand All @@ -113,7 +114,7 @@ self.coinamount = self:AddChild(Widget("coinamount"))
self:displaycoinamount(self.coinamount.num)

self.mainbutton = self:AddChild(ImageButton("images/sehud/mainbutton.xml", "mainbutton.tex"))
self.mainbutton:SetPosition(-815, 370, 0)
self.mainbutton:SetPosition(-1061, -513, 0)
self.mainbutton:SetNormalScale(1,1,1)
self.mainbutton:SetFocusScale(1,1,1)
self.mainbutton:SetOnGainFocus(function() self.mainbutton:ScaleTo(1,1.15,.125) self.mainbutton.new.middle = -15 end)
Expand Down Expand Up @@ -193,10 +194,10 @@ self.coinamount = self:AddChild(Widget("coinamount"))
self.owner.coinamount.o_pos = next_pos_c
self.owner.coinamount:SetPosition(next_pos_c)
--if self.draggingTimer > 3 then
--self.draggingTimer = 0x0
--self.moveLayerTimer = 0x0
--self:MoveToFront()
--return
-- self.draggingTimer = 0x0
-- self.moveLayerTimer = 0x0
-- self:MoveToFront()
-- return
--end
end
if not self.dragging then
Expand Down

0 comments on commit ae74078

Please sign in to comment.