Пример #1
0
 @Override
 public List<Object> getAttributeValues(String attribute) {
   if (attributeValues.containsKey(attribute)) {
     return attributeValues.get(attribute);
   }
   List<Object> result = super.getAttributeValues(attribute);
   switch (Attribute.valueOf(attribute.replace(" ", "_"))) {
     case Type:
       {
         result.add("Image");
         break;
       }
   }
   attributeValues.put(attribute, result);
   return result;
 }
 @Override
 public void xmlSet(final String key, final String value) {
   switch (mode) {
     case DEFAULT:
       if ("age".equals(key)) {
         age = Age.valueOf(Xml.getText(value));
       } else if ("gender".equals(key)) {
         gender = Gender.valueOf(Xml.getText(value));
       } else if ("alignment".equals(key)) {
         alignment = Enum.valueOf(Alignment.class, Xml.getText(value));
       } else if ("money".equals(key)) {
         money = new Range(Xml.getText(value));
       } else if ("juice".equals(key)) {
         juice = new Range(Xml.getText(value));
       } else if ("infiltration".equals(key)) {
         infiltration = new Range(Xml.getText(value));
       } else if ("ccs".equals(key)) {
         ccs = Xml.getBoolean(value);
       } else if ("animalgloss".equals(key)) {
         animalGloss = Animal.valueOf(value);
       } else if ("lcsname".equals(key)) {
         lcsname = Xml.getText(value);
       } else if ("attnum".equals(key)) {
         attnum = new Range(Xml.getText(value));
       } else if ("teaches".equals(key)) {
         teaches = Activity.valueOf(value);
       } else if ("police".equals(key)) {
         police = Xml.getBoolean(value);
       } else if ("observationskill".equals(key)) {
         observationSkill = CheckDifficulty.valueOf(value);
       } else if ("receptive".equals(key)) {
         receptive = Xml.getBoolean(value);
       } else if ("coreskill".equals(key)) {
         coreSkill = Skill.valueOf(value);
       } else if ("influence".equals(key)) {
         influence = Xml.getInt(value);
       } else if ("seduce".equals(key)) {
         seduce = CheckDifficulty.valueOf(value);
       } else if ("stub".equals(key)) {
         stub = Xml.getBoolean(value);
       } else {
         Log.w(Game.LCS, "Oops: " + key + "=" + value);
       }
       break;
     case ARMOR:
       if ("item".equals(key)) {
         final ArmorType at = Game.type.armor.get("ARMOR_" + Xml.getText(value));
         if (at == null) {
           Log.e(Game.LCS, "No such armortype:" + Xml.getText(value));
         } else {
           armorTypes.add(at);
         }
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case WEAPON:
       if ("item".equals(key)) {
         weapontypes.add(new WeaponAssigner(Xml.getText(value)));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case NAMES:
       if ("item".equals(key)) {
         names.add(Xml.getText(value));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case SPECIALS:
       if ("item".equals(key)) {
         specials.add(Specials.valueOf(Xml.getText(value)));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case WORKLOCATION:
       if ("item".equals(key)) {
         workLocation.add(AbstractSiteType.type(value));
       } else {
         Log.w(Game.LCS, "Bad key:" + key + "=" + value);
       }
       break;
     case SKILL:
       skills.put(Skill.valueOf(key), new Range(value));
       break;
     case ATTCAP:
       attributeCap.put(Attribute.valueOf(key), new Range(value));
       break;
     case ATTRIBUTE:
       attribute.put(Attribute.valueOf(key), new Range(value));
       break;
     case CRIMES:
       if (value.length() != 0) {
         offences.add(Crime.valueOf(value));
       } else {
         offences.add(null);
       }
       break;
     default:
       Log.e("LCS", "CreatureType xmlSet default:" + mode);
   }
 }