-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemMap.cs
141 lines (123 loc) · 2.34 KB
/
ItemMap.cs
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
public class ItemMap
{
public int x;
public int y;
public int xEnd;
public int yEnd;
public int f;
public int vx;
public int vy;
public int itemMapID;
public int IdCharMove;
public ItemTemplate template;
public sbyte status;
public int sizeItem = 24;
public MyImage imgCaptcha;
private int frame;
public ItemMap(short itemMapID, short itemTemplateID, int x, int y, int xEnd, int yEnd)
{
this.itemMapID = itemMapID;
template = ItemTemplates.get(itemTemplateID);
this.x = xEnd;
this.y = y;
this.xEnd = xEnd;
this.yEnd = yEnd;
vx = xEnd - x >> 2;
vy = 5;
}
public ItemMap(short itemMapID, short itemTemplateID, int x, int y)
{
this.itemMapID = itemMapID;
template = ItemTemplates.get(itemTemplateID);
this.x = (xEnd = x);
this.y = (yEnd = y);
status = 1;
}
public void setPoint(int xEnd, int yEnd)
{
this.xEnd = xEnd;
this.yEnd = yEnd;
vx = xEnd - x >> 2;
vy = yEnd - y >> 2;
status = 2;
}
public void update()
{
if (status == 2 && x == xEnd && y == yEnd)
{
GameScr.vItemMap.removeElement(this);
if (Char.getMyChar().itemFocus != null && Char.getMyChar().itemFocus.Equals(this))
{
Char.getMyChar().itemFocus = null;
}
return;
}
if (status > 0)
{
if (vx == 0)
{
x = xEnd;
}
if (vy == 0)
{
y = yEnd;
}
if (x != xEnd)
{
x += vx;
if ((vx > 0 && x > xEnd) || (vx < 0 && x < xEnd))
{
x = xEnd;
}
}
if (y != yEnd)
{
y += vy;
if ((vy > 0 && y > yEnd) || (vy < 0 && y < yEnd))
{
y = yEnd;
}
}
}
else
{
status -= 4;
if (status < -12)
{
y -= 12;
status = 1;
}
}
if (GameCanvas.gameTick % 5 == 0)
{
frame++;
if (frame > 2)
{
frame = 0;
}
}
}
public void paint(mGraphics g)
{
if (imgCaptcha != null && imgCaptcha.img != null)
{
int num = 0;
if (status <= 0)
{
num = status;
}
g.drawImage(imgCaptcha.img, x, y + num, mGraphics.BOTTOM | mGraphics.HCENTER);
return;
}
int num2 = 0;
if (status <= 0)
{
num2 = status;
}
SmallImage.drawSmallImage(g, template.iconID, x, y + num2, 0, mGraphics.BOTTOM | mGraphics.HCENTER);
if (Char.getMyChar().itemFocus != null && Char.getMyChar().itemFocus.Equals(this) && status != 2)
{
SmallImage.drawSmallImage(g, 988, x, y - 20, 0, mGraphics.VCENTER | mGraphics.HCENTER);
}
}
}