-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathItemWeapon.cs
186 lines (159 loc) · 4.16 KB
/
ItemWeapon.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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
namespace GameServer
{
class ItemWeapon
{
private uint id;
private string type;
private uint price;
private string name;
private uint min_attack;
private uint max_attack;
private uint strength;
private uint stamina;
private uint dexterity;
private uint luck;
public ItemWeapon(uint _id, string _type, uint _price, string _name, uint _min_attack, uint _max_attack, uint _strength, uint _stamina, uint _dexterity, uint _luck)
{
id = _id;
type = _type;
price = _price;
name = _name;
min_attack = _min_attack;
max_attack = _max_attack;
strength = _strength;
stamina = _stamina;
dexterity = _dexterity;
luck = _luck;
}
public uint Id
{
get
{
return id;
}
}
public string Type
{
get
{
return type;
}
}
public uint Price
{
get
{
return price;
}
}
public string Name
{
get
{
return name;
}
}
public uint Min_attack
{
get
{
return min_attack;
}
}
public uint Max_attack
{
get
{
return max_attack;
}
}
public uint Strength
{
get
{
return strength;
}
}
public uint Stamina
{
get
{
return stamina;
}
}
public uint Dexterity
{
get
{
return dexterity;
}
}
public uint Luck
{
get
{
return luck;
}
}
}
class ItemsWeapon
{
private List<ItemWeapon> itemWList;
public ItemsWeapon(GlobalMySql dataBase)
{
itemWList = new List<ItemWeapon>();
if (dataBase.Connection.State != ConnectionState.Open)
{
try
{
dataBase.Connection.Open();
}
catch
{
//
}
}
MySqlCommand query = dataBase.Connection.CreateCommand();
query.CommandText = "SELECT ITEM.*, WEAPON_DETAILS.min_attack, WEAPON_DETAILS.max_attack, BONUSES.strength, BONUSES.stamina, BONUSES.dexterity, BONUSES.luck FROM `item` ITEM, `weapon_details` WEAPON_DETAILS, `bonuses` BONUSES WHERE ITEM.type='weapon' AND ITEM.id=WEAPON_DETAILS.id AND ITEM.id=BONUSES.id";
try
{
using (MySqlDataReader reader = query.ExecuteReader())
{
while (reader.Read())
{
ItemWeapon weapon = new ItemWeapon(
reader.GetUInt32("id"),
reader.GetString("type"),
reader.GetUInt32("price"),
reader.GetString("name"),
reader.GetUInt32("min_attack"),
reader.GetUInt32("max_attack"),
reader.GetUInt32("strength"),
reader.GetUInt32("stamina"),
reader.GetUInt32("dexterity"),
reader.GetUInt32("luck")
);
itemWList.Add(weapon);
}
}
}
catch
{
//
}
}
public List<ItemWeapon> ItemWList
{
get
{
return itemWList;
}
}
}
}