本文整理汇总了C++中ManagedReference::addSuiBox方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::addSuiBox方法的具体用法?C++ ManagedReference::addSuiBox怎么用?C++ ManagedReference::addSuiBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::addSuiBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showData
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());
}
示例2: useObject
int ResourceDeedImplementation::useObject(CreatureObject* creature) {
if (creature == NULL)
return 0;
if (!isASubChildOf(creature))
return 0;
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL || ghost->hasSuiBoxWindowType(SuiWindowType::FREE_RESOURCE)) {
//ghost->closeSuiWindowType(SuiWindowType::FREE_RESOURCE);
ghost->removeSuiBoxType(SuiWindowType::FREE_RESOURCE);
return 0;
}
ManagedReference<ResourceManager*> resourceManager = server->getZoneServer()->getResourceManager();
ManagedReference<SuiListBox*> sui = new SuiListBox(creature, SuiWindowType::FREE_RESOURCE);
sui->setUsingObject(_this.getReferenceUnsafeStaticCast());
sui->setCallback(new ResourceDeedSuiCallback(server->getZoneServer(), "Resource"));
sui->setPromptTitle("@veteran:resource_title"); //Resources
sui->setPromptText("@veteran:choose_class"); //Choose resource class
sui->setOtherButton(true, "@back");
sui->setCancelButton(true, "@cancel");
sui->setOkButton(true, "@ok");
resourceManager->addNodeToListBox(sui, "resource");
ghost->addSuiBox(sui);
creature->sendMessage(sui->generateMessage());
return 1;
}
示例3: promptWithdrawMaintenance
void StructureManager::promptWithdrawMaintenance(StructureObject* structure, CreatureObject* creature) {
if (!structure->isGuildHall()) {
return;
}
if (!structure->isOnAdminList(creature)) {
creature->sendSystemMessage("@player_structure:withdraw_admin_only"); // You must be an administrator to remove credits from the treasury.
return;
}
//Get the most up to date maintenance count.
structure->updateStructureStatus();
int surplusMaintenance = structure->getSurplusMaintenance();
if (surplusMaintenance <= 0) {
creature->sendSystemMessage("@player_structure:insufficient_funds_withdrawal"); // Insufficent funds for withdrawal.
return;
}
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL)
return;
ManagedReference<SuiInputBox*> sui = new SuiInputBox(creature, SuiWindowType::STRUCTURE_MANAGE_MAINTENANCE);
sui->setCallback(new StructureWithdrawMaintenanceSuiCallback(server));
sui->setPromptTitle("@player_structure:withdraw_maintenance"); // Withdraw From Treasury
sui->setUsingObject(structure);
sui->setPromptText("@player_structure:treasury_prompt " + String::valueOf(surplusMaintenance)); // Treasury:
ghost->addSuiBox(sui);
creature->sendMessage(sui->generateMessage());
}
示例4: sendMasterLooterList
void GroupManager::sendMasterLooterList(GroupObject* group, CreatureObject* leader) {
//Pre: Leader and group are locked
//Post: Leader and group are locked
if (group == NULL || leader == NULL)
return;
ManagedReference<PlayerObject*> ghost = leader->getPlayerObject();
if (ghost == NULL)
return;
//Close SUI box if already open.
ghost->closeSuiWindowType(SuiWindowType::GROUP_LOOT_PICK_LOOTER);
//Create Master Looter selection list box.
ManagedReference<SuiListBox*> sui = new SuiListBox(leader, SuiWindowType::GROUP_LOOT_PICK_LOOTER);
sui->setPromptTitle("@group:master_looter_sui_title"); //"Select Master Looter"
sui->setPromptText("@group:choose_master_looter"); //"Choose a Master Looter from the list of available players:"
sui->setCancelButton(true, "@ui:cancel");
sui->setOkButton(true, "@ui:ok");
sui->setCallback(new GroupLootPickLooterSuiCallback(leader->getZoneServer()));
for (int i = 0; i < group->getGroupSize(); ++i) {
ManagedReference<CreatureObject*> member = (group->getGroupMember(i)).castTo<CreatureObject*>();
if (member == NULL || !member->isPlayerCreature())
continue;
sui->addMenuItem(member->getFirstName(), member->getObjectID());
}
//Send list box to the group leader.
ghost->addSuiBox(sui);
leader->sendMessage(sui->generateMessage());
}
示例5: sendResourceSUI
void PlantObjectImplementation::sendResourceSUI(CreatureObject* player, int type) {
ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
if (ghost == NULL)
return;
ManagedReference<SuiListBox*> suiBox = new SuiListBox(player, SuiWindowType::GROWABLE_PLANT, SuiListBox::HANDLETWOBUTTON);
suiBox->setCallback(new GrowablePlantSuiCallback(player->getZoneServer()));
suiBox->setPromptTitle("@plant_grow:select_resource_sub");
suiBox->setPromptText("@plant_grow:select_resource_body");
suiBox->setOkButton(true, "@ok");
suiBox->setCancelButton(true, "@cancel");
suiBox->setUsingObject(_this.getReferenceUnsafeStaticCast());
suiBox->setForceCloseDistance(32.f);
ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");
ManagedReference<SceneObject*> sceneObject = NULL;
for (int i=0; i< inventory->getContainerObjectsSize(); i++) {
sceneObject = inventory->getContainerObject(i);
if (sceneObject == NULL)
continue;
if (sceneObject->isResourceContainer()) {
ManagedReference<ResourceContainer*> rcno = cast<ResourceContainer*>( sceneObject.get());
if (rcno == NULL)
continue;
ManagedReference<ResourceSpawn*> spawn = rcno->getSpawnObject();
if (spawn == NULL)
continue;
if ((type == 1 && spawn->isType("organic")) || (type == 2 && spawn->isType("water"))) {
suiBox->addMenuItem(spawn->getName(), sceneObject->getObjectID());
}
}
}
if (suiBox->getMenuSize() > 0) {
ghost->closeSuiWindowType(SuiWindowType::GROWABLE_PLANT);
ghost->addSuiBox(suiBox);
player->sendMessage(suiBox->generateMessage());
} else {
if (type == 1)
player->sendSystemMessage("@plant_grow:no_nutrients"); // You don't have any nutrients.
else
player->sendSystemMessage("@plant_grow:no_water"); // You don't have any water.
}
}
示例6: promptFindLostItems
void StructureManager::promptFindLostItems(CreatureObject* creature,
StructureObject* structure) {
ManagedReference<SuiMessageBox*> sui = new SuiMessageBox(creature, 0x00);
sui->setUsingObject(structure);
sui->setPromptTitle("@player_structure:move_first_item"); //Find Lost Items
sui->setPromptText("@player_structure:move_first_item_d"); //This command will move the first item in your house to your location...
sui->setCallback(new FindLostItemsSuiCallback(server));
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost != NULL) {
ghost->addSuiBox(sui);
creature->sendMessage(sui->generateMessage());
}
}
示例7: promptDeleteAllItems
void StructureManager::promptDeleteAllItems(CreatureObject* creature,
StructureObject* structure) {
ManagedReference<SuiMessageBox*> sui = new SuiMessageBox(creature, 0x00);
sui->setUsingObject(structure);
sui->setPromptTitle("@player_structure:delete_all_items"); //Delete All Items
sui->setPromptText("@player_structure:delete_all_items_d"); //This command will delete every object in your house. Are you ABSOLUTELY sure you want to destroy every object in your house?
sui->setCancelButton(true, "@cancel");
sui->setCallback(new DeleteAllItemsSuiCallback(server));
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost != NULL) {
ghost->addSuiBox(sui);
creature->sendMessage(sui->generateMessage());
}
}
示例8: promptMaintenanceDroid
void StructureManager::promptMaintenanceDroid(StructureObject* structure, CreatureObject* creature) {
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL)
return;
Vector<DroidObject*> droids;
ManagedReference<SceneObject*> datapad = creature->getSlottedObject("datapad");
if(datapad == NULL) {
return;
}
for (int i = 0; i < datapad->getContainerObjectsSize(); ++i) {
ManagedReference<SceneObject*> object = datapad->getContainerObject(i);
if (object != NULL && object->isPetControlDevice()) {
PetControlDevice* device = cast<PetControlDevice*>( object.get());
if (device->getPetType() == PetManager::DROIDPET) {
DroidObject* pet = cast<DroidObject*>(device->getControlledObject());
if (pet->isMaintenanceDroid()) {
droids.add(pet);
}
}
}
}
if (droids.size() == 0) {
creature->sendSystemMessage("@player_structure:no_droids");
return;
}
ManagedReference<SuiListBox*> box = new SuiListBox(creature,SuiWindowType::STRUCTURE_ASSIGN_DROID);
box->setCallback(new StructureAssignDroidSuiCallback(creature->getZoneServer()));
box->setPromptText("@sui:assign_droid_prompt");
box->setPromptTitle("@sui:assign_droid_title"); // Configure Effects
box->setOkButton(true, "@ok");
// Check if player has a droid called with a maintenance module installed
for (int i = 0; i < droids.size(); ++i) {
DroidObject* droidObject = droids.elementAt(i);
box->addMenuItem(droidObject->getDisplayedName(),droidObject->getObjectID());
}
box->setUsingObject(structure);
ghost->addSuiBox(box);
creature->sendMessage(box->generateMessage());
}
示例9: handleObjectMenuSelect
int GogglesObjectMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
if (!sceneObject->isTangibleObject())
return 0;
if (!sceneObject->isASubChildOf(player))
return 0;
if (selectedID == 81 || selectedID == 82) {
ManagedReference<SceneObject*> parent = sceneObject->getParent().get();
if (parent != NULL && parent->isPlayerCreature()) {
player->sendSystemMessage("@error_message:equipped_goggles");
return 0;
}
// Handle color change.
ZoneServer* server = player->getZoneServer();
if (server != NULL) {
// The color index.
String appearanceFilename = sceneObject->getObjectTemplate()->getAppearanceFilename();
VectorMap<String, Reference<CustomizationVariable*> > variables;
AssetCustomizationManagerTemplate::instance()->getCustomizationVariables(appearanceFilename.hashCode(), variables, false);
// The Sui Box.
ManagedReference<SuiColorBox*> cbox = new SuiColorBox(player, SuiWindowType::COLOR_GOGGLES);
cbox->setCallback(new ColorGogglesSuiCallback(server));
if (selectedID == 81)
cbox->setColorPalette(variables.elementAt(1).getKey());
else
cbox->setColorPalette(variables.elementAt(0).getKey());
cbox->setUsingObject(sceneObject);
// Add to player.
ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
ghost->addSuiBox(cbox);
player->sendMessage(cbox->generateMessage());
}
}
return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
示例10: reorderShow
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());
}
示例11: promptNameStructure
void StructureManager::promptNameStructure(CreatureObject* creature,
StructureObject* structure, TangibleObject* object) {
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL)
return;
ManagedReference<SuiInputBox*> inputBox = new SuiInputBox(creature,
SuiWindowType::OBJECT_NAME);
if (object == NULL) {
inputBox->setUsingObject(structure);
} else {
inputBox->setUsingObject(object);
}
inputBox->setPromptTitle("@base_player:set_name"); //Set Name
inputBox->setPromptText("@player_structure:structure_name_prompt"); //Structure Name:
inputBox->setMaxInputSize(128);
inputBox->setCallback(new NameStructureSuiCallback(server));
inputBox->setForceCloseDistance(32);
ghost->addSuiBox(inputBox);
creature->sendMessage(inputBox->generateMessage());
}
示例12: promptPayMaintenance
void StructureManager::promptPayMaintenance(StructureObject* structure,
CreatureObject* creature, SceneObject* terminal) {
int availableCredits = creature->getCashCredits();
if (availableCredits <= 0) {
creature->sendSystemMessage("@player_structure:no_money"); //You do not have any money to pay maintenance.
return;
}
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL)
return;
//Get the most up to date maintenance count.
structure->updateStructureStatus();
int surplusMaintenance = (int) floor(
(float) structure->getSurplusMaintenance());
ManagedReference<SuiTransferBox*> sui = new SuiTransferBox(creature,
SuiWindowType::STRUCTURE_MANAGE_MAINTENANCE);
sui->setCallback(new StructurePayMaintenanceSuiCallback(server));
sui->setPromptTitle("@player_structure:select_amount"); //Select Amount
sui->setUsingObject(structure);
sui->setPromptText(
"@player_structure:select_maint_amount \[email protected]_structure:current_maint_pool "
+ String::valueOf(surplusMaintenance));
sui->addFrom("@player_structure:total_funds",
String::valueOf(availableCredits),
String::valueOf(availableCredits), "1");
sui->addTo("@player_structure:to_pay", "0", "0", "1");
ghost->addSuiBox(sui);
creature->sendMessage(sui->generateMessage());
}
示例13: reportStructureStatus
//.........这里部分代码省略.........
ManagedReference<SceneObject*> ownerObject = server->getObject(
structure->getOwnerObjectID());
if (ownerObject != NULL && ownerObject->isCreatureObject()) {
CreatureObject* owner = cast<CreatureObject*>(ownerObject.get());
status->addMenuItem(
"@player_structure:owner_prompt " + owner->getFirstName());
}
uint64 declaredOidResidence = ghost->getDeclaredResidence();
ManagedReference<BuildingObject*> declaredResidence =
server->getObject(declaredOidResidence).castTo<BuildingObject*>();
if (declaredResidence == structure) {
status->addMenuItem("@player_structure:declared_residency"); //You have declared your residency here.
}
if (structure->isPrivateStructure() && !structure->isCivicStructure()) {
status->addMenuItem("@player_structure:structure_private"); //This structure is private
} else {
status->addMenuItem("@player_structure:structure_public"); //This structure is public
}
status->addMenuItem(
"@player_structure:condition_prompt "
+ String::valueOf(structure->getDecayPercentage()) + "%");
if (!structure->isCivicStructure()) {
// property tax
float propertytax = 0.f;
if(!structure->isCivicStructure() && structure->getCityRegion() != NULL){
ManagedReference<CityRegion*> city = structure->getCityRegion().get();
if(city != NULL){
propertytax = city->getPropertyTax()/ 100.f * structure->getMaintenanceRate();
status->addMenuItem(
"@city/city:property_tax_prompt : "
+ String::valueOf(ceil(propertytax))
+ " cr/hr");
}
}
// maintenance
float secsRemainingMaint = 0.f;
if( structure->getSurplusMaintenance() > 0 ){
float totalrate = (float)structure->getMaintenanceRate() + propertytax;
secsRemainingMaint = ((float)structure->getSurplusMaintenance() / totalrate)*3600;
}
status->addMenuItem(
"@player_structure:maintenance_pool_prompt "
+ String::valueOf( (int) floor( (float) structure->getSurplusMaintenance()))
+ " "
+ getTimeString( (uint32)secsRemainingMaint ) );
status->addMenuItem(
"@player_structure:maintenance_rate_prompt "
+ String::valueOf(structure->getMaintenanceRate())
+ " cr/hr");
status->addMenuItem(
"@player_structure:maintenance_mods_prompt "
+ structure->getMaintenanceMods());
}
if (structure->isInstallationObject() && !structure->isGeneratorObject() && !structure->isCivicStructure()) {
InstallationObject* installation = cast<InstallationObject*>(structure);
float secsRemainingPower = 0.f;
if( installation->getSurplusPower() > 0 ){
secsRemainingPower = ((float)installation->getSurplusPower() / (float)installation->getBasePowerRate())*3600;
}
status->addMenuItem(
"@player_structure:power_reserve_prompt "
+ String::valueOf( (int) installation->getSurplusPower())
+ " "
+ getTimeString( (uint32)secsRemainingPower ) );
status->addMenuItem(
"@player_structure:power_consumption_prompt "
+ String::valueOf(
(int) installation->getBasePowerRate())
+ " @player_structure:units_per_hour");
}
if (structure->isBuildingObject()) {
BuildingObject* building = cast<BuildingObject*>(structure);
status->addMenuItem(
"@player_structure:items_in_building_prompt "
+ String::valueOf(
building->getCurrentNumberOfPlayerItems())); //Number of Items in Building:
}
ghost->addSuiBox(status);
creature->sendMessage(status->generateMessage());
}
示例14: handleObjectMenuSelect
int ForceShrineMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* creature, byte selectedID) {
if (selectedID != 213)
return 0;
if (creature->getPosture() != CreaturePosture::CROUCHED){
creature->sendSystemMessage("@jedi_trials:show_respect"); // Must show respect
return 0;
}
ManagedReference<PlayerObject*> ghost = creature->getPlayerObject();
if (ghost == NULL)
return 0;
if (creature->getScreenPlayState("VillageJediProgression") && !creature->hasSkill("force_title_jedi_rank_02")){
ManagedReference<SuiMessageBox*> box = new SuiMessageBox(creature, SuiWindowType::NONE);
box->setPromptTitle("@jedi_trials:padawan_trials_title"); // Jedi Trials
box->setPromptText("@jedi_trials:padawan_trials_completed");
ghost->addSuiBox(box);
creature->sendMessage(box->generateMessage());
SkillManager::instance()->awardSkill("force_title_jedi_rank_02", creature, true, true, true);
creature->playEffect("clienteffect/entertainer_dazzle_level_3.cef", ""); // Not sure if it's the right one for this.
PlayMusicMessage* pmm = new PlayMusicMessage("sound/intro.snd");
creature->sendMessage(pmm);
ghost->setJediState(2);
// Trainer number. Pick a random trainer, there are at least 600 in the galaxy.
ZoneServer* zoneServer = ghost->getZoneServer();
int randomZone = System::random(zoneServer->getZoneCount() - 1);
ManagedReference<Zone*> zone = zoneServer->getZone(randomZone);
Vector3 randomTrainer = zone->getCreatureManager()->getRandomJediTrainer();
if ((randomTrainer.getX() == 0) && (randomTrainer.getY() == 0)) { // No trainers on the zone.
ManagedReference<Zone*> zone = zoneServer->getZone(0);
Vector3 randomTrainer = zone->getCreatureManager()->getRandomJediTrainer();
}
Vector3 trainerPositionFinal(randomTrainer.getX(), randomTrainer.getY(), 0);
String zoneName = zone->getZoneName();
ghost->setTrainerCoordinates(trainerPositionFinal);
ghost->setTrainerZoneName(zoneName); // For the Waypoint.
ManagedReference<SceneObject*> inventory = creature->getSlottedObject("inventory");
//Check if inventory is full.
if (inventory->hasFullContainerObjects()) {
creature->sendSystemMessage("@jedi_spam:inventory_full_jedi_robe"); // You have too many items in your inventory. In order to get your Padawan Robe you must clear out at least one free slot.
return 0;
}
ZoneServer* zserv = creature->getZoneServer();
String PadawanRobe = "object/tangible/wearables/robe/robe_jedi_padawan.iff";
ManagedReference<SceneObject*> padawanRobe = zserv->createObject(PadawanRobe.hashCode(), 1);
if (inventory->transferObject(padawanRobe, -1)) {
inventory->broadcastObject(padawanRobe, true);
} else {
padawanRobe->destroyObjectFromDatabase(true);
}
}
else if (!creature->hasSkill("force_title_jedi_novice")){
int rand = System::random(14) + 1;
StringBuffer sysmsg;
sysmsg << "@jedi_trials:force_shrine_wisdom_" << rand;
creature->sendSystemMessage(sysmsg.toString());
}
else if (creature->hasSkill("force_title_jedi_rank_02")){
ManagedReference<SceneObject*> inventory = creature->getSlottedObject("inventory");
//Check if inventory is full.
if (inventory->hasFullContainerObjects()) {
creature->sendSystemMessage("@jedi_spam:inventory_full_jedi_robe"); // You have too many items in your inventory. In order to get your Padawan Robe you must clear out at least one free slot.
return 0;
}
ZoneServer* zserv = creature->getZoneServer();
String PadawanRobe = "object/tangible/wearables/robe/robe_jedi_padawan.iff";
ManagedReference<SceneObject*> padawanRobe = zserv->createObject(PadawanRobe.hashCode(), 1);
if (inventory->transferObject(padawanRobe, -1)) {
inventory->broadcastObject(padawanRobe, true);
} else {
//.........这里部分代码省略.........
示例15: createCharacter
//.........这里部分代码省略.........
} catch (Exception& e) {
error(e.getMessage());
}
} else {
playerManager->updatePermissionLevel(playerCreature, PermissionLevelList::instance()->getLevelNumber("admin"));
}
if (doTutorial)
playerManager->createTutorialBuilding(playerCreature);
else
playerManager->createSkippedTutorialBuilding(playerCreature);
ValidatedPosition* lastValidatedPosition =
ghost->getLastValidatedPosition();
lastValidatedPosition->update(playerCreature);
ghost->setBiography(bio);
ghost->setRaceID(raceID);
ghost->setLanguageID(playerTemplate->getDefaultLanguage());
}
playerCreature->setLevel(1);
ClientCreateCharacterSuccess* msg = new ClientCreateCharacterSuccess(
playerCreature->getObjectID());
playerCreature->sendMessage(msg);
ChatManager* chatManager = zoneServer.get()->getChatManager();
chatManager->addPlayer(playerCreature);
String firstName = playerCreature->getFirstName();
String lastName = playerCreature->getLastName();
try {
StringBuffer query;
query
<< "INSERT INTO `characters_dirty` (`character_oid`, `account_id`, `galaxy_id`, `firstname`, `surname`, `race`, `gender`, `template`)"
<< " VALUES (" << playerCreature->getObjectID() << ","
<< client->getAccountID() << "," << zoneServer.get()->getGalaxyID()
<< "," << "'" << firstName.escapeString() << "','"
<< lastName.escapeString() << "'," << raceID << "," << 0 << ",'"
<< raceFile.escapeString() << "')";
ServerDatabase::instance()->executeStatement(query);
} catch (DatabaseException& e) {
error(e.getMessage());
}
playerManager->addPlayer(playerCreature);
// Copy claimed veteran rewards from player's alt character
uint32 accID = client->getAccountID();
ManagedReference<Account*> playerAccount = playerManager->getAccount(accID);
if (playerAccount != NULL && ghost != NULL) {
// Find the first alt character
ManagedReference<CreatureObject*> altPlayer = NULL;
CharacterList* characters = playerAccount->getCharacterList();
for(int i = 0; i < characters->size(); ++i) {
CharacterListEntry* entry = &characters->get(i);
if(entry->getGalaxyID() == zoneServer.get()->getGalaxyID() &&
entry->getFirstName() != playerCreature->getFirstName() ) {
altPlayer = playerManager->getPlayer(entry->getFirstName());
if( altPlayer != NULL ){
break;
}
}
}
// Record the rewards if alt player was found
if( altPlayer != NULL && altPlayer->getPlayerObject() != NULL){
Locker alocker( altPlayer );
for( int i = 0; i < playerManager->getNumVeteranRewardMilestones(); i++ ){
int milestone = playerManager->getVeteranRewardMilestone(i);
String claimedReward = altPlayer->getPlayerObject()->getChosenVeteranReward(milestone);
if( !claimedReward.isEmpty() ){
ghost->addChosenVeteranReward(milestone,claimedReward);
}
}
}
}
client->addCharacter(playerCreature->getObjectID(), zoneServer.get()->getGalaxyID());
JediManager::instance()->onPlayerCreated(playerCreature);
ManagedReference<SuiMessageBox*> box = new SuiMessageBox(playerCreature, SuiWindowType::NONE);
box->setPromptTitle("PLEASE NOTE");
box->setPromptText("You are limited to creating one character every 24 hours. Attempting to create another character or deleting your character before the 24 hour timer expires will reset the timer.");
ghost->addSuiBox(box);
playerCreature->sendMessage(box->generateMessage());
ghost->recalculateCombatLevel(playerCreature);
return true;
}