aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/MUDControlCentre.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-09 18:32:48 -0500
committerMichael <[email protected]>2017-02-09 18:32:48 -0500
commitc544e4081d53bcd888c8fce459c7e02f8516f5a8 (patch)
treed654358830f21f28d417665d1a2d7946f0620efb /ShiftOS.WinForms/Applications/MUDControlCentre.cs
parent86f204ee49fefc6dd92f7b02248a3dddb1fca400 (diff)
downloadshiftos_thereturn-c544e4081d53bcd888c8fce459c7e02f8516f5a8.tar.gz
shiftos_thereturn-c544e4081d53bcd888c8fce459c7e02f8516f5a8.tar.bz2
shiftos_thereturn-c544e4081d53bcd888c8fce459c7e02f8516f5a8.zip
Dramatic shop optimizations.
Diffstat (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs')
-rw-r--r--ShiftOS.WinForms/Applications/MUDControlCentre.cs32
1 files changed, 26 insertions, 6 deletions
diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs
index 5e93e2f..927f50d 100644
--- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs
+++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs
@@ -140,6 +140,15 @@ namespace ShiftOS.WinForms.Applications
ShowShop(JsonConvert.DeserializeObject<Shop>(msg.Contents));
}));
}
+ else if(msg.Name == "shop_additem")
+ {
+ var contents = JsonConvert.DeserializeObject<Dictionary<string, object>>(msg.Contents);
+ if((string)contents["shop"] == CurrentShop.Name)
+ {
+ CurrentShop.Items.Add((ShopItem)contents["itemdata"]);
+ this.Invoke(new Action(PopulateShopView));
+ }
+ }
else if(msg.Name == "user_noshop")
{
this.Invoke(new Action(() =>
@@ -181,7 +190,7 @@ namespace ShiftOS.WinForms.Applications
public void PopulateShopEditor()
{
txtshopdescription.Text = editingShop.Description;
- txtshopname.Text = editingShop.Description;
+ txtshopname.Text = editingShop.Name;
lbeditingshopitems.Items.Clear();
foreach(var item in editingShop.Items)
{
@@ -247,6 +256,17 @@ namespace ShiftOS.WinForms.Applications
}
+ public void PopulateShopView()
+ {
+ lbupgrades.Items.Clear();
+ shopItems = CurrentShop.Items;
+ foreach (var item in CurrentShop.Items)
+ {
+ lbupgrades.Items.Add(item.Name);
+ }
+
+ }
+
public void ShowShop(Shop shop)
{
shop_view.BringToFront();
@@ -257,12 +277,11 @@ namespace ShiftOS.WinForms.Applications
lbprice.Text = "Select an item from the list on the left.";
btnbuy.Hide();
- lbupgrades.Items.Clear();
- shopItems = shop.Items;
- foreach (var item in shop.Items)
+ ServerManager.SendMessage("shop_getitems", JsonConvert.SerializeObject(new
{
- lbupgrades.Items.Add(item.Name);
- }
+ shopname = CurrentShop.Name
+ }));
+
lbupgrades.SelectedIndexChanged += (o, a) =>
{
item = shopItems[lbupgrades.SelectedIndex];
@@ -715,6 +734,7 @@ Current legions: {legionname}";
AppearanceManager.SetupWindow(new ShopItemCreator(new ShopItem(), new Action<ShopItem>((item) =>
{
editingShop.Items.Add(item);
+ PopulateShopEditor();
})));
}