| 793 | } |
| 794 | |
| 795 | uint32 ZoneDatabase::AddObject( |
| 796 | uint32 type, |
| 797 | uint32 icon, |
| 798 | const Object_Struct& o, |
| 799 | const EQ::ItemInstance* inst |
| 800 | ) |
| 801 | { |
| 802 | uint32 item_id = 0; |
| 803 | int16 charges = 0; |
| 804 | |
| 805 | if (inst && inst->GetItem()) { |
| 806 | item_id = inst->GetItem()->ID; |
| 807 | charges = inst->GetCharges(); |
| 808 | } |
| 809 | |
| 810 | auto e = ObjectRepository::NewEntity(); |
| 811 | |
| 812 | e.zoneid = o.zone_id; |
| 813 | e.xpos = o.x; |
| 814 | e.ypos = o.y; |
| 815 | e.zpos = o.z; |
| 816 | e.heading = o.heading; |
| 817 | e.itemid = item_id; |
| 818 | e.charges = charges; |
| 819 | e.objectname = o.object_name; |
| 820 | e.type = type; |
| 821 | e.icon = icon; |
| 822 | |
| 823 | e = ObjectRepository::InsertOne(*this, e); |
| 824 | |
| 825 | if (!e.id) { |
| 826 | return 0; |
| 827 | } |
| 828 | |
| 829 | if (inst && inst->IsType(EQ::item::ItemClassBag)) { |
| 830 | SaveWorldContainer(o.zone_id, e.id, inst); |
| 831 | } |
| 832 | |
| 833 | return e.id; |
| 834 | } |
| 835 | |
| 836 | void ZoneDatabase::UpdateObject( |
| 837 | uint32 object_id, |
no test coverage detected