Instructions Jenkins Doxygen

[added] Jump to Lightspeed Chassis broker NPC in Coronet, Corellia, with 26/2026/3
authorValkyra <lyhtmyst@gmail.com>
Fri, 11 Jul 2014 03:08:49 +0000 (23:08 -0400)
committergerrit <gerrit@review.swgemu.com>
Sat, 12 Jul 2014 13:53:18 +0000 (13:53 +0000)
basic testing dialogue and four ship tradein options.
[note] Some code by user XBitX.

Change-Id: Ia100c4eb16c0a605b1d101b882aee53708804724

MMOCoreORB/bin/scripts/mobile/conversations.lua
MMOCoreORB/bin/scripts/mobile/conversations/space/chassis_dealer_conv.lua [new file with mode: 0755]
MMOCoreORB/bin/scripts/mobile/space/chassis_dealer.lua [new file with mode: 0644]
MMOCoreORB/bin/scripts/mobile/space/serverobjects.lua
MMOCoreORB/bin/scripts/screenplays/cities/corellia_coronet.lua
MMOCoreORB/bin/scripts/screenplays/screenplays.lua
MMOCoreORB/bin/scripts/screenplays/space/chassis_dealer.lua [new file with mode: 0644]
MMOCoreORB/bin/scripts/screenplays/space/space_chassis_dealer_conv_handler.lua [new file with mode: 0644]

index 692a925..39ccc57 100644 (file)
@@ -87,3 +87,6 @@ includeFile("conversations/racetracks/mosespaconversation.lua")
 includeFile("conversations/racetracks/narmleconversation.lua")
 includeFile("conversations/racetracks/lokconversation.lua")
 includeFile("conversations/racetracks/nashalconversation.lua")
+
+-- Space
+includeFile("conversations/space/chassis_dealer_conv.lua")
diff --git a/MMOCoreORB/bin/scripts/mobile/conversations/space/chassis_dealer_conv.lua b/MMOCoreORB/bin/scripts/mobile/conversations/space/chassis_dealer_conv.lua
new file mode 100755 (executable)
index 0000000..b0d3f20
--- /dev/null
@@ -0,0 +1,62 @@
+chassis_dealer_convotemplate = ConvoTemplate:new {\r
+       initialScreen = "chassis_dealer_greeting",\r
+       templateType = "Lua",\r
+       luaClassHandler = "chassis_dealer_conv_handler",\r
+       screens = {}\r
+}\r
+\r
+chassis_dealer_greeting = ConvoScreen:new {\r
+       id = "chassis_dealer_greeting",\r
+       leftDialog = "@conversation/chassis_npc:s_9ed93871",\r
+       stopConversation = "false",\r
+       options = {\r
+               {"@conversation/chassis_npc:s_2f553ea8", "chassis_dealer_buy_chassis"},\r
+               {"@conversation/chassis_npc:s_94e3013f", "chassis_dealer_sell_components"},\r
+               {"@conversation/chassis_npc:s_93a92e8", "chassis_dealer_how_do_i"},\r
+               {"@conversation/chassis_npc:s_42d3759c", "chassis_dealer_come_back_later"},\r
+       }\r
+}\r
+\r
+chassis_dealer_convotemplate:addScreen(chassis_dealer_greeting);\r
+\r
+chassis_dealer_buy_chassis = ConvoScreen:new {\r
+       id = "chassis_dealer_buy_chassis",\r
+       leftDialog = "@conversation/chassis_npc:s_bcb592f",\r
+       stopConversation = "true",\r
+       options = {\r
+       }\r
+}\r
+\r
+chassis_dealer_convotemplate:addScreen(chassis_dealer_buy_chassis);\r
+\r
+chassis_dealer_sell_components = ConvoScreen:new {\r
+       id = "chassis_dealer_sell_components",\r
+       leftDialog = "@conversation/chassis_npc:s_aae81853",\r
+       stopConversation = "true",\r
+       options = {\r
+       }\r
+}\r
+\r
+chassis_dealer_convotemplate:addScreen(chassis_dealer_sell_components);\r
+\r
+chassis_dealer_how_do_i = ConvoScreen:new {\r
+       id = "chassis_dealer_how_do_i",\r
+       leftDialog = "@conversation/chassis_npc:s_37386aa2", -- You need to procure a set of chassis blueprints from a Shipwright. Once you have the blueprints, you must come to a chassis dealer to have the chassis built to your specifications.\r
+       stopConversation = "true",\r
+       options = {\r
+       }\r
+}\r
+\r
+chassis_dealer_convotemplate:addScreen(chassis_dealer_how_do_i);\r
+\r
+chassis_dealer_come_back_later = ConvoScreen:new {\r
+       id = "chassis_dealer_come_back_later",\r
+       leftDialog = "@conversation/chassis_npc:s_37f48153",\r
+       stopConversation = "true",\r
+       options = {\r
+       }\r
+}\r
+\r
+chassis_dealer_convotemplate:addScreen(chassis_dealer_come_back_later);\r
+\r
+addConversationTemplate("chassis_dealer_convotemplate", chassis_dealer_convotemplate);\r
diff --git a/MMOCoreORB/bin/scripts/mobile/space/chassis_dealer.lua b/MMOCoreORB/bin/scripts/mobile/space/chassis_dealer.lua
new file mode 100644 (file)
index 0000000..ef125d1
--- /dev/null
@@ -0,0 +1,38 @@
+chassis_dealer = Creature:new {
+       objectName = "",
+       customName = "Chassis Dealer",
+       socialGroup = "Townsperson",
+       pvpFaction = "Townsperson",
+       faction = "",
+       level = 100,
+       chanceHit = 1,
+       damageMin = 645,
+       damageMax = 1000,
+       baseXp = 9429,
+       baseHAM = 24000,
+       baseHAMmax = 30000,
+       armor = 0,
+       resists = {0,0,0,0,0,0,0,0,-1},
+       meatType = "",
+       meatAmount = 0,
+       hideType = "",
+       hideAmount = 0,
+       boneType = "",
+       boneAmount = 0,
+       milk = 0,
+       tamingChance = 0,
+       ferocity = 0,
+       pvpBitmask = NONE,
+       creatureBitmask = PACK,
+       optionsBitmask = 264,
+       diet = HERBIVORE,
+
+       templates = {"object/mobile/space_chassis_broker_01.iff"},
+       lootGroups = {},
+       weapons = {},
+       conversationTemplate = "chassis_dealer_convotemplate",
+       attacks = {
+       }
+}
+
+CreatureTemplates:addCreatureTemplate(chassis_dealer, "chassis_dealer")
index c9bea29..4cc5026 100644 (file)
@@ -47,3 +47,4 @@ includeFile("space/vrovel.lua")
 includeFile("space/warvog_arkon.lua")
 includeFile("space/wlinc_tchrr.lua")
 includeFile("space/zhanks.lua")
+includeFile("space/chassis_dealer.lua")
\ No newline at end of file
index b0530ba..daec751 100644 (file)
@@ -378,5 +378,7 @@ function CorelliaCoronetScreenPlay:spawnMobiles()
        spawnMobile("corellia", "trainer_politician",0,-218,28,-4500,0,0)
        spawnMobile("corellia", "trainer_ranger",0,-505,28,-4633,180,0)
        spawnMobile("corellia", "trainer_scout",0,-169.45,28,-4712.58,134,0)
-
+       
+       -- Chassis dealer.
+       spawnMobile("corellia", "chassis_dealer", 0, 0.1, 0.6, 72.9, -4, 1855672)
 end
index 8406e37..03b9abb 100644 (file)
@@ -268,3 +268,6 @@ includeFile("static_spawns/yavin4_static_spawns.lua")
 
 --Race Tracks
 includeFile("racetracks/racetracks.lua")
+
+-- Space
+includeFile("space/space_chassis_dealer_conv_handler.lua")
diff --git a/MMOCoreORB/bin/scripts/screenplays/space/chassis_dealer.lua b/MMOCoreORB/bin/scripts/screenplays/space/chassis_dealer.lua
new file mode 100644 (file)
index 0000000..7384886
--- /dev/null
@@ -0,0 +1,73 @@
+local Logger = require("utils.logger")
+require("utils.helpers")
+
+
+-- Key is ship name, values are blueprint name, blueprint path, and deed path.
+ships = {
+       blacksun_heavy_s01 = {name = "Rihkxyrk Attack Ship Chassis Blueprints, Style 1", blueprint = "object/tangible/ship/components/chassis/blacksun_heavy_s01_chassis_token.iff", deedObject = "object/tangible/ship/crafted/chassis/blacksun_heavy_s01_deed.iff"},
+       blacksun_heavy_s02 = {name = "Rihkxyrk Attack Ship Chassis Blueprints, Style 2", blueprint = "object/tangible/ship/components/chassis/blacksun_heavy_s02_chassis_token.iff", deedObject = "object/tangible/ship/crafted/chassis/blacksun_heavy_s02_deed.iff"},
+       blacksun_heavy_s03 = {name = "Rihkxyrk Attack Ship Chassis Blueprints, Style 3", blueprint = "object/tangible/ship/components/chassis/blacksun_heavy_s03_chassis_token.iff", deedObject = "object/tangible/ship/crafted/chassis/blacksun_heavy_s03_deed.iff"},
+       blacksun_heavy_s04 = {name = "Rihkxyrk Attack Ship Chassis Blueprints, Style 4", blueprint = "object/tangible/ship/components/chassis/blacksun_heavy_s04_chassis_token.iff", deedObject = "object/tangible/ship/crafted/chassis/blacksun_heavy_s04_deed.iff"}
+}
+       
+ChassisDealer = Object:new {}
+
+function ChassisDealer.playerHasValidBlueprints(pCreatureObject)
+       if (ChassisDealer.getValidBlueprints(pCreatureObject) ~= "") then
+               return true
+       elseif (ChassisDealer.getValidBlueprints(pCreatureObject) == "") then
+               return false
+       end
+end
+
+function ChassisDealer.getValidBlueprints(pCreatureObject)
+
+       local creo = LuaSceneObject(pCreatureObject)
+       local inventory = creo:getSlottedObject("inventory")
+       local returnBluePrints = {}
+
+       foreach(ships, function(theShip)
+               local pointer = getContainerObjectByTemplate(inventory, theShip.blueprint, true)
+               if (pointer ~= nil) then
+                       local pString = LuaSceneObject(pointer)
+                       local string = pString:getCustomObjectName()
+                       if (string ~= nil or string ~= "") then
+                               Logger:log("They have a " .. string, LT_INFO)
+                               table.insert(returnBluePrints, string)
+                       end
+               end
+       end)
+       
+       return returnBluePrints
+       
+end
+
+function ChassisDealer.getPathByName(pBlueprintObjectName)
+       local returnString = nil
+       
+       foreach(ships, function(theShip)
+                       local stringOfName = theShip.name
+                       if (string.find(pBlueprintObjectName, stringOfName) ~= nil) then
+                               returnString = theShip.blueprint
+                               Logger:log("Returning " .. returnString, LT_INFO)
+                       end
+       end)
+       
+       return returnString
+       
+end
+
+function ChassisDealer.getChassisFromBlueprint(pObjectPath)
+       local returnString = nil
+
+       foreach(ships, function(theShip)
+                       local string = theShip.blueprint
+                       if (string == pObjectPath) then
+                               returnString = theShip.deedObject
+                       end
+       end)
+       
+       return returnString
+end
+
+return ChassisDealer
\ No newline at end of file
diff --git a/MMOCoreORB/bin/scripts/screenplays/space/space_chassis_dealer_conv_handler.lua b/MMOCoreORB/bin/scripts/screenplays/space/space_chassis_dealer_conv_handler.lua
new file mode 100644 (file)
index 0000000..1b35562
--- /dev/null
@@ -0,0 +1,113 @@
+local Logger = require("utils.logger")
+require("utils.helpers")
+local ChassisDealer = require("screenplays.space.chassis_dealer")
+
+chassis_dealer_conv_handler = Object:new{ }
+
+function chassis_dealer_conv_handler:getNextConversationScreen(pConversationTemplate, pPlayer, selectedOption, pConversingNpc)
+       local player = LuaCreatureObject(pPlayer)
+       local pConversationSession = player:getConversationSession()
+
+       local pLastConversationScreen = nil
+
+       if (pConversationSession ~= nil) then
+               local conversationSession = LuaConversationSession(pConversationSession)
+               pLastConversationScreen = conversationSession:getLastConversationScreen()
+       end
+
+       local conversationTemplate = LuaConversationTemplate(pConversationTemplate)
+
+       if (pLastConversationScreen ~= nil) then        
+               local lastConversationScreen = LuaConversationScreen(pLastConversationScreen)
+               local optionLink = lastConversationScreen:getOptionLink(selectedOption)
+
+               return conversationTemplate:getScreen(optionLink)
+       end
+
+       return conversationTemplate:getScreen("chassis_dealer_greeting")
+end
+
+function chassis_dealer_conv_handler:runScreenHandlers(pConversationTemplate, pConversingPlayer, pConversingNpc, selectedOption, pConversationScreen)
+       local screen = LuaConversationScreen(pConversationScreen)
+
+       local screenID = screen:getScreenID()
+
+       Logger:log("Screen ID is " .. screenID, LT_INFO)
+
+
+       if (screenID == "chassis_dealer_buy_chassis") then
+               local suiManager = LuaSuiManager()
+               local options = ChassisDealer.getValidBlueprints(pConversingPlayer)
+
+               if (table.getn(options) <= 0) then
+                       pConversationScreen = screen:cloneScreen()
+                       local clonedConversation = LuaConversationScreen(pConversationScreen)
+                       clonedConversation:setDialogTextTO("@chassis_npc:no_deeds")
+                       return pConversationScreen
+               end
+               suiManager:sendListBox(pConversingPlayer, pConversingPlayer, "@chassis_npc:buy_ship_title", "@chassis_npc:buy_ship_prompt", 2, "@cancel", "", "@ok", "chassis_dealer_conv_handler", "purchaseChassisConfirmation", options)
+       elseif (screenID == "chassis_dealer_sell_components") then
+               -- TODO: Get looted components...
+               pConversationScreen = screen:cloneScreen()
+               local clonedConversation = LuaConversationScreen(pConversationScreen)
+               clonedConversation:setDialogTextTO("@conversation/chassis_npc:s_3310c404")
+               return pConversationScreen
+       end
+
+       return pConversationScreen
+end
+
+function chassis_dealer_conv_handler:purchaseChassisConfirmation(pCreature, pSui, cancelPressed, arg0)
+       if (not cancelPressed) then
+               local creo = LuaSceneObject(pCreature)
+               local inventory = creo:getSlottedObject("inventory")
+               local suiManager = LuaSuiManager()
+               local selection = arg0 + 1
+
+               -- TODO CHECKS: Too many ships, no money, too many POB ships, inventory full.
+
+               local possibleBlueprints = ChassisDealer.getValidBlueprints(pCreature)
+               local selectedBluePrint = possibleBlueprints[selection]
+               local path = ChassisDealer.getPathByName(selectedBluePrint)
+
+               if (path == nil) then
+                       local creature = LuaCreatureObject(pCreature)
+                       creature:sendSystemMessage("@chassis_npc:failed")
+               else
+                       local pBlueprint = getContainerObjectByTemplate(inventory, path, true)
+                       suiManager:sendMessageBox(pBlueprint, pCreature, "@chassis_npc:confirm_transaction", "@chassis_npc:can_use", "@chassis_npc:btn_buy", "chassis_dealer_conv_handler", "purchaseChassis")
+               end
+
+               -- TODO: Add in certs...
+       end
+end
+
+function chassis_dealer_conv_handler:purchaseChassis(pCreature, pSui, cancelPressed, arg0)
+       local creo = LuaSceneObject(pCreature)
+       local inventory = creo:getSlottedObject("inventory")
+       local suiBox = LuaSuiBox(pSui)
+       local pUsingObject = suiBox:getUsingObject()
+       local usingObject = LuaSceneObject(pUsingObject)
+       local deedPath = usingObject:getTemplateObjectPath()
+
+       local pChassis = ChassisDealer.getChassisFromBlueprint(deedPath)
+
+       Logger:log("Deed path is " .. deedPath, LT_INFO)
+
+       if (pChassis ~= nil) then
+               local chassis = giveItem(inventory, pChassis, -1)
+
+               if (chassis ~= nil) then
+                       local ochassis = LuaSceneObject(chassis)
+                       ochassis:sendTo(pCreature)
+                       local creature = LuaCreatureObject(pCreature)
+                       creature:sendSystemMessage("@chassis_npc:bought_chassis")
+               end
+
+               if (usingObject ~= nil) then
+                       usingObject:destroyObjectFromWorld()
+                       usingObject:destroyObjectFromDatabase()
+               end
+
+       end
+end