Advertisement
Guest User

Untitled

a guest
Sep 15th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.09 KB | None | 0 0
  1. //
  2. // So it was
  3. //
  4.     if (event->incoming) {
  5.         if (event->invite.ends > gGDM->GetGlobalData()->GetServerTime(GetTime()))
  6.         {
  7.             if (event->charName.empty())
  8.                 event->SetDescText(gRepData->GetString("unknown_incoming_duel_invite"));
  9.             else if (event->targetGroupId != 0)
  10.                 event->SetDescText(yprintf(gRepData->GetString("incoming_group_duel_invite").c_str(), event->charName));
  11.             else
  12.                 event->SetDescText(yprintf(gRepData->GetString("incoming_duel_invite").c_str(), event->charName));
  13.         }
  14.         else
  15.         {
  16.             if ( event->invite.ends == 0 )
  17.             {
  18.                 event->SetDescText( yprintf( gRepData->GetString( "incoming_duel_invite_denied" ).c_str( ), event->charName ) );
  19.                 if ( event->dialog )
  20.                     event->dialog->Close( );
  21.             }
  22.         }
  23.     }else{
  24.         if ( event->invite.ends == 0 )
  25.         {
  26.             event->SetDescText( yprintf( gRepData->GetString( "outgoing_duel_invite_denied" ).c_str( ), event->charName ) );
  27.             if ( event->dialog )
  28.                 event->dialog->Close( );
  29.         }
  30.         else
  31.             if (event->charName.empty())
  32.             event->SetDescText(gRepData->GetString("unknown_outgoing_duel_invite"));
  33.         else if (event->targetGroupId != 0)
  34.             event->SetDescText(yprintf(gRepData->GetString("outgoing_group_duel_invite").c_str(), event->charName));
  35.         else
  36.             event->SetDescText(yprintf(gRepData->GetString("outgoing_duel_invite").c_str(), event->charName));
  37.     }
  38. //
  39. // Now it is
  40. //
  41.     std::string direction = event->incoming ? "incoming" : "outgoing",
  42.                 description;
  43.                
  44.     if ( 0 == event->invite.ends /* Invalidated */ )
  45.     {
  46.         // TODO Here we need more sense messages, like "challenge was cancelled",
  47.         //       "challenge outdated" and so on
  48.         description = direction + "_duel_invite_denied";
  49.         if ( event->dialog )
  50.             event->dialog->Close( );
  51.     }
  52.     else /* Valid, here we don't need to check TTL */
  53.         if ( event->charName.empty( ) )
  54.             description = "unknown_" + direction + "_duel_invite"
  55.         else if ( event->targetGroupId > 0 )
  56.             description = direction + "_group_duel_invite";
  57.         else
  58.             description = direction + "_duel_invite";
  59.    
  60.     event->setDescText( yprintf( gRepData( message ) ).c_str( ), event->charName );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement