Fixes to the show command.

This commit is contained in:
Olof Larsson 2011-11-24 16:53:59 +01:00
parent fc6bfcf061
commit 686986eeb9
2 changed files with 15 additions and 6 deletions

View File

@ -252,7 +252,7 @@ public class Faction extends Entity implements EconomyParticipator
} }
} }
public Map<Rel, List<String>> getFactionTagsPerRelation() public Map<Rel, List<String>> getFactionTagsPerRelation(RelationParticipator rp)
{ {
Map<Rel, List<String>> ret = new HashMap<Rel, List<String>>(); Map<Rel, List<String>> ret = new HashMap<Rel, List<String>>();
for (Rel rel : Rel.values()) for (Rel rel : Rel.values())
@ -262,7 +262,7 @@ public class Faction extends Entity implements EconomyParticipator
for (Faction faction : Factions.i.get()) for (Faction faction : Factions.i.get())
{ {
Rel relation = faction.getRelationTo(this); Rel relation = faction.getRelationTo(this);
ret.get(relation).add(faction.getTag(this)); ret.get(relation).add(faction.getTag(rp));
} }
return ret; return ret;
} }

View File

@ -57,12 +57,12 @@ public class CmdShow extends FCommand
// TODO: Find the non default flags, and display them instead. // TODO: Find the non default flags, and display them instead.
if (faction.getFlag(FFlag.PERMANENT)) if (faction.getFlag(FFlag.PERMANENT))
{ {
msg("<a>This faction is permanent, remaining even with no members."); msg("<a>This faction is permanent - remaining even with no members.");
} }
if (faction.getFlag(FFlag.PEACEFUL)) if (faction.getFlag(FFlag.PEACEFUL))
{ {
sendMessage(Conf.colorTruce+"This faction is peaceful - in truce with everyone."); msg("<a>This faction is peaceful - in truce with everyone.");
} }
msg("<a>Joining: <i>"+(faction.getOpen() ? "no invitation is needed" : "invitation is required")); msg("<a>Joining: <i>"+(faction.getOpen() ? "no invitation is needed" : "invitation is required"));
@ -90,8 +90,17 @@ public class CmdShow extends FCommand
String sepparator = p.txt.parse("<i>")+", "; String sepparator = p.txt.parse("<i>")+", ";
// List the relations to other factions // List the relations to other factions
Map<Rel, List<String>> relationTags = faction.getFactionTagsPerRelation(); Map<Rel, List<String>> relationTags = faction.getFactionTagsPerRelation(fme);
sendMessage(p.txt.parse("<a>In Truce with: ") + TextUtil.implode(relationTags.get(Rel.TRUCE), sepparator));
if (faction.getFlag(FFlag.PEACEFUL))
{
sendMessage(p.txt.parse("<a>In Truce with:<i> *everyone*"));
}
else
{
sendMessage(p.txt.parse("<a>In Truce with: ") + TextUtil.implode(relationTags.get(Rel.TRUCE), sepparator));
}
sendMessage(p.txt.parse("<a>Allied to: ") + TextUtil.implode(relationTags.get(Rel.ALLY), sepparator)); sendMessage(p.txt.parse("<a>Allied to: ") + TextUtil.implode(relationTags.get(Rel.ALLY), sepparator));
sendMessage(p.txt.parse("<a>Enemies: ") + TextUtil.implode(relationTags.get(Rel.ENEMY), sepparator)); sendMessage(p.txt.parse("<a>Enemies: ") + TextUtil.implode(relationTags.get(Rel.ENEMY), sepparator));