Beispiel #1
0
        // Function from file: tgui.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string  action  = null;
            ByTable _params = null;


            if (this.user != Task13.User)
            {
                return(null);
            }
            action  = href_list["action"];
            _params = href_list;
            _params.Remove("action");

            switch ((string)(action))
            {
            case "tgui:initialize":
                Interface13.Output(this.user, String13.UrlEncode(this.get_json(this.initial_data), false), "" + this.window_id + ".browser:initialize");
                this.initialized = GlobalVars.TRUE;
                break;

            case "tgui:view":

                if (Lang13.Bool(_params["screen"]))
                {
                    this.src_object.ui_screen = _params["screen"];
                }
                GlobalVars.SStgui.update_uis(this.src_object);
                break;

            case "tgui:link":
                Interface13.Link(this.user, _params["url"]);
                break;

            case "tgui:fancy":
                this.user.client.prefs.tgui_fancy = GlobalVars.TRUE;
                break;

            case "tgui:nofrills":
                this.user.client.prefs.tgui_fancy = GlobalVars.FALSE;
                break;

            default:
                this.update_status(false);

                if (Lang13.Bool(this.src_object.ui_act(action, _params, this, this.state)))
                {
                    GlobalVars.SStgui.update_uis(this.src_object);
                }
                break;
            }
            return(null);
        }
Beispiel #2
0
        // Function from file: tgui.dm
        public void push_data(ByTable data = null, bool?force = null)
        {
            force = force ?? false;

            this.update_status(false);

            if (!Lang13.Bool(this.initialized))
            {
                return;
            }

            if (this.status <= 0 && !(force == true))
            {
                return;
            }
            Interface13.Output(this.user, String13.UrlEncode(this.get_json(data), false), "" + this.window_id + ".browser:update");
            return;
        }
Beispiel #3
0
        // Function from file: smartfridge.dm
        public override dynamic interact(dynamic user = null, bool?flag1 = null)
        {
            string      dat         = null;
            ByTable     listofitems = null;
            Ent_Dynamic O           = null;
            dynamic     O2          = null;
            int         N           = 0;
            string      itemName    = null;


            if (this.stat != 0)
            {
                return(0);
            }
            dat = "<TT><b>Select an item:</b><br>";

            if (this.contents.len == 0)
            {
                dat += "<font color = 'red'>No product loaded!</font>";
            }
            else
            {
                listofitems = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(this.contents, typeof(Ent_Dynamic)))
                {
                    O = _a;


                    if (Lang13.Bool(listofitems[O.name]))
                    {
                        listofitems[O.name]++;
                    }
                    else
                    {
                        listofitems[O.name] = 1;
                    }
                }
                GlobalFuncs.sortList(listofitems);

                foreach (dynamic _b in Lang13.Enumerate(listofitems))
                {
                    O2 = _b;


                    if (Convert.ToDouble(listofitems[O2]) <= 0)
                    {
                        continue;
                    }
                    N        = Convert.ToInt32(listofitems[O2]);
                    itemName = String13.UrlEncode(O2, false);
                    dat     += "<FONT color = 'blue'><B>" + GlobalFuncs.capitalize(O2) + "</B>:";
                    dat     += " " + N + " </font>";
                    dat     += new Txt("<a href='byond://?src=").Ref(this).str(";vend=").item(itemName).str(";amount=1'>Vend</A> ").ToString();

                    if (N > 5)
                    {
                        dat += new Txt("(<a href='byond://?src=").Ref(this).str(";vend=").item(itemName).str(";amount=5'>x5</A>)").ToString();

                        if (N > 10)
                        {
                            dat += new Txt("(<a href='byond://?src=").Ref(this).str(";vend=").item(itemName).str(";amount=10'>x10</A>)").ToString();

                            if (N > 25)
                            {
                                dat += new Txt("(<a href='byond://?src=").Ref(this).str(";vend=").item(itemName).str(";amount=25'>x25</A>)").ToString();
                            }
                        }
                    }

                    if (N > 1)
                    {
                        dat += new Txt("(<a href='?src=").Ref(this).str(";vend=").item(itemName).str(";amount=").item(N).str("'>All</A>)").ToString();
                    }
                    dat += "<br>";
                }
                dat += "</TT>";
            }
            Interface13.Browse(user, "<HEAD><TITLE>" + this + " supplies</TITLE></HEAD><TT>" + dat + "</TT>", "window=smartfridge");
            GlobalFuncs.onclose(user, "smartfridge");
            return(dat);
        }