Instructions Jenkins Doxygen

[Added] special type waypoints can now be created in Lua 28/1628/3
authorIvojedi <ivojedi@swgemu.com>
Sun, 11 May 2014 19:14:23 +0000 (12:14 -0700)
committerIvojedi <ivojedi@swgemu.com>
Sun, 11 May 2014 19:14:23 +0000 (12:14 -0700)
[Changed] ThemeParkLogic now uses special type waypoints
[Changed] race track engine now uses special type waypoints

Change-Id: I4ca4b6a2bfae4c7a174a3d0e2e004705f842b31c

12 files changed:
MMOCoreORB/bin/scripts/quest/tasks/go_to_theater.lua
MMOCoreORB/bin/scripts/quest/tasks/tests/go_to_theater_Test.lua
MMOCoreORB/bin/scripts/screenplays/racetracks/racetrackengine.lua
MMOCoreORB/bin/scripts/screenplays/tasks/dolac_legasi.lua
MMOCoreORB/bin/scripts/screenplays/tasks/hedon_istee.lua
MMOCoreORB/bin/scripts/screenplays/themepark/themeParkLogic.lua
MMOCoreORB/src/server/zone/managers/director/DirectorManager.cpp
MMOCoreORB/src/server/zone/objects/player/LuaPlayerObject.cpp
MMOCoreORB/src/server/zone/objects/player/LuaPlayerObject.h
MMOCoreORB/src/server/zone/objects/player/PlayerObject.idl
MMOCoreORB/src/server/zone/objects/player/PlayerObjectImplementation.cpp
MMOCoreORB/src/server/zone/objects/waypoint/WaypointObject.idl

index bc2df98..6ba61b0 100644 (file)
@@ -107,7 +107,7 @@ function GoToTheater:taskStart(pCreatureObject)
                                if spawnedMobilesList ~= nil then
                                        if self:setupActiveArea(pCreatureObject, spawnPoint) then
                                                local waypointId = ObjectManager.withPlayerObject(creatureObject:getPlayerObject(), function(playerObject)
-                                                       return playerObject:addWaypoint(creatureObject:getZoneName(), self.waypointDescription, "", spawnPoint[1], spawnPoint[3], WAYPOINTWHITE, true, true)
+                                                       return playerObject:addWaypoint(creatureObject:getZoneName(), self.waypointDescription, "", spawnPoint[1], spawnPoint[3], WAYPOINTWHITE, true, true, 0)
                                                end)
 
                                                if waypointId ~= nil then
index 1f095ea..2bfcdd9 100644 (file)
@@ -218,7 +218,7 @@ describe("GoToTheater", function()
                                                        it("Should generate an active waypoint for the player to the theater.", function()
                                                                testGoToTheater:start(pCreatureObject)
 
-                                                               assert.spy(playerObject.addWaypoint).was.called_with(playerObject, zoneName, testGoToTheater.waypointDescription, "", spawnAreaPosition[1], spawnAreaPosition[3], WAYPOINTWHITE, true, true)
+                                                               assert.spy(playerObject.addWaypoint).was.called_with(playerObject, zoneName, testGoToTheater.waypointDescription, "", spawnAreaPosition[1], spawnAreaPosition[3], WAYPOINTWHITE, true, true, 0)
                                                        end)
 
                                                        it("Should store the id of the waypoint on the player", function()
index b0b15cf..bcc6a92 100644 (file)
@@ -16,18 +16,17 @@ function RaceTrack:createRaceTrack()
 end
 
 function RaceTrack:startRacing(pObject)
-  ObjectManager.withCreatureAndPlayerObject(pObject, function(creatureObject, playerObject)
-       clearScreenPlayData(pObject,self.trackConfig.trackName )
-    self:createResetPlayerUnfinishedEvent(pObject)
-               local waypointID = playerObject:addWaypoint(self.trackConfig.planetName,self.trackConfig.trackCheckpoint .. "0",self.trackConfig.trackCheckpoint .. "0",self.trackConfig.waypoints[1].x,self.trackConfig.waypoints[1].y,WAYPOINTWHITE,true,true)
+       ObjectManager.withCreatureAndPlayerObject(pObject, function(creatureObject, playerObject)
+               clearScreenPlayData(pObject,self.trackConfig.trackName )
+               self:createResetPlayerUnfinishedEvent(pObject)
+               local waypointID = playerObject:addWaypoint(self.trackConfig.planetName,self.trackConfig.trackCheckpoint .. "0",self.trackConfig.trackCheckpoint .. "0",self.trackConfig.waypoints[1].x,self.trackConfig.waypoints[1].y,WAYPOINTWHITE,true,true,WAYPOINTRACETRACK)
                --local time = os.time()
                local time = getTimestampMilli()
                writeScreenPlayData(pObject, self.trackConfig.trackName, "starttime", time)
-               writeScreenPlayData(pObject, self.trackConfig.trackName, "waypointID", waypointID)
                writeScreenPlayData(pObject, self.trackConfig.trackName, "waypoint", 1)
                creatureObject:sendSystemMessage("@theme_park/racing/racing:go_fly")
                creatureObject:playMusicMessage("sound/music_combat_bfield_lp.snd")
-   end)
+       end)
 end
 
 function RaceTrack:processWaypoint(pActiveArea, pObject)
@@ -36,11 +35,6 @@ function RaceTrack:processWaypoint(pActiveArea, pObject)
                if lastIndex ~= "" then
                        local index = self:getWaypointIndex(pActiveArea)
                        if tonumber(lastIndex)==index then
-                               local lastWaypointID =  readScreenPlayData(pObject, self.trackConfig.trackName, "waypointID")
-                               if lastWaypointID=="" then
-                                       return nil -- Somethings gone wrong
-                               end
-                               playerObject:removeWaypoint(tonumber(lastWaypointID),true)
                                if tonumber(index)==table.getn(self.trackConfig.waypoints) then
                                        self:finalWaypoint(pActiveArea, pObject)
                                else
@@ -59,22 +53,22 @@ end
 
 function RaceTrack:actuallyProcessWaypoint(pObject,index)
        ObjectManager.withCreatureAndPlayerObject(pObject, function(creatureObject,playerObject)
-               local waypointID = playerObject:addWaypoint(self.trackConfig.planetName,self.trackConfig.trackCheckpoint .. index,self.trackConfig.trackCheckpoint .. index,self.trackConfig.waypoints[index+1].x,self.trackConfig.waypoints[index+1].y,WAYPOINTWHITE,true,true)
+               local waypointID = playerObject:addWaypoint(self.trackConfig.planetName,self.trackConfig.trackCheckpoint .. index,self.trackConfig.trackCheckpoint .. index,self.trackConfig.waypoints[index+1].x,self.trackConfig.waypoints[index+1].y,WAYPOINTWHITE,true,true,WAYPOINTRACETRACK)
                local seconds = self:getLaptime(pObject)
                creatureObject:sendSystemMessage(self.trackConfig.trackLaptime .. index)
                creatureObject:sendSystemMessage("Time " .. self:roundNumber(seconds/1000) .. "s")
-               writeScreenPlayData(pObject, self.trackConfig.trackName, "waypointID", waypointID)
                writeScreenPlayData(pObject,self.trackConfig.trackName, "waypoint", index+1)
                creatureObject:playMusicMessage("sound/music_combat_bfield_lp.snd")
        end)
 end
 
 function  RaceTrack:finalWaypoint(pActiveArea, pObject)
-       ObjectManager.withCreatureObject(pObject, function(creatureObject)
+       ObjectManager.withCreatureAndPlayerObject(pObject, function(creatureObject,playerObject)
                creatureObject:playMusicMessage("sound/music_combat_bfield_vict.snd")
                self:checkPersonalTime(pObject)
                self:checkServerRecordTime(pObject)
                clearScreenPlayData(pObject,self.trackConfig.trackName )
+               playerObject:removeWaypointBySpecialType(WAYPOINTRACETRACK)
        end)
 end
 function RaceTrack:getLaptime(pObject)
@@ -216,12 +210,8 @@ function RaceTrack:resetPlayerUnfinishedEventHandler(pObject)
     if not(startTime == nil) then 
       local time = getTimestampMilli()
       if  math.abs((time/1000) - (startTime/1000)) > (self.trackConfig.expiryTime-5) then
-        local lastWaypointID =  readScreenPlayData(pObject, self.trackConfig.trackName, "waypointID")
         clearScreenPlayData(pObject,self.trackConfig.trackName )
-        if lastWaypointID=="" then
-          return nil -- Somethings gone wrong
-        end
-        playerObject:removeWaypoint(tonumber(lastWaypointID),true)
+        playerObject:removeWaypointBySpecialType(WAYPOINTRACETRACK)
         if self.trackConfig.debugMode==1 then
           printf("Reset Player for :" .. self.trackConfig.trackName .. "\n")
         end
@@ -230,4 +220,4 @@ function RaceTrack:resetPlayerUnfinishedEventHandler(pObject)
   end)
 end
 
-return RaceTrack
\ No newline at end of file
+return RaceTrack
index b6ddb16..f4dd055 100644 (file)
@@ -574,7 +574,7 @@ function dolac_legasi_handler:beginQuest1(player)
        local pPlayerObject = player:getPlayerObject()
        local playerObject = LuaPlayerObject(pPlayerObject)
 
-       playerObject:addWaypoint("dathomir", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_name_1", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_description_1", dolac_legasi_screenplay.loc.prisoner.x, dolac_legasi_screenplay.loc.prisoner.y, WAYPOINTBLUE, true, true)
+       playerObject:addWaypoint("dathomir", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_name_1", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_description_1", dolac_legasi_screenplay.loc.prisoner.x, dolac_legasi_screenplay.loc.prisoner.y, WAYPOINTBLUE, true, true, 0)
 
        dolac_legasi_screenplay:setState(player, dolac_legasi_screenplay.states.quest1.started)
 end
@@ -583,7 +583,7 @@ function dolac_legasi_handler:beginQuest2(player)
        local pPlayerObject = player:getPlayerObject()
        local playerObject = LuaPlayerObject(pPlayerObject)
 
-       playerObject:addWaypoint("dathomir", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_name_2", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_description_2", dolac_legasi_screenplay.loc.djk.x, dolac_legasi_screenplay.loc.djk.y, WAYPOINTBLUE, true, true)
+       playerObject:addWaypoint("dathomir", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_name_2", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_description_2", dolac_legasi_screenplay.loc.djk.x, dolac_legasi_screenplay.loc.djk.y, WAYPOINTBLUE, true, true, 0)
        dolac_legasi_screenplay:setState(player, dolac_legasi_screenplay.states.quest2.started)
 end
 
@@ -591,7 +591,7 @@ function dolac_legasi_handler:beginQuest3(player)
        local pPlayerObject = player:getPlayerObject()
        local playerObject = LuaPlayerObject(pPlayerObject)
 
-       playerObject:addWaypoint("dathomir", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_name_3", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_description_3", dolac_legasi_screenplay.loc.djm.x, dolac_legasi_screenplay.loc.djm.y, WAYPOINTBLUE, true, true)
+       playerObject:addWaypoint("dathomir", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_name_3", "@static_npc/dathomir/dathomir_imperialprison_dolac_legasi:waypoint_description_3", dolac_legasi_screenplay.loc.djm.x, dolac_legasi_screenplay.loc.djm.y, WAYPOINTBLUE, true, true, 0)
        dolac_legasi_screenplay:setState(player, dolac_legasi_screenplay.states.quest3.started)
 end
 
index 0b951b2..28f489f 100644 (file)
@@ -97,7 +97,7 @@ function HedonIstee:handleTreasureMapCallback(pCreature, pSui, cancelPressed)
                        
                        if (pPlayerObject ~= nil) then
                                local playerObject = LuaPlayerObject(pPlayerObject)
-                               local waypointID = playerObject:addWaypoint("tatooine", "Ancient Treasure Location", "", HedonIstee.mapX, HedonIstee.mapY, WAYPOINTGREEN, true, true)
+                               local waypointID = playerObject:addWaypoint("tatooine", "Ancient Treasure Location", "", HedonIstee.mapX, HedonIstee.mapY, WAYPOINTGREEN, true, true, 0)
                                local activeAreaID = self:spawnActiveArea()
                                writeData(creature:getObjectID() .. ":scytheTreasureWaypointID", waypointID)
                                writeData(creature:getObjectID() .. ":treasureActiveAreaID", activeAreaID)
@@ -129,7 +129,7 @@ function HedonIstee:spawnTreasure(pTreasureMap, pPlayer)
                local y = HedonIstee.mapY - math.random(200)
                local z = getTerrainHeight(pPlayer, x, y)
 
-               playerObject:addWaypoint("tatooine", "Ancient Treasure Location", "", x, y, WAYPOINTGREEN, true, true)
+               playerObject:addWaypoint("tatooine", "Ancient Treasure Location", "", x, y, WAYPOINTGREEN, true, true, 0)
 
                local pChest = spawnSceneObject("tatooine", "object/tangible/container/drum/treasure_drum.iff", x, z, y, 0, 0, 0, 0, 0)
                local pKrayt = spawnMobile("tatooine", "canyon_krayt_dragon", 0, x, z, y, 0, 0)
index 6f8b319..4d813f0 100644 (file)
@@ -1,4 +1,5 @@
 require("screenplays.screenplay")
+local ObjectManager = require("managers.object.object_manager")
 
 WAYPOINT_COLOR_PURPLE = 5
 SIT = 1
@@ -685,28 +686,14 @@ function ThemeParkLogic:getDefaultWaypointName(pConversingPlayer, direction)
        end
 end
 
-function ThemeParkLogic:removeWaypoint(pConversingPlayer)
-       if pConversingPlayer ~= nil then
-               local creature = LuaCreatureObject(pConversingPlayer)
-               local pGhost = creature:getPlayerObject()
-               if pGhost ~= nil then
-                       local ghost = LuaPlayerObject(pGhost)
-                       local waypointID = readData(creature:getObjectID() .. "themePark:waypointID")
-                       ghost:removeWaypoint(waypointID, true)
-               end
-       end
-end
-
 function ThemeParkLogic:updateWaypoint(pConversingPlayer, planetName, x, y, direction)
-       self:removeWaypoint(pConversingPlayer)
        if pConversingPlayer ~= nil then
                local creature = LuaCreatureObject(pConversingPlayer)
                local pGhost = creature:getPlayerObject()
                if pGhost ~= nil then
                        local ghost = LuaPlayerObject(pGhost)
 
-                       waypointID = ghost:addWaypoint(planetName, self:getMissionDescription(pConversingPlayer, direction), "", x, y, WAYPOINT_COLOR_PURPLE, true, true)
-                       writeData(creature:getObjectID() .. "themePark:waypointID", waypointID)
+                       waypointID = ghost:addWaypoint(planetName, self:getMissionDescription(pConversingPlayer, direction), "", x, y, WAYPOINT_COLOR_PURPLE, true, true, WAYPOINTTHEMEPARK)
                end
        end
 end
@@ -966,7 +953,9 @@ function ThemeParkLogic:cleanUpMission(pConversingPlayer)
                return false
        end
 
-       self:removeWaypoint(pConversingPlayer)
+       ObjectManager.withCreaturePlayerObject(pConversingPlayer, function(playerObject)
+               playerObject:removeWaypointBySpecialType(WAYPOINTTHEMEPARK)
+       end)
 
        local creature = LuaCreatureObject(pConversingPlayer)
 
index ce59aec..f230b67 100644 (file)
@@ -259,6 +259,10 @@ void DirectorManager::initializeLuaEngine(Lua* luaEngine) {
        luaEngine->setGlobalInt("WAYPOINTWHITE", WaypointObject::COLOR_WHITE);
        luaEngine->setGlobalInt("WAYPOINTORANGE", WaypointObject::COLOR_ORANGE);
 
+       //Waypoint Special Types
+       luaEngine->setGlobalInt("WAYPOINTTHEMEPARK", WaypointObject::SPECIALTYPE_THEMEPARK);
+       luaEngine->setGlobalInt("WAYPOINTRACETRACK", WaypointObject::SPECIALTYPE_RACETRACK);
+
        luaEngine->setGlobalInt("HEALTH", CreatureAttribute::HEALTH);
        luaEngine->setGlobalInt("CONSTITUTION", CreatureAttribute::CONSTITUTION);
        luaEngine->setGlobalInt("STAMINA", CreatureAttribute::STAMINA);
index 226d4c7..c3cd38c 100644 (file)
@@ -24,6 +24,7 @@ Luna<LuaPlayerObject>::RegType LuaPlayerObject::Register[] = {
                { "decreaseFactionStanding", &LuaPlayerObject::decreaseFactionStanding },
                { "addWaypoint", &LuaPlayerObject::addWaypoint },
                { "removeWaypoint", &LuaPlayerObject::removeWaypoint },
+               { "removeWaypointBySpecialType", &LuaPlayerObject::removeWaypointBySpecialType },
                { "addRewardedSchematic", &LuaPlayerObject::addRewardedSchematic },
                { "addPermissionGroup", &LuaPlayerObject::addPermissionGroup },
                { "removePermissionGroup", &LuaPlayerObject::removePermissionGroup },
@@ -127,16 +128,20 @@ int LuaPlayerObject::decreaseFactionStanding(lua_State* L) {
 
 //addWaypoint(planet, name, desc, x, y, color, active, notifyClient)
 int LuaPlayerObject::addWaypoint(lua_State* L) {
-       String planet = lua_tostring(L, -8);
-       String customName = lua_tostring(L, -7);
-       String desc = lua_tostring(L, -6);
-       float x = lua_tonumber(L, -5);
-       float y = lua_tonumber(L, -4);
-       int color = lua_tointeger(L, -3);
-       bool active = lua_toboolean(L, -2);
-       bool notifyClient = lua_toboolean(L, -1);
-
-       ManagedReference<WaypointObject*> waypoint = realObject->addWaypoint(planet, x, y, false);
+       String planet = lua_tostring(L, -9);
+       String customName = lua_tostring(L, -8);
+       String desc = lua_tostring(L, -7);
+       float x = lua_tonumber(L, -6);
+       float y = lua_tonumber(L, -5);
+       int color = lua_tointeger(L, -4);
+       bool active = lua_toboolean(L, -3);
+       bool notifyClient = lua_toboolean(L, -2);
+       int specialTypeID = lua_tointeger(L, -1);
+
+       ManagedReference<WaypointObject*> waypoint = realObject->getZoneServer()->createObject(0xc456e788, 1).castTo<WaypointObject*>();
+       waypoint->setPlanetCRC(planet.hashCode());
+       waypoint->setPosition(x, 0, y);
+       waypoint->setSpecialTypeID(specialTypeID);
        waypoint->setCustomObjectName(customName, false);
        waypoint->setColor(color);
        waypoint->setActive(active);
@@ -144,7 +149,7 @@ int LuaPlayerObject::addWaypoint(lua_State* L) {
        if (!desc.isEmpty())
                waypoint->setDetailedDescription(desc);
 
-       realObject->setWaypoint(waypoint, notifyClient);
+       realObject->addWaypoint(waypoint, false, notifyClient);
 
        lua_pushinteger(L, waypoint->getObjectID());
 
@@ -160,6 +165,14 @@ int LuaPlayerObject::removeWaypoint(lua_State* L) {
        return 0;
 }
 
+int LuaPlayerObject::removeWaypointBySpecialType(lua_State* L) {
+       int specialTypeID = lua_tointeger(L, -1);
+
+       realObject->removeWaypointBySpecialType(specialTypeID);
+
+       return 0;
+}
+
 int LuaPlayerObject::addRewardedSchematic(lua_State* L){
        String templateString = lua_tostring(L, -4);
        short type = lua_tointeger(L, -3);
index 24e4c8e..c7f79a6 100644 (file)
@@ -34,6 +34,7 @@ public:
        int decreaseFactionStanding(lua_State* L);
        int addWaypoint(lua_State* L);
        int removeWaypoint(lua_State* L);
+       int removeWaypointBySpecialType(lua_State* L);
        int addRewardedSchematic(lua_State* L);
        int addPermissionGroup(lua_State* L);
        int removePermissionGroup(lua_State* L);
index 63d65e3..98353fd 100644 (file)
@@ -467,7 +467,7 @@ class PlayerObject extends IntangibleObject {
         */
        @local
        public native WaypointObject addWaypoint(final string planet, float positionX, float positionY, boolean notifyClient = true);
-       
+
        /**
         * Removes a waypoint from this player
         * @pre { this is locked }
@@ -476,7 +476,16 @@ class PlayerObject extends IntangibleObject {
         * @param notifyClient determines whether to update the client with the changes
         */
        public native void removeWaypoint(unsigned long waypointID, boolean notifyClient = true);
-       
+
+       /**
+        * Removes a waypoint of a special type from this player
+        * @pre { this is locked }
+        * @post { this is locked, waypoint list doesnt contain a waypoint of the special type }
+        * @param specialTypeID id of special type to remove
+        * @param notifyClient determines whether to update the client with the changes
+        */
+       public native void removeWaypointBySpecialType(int specialTypeID, boolean notifyClient = true);
+
        /**
         * Adds new abilities commands to player
         * @pre { this is locked }
index 5d71fb4..dc825d4 100644 (file)
@@ -688,6 +688,25 @@ void PlayerObjectImplementation::removeWaypoint(uint64 waypointID, bool notifyCl
 
 }
 
+void PlayerObjectImplementation::removeWaypointBySpecialType(int specialTypeID, bool notifyClient) {
+       uint64 waypointID = waypointList.getWaypointBySpecialType(specialTypeID);
+
+       while (waypointID != 0) {
+               if (notifyClient) {
+                       PlayerObjectDeltaMessage8* msg = new PlayerObjectDeltaMessage8(this);
+                       msg->startUpdate(1);
+                       waypointList.drop(waypointID, msg, 1);
+                       msg->close();
+
+                       sendMessage(msg);
+               } else {
+                       waypointList.drop(waypointID);
+               }
+
+               waypointID = waypointList.getWaypointBySpecialType(specialTypeID);
+       }
+
+}
 
 WaypointObject* PlayerObjectImplementation::addWaypoint(const String& planet, float positionX, float positionY, bool notifyClient) {
        ManagedReference<WaypointObject*> obj = getZoneServer()->createObject(0xc456e788, 1).castTo<WaypointObject*>();
index e2cf568..b71cbdd 100644 (file)
@@ -34,6 +34,8 @@ class WaypointObject extends IntangibleObject {
        public static final int SPECIALTYPE_FINDMYTRAINER = 4;
        public static final int SPECIALTYPE_FINDOBJECT = 5;
        public static final int SPECIALTYPE_RESOURCE = 6;
+       public static final int SPECIALTYPE_THEMEPARK = 7;
+       public static final int SPECIALTYPE_RACETRACK = 8;
        
        public WaypointObject() {
                Logger.setLoggingName("WaypointObject");