Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tny5989 committed Jan 4, 2019
2 parents b33f912 + 0e09cdd commit 5c62fc6
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 390 deletions.
5 changes: 3 additions & 2 deletions data/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ Keys.Values = {}
Keys.Values[''] = { id = 0000, idx = 0, en = '' }

-- Keys
Keys.Values[8973] = { id = 8973, idx = 1, en = 'SP Gobbie Key' }
Keys.Values[4181] = { id = 4181, idx = 2, en = 'Warp Scroll' }
Keys.Values[8973] = { id = 8973, idx = 01, en = 'SP Gobbie Key' }
Keys.Values[4181] = { id = 4181, idx = 02, en = 'Warp Scroll' }
Keys.Values[5945] = { id = 5945, idx = 12, en = "Prize Powder" }

--------------------------------------------------------------------------------
function Keys.GetByProperty(key, value)
Expand Down
2 changes: 1 addition & 1 deletion model/dialogue/buy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function BuyDialogue:_OnSuccess()
local menu_id = self._menu:Id()
local next = self._interactions[self._idx]

next(self._target, menu_id, option.option, option.automated)
next(self._target, menu_id, option.option, option.automated, option.cycle)
end

return BuyDialogue
2 changes: 1 addition & 1 deletion model/dialogue/use.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function UseDialogue:_OnSuccess()
local menu_id = self._menu:Id()
local next = self._interactions[self._idx]

next(self._target, menu_id, option.option, option.automated, self._player, self._item_id)
next(self._target, menu_id, option.option, option.automated, option.cycle, self._player, self._item_id)
end

return UseDialogue
13 changes: 7 additions & 6 deletions model/interaction/choice.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
local NilInteraction = require('model/interaction/nil')

--------------------------------------------------------------------------------
local function CreateChoicePacket(target, menu, choice, automated)
local function CreateChoicePacket(target, menu, choice, automated, cycles)
local pkt = packets.new('outgoing', 0x05B)
pkt['Target'] = target:Id()
pkt['Target Index'] = target:Index()
pkt['Option Index'] = choice
pkt['_unknown1'] = cycles
pkt['Automated Message'] = automated
pkt['Zone'] = target:Zone()
pkt['Menu ID'] = menu
Expand All @@ -21,7 +22,7 @@ Choice.__index = Choice
function Choice:Choice()
local o = NilInteraction:NilInteraction()
setmetatable(o, self)
o._to_send = { [1] = function(target, menu, choice, automated) return {CreateChoicePacket(target, menu, choice, automated)} end }
o._to_send = { [1] = function(target, menu, choice, automated, cycles) return {CreateChoicePacket(target, menu, choice, automated, cycles)} end }
o._idx = 1
o._type = 'Choice'

Expand All @@ -43,15 +44,15 @@ function Choice:OnIncomingData(id, pkt)
end

--------------------------------------------------------------------------------
function Choice:_GeneratePackets(target, menu, choice, automated)
local pkts = self._to_send[self._idx](target, menu, choice, automated)
function Choice:_GeneratePackets(target, menu, choice, automated, cycles)
local pkts = self._to_send[self._idx](target, menu, choice, automated, cycles)
self._idx = self._idx + 1
return pkts
end

--------------------------------------------------------------------------------
function Choice:__call(target, menu, choice, automated)
local pkts = self:_GeneratePackets(target, menu, choice, automated)
function Choice:__call(target, menu, choice, automated, cycles)
local pkts = self:_GeneratePackets(target, menu, choice, automated, cycles)
for _, pkt in pairs(pkts) do
packets.inject(pkt)
end
Expand Down
2 changes: 1 addition & 1 deletion model/interaction/trade.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Trade:_GeneratePackets(target, player, item_id)
end

--------------------------------------------------------------------------------
function Trade:__call(target, _, _, _, player, item_id)
function Trade:__call(target, _, _, _, _, player, item_id)
local pkts = self:_GeneratePackets(target, player, item_id)
for _, pkt in pairs(pkts) do
packets.inject(pkt)
Expand Down
2 changes: 1 addition & 1 deletion model/menu/buy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BuyMenu.__index = BuyMenu

--------------------------------------------------------------------------------
function BuyMenu:BuyMenu(id)
local o = SimpleMenu:SimpleMenu(id, 10, true)
local o = SimpleMenu:SimpleMenu(id, 10, true, 0)
setmetatable(o, self)
o._type = 'BuyMenu'

Expand Down
2 changes: 1 addition & 1 deletion model/menu/count.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CountMenu.__index = CountMenu

--------------------------------------------------------------------------------
function CountMenu:CountMenu(id, idx, count)
local o = SimpleMenu:SimpleMenu(id, (count * (2^13) + (idx * (2^5) + 3) + 1), true)
local o = SimpleMenu:SimpleMenu(id, (count % 8) * (2^13) + (idx * (2^5)) + 4, true, math.floor(count / 8))
setmetatable(o, self)
o._type = 'CountMenu'

Expand Down
2 changes: 1 addition & 1 deletion model/menu/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ItemMenu.__index = ItemMenu

--------------------------------------------------------------------------------
function ItemMenu:ItemMenu(id, idx)
local o = SimpleMenu:SimpleMenu(id, (idx * (2^5) + 3), true)
local o = SimpleMenu:SimpleMenu(id, (idx * (2^5) + 3), true, 0)
setmetatable(o, self)
o._type = 'ItemMenu'

Expand Down
2 changes: 1 addition & 1 deletion model/menu/nil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function NilMenu:NilMenu(id)
local o = {}
setmetatable(o, self)
o._id = id
o._option = { option = 0, automated = false }
o._option = { option = 0, automated = false, cycle = 0 }
o._type = 'NilMenu'
return o
end
Expand Down
4 changes: 2 additions & 2 deletions model/menu/simple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ local SimpleMenu = NilMenu:NilMenu()
SimpleMenu.__index = SimpleMenu

--------------------------------------------------------------------------------
function SimpleMenu:SimpleMenu(id, option, automated)
function SimpleMenu:SimpleMenu(id, option, automated, cycle)
local o = NilMenu:NilMenu()
setmetatable(o, self)

o._id = id
o._option = { option = option, automated = automated }
o._option = { option = option, automated = automated, cycle = cycle }
o._type = 'SimpleMenu'

return o
Expand Down
26 changes: 0 additions & 26 deletions model/menu/tests/buy.lua

This file was deleted.

26 changes: 0 additions & 26 deletions model/menu/tests/count.lua

This file was deleted.

Loading

0 comments on commit 5c62fc6

Please sign in to comment.