Developer Store
Support
Member Forums

Screenshots
FAQ
Documentation
License
Known Issues
Downloads

MMOWorkshop BACK!

PyTorque
TGB Web Browser


karvermimic

hallsofvalhalla - Been A while
xapken - Wizards and Champions
J.C. Smith - The Repopulation - 0.5.2 Build Notes
EmpireGames - Elementals in Rise of Heroes
Empire Games - WarPath.
jaidurn - Warcall 0.0.1.0 build notes
medafor - Final detailing of models
Thamior - Presence system GONE! [May 25th 2009)]
... MORE BLOGS!

Building a MMO
Wow I had no idea....
Quest Remnants of Chaos
Checking to see if anyone is sti...
Well here I am again :)
T3D and MMOKit
afx 2.0
Terrain specularity [video]
Torque T3D MMO Kit
[3dFoin] Dragon Bug

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()