Developer Store
Support
Member Forums

Screenshots
FAQ
Documentation
License
Known Issues
Downloads

MMOWorkshop.com Store Opened!
Torque MMO Kit - Open Sourced!
Torque MMO Kit - 1.5.2 Port Alpha Test
Torque MMO Kit - OSX Status

GarageGames.com irc.prairiegames.com
#mmoworkshop

PyTorque
TGB Web Browser


Boaal

hallsofvalhalla - After a long epiphany
Leathel - FoHO pre-Alpha 2.42
OldRod - More Musings on the MMO Industry
xapken - nice
J.C. Smith - 0.0.4.1 Build Notes
Wolf Dreamer - Pointless blog of pointless things
AthlonJedi2 - Server Nuked !!!!!
gamer_goof - New character model GIRL1 available only $4
... MORE BLOGS!

Graves
Scripted NPC or Mob
Epic Battles
Fun with the Laptop/Desktop
Lets talk skills.
IRC
--python and mysql related quest...
License for packs?
Seagull Productions
Tmmokit152 problem

When you start "Edit Zone" some data is read from world.db in test.game\data\worlds\singleplayer\editworld. Then a copy is made from test.game\data\worlds\multiplayer.baseline which is recreated by Genesis.py. The saved data is then added to this fresh copy.

This way all items without a player and/or character ID were deleted and the item_dropped table was reset.

The only way was to add the table to the set of data saved and that is done in mud/world/worldupdate.py.

First of all import the class:

from mud.world.item import Item,ItemProto,ItemSpell,ItemDropped

Then we need a copier for the entries just like the other ones:

class DroppedItemCopier:
    def __init__(self,conn,id):
        self.dbAttr = {}
        cur = conn.cursor()
        t = mixedToUnder("ItemDropped")
        cur.execute("SELECT * from %s WHERE id = %i;"%(t,id))
        for name,value in zip(WSCHEMA["ItemDropped"],cur.fetchall()[0]):
            self.dbAttr[str(name)]=value
        self.item = None
        try:
            self.item = ItemCopier(conn.cursor(), int(self.dbAttr['itemID']))
        except:
            print "Item %i does not exist anymore."%int(self.dbAttr['itemID'])
            pass
        cur.close()
        
    def install(self):

        if self.item:
            FilterColumns(ItemDropped,self.dbAttr)
            self.item.install(DummyCharacter())
            ditem = ItemDropped(**self.dbAttr)

The DummyCharacter is a helper to make item.install work. This needs a character instance where it takes the id from. As all dropped items have a character_id of None.

class DummyCharacter:
    def __init__(self):
        self.id = None;

Finally the copier is called: line 805

        droppedItems = []

line 823:

        #dropped items
        cur.execute("select id from item_dropped;")
        
        for r in cur.fetchall():
            i = DroppedItemCopier(WCONN,r[0])
            droppedItems.append(i)

line 854:

        for i in droppedItems:
            i.install()