Added check to make sure the trader participating in the city invasions and is trying to build defenses that they have the crafting tool required for building.

This commit is contained in:
Cekis
2017-01-30 03:19:42 +00:00
parent 110d3c289d
commit f0a5c34c5f
+6 -1
View File
@@ -373,13 +373,18 @@ public class gcw_city_pylon extends script.base_script
}
desiredTemplate = getStringObjVar(self, gcw.GCW_TOOL_TEMPLATE_OBJVAR);
obj_id[] toolList = utils.getAllItemsPlayerHasByTemplate(player, desiredTemplate);
if(toolList == null)
{
return SCRIPT_CONTINUE;
}
int bestToolValue = 0;
int toolValue = 0;
obj_id bestTool = null;
for (int i = 0; i < toolList.length; i++)
{
toolValue = 0;
String itemTemplate = getTemplateName(toolList[i]);
if (itemTemplate.equals(desiredTemplate))
if (itemTemplate != null && itemTemplate.equals(desiredTemplate))
{
if (hasObjVar(toolList[i], "crafting_components.power"))
{