void GeneratorObjectImplementation::synchronizedUIListen(SceneObject* player, int value) { if (!player->isPlayerCreature() || !isOnAdminList(cast<CreatureObject*>(player)) || getZone() == NULL) return; addOperator(cast<CreatureObject*>(player)); updateInstallationWork(); HarvesterObjectMessage7* msg = new HarvesterObjectMessage7(_this.getReferenceUnsafeStaticCast()); player->sendMessage(msg); activateUiSync(); }
void InstallationObjectImplementation::updateStructureStatus() { if(isCivicStructure()) return; updateInstallationWork(); if (surplusMaintenance < 0) { setConditionDamage(-surplusMaintenance, true); } else { setConditionDamage(0, true); } }
void InstallationObjectImplementation::setActiveResource(ResourceContainer* container) { Time timeToWorkTill; if (resourceHopper.size() == 0) { addResourceToHopper(container); currentSpawn = container->getSpawnObject(); spawnDensity = currentSpawn->getDensityAt(getZone()->getZoneName(), getPositionX(), getPositionY()); return; } updateInstallationWork(); int i = 0; for (; i < resourceHopper.size(); ++i) { ResourceContainer* entry = resourceHopper.get(i); if (entry == container) { if (i == 0) return; ManagedReference<ResourceContainer*> oldEntry = resourceHopper.get(0); InstallationObjectDeltaMessage7* inso7 = new InstallationObjectDeltaMessage7( _this.get()); inso7->updateHopper(); inso7->startUpdate(0x0D); resourceHopper.set(0, container, inso7, 2); if(oldEntry->getQuantity() > 0) resourceHopper.set(i, oldEntry, inso7, 0); else resourceHopper.remove(i, inso7, 0); currentSpawn = container->getSpawnObject(); spawnDensity = currentSpawn->getDensityAt(getZone()->getZoneName(), getPositionX(), getPositionY()); inso7->updateHopperSize(getHopperSize()); inso7->updateExtractionRate(getActualRate()); inso7->close(); broadcastToOperators(inso7); } } }
void InstallationObjectImplementation::changeActiveResourceID(uint64 spawnID) { // Logic: // 1) If operating, and already has an active resource ID - make sure the hopper gets updated // 2) Get the spawn information & set the active resource id // 3) If hopper size is zero for the resource + is operating, send a packet to the operators to add a zero element for delta packets info("updating active "); if (isOperating()) { updateInstallationWork(); } currentSpawn = getZoneServer()->getObject(spawnID).castTo<ResourceSpawn*>(); if (currentSpawn == NULL) { error("new spawn null"); return; } Time timeToWorkTill; Time currentTime; resourceHopperTimestamp.updateToCurrentTime(); ManagedReference<ResourceContainer*> container = getContainerFromHopper(currentSpawn); if (container == NULL) { Locker locker(currentSpawn); container = currentSpawn->createResource(0); addResourceToHopper(container); setActiveResource(container); } else { setActiveResource(container); } InstallationObjectDeltaMessage7* inso7 = new InstallationObjectDeltaMessage7( _this.get()); inso7->updateExtractionRate(getActualRate()); inso7->updateActiveResourceSpawn(getActiveResourceSpawnID()); inso7->close(); broadcastToOperators(inso7); }
void HarvesterObjectImplementation::synchronizedUIListen(CreatureObject* player, int value) { if (!player->isPlayerCreature() || !isOnAdminList(player) || getZone() == NULL) return; addOperator(player); updateInstallationWork(); HarvesterObjectMessage7* msg = new HarvesterObjectMessage7(_this.getReferenceUnsafeStaticCast()); player->sendMessage(msg); /// Have to send the spawns of items no in shift, or the dont show /// up in the hopper when you look. for (int i = 0; i < resourceHopper.size(); ++i) { ResourceContainer* container = resourceHopper.get(i); if (container != NULL) { container->sendTo(player, true); } } activateUiSync(); }