void FireworkShowMenuComponent::showData(CreatureObject* player, FireworkObject* fireworkShow) const { ManagedReference<PlayerObject*> ghost = player->getPlayerObject(); if (ghost == NULL || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_ADDEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REMOVEEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REORDERSHOW) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_MODIFYEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_DELAYSELECTION)) { return; } DataObjectComponent* data = fireworkShow->getDataObjectComponent()->get(); if (data == NULL || !data->isFireworkShowData()) return; FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data); Locker plocker(player); ManagedReference<SuiListBox*> suiBox = new SuiListBox(player, SuiWindowType::FIREWORK_SHOW_ADDEVENT, SuiListBox::HANDLESINGLEBUTTON); suiBox->setPromptTitle("@firework:data_title"); suiBox->setPromptText("@firework:data_prompt"); suiBox->setOkButton(true, "@ok"); suiBox->setUsingObject(fireworkShow); int totalFireworks = fireworkShowData->getTotalFireworkCount(); for (int i = 0; i < totalFireworks; i++) { ManagedReference<FireworkObject*> firework = fireworkShowData->getFirework(i); String fireworkDelay = String::valueOf(float(fireworkShowData->getFireworkDelay(i)) / 1000.f); String menuItem = "(" + String::valueOf(i) + ":" + fireworkDelay + "s) " + firework->getDisplayedName(); suiBox->addMenuItem(menuItem); } ghost->addSuiBox(suiBox); player->sendMessage(suiBox->generateMessage()); }
void FireworkShowMenuComponent::reorderShow(CreatureObject* player, FireworkObject* fireworkShow) const { ManagedReference<PlayerObject*> ghost = player->getPlayerObject(); if (ghost == NULL || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_ADDEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REMOVEEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_REORDERSHOW) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_MODIFYEVENT) || ghost->hasSuiBoxWindowType(SuiWindowType::FIREWORK_SHOW_DELAYSELECTION)) { return; } DataObjectComponent* data = fireworkShow->getDataObjectComponent()->get(); if (data == NULL || !data->isFireworkShowData()) return; FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data); Locker plocker(player); ManagedReference<SuiListBox*> suiBox = new SuiListBox(player, SuiWindowType::FIREWORK_SHOW_REORDERSHOW, SuiListBox::HANDLETHREEBUTTON); suiBox->setPromptTitle("@firework:modify_index_title"); // Remove Show Event suiBox->setPromptText("@firework:modify_index_prompt"); // Select the event index for which you would like to modify the delay time. suiBox->setOkButton(true, "@ui:done"); suiBox->setCancelButton(true, "@ui:moveup"); suiBox->setOtherButton(true, "@ui:movedown"); suiBox->setUsingObject(fireworkShow); int totalFireworks = fireworkShowData->getTotalFireworkCount(); for (int i = 0; i < totalFireworks; i++) { ManagedReference<FireworkObject*> firework = fireworkShowData->getFirework(i); String fireworkDelay = String::valueOf(float(fireworkShowData->getFireworkDelay(i)) / 1000.f); String menuItem = "(" + String::valueOf(i) + ":" + fireworkDelay + "s) " + firework->getDisplayedName(); suiBox->addMenuItem(menuItem, firework->getObjectID()); } suiBox->setCallback(new FireworkShowReorderShowSuiCallback(player->getZoneServer())); ghost->addSuiBox(suiBox); player->sendMessage(suiBox->generateMessage()); }
void FireworkObjectImplementation::fillAttributeList(AttributeListMessage* alm, CreatureObject* object) { TangibleObjectImplementation::fillAttributeList(alm, object); ManagedReference<FireworkObject*> firework = _this.getReferenceUnsafeStaticCast(); if (firework == NULL) return; DataObjectComponent* data = firework->getDataObjectComponent()->get(); if (data == NULL || !data->isFireworkShowData()) { String effect = "@firework_n:" + fireworkObject.subString(fireworkObject.lastIndexOf("/") + 1, fireworkObject.lastIndexOf(".")); alm->insertAttribute("@obj_attr_n:pattern", effect); } else { FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data); if (fireworkShowData == NULL) return; alm->insertAttribute("examine_hoppersize", firework->getCapacity()); int totalFireworks = fireworkShowData->getTotalFireworkCount(); alm->insertAttribute("blank_entry", ""); alm->insertAttribute("length", "\\#pcontrast2 " + String::valueOf(totalFireworks) + " Fireworks"); for (int i = 0; i < totalFireworks; i++) { ManagedReference<FireworkObject*> firework = fireworkShowData->getFirework(i); if (firework == NULL) continue; String fireworkObj = firework->getFireworkObjectPath(); String effect = "@firework_n:" + fireworkObj.subString(fireworkObj.lastIndexOf("/") + 1, fireworkObj.lastIndexOf(".")); alm->insertAttribute("pattern", effect); } } }
void FireworkObjectImplementation::destroyObjectFromDatabase(bool destroyContainedObjects) { ManagedReference<FireworkObject*> firework = _this.getReferenceUnsafeStaticCast(); if (firework != NULL && firework->isFireworkObject()) { DataObjectComponent* data = firework->getDataObjectComponent()->get(); if(data != NULL && data->isFireworkShowData()) { FireworkShowDataComponent* fireworkShowData = cast<FireworkShowDataComponent*>(data); if (fireworkShowData->getTotalFireworkCount() > 0) { for (int i=0; i< fireworkShowData->getTotalFireworkCount(); i++) { ManagedReference<FireworkObject*> firework = fireworkShowData->getFirework(0); fireworkShowData->removeFirework(0); if (firework != NULL) firework->destroyObjectFromDatabase(false); } } } } TangibleObjectImplementation::destroyObjectFromDatabase(destroyContainedObjects); }