Exemple #1
0
        // Function from file: blob.dm
        public void burst_blob(Mind blob = null, bool?warned = null)
        {
            warned = warned ?? false;

            Client  blob_client       = null;
            dynamic location          = null;
            dynamic C                 = null;
            Obj_Effect_Blob_Core core = null;

            blob_client = null;
            location    = null;

            if (blob.current is Mob_Living_Carbon)
            {
                C = blob.current;

                if (Lang13.Bool(GlobalVars.directory[String13.CKey(blob.key)]))
                {
                    blob_client = GlobalVars.directory[String13.CKey(blob.key)];
                    location    = GlobalFuncs.get_turf(C);

                    if (Lang13.Bool(location.z) != true || location is Tile_Space)
                    {
                        if (!(warned == true))
                        {
                            C.WriteMsg("<span class='userdanger'>You feel ready to burst, but this isn't an appropriate place!  You must return to the station!</span>");
                            GlobalFuncs.message_admins("" + GlobalFuncs.key_name(C) + " was in space when the blobs burst, and will die if he doesn't return to the station.");
                            Task13.Schedule(300, (Task13.Closure)(() => {
                                this.burst_blob(blob, true);
                                return;
                            }));
                        }
                        else
                        {
                            this.burst++;
                            GlobalFuncs.log_admin("" + GlobalFuncs.key_name(C) + " was in space when attempting to burst as a blob.");
                            GlobalFuncs.message_admins("" + GlobalFuncs.key_name(C) + " was in space when attempting to burst as a blob.");
                            ((Mob)C).gib();
                            this.make_blobs(1);
                            this.check_finished();
                        }
                    }
                    else if (blob_client != null && Lang13.Bool(location))
                    {
                        this.burst++;
                        ((Mob)C).gib();
                        core = new Obj_Effect_Blob_Core(location, 200, blob_client, this.blob_point_rate);

                        if (core.overmind != null && core.overmind.mind != null)
                        {
                            core.overmind.mind.name = blob.name;
                            this.infected_crew.Remove(blob);
                            this.infected_crew.Add(core.overmind.mind);
                            core.overmind.mind.special_role = "Blob Overmind";
                        }
                    }
                }
            }
            return;
        }
Exemple #2
0
        // Function from file: browser.dm
        public string get_header(  )
        {
            dynamic key              = null;
            string  filename         = null;
            string  title_attributes = null;


            foreach (dynamic _a in Lang13.Enumerate(this.stylesheets))
            {
                key = _a;

                filename = "" + String13.CKey(key) + ".css";
                Interface13.CacheBrowseResource(this.user, this.stylesheets[key], filename);
                this.head_content += "<link rel='stylesheet' type='text/css' href='" + filename + "'>";
            }

            foreach (dynamic _b in Lang13.Enumerate(this.scripts))
            {
                key = _b;

                filename = "" + String13.CKey(key) + ".js";
                Interface13.CacheBrowseResource(this.user, this.scripts[key], filename);
                this.head_content += "<script type='text/javascript' src='" + filename + "'></script>";
            }
            title_attributes = "class='uiTitle'";

            if (Lang13.Bool(this.title_image))
            {
                title_attributes = "class='uiTitle icon' style='background-image: url(" + this.title_image + ");'";
            }
            return(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"" ""http://www.w3.org/TR/html4/loose.dtd"">
<html>
	<meta http-equiv=""Content-Type"" content=""text/html; charset=ISO-8859-1"">
	<meta http-equiv=""X-UA-Compatible"" content=""IE=edge"">
	<head>
		"         + this.head_content + @"
	</head>
	<body scroll=auto>
		<div class='uiWrapper'>
			"             + (Lang13.Bool(this.title) ? "<div class='uiTitleWrapper'><div " + title_attributes + "><tt>" + this.title + "</tt></div></div>" : "") + "\n			<div class='uiContent'>\n	");
        }
        // Function from file: hydroponics.dm
        public override ByTable harvest(Mob user = null)
        {
            user = user ?? Task13.User;

            Ent_Static parent              = null;
            bool       make_podman         = false;
            dynamic    ckey_holder         = null;
            dynamic    M                   = null;
            dynamic    O                   = null;
            dynamic    M2                  = null;
            dynamic    O2                  = null;
            Mob_Living_Carbon_Human podman = null;
            int?seed_count                 = null;
            int?i = null;
            Obj_Item_Seeds_Replicapod harvestseeds = null;

            parent      = this.loc;
            make_podman = false;
            ckey_holder = null;

            if (Lang13.Bool(GlobalVars.config.revival_pod_plants))
            {
                if (Lang13.Bool(this.ckey))
                {
                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list))
                    {
                        M = _a;


                        if (M is Mob_Dead_Observer)
                        {
                            O = M;

                            if (O.ckey == this.ckey && O.can_reenter_corpse == true)
                            {
                                make_podman = true;
                                break;
                            }
                        }
                        else if (M.ckey == this.ckey && Convert.ToInt32(M.stat) == 2 && !Lang13.Bool(M.suiciding))
                        {
                            make_podman = true;
                            break;
                        }
                    }
                }
                else
                {
                    foreach (dynamic _b in Lang13.Enumerate(GlobalVars.player_list))
                    {
                        M2 = _b;


                        if (this.mind != null && Lang13.Bool(M2.mind) && String13.CKey(M2.mind.key) == String13.CKey(this.mind.key) && Lang13.Bool(M2.ckey) && Lang13.Bool(M2.client) && Convert.ToInt32(M2.stat) == 2 && !Lang13.Bool(M2.suiciding))
                        {
                            if (M2 is Mob_Dead_Observer)
                            {
                                O2 = M2;

                                if (!(O2.can_reenter_corpse == true))
                                {
                                    break;
                                }
                            }
                            make_podman = true;
                            ckey_holder = M2.ckey;
                            break;
                        }
                    }
                }
            }

            if (make_podman)
            {
                podman = new Mob_Living_Carbon_Human(parent.loc);

                if (Lang13.Bool(this.realName))
                {
                    podman.real_name = this.realName;
                }
                else
                {
                    podman.real_name = "Pod Person " + Rand13.Int(0, 999);
                }
                this.mind.transfer_to(podman);

                if (Lang13.Bool(this.ckey))
                {
                    podman.ckey = this.ckey;
                }
                else
                {
                    podman.ckey = ckey_holder;
                }
                podman.gender   = this.blood_gender;
                podman.faction |= this.factions;

                if (!Lang13.Bool(this.features["mcolor"]))
                {
                    this.features["mcolor"] = "#59CE00";
                }
                podman.hardset_dna(null, null, podman.real_name, this.blood_type, typeof(Species_Pod), this.features);
                podman.set_cloned_appearance();
            }
            else
            {
                seed_count = 1;

                if (Rand13.PercentChance(((int)(this.getYield() * 20))))
                {
                    seed_count++;
                }
                i = null;
                i = 0;

                while ((i ?? 0) < (seed_count ?? 0))
                {
                    harvestseeds            = new Obj_Item_Seeds_Replicapod(user.loc);
                    harvestseeds.lifespan   = this.lifespan;
                    harvestseeds.endurance  = this.endurance;
                    harvestseeds.maturation = this.maturation;
                    harvestseeds.production = this.production;
                    harvestseeds.yield      = this.yield;
                    harvestseeds.potency    = this.potency;
                    i++;
                }
            }
            ((dynamic)parent).update_tray();
            return(null);
        }
Exemple #4
0
        // Function from file: cloning.dm
        public bool growclone(string ckey = null, string clonename = null, dynamic ui = null, dynamic se = null, dynamic mindref = null, Type mrace = null, ByTable features = null, dynamic factions = null)
        {
            dynamic clonemind = null;
            dynamic M         = null;
            dynamic G         = null;
            dynamic H         = null;
            dynamic A         = null;
            dynamic M2        = null;


            if (Lang13.Bool(this.panel_open))
            {
                return(false);
            }

            if (this.mess || this.attempting)
            {
                return(false);
            }
            clonemind = Lang13.FindObj(mindref);

            if (!(clonemind is Mind))
            {
                return(false);
            }

            if (Lang13.Bool(clonemind.current) && Convert.ToInt32(clonemind.current.stat) != 2)
            {
                return(false);
            }

            if (Lang13.Bool(clonemind.active))
            {
                if (String13.CKey(clonemind.key) != ckey)
                {
                    return(false);
                }
            }
            else
            {
                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list))
                {
                    M = _a;


                    if (M.ckey == ckey)
                    {
                        if (M is Mob_Dead_Observer)
                        {
                            G = M;

                            if (G.can_reenter_corpse == true)
                            {
                                break;
                            }
                        }
                        return(false);
                    }
                }
            }
            this.attempting = true;
            this.locked     = true;
            this.eject_wait = true;
            Task13.Schedule(30, (Task13.Closure)(() => {
                this.eject_wait = false;
                return;
            }));
            H = new Mob_Living_Carbon_Human(this);

            if (this.efficiency > 2)
            {
                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.bad_se_blocks))
                {
                    A = _b;

                    GlobalFuncs.setblock(H.dna.struc_enzymes, A, GlobalFuncs.construct_block(0, 2));
                }
            }

            if (this.efficiency > 5 && Rand13.PercentChance(20))
            {
                GlobalFuncs.randmutg(H);
            }

            if (this.efficiency < 3 && Rand13.PercentChance(50))
            {
                M2 = GlobalFuncs.randmutb(H);

                if (M2 is Mob)
                {
                    H = M2;
                }
            }
            H.silent      = 20;
            this.occupant = H;

            if (!Lang13.Bool(clonename))
            {
                clonename = "clone (" + Rand13.Int(0, 999) + ")";
            }
            H.real_name     = clonename;
            this.icon_state = "pod_1";
            ((Mob_Living)H).adjustCloneLoss(190);
            ((Mob_Living)H).adjustBrainLoss(190);
            ((Mob)H).Paralyse(4);
            ((Mind)clonemind).transfer_to(H);
            H.ckey = ckey;
            H.WriteMsg("<span class='notice'><b>Consciousness slowly creeps over you as your body regenerates.</b><br><i>So this is what cloning feels like?</i></span>");
            ((Mob_Living_Carbon_Human)H).hardset_dna(ui, se, H.real_name, null, mrace, features);

            if (Lang13.Bool(H))
            {
                H.faction |= factions;
                ((Mob_Living_Carbon_Human)H).set_cloned_appearance();
                H.suiciding = 0;
            }
            this.attempting = false;
            return(true);
        }
Exemple #5
0
        // Function from file: requests_console.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string  dat  = null;
            dynamic dpt  = null;
            dynamic dpt2 = null;
            dynamic dpt3 = null;
            Obj_Machinery_RequestsConsole Console = null;
            string  messageComposite = null;
            dynamic msg   = null;
            Browser popup = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            dat = "";

            if (!this.open)
            {
                switch ((int)(this.screen))
                {
                case 1:
                    dat += "Which department do you need assistance from?<BR><BR>";
                    dat += "<table width='100%'>";

                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.req_console_assistance))
                    {
                        dpt = _a;


                        if (dpt != this.department)
                        {
                            dat += "<tr>";
                            dat += "<td width='55%'>" + dpt + "</td>";
                            dat += new Txt("<td width='45%'><A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt)).str("'>Normal</A> <A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt)).str(";priority=2'>High</A>").ToString();

                            if (this.hackState)
                            {
                                dat += new Txt("<A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt)).str(";priority=3'>EXTREME</A>").ToString();
                            }
                            dat += "</td>";
                            dat += "</tr>";
                        }
                    }
                    dat += "</table>";
                    dat += new Txt("<BR><A href='?src=").Ref(this).str(";setScreen=0'><< Back</A><BR>").ToString();
                    break;

                case 2:
                    dat += "Which department do you need supplies from?<BR><BR>";
                    dat += "<table width='100%'>";

                    foreach (dynamic _b in Lang13.Enumerate(GlobalVars.req_console_supplies))
                    {
                        dpt2 = _b;


                        if (dpt2 != this.department)
                        {
                            dat += "<tr>";
                            dat += "<td width='55%'>" + dpt2 + "</td>";
                            dat += new Txt("<td width='45%'><A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt2)).str("'>Normal</A> <A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt2)).str(";priority=2'>High</A>").ToString();

                            if (this.hackState)
                            {
                                dat += new Txt("<A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt2)).str(";priority=3'>EXTREME</A>").ToString();
                            }
                            dat += "</td>";
                            dat += "</tr>";
                        }
                    }
                    dat += "</table>";
                    dat += new Txt("<BR><A href='?src=").Ref(this).str(";setScreen=0'><< Back</A><BR>").ToString();
                    break;

                case 3:
                    dat += "Which department would you like to send information to?<BR><BR>";
                    dat += "<table width='100%'>";

                    foreach (dynamic _c in Lang13.Enumerate(GlobalVars.req_console_information))
                    {
                        dpt3 = _c;


                        if (dpt3 != this.department)
                        {
                            dat += "<tr>";
                            dat += "<td width='55%'>" + dpt3 + "</td>";
                            dat += new Txt("<td width='45%'><A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt3)).str("'>Normal</A> <A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt3)).str(";priority=2'>High</A>").ToString();

                            if (this.hackState)
                            {
                                dat += new Txt("<A href='?src=").Ref(this).str(";write=").item(String13.CKey(dpt3)).str(";priority=3'>EXTREME</A>").ToString();
                            }
                            dat += "</td>";
                            dat += "</tr>";
                        }
                    }
                    dat += "</table>";
                    dat += new Txt("<BR><A href='?src=").Ref(this).str(";setScreen=0'><< Back</A><BR>").ToString();
                    break;

                case 6:
                    dat += "<span class='good'>Message sent.</span><BR><BR>";
                    dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=0'>Continue</A><BR>").ToString();
                    break;

                case 7:
                    dat += "<span class='bad'>An error occurred.</span><BR><BR>";
                    dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=0'>Continue</A><BR>").ToString();
                    break;

                case 8:

                    foreach (dynamic _d in Lang13.Enumerate(GlobalVars.allConsoles, typeof(Obj_Machinery_RequestsConsole)))
                    {
                        Console = _d;


                        if (Console.department == this.department)
                        {
                            Console.newmessagepriority = 0;
                            Console.update_icon();
                            Console.SetLuminosity(1);
                        }
                    }
                    this.newmessagepriority = 0;
                    this.update_icon();
                    messageComposite = "";

                    foreach (dynamic _e in Lang13.Enumerate(this.messages))
                    {
                        msg = _e;

                        messageComposite = "<div class='block'>" + msg + "</div>" + messageComposite;
                    }
                    dat += messageComposite;
                    dat += new Txt("<BR><A href='?src=").Ref(this).str(";setScreen=0'><< Back to Main Menu</A><BR>").ToString();
                    break;

                case 9:
                    dat += "<B>Message Authentication</B><BR><BR>";
                    dat += "<b>Message for " + this.dpt + ": </b>" + this.message + "<BR><BR>";
                    dat += "<div class='notice'>You may authenticate your message now by scanning your ID or your stamp</div><BR>";
                    dat += "<b>Validated by:</b> " + (Lang13.Bool(this.msgVerified) ? this.msgVerified : "<i>Not Validated</i>") + "<br>";
                    dat += "<b>Stamped by:</b> " + (Lang13.Bool(this.msgStamped) ? this.msgStamped : "<i>Not Stamped</i>") + "<br><br>";
                    dat += new Txt("<A href='?src=").Ref(this).str(";department=").item(this.dpt).str("'>Send Message</A><BR>").ToString();
                    dat += new Txt("<BR><A href='?src=").Ref(this).str(";setScreen=0'><< Discard Message</A><BR>").ToString();
                    break;

                case 10:
                    dat += "<h3>Station-wide Announcement</h3>";

                    if (this.announceAuth)
                    {
                        dat += "<div class='notice'>Authentication accepted</div><BR>";
                    }
                    else
                    {
                        dat += "<div class='notice'>Swipe your card to authenticate yourself</div><BR>";
                    }
                    dat += "<b>Message: </b>" + (Lang13.Bool(this.message) ? this.message : "<i>No Message</i>") + "<BR>";
                    dat += new Txt("<A href='?src=").Ref(this).str(";writeAnnouncement=1'>").item((Lang13.Bool(this.message) ? "Edit" : "Write")).str(" Message</A><BR><BR>").ToString();

                    if ((this.announceAuth || Lang13.Bool(GlobalFuncs.IsAdminGhost(a))) && Lang13.Bool(this.message))
                    {
                        dat += new Txt("<A href='?src=").Ref(this).str(";sendAnnouncement=1'>Announce Message</A><BR>").ToString();
                    }
                    else
                    {
                        dat += "<span class='linkOff'>Announce Message</span><BR>";
                    }
                    dat += new Txt("<BR><A href='?src=").Ref(this).str(";setScreen=0'><< Back</A><BR>").ToString();
                    break;

                default:
                    this.screen       = 0;
                    this.announceAuth = false;

                    if (this.newmessagepriority == 1)
                    {
                        dat += "<div class='notice'>There are new messages</div><BR>";
                    }

                    if (this.newmessagepriority == 2)
                    {
                        dat += "<div class='notice'>There are new <b>PRIORITY</b> messages</div><BR>";
                    }

                    if (this.newmessagepriority == 3)
                    {
                        dat += "<div class='notice'>There are new <b>EXTREME PRIORITY</b> messages</div><BR>";
                    }
                    dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=8'>View Messages</A><BR><BR>").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=1'>Request Assistance</A><BR>").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=2'>Request Supplies</A><BR>").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=3'>Relay Anonymous Information</A><BR><BR>").ToString();

                    if (!Lang13.Bool(this.emergency))
                    {
                        dat += new Txt("<A href='?src=").Ref(this).str(";emergency=1'>Emergency: Security</A><BR>").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";emergency=2'>Emergency: Engineering</A><BR>").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";emergency=3'>Emergency: Medical</A><BR><BR>").ToString();
                    }
                    else
                    {
                        dat += "<B><font color='red'>" + this.emergency + " has been dispatched to this location.</font></B><BR><BR>";
                    }

                    if (this.announcementConsole)
                    {
                        dat += new Txt("<A href='?src=").Ref(this).str(";setScreen=10'>Send Station-wide Announcement</A><BR><BR>").ToString();
                    }

                    if (this.silent)
                    {
                        dat += new Txt("Speaker <A href='?src=").Ref(this).str(";setSilent=0'>OFF</A>").ToString();
                    }
                    else
                    {
                        dat += new Txt("Speaker <A href='?src=").Ref(this).str(";setSilent=1'>ON</A>").ToString();
                    }
                    break;
                }
                popup = new Browser(a, "req_console", "" + this.department + " Requests Console", 450, 440);
                popup.set_content(dat);
                popup.set_title_image(((Mob)a).browse_rsc_icon(this.icon, this.icon_state));
                popup.open();
            }
            return(null);
        }
Exemple #6
0
        // Function from file: requests_console.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            string new_message                    = null;
            string new_message2                   = null;
            double?radio_freq                     = null;
            string log_msg                        = null;
            string sending                        = null;
            bool   pass                           = false;
            Obj_Machinery_MessageServer MS        = null;
            double?radio_freq2                    = null;
            string authentic                      = null;
            string alert                          = null;
            Obj_Machinery_RequestsConsole Console = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }
            Task13.User.set_machine(this);
            this.add_fingerprint(Task13.User);

            if (Lang13.Bool(GlobalFuncs.reject_bad_text(href_list["write"])))
            {
                this.dpt    = String13.CKey(href_list["write"]);
                new_message = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Write your message:", "Awaiting Input", "", null, InputType.Any)), 1, 1024);

                if (Lang13.Bool(new_message))
                {
                    this.message = new_message;
                    this.screen  = 9;

                    if ((String13.ParseNumber(href_list["priority"]) ?? 0) < 2)
                    {
                        this.priority = -1;
                    }
                    else
                    {
                        this.priority = String13.ParseNumber(href_list["priority"]);
                    }
                }
                else
                {
                    this.dpt         = "";
                    this.msgVerified = "";
                    this.msgStamped  = "";
                    this.screen      = 0;
                    this.priority    = -1;
                }
            }

            if (Lang13.Bool(href_list["writeAnnouncement"]))
            {
                new_message2 = String13.SubStr(GlobalFuncs.reject_bad_text(Interface13.Input(Task13.User, "Write your message:", "Awaiting Input", "", null, InputType.Any)), 1, 1024);

                if (Lang13.Bool(new_message2))
                {
                    this.message = new_message2;

                    if ((String13.ParseNumber(href_list["priority"]) ?? 0) < 2)
                    {
                        this.priority = -1;
                    }
                    else
                    {
                        this.priority = String13.ParseNumber(href_list["priority"]);
                    }
                }
                else
                {
                    this.message      = "";
                    this.announceAuth = false;
                    this.screen       = 0;
                }
            }

            if (Lang13.Bool(href_list["sendAnnouncement"]))
            {
                if (!this.announcementConsole)
                {
                    return(null);
                }
                GlobalFuncs.minor_announce(this.message, "" + this.department + " Announcement:");
                GlobalVars.news_network.SubmitArticle(this.message, this.department, "Station Announcements", null);
                GlobalFuncs.log_say("" + GlobalFuncs.key_name(Task13.User) + " has made a station announcement: " + this.message);
                GlobalFuncs.message_admins("" + GlobalFuncs.key_name_admin(Task13.User) + " has made a station announcement.");
                this.announceAuth = false;
                this.message      = "";
                this.screen       = 0;
            }

            if (Lang13.Bool(href_list["emergency"]))
            {
                if (!Lang13.Bool(this.emergency))
                {
                    switch ((int?)(String13.ParseNumber(href_list["emergency"])))
                    {
                    case 1:
                        radio_freq     = GlobalVars.SEC_FREQ;
                        this.emergency = "Security";
                        break;

                    case 2:
                        radio_freq     = GlobalVars.ENG_FREQ;
                        this.emergency = "Engineering";
                        break;

                    case 3:
                        radio_freq     = GlobalVars.MED_FREQ;
                        this.emergency = "Medical";
                        break;
                    }

                    if (Lang13.Bool(radio_freq))
                    {
                        this.Radio.set_frequency(radio_freq);
                        this.Radio.talk_into(this, "" + this.emergency + " emergency in " + this.department + "!!", radio_freq);
                        this.update_icon();
                        Task13.Schedule(3000, (Task13.Closure)(() => {
                            this.emergency = null;
                            this.update_icon();
                            return;
                        }));
                    }
                }
            }

            if (Lang13.Bool(href_list["department"]) && Lang13.Bool(this.message))
            {
                log_msg  = this.message;
                sending  = this.message;
                sending += "<br>";

                if (Lang13.Bool(this.msgVerified))
                {
                    sending += this.msgVerified;
                    sending += "<br>";
                }

                if (Lang13.Bool(this.msgStamped))
                {
                    sending += this.msgStamped;
                    sending += "<br>";
                }
                this.screen = 7;

                if (Lang13.Bool(sending))
                {
                    pass = false;

                    foreach (dynamic _b in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_MessageServer)))
                    {
                        MS = _b;


                        if (!MS.active)
                        {
                            continue;
                        }
                        MS.send_rc_message(href_list["department"], this.department, log_msg, this.msgStamped, this.msgVerified, this.priority);
                        pass = true;
                    }

                    if (pass)
                    {
                        radio_freq2 = 0;

                        dynamic _c = href_list["department"];                         // Was a switch-case, sorry for the mess.
                        if (_c == "bridge")
                        {
                            radio_freq2 = GlobalVars.COMM_FREQ;
                        }
                        else if (_c == "medbay")
                        {
                            radio_freq2 = GlobalVars.MED_FREQ;
                        }
                        else if (_c == "science")
                        {
                            radio_freq2 = GlobalVars.SCI_FREQ;
                        }
                        else if (_c == "engineering")
                        {
                            radio_freq2 = GlobalVars.ENG_FREQ;
                        }
                        else if (_c == "security")
                        {
                            radio_freq2 = GlobalVars.SEC_FREQ;
                        }
                        else if (_c == "cargobay")
                        {
                            radio_freq2 = GlobalVars.SUPP_FREQ;
                        }
                        this.Radio.set_frequency(radio_freq2);
                        authentic = null;

                        if (Lang13.Bool(this.msgVerified) || Lang13.Bool(this.msgStamped))
                        {
                            authentic = " (Authenticated)";
                        }
                        alert = "";

                        foreach (dynamic _e in Lang13.Enumerate(GlobalVars.allConsoles, typeof(Obj_Machinery_RequestsConsole)))
                        {
                            Console = _e;


                            if (String13.CKey(Console.department) == String13.CKey(href_list["department"]))
                            {
                                switch ((int?)(this.priority))
                                {
                                case 2:
                                    alert = "PRIORITY Alert in " + this.department + authentic;
                                    Console.createmessage(this, alert, sending, 2);
                                    break;

                                case 3:
                                    alert = "EXTREME PRIORITY Alert from " + this.department + authentic;
                                    Console.createmessage(this, alert, sending, 3);
                                    break;

                                default:
                                    alert = "Message from " + this.department + authentic;
                                    Console.createmessage(this, alert, sending, 1);
                                    break;
                                }
                                this.screen = 6;
                                Console.SetLuminosity(2);
                            }
                        }

                        if (Lang13.Bool(radio_freq2))
                        {
                            this.Radio.talk_into(this, "" + alert + ": <i>" + this.message + "</i>", radio_freq2);
                        }

                        switch ((int?)(this.priority))
                        {
                        case 2:
                            this.messages.Add("<span class='bad'>High Priority</span><BR><b>To:</b> " + this.dpt + "<BR>" + sending);
                            break;

                        default:
                            this.messages.Add("<b>To: " + this.dpt + "</b><BR>" + sending);
                            break;
                        }
                    }
                    else
                    {
                        this.say("NOTICE: No server detected!");
                    }
                }
            }

            switch ((int?)(String13.ParseNumber(href_list["setScreen"])))
            {
            case null:

                break;

            case 1:
                this.screen = 1;
                break;

            case 2:
                this.screen = 2;
                break;

            case 3:
                this.screen = 3;
                break;

            case 5:
                this.screen = 5;
                break;

            case 6:
                this.screen = 6;
                break;

            case 7:
                this.screen = 7;
                break;

            case 8:
                this.screen = 8;
                break;

            case 9:
                this.screen = 9;
                break;

            case 10:

                if (!this.announcementConsole)
                {
                    return(null);
                }
                this.screen = 10;
                break;

            default:
                this.dpt         = "";
                this.msgVerified = "";
                this.msgStamped  = "";
                this.message     = "";
                this.priority    = -1;
                this.screen      = 0;
                break;
            }

            dynamic _h = href_list["setSilent"];             // Was a switch-case, sorry for the mess.

            if (_h == null)
            {
            }
            else if (_h == "1")
            {
                this.silent = true;
            }
            else
            {
                this.silent = false;
            }
            this.updateUsrDialog();
            return(null);
        }
Exemple #7
0
        // Function from file: requests_console.dm
        public void createmessage(dynamic source = null, string title = null, string message = null, int priority = 0)
        {
            dynamic linkedsender = null;
            dynamic sender       = null;


            if (source is Obj_Machinery_RequestsConsole)
            {
                sender       = source;
                linkedsender = new Txt("<a href='?src=").Ref(this).str(";write=").item(String13.CKey(sender.department)).str("'>").item(sender.department).str("</a>").ToString();
            }
            else
            {
                GlobalFuncs.capitalize(source);
                linkedsender = source;
            }
            GlobalFuncs.capitalize(title);

            switch ((int)(priority))
            {
            case 2:

                if (this.newmessagepriority < 2)
                {
                    this.newmessagepriority = 2;
                    this.update_icon();
                }

                if (!this.silent)
                {
                    GlobalFuncs.playsound(this.loc, "sound/machines/twobeep.ogg", 50, 1);
                    this.say(title);
                    this.messages.Add("<span class='bad'>High Priority</span><BR><b>From:</b> " + linkedsender + "<BR>" + message);
                }
                break;

            case 3:

                if (this.newmessagepriority < 3)
                {
                    this.newmessagepriority = 3;
                    this.update_icon();
                }
                GlobalFuncs.playsound(this.loc, "sound/machines/twobeep.ogg", 50, 1);
                this.say(title);
                this.messages.Add("<span class='bad'>!!!Extreme Priority!!!</span><BR><b>From:</b> " + linkedsender + "<BR>" + message);
                break;

            default:

                if (this.newmessagepriority < 1)
                {
                    this.newmessagepriority = 1;
                    this.update_icon();
                }

                if (!this.silent)
                {
                    GlobalFuncs.playsound(this.loc, "sound/machines/twobeep.ogg", 50, 1);
                    this.say(title);
                }
                this.messages.Add("<b>From:</b> " + linkedsender + "<BR>" + message);
                break;
            }
            this.SetLuminosity(2);
            return;
        }
        // Function from file: card.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            dynamic I                = null;
            dynamic I2               = null;
            double? access_type      = null;
            double? access_allowed   = null;
            dynamic t1               = null;
            dynamic newJob           = null;
            dynamic jobdatum         = null;
            dynamic jobtype          = null;
            dynamic J                = null;
            dynamic t2               = null;
            string  newName          = null;
            dynamic edit_job_target  = null;
            Job     j                = null;
            dynamic edit_job_target2 = null;
            Job     j2               = null;
            Obj_Item_Weapon_Paper P  = null;
            string      t12          = null;
            Data_Record t            = null;


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

            dynamic _c = href_list["choice"];             // Was a switch-case, sorry for the mess.

            if (_c == "modify")
            {
                if (Lang13.Bool(this.modify))
                {
                    GlobalVars.data_core.manifest_modify(this.modify.registered_name, this.modify.assignment);
                    this.modify.update_label();
                    this.modify.loc = this.loc;
                    this.modify.__CallVerb("Pick up");
                    this.modify            = null;
                    this.region_access     = null;
                    this.head_subordinates = null;
                }
                else
                {
                    I = Task13.User.get_active_hand();

                    if (I is Obj_Item_Weapon_Card_Id)
                    {
                        if (!Task13.User.drop_item())
                        {
                            return(null);
                        }
                        I.loc       = this;
                        this.modify = I;
                    }
                }
                this.authenticated = 0;
            }
            else if (_c == "scan")
            {
                if (Lang13.Bool(this.scan))
                {
                    this.scan.loc = this.loc;
                    this.scan.__CallVerb("Pick up");
                    this.scan = null;
                }
                else
                {
                    I2 = Task13.User.get_active_hand();

                    if (I2 is Obj_Item_Weapon_Card_Id)
                    {
                        if (!Task13.User.drop_item())
                        {
                            return(null);
                        }
                        I2.loc    = this;
                        this.scan = I2;
                    }
                }
                this.authenticated = 0;
            }
            else if (_c == "auth")
            {
                if (!(this.authenticated != 0) && (Lang13.Bool(this.scan) || Task13.User is Mob_Living_Silicon) && (Lang13.Bool(this.modify) || Lang13.Bool(this.mode)))
                {
                    if (this.check_access(this.scan))
                    {
                        this.region_access     = new ByTable();
                        this.head_subordinates = new ByTable();

                        if (Lang13.Bool(this.scan.access.Contains(GlobalVars.access_change_ids)))
                        {
                            if (this.target_dept != 0)
                            {
                                this.head_subordinates = GlobalFuncs.get_all_jobs();
                                this.region_access.Or(this.target_dept);
                                this.authenticated = 1;
                            }
                            else
                            {
                                this.authenticated = 2;
                            }
                        }
                        else
                        {
                            if (Lang13.Bool(this.scan.access.Contains(GlobalVars.access_hop)) && (this.target_dept == 1 || !(this.target_dept != 0)))
                            {
                                this.region_access.Or(1);
                                this.region_access.Or(6);
                                this.get_subordinates("Head of Personnel");
                            }

                            if (Lang13.Bool(this.scan.access.Contains(GlobalVars.access_hos)) && (this.target_dept == 2 || !(this.target_dept != 0)))
                            {
                                this.region_access.Or(2);
                                this.get_subordinates("Head of Security");
                            }

                            if (Lang13.Bool(this.scan.access.Contains(GlobalVars.access_cmo)) && (this.target_dept == 3 || !(this.target_dept != 0)))
                            {
                                this.region_access.Or(3);
                                this.get_subordinates("Chief Medical Officer");
                            }

                            if (Lang13.Bool(this.scan.access.Contains(GlobalVars.access_rd)) && (this.target_dept == 4 || !(this.target_dept != 0)))
                            {
                                this.region_access.Or(4);
                                this.get_subordinates("Research Director");
                            }

                            if (Lang13.Bool(this.scan.access.Contains(GlobalVars.access_ce)) && (this.target_dept == 5 || !(this.target_dept != 0)))
                            {
                                this.region_access.Or(5);
                                this.get_subordinates("Chief Engineer");
                            }

                            if (this.region_access != null)
                            {
                                this.authenticated = 1;
                            }
                        }
                    }
                }
                else if (!(this.authenticated != 0) && Task13.User is Mob_Living_Silicon && !Lang13.Bool(this.modify))
                {
                    Task13.User.WriteMsg("<span class='warning'>You can't modify an ID without an ID inserted to modify! Once one is in the modify slot on the computer, you can log in.</span>");
                }
            }
            else if (_c == "logout")
            {
                this.region_access     = null;
                this.head_subordinates = null;
                this.authenticated     = 0;
            }
            else if (_c == "access")
            {
                if (Lang13.Bool(href_list["allowed"]))
                {
                    if (this.authenticated != 0)
                    {
                        access_type    = String13.ParseNumber(href_list["access_target"]);
                        access_allowed = String13.ParseNumber(href_list["allowed"]);

                        if ((this is Obj_Machinery_Computer_Card_Centcom ? GlobalFuncs.get_all_centcom_access() : GlobalFuncs.get_all_accesses()).Contains(access_type))
                        {
                            this.modify.access -= access_type;

                            if (access_allowed == 1)
                            {
                                this.modify.access += access_type;
                            }
                        }
                    }
                }
            }
            else if (_c == "assign")
            {
                if (this.authenticated == 2)
                {
                    t1 = href_list["assign_target"];

                    if (t1 == "Custom")
                    {
                        newJob = GlobalFuncs.reject_bad_text(Interface13.Input("Enter a custom job assignment.", "Assignment", (Lang13.Bool(this.modify) ? this.modify.assignment : ((dynamic)("Unassigned"))), null, null, InputType.Any), 26);

                        if (Lang13.Bool(newJob))
                        {
                            t1 = newJob;
                        }
                    }
                    else if (t1 == "Unassigned")
                    {
                        this.modify.access -= GlobalFuncs.get_all_accesses();
                    }
                    else
                    {
                        jobdatum = null;

                        foreach (dynamic _a in Lang13.Enumerate(Lang13.GetTypes(typeof(Job))))
                        {
                            jobtype = _a;

                            J = Lang13.Call(jobtype);

                            if (String13.CKey(J.title) == String13.CKey(t1))
                            {
                                jobdatum = J;
                                break;
                            }
                        }

                        if (!Lang13.Bool(jobdatum))
                        {
                            Task13.User.WriteMsg("<span class='error'>No log exists for this job.</span>");
                            return(null);
                        }
                        this.modify.access = (this is Obj_Machinery_Computer_Card_Centcom ? GlobalFuncs.get_centcom_access(t1) : ((Job)jobdatum).get_access());
                    }

                    if (Lang13.Bool(this.modify))
                    {
                        this.modify.assignment = t1;
                    }
                }
            }
            else if (_c == "demote")
            {
                if (Lang13.Bool(((dynamic)(this.head_subordinates != null || this.modify.assignment == "Assistant")).Contains(this.modify.assignment)))
                {
                    this.modify.assignment = "Unassigned";
                }
                else
                {
                    Task13.User.WriteMsg("<span class='error'>You are not authorized to demote this position.</span>");
                }
            }
            else if (_c == "reg")
            {
                if (this.authenticated != 0)
                {
                    t2 = this.modify;

                    if (this.authenticated != 0 && this.modify == t2 && (Map13.GetDistance(this, Task13.User) <= 1 || Task13.User is Mob_Living_Silicon) && this.loc is Tile)
                    {
                        newName = GlobalFuncs.reject_bad_name(href_list["reg"]);

                        if (Lang13.Bool(newName))
                        {
                            this.modify.registered_name = newName;
                        }
                        else
                        {
                            Task13.User.WriteMsg("<span class='error'>Invalid name entered.</span>");
                            return(null);
                        }
                    }
                }
            }
            else if (_c == "mode")
            {
                this.mode = String13.ParseNumber(href_list["mode_target"]);
            }
            else if (_c == "return")
            {
                this.mode = 3;
            }
            else if (_c == "make_job_available")
            {
                if (Lang13.Bool(this.scan) && Lang13.Bool(this.scan.access.Contains(GlobalVars.access_change_ids)) && !(this.target_dept != 0))
                {
                    edit_job_target = href_list["job"];
                    j = GlobalVars.SSjob.GetJob(edit_job_target);

                    if (!(j != null))
                    {
                        return(0);
                    }

                    if (this.can_open_job(j) != 1)
                    {
                        return(0);
                    }

                    if (Convert.ToDouble(this.opened_positions[edit_job_target]) >= 0)
                    {
                        GlobalVars.time_last_changed_position = Game13.time / 10;
                    }
                    j.total_positions++;
                    this.opened_positions[edit_job_target]++;
                }
            }
            else if (_c == "make_job_unavailable")
            {
                if (Lang13.Bool(this.scan) && Lang13.Bool(this.scan.access.Contains(GlobalVars.access_change_ids)) && !(this.target_dept != 0))
                {
                    edit_job_target2 = href_list["job"];
                    j2 = GlobalVars.SSjob.GetJob(edit_job_target2);

                    if (!(j2 != null))
                    {
                        return(0);
                    }

                    if (this.can_close_job(j2) != 1)
                    {
                        return(0);
                    }

                    if (Convert.ToDouble(this.opened_positions[edit_job_target2]) <= 0)
                    {
                        GlobalVars.time_last_changed_position = Game13.time / 10;
                    }
                    j2.total_positions--;
                    this.opened_positions[edit_job_target2]--;
                }
            }
            else if (_c == "print")
            {
                if (!(this.printing == true))
                {
                    this.printing = true;
                    Task13.Sleep(50);
                    P   = new Obj_Item_Weapon_Paper(this.loc);
                    t12 = "<B>Crew Manifest:</B><BR>";

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

                        t12 += t.fields["name"] + " - " + t.fields["rank"] + "<br>";
                    }
                    P.info        = t12;
                    P.name        = "paper- 'Crew Manifest'";
                    this.printing = null;
                }
            }

            if (Lang13.Bool(this.modify))
            {
                this.modify.update_label();
            }
            this.updateUsrDialog();
            return(null);
        }