-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVendor
254 lines (211 loc) · 5.94 KB
/
Vendor
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
using System;
using System.Collections.Generic;
namespace Vendor
{
//Ishan Dutta
class Program
{
static void Main(string[] args)
{
Vendor V = new Vendor("");
}
}
public enum StuffEnum
{
Healing,
Speed,
Invisibility,
Invincibility,
Regeneration,
Shield,
Strength,
Poison
}
class Magic
{
string nameofmagicvendor = "";
string[] inventoryofmagic = { "" };
public Magic()
{
Potions poop = new Potions();
}
public void restore()
{
}
public void buy()
{
}
public void sell()
{
}
}
class Vendor : IBuy, ISell
{
string name = "";
string[] inventory = { "" };
int Gold = 0;
bool Bought = false;
//temporary solution
int IBuy.Gold { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
bool IBuy.Bought { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public int itemCost { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool sold { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
//int gold;
public Vendor(string Name)
{
ask(Name);
Console.ReadKey();
}
public void ask(string Name)
{
while (true)
{
try
{
Console.Clear();
Console.WriteLine("Which vendor would you like to go to? Please type the name.");
Console.WriteLine("1) Blacksmith\n2) Magic\n3) Exit");
Name = Console.ReadLine();
if (Name.ToLower() == "1" || Name.ToLower() == "blacksmith")
{
Blacksmith BS = new Blacksmith();
}
else if (Name.ToLower() == "2" || Name.ToLower() == "magic")
{
Magic MV = new Magic();
}
else if (Name.ToLower() == "3" || Name.ToLower() == "exit")
{
Environment.Exit(0);
}
}
catch
{
Console.WriteLine("Try Again!");
}
}
}
public void buy()
{
Console.WriteLine("Buying....");
}
public void sell()
{
Console.WriteLine("Selling....");
}
}
interface IBuy
{
int Gold { get; set; }
bool Bought { get; set; }
void buy();
}
interface ISell
{
int itemCost { get; set; }
bool sold { get; set; }
void sell();
}
class Blacksmith
{
string nameofsmith = "";
string[] inventoryofsmith = { "" };
public Blacksmith()
{
Weapons weep = new Weapons();
}
public void repair()
{
}
public void buy()
{
Console.WriteLine("This is a sword");
}
public void sell()
{
}
}
public class Items
{
public static Random myRandom = new Random();
int price = 0;
string nameofitem = "";
bool used = false;
public int getRandom(int range)
{
return myRandom.Next(range);
}
public void use()
{
}
}
public class Weapons : Items
{
public delegate void Print(int value);
int durability = 100;
string typeofweapon = "";
List<string> weaponList = File.ReadAllLines("Weapons.txt").ToList();
public Weapons() //displays weapons list
{
Console.Clear();
Console.WriteLine("Weapons List\n");
Console.ForegroundColor = ConsoleColor.Magenta;
foreach (string s in weaponList)
{
Console.WriteLine(s);
}
Console.ResetColor();
Print printDel = PrintMoney;
Console.WriteLine("\nCost of all these weapons combined: ");
printDel(11242);
Console.ReadKey();
}
public static void PrintMoney(int num)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("{0:C}", num);
Console.ResetColor();
}
private string getWeapon()
{
return weaponList[getRandom(weaponList.Count)];
}
public void attack()
{
}
}
public class Potions : Items
{
public delegate void Print(int value);
string typeofpotion = "";
List<string> potionList = File.ReadAllLines("Potion.txt").ToList();
public Potions() //displays potions list
{
Console.Clear();
Print printDel = PrintMoney;
Console.WriteLine("\nPotions List\n");
Console.ForegroundColor = ConsoleColor.Cyan;
foreach (StuffEnum value in Enum.GetValues(typeof(StuffEnum)))
{
Console.WriteLine(value);
}
Console.ResetColor();
Console.WriteLine("\nCost of all these potions combined: ");
printDel(2341);
Console.ReadKey();
}
private string getWeapon()
{
return potionList[getRandom(potionList.Count)];
}
public static void PrintMoney(int num)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("{0:C}", num);
Console.ResetColor();
}
public void drink()
{
}
}
}