Mercurial > parpg-core
comparison src/parpg/gamemodel.py @ 136:e1fd4cda237d
Added optional Slot value to the "Items" list in the agents file.
updateObjectDB now saves the slot of the item
author | KarstenBock@gmx.net |
---|---|
date | Fri, 30 Sep 2011 15:08:53 +0200 |
parents | e28c13a4802a |
children | 140e5e93f026 |
comparison
equal
deleted
inserted
replaced
135:e28c13a4802a | 136:e1fd4cda237d |
---|---|
420 for x in xrange(slots): | 420 for x in xrange(slots): |
421 obj.container.children.append(None) | 421 obj.container.children.append(None) |
422 items = inv["Items"] if inv.has_key("Items") else list() | 422 items = inv["Items"] if inv.has_key("Items") else list() |
423 for data in items: | 423 for data in items: |
424 item = None | 424 item = None |
425 slot = data["Slot"] if data.has_key("Slot") else -1 | |
425 if data.has_key("type"): | 426 if data.has_key("type"): |
426 item_type = data["type"] | 427 item_type = data["type"] |
427 item_data = {} | 428 item_data = {} |
428 item_data = self.checkAttributes(item_data, item_type) | 429 item_data = self.checkAttributes(item_data, item_type) |
429 if item_data.has_key("containable"): | 430 if item_data.has_key("containable"): |
440 item_data = self.items[identifier]["Entity"] | 441 item_data = self.items[identifier]["Entity"] |
441 item_type = item_data["containable"]["item_type"] | 442 item_type = item_data["containable"]["item_type"] |
442 item = self.create_item(identifier, item_data, | 443 item = self.create_item(identifier, item_data, |
443 world, item_type) | 444 world, item_type) |
444 | 445 |
445 container.put_item(obj.container, item.containable) | 446 container.put_item(obj.container, item.containable, slot) |
446 | 447 |
447 if agent.has_key("Equipment"): | 448 if agent.has_key("Equipment"): |
448 for slot, data in agent["Equipment"].iteritems(): | 449 for slot, data in agent["Equipment"].iteritems(): |
449 item = None | 450 item = None |
450 if data.has_key("type"): | 451 if data.has_key("type"): |
698 items = [] | 699 items = [] |
699 for child in comp_vals.children: | 700 for child in comp_vals.children: |
700 if not child: | 701 if not child: |
701 continue | 702 continue |
702 items.append( | 703 items.append( |
703 {"ID": child.entity.general.identifier} | 704 {"ID": child.entity.general.identifier, |
705 "Slot": child.slot} | |
704 ) | 706 ) |
705 inventory_data["Items"] = items | 707 inventory_data["Items"] = items |
706 agent_data["Inventory"] = inventory_data | 708 agent_data["Inventory"] = inventory_data |
707 elif name == "equip": | 709 elif name == "equip": |
708 equip_data = {} | 710 equip_data = {} |