Code Monkey home page Code Monkey logo

ffxikeys's People

Contributors

tny5989 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

ffxikeys's Issues

proper count calculation

You lua works well for when buying items in quantities less than 8, but any quantity 8 or above it needs a change.

The function: CreateDialogChoicePacket in ./model/valid_purchase.lua needs the following change (see I am just adding a way to add the _unknown1 field):

local function CreateDialogChoicePacket(target, option, u1, zone, automated)
    local pkt = packets.new('outgoing', 0x05B)
    pkt['Target'] = target:Npc()
    pkt['Option Index'] = option
    pkt['_unknown1'] = u1
    pkt['Target Index'] = target:Entity():Index()
    pkt['Automated Message'] = automated
    pkt['Zone'] = zone
    pkt['Menu ID'] = target:Menu()
    return pkt
end

then it means that the CreateDialogChoicePackets function in the same file needs a change:

local function CreateDialogChoicePackets(target, item, zone, count)
    local to_send = {}
    to_send[1] = CreateDialogChoicePacket(target, 10, 0, zone, true)
    to_send[2] = CreateDialogChoicePacket(target, item:Option(), 0, zone, true)
    to_send[3] = CreateDialogChoicePacket(target, (count % 8) * (2^13) + item:Option() + 1, math.floor(count/8), zone, true)
    to_send[4] = CreateDialogChoicePacket(target, 0, 0, zone, false)
    return to_send
end

Specifically look at the following line:

CreateDialogChoicePacket(target, (count % 8) * (2^13) + item:Option() + 1, math.floor(count/8), zone, true)

the option field now uses modulus 8 (i.e. (count % 8) since the option field cycles from 0 + item:Option() + 1 to 7 * (2^13) + item:Option() + 1.

the u1 field (i.e. _unknown1) now has the number of "cycles" given by the formula math.floor(count/8).

I have tested this with other items and seems to work!

Does not detect full inventory when using multiple keys

The addon does not detect a full inventory when using multiple keys. Inventory updates and key usage are asynchronous operations and one is not guaranteed to happen before the other.

When the addon goes to use another key the inventory is not guaranteed to have been updated with the item from the previous key use. The addons makes the decision to use another key based on stale information and gets hung up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.