Example #1
0
        // Function from file: server.dm
        public void griefProtection(  )
        {
            Obj_Machinery_RND_Server_Centcom C = null;
            dynamic v  = null;
            Tech    T  = null;
            dynamic v2 = null;
            dynamic D  = null;


            foreach (dynamic _c in Lang13.Enumerate(GlobalVars.machines, typeof(Obj_Machinery_RND_Server_Centcom)))
            {
                C = _c;


                foreach (dynamic _a in Lang13.Enumerate(this.files.known_tech))
                {
                    v = _a;

                    T = this.files.known_tech[v];
                    C.files.AddTech2Known(T);
                }

                foreach (dynamic _b in Lang13.Enumerate(this.files.known_designs))
                {
                    v2 = _b;

                    D = this.files.known_designs[v2];
                    C.files.AddDesign2Known(D);
                }
                C.files.RefreshResearch();
            }
            return;
        }
Example #2
0
        // Function from file: objective.dm
        public override int check_completion(  )
        {
            Mob_Living_Carbon_Human H = null;
            dynamic SN             = null;
            dynamic current_amount = null;
            Tech    current_data   = null;


            if (!(this.owner.current is Mob_Living_Carbon_Human))
            {
                return(0);
            }
            H = this.owner.current;

            if (!(H != null) || H.stat == 2)
            {
                return(0);
            }

            if (!(H.wear_suit is Obj_Item_Clothing_Suit_Space_SpaceNinja))
            {
                return(0);
            }
            SN = H.wear_suit;

            if (!SN.s_initialized)
            {
                return(0);
            }

            if (!(SN.stored_research.len != 0))
            {
                return(0);
            }
            else
            {
                foreach (dynamic _a in Lang13.Enumerate(SN.stored_research, typeof(Tech)))
                {
                    current_data = _a;


                    if (current_data.level != 0)                                //Originally just *.level, not (*.level != 0) -Pdan
                    {
                        current_amount += ((current_data.level != 0) ?1:0) - 1; //Originally just *.level, not (*.level != 0) -Pdan
                    }
                }
            }

            if (Convert.ToDouble(current_amount) < Convert.ToDouble(this.target_amount))
            {
                return(0);
            }
            return(1);
        }
        public void f_sync(  )
        {
            Obj_Machinery_Computer_Rdconsole RDC = null;
            dynamic v  = null;
            Tech    T  = null;
            dynamic v2 = null;
            dynamic D  = null;

            this.temp = "Updating local R&D database...";
            this.updateUsrDialog();
            Task13.Sleep(30);

            foreach (dynamic _c in Lang13.Enumerate(Map13.FetchInViewExcludeThis(this, 5), typeof(Obj_Machinery_Computer_Rdconsole)))
            {
                RDC = _c;


                if (!RDC.sync)
                {
                    continue;
                }

                foreach (dynamic _a in Lang13.Enumerate(RDC.files.known_tech))
                {
                    v = _a;

                    T = RDC.files.known_tech[v];
                    this.files.AddTech2Known(T);
                }

                foreach (dynamic _b in Lang13.Enumerate(RDC.files.known_designs))
                {
                    v2 = _b;

                    D = RDC.files.known_designs[v2];
                    this.files.AddDesign2Known(D);
                }
                this.files.RefreshResearch();
                this.temp  = "Processed equipment designs.<br>";
                this.temp += this.update_tech();
                this.temp += new Txt("<a href='?src=").Ref(this).str(";clear_temp=1'>Return</a>").ToString();
                this.updateUsrDialog();
                this.visible_message(new Txt().icon(this).str(" <b>").The(this).item().str("</b> beeps, \"Successfully synchronized with R&D server.\"").ToString());
                return;
            }
            this.temp = new Txt("Unable to connect to local R&D Database.<br>Please check your connections and try again.<br><a href='?src=").Ref(this).str(";clear_temp=1'>Return</a>").ToString();
            this.updateUsrDialog();
            return;
        }
Example #4
0
        // Function from file: research.dm
        public void RefreshResearch(  )
        {
            Tech    PT = null;
            Design  PD = null;
            dynamic v  = null;
            dynamic T  = null;
            dynamic v2 = null;
            Design  D  = null;


            foreach (dynamic _a in Lang13.Enumerate(this.possible_tech, typeof(Tech)))
            {
                PT = _a;


                if (Lang13.Bool(this.TechHasReqs(PT)))
                {
                    this.AddTech2Known(PT);
                }
            }

            foreach (dynamic _b in Lang13.Enumerate(this.possible_designs, typeof(Design)))
            {
                PD = _b;


                if (Lang13.Bool(this.DesignHasReqs(PD)))
                {
                    this.AddDesign2Known(PD);
                }
            }

            foreach (dynamic _c in Lang13.Enumerate(this.known_tech))
            {
                v = _c;

                T       = this.known_tech[v];
                T.level = Num13.MaxInt(1, Num13.MinInt(Convert.ToInt32(T.level), 20));
            }

            foreach (dynamic _d in Lang13.Enumerate(this.known_designs))
            {
                v2 = _d;

                D = this.known_designs[v2];
                D.CalcReliability(this.known_tech);
            }
            return;
        }
Example #5
0
        // Function from file: research.dm
        public void AddTech2Known(Tech T = null)
        {
            dynamic known = null;


            if (Lang13.Bool(this.known_tech[T.id]))
            {
                known = this.known_tech[T.id];

                if (T.level > Convert.ToDouble(known.level))                       //Originally just *.level, not (*.level != 0) -Pdan
                {
                    known.level = T.level;
                }
                return;
            }
            this.known_tech[T.id] = T;
            return;
        }
Example #6
0
        // Function from file: designs.dm
        public void CalcReliability(ByTable temp_techs = null)
        {
            int  new_reliability = 0;
            Tech T = null;


            foreach (dynamic _a in Lang13.Enumerate(temp_techs, typeof(Tech)))
            {
                T = _a;


                if (this.req_tech.Contains(T.id))
                {
                    new_reliability += T.level;                     //Originally just *.level, not (*.level != 0) -Pdan
                }
            }
            new_reliability  = Num13.MaxInt(this.reliability, Num13.MinInt(new_reliability, 100));
            this.reliability = new_reliability;
            return;
        }
Example #7
0
        // Function from file: research.dm
        public int?TechHasReqs(Tech T = null)
        {
            dynamic req   = null;
            dynamic known = null;


            if (T.req_tech.len == 0)
            {
                return(GlobalVars.TRUE);
            }

            foreach (dynamic _a in Lang13.Enumerate(T.req_tech))
            {
                req = _a;

                known = this.known_tech[req];

                if (!Lang13.Bool(known) || Convert.ToDouble(known.level) < Convert.ToDouble(T.req_tech[req]))
                {
                    return(GlobalVars.FALSE);
                }
            }
            return(GlobalVars.TRUE);
        }
Example #8
0
        // Function from file: ninjaDrainAct.dm
        public override dynamic ninjadrain_act(Obj_Item_Clothing_Suit_Space_SpaceNinja S = null, Ent_Static H = null, Obj_Item_Clothing_Gloves_SpaceNinja G = null)
        {
            dynamic _default = null;

            dynamic location         = null;
            Mob_Living_Silicon_Ai AI = null;
            Tech current_data        = null;
            Tech analyzing_data      = null;


            if (!(S != null) || !(H != null) || !(G != null))
            {
                return("INVALID");
            }
            _default = "RDHACKFAIL";
            ((dynamic)H).WriteMsg(new Txt("<span class='notice'>Hacking ").the(this).item().str("...</span>").ToString());
            Task13.Schedule(0, (Task13.Closure)(() => {
                location = GlobalFuncs.get_turf(H);

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list, typeof(Mob_Living_Silicon_Ai)))
                {
                    AI = _a;

                    AI.WriteMsg("<span class='userdanger'>Network Alert: Hacking attempt detected" + (Lang13.Bool(location) ? " in " + location : ". Unable to pinpoint location") + "</span>.");
                }
                return;
            }));

            if (this.files != null && this.files.known_tech.len != 0)
            {
                foreach (dynamic _c in Lang13.Enumerate(S.stored_research, typeof(Tech)))
                {
                    current_data = _c;

                    ((dynamic)H).WriteMsg(new Txt("<span class='notice'>Checking ").the(current_data.name).item().str(" database.</span>").ToString());

                    if (GlobalFuncs.do_after(H, S.s_delay, null, this) && G.candrain && this != null)
                    {
                        foreach (dynamic _b in Lang13.Enumerate(this.files.known_tech, typeof(Tech)))
                        {
                            analyzing_data = _b;


                            if (current_data.id == analyzing_data.id)
                            {
                                if (analyzing_data.level > current_data.level)
                                {
                                    ((dynamic)H).WriteMsg("<span class='notice'>Database:</span> <b>UPDATED</b>.");
                                    current_data.level = analyzing_data.level;
                                    _default           = "RDHACK";
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            ((dynamic)H).WriteMsg("<span class='notice'>Data analyzed. Process finished.</span>");
            return(_default);
        }
        // Function from file: suit_attackby.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic total_reagent_transfer = null;
            dynamic reagent_id             = null;
            dynamic R = null;
            double? amount_to_transfer = null;
            dynamic CELL         = null;
            dynamic old_cell     = null;
            dynamic TD           = null;
            Tech    current_data = null;


            if (user == this.affecting)
            {
                if (A is Obj_Item_Weapon_ReagentContainers_Glass)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.reagent_list))
                    {
                        reagent_id = _a;

                        R = ((Reagents)A.reagents).has_reagent(reagent_id);

                        if (Lang13.Bool(R) && (this.reagents.get_reagent_amount(reagent_id) ?1:0) < (this.r_maxamount ?? 0) + (reagent_id == "radium" ? this.a_boost * (this.a_transfer ?? 0) : 0) && Convert.ToDouble(R.volume) >= (this.a_transfer ?? 0))
                        {
                            amount_to_transfer = Num13.MinInt(((int)((this.r_maxamount ?? 0) + (reagent_id == "radium" ? this.a_boost * (this.a_transfer ?? 0) : 0) - (this.reagents.get_reagent_amount(reagent_id) ?1:0))), ((int)(Num13.Floor(Convert.ToDouble(R.volume / this.a_transfer)) * (this.a_transfer ?? 0))));
                            R.volume          -= amount_to_transfer;
                            this.reagents.add_reagent(reagent_id, amount_to_transfer);
                            total_reagent_transfer += amount_to_transfer;
                            user.WriteMsg("Added " + amount_to_transfer + " units of " + R.name + ".");
                            ((Reagents)A.reagents).update_total();
                        }
                    }
                    user.WriteMsg("Replenished a total of " + (Lang13.Bool(total_reagent_transfer) ? total_reagent_transfer : "zero") + " chemical units.");
                    return(null);
                }
                else if (A is Obj_Item_Weapon_StockParts_Cell)
                {
                    CELL = A;

                    if ((CELL.maxcharge ?? 0) > (this.cell.maxcharge ?? 0) && this.n_gloves != null && this.n_gloves.candrain)
                    {
                        user.WriteMsg("<span class='notice'>Higher maximum capacity detected.\nUpgrading...</span>");

                        if (this.n_gloves != null && this.n_gloves.candrain && GlobalFuncs.do_after(user, this.s_delay, null, this))
                        {
                            user.drop_item();
                            CELL.loc        = this;
                            CELL.charge     = Num13.MinInt(Convert.ToInt32(CELL.charge + this.cell.charge), ((int)(CELL.maxcharge ?? 0)));
                            old_cell        = this.cell;
                            old_cell.charge = 0;
                            ((Mob)user).put_in_hands(old_cell);
                            ((Ent_Static)old_cell).add_fingerprint(user);
                            ((Obj_Item_Weapon_StockParts_Cell)old_cell).corrupt();
                            old_cell.updateicon();
                            this.cell = CELL;
                            user.WriteMsg("<span class='notice'>Upgrade complete. Maximum capacity: <b>" + Num13.Floor((this.cell.maxcharge ?? 0) / 100) + "</b>%</span>");
                        }
                        else
                        {
                            user.WriteMsg("<span class='danger'>Procedure interrupted. Protocol terminated.</span>");
                        }
                    }
                    return(null);
                }
                else if (A is Obj_Item_Weapon_Disk_TechDisk)
                {
                    TD = A;

                    if (Lang13.Bool(TD.stored))
                    {
                        user.WriteMsg("Research information detected, processing...");

                        if (GlobalFuncs.do_after(user, this.s_delay, null, this))
                        {
                            foreach (dynamic _b in Lang13.Enumerate(this.stored_research, typeof(Tech)))
                            {
                                current_data = _b;


                                if (current_data.id == TD.stored.id)
                                {
                                    if (current_data.level < Convert.ToInt32(TD.stored.level))
                                    {
                                        current_data.level = Convert.ToInt32(TD.stored.level);                                           // TODO what is TD.stored.level ?
                                    }
                                    break;
                                }
                            }
                            TD.stored = null;
                            user.WriteMsg("<span class='notice'>Data analyzed and updated. Disk erased.</span>");
                        }
                        else
                        {
                            user.WriteMsg("<span class='userdanger'>ERROR</span>: Procedure interrupted. Process terminated.");
                        }
                    }
                    else
                    {
                        A.loc       = this;
                        this.t_disk = A;
                        user.WriteMsg(new Txt("<span class='notice'>You slot ").the(A).item().str(" into ").the(this).item().str(".</span>").ToString());
                    }
                    return(null);
                }
            }
            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);
            return(null);
        }
Example #10
0
        // Function from file: supply.dm
        public void sell(  )
        {
            double      presale_points = 0;
            int         pointsEarned   = 0;
            int         crates         = 0;
            double      plasma         = 0;
            int         intel          = 0;
            string      msg            = null;
            string      sold_atoms     = null;
            Ent_Dynamic AM             = null;
            int?        manifest_found = null;
            Ent_Dynamic thing          = null;
            Ent_Dynamic manifest       = null;
            int?        denied         = null;
            dynamic     stamp          = null;
            Ent_Dynamic P       = null;
            Ent_Dynamic disk    = null;
            Tech        tech    = null;
            double      cost    = 0;
            Ent_Dynamic disk2   = null;
            dynamic     design  = null;
            Ent_Dynamic S       = null;
            bool        potDiff = false;

            presale_points = GlobalVars.SSshuttle.points;
            pointsEarned   = 0;
            crates         = 0;
            plasma         = 0;
            intel          = 0;
            msg            = "";
            sold_atoms     = "";

            foreach (dynamic _c in Lang13.Enumerate(this.areaInstance, typeof(Ent_Dynamic)))
            {
                AM = _c;


                if (Lang13.Bool(AM.anchored))
                {
                    continue;
                }
                sold_atoms += " " + AM.name;

                if (AM is Obj_Structure_Closet_Crate)
                {
                    crates++;
                    sold_atoms += ":";

                    if (!(AM.contents.len != 0))
                    {
                        sold_atoms += " (empty).";
                    }
                    else
                    {
                        manifest_found = GlobalVars.FALSE;

                        foreach (dynamic _b in Lang13.Enumerate(AM, typeof(Ent_Dynamic)))
                        {
                            thing = _b;

                            sold_atoms += " " + thing.name + ",";

                            if (!Lang13.Bool(manifest_found) && thing is Obj_Item_Weapon_Paper_Manifest)
                            {
                                manifest = thing;

                                if (Lang13.Bool(((dynamic)manifest).stamped) && ((dynamic)manifest).stamped.len != 0)
                                {
                                    manifest_found = GlobalVars.TRUE;
                                    denied         = GlobalVars.FALSE;

                                    foreach (dynamic _a in Lang13.Enumerate(((dynamic)manifest).stamped))
                                    {
                                        stamp = _a;


                                        if (stamp == typeof(Obj_Item_Weapon_Stamp_Denied))
                                        {
                                            denied = GlobalVars.TRUE;
                                            break;
                                        }
                                    }

                                    if (Lang13.Bool(((dynamic)manifest).errors) && Lang13.Bool(denied))
                                    {
                                        pointsEarned = Convert.ToInt32(((dynamic)manifest).order_cost - GlobalVars.SSshuttle.points_per_crate);
                                        GlobalVars.SSshuttle.points += pointsEarned;
                                        msg += "+" + pointsEarned + ": Station correctly denied package #" + ((dynamic)manifest).order_id + ": ";

                                        if (Lang13.Bool(((dynamic)manifest).errors & 1))
                                        {
                                            msg += "Destination station incorrect. ";
                                        }
                                        else if (Lang13.Bool(((dynamic)manifest).errors & 2))
                                        {
                                            msg += "Contents incorrectly counted. ";
                                        }
                                        else if (Lang13.Bool(((dynamic)manifest).errors & 4))
                                        {
                                            msg += "Package incomplete. ";
                                        }
                                        msg += "Points refunded.";
                                    }
                                    else if (!Lang13.Bool(((dynamic)manifest).errors) && !Lang13.Bool(denied))
                                    {
                                        pointsEarned = GlobalVars.SSshuttle.points_per_manifest;
                                        GlobalVars.SSshuttle.points += pointsEarned;
                                        msg += "+" + pointsEarned + ": Package " + ((dynamic)manifest).order_id + " accorded.";
                                    }
                                    else if (Lang13.Bool(((dynamic)manifest).errors))
                                    {
                                        pointsEarned = -GlobalVars.SSshuttle.points_per_manifest;
                                        GlobalVars.SSshuttle.points += pointsEarned;
                                        msg += "" + pointsEarned + ": Station erroneously approved package #" + ((dynamic)manifest).order_id + ": ";

                                        if (Lang13.Bool(((dynamic)manifest).errors & 1))
                                        {
                                            msg += "Destination station incorrect.";
                                        }
                                        else if (Lang13.Bool(((dynamic)manifest).errors & 2))
                                        {
                                            msg += "Contents incorrectly counted. ";
                                        }
                                        else if (Lang13.Bool(((dynamic)manifest).errors & 4))
                                        {
                                            msg += "We found unshipped items on our dock.";
                                        }
                                        msg += " Be more vigilant.";
                                    }
                                    else
                                    {
                                        pointsEarned = Num13.Floor(GlobalVars.SSshuttle.points_per_crate - Convert.ToDouble(((dynamic)manifest).order_cost));
                                        GlobalVars.SSshuttle.points += pointsEarned;
                                        msg += "" + pointsEarned + ": Station erroneously denied package #" + ((dynamic)manifest).order_id + ".";
                                    }
                                }
                            }

                            if (thing is Obj_Item_Stack_Sheet_Mineral_Plasma)
                            {
                                P       = thing;
                                plasma += Convert.ToDouble(((dynamic)P).amount);
                            }

                            if (thing is Obj_Item_Documents_Syndicate)
                            {
                                intel++;
                            }

                            if (thing is Obj_Item_Weapon_Disk_TechDisk)
                            {
                                disk = thing;

                                if (!Lang13.Bool(((dynamic)disk).stored))
                                {
                                    continue;
                                }
                                tech = ((dynamic)disk).stored;
                                cost = tech.getCost(GlobalVars.SSshuttle.techLevels[tech.id]);

                                if (cost != 0)
                                {
                                    GlobalVars.SSshuttle.techLevels[tech.id] = tech.level;
                                    GlobalVars.SSshuttle.points += cost;
                                    msg += "+" + cost + ": Data: " + tech.name + ".";
                                }
                            }

                            if (thing is Obj_Item_Weapon_Disk_DesignDisk)
                            {
                                disk2 = thing;

                                if (!Lang13.Bool(((dynamic)disk2).blueprint))
                                {
                                    continue;
                                }
                                design = ((dynamic)disk2).blueprint;

                                if (GlobalVars.SSshuttle.researchDesigns.Contains(design.id))
                                {
                                    continue;
                                }

                                if (Convert.ToDouble(Lang13.Initial(design, "reliability")) < 100 && Convert.ToDouble(design.reliability) >= 100)
                                {
                                    GlobalVars.SSshuttle.points += GlobalVars.SSshuttle.points_per_design;
                                    GlobalVars.SSshuttle.researchDesigns.Add(design.id);
                                    msg += "+" + GlobalVars.SSshuttle.points_per_design + ": Design: " + design.name + ".";
                                }
                            }

                            if (thing is Obj_Item_Seeds)
                            {
                                S = thing;

                                if (Lang13.Bool(((dynamic)S).rarity) == false)
                                {
                                    msg += "+0: We don't need samples of mundane species \"" + GlobalFuncs.capitalize(((dynamic)S).species) + "\".";
                                }
                                else if (Lang13.Bool(GlobalVars.SSshuttle.discoveredPlants[S.type]))
                                {
                                    potDiff = Lang13.Bool(((dynamic)S).potency - GlobalVars.SSshuttle.discoveredPlants[S.type]);

                                    if ((potDiff ?1:0) > 0)
                                    {
                                        GlobalVars.SSshuttle.discoveredPlants[S.type] = ((dynamic)S).potency;
                                        msg += "+" + potDiff + ": New sample of \"" + GlobalFuncs.capitalize(((dynamic)S).species) + "\" is superior.  Good work.";
                                        GlobalVars.SSshuttle.points += potDiff ?1:0;
                                    }
                                    else
                                    {
                                        msg += "+0: New sample of \"" + GlobalFuncs.capitalize(((dynamic)S).species) + "\" is not more potent than existing sample (" + GlobalVars.SSshuttle.discoveredPlants[S.type] + " potency).";
                                    }
                                }
                                else
                                {
                                    GlobalVars.SSshuttle.discoveredPlants[S.type] = ((dynamic)S).potency;
                                    msg += "" + ((dynamic)S).rarity + ": New species discovered: \"" + GlobalFuncs.capitalize(((dynamic)S).species) + "\".  Excellent work.";
                                    GlobalVars.SSshuttle.points += Convert.ToDouble(((dynamic)S).rarity);
                                }
                            }
                            GlobalFuncs.qdel(thing);
                        }
                    }
                }
                GlobalFuncs.qdel(AM);
                sold_atoms += ".";
            }

            if (plasma > 0)
            {
                pointsEarned = Num13.Floor(plasma * GlobalVars.SSshuttle.points_per_plasma);
                msg         += "" + pointsEarned + ": Received " + plasma + " unit(s) of exotic material.";
                GlobalVars.SSshuttle.points += pointsEarned;
            }

            if (intel > 0)
            {
                pointsEarned = Num13.Floor(intel * GlobalVars.SSshuttle.points_per_intel);
                msg         += "" + pointsEarned + ": Received " + intel + " article(s) of enemy intelligence.";
                GlobalVars.SSshuttle.points += pointsEarned;
            }

            if (crates > 0)
            {
                pointsEarned = Num13.Floor(crates * GlobalVars.SSshuttle.points_per_crate);
                msg         += "+" + pointsEarned + ": Received " + crates + " crate(s).";
                GlobalVars.SSshuttle.points += pointsEarned;
            }
            GlobalVars.SSshuttle.centcom_message = msg;
            this.investigate_log("Shuttle contents sold for " + (GlobalVars.SSshuttle.points - presale_points) + " points. Contents: " + (Lang13.Bool(sold_atoms) || Lang13.Bool("none.")) + " Message: " + (Lang13.Bool(GlobalVars.SSshuttle.centcom_message) || Lang13.Bool("none.")), "cargo");
            return;
        }