summaryrefslogtreecommitdiff
path: root/NET/worlds/console/GiftDialog.java
blob: fde5afa6c1331aa690afd3059ab022abcfb970c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*    */ package NET.worlds.console;
/*    */ 
/*    */ import NET.worlds.core.Std;
/*    */ import NET.worlds.scape.InventoryItem;
/*    */ import NET.worlds.scape.InventoryManager;
/*    */ import java.text.MessageFormat;
/*    */ import java.util.Hashtable;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ class GiftDialog
/*    */   extends OkCancelDialog
/*    */ {
/*    */   private static final long serialVersionUID = -5698666260017940591L;
/*    */   private String inv;
/*    */   private int autoCloseTime;
/*    */   
/*    */   public static String calcMsg(String inv, int duration)
/*    */   {
/* 34 */     InventoryManager im = InventoryManager.getInventoryManager();
/* 35 */     Hashtable<String, InventoryItem> inventory = im.parseInventoryString(inv);
/*    */     
/*    */ 
/* 38 */     String hr = TradeDialog.buildInvDesc(inventory);
/*    */     
/* 40 */     Object[] arguments = { new String(hr), 
/* 41 */       new String(duration / 1000) };
/* 42 */     return MessageFormat.format(Console.message("To-claim-hr"), arguments);
/*    */   }
/*    */   
/*    */   public GiftDialog(String _inv, int duration)
/*    */   {
/* 47 */     super(Console.getFrame(), null, Console.message("A-Gift"), null, "Accept", calcMsg(_inv, duration), false);
/*    */     
/* 49 */     this.autoCloseTime = (Std.getFastTime() + duration);
/* 50 */     this.inv = _inv;
/*    */   }
/*    */   
/*    */   protected void activeCallback()
/*    */   {
/* 55 */     super.activeCallback();
/*    */     
/* 57 */     if ((Std.getFastTime() > this.autoCloseTime) && (this.autoCloseTime != 0)) {
/* 58 */       done(false);
/*    */     }
/*    */   }
/*    */   
/*    */   protected synchronized boolean done(boolean confirmed) {
/* 63 */     WhisperManager.whisperManager().giftDialogDone();
/*    */     
/* 65 */     if (confirmed)
/*    */     {
/* 67 */       TradeDialog.sendTradeMessage("&|+deal>TRADE ," + this.inv); }
/* 68 */     return super.done(confirmed);
/*    */   }
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\GiftDialog.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */