예제 #1
0
        // Function from file: ticker.dm
        public void send_random_tip(  )
        {
            ByTable randomtips = null;

            randomtips = GlobalFuncs.file2list("config/tips.txt");

            if (randomtips.len != 0)
            {
                Game13.WriteMsg("<font color='purple'><b>Tip of the round: </b>" + String13.HtmlEncode(Rand13.PickFromTable(randomtips)) + "</font>");
            }
            return;
        }
예제 #2
0
        // Function from file: communications.dm
        public void sanitize_data(  )
        {
            dynamic d   = null;
            string  val = null;


            foreach (dynamic _a in Lang13.Enumerate(this.data))
            {
                d = _a;

                val = this.data[d];

                if (val is string)
                {
                    this.data[d] = String13.HtmlEncode(val);
                }
            }
            return;
        }
예제 #3
0
        // Function from file: shuttles.dm
        public void requestEvac(Mob user = null, dynamic call_reason = null)
        {
            dynamic signal_origin    = null;
            string  emergency_reason = null;


            if (!(this.emergency != null))
            {
                throw new Exception("requestEvac(): There is no emergency shuttle! The game will be unresolvable. This is likely due to a mapping error");
                return;
            }

            if (Game13.time - GlobalVars.round_start_time < (GlobalVars.config.shuttle_refuel_delay ?? 0))
            {
                user.WriteMsg("The emergency shuttle is refueling. Please wait another " + Math.Abs(Num13.Floor((Game13.time - GlobalVars.round_start_time - (GlobalVars.config.shuttle_refuel_delay ?? 0)) / 600)) + " minutes before trying again.");
                return;
            }

            switch ((int)(this.emergency.mode))
            {
            case 1:
                user.WriteMsg("The emergency shuttle may not be called while returning to Centcom.");
                return;

                break;

            case 2:
                user.WriteMsg("The emergency shuttle is already on its way.");
                return;

                break;

            case 3:
                user.WriteMsg("The emergency shuttle is already here.");
                return;

                break;

            case 5:
                user.WriteMsg("The emergency shuttle is moving away to a safe distance.");
                return;

                break;

            case 4:
                user.WriteMsg("The emergency shuttle has been disabled by Centcom.");
                return;

                break;
            }
            call_reason = GlobalFuncs.trim(String13.HtmlEncode(call_reason));

            if (Lang13.Length(call_reason) < GlobalVars.CALL_SHUTTLE_REASON_LENGTH)
            {
                user.WriteMsg("You must provide a reason.");
                return;
            }
            signal_origin    = GlobalFuncs.get_area(user);
            emergency_reason = "\nNature of emergency:\n\n" + call_reason;

            if (GlobalFuncs.seclevel2num(GlobalFuncs.get_security_level()) == 2)
            {
                this.emergency.request(null, 0.5, signal_origin, String13.HtmlDecode(emergency_reason), true);
            }
            else
            {
                this.emergency.request(null, 1, signal_origin, String13.HtmlDecode(emergency_reason), false);
            }
            GlobalFuncs.log_game("" + GlobalFuncs.key_name(user) + " has called the shuttle.");
            GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(user) + " has called the shuttle.");
            return;
        }
예제 #4
0
        // Function from file: blueprints.dm
        public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null)
        {
            dynamic _default = null;

            Ent_Static A     = null;
            Browser    popup = null;

            _default = base.attack_self((object)(user), (object)(flag), emp);
            A        = this.get_area();

            if (this.get_area_type() == (GlobalVars.AREA_STATION ?1:0))
            {
                _default += new Txt("<p>According to ").the(this).item().str(", you are now in <b>\"").item(String13.HtmlEncode(A.name)).str("\"</b>.</p>").ToString();
            }
            popup = new Browser(user, "blueprints", "" + this, 700, 500);
            popup.set_content(_default);
            popup.open();
            GlobalFuncs.onclose(Task13.User, "blueprints");
            return(_default);
        }
예제 #5
0
        // Function from file: robot.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic R       = null;
            dynamic choice  = null;
            dynamic R2      = null;
            dynamic choice2 = null;
            dynamic R3      = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (Lang13.Bool(href_list["temp"]))
            {
                this.temp = null;
            }
            else if (Lang13.Bool(href_list["killbot"]))
            {
                if (this.allowed(Task13.User))
                {
                    R = Lang13.FindObj(href_list["killbot"]);

                    if (this.can_control(Task13.User, R))
                    {
                        choice = Interface13.Input("Are you certain you wish to detonate " + R.name + "?", null, null, null, new ByTable(new object [] { "Confirm", "Abort" }), InputType.Any);

                        if (choice == "Confirm" && this.can_control(Task13.User, R) && !Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
                        {
                            if (Lang13.Bool(R.mind) && Lang13.Bool(R.mind.special_role) && Lang13.Bool(R.emagged))
                            {
                                R.WriteMsg("Extreme danger.  Termination codes detected.  Scrambling security codes and automatic AI unlink triggered.");
                                ((Mob_Living_Silicon_Robot)R).ResetSecurityCodes();
                            }
                            else
                            {
                                GlobalFuncs.message_admins(new Txt("<span class='notice'>").item(GlobalFuncs.key_name_admin(Task13.User)).str(" (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(Task13.User).str("'>FLW</A>) detonated ").item(GlobalFuncs.key_name(R, R.client)).str("(<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=").item(R.x).str(";Y=").item(R.y).str(";Z=").item(R.z).str("'>JMP</a>)!</span>").ToString());
                                GlobalFuncs.log_game("&lt;span class='notice'>" + GlobalFuncs.key_name(Task13.User) + " detonated " + GlobalFuncs.key_name(R) + "!</span>");

                                if (Lang13.Bool(R.connected_ai))
                                {
                                    R.connected_ai.WriteMsg("<br><br><span class='alert'>ALERT - Cyborg detonation detected: " + R.name + "</span><br>");
                                }
                                ((Mob_Living_Silicon_Robot)R).self_destruct();
                            }
                        }
                    }
                }
                else
                {
                    Task13.User.WriteMsg("<span class='danger'>Access Denied.</span>");
                }
            }
            else if (Lang13.Bool(href_list["stopbot"]))
            {
                if (this.allowed(Task13.User))
                {
                    R2 = Lang13.FindObj(href_list["stopbot"]);

                    if (this.can_control(Task13.User, R2))
                    {
                        choice2 = Interface13.Input("Are you certain you wish to " + (Lang13.Bool(R2.canmove) ? "lock down" : "release") + " " + R2.name + "?", null, null, null, new ByTable(new object [] { "Confirm", "Abort" }), InputType.Any);

                        if (choice2 == "Confirm" && this.can_control(Task13.User, R2) && !Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
                        {
                            GlobalFuncs.message_admins(new Txt("<span class='notice'>").item(GlobalFuncs.key_name_admin(Task13.User)).str(" (<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(Task13.User).str("'>FLW</A>) ").item((Lang13.Bool(R2.canmove) ? "locked down" : "released")).str(" ").item(GlobalFuncs.key_name(R2, R2.client)).str("(<A HREF='?_src_=holder;adminplayerobservefollow=").Ref(R2).str("'>FLW</A>)!</span>").ToString());
                            GlobalFuncs.log_game("" + GlobalFuncs.key_name(Task13.User) + " " + (Lang13.Bool(R2.canmove) ? "locked down" : "released") + " " + GlobalFuncs.key_name(R2) + "!");
                            ((Mob_Living_Silicon_Robot)R2).SetLockdown(!(R2.lockcharge == true));
                            R2.WriteMsg("" + (!(R2.lockcharge == true) ? "<span class='notice'>Your lockdown has been lifted!" : "<span class='alert'>You have been locked down!") + "</span>");

                            if (Lang13.Bool(R2.connected_ai))
                            {
                                R2.connected_ai.WriteMsg(new Txt().item((!(R2.lockcharge == true) ? "<span class='notice'>NOTICE - Cyborg lockdown lifted" : "<span class='alert'>ALERT - Cyborg lockdown detected")).str(": <a href='?src=").Ref(R2.connected_ai).str(";track=").item(String13.HtmlEncode(R2.name)).str("'>").item(R2.name).str("</a></span><br>").ToString());
                            }
                        }
                    }
                }
                else
                {
                    Task13.User.WriteMsg("<span class='danger'>Access Denied.</span>");
                }
            }
            else if (Lang13.Bool(href_list["magbot"]))
            {
                if (Task13.User is Mob_Living_Silicon && GlobalFuncs.is_special_character(Task13.User) != 0 || Lang13.Bool(GlobalFuncs.IsAdminGhost(Task13.User)))
                {
                    R3 = Lang13.FindObj(href_list["magbot"]);

                    if (R3 is Mob_Living_Silicon_Robot && !Lang13.Bool(R3.emagged) && (R3.connected_ai == Task13.User || Lang13.Bool(GlobalFuncs.IsAdminGhost(Task13.User))) && !R3.scrambledcodes && this.can_control(Task13.User, R3))
                    {
                        GlobalFuncs.log_game("" + GlobalFuncs.key_name(Task13.User) + " emagged " + R3.name + " using robotic console!");
                        ((Mob_Living_Silicon_Robot)R3).SetEmagged(true);

                        if (Lang13.Bool(R3.mind.special_role))
                        {
                            R3.verbs += typeof(Mob_Living_Silicon_Robot).GetMethod("ResetSecurityCodes");
                        }
                    }
                }
            }
            this.updateUsrDialog();
            return(null);
        }
예제 #6
0
        // Function from file: camera.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            string  msg      = null;
            string  msg2     = null;
            dynamic U        = null;
            dynamic X        = null;
            dynamic P        = null;
            string  itemname = null;
            dynamic info     = null;
            dynamic O        = null;
            dynamic AI       = null;
            dynamic L        = null;

            msg  = "<span class='notice'>You attach " + A + " into the assembly's inner circuits.</span>";
            msg2 = "<span class='notice'>" + this + " already has that upgrade!</span>";

            if (A is Obj_Item_Weapon_Screwdriver)
            {
                this.panel_open = !Lang13.Bool(this.panel_open) ?1:0;
                user.WriteMsg("<span class='notice'>You screw the camera's panel " + (Lang13.Bool(this.panel_open) ? "open" : "closed") + ".</span>");
                GlobalFuncs.playsound(this.loc, "sound/items/Screwdriver.ogg", 50, 1);
                return(null);
            }

            if (Lang13.Bool(this.panel_open))
            {
                if (A is Obj_Item_Weapon_Wirecutters)
                {
                    this.toggle_cam(user, true);
                    this.health = Lang13.Initial(this, "health");
                }
                else if (A is Obj_Item_Device_Multitool)
                {
                    this.setViewRange((this.view_range == Lang13.Initial(this, "view_range") ? ((dynamic)(this.short_range)) : Lang13.Initial(this, "view_range")));
                    user.WriteMsg("<span class='notice'>You " + (this.view_range == Lang13.Initial(this, "view_range") ? "restore" : "mess up") + " the camera's focus.</span>");
                }
                else if (A is Obj_Item_Weapon_Weldingtool)
                {
                    if (this.weld(A, user))
                    {
                        this.visible_message("<span class='warning'>" + user + " unwelds " + this + ", leaving it as just a frame screwed to the wall.</span>", "<span class='warning'>You unweld " + this + ", leaving it as just a frame screwed to the wall</span>");

                        if (!(this.assembly != null))
                        {
                            this.assembly = new Obj_Machinery_CameraAssembly();
                        }
                        this.assembly.loc   = this.loc;
                        this.assembly.state = 1;
                        this.assembly.dir   = this.dir;
                        this.assembly       = null;
                        GlobalFuncs.qdel(this);
                        return(null);
                    }
                }
                else if (A is Obj_Item_Device_Analyzer)
                {
                    if (!(this.isXRay() != 0))
                    {
                        this.upgradeXRay();
                        GlobalFuncs.qdel(A);
                        user.WriteMsg("" + msg);
                    }
                    else
                    {
                        user.WriteMsg("" + msg2);
                    }
                }
                else if (A is Obj_Item_Stack_Sheet_Mineral_Plasma)
                {
                    if (!(this.isEmpProof() != 0))
                    {
                        this.upgradeEmpProof();
                        user.WriteMsg("" + msg);
                        GlobalFuncs.qdel(A);
                    }
                    else
                    {
                        user.WriteMsg("" + msg2);
                    }
                }
                else if (A is Obj_Item_Device_Assembly_ProxSensor)
                {
                    if (!(this.isMotion() != 0))
                    {
                        this.upgradeMotion();
                        user.WriteMsg("" + msg);
                        GlobalFuncs.qdel(A);
                    }
                    else
                    {
                        user.WriteMsg("" + msg2);
                    }
                }
            }

            if ((A is Obj_Item_Weapon_Paper || A is Obj_Item_Device_Pda) && user is Mob_Living)
            {
                U        = user;
                X        = null;
                P        = null;
                itemname = "";
                info     = "";

                if (A is Obj_Item_Weapon_Paper)
                {
                    X        = A;
                    itemname = X.name;
                    info     = X.info;
                }
                else
                {
                    P        = A;
                    itemname = P.name;
                    info     = P.notehtml;
                }
                U.WriteMsg(new Txt("<span class='notice'>You hold ").the(itemname).item().str(" up to the camera...</span>").ToString());
                ((Mob)U).changeNext_move(8);

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list))
                {
                    O = _a;


                    if (O is Mob_Living_Silicon_Ai)
                    {
                        AI = O;

                        if (AI.control_disabled || Convert.ToInt32(AI.stat) == 2)
                        {
                            return(null);
                        }

                        if (U.name == "Unknown")
                        {
                            AI.WriteMsg(new Txt("<b>").item(U).str("</b> holds <a href='?_src_=usr;show_paper=1;'>").a(itemname).item().str("</a> up to one of your cameras ...").ToString());
                        }
                        else
                        {
                            AI.WriteMsg(new Txt("<b><a href='?src=").Ref(AI).str(";track=").item(String13.HtmlEncode(U.name)).str("'>").item(U).str("</a></b> holds <a href='?_src_=usr;show_paper=1;'>").a(itemname).item().str("</a> up to one of your cameras ...").ToString());
                        }
                        AI.last_paper_seen = "<HTML><HEAD><TITLE>" + itemname + "</TITLE></HEAD><BODY><TT>" + info + "</TT></BODY></HTML>";
                    }
                    else if (Lang13.Bool(O.client) && O.client.eye == this)
                    {
                        O.WriteMsg(new Txt().item(U).str(" holds ").a(itemname).item().str(" up to one of the cameras ...").ToString());
                        Interface13.Browse(O, "<HTML><HEAD><TITLE>" + itemname + "</TITLE></HEAD><BODY><TT>" + info + "</TT></BODY></HTML>", "window=" + itemname);
                    }
                }
            }
            else if (A is Obj_Item_Device_CameraBug)
            {
                if (!this.can_use())
                {
                    user.WriteMsg("<span class='notice'>Camera non-functional.</span>");
                    return(null);
                }

                if (this.bug is Obj_Item_Device_CameraBug)
                {
                    user.WriteMsg("<span class='notice'>Camera bug removed.</span>");
                    this.bug.bugged_cameras.Remove(this.c_tag);
                    this.bug = null;
                }
                else
                {
                    user.WriteMsg("<span class='notice'>Camera bugged.</span>");
                    this.bug = A;
                    this.bug.bugged_cameras[this.c_tag] = this;
                }
            }
            else if (A is Obj_Item_Device_LaserPointer)
            {
                L = A;
                ((Obj_Item_Device_LaserPointer)L).laser_act(this, user);
            }
            else if (Convert.ToDouble(A.force) >= 10)
            {
                ((Mob)user).changeNext_move(8);
                this.visible_message("<span class='warning'>" + user + " hits " + this + " with " + A + "!</span>", "<span class='warning'>You hit " + this + " with " + A + "!</span>");
                this.health = Num13.MaxInt(0, Convert.ToInt32(this.health - A.force));
                ((Ent_Dynamic)user).do_attack_animation(this);

                if (!Lang13.Bool(this.health) && this.status)
                {
                    this.triggerCameraAlarm();
                    this.toggle_cam(user, true);
                }
            }
            return(null);
        }
예제 #7
0
        // Function from file: card.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string      dat           = null;
            string      crew          = null;
            Data_Record t             = null;
            string      S             = null;
            bool?       ID            = null;
            Job         job           = null;
            double      time_to_wait  = 0;
            int         mins          = 0;
            double      seconds       = 0;
            double      time_to_wait2 = 0;
            int         mins2         = 0;
            double      seconds2      = 0;
            string      header        = null;
            string      target_name   = null;
            string      target_owner  = null;
            string      target_rank   = null;
            string      scan_name     = null;
            string      jobs_all      = null;
            ByTable     alljobs       = null;
            dynamic     job2          = null;
            string      body          = null;
            string      carddesc      = null;
            string      jobs          = null;
            string      accesses      = null;
            dynamic     A             = null;
            double?     i             = null;
            double?     i2            = null;
            dynamic     A2            = null;
            Browser     popup         = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            ((Mob)a).set_machine(this);

            if (!(GlobalVars.ticker != null))
            {
                return(null);
            }

            if (this.mode == 1)
            {
                crew = "";

                foreach (dynamic _a in Lang13.Enumerate(GlobalFuncs.sortRecord(GlobalVars.data_core.general), typeof(Data_Record)))
                {
                    t = _a;

                    crew += t.fields["name"] + " - " + t.fields["rank"] + "<br>";
                }
                dat = new Txt("<tt><b>Crew Manifest:</b><br>Please use security record computer to modify entries.<br><br>").item(crew).str("<a href='?src=").Ref(this).str(";choice=print'>Print</a><br><br><a href='?src=").Ref(this).str(";choice=mode;mode_target=0'>Access ID modification console.</a><br></tt>").ToString();
            }
            else if (this.mode == 2)
            {
                dat  = new Txt("<a href='?src=").Ref(this).str(";choice=return'>Return</a>").ToString();
                dat += " || Confirm Identity: ";
                S    = null;

                if (Lang13.Bool(this.scan))
                {
                    S = String13.HtmlEncode(this.scan.name);
                }
                else
                {
                    S = "--------";
                }
                dat += new Txt("<a href='?src=").Ref(this).str(";choice=scan'>").item(S).str("</a>").ToString();
                dat += "<table>";
                dat += "<tr><td style='width:25%'><b>Job</b></td><td style='width:25%'><b>Slots</b></td><td style='width:25%'><b>Open job</b></td><td style='width:25%'><b>Close job</b></td></tr>";
                ID   = null;

                if (Lang13.Bool(this.scan) && Lang13.Bool(this.scan.access.Contains(GlobalVars.access_change_ids)) && !(this.target_dept != 0))
                {
                    ID = true;
                }
                else
                {
                    ID = false;
                }

                foreach (dynamic _d in Lang13.Enumerate(GlobalVars.SSjob.occupations, typeof(Job)))
                {
                    job = _d;

                    dat += "<tr>";

                    if (this.blacklisted.Contains(job.title))
                    {
                        continue;
                    }
                    dat += "<td>" + job.title + "</td>";
                    dat += "<td>" + job.current_positions + "/" + job.total_positions + "</td>";
                    dat += "<td>";

                    switch ((int)(this.can_open_job(job)))
                    {
                    case 1:

                        if (ID == true)
                        {
                            dat += new Txt("<a href='?src=").Ref(this).str(";choice=make_job_available;job=").item(job.title).str("'>Open Position</a><br>").ToString();
                        }
                        else
                        {
                            dat += "Open Position";
                        }
                        break;

                    case -1:
                        dat += "Denied";
                        break;

                    case -2:
                        time_to_wait = Num13.Round(this.change_position_cooldown - (Game13.time / 10 - GlobalVars.time_last_changed_position), 1);
                        mins         = Num13.Floor(time_to_wait / 60);
                        seconds      = time_to_wait - mins * 60;
                        dat         += "Cooldown ongoing: " + mins + ":" + (seconds < 10 ? "0" + seconds : "" + seconds);
                        break;

                    case 0:
                        dat += "Denied";
                        break;
                    }
                    dat += "</td><td>";

                    switch ((int)(this.can_close_job(job)))
                    {
                    case 1:

                        if (ID == true)
                        {
                            dat += new Txt("<a href='?src=").Ref(this).str(";choice=make_job_unavailable;job=").item(job.title).str("'>Close Position</a>").ToString();
                        }
                        else
                        {
                            dat += "Close Position";
                        }
                        break;

                    case -1:
                        dat += "Denied";
                        break;

                    case -2:
                        time_to_wait2 = Num13.Round(this.change_position_cooldown - (Game13.time / 10 - GlobalVars.time_last_changed_position), 1);
                        mins2         = Num13.Floor(time_to_wait2 / 60);
                        seconds2      = time_to_wait2 - mins2 * 60;
                        dat          += "Cooldown ongoing: " + mins2 + ":" + (seconds2 < 10 ? "0" + seconds2 : "" + seconds2);
                        break;

                    case 0:
                        dat += "Denied";
                        break;
                    }
                    dat += "</td></tr>";
                }
                dat += "</table>";
            }
            else
            {
                header       = "";
                target_name  = null;
                target_owner = null;
                target_rank  = null;

                if (Lang13.Bool(this.modify))
                {
                    target_name = String13.HtmlEncode(this.modify.name);
                }
                else
                {
                    target_name = "--------";
                }

                if (Lang13.Bool(this.modify) && Lang13.Bool(this.modify.registered_name))
                {
                    target_owner = String13.HtmlEncode(this.modify.registered_name);
                }
                else
                {
                    target_owner = "--------";
                }

                if (Lang13.Bool(this.modify) && Lang13.Bool(this.modify.assignment))
                {
                    target_rank = String13.HtmlEncode(this.modify.assignment);
                }
                else
                {
                    target_rank = "Unassigned";
                }
                scan_name = null;

                if (Lang13.Bool(this.scan))
                {
                    scan_name = String13.HtmlEncode(this.scan.name);
                }
                else
                {
                    scan_name = "--------";
                }

                if (!(this.authenticated != 0))
                {
                    header += "<br><i>Please insert the cards into the slots</i><br>";
                    header += new Txt("Target: <a href='?src=").Ref(this).str(";choice=modify'>").item(target_name).str("</a><br>").ToString();
                    header += new Txt("Confirm Identity: <a href='?src=").Ref(this).str(";choice=scan'>").item(scan_name).str("</a><br>").ToString();
                }
                else
                {
                    header += "<div align='center'><br>";
                    header += new Txt("<a href='?src=").Ref(this).str(";choice=modify'>Remove ").item(target_name).str("</a> || ").ToString();
                    header += new Txt("<a href='?src=").Ref(this).str(";choice=scan'>Remove ").item(scan_name).str("</a> <br> ").ToString();
                    header += new Txt("<a href='?src=").Ref(this).str(";choice=mode;mode_target=1'>Access Crew Manifest</a> || ").ToString();
                    header += new Txt("<a href='?src=").Ref(this).str(";choice=logout'>Log Out</a></div>").ToString();
                }
                header  += "<hr>";
                jobs_all = "";
                alljobs  = new ByTable(new object [] { "Unassigned" });
                alljobs.Add((this is Obj_Machinery_Computer_Card_Centcom ? GlobalFuncs.get_all_centcom_jobs() : GlobalFuncs.get_all_jobs()) + "Custom");

                foreach (dynamic _e in Lang13.Enumerate(alljobs))
                {
                    job2 = _e;

                    jobs_all += new Txt("<a href='?src=").Ref(this).str(";choice=assign;assign_target=").item(job2).str("'>").item(GlobalFuncs.replacetext(job2, " ", "&nbsp")).str("</a> ").ToString();
                }
                body = null;

                if (this.authenticated != 0 && Lang13.Bool(this.modify))
                {
                    carddesc = "";
                    jobs     = "";

                    if (this.authenticated == 2)
                    {
                        carddesc += @"<script type=""text/javascript"">
									function markRed(){
										var nameField = document.getElementById('namefield');
										nameField.style.backgroundColor = ""#FFDDDD"";
									}
									function markGreen(){
										var nameField = document.getElementById('namefield');
										nameField.style.backgroundColor = ""#DDFFDD"";
									}
									function showAll(){
										var allJobsSlot = document.getElementById('alljobsslot');
										allJobsSlot.innerHTML = ""<a href='#' onclick='hideAll()'>hide</a><br>""+ """                                         + jobs_all + @""";
									}
									function hideAll(){
										var allJobsSlot = document.getElementById('alljobsslot');
										allJobsSlot.innerHTML = ""<a href='#' onclick='showAll()'>show</a>"";
									}
								</script>"                                ;
                        carddesc += new Txt("<form name='cardcomp' action='?src=").Ref(this).str("' method='get'>").ToString();
                        carddesc += new Txt("<input type='hidden' name='src' value='").Ref(this).str("'>").ToString();
                        carddesc += "<input type='hidden' name='choice' value='reg'>";
                        carddesc += "<b>registered name:</b> <input type='text' id='namefield' name='reg' value='" + target_owner + "' style='width:250px; background-color:white;' onchange='markRed()'>";
                        carddesc += "<input type='submit' value='Rename' onclick='markGreen()'>";
                        carddesc += "</form>";
                        carddesc += "<b>Assignment:</b> ";
                        jobs     += "<span id='alljobsslot'><a href='#' onclick='showAll()'>" + target_rank + "</a></span>";
                    }
                    else
                    {
                        carddesc += "<b>registered_name:</b> " + target_owner + "</span>";
                        jobs     += new Txt("<b>Assignment:</b> ").item(target_rank).str(" (<a href='?src=").Ref(this).str(";choice=demote'>Demote</a>)</span>").ToString();
                    }
                    accesses = "";

                    if (this is Obj_Machinery_Computer_Card_Centcom)
                    {
                        accesses += "<h5>Central Command:</h5>";

                        foreach (dynamic _f in Lang13.Enumerate(GlobalFuncs.get_all_centcom_access()))
                        {
                            A = _f;


                            if (Lang13.Bool(this.modify.access.Contains(A)))
                            {
                                accesses += new Txt("<a href='?src=").Ref(this).str(";choice=access;access_target=").item(A).str(";allowed=0'><font color=\"red\">").item(GlobalFuncs.replacetext(GlobalFuncs.get_centcom_access_desc(A), " ", "&nbsp")).str("</font></a> ").ToString();
                            }
                            else
                            {
                                accesses += new Txt("<a href='?src=").Ref(this).str(";choice=access;access_target=").item(A).str(";allowed=1'>").item(GlobalFuncs.replacetext(GlobalFuncs.get_centcom_access_desc(A), " ", "&nbsp")).str("</a> ").ToString();
                            }
                        }
                    }
                    else
                    {
                        accesses += "<div align='center'><b>Access</b></div>";
                        accesses += "<table style='width:100%'>";
                        accesses += "<tr>";
                        i         = null;
                        i         = 1;

                        while ((i ?? 0) <= 7)
                        {
                            if (this.authenticated == 1 && !this.region_access.Contains(i))
                            {
                            }
                            else
                            {
                                accesses += "<td style='width:14%'><b>" + GlobalFuncs.get_region_accesses_name(i) + ":</b></td>";
                            }
                            i++;
                        }
                        accesses += "</tr><tr>";
                        i2        = null;
                        i2        = 1;

                        while ((i2 ?? 0) <= 7)
                        {
                            if (this.authenticated == 1 && !this.region_access.Contains(i2))
                            {
                            }
                            else
                            {
                                accesses += "<td style='width:14%' valign='top'>";

                                foreach (dynamic _g in Lang13.Enumerate(GlobalFuncs.get_region_accesses(i2)))
                                {
                                    A2 = _g;


                                    if (Lang13.Bool(this.modify.access.Contains(A2)))
                                    {
                                        accesses += new Txt("<a href='?src=").Ref(this).str(";choice=access;access_target=").item(A2).str(";allowed=0'><font color=\"red\">").item(GlobalFuncs.replacetext(GlobalFuncs.get_access_desc(A2), " ", "&nbsp")).str("</font></a> ").ToString();
                                    }
                                    else
                                    {
                                        accesses += new Txt("<a href='?src=").Ref(this).str(";choice=access;access_target=").item(A2).str(";allowed=1'>").item(GlobalFuncs.replacetext(GlobalFuncs.get_access_desc(A2), " ", "&nbsp")).str("</a> ").ToString();
                                    }
                                    accesses += "<br>";
                                }
                                accesses += "</td>";
                            }
                            i2++;
                        }
                        accesses += "</tr></table>";
                    }
                    body = "" + carddesc + "<br>" + jobs + "<br><br>" + accesses;
                }
                else
                {
                    body  = new Txt("<a href='?src=").Ref(this).str(";choice=auth'>{Log in}</a> <br><hr>").ToString();
                    body += new Txt("<a href='?src=").Ref(this).str(";choice=mode;mode_target=1'>Access Crew Manifest</a>").ToString();

                    if (!(this.target_dept != 0))
                    {
                        body += new Txt("<br><hr><a href = '?src=").Ref(this).str(";choice=mode;mode_target=2'>Job Management</a>").ToString();
                    }
                }
                dat = "<tt>" + header + body + "<hr><br></tt>";
            }
            popup = new Browser(a, "id_com", this.name, 900, 620);
            popup.set_content(dat);
            popup.set_title_image(((Mob)a).browse_rsc_icon(this.icon, this.icon_state));
            popup.open();
            return(null);
        }
예제 #8
0
파일: Song.cs 프로젝트: Somnium13/SS13
		// Function from file: musician.dm
		public override dynamic Topic( string href = null, ByTable href_list = null, dynamic hsrc = null ) {
			string t = null;
			dynamic cont = null;
			int linenum = 0;
			dynamic l = null;
			string newline = null;
			int? num = null;
			double num2 = 0;
			string content = null;

			
			if ( !Task13.User.canUseTopic( this.instrumentObj ) ) {
				Interface13.Browse( Task13.User, null, "window=instrument" );
				Task13.User.unset_machine();
				return null;
			}
			this.instrumentObj.add_fingerprint( Task13.User );

			if ( Lang13.Bool( href_list["newsong"] ) ) {
				this.lines = new ByTable();
				this.tempo = this.sanitize_tempo( 5 );
				this.name = "";
			} else if ( Lang13.Bool( href_list["import"] ) ) {
				t = "";

				do {
					t = String13.HtmlEncode( Interface13.Input( Task13.User, "Please paste the entire song, formatted:", "" + this.name, t, null, InputType.StrMultiline ) );

					if ( !( Map13.GetDistance( this.instrumentObj, Task13.User ) <= 1 ) ) {
						return null;
					}

					if ( Lang13.Length( t ) >= 3072 ) {
						cont = Interface13.Input( Task13.User, "Your message is too long! Would you like to continue editing it?", "", "yes", new ByTable(new object [] { "yes", "no" }), InputType.Any );

						if ( cont == "no" ) {
							break;
						}
					}
				} while ( Lang13.Length( t ) > 3072 );
				Task13.Schedule( 0, (Task13.Closure)(() => {
					this.lines = GlobalFuncs.splittext( t, "\n" );

					if ( String13.SubStr( this.lines[1], 1, 6 ) == "BPM: " ) {
						this.tempo = this.sanitize_tempo( 600 / ( String13.ParseNumber( String13.SubStr( this.lines[1], 6, 0 ) ) ??0) );
						this.lines.Cut( 1, 2 );
					} else {
						this.tempo = this.sanitize_tempo( 5 );
					}

					if ( this.lines.len > 50 ) {
						Task13.User.WriteMsg( "Too many lines!" );
						this.lines.Cut( 51 );
					}
					linenum = 1;

					foreach (dynamic _a in Lang13.Enumerate( this.lines )) {
						l = _a;
						

						if ( Lang13.Length( l ) > 50 ) {
							Task13.User.WriteMsg( "Line " + linenum + " too long!" );
							this.lines.Remove( l );
						} else {
							linenum++;
						}
					}
					this.updateDialog( Task13.User );
					return;
				}));
			} else if ( Lang13.Bool( href_list["help"] ) ) {
				this.help = ( String13.ParseNumber( href_list["help"] ) ??0) - 1;
			} else if ( Lang13.Bool( href_list["edit"] ) ) {
				this.edit = ( String13.ParseNumber( href_list["edit"] ) ??0) - 1;
			}

			if ( Lang13.Bool( href_list["repeat"] ) ) {
				
				if ( this.playing ) {
					return null;
				}
				this.repeat += Num13.Floor( String13.ParseNumber( href_list["repeat"] ) ??0 );

				if ( this.repeat < 0 ) {
					this.repeat = 0;
				}

				if ( this.repeat > this.max_repeats ) {
					this.repeat = this.max_repeats;
				}
			} else if ( Lang13.Bool( href_list["tempo"] ) ) {
				this.tempo = this.sanitize_tempo( this.tempo + ( String13.ParseNumber( href_list["tempo"] ) ??0) );
			} else if ( Lang13.Bool( href_list["play"] ) ) {
				this.playing = true;
				Task13.Schedule( 0, (Task13.Closure)(() => {
					this.playsong( Task13.User );
					return;
				}));
			} else if ( Lang13.Bool( href_list["newline"] ) ) {
				newline = String13.HtmlEncode( Interface13.Input( "Enter your line: ", this.instrumentObj.name, null, null, null, InputType.Str | InputType.Null ) );

				if ( !Lang13.Bool( newline ) || !( Map13.GetDistance( this.instrumentObj, Task13.User ) <= 1 ) ) {
					return null;
				}

				if ( this.lines.len > 50 ) {
					return null;
				}

				if ( Lang13.Length( newline ) > 50 ) {
					newline = String13.SubStr( newline, 1, 50 );
				}
				this.lines.Add( newline );
			} else if ( Lang13.Bool( href_list["deleteline"] ) ) {
				num = Num13.Floor( String13.ParseNumber( href_list["deleteline"] ) ??0 );

				if ( ( num ??0) > this.lines.len || ( num ??0) < 1 ) {
					return null;
				}
				this.lines.Cut( num, ( num ??0) + 1 );
			} else if ( Lang13.Bool( href_list["modifyline"] ) ) {
				num2 = Num13.Round( String13.ParseNumber( href_list["modifyline"] ) ??0, 1 );
				content = String13.HtmlEncode( Interface13.Input( "Enter your line: ", this.instrumentObj.name, this.lines[num2], null, null, InputType.Str | InputType.Null ) );

				if ( !Lang13.Bool( content ) || !( Map13.GetDistance( this.instrumentObj, Task13.User ) <= 1 ) ) {
					return null;
				}

				if ( Lang13.Length( content ) > 50 ) {
					content = String13.SubStr( content, 1, 50 );
				}

				if ( num2 > this.lines.len || num2 < 1 ) {
					return null;
				}
				this.lines[num2] = content;
			} else if ( Lang13.Bool( href_list["stop"] ) ) {
				this.playing = false;
			}
			this.updateDialog( Task13.User );
			return null;
		}