Exemplo n.º 1
0
        // Function from file: datacore.dm
        public void removeMinorCrime(dynamic id = null, string cDataId = null)
        {
            Data_Record R      = null;
            dynamic     crimes = null;
            Data_Crime  crime  = null;


            foreach (dynamic _b in Lang13.Enumerate(this.security, typeof(Data_Record)))
            {
                R = _b;


                if (R.fields["id"] == id)
                {
                    crimes = R.fields["mi_crim"];

                    foreach (dynamic _a in Lang13.Enumerate(crimes, typeof(Data_Crime)))
                    {
                        crime = _a;


                        if (crime.dataId == String13.ParseNumber(cDataId))
                        {
                            crimes -= crime;
                            return;
                        }
                    }
                }
            }
            return;
        }
Exemplo n.º 2
0
        // Function from file: datacore.dm
        public void manifest_modify(dynamic name = null, dynamic assignment = null)
        {
            Data_Record foundrecord = null;

            foundrecord = GlobalFuncs.find_record("name", name, GlobalVars.data_core.general);

            if (foundrecord != null)
            {
                foundrecord.fields["rank"] = assignment;
            }
            return;
        }
Exemplo n.º 3
0
        // Function from file: datacore.dm
        public void addMinorCrime(string id = null, Data_Crime crime = null)
        {
            id = id ?? "";

            Data_Record R      = null;
            dynamic     crimes = null;


            foreach (dynamic _a in Lang13.Enumerate(this.security, typeof(Data_Record)))
            {
                R = _a;


                if (R.fields["id"] == id)
                {
                    crimes  = R.fields["mi_crim"];
                    crimes |= crime;
                    return;
                }
            }
            return;
        }
Exemplo n.º 4
0
        // Function from file: datacore.dm
        public void manifest_inject(dynamic H = null)
        {
            dynamic assignment = null;
            string  id         = null;
            Icon    image      = null;
            Obj_Item_Weapon_Photo photo_front = null;
            Obj_Item_Weapon_Photo photo_side  = null;
            Data_Record           G           = null;
            Data_Record           M           = null;
            Data_Record           S           = null;
            Data_Record           L           = null;


            if (Lang13.Bool(H.mind) && H.mind.assigned_role != H.mind.special_role)
            {
                if (Lang13.Bool(H.mind.assigned_role))
                {
                    assignment = H.mind.assigned_role;
                }
                else if (Lang13.Bool(H.job))
                {
                    assignment = H.job;
                }
                else
                {
                    assignment = "Unassigned";
                }
                id          = GlobalFuncs.num2hex(GlobalVars.record_id_num++, 6);
                image       = this.get_id_photo(H);
                photo_front = new Obj_Item_Weapon_Photo();
                photo_side  = new Obj_Item_Weapon_Photo();
                photo_front.photocreate(null, new Icon(image, null, GlobalVars.SOUTH));
                photo_side.photocreate(null, new Icon(image, null, GlobalVars.WEST));
                G = new Data_Record();
                G.fields["id"]   = id;
                G.fields["name"] = H.real_name;
                G.fields["rank"] = assignment;
                G.fields["age"]  = H.age;

                if (GlobalVars.config.mutant_races)
                {
                    G.fields["species"] = H.dna.species.name;
                }
                G.fields["fingerprint"] = Num13.Md5(H.dna.uni_identity);
                G.fields["p_stat"]      = "Active";
                G.fields["m_stat"]      = "Stable";
                G.fields["sex"]         = H.gender;
                G.fields["photo_front"] = photo_front;
                G.fields["photo_side"]  = photo_side;
                this.general.Add(G);
                M = new Data_Record();
                M.fields["id"]         = id;
                M.fields["name"]       = H.real_name;
                M.fields["blood_type"] = H.dna.blood_type;
                M.fields["b_dna"]      = H.dna.unique_enzymes;
                M.fields["mi_dis"]     = "None";
                M.fields["mi_dis_d"]   = "No minor disabilities have been declared.";
                M.fields["ma_dis"]     = "None";
                M.fields["ma_dis_d"]   = "No major disabilities have been diagnosed.";
                M.fields["alg"]        = "None";
                M.fields["alg_d"]      = "No allergies have been detected in this patient.";
                M.fields["cdi"]        = "None";
                M.fields["cdi_d"]      = "No diseases have been diagnosed at the moment.";
                M.fields["notes"]      = "No notes.";
                this.medical.Add(M);
                S = new Data_Record();
                S.fields["id"]       = id;
                S.fields["name"]     = H.real_name;
                S.fields["criminal"] = "None";
                S.fields["mi_crim"]  = new ByTable();
                S.fields["ma_crim"]  = new ByTable();
                S.fields["notes"]    = "No notes.";
                this.security.Add(S);
                L = new Data_Record();
                L.fields["id"]         = Num13.Md5("" + H.real_name + H.mind.assigned_role);
                L.fields["name"]       = H.real_name;
                L.fields["rank"]       = H.mind.assigned_role;
                L.fields["age"]        = H.age;
                L.fields["sex"]        = H.gender;
                L.fields["blood_type"] = H.dna.blood_type;
                L.fields["b_dna"]      = H.dna.unique_enzymes;
                L.fields["enzymes"]    = H.dna.struc_enzymes;
                L.fields["identity"]   = H.dna.uni_identity;
                L.fields["species"]    = H.dna.species.type;
                L.fields["features"]   = H.dna.features;
                L.fields["image"]      = image;
                this.locked.Add(L);
            }
            return;
        }
Exemplo n.º 5
0
        // Function from file: datacore.dm
        public dynamic get_manifest(dynamic monochrome = null, bool?OOC = null)
        {
            ByTable     heads      = null;
            ByTable     sec        = null;
            ByTable     eng        = null;
            ByTable     med        = null;
            ByTable     sci        = null;
            ByTable     sup        = null;
            ByTable     civ        = null;
            ByTable     bot        = null;
            ByTable     misc       = null;
            dynamic     dat        = null;
            bool        even       = false;
            Data_Record t          = null;
            dynamic     name       = null;
            dynamic     rank       = null;
            bool        department = false;
            dynamic     name2      = null;
            dynamic     name3      = null;
            dynamic     name4      = null;
            dynamic     name5      = null;
            dynamic     name6      = null;
            dynamic     name7      = null;
            dynamic     name8      = null;
            dynamic     name9      = null;
            dynamic     name10     = null;

            heads = new ByTable();
            sec   = new ByTable();
            eng   = new ByTable();
            med   = new ByTable();
            sci   = new ByTable();
            sup   = new ByTable();
            civ   = new ByTable();
            bot   = new ByTable();
            misc  = new ByTable();
            dat   = "\n	<head><style>\n		.manifest {border-collapse:collapse;}\n		.manifest td, th {border:1px solid "+ (Lang13.Bool(monochrome) ? "black" : "#DEF; background-color:white; color:black") + "; padding:.25em}\n		.manifest th {height: 2em; "+ (Lang13.Bool(monochrome) ? "border-top-width: 3px" : "background-color: #48C; color:white") + "}\n		.manifest tr.head th { "+ (Lang13.Bool(monochrome) ? "border-top-width: 1px" : "background-color: #488;") + " }\n		.manifest td:first-child {text-align:right}\n		.manifest tr.alt td {"+ (Lang13.Bool(monochrome) ? "border-top-width: 2px" : "background-color: #DEF") + @"}
	</style></head>
	<table class=""manifest"" width='350px'>
	<tr class='head'><th>Name</th><th>Rank</th></tr>
	"    ;
            even  = false;

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

                name       = t.fields["name"];
                rank       = t.fields["rank"];
                department = false;

                if (GlobalVars.command_positions.Contains(rank))
                {
                    heads[name] = rank;
                    department  = true;
                }

                if (GlobalVars.security_positions.Contains(rank))
                {
                    sec[name]  = rank;
                    department = true;
                }

                if (GlobalVars.engineering_positions.Contains(rank))
                {
                    eng[name]  = rank;
                    department = true;
                }

                if (GlobalVars.medical_positions.Contains(rank))
                {
                    med[name]  = rank;
                    department = true;
                }

                if (GlobalVars.science_positions.Contains(rank))
                {
                    sci[name]  = rank;
                    department = true;
                }

                if (GlobalVars.supply_positions.Contains(rank))
                {
                    sup[name]  = rank;
                    department = true;
                }

                if (GlobalVars.civilian_positions.Contains(rank))
                {
                    civ[name]  = rank;
                    department = true;
                }

                if (GlobalVars.nonhuman_positions.Contains(rank))
                {
                    bot[name]  = rank;
                    department = true;
                }

                if (!department && !heads.Contains(name))
                {
                    misc[name] = rank;
                }
            }

            if (heads.len > 0)
            {
                dat += "<tr><th colspan=3>Heads</th></tr>";

                foreach (dynamic _b in Lang13.Enumerate(heads))
                {
                    name2 = _b;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name2 + "</td><td>" + heads[name2] + "</td></tr>";
                    even = !even;
                }
            }

            if (sec.len > 0)
            {
                dat += "<tr><th colspan=3>Security</th></tr>";

                foreach (dynamic _c in Lang13.Enumerate(sec))
                {
                    name3 = _c;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name3 + "</td><td>" + sec[name3] + "</td></tr>";
                    even = !even;
                }
            }

            if (eng.len > 0)
            {
                dat += "<tr><th colspan=3>Engineering</th></tr>";

                foreach (dynamic _d in Lang13.Enumerate(eng))
                {
                    name4 = _d;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name4 + "</td><td>" + eng[name4] + "</td></tr>";
                    even = !even;
                }
            }

            if (med.len > 0)
            {
                dat += "<tr><th colspan=3>Medical</th></tr>";

                foreach (dynamic _e in Lang13.Enumerate(med))
                {
                    name5 = _e;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name5 + "</td><td>" + med[name5] + "</td></tr>";
                    even = !even;
                }
            }

            if (sci.len > 0)
            {
                dat += "<tr><th colspan=3>Science</th></tr>";

                foreach (dynamic _f in Lang13.Enumerate(sci))
                {
                    name6 = _f;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name6 + "</td><td>" + sci[name6] + "</td></tr>";
                    even = !even;
                }
            }

            if (sup.len > 0)
            {
                dat += "<tr><th colspan=3>Supply</th></tr>";

                foreach (dynamic _g in Lang13.Enumerate(sup))
                {
                    name7 = _g;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name7 + "</td><td>" + sup[name7] + "</td></tr>";
                    even = !even;
                }
            }

            if (civ.len > 0)
            {
                dat += "<tr><th colspan=3>Civilian</th></tr>";

                foreach (dynamic _h in Lang13.Enumerate(civ))
                {
                    name8 = _h;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name8 + "</td><td>" + civ[name8] + "</td></tr>";
                    even = !even;
                }
            }

            if (bot.len > 0)
            {
                dat += "<tr><th colspan=3>Silicon</th></tr>";

                foreach (dynamic _i in Lang13.Enumerate(bot))
                {
                    name9 = _i;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name9 + "</td><td>" + bot[name9] + "</td></tr>";
                    even = !even;
                }
            }

            if (misc.len > 0)
            {
                dat += "<tr><th colspan=3>Miscellaneous</th></tr>";

                foreach (dynamic _j in Lang13.Enumerate(misc))
                {
                    name10 = _j;

                    dat += "<tr" + (even ? " class='alt'" : "") + "><td>" + name10 + "</td><td>" + misc[name10] + "</td></tr>";
                    even = !even;
                }
            }
            dat += "</table>";
            dat  = GlobalFuncs.replacetext(dat, "\n", "");
            dat  = GlobalFuncs.replacetext(dat, "	", "");
            return(dat);
        }
Exemplo n.º 6
0
        // Function from file: portable_turret.dm
        public virtual int assess_perp(dynamic perp = null)
        {
            int         threatcount = 0;
            dynamic     perpname    = null;
            Data_Record R           = null;

            threatcount = 0;

            if (Lang13.Bool(this.emagged))
            {
                return(10);
            }

            if ((this.stun_all || this.attacked) && !this.allowed(perp))
            {
                if (!this.allowed(perp))
                {
                    return(10);
                }
            }

            if (this.auth_weapons)
            {
                if (perp.wear_id == null || ((Obj_Item)perp.wear_id).GetID() is Obj_Item_Weapon_Card_Id_Syndicate)
                {
                    if (this.allowed(perp) && !Lang13.Bool(this.lasercolor))
                    {
                        return(0);
                    }

                    if (perp.l_hand is Obj_Item_Weapon_Gun && !(perp.l_hand is Obj_Item_Weapon_Gun_Projectile_Revolver_Doublebarrel) || perp.l_hand is Obj_Item_Weapon_Melee_Baton)
                    {
                        threatcount += 4;
                    }

                    if (perp.r_hand is Obj_Item_Weapon_Gun && !(perp.r_hand is Obj_Item_Weapon_Gun_Projectile_Revolver_Doublebarrel) || perp.r_hand is Obj_Item_Weapon_Melee_Baton)
                    {
                        threatcount += 4;
                    }

                    if (perp.belt is Obj_Item_Weapon_Gun || perp.belt is Obj_Item_Weapon_Melee_Baton)
                    {
                        threatcount += 2;
                    }
                }
            }

            if (this.lasercolor == "b")
            {
                threatcount = 0;

                if (perp.wear_suit is Obj_Item_Clothing_Suit_Redtag)
                {
                    threatcount += 4;
                }

                if (perp.r_hand is Obj_Item_Weapon_Gun_Energy_Laser_Redtag || perp.l_hand is Obj_Item_Weapon_Gun_Energy_Laser_Redtag)
                {
                    threatcount += 4;
                }

                if (perp.belt is Obj_Item_Weapon_Gun_Energy_Laser_Redtag)
                {
                    threatcount += 2;
                }
            }

            if (this.lasercolor == "r")
            {
                threatcount = 0;

                if (perp.wear_suit is Obj_Item_Clothing_Suit_Bluetag)
                {
                    threatcount += 4;
                }

                if (perp.r_hand is Obj_Item_Weapon_Gun_Energy_Laser_Bluetag || perp.l_hand is Obj_Item_Weapon_Gun_Energy_Laser_Bluetag)
                {
                    threatcount += 4;
                }

                if (perp.belt is Obj_Item_Weapon_Gun_Energy_Laser_Bluetag)
                {
                    threatcount += 2;
                }
            }

            if (this.check_records)
            {
                perpname = ((Mob_Living_Carbon_Human)perp).get_face_name(((Mob_Living_Carbon_Human)perp).get_id_name());
                R        = GlobalFuncs.find_record("name", perpname, GlobalVars.data_core.security);

                if (!(R != null) || R.fields["criminal"] == "*Arrest*")
                {
                    threatcount += 4;
                }
            }
            return(threatcount);
        }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
        // 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);
        }