Instructions Jenkins Doxygen

[added] Change city name 46/746/3
authorPete <elpete@swgemu.com>
Tue, 3 Sep 2013 21:03:38 +0000 (16:03 -0500)
committerPete <elpete@swgemu.com>
Wed, 4 Sep 2013 10:56:35 +0000 (05:56 -0500)
Change-Id: I17b65d3daa96e298fbc3af282cb5c5bc0d021fdb

MMOCoreORB/src/server/zone/managers/city/CityManager.cpp
MMOCoreORB/src/server/zone/managers/city/CityManager.h
MMOCoreORB/src/server/zone/managers/city/CityManager.idl
MMOCoreORB/src/server/zone/managers/city/CityManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/planet/PlanetTravelPoint.h
MMOCoreORB/src/server/zone/objects/player/sui/SuiWindowType.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/RenameCitySuiCallback.h [new file with mode: 0644]
MMOCoreORB/src/server/zone/objects/region/components/CityManagementMenuComponent.cpp

index ce0f5d9..9b49466 100644 (file)
@@ -24,7 +24,7 @@
  *     CityManagerStub
  */
 
-enum {RPC_LOADLUACONFIG__ = 6,RPC_LOADCITYREGIONS__,RPC_VALIDATECITYNAME__STRING_,RPC_ISCITYINRANGE__ZONE_FLOAT_FLOAT_,RPC_CREATECITY__CREATUREOBJECT_STRING_FLOAT_FLOAT_,RPC_PROCESSCITYUPDATE__CITYREGION_,RPC_PROCESSINCOMETAX__CITYREGION_,RPC_UPDATECITYVOTING__CITYREGION_BOOL_,RPC_DEDUCTCITYMAINTENANCE__CITYREGION_,RPC_COLLECTNONSTRUCTUREMAINTENANCE__SCENEOBJECT_CITYREGION_INT_,RPC_COLLECTCIVICSTRUCTUREMAINTENANCE__STRUCTUREOBJECT_CITYREGION_INT_,RPC_SENDMAINTENANCEEMAIL__CITYREGION_INT_,RPC_SENDMAINTENANCEDECAYEMAIL__CITYREGION_STRUCTUREOBJECT_INT_,RPC_SENDMAINTENANCEDESTROYEMAIL__CITYREGION_STRUCTUREOBJECT_,RPC_SENDMAINTENANCEREPAIREMAIL__CITYREGION_STRUCTUREOBJECT_,RPC_CONTRACTCITY__CITYREGION_,RPC_EXPANDCITY__CITYREGION_,RPC_DESTROYCITY__CITYREGION_,RPC_SENDSTATUSREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTCITYSPECIALIZATION__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_CHANGECITYSPECIALIZATION__CITYREGION_CREATUREOBJECT_STRING_,RPC_PROMPTWITHDRAWCITYTREASURY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTDEPOSITCITYTREASURY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_WITHDRAWFROMCITYTREASURY__CITYREGION_CREATUREOBJECT_INT_STRING_SCENEOBJECT_,RPC_DEPOSITTOCITYTREASURY__CITYREGION_CREATUREOBJECT_INT_,RPC_SENDTREASURYREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_SENDCITIZENSHIPREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_REGISTERCITIZEN__CITYREGION_CREATUREOBJECT_,RPC_UNREGISTERCITIZEN__CITYREGION_CREATUREOBJECT_BOOL_,RPC_SENDMANAGEMILITIA__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTADDMILITIAMEMBER__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_ADDMILITIAMEMBER__CITYREGION_CREATUREOBJECT_STRING_,RPC_REMOVEMILITIAMEMBER__CITYREGION_CREATUREOBJECT_LONG_,RPC_SENDCITYADVANCEMENT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTREGISTERCITY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTUNREGISTERCITY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_REGISTERCITY__CITYREGION_CREATUREOBJECT_,RPC_UNREGISTERCITY__CITYREGION_CREATUREOBJECT_,RPC_PROMPTADJUSTTAXES__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTSETTAX__CITYREGION_CREATUREOBJECT_INT_SCENEOBJECT_,RPC_SETTAX__CITYREGION_CREATUREOBJECT_INT_INT_,RPC_SENDMAINTENANCEREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_CONTAINSCITYNAME__STRING_,RPC_ISCITYRANKCAPPED__STRING_BYTE_,RPC_SENDCITYREPORT__CREATUREOBJECT_STRING_BYTE_,RPC_VALIDATECITYINRANGE__CREATUREOBJECT_ZONE_FLOAT_FLOAT_,RPC_TOGGLEZONINGENABLED__CITYREGION_CREATUREOBJECT_,RPC_GETTOTALCITIES__,RPC_SENDMAYORALSTANDINGS__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTMAYORALVOTE__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_REGISTERFORMAYORALRACE__CITYREGION_CREATUREOBJECT_,RPC_CASTMAYORALVOTE__CITYREGION_CREATUREOBJECT_LONG_,RPC_SENDSTRUCTUREREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_FIXMAYOR__CITYREGION_CREATUREOBJECT_,RPC_CANSUPPORTMOREDECORATIONS__CITYREGION_,};
+enum {RPC_LOADLUACONFIG__ = 6,RPC_LOADCITYREGIONS__,RPC_VALIDATECITYNAME__STRING_,RPC_ISCITYINRANGE__ZONE_FLOAT_FLOAT_,RPC_CREATECITY__CREATUREOBJECT_STRING_FLOAT_FLOAT_,RPC_PROCESSCITYUPDATE__CITYREGION_,RPC_PROCESSINCOMETAX__CITYREGION_,RPC_UPDATECITYVOTING__CITYREGION_BOOL_,RPC_DEDUCTCITYMAINTENANCE__CITYREGION_,RPC_COLLECTNONSTRUCTUREMAINTENANCE__SCENEOBJECT_CITYREGION_INT_,RPC_COLLECTCIVICSTRUCTUREMAINTENANCE__STRUCTUREOBJECT_CITYREGION_INT_,RPC_SENDMAINTENANCEEMAIL__CITYREGION_INT_,RPC_SENDMAINTENANCEDECAYEMAIL__CITYREGION_STRUCTUREOBJECT_INT_,RPC_SENDMAINTENANCEDESTROYEMAIL__CITYREGION_STRUCTUREOBJECT_,RPC_SENDMAINTENANCEREPAIREMAIL__CITYREGION_STRUCTUREOBJECT_,RPC_CONTRACTCITY__CITYREGION_,RPC_EXPANDCITY__CITYREGION_,RPC_DESTROYCITY__CITYREGION_,RPC_SENDSTATUSREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTCITYSPECIALIZATION__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_CHANGECITYSPECIALIZATION__CITYREGION_CREATUREOBJECT_STRING_,RPC_PROMPTWITHDRAWCITYTREASURY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTDEPOSITCITYTREASURY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_WITHDRAWFROMCITYTREASURY__CITYREGION_CREATUREOBJECT_INT_STRING_SCENEOBJECT_,RPC_DEPOSITTOCITYTREASURY__CITYREGION_CREATUREOBJECT_INT_,RPC_SENDTREASURYREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_SENDCITIZENSHIPREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_REGISTERCITIZEN__CITYREGION_CREATUREOBJECT_,RPC_UNREGISTERCITIZEN__CITYREGION_CREATUREOBJECT_BOOL_,RPC_SENDMANAGEMILITIA__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTADDMILITIAMEMBER__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_ADDMILITIAMEMBER__CITYREGION_CREATUREOBJECT_STRING_,RPC_REMOVEMILITIAMEMBER__CITYREGION_CREATUREOBJECT_LONG_,RPC_SENDCITYADVANCEMENT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTREGISTERCITY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTUNREGISTERCITY__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_REGISTERCITY__CITYREGION_CREATUREOBJECT_,RPC_UNREGISTERCITY__CITYREGION_CREATUREOBJECT_,RPC_PROMPTADJUSTTAXES__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTSETTAX__CITYREGION_CREATUREOBJECT_INT_SCENEOBJECT_,RPC_SETTAX__CITYREGION_CREATUREOBJECT_INT_INT_,RPC_SENDMAINTENANCEREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_CONTAINSCITYNAME__STRING_,RPC_ISCITYRANKCAPPED__STRING_BYTE_,RPC_SENDCITYREPORT__CREATUREOBJECT_STRING_BYTE_,RPC_VALIDATECITYINRANGE__CREATUREOBJECT_ZONE_FLOAT_FLOAT_,RPC_TOGGLEZONINGENABLED__CITYREGION_CREATUREOBJECT_,RPC_GETTOTALCITIES__,RPC_RENAMECITY__CITYREGION_STRING_,RPC_SENDMAYORALSTANDINGS__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_PROMPTMAYORALVOTE__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_REGISTERFORMAYORALRACE__CITYREGION_CREATUREOBJECT_,RPC_CASTMAYORALVOTE__CITYREGION_CREATUREOBJECT_LONG_,RPC_SENDSTRUCTUREREPORT__CITYREGION_CREATUREOBJECT_SCENEOBJECT_,RPC_FIXMAYOR__CITYREGION_CREATUREOBJECT_,RPC_CANSUPPORTMOREDECORATIONS__CITYREGION_,RPC_SENDCHANGECITYNAME__CITYREGION_CREATUREOBJECT_};
 
 CityManager::CityManager(ZoneServer* zserv) : ManagedService(DummyConstructorParameter::instance()) {
        CityManagerImplementation* _implementation = new CityManagerImplementation(zserv);
@@ -791,6 +791,21 @@ int CityManager::getTotalCities() {
                return _implementation->getTotalCities();
 }
 
+bool CityManager::renameCity(CityRegion* city, const String& newName) {
+       CityManagerImplementation* _implementation = static_cast<CityManagerImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               if (!deployed)
+                       throw ObjectNotDeployedException(this);
+
+               DistributedMethod method(this, RPC_RENAMECITY__CITYREGION_STRING_);
+               method.addObjectParameter(city);
+               method.addAsciiParameter(newName);
+
+               return method.executeWithBooleanReturn();
+       } else
+               return _implementation->renameCity(city, newName);
+}
+
 void CityManager::sendMayoralStandings(CityRegion* city, CreatureObject* creature, SceneObject* terminal) {
        CityManagerImplementation* _implementation = static_cast<CityManagerImplementation*>(_getImplementation());
        if (_implementation == NULL) {
@@ -917,6 +932,21 @@ CityTax* CityManager::getCityTax(int idx) {
                return _implementation->getCityTax(idx);
 }
 
+void CityManager::sendChangeCityName(CityRegion* city, CreatureObject* mayor) {
+       CityManagerImplementation* _implementation = static_cast<CityManagerImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               if (!deployed)
+                       throw ObjectNotDeployedException(this);
+
+               DistributedMethod method(this, RPC_SENDCHANGECITYNAME__CITYREGION_CREATUREOBJECT_);
+               method.addObjectParameter(city);
+               method.addObjectParameter(mayor);
+
+               method.executeWithVoidReturn();
+       } else
+               _implementation->sendChangeCityName(city, mayor);
+}
+
 DistributedObjectServant* CityManager::_getImplementation() {
 
         if (!_updated) _updated = true;
@@ -1096,6 +1126,20 @@ int CityManagerImplementation::getTotalCities() {
        return (&cities)->size();
 }
 
+bool CityManagerImplementation::renameCity(CityRegion* city, const String& newName) {
+       // server/zone/managers/city/CityManager.idl():                 return 
+       if ((&cities)->contains(city->getRegionName())){
+       // server/zone/managers/city/CityManager.idl():                         cities.drop(city.getRegionName());
+       (&cities)->drop(city->getRegionName());
+       // server/zone/managers/city/CityManager.idl():                         cities.put(newName, city);
+       (&cities)->put(newName, city);
+       // server/zone/managers/city/CityManager.idl():                         return true;
+       return true;
+}
+       // server/zone/managers/city/CityManager.idl():                 return false;
+       return false;
+}
+
 /*
  *     CityManagerAdapter
  */
@@ -1359,6 +1403,12 @@ void CityManagerAdapter::invokeMethod(uint32 methid, DistributedMethod* inv) {
                        resp->insertSignedInt(getTotalCities());
                }
                break;
+       case RPC_RENAMECITY__CITYREGION_STRING_:
+               {
+                       String newName; 
+                       resp->insertBoolean(renameCity(static_cast<CityRegion*>(inv->getObjectParameter()), inv->getAsciiParameter(newName)));
+               }
+               break;
        case RPC_SENDMAYORALSTANDINGS__CITYREGION_CREATUREOBJECT_SCENEOBJECT_:
                {
                        sendMayoralStandings(static_cast<CityRegion*>(inv->getObjectParameter()), static_cast<CreatureObject*>(inv->getObjectParameter()), static_cast<SceneObject*>(inv->getObjectParameter()));
@@ -1394,6 +1444,11 @@ void CityManagerAdapter::invokeMethod(uint32 methid, DistributedMethod* inv) {
                        resp->insertBoolean(canSupportMoreDecorations(static_cast<CityRegion*>(inv->getObjectParameter())));
                }
                break;
+       case RPC_SENDCHANGECITYNAME__CITYREGION_CREATUREOBJECT_:
+               {
+                       sendChangeCityName(static_cast<CityRegion*>(inv->getObjectParameter()), static_cast<CreatureObject*>(inv->getObjectParameter()));
+               }
+               break;
        default:
                throw Exception("Method does not exists");
        }
@@ -1591,6 +1646,10 @@ int CityManagerAdapter::getTotalCities() {
        return (static_cast<CityManager*>(stub))->getTotalCities();
 }
 
+bool CityManagerAdapter::renameCity(CityRegion* city, const String& newName) {
+       return (static_cast<CityManager*>(stub))->renameCity(city, newName);
+}
+
 void CityManagerAdapter::sendMayoralStandings(CityRegion* city, CreatureObject* creature, SceneObject* terminal) {
        (static_cast<CityManager*>(stub))->sendMayoralStandings(city, creature, terminal);
 }
@@ -1619,6 +1678,10 @@ bool CityManagerAdapter::canSupportMoreDecorations(CityRegion* city) {
        return (static_cast<CityManager*>(stub))->canSupportMoreDecorations(city);
 }
 
+void CityManagerAdapter::sendChangeCityName(CityRegion* city, CreatureObject* mayor) {
+       (static_cast<CityManager*>(stub))->sendChangeCityName(city, mayor);
+}
+
 /*
  *     CityManagerHelper
  */
index d5ae58f..e4ded88 100644 (file)
@@ -254,6 +254,8 @@ public:
 
        int getTotalCities();
 
+       bool renameCity(CityRegion* city, const String& newName);
+
        void sendMayoralStandings(CityRegion* city, CreatureObject* creature, SceneObject* terminal = NULL);
 
        void promptMayoralVote(CityRegion* city, CreatureObject* creature, SceneObject* terminal = NULL);
@@ -272,6 +274,8 @@ public:
 
        CityTax* getCityTax(int idx);
 
+       void sendChangeCityName(CityRegion* city, CreatureObject* mayor);
+
        DistributedObjectServant* _getImplementation();
        DistributedObjectServant* _getImplementationForRead();
 
@@ -449,6 +453,8 @@ public:
 
        int getTotalCities();
 
+       bool renameCity(CityRegion* city, const String& newName);
+
        void sendMayoralStandings(CityRegion* city, CreatureObject* creature, SceneObject* terminal = NULL);
 
        void promptMayoralVote(CityRegion* city, CreatureObject* creature, SceneObject* terminal = NULL);
@@ -467,6 +473,8 @@ public:
 
        CityTax* getCityTax(int idx);
 
+       void sendChangeCityName(CityRegion* city, CreatureObject* mayor);
+
        WeakReference<CityManager*> _this;
 
        operator const CityManager*();
@@ -606,6 +614,8 @@ public:
 
        int getTotalCities();
 
+       bool renameCity(CityRegion* city, const String& newName);
+
        void sendMayoralStandings(CityRegion* city, CreatureObject* creature, SceneObject* terminal);
 
        void promptMayoralVote(CityRegion* city, CreatureObject* creature, SceneObject* terminal);
@@ -620,6 +630,8 @@ public:
 
        bool canSupportMoreDecorations(CityRegion* city);
 
+       void sendChangeCityName(CityRegion* city, CreatureObject* mayor);
+
 };
 
 class CityManagerHelper : public DistributedObjectClassHelper, public Singleton<CityManagerHelper> {
index 53f3d94..8f13354 100644 (file)
@@ -241,6 +241,17 @@ class CityManager extends ManagedService implements Logger {
        public int getTotalCities() {
                return cities.size();
        }
+
+       public boolean renameCity(CityRegion city, final string newName){
+               if(cities.contains(city.getRegionName())){
+                       cities.drop(city.getRegionName());
+                       cities.put(newName, city);
+                       return true;
+               }       
+
+               return false;
+
+       }
        
        /**
         * @pre city locked, creature locked, sceneObject locked
@@ -274,4 +285,6 @@ class CityManager extends ManagedService implements Logger {
        @local
        public native CityTax getCityTax(int idx);
 
+       public native void sendChangeCityName(CityRegion city, CreatureObject mayor);
+
 }
index 3fe2444..46094b2 100644 (file)
@@ -34,6 +34,8 @@
 #include "server/zone/objects/building/BuildingObject.h"
 #include "TaxPayMailTask.h"
 #include "server/zone/templates/tangible/SharedStructureObjectTemplate.h"
+#include "server/zone/objects/player/sui/callbacks/RenameCitySuiCallback.h"
+
 
 #ifndef CITY_DEBUG
 #define CITY_DEBUG
@@ -2249,3 +2251,25 @@ bool CityManagerImplementation::canSupportMoreDecorations(CityRegion* city) {
                        * city->getCityRank());
 
 }
+
+void CityManagerImplementation::sendChangeCityName(CityRegion* city, CreatureObject* mayor){
+       PlayerObject* ghost = mayor->getPlayerObject();
+
+       if (ghost == NULL)
+               return;
+
+       if(ghost->hasSuiBoxWindowType(SuiWindowType::CITY_RENAME))
+               return;
+
+       if(!mayor->checkCooldownRecovery("rename_city_cooldown") && !ghost->isPrivileged()){
+               mayor->sendSystemMessage("You can't change the city name now");
+               return;
+       }
+       ManagedReference<SuiInputBox*> inputBox = new SuiInputBox(mayor, SuiWindowType::CITY_RENAME, 0);
+       inputBox->setPromptTitle("@city/city:city_name_new_t"); //Change City Name
+       inputBox->setPromptText("@city/city:city_name_new_d"); //Enter the new city name below.  Your city must be uniquely named for this planet.  Note that the citizens of your town will receive an email notifying them of the city name change.
+       inputBox->setCallback(new RenameCitySuiCallback(mayor->getZone(), city) );
+
+       ghost->addSuiBox(inputBox);
+       mayor->sendMessage(inputBox->generateMessage());
+}
index 1702533..e7757c4 100644 (file)
@@ -90,6 +90,10 @@ public:
                departureVector = shuttle->getWorldPosition();
        }
 
+       void setPointName(const String& name){
+               pointName = name;
+       }
+
        inline String& getPointZone() {
                return pointZone;
        }
index 069f508..5579953 100644 (file)
@@ -133,6 +133,7 @@ public:
        static const uint16 CITY_MAYOR_VOTE = 128;
        static const uint16 CITY_ADJUST_TAX = 129;
        static const uint16 CITY_TAX_PROMPT = 130;
+       static const uint16 CITY_RENAME = 131;
 
        //Structure 141 - 170
        static const uint16 STRUCTURE_STATUS = 141;
diff --git a/MMOCoreORB/src/server/zone/objects/player/sui/callbacks/RenameCitySuiCallback.h b/MMOCoreORB/src/server/zone/objects/player/sui/callbacks/RenameCitySuiCallback.h
new file mode 100644 (file)
index 0000000..ab7ac3f
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * RenameCitySuiCallback.h
+ *
+ *  Created on: Sep 2, 2013
+ *      Author: root
+ */
+
+#ifndef RENAMECITYSUICALLBACK_H_
+#define RENAMECITYSUICALLBACK_H_
+#include "server/zone/objects/player/sui/SuiCallback.h"
+#include "server/zone/Zone.h"
+#include "server/zone/objects/region/CityRegion.h"
+#include "server/zone/managers/city/CityManager.h"
+#include "server/zone/managers/name/NameManager.h"
+#include "server/zone/managers/planet/PlanetManager.h"
+
+
+class RenameCitySuiCallback : public SuiCallback {
+       ManagedWeakReference<Zone*> zne;
+       ManagedWeakReference<CityRegion*> city;
+
+public:
+       RenameCitySuiCallback(Zone* zone, CityRegion* city)
+                       : SuiCallback(zone->getZoneServer()) {
+
+               this->zne = zone;
+               this->city = city;
+       }
+
+       void run(CreatureObject* creature, SuiBox* sui, bool cancelPressed, Vector<UnicodeString>* args) {
+               if(cancelPressed)
+                       return;
+
+               if(city == NULL || zne == NULL || server == NULL)
+                       return;
+
+               String cityName = args->get(0).toString();
+
+               NameManager* nameManager = NameManager::instance();
+
+               if (nameManager->isProfane(cityName) || cityName.contains("\\") || cityName.contains("#")) {
+                       creature->sendSystemMessage("@player_structure:obscene"); //That name was rejected by the name filter. Try a different name.
+                       return;
+               }
+
+               CityManager* cityManager = server->getCityManager();
+               ManagedReference<CityRegion*> cityObject = city.get();
+               ManagedReference<Zone*> zone = zne.get();
+
+               if(cityObject->getMayorID() != creature->getObjectID())
+                       return;
+
+               Locker mlock(cityManager, creature);
+
+               if(!cityManager->renameCity(cityObject, cityName))
+                       return;
+
+               mlock.release();
+
+               Locker clock(cityObject, creature);
+
+               String oldName = cityObject->getRegionName();
+               bool isRegistered = cityObject->isRegistered();
+
+               if(isRegistered)
+                       cityManager->unregisterCity(cityObject, creature);
+
+               cityObject->setCustomRegionName(cityName);
+
+               if(cityObject->hasShuttleInstallation()) {
+                       Reference<PlanetTravelPoint*> tp = zone->getPlanetManager()->getPlanetTravelPoint(oldName);
+
+                       if(tp != NULL) {
+                               Reference<PlanetTravelPoint*> newTP = tp;
+                               newTP->setPointName(cityName);
+                               zone->getPlanetManager()->removePlayerCityTravelPoint(oldName);
+                               zone->getPlanetManager()->addPlayerCityTravelPoint(newTP);
+                       }
+               }
+               if(isRegistered)
+                       cityManager->registerCity(cityObject, creature);
+
+               creature->addCooldown("rename_city_cooldown", 604800 * 4); // 4 week cooldown.  need to investigate
+               creature->sendSystemMessage("@city/city:name_changed"); // The city name has been successfully changed.");
+
+       }
+};
+
+
+
+
+#endif /* RENAMECITYSUICALLBACK_H_ */
index ca545c7..06360fe 100644 (file)
@@ -12,6 +12,7 @@
 #include "server/zone/objects/creature/CreatureObject.h"
 #include "server/zone/managers/city/CityManager.h"
 #include "server/zone/objects/player/PlayerObject.h"
+
 #ifndef CITY_DEBUG
 #define CITY_DEBUG
 #endif
@@ -96,6 +97,9 @@ int CityManagementMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject
        case 215: //Treasury Report
                cityManager->sendTreasuryReport(city, player, sceneObject);
                break;
+       case 217:  // Change Name
+               cityManager->sendChangeCityName(city, player);
+               break;
        case 218: //Manage Militia
                if (city->isMayor(player->getObjectID()))
                        cityManager->sendManageMilitia(city, player, sceneObject);