001package com.fs.starfarer.api.impl.campaign.rulecmd; 002 003import java.util.List; 004import java.util.Map; 005 006import com.fs.starfarer.api.Global; 007import com.fs.starfarer.api.campaign.InteractionDialogAPI; 008import com.fs.starfarer.api.campaign.rules.MemoryAPI; 009import com.fs.starfarer.api.characters.PersonAPI; 010import com.fs.starfarer.api.util.Misc.Token; 011 012/** 013 * Unhide person in CommDirectory by id 014 */ 015public class UnhidePerson extends BaseCommandPlugin { 016 017 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) { 018 019 // if you wanted to just pass in the person ID. The person has to have been 020 // added to ImportantPeople at some point (as the people defined in People are) 021 String id = params.get(0).getString(memoryMap); 022 PersonAPI person = Global.getSector().getImportantPeople().getPerson(id); 023 024 //VarAndMemory var = params.get(0).getVarNameAndMemory(memoryMap); 025 //PersonAPI person = (PersonAPI) var.memory.get(var.name); 026 027 if (person.getMarket() == null) return false; 028 if (person.getMarket().getCommDirectory() == null) return false; 029 if (person.getMarket().getCommDirectory().getEntryForPerson(person.getId()) == null) return false; 030 031 person.getMarket().getCommDirectory().getEntryForPerson(person.getId()).setHidden(false); 032 return true; 033 } 034}