Forcing iConomy to be Zero-sum

Discussion in 'Plugin Development' started by MichaelBurge, May 9, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    MichaelBurge

    Hello,

    My server is for the most part a zero-sum economy: You can't drop your junk in an NPC box somewhere to get money, you can't kill monsters for money, etc. Everything is player-to-player, and we run a modified HeroBounty that acts as a bulletin board selling items, regions, or services.

    The only thing stopping my money from ultimately being useless is the fact that you can buy regions of land. I've been looking at other plugins that provide nice features, like 'lives' so you don't lose your inventory on death, but they all tend to charge your account directly: the $250 you spend on protecting your inventory is erased from the economy entirely. I'd like to instead reroute all such transactions to a "government account" used to fund building projects.

    I figure that if I record every amount A to every account on the server, and add -A to a designated account, then this would accomplish what I want. The difficult is capturing whenever an account is modified; I've thought of several different ways you might do this(since I didn't see anything in the listed iConomy API), but would like some help expanding on it because I'm not as familiar with either one:

    1.) Write a plugin that intercepts every change to every account on the server(except the government account). I'm unsure of how to intercept an iConomy call from arbitrary plugins.

    2.) Configure my MySQL database holding my iConomy money so that it records a history of every transaction; the "government's" money is then (opposite) the sum over this table. I'm unsure of how to record such a transaction history with iConomy.

    3.) Watch for changes in my MySQL database somehow and immediately add it to another account. I'm unsure of how to get code of any sort called whenever a table is updated.

    4.) I see an "iConomy.getTransactions()" function listed my iConomy 5, but without the source code, any documentation in the API page, and only an "insert" function with generic arguments, I'm unsure of how to actually use it to do anything. It might not be useful at all for my purpose, or is some internal function not intended to be seen.

    If you can suggest a different way for me to force iConomy to be zero-sum with arbitrary plugins, or help me on any of these specific issues, I'd be happy to hear them.

    Thanks,
    -- Michael Burge
     
  2. Offline

    fugue2005

    i know nothing of programming java, however i would think that at some point in the code there is something like a getplayeraccount() or somesuch, couldn't you just decompile iconomy and change the getplayeraccount() variable to a single static account? so that it only accesses that account for credits and debits?
     
Thread Status:
Not open for further replies.

Share This Page