diff --git a/units/game_actors_point.pas b/units/game_actors_point.pas index aa2be19..bf2a551 100644 --- a/units/game_actors_point.pas +++ b/units/game_actors_point.pas @@ -33,7 +33,8 @@ type constructor Create(AOwner:TComponent;AValue : integer);overload; constructor Create(AOwner:TComponent;AValue : array of integer); overload; constructor Create(AOwner:TComponent;AResult : string); overload; - function PointMessage(APrepend, AAppendicePlural, AAppendiceSingular: string; IsGroupPoint: Boolean) : string; + function PointMessage(APrepend, APrependLoss, AAppendiceLossSingular,AAppendiceLossPlural, + APrependEarn,AAppendiceEarnSingular,AAppendiceEarnPlural,AAppendiceZero: string; IsGroupPoint: Boolean) : string; property ValueWithVariation : integer read GetValue write FValue; property Variation : integer read FVariation write FVariation; @@ -92,12 +93,28 @@ end; constructor TGamePoint.Create(AOwner: TComponent; AResult: string); begin - FValue := 0;//does not matter here, this creation method is called by a player, admin sent a result + inherited Create(AOwner); + FValue := 0;//does not matter here, this creation method is called by a player, result is sent by the admin FVariation := 0; FResult := StrToInt(AResult); end; -function TGamePoint.PointMessage(APrepend, AAppendicePlural, AAppendiceSingular: string; IsGroupPoint: Boolean): string; +function TGamePoint.PointMessage(APrepend, + APrependLoss, AAppendiceLossSingular, AAppendiceLossPlural, + APrependEarn, AAppendiceEarnSingular, AAppendiceEarnPlural, + AAppendiceZero: string; IsGroupPoint: Boolean): string; + + procedure ReadCustomMessage; + begin + case FResult of + -MaxInt..-2: Result += #32+APrependLoss+#32+Self.AsString+#32+AAppendiceLossPlural; + -1 : Result += #32+APrependLoss+#32+Self.AsString+#32+AAppendiceLossSingular; + 0 : Result += #32+AAppendiceZero; + 1 : Result += #32+APrependEarn+#32+Self.AsString+#32+AAppendiceEarnSingular; + 2..MaxInt: Result += #32+APrependEarn+#32+Self.AsString+#32+AAppendiceEarnPlural; + end; + end; + begin if IsGroupPoint then begin @@ -106,26 +123,20 @@ begin else Result := APrepend; - if (AAppendiceSingular = '') or (AAppendicePlural = '') then + if (APrependLoss = '') or (AAppendiceLossSingular = '') or (AAppendiceLossPlural = '') or + (APrependEarn = '') or (AAppendiceEarnSingular = '') or (AAppendiceEarnPlural = '') or + (AAppendiceZero = '') then begin case FResult of - -MaxInt..-2: Result += ' produziram a perda de '+Self.AsString+ ' pontos para o grupo'; - -1 : Result += ' produziram a perda de 1 ponto para o grupo'; - 0 : Result += ' não produziram nem perderam pontos para o grupo'; - 1 : Result += ' produziram 1 ponto para o grupo'; - 2..MaxInt: Result += ' produziram '+Self.AsString+' pontos para o grupo' + -MaxInt..-2: Result += #32+'retiraram'+#32+Self.AsString+#32+'itens escolares de uma escola pública'; + -1 : Result += #32+'retiraram'+#32+Self.AsString+#32+'item escolar de uma escola pública'; + 0 : Result += #32+'não doaram e nem retiraram itens escolares'; + 1 : Result += #32+'doaram'+#32+Self.AsString+#32+'item escolar a uma escola pública'; + 2..MaxInt: Result += #32+'doaram'+#32+Self.AsString+#32+'itens escolares a uma escola pública'; end; end else - begin - case FResult of - -MaxInt..-2: Result += ' produziram a perda de ' + Self.AsString + ' ' + AAppendicePlural; - -1 : Result += ' produziram a perda de 1 ' + AAppendiceSingular; - 0 : Result += ' não produziram nem perderam ' + AAppendicePlural; - 1 : Result += ' produziram 1 ' + AAppendiceSingular; - 2..MaxInt: Result += ' produziram ' + Self.AsString + ' ' + AAppendicePlural; - end; - end; + ReadCustomMessage; end else begin @@ -134,26 +145,20 @@ begin else Result := APrepend; - if (AAppendiceSingular = '') or (AAppendicePlural = '') then + if (APrependLoss = '') or (AAppendiceLossSingular = '') or (AAppendiceLossPlural = '') or + (APrependEarn = '') or (AAppendiceEarnSingular = '') or (AAppendiceEarnPlural = '') or + (AAppendiceZero = '') then begin case FResult of - -MaxInt..-2: Result += ' perdeu '+Self.AsString+ ' pontos'; - -1 : Result += ' perdeu 1 ponto'; - 0 : Result += ' não perdeu nem ganhou pontos'; - 1 : Result += ' ganhou 1 ponto'; - 2..MaxInt: Result += ' ganhou '+Self.AsString+' pontos' + -MaxInt..-2: Result += #32+'perdeu'+#32+Self.AsString+#32+'pontos'; + -1 : Result += #32+'perdeu'+#32+Self.AsString+#32+'ponto'; + 0 : Result += #32+'não perdeu nem ganhou pontos'; + 1 : Result += #32+'ganhou'+#32+Self.AsString+#32+'ponto'; + 2..MaxInt: Result += #32+'ganhou'+#32+Self.AsString+#32+'pontos'; end; end else - begin - case FResult of - -MaxInt..-2: Result += ' perdeu '+Self.AsString+ ' ' + AAppendicePlural; - -1 : Result += ' perdeu 1 ' + AAppendiceSingular; - 0 : Result += ' não perdeu nem ganhou ' + AAppendicePlural; - 1 : Result += ' ganhou 1 ' + AAppendiceSingular; - 2..MaxInt: Result += ' ganhou '+Self.AsString+ ' ' + AAppendicePlural; - end; - end; + ReadCustomMessage; end; Result += '.'; end; -- libgit2 0.21.2