Shop work.

- Shop Editor implemented.
- Shop List implemented.
- Shops are now a way to earn Codepoints.
This commit is contained in:
Michael 2017-02-08 15:51:22 -05:00
parent a4b49ab68b
commit 51ad9434bb
9 changed files with 859 additions and 231 deletions

View file

@ -11,6 +11,7 @@ namespace ShiftOS.Objects
public string Name { get; set; }
public string Description { get; set; }
public List<ShopItem> Items { get; set; }
public string Owner { get; set; }
}
public abstract class ShopItem
@ -18,26 +19,7 @@ namespace ShiftOS.Objects
public string Name { get; set; }
public string Description { get; set; }
public int Cost { get; set; }
public string ShopOwner { get; set; }
protected abstract void OnBuy();
protected abstract void GiveCPToShopOwner(int cp);
public bool Buy(ref Save buyer)
{
if(buyer.Codepoints >= Cost)
{
buyer.Codepoints -= Cost;
OnBuy();
GiveCPToShopOwner(Cost);
return true;
}
else
{
return false;
}
}
public int FileType { get; set; }
public byte[] MUDFile { get; set; }
}
}

View file

@ -364,6 +364,109 @@ Contents:
}));
Console.WriteLine("After dispatch");
}
break;
case "update_shop_by_user":
List<Shop> shopList = new List<Shop>();
if (File.Exists("shops.json"))
shopList = JsonConvert.DeserializeObject<List<Shop>>(File.ReadAllText("shops.json"));
var username = args["username"] as string;
var updateShop = JsonConvert.DeserializeObject<Shop>(msg.Contents);
for(int i = 0; i < shopList.Count; i++)
{
if(shopList[i].Owner == username)
{
shopList[i] = updateShop;
}
}
File.WriteAllText("shops.json", JsonConvert.SerializeObject(shopList, Formatting.Indented));
server.DispatchTo(new Guid(msg.GUID), new NetObject("nametaken", new ServerMessage
{
Name = "shop_added",
GUID = "server",
}));
break;
case "create_shop":
List<Shop> shopFile = new List<Shop>();
if (File.Exists("shops.json"))
shopFile = JsonConvert.DeserializeObject<List<Shop>>(File.ReadAllText("shops.json"));
var newShop = JsonConvert.DeserializeObject<Shop>(msg.Contents);
foreach (var shop in shopFile)
{
if (shop.Name == newShop.Name)
{
server.DispatchTo(new Guid(msg.GUID), new NetObject("nametaken", new ServerMessage
{
Name = "shop_taken",
GUID = "server",
}));
}
return;
}
shopFile.Add(newShop);
File.WriteAllText("shops.json", JsonConvert.SerializeObject(shopFile, Formatting.Indented));
server.DispatchTo(new Guid(msg.GUID), new NetObject("nametaken", new ServerMessage
{
Name = "shop_added",
GUID = "server",
}));
break;
case "user_shop_check":
List<Shop> allshops = new List<Shop>();
if (File.Exists("shops.json"))
allshops = JsonConvert.DeserializeObject<List<Shop>>(File.ReadAllText("shops.json"));
int res = 0;
foreach(var shop in allshops)
{
if(shop.Owner == args["username"] as string)
{
res = 1;
}
}
server.DispatchTo(new Guid(msg.GUID), new NetObject("hahhhhhhh", new ServerMessage
{
Name = "user_shop_check_result",
GUID = "server",
Contents = res.ToString()
}));
break;
case "shop_getall":
List<Shop> shops = new List<Shop>();
if (File.Exists("shops.json"))
shops = JsonConvert.DeserializeObject<List<Shop>>(File.ReadAllText("shops.json"));
server.DispatchTo(new Guid(msg.GUID), new NetObject("ladouceur", new ServerMessage
{
Name = "shop_all",
GUID = "server",
Contents = JsonConvert.SerializeObject(shops)
}));
break;
case "shop_requestdownload":
string download = args["download"] as string;
if (File.Exists(download) && download.StartsWith("shopDownloads/"))
{
server.DispatchTo(new Guid(msg.GUID), new NetObject("shop_download_meta", new ServerMessage
{
Name = "shop_download_meta",
GUID = "server",
Contents = JsonConvert.SerializeObject(File.ReadAllBytes(download))
}));
}
break;
case "usr_givecp":
if (args["username"] != null && args["amount"] != null)
@ -599,7 +702,7 @@ Contents:
case "get_memos_for_user":
if(args["username"] != null)
{
string usrname = args["username"].ToString();
string usrnme = args["username"].ToString();
List<MUDMemo> mmos = new List<MUDMemo>();
@ -607,7 +710,7 @@ Contents:
{
foreach(var mmo in JsonConvert.DeserializeObject<MUDMemo[]>(File.ReadAllText("memos.json")))
{
if(mmo.UserTo == usrname)
if(mmo.UserTo == usrnme)
{
mmos.Add(mmo);
}
@ -1128,13 +1231,13 @@ The page you requested at was not found on this multi-user domain."
server.DispatchTo(new Guid(msg.GUID), new NetObject("bounce", msg));
break;
case "getguid_send":
string username = msg.Contents;
string usrname = msg.Contents;
string guid = msg.GUID;
server.DispatchAll(new NetObject("are_you_this_guy", new ServerMessage
{
Name = "getguid_fromserver",
GUID = guid,
Contents = username,
Contents = usrname,
}));
break;
case "script":

View file

@ -72,21 +72,6 @@ namespace ShiftOS.WinForms.Applications
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.txtappstatus = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
this.job_current = new System.Windows.Forms.Panel();
this.lbtaskdescription = new System.Windows.Forms.Label();
this.lbtaskname = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.shop_view = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.lbupggradedesc = new System.Windows.Forms.Label();
this.pnlbuy = new System.Windows.Forms.Panel();
this.lbprice = new System.Windows.Forms.Label();
this.btnbuy = new System.Windows.Forms.Button();
this.lbupgradetitle = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.lbupgrades = new System.Windows.Forms.ListBox();
this.lbcodepoints = new System.Windows.Forms.Label();
this.lbshopname = new System.Windows.Forms.Label();
this.lgn_create = new System.Windows.Forms.Panel();
this.btncreate = new System.Windows.Forms.Button();
this.txtnewlegiondescription = new System.Windows.Forms.TextBox();
@ -103,6 +88,21 @@ namespace ShiftOS.WinForms.Applications
this.txtnewlegionshortname = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.txtnewlegiontitle = new System.Windows.Forms.TextBox();
this.job_current = new System.Windows.Forms.Panel();
this.lbtaskdescription = new System.Windows.Forms.Label();
this.lbtaskname = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.shop_view = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.lbupgradedesc = new System.Windows.Forms.Label();
this.pnlbuy = new System.Windows.Forms.Panel();
this.lbprice = new System.Windows.Forms.Label();
this.btnbuy = new System.Windows.Forms.Button();
this.lbupgradetitle = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.lbupgrades = new System.Windows.Forms.ListBox();
this.lbcodepoints = new System.Windows.Forms.Label();
this.lbshopname = new System.Windows.Forms.Label();
this.lgn_view = new System.Windows.Forms.Panel();
this.pnllgnusers = new System.Windows.Forms.Panel();
this.lvusers = new System.Windows.Forms.ListView();
@ -127,21 +127,39 @@ namespace ShiftOS.WinForms.Applications
this.you_systemstatus = new System.Windows.Forms.Panel();
this.lblsysstatus = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.shop_all = new System.Windows.Forms.Panel();
this.flshoplist = new System.Windows.Forms.FlowLayoutPanel();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.shop_editor = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.label15 = new System.Windows.Forms.Label();
this.btnsaveshop = new System.Windows.Forms.Button();
this.label16 = new System.Windows.Forms.Label();
this.panel9 = new System.Windows.Forms.Panel();
this.listBox1 = new System.Windows.Forms.ListBox();
this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel();
this.btnaddshopitem = new System.Windows.Forms.Button();
this.btnremoveitem = new System.Windows.Forms.Button();
this.btnedititem = new System.Windows.Forms.Button();
this.txtshopname = new System.Windows.Forms.TextBox();
this.txtshopdescription = new System.Windows.Forms.TextBox();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
this.toolStripContainer1.SuspendLayout();
this.lgn_create.SuspendLayout();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.flowLayoutPanel4.SuspendLayout();
this.job_current.SuspendLayout();
this.shop_view.SuspendLayout();
this.panel5.SuspendLayout();
this.pnlbuy.SuspendLayout();
this.panel1.SuspendLayout();
this.lgn_create.SuspendLayout();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.flowLayoutPanel4.SuspendLayout();
this.lgn_view.SuspendLayout();
this.pnllgnusers.SuspendLayout();
this.banner.SuspendLayout();
@ -151,6 +169,12 @@ namespace ShiftOS.WinForms.Applications
this.flowLayoutPanel2.SuspendLayout();
this.you_memos.SuspendLayout();
this.you_systemstatus.SuspendLayout();
this.shop_all.SuspendLayout();
this.shop_editor.SuspendLayout();
this.panel7.SuspendLayout();
this.panel8.SuspendLayout();
this.panel9.SuspendLayout();
this.flowLayoutPanel5.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@ -211,20 +235,22 @@ namespace ShiftOS.WinForms.Applications
// browseToolStripMenuItem
//
this.browseToolStripMenuItem.Name = "browseToolStripMenuItem";
this.browseToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.browseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.browseToolStripMenuItem.Text = "Browse";
this.browseToolStripMenuItem.Click += new System.EventHandler(this.browseToolStripMenuItem_Click);
//
// myShopToolStripMenuItem
//
this.myShopToolStripMenuItem.Name = "myShopToolStripMenuItem";
this.myShopToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.myShopToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.myShopToolStripMenuItem.Text = "My Shop";
//
// openAShopToolStripMenuItem
//
this.openAShopToolStripMenuItem.Name = "openAShopToolStripMenuItem";
this.openAShopToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.openAShopToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openAShopToolStripMenuItem.Text = "Open a Shop";
this.openAShopToolStripMenuItem.Click += new System.EventHandler(this.openAShopToolStripMenuItem_Click);
//
// tasksToolStripMenuItem
//
@ -305,9 +331,11 @@ namespace ShiftOS.WinForms.Applications
//
// toolStripContainer1.ContentPanel
//
this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_editor);
this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_view);
this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_all);
this.toolStripContainer1.ContentPanel.Controls.Add(this.lgn_create);
this.toolStripContainer1.ContentPanel.Controls.Add(this.job_current);
this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_view);
this.toolStripContainer1.ContentPanel.Controls.Add(this.lgn_view);
this.toolStripContainer1.ContentPanel.Controls.Add(this.lgn_join);
this.toolStripContainer1.ContentPanel.Controls.Add(this.you_memos);
@ -324,167 +352,6 @@ namespace ShiftOS.WinForms.Applications
//
this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
//
// job_current
//
this.job_current.Controls.Add(this.lbtaskdescription);
this.job_current.Controls.Add(this.lbtaskname);
this.job_current.Controls.Add(this.label6);
this.job_current.Dock = System.Windows.Forms.DockStyle.Fill;
this.job_current.Location = new System.Drawing.Point(0, 0);
this.job_current.Name = "job_current";
this.job_current.Size = new System.Drawing.Size(756, 442);
this.job_current.TabIndex = 3;
//
// lbtaskdescription
//
this.lbtaskdescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbtaskdescription.Location = new System.Drawing.Point(0, 26);
this.lbtaskdescription.Margin = new System.Windows.Forms.Padding(30);
this.lbtaskdescription.Name = "lbtaskdescription";
this.lbtaskdescription.Size = new System.Drawing.Size(756, 416);
this.lbtaskdescription.TabIndex = 2;
this.lbtaskdescription.Text = "label12";
//
// lbtaskname
//
this.lbtaskname.AutoSize = true;
this.lbtaskname.Dock = System.Windows.Forms.DockStyle.Top;
this.lbtaskname.Location = new System.Drawing.Point(0, 13);
this.lbtaskname.Margin = new System.Windows.Forms.Padding(15);
this.lbtaskname.Name = "lbtaskname";
this.lbtaskname.Size = new System.Drawing.Size(60, 13);
this.lbtaskname.TabIndex = 1;
this.lbtaskname.Tag = "header2";
this.lbtaskname.Text = "Task name";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Dock = System.Windows.Forms.DockStyle.Top;
this.label6.Location = new System.Drawing.Point(0, 0);
this.label6.Margin = new System.Windows.Forms.Padding(15);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 13);
this.label6.TabIndex = 0;
this.label6.Tag = "header1";
this.label6.Text = "Current Task";
//
// shop_view
//
this.shop_view.Controls.Add(this.panel5);
this.shop_view.Controls.Add(this.panel1);
this.shop_view.Dock = System.Windows.Forms.DockStyle.Fill;
this.shop_view.Location = new System.Drawing.Point(0, 0);
this.shop_view.Name = "shop_view";
this.shop_view.Size = new System.Drawing.Size(756, 442);
this.shop_view.TabIndex = 6;
//
// panel5
//
this.panel5.Controls.Add(this.lbupggradedesc);
this.panel5.Controls.Add(this.pnlbuy);
this.panel5.Controls.Add(this.lbupgradetitle);
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel5.Location = new System.Drawing.Point(389, 0);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(367, 442);
this.panel5.TabIndex = 1;
//
// lbupggradedesc
//
this.lbupggradedesc.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbupggradedesc.Location = new System.Drawing.Point(0, 43);
this.lbupggradedesc.Name = "lbupggradedesc";
this.lbupggradedesc.Size = new System.Drawing.Size(367, 363);
this.lbupggradedesc.TabIndex = 2;
this.lbupggradedesc.Text = "label6";
this.lbupggradedesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pnlbuy
//
this.pnlbuy.Controls.Add(this.lbprice);
this.pnlbuy.Controls.Add(this.btnbuy);
this.pnlbuy.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlbuy.Location = new System.Drawing.Point(0, 406);
this.pnlbuy.Name = "pnlbuy";
this.pnlbuy.Size = new System.Drawing.Size(367, 36);
this.pnlbuy.TabIndex = 1;
//
// lbprice
//
this.lbprice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbprice.AutoSize = true;
this.lbprice.Location = new System.Drawing.Point(6, 10);
this.lbprice.Name = "lbprice";
this.lbprice.Size = new System.Drawing.Size(35, 13);
this.lbprice.TabIndex = 1;
this.lbprice.Text = "label6";
//
// btnbuy
//
this.btnbuy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnbuy.Location = new System.Drawing.Point(283, 3);
this.btnbuy.Name = "btnbuy";
this.btnbuy.Size = new System.Drawing.Size(75, 23);
this.btnbuy.TabIndex = 0;
this.btnbuy.Text = "button3";
this.btnbuy.UseVisualStyleBackColor = true;
//
// lbupgradetitle
//
this.lbupgradetitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lbupgradetitle.Location = new System.Drawing.Point(0, 0);
this.lbupgradetitle.Name = "lbupgradetitle";
this.lbupgradetitle.Size = new System.Drawing.Size(367, 43);
this.lbupgradetitle.TabIndex = 0;
this.lbupgradetitle.Tag = "header2";
this.lbupgradetitle.Text = "Welcome to my shop!";
this.lbupgradetitle.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// panel1
//
this.panel1.Controls.Add(this.lbupgrades);
this.panel1.Controls.Add(this.lbcodepoints);
this.panel1.Controls.Add(this.lbshopname);
this.panel1.Cursor = System.Windows.Forms.Cursors.Default;
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(389, 442);
this.panel1.TabIndex = 0;
//
// lbupgrades
//
this.lbupgrades.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbupgrades.FormattingEnabled = true;
this.lbupgrades.Location = new System.Drawing.Point(0, 46);
this.lbupgrades.Name = "lbupgrades";
this.lbupgrades.Size = new System.Drawing.Size(389, 383);
this.lbupgrades.TabIndex = 2;
//
// lbcodepoints
//
this.lbcodepoints.AutoSize = true;
this.lbcodepoints.Dock = System.Windows.Forms.DockStyle.Bottom;
this.lbcodepoints.Location = new System.Drawing.Point(0, 429);
this.lbcodepoints.Margin = new System.Windows.Forms.Padding(10);
this.lbcodepoints.Name = "lbcodepoints";
this.lbcodepoints.Size = new System.Drawing.Size(72, 13);
this.lbcodepoints.TabIndex = 1;
this.lbcodepoints.Tag = "header2";
this.lbcodepoints.Text = "Codepoints: 0";
//
// lbshopname
//
this.lbshopname.Dock = System.Windows.Forms.DockStyle.Top;
this.lbshopname.Location = new System.Drawing.Point(0, 0);
this.lbshopname.Name = "lbshopname";
this.lbshopname.Size = new System.Drawing.Size(389, 46);
this.lbshopname.TabIndex = 0;
this.lbshopname.Tag = "header1";
this.lbshopname.Text = "My shop";
this.lbshopname.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// lgn_create
//
this.lgn_create.Controls.Add(this.btncreate);
@ -672,6 +539,168 @@ namespace ShiftOS.WinForms.Applications
this.txtnewlegiontitle.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtnewlegiontitle.TextChanged += new System.EventHandler(this.txtnewlegiontitle_TextChanged);
//
// job_current
//
this.job_current.Controls.Add(this.lbtaskdescription);
this.job_current.Controls.Add(this.lbtaskname);
this.job_current.Controls.Add(this.label6);
this.job_current.Dock = System.Windows.Forms.DockStyle.Fill;
this.job_current.Location = new System.Drawing.Point(0, 0);
this.job_current.Name = "job_current";
this.job_current.Size = new System.Drawing.Size(756, 442);
this.job_current.TabIndex = 3;
//
// lbtaskdescription
//
this.lbtaskdescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbtaskdescription.Location = new System.Drawing.Point(0, 26);
this.lbtaskdescription.Margin = new System.Windows.Forms.Padding(30);
this.lbtaskdescription.Name = "lbtaskdescription";
this.lbtaskdescription.Size = new System.Drawing.Size(756, 416);
this.lbtaskdescription.TabIndex = 2;
this.lbtaskdescription.Text = "label12";
//
// lbtaskname
//
this.lbtaskname.AutoSize = true;
this.lbtaskname.Dock = System.Windows.Forms.DockStyle.Top;
this.lbtaskname.Location = new System.Drawing.Point(0, 13);
this.lbtaskname.Margin = new System.Windows.Forms.Padding(15);
this.lbtaskname.Name = "lbtaskname";
this.lbtaskname.Size = new System.Drawing.Size(60, 13);
this.lbtaskname.TabIndex = 1;
this.lbtaskname.Tag = "header2";
this.lbtaskname.Text = "Task name";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Dock = System.Windows.Forms.DockStyle.Top;
this.label6.Location = new System.Drawing.Point(0, 0);
this.label6.Margin = new System.Windows.Forms.Padding(15);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 13);
this.label6.TabIndex = 0;
this.label6.Tag = "header1";
this.label6.Text = "Current Task";
//
// shop_view
//
this.shop_view.Controls.Add(this.panel5);
this.shop_view.Controls.Add(this.panel1);
this.shop_view.Dock = System.Windows.Forms.DockStyle.Fill;
this.shop_view.Location = new System.Drawing.Point(0, 0);
this.shop_view.Name = "shop_view";
this.shop_view.Size = new System.Drawing.Size(756, 442);
this.shop_view.TabIndex = 6;
//
// panel5
//
this.panel5.Controls.Add(this.lbupgradedesc);
this.panel5.Controls.Add(this.pnlbuy);
this.panel5.Controls.Add(this.lbupgradetitle);
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel5.Location = new System.Drawing.Point(389, 0);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(367, 442);
this.panel5.TabIndex = 1;
//
// lbupgradedesc
//
this.lbupgradedesc.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbupgradedesc.Location = new System.Drawing.Point(0, 43);
this.lbupgradedesc.Name = "lbupgradedesc";
this.lbupgradedesc.Size = new System.Drawing.Size(367, 363);
this.lbupgradedesc.TabIndex = 2;
this.lbupgradedesc.Text = "label6";
this.lbupgradedesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pnlbuy
//
this.pnlbuy.Controls.Add(this.lbprice);
this.pnlbuy.Controls.Add(this.btnbuy);
this.pnlbuy.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlbuy.Location = new System.Drawing.Point(0, 406);
this.pnlbuy.Name = "pnlbuy";
this.pnlbuy.Size = new System.Drawing.Size(367, 36);
this.pnlbuy.TabIndex = 1;
//
// lbprice
//
this.lbprice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbprice.AutoSize = true;
this.lbprice.Location = new System.Drawing.Point(6, 10);
this.lbprice.Name = "lbprice";
this.lbprice.Size = new System.Drawing.Size(35, 13);
this.lbprice.TabIndex = 1;
this.lbprice.Text = "label6";
//
// btnbuy
//
this.btnbuy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnbuy.Location = new System.Drawing.Point(283, 3);
this.btnbuy.Name = "btnbuy";
this.btnbuy.Size = new System.Drawing.Size(75, 23);
this.btnbuy.TabIndex = 0;
this.btnbuy.Text = "button3";
this.btnbuy.UseVisualStyleBackColor = true;
this.btnbuy.Click += new System.EventHandler(this.btnbuy_Click);
//
// lbupgradetitle
//
this.lbupgradetitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lbupgradetitle.Location = new System.Drawing.Point(0, 0);
this.lbupgradetitle.Name = "lbupgradetitle";
this.lbupgradetitle.Size = new System.Drawing.Size(367, 43);
this.lbupgradetitle.TabIndex = 0;
this.lbupgradetitle.Tag = "header2";
this.lbupgradetitle.Text = "Welcome to my shop!";
this.lbupgradetitle.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// panel1
//
this.panel1.Controls.Add(this.lbupgrades);
this.panel1.Controls.Add(this.lbcodepoints);
this.panel1.Controls.Add(this.lbshopname);
this.panel1.Cursor = System.Windows.Forms.Cursors.Default;
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(389, 442);
this.panel1.TabIndex = 0;
//
// lbupgrades
//
this.lbupgrades.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbupgrades.FormattingEnabled = true;
this.lbupgrades.Location = new System.Drawing.Point(0, 46);
this.lbupgrades.Name = "lbupgrades";
this.lbupgrades.Size = new System.Drawing.Size(389, 383);
this.lbupgrades.TabIndex = 2;
//
// lbcodepoints
//
this.lbcodepoints.AutoSize = true;
this.lbcodepoints.Dock = System.Windows.Forms.DockStyle.Bottom;
this.lbcodepoints.Location = new System.Drawing.Point(0, 429);
this.lbcodepoints.Margin = new System.Windows.Forms.Padding(10);
this.lbcodepoints.Name = "lbcodepoints";
this.lbcodepoints.Size = new System.Drawing.Size(72, 13);
this.lbcodepoints.TabIndex = 1;
this.lbcodepoints.Tag = "header2";
this.lbcodepoints.Text = "Codepoints: 0";
//
// lbshopname
//
this.lbshopname.Dock = System.Windows.Forms.DockStyle.Top;
this.lbshopname.Location = new System.Drawing.Point(0, 0);
this.lbshopname.Name = "lbshopname";
this.lbshopname.Size = new System.Drawing.Size(389, 46);
this.lbshopname.TabIndex = 0;
this.lbshopname.Tag = "header1";
this.lbshopname.Text = "My shop";
this.lbshopname.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// lgn_view
//
this.lgn_view.Controls.Add(this.pnllgnusers);
@ -955,6 +984,205 @@ namespace ShiftOS.WinForms.Applications
this.label1.Tag = "header1";
this.label1.Text = "You";
//
// shop_all
//
this.shop_all.Controls.Add(this.flshoplist);
this.shop_all.Controls.Add(this.label12);
this.shop_all.Controls.Add(this.label13);
this.shop_all.Dock = System.Windows.Forms.DockStyle.Fill;
this.shop_all.Location = new System.Drawing.Point(0, 0);
this.shop_all.Name = "shop_all";
this.shop_all.Size = new System.Drawing.Size(756, 442);
this.shop_all.TabIndex = 7;
//
// flshoplist
//
this.flshoplist.AutoScroll = true;
this.flshoplist.Dock = System.Windows.Forms.DockStyle.Fill;
this.flshoplist.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flshoplist.Location = new System.Drawing.Point(0, 94);
this.flshoplist.Name = "flshoplist";
this.flshoplist.Size = new System.Drawing.Size(756, 348);
this.flshoplist.TabIndex = 1;
this.flshoplist.WrapContents = false;
//
// label12
//
this.label12.Dock = System.Windows.Forms.DockStyle.Top;
this.label12.Location = new System.Drawing.Point(0, 43);
this.label12.Name = "label12";
this.label12.Padding = new System.Windows.Forms.Padding(15, 0, 15, 15);
this.label12.Size = new System.Drawing.Size(756, 51);
this.label12.TabIndex = 0;
this.label12.Tag = "";
this.label12.Text = resources.GetString("label12.Text");
//
// label13
//
this.label13.AutoSize = true;
this.label13.Dock = System.Windows.Forms.DockStyle.Top;
this.label13.Location = new System.Drawing.Point(0, 0);
this.label13.Name = "label13";
this.label13.Padding = new System.Windows.Forms.Padding(15);
this.label13.Size = new System.Drawing.Size(67, 43);
this.label13.TabIndex = 2;
this.label13.Tag = "header1";
this.label13.Text = "Shops";
//
// shop_editor
//
this.shop_editor.Controls.Add(this.panel7);
this.shop_editor.Controls.Add(this.panel9);
this.shop_editor.Dock = System.Windows.Forms.DockStyle.Fill;
this.shop_editor.Location = new System.Drawing.Point(0, 0);
this.shop_editor.Name = "shop_editor";
this.shop_editor.Size = new System.Drawing.Size(756, 442);
this.shop_editor.TabIndex = 8;
//
// panel7
//
this.panel7.Controls.Add(this.txtshopdescription);
this.panel7.Controls.Add(this.panel8);
this.panel7.Controls.Add(this.label16);
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel7.Location = new System.Drawing.Point(389, 0);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(367, 442);
this.panel7.TabIndex = 1;
//
// panel8
//
this.panel8.Controls.Add(this.label15);
this.panel8.Controls.Add(this.btnsaveshop);
this.panel8.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel8.Location = new System.Drawing.Point(0, 406);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(367, 36);
this.panel8.TabIndex = 1;
//
// label15
//
this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(6, 10);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(267, 13);
this.label15.TabIndex = 1;
this.label15.Text = "When you are done editing your shop, click this button:";
//
// btnsaveshop
//
this.btnsaveshop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnsaveshop.Location = new System.Drawing.Point(283, 3);
this.btnsaveshop.Name = "btnsaveshop";
this.btnsaveshop.Size = new System.Drawing.Size(75, 23);
this.btnsaveshop.TabIndex = 0;
this.btnsaveshop.Text = "Save";
this.btnsaveshop.UseVisualStyleBackColor = true;
this.btnsaveshop.Click += new System.EventHandler(this.btnsaveshop_Click);
//
// label16
//
this.label16.Dock = System.Windows.Forms.DockStyle.Top;
this.label16.Location = new System.Drawing.Point(0, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(367, 43);
this.label16.TabIndex = 0;
this.label16.Tag = "header2";
this.label16.Text = "Welcome to my shop!";
this.label16.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// panel9
//
this.panel9.Controls.Add(this.listBox1);
this.panel9.Controls.Add(this.txtshopname);
this.panel9.Controls.Add(this.flowLayoutPanel5);
this.panel9.Cursor = System.Windows.Forms.Cursors.Default;
this.panel9.Dock = System.Windows.Forms.DockStyle.Left;
this.panel9.Location = new System.Drawing.Point(0, 0);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(389, 442);
this.panel9.TabIndex = 0;
//
// listBox1
//
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(0, 20);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(389, 393);
this.listBox1.TabIndex = 2;
//
// flowLayoutPanel5
//
this.flowLayoutPanel5.AutoSize = true;
this.flowLayoutPanel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flowLayoutPanel5.Controls.Add(this.btnaddshopitem);
this.flowLayoutPanel5.Controls.Add(this.btnremoveitem);
this.flowLayoutPanel5.Controls.Add(this.btnedititem);
this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Bottom;
this.flowLayoutPanel5.Location = new System.Drawing.Point(0, 413);
this.flowLayoutPanel5.Name = "flowLayoutPanel5";
this.flowLayoutPanel5.Size = new System.Drawing.Size(389, 29);
this.flowLayoutPanel5.TabIndex = 3;
//
// btnaddshopitem
//
this.btnaddshopitem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnaddshopitem.AutoSize = true;
this.btnaddshopitem.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnaddshopitem.Location = new System.Drawing.Point(3, 3);
this.btnaddshopitem.Name = "btnaddshopitem";
this.btnaddshopitem.Size = new System.Drawing.Size(36, 23);
this.btnaddshopitem.TabIndex = 1;
this.btnaddshopitem.Text = "Add";
this.btnaddshopitem.UseVisualStyleBackColor = true;
this.btnaddshopitem.Click += new System.EventHandler(this.btnaddshopitem_Click);
//
// btnremoveitem
//
this.btnremoveitem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnremoveitem.AutoSize = true;
this.btnremoveitem.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnremoveitem.Location = new System.Drawing.Point(45, 3);
this.btnremoveitem.Name = "btnremoveitem";
this.btnremoveitem.Size = new System.Drawing.Size(57, 23);
this.btnremoveitem.TabIndex = 2;
this.btnremoveitem.Text = "Remove";
this.btnremoveitem.UseVisualStyleBackColor = true;
//
// btnedititem
//
this.btnedititem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnedititem.AutoSize = true;
this.btnedititem.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnedititem.Location = new System.Drawing.Point(108, 3);
this.btnedititem.Name = "btnedititem";
this.btnedititem.Size = new System.Drawing.Size(35, 23);
this.btnedititem.TabIndex = 3;
this.btnedititem.Text = "Edit";
this.btnedititem.UseVisualStyleBackColor = true;
//
// txtshopname
//
this.txtshopname.Dock = System.Windows.Forms.DockStyle.Top;
this.txtshopname.Location = new System.Drawing.Point(0, 0);
this.txtshopname.Name = "txtshopname";
this.txtshopname.Size = new System.Drawing.Size(389, 20);
this.txtshopname.TabIndex = 4;
this.txtshopname.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.txtshopname.TextChanged += new System.EventHandler(this.txtshopname_TextChanged);
//
// txtshopdescription
//
this.txtshopdescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtshopdescription.Location = new System.Drawing.Point(0, 43);
this.txtshopdescription.Multiline = true;
this.txtshopdescription.Name = "txtshopdescription";
this.txtshopdescription.Size = new System.Drawing.Size(367, 363);
this.txtshopdescription.TabIndex = 2;
this.txtshopdescription.TextChanged += new System.EventHandler(this.txtshopdescription_TextChanged);
//
// MUDControlCentre
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -975,14 +1203,6 @@ namespace ShiftOS.WinForms.Applications
this.toolStripContainer1.TopToolStripPanel.PerformLayout();
this.toolStripContainer1.ResumeLayout(false);
this.toolStripContainer1.PerformLayout();
this.job_current.ResumeLayout(false);
this.job_current.PerformLayout();
this.shop_view.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.pnlbuy.ResumeLayout(false);
this.pnlbuy.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.lgn_create.ResumeLayout(false);
this.lgn_create.PerformLayout();
this.panel2.ResumeLayout(false);
@ -991,6 +1211,14 @@ namespace ShiftOS.WinForms.Applications
this.panel4.PerformLayout();
this.flowLayoutPanel4.ResumeLayout(false);
this.flowLayoutPanel4.PerformLayout();
this.job_current.ResumeLayout(false);
this.job_current.PerformLayout();
this.shop_view.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.pnlbuy.ResumeLayout(false);
this.pnlbuy.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.lgn_view.ResumeLayout(false);
this.lgn_view.PerformLayout();
this.pnllgnusers.ResumeLayout(false);
@ -1008,6 +1236,17 @@ namespace ShiftOS.WinForms.Applications
this.you_memos.PerformLayout();
this.you_systemstatus.ResumeLayout(false);
this.you_systemstatus.PerformLayout();
this.shop_all.ResumeLayout(false);
this.shop_all.PerformLayout();
this.shop_editor.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.panel7.PerformLayout();
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
this.panel9.ResumeLayout(false);
this.panel9.PerformLayout();
this.flowLayoutPanel5.ResumeLayout(false);
this.flowLayoutPanel5.PerformLayout();
this.ResumeLayout(false);
}
@ -1075,7 +1314,7 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.ComboBox cbpublicity;
private System.Windows.Forms.Panel shop_view;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Label lbupggradedesc;
private System.Windows.Forms.Label lbupgradedesc;
private System.Windows.Forms.Panel pnlbuy;
private System.Windows.Forms.Label lbprice;
private System.Windows.Forms.Button btnbuy;
@ -1088,5 +1327,23 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.Label lbtaskname;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label lbtaskdescription;
private System.Windows.Forms.Panel shop_all;
private System.Windows.Forms.FlowLayoutPanel flshoplist;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Panel shop_editor;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.TextBox txtshopdescription;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Button btnsaveshop;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.TextBox txtshopname;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel5;
private System.Windows.Forms.Button btnaddshopitem;
private System.Windows.Forms.Button btnremoveitem;
private System.Windows.Forms.Button btnedititem;
}
}

View file

@ -78,6 +78,27 @@ namespace ShiftOS.WinForms.Applications
myLegionToolStripMenuItem_Click(this, EventArgs.Empty);
}));
}
else if (msg.Name == "user_shop_check_result")
{
if (msg.Contents == "0")
{
ShowCreateShop();
}
else
{
Infobox.PromptYesNo("Close Shop", "You already own a MUD shop. Would you like to close it and create a new one?", new Action<bool>((result) =>
{
if (result == true)
{
ServerManager.SendMessage("shop_removeowned", JsonConvert.SerializeObject(new
{
username = SaveSystem.CurrentSave.Username
}));
ShowCreateShop();
}
}));
}
}
else if (msg.Name == "legion_alreadyexists")
{
this.Invoke(new Action(() =>
@ -97,17 +118,143 @@ namespace ShiftOS.WinForms.Applications
{
ShowLegionInfo(JsonConvert.DeserializeObject<Legion>(msg.Contents));
}
else if (msg.Name == "shop_taken")
{
this.Invoke(new Action(() =>
{
Infobox.Show("Shop name taken.", "A shop with the same name already exists.");
}));
}
else if (msg.Name == "shop_added")
{
ServerManager.SendMessage("shop_getall", "");
}
else if (msg.Name == "legion_all")
{
PopulateJoinLegion(JsonConvert.DeserializeObject<List<Legion>>(msg.Contents));
}
else if (msg.Name == "shop_allshops")
{
this.Invoke(new Action(() =>
{
PopulateShopList(JsonConvert.DeserializeObject<Shop[]>(msg.Contents));
}));
}
}));
}
catch { }
};
}
private Shop editingShop = null;
private string editingShopOldName = "";
public void ShowCreateShop()
{
this.Invoke(new Action(() =>
{
editingShop = new Shop();
creatingShop = true;
editingShop.Name = "My shop";
editingShop.Description = "My shop has lots of awesome items. You should buy from my shop.";
editingShop.Owner = SaveSystem.CurrentSave.Username;
editingShop.Items = new List<ShopItem>();
shop_editor.BringToFront();
PopulateShopEditor();
}));
}
public void PopulateShopEditor()
{
}
public void PopulateShopList(Shop[] shops)
{
shop_all.BringToFront();
flshoplist.Controls.Clear();
foreach (var shop in shops)
{
var bnr = new Panel();
bnr.Height = 100;
bnr.Tag = "keepbg";
bnr.Width = flshoplist.Width;
var lTitle = new Label();
lTitle.AutoSize = true;
lTitle.Tag = "keepbg header2";
lTitle.Text = shop.Name;
lTitle.Location = new Point(18, 17);
bnr.Controls.Add(lTitle);
lTitle.Show();
var desc = new Label();
desc.Left = lTitle.Left;
desc.Width = (bnr.Width - desc.Left - desc.Left);
desc.Top = lTitle.Top + lTitle.Height;
desc.Height = (bnr.Height - lTitle.Top);
desc.Text = shop.Description;
bnr.Controls.Add(desc);
desc.Show();
var flButtons = new FlowLayoutPanel();
flButtons.AutoSize = true;
flButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
flButtons.Tag = "keepbg";
flButtons.FlowDirection = FlowDirection.RightToLeft;
flButtons.Anchor = AnchorStyles.Top | AnchorStyles.Right;
flButtons.Top = 2;
flButtons.Left = bnr.Width - flButtons.Width - 2;
bnr.Controls.Add(flButtons);
flButtons.Show();
var btn = new Button();
btn.Text = "Browse";
btn.Click += (o, a) =>
{
ShowShop(shop);
};
flButtons.Controls.Add(btn);
btn.Show();
flshoplist.Controls.Add(bnr);
bnr.Show();
ControlManager.SetupControls(bnr);
}
}
public void ShowShop(Shop shop)
{
shop_view.BringToFront();
lbshopname.Text = shop.Name;
lbupgradetitle.Text = $"Welcome to {shop.Name}.";
lbupgradedesc.Text = shop.Description;
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)
{
lbupgrades.Items.Add(item.Name);
}
lbupgrades.SelectedIndexChanged += (o, a) =>
{
item = shopItems[lbupgrades.SelectedIndex];
lbupgradetitle.Text = item.Name;
lbupgradedesc.Text = item.Description;
lbprice.Text = $"Cost: {item.Cost} CP";
btnbuy.Show();
};
}
private ShopItem item = null;
private List<ShopItem> shopItems = null;
public void PopulateJoinLegion(List<Legion> legions)
{
lgn_join.BringToFront();
@ -452,5 +599,91 @@ Current legions: {legionname}";
{
this.job_current.BringToFront();
}
private void browseToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("shop_getallshops", "");
}
private void btnbuy_Click(object sender, EventArgs e)
{
if (SaveSystem.CurrentSave.Codepoints >= item.Cost)
{
//Send the Codepoints to the shop owner. If they're online, the MUD will tell them to update their Codepoints.
ServerManager.SendMessage("usr_givecp", JsonConvert.SerializeObject(new
{
username = this.CurrentShop.Owner,
amount = item.Cost
}));
string fileExt = FileSkimmerBackend.GetFileExtension((FileType)item.FileType);
FileSkimmerBackend.GetFile(new[] { fileExt }, FileOpenerStyle.Save, new Action<string>((dest) =>
{
var d = new Download
{
ShiftnetUrl = $"{CurrentShop.Name}: {item.Name}",
Destination = dest,
Bytes = item.MUDFile
};
DownloadManager.StartDownload(d);
}));
}
else
{
Infobox.Show("Not enough Codepoints", "You cannot afford this item. You need at least " + item.Cost.ToString() + ".");
}
}
private void openAShopToolStripMenuItem_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("user_shop_check", JsonConvert.SerializeObject(new
{
username = SaveSystem.CurrentSave.Username
}));
}
private void txtshopname_TextChanged(object sender, EventArgs e)
{
try
{
editingShop.Name = txtshopname.Text;
}
catch { }
}
private void txtshopdescription_TextChanged(object sender, EventArgs e)
{
try
{
editingShop.Description = txtshopdescription.Text;
}
catch { }
}
bool creatingShop = false;
private void btnsaveshop_Click(object sender, EventArgs e)
{
if(creatingShop == true)
{
ServerManager.SendMessage("create_shop", JsonConvert.SerializeObject(editingShop));
}
else
{
ServerManager.SendMessage("update_shop_by_user", JsonConvert.SerializeObject(new
{
username = editingShop.Owner,
shop = editingShop
}));
}
}
private void btnaddshopitem_Click(object sender, EventArgs e)
{
}
}
}

View file

@ -130,4 +130,7 @@ You can set up a banner color, short and long name, and a description on this sc
The description will be what explains your legion - what does it do? Why should the user join it? Stuff like that.</value>
</data>
<data name="label12.Text" xml:space="preserve">
<value>The multi-user domain has many unique shops selling many items such as applications, skins and other things. Just choose a shop, browse for an item you'd like, then pay Codepoints and the download will begin.</value>
</data>
</root>

View file

@ -104,6 +104,8 @@ namespace ShiftOS.WinForms
public class WinformsFSFrontend : IFileSkimmer
{
public void OpenDirectory(string path)
{
var fs = new Applications.FileSkimmer();
@ -185,5 +187,31 @@ namespace ShiftOS.WinForms
{
return Applications.FileSkimmer.GetImage(FileSkimmerBackend.GetFileType(path));
}
public string GetFileExtension(FileType fileType)
{
switch (fileType)
{
case FileType.Executable:
return ".saa";
case FileType.Filesystem:
return ".mfs";
case FileType.Image:
return ".pic";
case FileType.JSON:
return ".json";
case FileType.Lua:
return ".lua";
case FileType.Python:
return ".py";
case FileType.Skin:
return ".skn";
case FileType.TextFile:
return ".txt";
default:
return ".bin";
}
}
}
}

View file

@ -230,20 +230,31 @@ namespace ShiftOS.Engine
}
#if DEVEL
[Namespace("cheats", true)]
public static class CheatCommands
{
[Command("freecp", true)]
[CommandObsolete("{OBSOLETE_CHEATS_FREECP}", "dev.freecp", true)]
public static bool FreeCodepoints(Dictionary<string, object> args)
{
// never called
return true;
}
}
[Namespace("dev")]
public static class ShiftOSDevCommands
{
[Command("unbuy")]
[RequiresArgument("upgrade")]
public static bool UnbuyUpgrade(Dictionary<string, object> args)
{
try
{
SaveSystem.CurrentSave.Upgrades[args["upgrade"] as string] = false;
}
catch
{
Console.WriteLine("Upgrade not found.");
}
return true;
}
[Command("getallupgrades")]
public static bool GetAllUpgrades()
{
Console.WriteLine(JsonConvert.SerializeObject(SaveSystem.CurrentSave.Upgrades, Formatting.Indented));
return true;
}
[Command("multarg")]
[RequiresArgument("id")]
[RequiresArgument("name")]
@ -275,7 +286,7 @@ namespace ShiftOS.Engine
}
[Command("unlockeverything")]
public static bool GetAllUpgrades()
public static bool UnlockAllUpgrades()
{
foreach (var upg in Shiftorium.GetDefaults())
{

View file

@ -133,6 +133,11 @@ namespace ShiftOS.Engine
{
return _fs.GetImage(filepath);
}
public static string GetFileExtension(FileType fileType)
{
return _fs.GetFileExtension(fileType);
}
}
/// <summary>
@ -144,6 +149,7 @@ namespace ShiftOS.Engine
void GetPath(string[] filetypes, FileOpenerStyle style, Action<string> callback);
void OpenDirectory(string path);
Image GetImage(string path);
string GetFileExtension(FileType fileType);
}

View file

@ -318,4 +318,9 @@ namespace ShiftOS.Engine
}
public delegate void TextSentEventHandler(string text);
public class DeveloperAttribute : Attribute
{
}
}