void JS_saveSingleObjectToDatabase(JSObject *object, flusspferd::string holderType, flusspferd::string holderId) { if(object->toReal() && object->toReal()->IsPurged() == false) { if(holderType.size() < 1) { throw flusspferd::exception("Attempting to save object to database with an empty holder type."); } Object::saveItemToTopLevelHolder(holderType.c_str()[0], holderId.to_string(), object->toReal()); } }
flusspferd::array JS_loadObjectsByHolderFromDatabase(flusspferd::string holderType, flusspferd::string holderId) { flusspferd::array objects = flusspferd::create_array(); if(holderType.size() == 0) { throw flusspferd::exception("Attempting to load objects from holder of empty type."); } std::list< Object* > objectList = Object::loadItemList(true, holderType.c_str()[0], holderId.to_string()); while(objectList.empty() == false) { objects.call("push", lookupValue(objectList.front())); // objects.push(lookupValue(objectList.front())); objectList.pop_front(); } return objects; }
void JS_sendToZone(int zoneNumber, flusspferd::string message) { Zone *zone = ZoneManager::GetManager().GetZoneByVnum( zoneNumber ); if( !zone ) return; sendToZone(message.c_str(), zone->GetRnum()); }