-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicTree.cs
More file actions
224 lines (194 loc) · 5.85 KB
/
MagicTree.cs
File metadata and controls
224 lines (194 loc) · 5.85 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
using System;
// Token: 0x02000061 RID: 97
public class MagicTree : Npc, IActionListener
{
// Token: 0x0600034B RID: 843 RVA: 0x00019470 File Offset: 0x00017670
public MagicTree(int npcId, int status, int cx, int cy, int templateId, int iconId) : base(npcId, status, cx, cy, templateId, iconId)
{
this.p = new PopUp(string.Empty, 0, 0);
this.p.command = new Command(null, this, 1, null);
PopUp.addPopUp(this.p);
}
// Token: 0x0600034D RID: 845 RVA: 0x000194C0 File Offset: 0x000176C0
public override void paint(mGraphics g)
{
if (this.id == 0)
{
return;
}
SmallImage.drawSmallImage(g, this.id, this.cx, this.cy, 0, StaticObj.BOTTOM_HCENTER);
if (global::Char.myCharz().npcFocus != null && global::Char.myCharz().npcFocus.Equals(this))
{
g.drawRegion(Mob.imgHP, 0, 0, 9, 6, 0, this.cx, this.cy - SmallImage.smallImg[this.id][4] - 1, mGraphics.BOTTOM | mGraphics.HCENTER);
if (this.name != null)
{
mFont.tahoma_7b_white.drawString(g, this.name, this.cx, this.cy - SmallImage.smallImg[this.id][4] - 20, mFont.CENTER, mFont.tahoma_7_grey);
}
}
else if (this.name != null)
{
mFont.tahoma_7b_white.drawString(g, this.name, this.cx, this.cy - SmallImage.smallImg[this.id][4] - 17, mFont.CENTER, mFont.tahoma_7_grey);
}
try
{
for (int i = 0; i < this.currPeas; i++)
{
g.drawImage(MagicTree.pea, this.cx + this.peaPostionX[i] - SmallImage.smallImg[this.id][3] / 2, this.cy + this.peaPostionY[i] - SmallImage.smallImg[this.id][4], 0);
}
}
catch (Exception ex)
{
}
if (this.indexEffTask >= 0 && this.effTask != null && (int)this.cTypePk == 0)
{
SmallImage.drawSmallImage(g, this.effTask.arrEfInfo[this.indexEffTask].idImg, this.cx + this.effTask.arrEfInfo[this.indexEffTask].dx + SmallImage.smallImg[this.id][3] / 2 + 5, this.cy - 15 + this.effTask.arrEfInfo[this.indexEffTask].dy, 0, mGraphics.VCENTER | mGraphics.HCENTER);
if (GameCanvas.gameTick % 2 == 0)
{
this.indexEffTask++;
if (this.indexEffTask >= this.effTask.arrEfInfo.Length)
{
this.indexEffTask = 0;
}
}
}
}
// Token: 0x0600034E RID: 846 RVA: 0x00019734 File Offset: 0x00017934
public override void update()
{
this.p.isPaint = MagicTree.isPaint;
this.cur = mSystem.currentTimeMillis();
if (this.cur - this.last >= 1000L)
{
this.seconds--;
this.last = this.cur;
if (this.seconds < 0)
{
this.seconds = 0;
}
}
if (!this.isUpdate)
{
if (this.currPeas < this.maxPeas && this.seconds == 0)
{
this.waitToUpdate = true;
}
}
else if (this.seconds == 0)
{
this.isUpdate = false;
this.waitToUpdate = true;
}
if (this.waitToUpdate)
{
this.delay++;
if (this.delay == 20)
{
this.delay = 0;
this.waitToUpdate = false;
Service.gI().getMagicTree(2);
}
}
this.num = ((this.peaPostionX == null) ? 0 : (this.peaPostionX.Length * this.currPeas / this.maxPeas));
if (this.isUpdateTree)
{
this.isUpdateTree = false;
if ((this.seconds >= 0 && this.currPeas < this.maxPeas) || (this.seconds >= 0 && this.isUpdate) || this.isPeasEffect)
{
this.p.updateXYWH(new string[]
{
this.isUpdate ? mResources.UPGRADING : (this.currPeas + "/" + this.maxPeas),
NinjaUtil.getTime(this.seconds)
}, this.cx, this.cy - 20 - SmallImage.smallImg[this.id][4]);
}
else if (this.currPeas == this.maxPeas && !this.isUpdate)
{
this.p.updateXYWH(new string[]
{
mResources.can_harvest,
this.currPeas + "/" + this.maxPeas
}, this.cx, this.cy - 20 - SmallImage.smallImg[this.id][4]);
}
}
if ((this.seconds >= 0 && this.currPeas < this.maxPeas) || (this.seconds >= 0 && this.isUpdate))
{
this.p.says[this.p.says.Length - 1] = NinjaUtil.getTime(this.seconds);
}
if (this.isPeasEffect)
{
this.p.isPaint = false;
ServerEffect.addServerEffect(98, this.cx + this.peaPostionX[this.currPeas - 1] - SmallImage.smallImg[this.id][3] / 2, this.cy + this.peaPostionY[this.currPeas - 1] - SmallImage.smallImg[this.id][4], 1);
this.currPeas--;
if (GameCanvas.gameTick % 2 == 0)
{
SoundMn.gI().HP_MPup();
}
if (this.currPeas == this.remainPeas)
{
this.p.isPaint = true;
this.isUpdateTree = true;
this.isPeasEffect = false;
}
}
base.update();
}
// Token: 0x0600034F RID: 847 RVA: 0x00004F8E File Offset: 0x0000318E
public void perform(int idAction, object p)
{
if (idAction == 1)
{
Service.gI().magicTree(1);
}
}
// Token: 0x04000580 RID: 1408
public static Image imgMagicTree;
// Token: 0x04000581 RID: 1409
public static Image pea = GameCanvas.loadImage("/mainImage/myTexture2dhatdau.png");
// Token: 0x04000582 RID: 1410
public int id;
// Token: 0x04000583 RID: 1411
public int level;
// Token: 0x04000584 RID: 1412
public int x;
// Token: 0x04000585 RID: 1413
public int y;
// Token: 0x04000586 RID: 1414
public int currPeas;
// Token: 0x04000587 RID: 1415
public int remainPeas;
// Token: 0x04000588 RID: 1416
public int maxPeas;
// Token: 0x04000589 RID: 1417
public new string strInfo;
// Token: 0x0400058A RID: 1418
public string name;
// Token: 0x0400058B RID: 1419
public int timeToRecieve;
// Token: 0x0400058C RID: 1420
public bool isUpdate;
// Token: 0x0400058D RID: 1421
public int[] peaPostionX;
// Token: 0x0400058E RID: 1422
public int[] peaPostionY;
// Token: 0x0400058F RID: 1423
private int num;
// Token: 0x04000590 RID: 1424
public PopUp p;
// Token: 0x04000591 RID: 1425
public bool isUpdateTree;
// Token: 0x04000592 RID: 1426
public new static bool isPaint = true;
// Token: 0x04000593 RID: 1427
public bool isPeasEffect;
// Token: 0x04000594 RID: 1428
public new int seconds;
// Token: 0x04000595 RID: 1429
public new long last;
// Token: 0x04000596 RID: 1430
public new long cur;
// Token: 0x04000597 RID: 1431
private int wPopUp;
// Token: 0x04000598 RID: 1432
private bool waitToUpdate;
// Token: 0x04000599 RID: 1433
private int delay;
}