Fixed the Bestine Museum event. Should now be working properly with all associated spawns as well (artists).

This commit is contained in:
Cekis
2016-03-19 16:53:17 +00:00
parent c9cfda25c9
commit 56a60d4137
10 changed files with 158 additions and 139 deletions
@@ -510,3 +510,4 @@ i i h i f f f f f f f s p
9835352 0 object/static/installation/mockup_power_generator_photo_bio_style_1.iff 0 927.842 75 1659.09 0.0299955 0 0.99955 0 $|
189707 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 275 90 1998 0.43051 0 -0.90258 0 $|
4006309 0 object/tangible/spawning/spawn_egg.iff 0 977.7 75 1575.76 1 0 0 0 quest.hero_of_tatooine.intellect_spawner $|
-1 0 object/tangible/spawning/static_npc/bestine_artist06.iff 0 904.6 75 1624.5 1 0 0 0 $|
@@ -1544,3 +1544,5 @@ i i h i f f f f f f f s p
3355711 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 1169 5 83 0.55919 0 0.82904 0 $|
3355712 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 1219 5 116 0.3665 0 -0.93042 0 $|
4006290 0 object/tangible/spawning/spawn_egg.iff 0 1205.96 5 150.77 1 0 0 0 quest.hero_of_tatooine.intellect_spawner $|
-1 0 object/tangible/spawning/static_npc/bestine_artist03.iff 0 1264.6 5 1488.8 1 0 0 0 $|
-2 0 object/tangible/spawning/static_npc/bestine_artist05.iff 0 1327.5 5 62.8 1 0 0 0 $|
@@ -139,12 +139,13 @@ i i h i f f f f f f f s p
1027939 1027931 object/cell/cell.iff 8 0 0 0 1 0 0 0 $|
1027940 1027931 object/cell/cell.iff 9 0 0 0 1 0 0 0 $|
1027941 1027931 object/cell/cell.iff 10 0 0 0 1 0 0 0 $|
1028167 0 object/building/tatooine/housing_tatt_style01_large.iff 0 944.493 12 424.633 0.937647 0 0.34759 0 $|
1028167 0 object/building/tatooine/bestine_museum.iff 0 944.493 12 424.633 0.937647 0 0.34759 0 planet_map.map_loc $|
1028168 1028167 object/cell/cell.iff 1 0 0 0 1 0 0 0 $|
1028169 1028167 object/cell/cell.iff 2 0 0 0 1 0 0 0 $|
1028170 1028167 object/cell/cell.iff 3 0 0 0 1 0 0 0 $|
1028171 1028167 object/cell/cell.iff 4 0 0 0 1 0 0 0 $|
1028172 1028167 object/cell/cell.iff 5 0 0 0 1 0 0 0 $|
-5 1028172 object/tangible/npc/tatooine_spawn/lilas_dinhint.iff 5 22.6 0.19 -0.15 1 0 0 0 $|
1028173 1028167 object/cell/cell.iff 6 0 0 0 1 0 0 0 $|
1028174 1028167 object/cell/cell.iff 7 0 0 0 1 0 0 0 $|
1028175 1028167 object/cell/cell.iff 8 0 0 0 1 0 0 0 $|
@@ -1395,3 +1396,7 @@ i i h i f f f f f f f s p
3355708 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 740 12 480 0.28402 0 0.95882 0 $|
3355707 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 755 12 528 0.95882 0 0.28402 0 $|
4006232 0 object/tangible/spawning/spawn_egg.iff 0 677.89 12 456.17 1 0 0 0 quest.hero_of_tatooine.intellect_spawner $|
-1 0 object/tangible/poi/tatooine/bestine/bestine_marketplace_spawner_object.iff 12 1000 0 400 1 0 0 0 $|
-2 0 object/tangible/poi/tatooine/bestine/bestine_city_raid_spawner_object.iff 12 1000 0 401 1 0 0 0 $|
-3 0 object/tangible/creature_spawner/tusken_master_spawner.iff 0 1000 12 402 1 0 0 0 $|
-4 0 object/tangible/poi/tatooine/bestine/bestine_museum_event_master_object.iff 0 953.5 14 435.1 1 0 0 0 bestine.objMuseumBuilding|0|1028167|$|
@@ -2044,3 +2044,4 @@ i i h i f f f f f f f s s
3355714 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 1293 7 1101 0.29237 0 -0.9563 0 $|
3355715 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 1304 7 1093 0.95106 0 0.30902 0 $|
4006289 0 object/tangible/spawning/spawn_egg.iff 0 1541.44 7 1078.77 1 0 0 0 quest.hero_of_tatooine.intellect_spawner $|
-1 0 object/tangible/spawning/static_npc/bestine_artist02.iff 0 1521.9 7 1211.7 1 0 0 0 $|
@@ -2295,3 +2295,5 @@ i i h i f f f f f f f s p
3355709 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 1486 5 1333 0.72211 0 -0.691778 0 $|
3355710 0 object/tangible/space/content_infrastructure/ground_npc_spawner.iff 0 1486 5 1349 0.72211 0 -0.691778 0 $|
4006269 0 object/tangible/spawning/spawn_egg.iff 0 1433.75 5 1502.95 1 0 0 0 quest.hero_of_tatooine.intellect_spawner $|
-17 0 object/tangible/spawning/static_npc/bestine_artist01.iff 0 1264.6 5 1488.8 1 0 0 0 $|
-18 0 object/tangible/spawning/static_npc/bestine_artist04.iff 0 1426.7 5 1168.8 1 0 0 0 $|
@@ -107,3 +107,4 @@ object/building/naboo/rori_restuss_starport.iff starport
object/building/naboo/rori_restuss_shuttleport.iff shuttleport
object/building/dathomir/dathomir_quarantine_zone_starport.iff starport
object/building/dathomir/dathomir_quarantine_zone_cantina.iff cantina
object/building/tatooine/bestine_museum.iff @map_loc_n:bestine museum
+106 -103
View File
@@ -1,15 +1,10 @@
package script.city.bestine;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.utils;
import script.library.create;
import script.library.utils;
import java.util.Vector;
public class museum_event_grandparent extends script.base_script
{
@@ -26,7 +21,6 @@ public class museum_event_grandparent extends script.base_script
public int OnInitialize(obj_id self) throws InterruptedException
{
messageTo(self, "bootStrap", null, 2, false);
messageTo(self, "spawnCurator", null, 2, false);
return SCRIPT_CONTINUE;
}
public int bootStrap(obj_id self, dictionary params) throws InterruptedException
@@ -37,6 +31,7 @@ public class museum_event_grandparent extends script.base_script
{
dctScriptVars.put("objMasterObjectId", objMasterObjectIds[0]);
updateMuseumEventStatus(self);
String strMuseumEventWinner = dctScriptVars.getString(VARNAME_MUSEUM_WINNER);
int intMuseumEventWinnerArtworkIndex = dctScriptVars.getInt(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX);
if (strMuseumEventWinner != null && !strMuseumEventWinner.equals("none"))
@@ -45,14 +40,17 @@ public class museum_event_grandparent extends script.base_script
String strArtworkColumn = "artwork_" + intMuseumEventWinnerArtworkIndex;
String strArtworkTemplate = artistData.getString(strArtworkColumn);
dctScriptVars.put("strFeaturedArtworkTemplate", strArtworkTemplate);
String locXColumn = "locX_" + intMuseumEventWinnerArtworkIndex;
String locYColumn = "locY_" + intMuseumEventWinnerArtworkIndex;
String locZColumn = "locZ_" + intMuseumEventWinnerArtworkIndex;
float locX = artistData.getFloat(locXColumn);
float locY = artistData.getFloat(locYColumn);
float locZ = artistData.getFloat(locZColumn);
obj_id objMuseumLobby = getCellId(self, "lobby");
location locArtworkLocation = new location(locX, locY, locZ, "tatooine", objMuseumLobby);
obj_id objNewArtwork = createObject(strArtworkTemplate, locArtworkLocation);
setYaw(objNewArtwork, -91);
dctScriptVars.put("objFeaturedArtwork", objNewArtwork);
@@ -63,6 +61,7 @@ public class museum_event_grandparent extends script.base_script
location locTest = getLocation(self);
locTest.x = locTest.x + 1;
obj_id objMuseumEventMaster = createObject(MASTER_OBJECT_TEMPLATE, locTest);
dctScriptVars.put("objMasterObjectId", objMuseumEventMaster);
dctScriptVars.put(VARNAME_MUSEUM_STATUS, "museumEventStarted");
dctScriptVars.put(VARNAME_MUSEUM_WINNER, "none");
@@ -76,6 +75,7 @@ public class museum_event_grandparent extends script.base_script
{
deltadictionary dctScriptVars = self.getScriptVars();
obj_id masterObjectId = dctScriptVars.getObjId("objMasterObjectId");
if (utils.hasScriptVar(self, "strMuseumEventEntry01"))
{
utils.removeScriptVar(self, "strMuseumEventEntry01");
@@ -112,123 +112,103 @@ public class museum_event_grandparent extends script.base_script
{
utils.removeScriptVar(self, "intVotesForEntry03");
}
int intMuseumEventNum = 1;
int intMuseumEventNum;
obj_var_list varList = getObjVarList(masterObjectId, "bestine");
if (varList != null)
{
int numItem = varList.getNumItems();
obj_var var;
String varName;
for (int i = 0; i < numItem; i++)
{
obj_var var = varList.getObjVar(i);
String varName = var.getName();
if (varName.equals("museumEventStarted"))
{
intMuseumEventNum = var.getIntData();
dctScriptVars.put(VARNAME_MUSEUM_STATUS, "museumEventStarted");
dctScriptVars.put(VARNAME_MUSEUM_NUM, intMuseumEventNum);
}
else if (varName.equals("museumEventEnded"))
{
intMuseumEventNum = var.getIntData();
dctScriptVars.put(VARNAME_MUSEUM_STATUS, "museumEventEnded");
dctScriptVars.put(VARNAME_MUSEUM_NUM, intMuseumEventNum);
}
else if (varName.equals("museumEventWinner"))
{
String strVarValue = var.getStringData();
if (strVarValue == null || strVarValue.equals(""))
{
strVarValue = "none";
}
dctScriptVars.put(VARNAME_MUSEUM_WINNER, strVarValue);
}
else if (varName.equals("museumEventWinnerArtworkIndex"))
{
int intWinnerArtworkIndexValue = var.getIntData();
dctScriptVars.put(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX, intWinnerArtworkIndexValue);
}
else if (varName.equals("museumEventEntry01"))
{
String strEntry01Value = var.getStringData();
dctScriptVars.put("strMuseumEventEntry01", strEntry01Value);
}
else if (varName.equals("museumEventEntry02"))
{
String strEntry02Value = var.getStringData();
dctScriptVars.put("strMuseumEventEntry02", strEntry02Value);
}
else if (varName.equals("museumEventEntry03"))
{
String strEntry03Value = var.getStringData();
dctScriptVars.put("strMuseumEventEntry03", strEntry03Value);
}
else if (varName.equals("museumEventIndex01"))
{
int intIndex01Value = var.getIntData();
dctScriptVars.put("intMuseumEventIndex01", intIndex01Value);
}
else if (varName.equals("museumEventIndex02"))
{
int intIndex02Value = var.getIntData();
dctScriptVars.put("intMuseumEventIndex02", intIndex02Value);
}
else if (varName.equals("museumEventIndex03"))
{
int intIndex03Value = var.getIntData();
dctScriptVars.put("intMuseumEventIndex03", intIndex03Value);
}
else if (varName.equals("votesForEntry01"))
{
int intVotesForEntry01 = var.getIntData();
dctScriptVars.put("intVotesForEntry01", intVotesForEntry01);
}
else if (varName.equals("votesForEntry02"))
{
int intVotesForEntry02 = var.getIntData();
dctScriptVars.put("intVotesForEntry02", intVotesForEntry02);
}
else if (varName.equals("votesForEntry03"))
{
int intVotesForEntry03 = var.getIntData();
dctScriptVars.put("intVotesForEntry03", intVotesForEntry03);
}
else if (varName.equals("timeNextEventStarts"))
{
int timeNextEventStarts = var.getIntData();
dctScriptVars.put("timeNextEventStarts", timeNextEventStarts);
var = varList.getObjVar(i);
varName = var.getName();
switch (varName) {
case "museumEventStarted":
intMuseumEventNum = var.getIntData();
dctScriptVars.put(VARNAME_MUSEUM_STATUS, "museumEventStarted");
dctScriptVars.put(VARNAME_MUSEUM_NUM, intMuseumEventNum);
break;
case "museumEventEnded":
intMuseumEventNum = var.getIntData();
dctScriptVars.put(VARNAME_MUSEUM_STATUS, "museumEventEnded");
dctScriptVars.put(VARNAME_MUSEUM_NUM, intMuseumEventNum);
break;
case "museumEventWinner":
String strVarValue = var.getStringData();
if (strVarValue == null || strVarValue.equals("")) {
strVarValue = "none";
}
dctScriptVars.put(VARNAME_MUSEUM_WINNER, strVarValue);
break;
case "museumEventWinnerArtworkIndex":
int intWinnerArtworkIndexValue = var.getIntData();
dctScriptVars.put(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX, intWinnerArtworkIndexValue);
break;
case "museumEventEntry01":
String strEntry01Value = var.getStringData();
dctScriptVars.put("strMuseumEventEntry01", strEntry01Value);
break;
case "museumEventEntry02":
String strEntry02Value = var.getStringData();
dctScriptVars.put("strMuseumEventEntry02", strEntry02Value);
break;
case "museumEventEntry03":
String strEntry03Value = var.getStringData();
dctScriptVars.put("strMuseumEventEntry03", strEntry03Value);
break;
case "museumEventIndex01":
int intIndex01Value = var.getIntData();
dctScriptVars.put("intMuseumEventIndex01", intIndex01Value);
break;
case "museumEventIndex02":
int intIndex02Value = var.getIntData();
dctScriptVars.put("intMuseumEventIndex02", intIndex02Value);
break;
case "museumEventIndex03":
int intIndex03Value = var.getIntData();
dctScriptVars.put("intMuseumEventIndex03", intIndex03Value);
break;
case "votesForEntry01":
int intVotesForEntry01 = var.getIntData();
dctScriptVars.put("intVotesForEntry01", intVotesForEntry01);
break;
case "votesForEntry02":
int intVotesForEntry02 = var.getIntData();
dctScriptVars.put("intVotesForEntry02", intVotesForEntry02);
break;
case "votesForEntry03":
int intVotesForEntry03 = var.getIntData();
dctScriptVars.put("intVotesForEntry03", intVotesForEntry03);
break;
case "timeNextEventStarts":
int timeNextEventStarts = var.getIntData();
dctScriptVars.put("timeNextEventStarts", timeNextEventStarts);
break;
}
}
}
return;
}
public int spawnCurator(obj_id self, dictionary params) throws InterruptedException
{
obj_id objMuseumRoom = getCellId(self, "livingroom2");
location locCuratorLocation = new location(22.6f, 0.19f, -0.15f, "tatooine", objMuseumRoom);
obj_id template = create.object("object/tangible/ground_spawning/area_spawner.iff", locCuratorLocation);
setObjVar(template, "spawns", "lilas_dinhint");
setObjVar(template, "npc_name", "Lilas Dinhint");
setObjVar(template, "quest_script", "conversation.lilas_dinhint");
String spawnerObjName = "Lilas Dinhint Spawner";
setName(template, spawnerObjName);
attachScript(template, "city.bestine.museum_event_spawner");
return SCRIPT_CONTINUE;
}
public int handleMuseumEventStateChange(obj_id self, dictionary params) throws InterruptedException
{
updateMuseumEventStatus(self);
deltadictionary dctScriptVars = self.getScriptVars();
obj_id objBestineCurator = dctScriptVars.getObjId("objBestineCurator");
dictionary dctParams = new dictionary();
dctParams.put(VARNAME_MUSEUM_STATUS, dctScriptVars.getString(VARNAME_MUSEUM_STATUS));
dctParams.put(VARNAME_MUSEUM_WINNER, dctScriptVars.getString(VARNAME_MUSEUM_WINNER));
dctParams.put(VARNAME_MUSEUM_NUM, dctScriptVars.getInt(VARNAME_MUSEUM_NUM));
dctParams.put(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX, dctScriptVars.getInt(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX));
if (utils.hasScriptVar(self, "timeNextEventStarts"))
{
dctParams.put("timeNextEventStarts", dctScriptVars.getInt("timeNextEventStarts"));
}
messageTo(objBestineCurator, "handleMuseumEventStateChangeCuratorAlert", dctParams, 1, false);
return SCRIPT_CONTINUE;
}
public int handleSetMuseumEventWinner(obj_id self, dictionary params) throws InterruptedException
@@ -238,17 +218,21 @@ public class museum_event_grandparent extends script.base_script
{
strMuseumEventWinner = "none";
}
int intMuseumEventWinnerArtworkIndex = params.getInt(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX);
deltadictionary dctScriptVars = self.getScriptVars();
dctScriptVars.put(VARNAME_MUSEUM_WINNER, strMuseumEventWinner);
dctScriptVars.put(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX, intMuseumEventWinnerArtworkIndex);
String eventStatus = dctScriptVars.getString(VARNAME_MUSEUM_STATUS);
obj_id masterObjectId = dctScriptVars.getObjId("objMasterObjectId");
setObjVar(masterObjectId, "bestine.museumEventWinner", strMuseumEventWinner);
setObjVar(masterObjectId, "bestine.museumEventWinnerArtworkIndex", intMuseumEventWinnerArtworkIndex);
if (eventStatus.equals("museumEventEnded"))
{
if (strMuseumEventWinner != null && !strMuseumEventWinner.equals("none"))
if (!strMuseumEventWinner.equals("none"))
{
Vector previousArtworkIndexes = new Vector();
if (hasObjVar(masterObjectId, "bestine.previousArtworkIndexes"))
@@ -270,49 +254,59 @@ public class museum_event_grandparent extends script.base_script
destroyObject(objOldArtwork);
}
}
if (strMuseumEventWinner != null && !strMuseumEventWinner.equals("none"))
if (!strMuseumEventWinner.equals("none"))
{
dictionary artistData = dataTableGetRow(DATATABLE_NAME, strMuseumEventWinner);
String strArtworkColumn = "artwork_" + intMuseumEventWinnerArtworkIndex;
String strArtworkTemplate = artistData.getString(strArtworkColumn);
dctScriptVars.put("strFeaturedArtworkTemplate", strArtworkTemplate);
String locXColumn = "locX_" + intMuseumEventWinnerArtworkIndex;
String locYColumn = "locY_" + intMuseumEventWinnerArtworkIndex;
String locZColumn = "locZ_" + intMuseumEventWinnerArtworkIndex;
float locX = artistData.getFloat(locXColumn);
float locY = artistData.getFloat(locYColumn);
float locZ = artistData.getFloat(locZColumn);
obj_id objMuseumLobby = getCellId(self, "lobby");
location locArtworkLocation = new location(locX, locY, locZ, "tatooine", objMuseumLobby);
obj_id objNewArtwork = createObject(strArtworkTemplate, locArtworkLocation);
setYaw(objNewArtwork, -91);
dctScriptVars.put("objFeaturedArtwork", objNewArtwork);
}
updateMuseumEventStatus(self);
dictionary dctParams = new dictionary();
dctParams.put(VARNAME_MUSEUM_STATUS, eventStatus);
dctParams.put(VARNAME_MUSEUM_WINNER, strMuseumEventWinner);
dctParams.put(VARNAME_MUSEUM_NUM, dctScriptVars.getInt(VARNAME_MUSEUM_NUM));
if (eventStatus.equals("museumEventStarted"))
{
dctParams.put("strMuseumEventEntry01", dctScriptVars.getString("strMuseumEventEntry01"));
dctParams.put("strMuseumEventEntry02", dctScriptVars.getString("strMuseumEventEntry02"));
dctParams.put("strMuseumEventEntry03", dctScriptVars.getString("strMuseumEventEntry03"));
}
broadcastMessage("handleMuseumEventStatusResponse", dctParams);
return SCRIPT_CONTINUE;
}
public int handleCuratorSetupRequest(obj_id self, dictionary params) throws InterruptedException
{
obj_id objRequester = params.getObjId("objRequester");
deltadictionary dctScriptVars = self.getScriptVars();
dctScriptVars.put("objBestineCurator", objRequester);
dictionary dctParams = new dictionary();
String eventStatus = dctScriptVars.getString(VARNAME_MUSEUM_STATUS);
dctParams.put(VARNAME_MUSEUM_STATUS, eventStatus);
dctParams.put(VARNAME_MUSEUM_WINNER, dctScriptVars.getString(VARNAME_MUSEUM_WINNER));
dctParams.put(VARNAME_MUSEUM_NUM, dctScriptVars.getInt(VARNAME_MUSEUM_NUM));
dctParams.put(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX, dctScriptVars.getInt(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX));
if (eventStatus.equals("museumEventStarted"))
{
dctParams.put("intVotesForEntry01", dctScriptVars.getInt("intVotesForEntry01"));
@@ -325,10 +319,12 @@ public class museum_event_grandparent extends script.base_script
dctParams.put("intMuseumEventIndex02", dctScriptVars.getInt("intMuseumEventIndex02"));
dctParams.put("intMuseumEventIndex03", dctScriptVars.getInt("intMuseumEventIndex03"));
}
if (utils.hasScriptVar(self, "timeNextEventStarts"))
{
dctParams.put("timeNextEventStarts", dctScriptVars.getInt("timeNextEventStarts"));
}
messageTo(objRequester, "handleCuratorSetupResponse", dctParams, 1, false);
return SCRIPT_CONTINUE;
}
@@ -337,23 +333,29 @@ public class museum_event_grandparent extends script.base_script
int intVotesForEntry01 = params.getInt("intVotesForEntry01");
int intVotesForEntry02 = params.getInt("intVotesForEntry02");
int intVotesForEntry03 = params.getInt("intVotesForEntry03");
deltadictionary dctScriptVars = self.getScriptVars();
obj_id masterObjectId = dctScriptVars.getObjId("objMasterObjectId");
setObjVar(masterObjectId, "bestine.votesForEntry01", intVotesForEntry01);
setObjVar(masterObjectId, "bestine.votesForEntry02", intVotesForEntry02);
setObjVar(masterObjectId, "bestine.votesForEntry03", intVotesForEntry03);
return SCRIPT_CONTINUE;
}
public int handleMuseumEventStatusRequest(obj_id self, dictionary params) throws InterruptedException
{
obj_id objRequester = params.getObjId("objRequester");
updateMuseumEventStatus(self);
deltadictionary dctScriptVars = self.getScriptVars();
dictionary dctParams = new dictionary();
String eventStatus = dctScriptVars.getString(VARNAME_MUSEUM_STATUS);
dctParams.put(VARNAME_MUSEUM_STATUS, eventStatus);
dctParams.put(VARNAME_MUSEUM_WINNER, dctScriptVars.getString(VARNAME_MUSEUM_WINNER));
dctParams.put(VARNAME_MUSEUM_NUM, dctScriptVars.getInt(VARNAME_MUSEUM_NUM));
if (eventStatus.equals("museumEventStarted"))
{
dctParams.put("strMuseumEventEntry01", dctScriptVars.getString("strMuseumEventEntry01"));
@@ -361,6 +363,7 @@ public class museum_event_grandparent extends script.base_script
dctParams.put("strMuseumEventEntry03", dctScriptVars.getString("strMuseumEventEntry03"));
}
messageTo(objRequester, "handleMuseumEventStatusResponse", dctParams, 1, false);
return SCRIPT_CONTINUE;
}
}
+21 -14
View File
@@ -1,14 +1,10 @@
package script.city.bestine;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.dictionary;
import script.library.utils;
import script.obj_id;
import java.util.Vector;
public class museum_event_master extends script.base_script
{
@@ -16,11 +12,13 @@ public class museum_event_master extends script.base_script
{
}
public static final String DATATABLE_NAME = "datatables/city/bestine/bestine_museum_event.iff";
public int OnAttach(obj_id self) throws InterruptedException
{
messageTo(self, "beginBestineMuseumEvent", null, 1, false);
return SCRIPT_CONTINUE;
}
public int getMuseumEventDuration() throws InterruptedException
{
String durationConfigSetting = getConfigSetting("BestineEvents", "MuseumEventDuration");
@@ -51,16 +49,21 @@ public class museum_event_master extends script.base_script
setObjVar(self, "bestine.votesForEntry01", 0);
setObjVar(self, "bestine.votesForEntry02", 0);
setObjVar(self, "bestine.votesForEntry03", 0);
pickArtistsForEvent(self);
if (!hasObjVar(self, "bestine.museumEventEntry01") || !hasObjVar(self, "bestine.museumEventEntry02") || !hasObjVar(self, "bestine.museumEventEntry03"))
{
removeObjVar(self, "bestine.previousArtworkIndexes");
pickArtistsForEvent(self);
}
obj_id museumBuildingObjId = getObjIdObjVar(self, "bestine.objMuseumBuilding");
messageTo(museumBuildingObjId, "handleMuseumEventStateChange", null, 1, false);
int museumEventDuration = getMuseumEventDuration();
messageTo(self, "endBestineMuseumEvent", null, museumEventDuration, true);
return SCRIPT_CONTINUE;
}
public int endBestineMuseumEvent(obj_id self, dictionary params) throws InterruptedException
@@ -92,33 +95,37 @@ public class museum_event_master extends script.base_script
}
obj_id museumBuildingObjId = getObjIdObjVar(self, "bestine.objMuseumBuilding");
messageTo(museumBuildingObjId, "handleMuseumEventStateChange", null, 1, false);
int museumEventDuration = getMuseumEventDuration();
int timeNextEventStarts = getGameTime() + museumEventDuration;
setObjVar(self, "bestine.timeNextEventStarts", timeNextEventStarts);
messageTo(self, "beginBestineMuseumEvent", null, museumEventDuration, true);
return SCRIPT_CONTINUE;
}
public void pickArtistsForEvent(obj_id self) throws InterruptedException
{
String[] strArtists = dataTableGetStringColumnNoDefaults(DATATABLE_NAME, "artistNpc");
int numArtists = strArtists.length;
Vector vectArtists = new Vector();
for (int k = 0; k < (numArtists); k++)
{
String temp = strArtists[k];
for (String temp : strArtists) {
vectArtists = utils.addElement(vectArtists, temp);
}
Vector previousArtworkIndexes = new Vector();
if (hasObjVar(self, "bestine.previousArtworkIndexes"))
{
previousArtworkIndexes = utils.getResizeableIntBatchObjVar(self, "bestine.previousArtworkIndexes");
}
int entryChosen = 0;
String artistName;
while ((entryChosen < 3) && (vectArtists.size() > 0))
{
int vectorSize = vectArtists.size();
int vectRow = rand(0, (vectorSize - 1));
String artistName = ((String)vectArtists.get(vectRow));
artistName = ((String) vectArtists.get(vectRow));
int artistRow = utils.getElementPositionInArray(strArtists, artistName);
int numArtworksByArtist = dataTableGetInt(DATATABLE_NAME, artistRow, "numWorksOfArt");
int artworkNum = 1;
@@ -130,7 +137,7 @@ public class museum_event_master extends script.base_script
{
foundArtworkEntry = true;
}
else if ((utils.getElementPositionInArray(previousArtworkIndexes, new Integer(artistIndex))) == -1)
else if ((utils.getElementPositionInArray(previousArtworkIndexes, artistIndex)) == -1)
{
foundArtworkEntry = true;
}
+7 -1
View File
@@ -19,21 +19,25 @@ public class museum_event_npc extends script.base_script
{
}
public static final String FACE_TO_VOLUME_NAME = "faceToTriggerVolume";
public static final String VARNAME_MUSEUM_STATUS = "strMuseumEventStatus";
public static final String VARNAME_MUSEUM_WINNER = "strMuseumEventWinner";
public static final String VARNAME_MUSEUM_NUM = "intMuseumEventNum";
public static final String VARNAME_MUSEUM_WINNER_ARTWORK_INDEX = "intMuseumWinnerArtworkIndex";
public static final String OBJVAR_MUSEUM_BUILDING = "bestine.objMuseumBuilding";
public static final String DATATABLE_NAME = "datatables/city/bestine/bestine_museum_event.iff";
public int OnAttach(obj_id self) throws InterruptedException
{
createTriggerVolume(FACE_TO_VOLUME_NAME, 8.0f, true);
String creatureName = ai_lib.getCreatureName(self);
if (creatureName.equals("lilas_dinhint"))
{
messageTo(self, "handleCuratorSetup", null, 9, false);
return SCRIPT_CONTINUE;
}
messageTo(self, "handleMuseumEventNpcSetup", null, 10, false);
return SCRIPT_CONTINUE;
}
@@ -303,8 +307,10 @@ public class museum_event_npc extends script.base_script
setObjVar(self, museumEventStatusObjvar, museumEventNum);
setObjVar(self, "bestine.museumEventWinner", museumEventWinner);
setObjVar(self, "bestine.museumEventWinnerArtworkIndex", museumEventWinnerArtworkIndex);
msgData.put(VARNAME_MUSEUM_WINNER, museumEventWinner);
msgData.put(VARNAME_MUSEUM_WINNER_ARTWORK_INDEX, museumEventWinnerArtworkIndex);
obj_id museumBuilding = getObjIdObjVar(self, OBJVAR_MUSEUM_BUILDING);
messageTo(museumBuilding, "handleSetMuseumEventWinner", msgData, 10, false);
return SCRIPT_CONTINUE;
@@ -316,6 +322,7 @@ public class museum_event_npc extends script.base_script
dictionary msgData = new dictionary();
msgData.put("objRequester", self);
obj_id museumBuilding = getObjIdObjVar(self, OBJVAR_MUSEUM_BUILDING);
listenToMessage(museumBuilding, "handleMuseumEventStatusResponse");
messageTo(museumBuilding, "handleMuseumEventStatusRequest", msgData, 10, false);
}
@@ -409,6 +416,5 @@ public class museum_event_npc extends script.base_script
{
removeObjVar(self, "bestine.museumEventWinnerArtworkIndex");
}
return;
}
}
+11 -20
View File
@@ -1,17 +1,9 @@
package script.city.bestine;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.create;
import script.library.ai_lib;
import script.library.create;
import script.library.utils;
import script.library.planetary_map;
public class museum_event_spawner extends script.base_script
{
@@ -21,13 +13,7 @@ public class museum_event_spawner extends script.base_script
public static final String SCRIPT_NAME = "city.bestine.museum_event_spawner";
public int OnInitialize(obj_id self) throws InterruptedException
{
deltadictionary dctScriptVars = self.getScriptVars();
dctScriptVars.put("numMuseumChecks", 1);
messageTo(self, "checkForMuseumBuilding", null, 60, false);
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
LOG("museum","Museum event NPC spawner initializing with objid of " + self + ".");
deltadictionary dctScriptVars = self.getScriptVars();
dctScriptVars.put("numMuseumChecks", 1);
messageTo(self, "checkForMuseumBuilding", null, 60, false);
@@ -35,22 +21,24 @@ public class museum_event_spawner extends script.base_script
}
public int checkForMuseumBuilding(obj_id self, dictionary params) throws InterruptedException
{
LOG("museum","Starting to look for Bestine's museum.");
location here = getLocation(self);
deltadictionary dctScriptVars = self.getScriptVars();
int numMuseumChecks = dctScriptVars.getInt("numMuseumChecks");
map_location[] allRegisteredMuseums = getPlanetaryMapLocations("museum", "");
if (allRegisteredMuseums != null && allRegisteredMuseums.length != 0)
{
obj_id objMuseumBuilding = null;
for (int m = 0; m < allRegisteredMuseums.length; m++)
{
LOG("museum","Found " + allRegisteredMuseums.length + " registered museums.");
map_location registeredMuseum = allRegisteredMuseums[m];
String museumNameCodeString = registeredMuseum.getLocationName();
string_id museumNameStringId = utils.unpackString(museumNameCodeString);
String museumName = getString(museumNameStringId);
if (museumName != null && museumName.equals("Bestine"))
if (museumNameCodeString != null && museumNameCodeString.equals("Bestine"))
{
objMuseumBuilding = registeredMuseum.getLocationId();
LOG("museum","Found Bestine's museum - has objid of " + objMuseumBuilding);
}
}
if (!isIdValid(objMuseumBuilding))
@@ -70,6 +58,7 @@ public class museum_event_spawner extends script.base_script
}
else
{
LOG("museum","Adding Bestine's museum obj id to the script vars and getting ready to spawn npc's.");
dctScriptVars.put("objMuseumBuilding", objMuseumBuilding);
spawnNpc(self);
}
@@ -92,15 +81,18 @@ public class museum_event_spawner extends script.base_script
}
public void spawnNpc(obj_id self) throws InterruptedException
{
LOG("museum","Starting to spawn NPC.");
String spawn = getStringObjVar(self, "spawns");
obj_id npc = create.staticObject(spawn, getLocation(self));
setInvulnerable(npc, true);
setCreatureStatic(npc, true);
ai_lib.setDefaultCalmBehavior(npc, ai_lib.BEHAVIOR_SENTINEL);
deltadictionary dctScriptVars = self.getScriptVars();
obj_id objMuseumBuilding = dctScriptVars.getObjId("objMuseumBuilding");
setObjVar(npc, "bestine.objMuseumBuilding", objMuseumBuilding);
attachScript(npc, "city.bestine.museum_event_npc");
if (spawn.equals("lilas_dinhint"))
{
attachScript(npc, "city.bestine.politician_event_npc");
@@ -130,6 +122,5 @@ public class museum_event_spawner extends script.base_script
{
attachScript(npc, "conversation.bestine_artist06");
}
return;
}
}