// Function from file: supply.dm public void buy( ) { ByTable empty_turfs = null; Tile_Simulated_Floor T = null; double value = 0; int purchases = 0; SupplyOrder SO = null; if (!(GlobalVars.SSshuttle.shoppinglist.len != 0)) { return; } empty_turfs = new ByTable(); foreach (dynamic _a in Lang13.Enumerate(this.areaInstance, typeof(Tile_Simulated_Floor))) { T = _a; if (T.density || T.contents.len != 0) { continue; } empty_turfs.Add(T); } value = 0; purchases = 0; foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSshuttle.shoppinglist, typeof(SupplyOrder))) { SO = _b; if (!(empty_turfs.len != 0)) { break; } if (SO.pack.cost > GlobalVars.SSshuttle.points) { continue; } GlobalVars.SSshuttle.points -= SO.pack.cost; value += SO.pack.cost; GlobalVars.SSshuttle.shoppinglist.Remove(SO); GlobalVars.SSshuttle.orderhistory.Add(SO); SO.generate(GlobalFuncs.pick_n_take(empty_turfs)); this.investigate_log("Order #" + SO.id + " (" + SO.pack.name + ", placed by " + GlobalFuncs.key_name(SO.orderer_ckey) + ") has shipped.", "cargo"); if (SO.pack.dangerous) { GlobalFuncs.message_admins(new Txt().A(SO.pack.name).item().str(" ordered by ").item(GlobalFuncs.key_name_admin(SO.orderer_ckey)).str(" has shipped.").ToString()); } purchases++; } this.investigate_log("" + purchases + " orders in this shipment, worth " + value + " points. " + GlobalVars.SSshuttle.points + " points left.", "cargo"); return; }
// Function from file: console.dm public override ByTable ui_data(dynamic user = null) { ByTable data = null; dynamic pack = null; dynamic P = null; SupplyOrder SO = null; SupplyOrder SO2 = null; data = new ByTable(); data["requestonly"] = this.requestonly; data["location"] = GlobalVars.SSshuttle.supply.getStatusText(); data["points"] = GlobalVars.SSshuttle.points; data["away"] = GlobalVars.SSshuttle.supply.getDockedId() == "supply_away"; data["docked"] = GlobalVars.SSshuttle.supply.mode == 0; data["loan"] = !(!(GlobalVars.SSshuttle.shuttle_loan != null)); data["loan_dispatched"] = GlobalVars.SSshuttle.shuttle_loan != null && GlobalVars.SSshuttle.shuttle_loan.dispatched; data["message"] = Lang13.Bool(GlobalVars.SSshuttle.centcom_message) || Lang13.Bool("Remember to stamp and send back the supply manifests."); data["supplies"] = new ByTable(); foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSshuttle.supply_packs)) { pack = _a; P = GlobalVars.SSshuttle.supply_packs[pack]; if (!Lang13.Bool(data["supplies"][P.group])) { data["supplies"][P.group] = new ByTable().Set("name", P.group).Set("packs", new ByTable()); } if (Lang13.Bool(P.hidden) && !Lang13.Bool(this.emagged) || Lang13.Bool(P.contraband) && !this.contraband) { continue; } data["supplies"][P.group]["packs"] += new ByTable(new object [] { new ByTable().Set("name", P.name).Set("cost", P.cost).Set("id", pack) }); } data["cart"] = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSshuttle.shoppinglist, typeof(SupplyOrder))) { SO = _b; data["cart"] += new ByTable(new object [] { new ByTable().Set("object", SO.pack.name).Set("cost", SO.pack.cost).Set("id", SO.id) }); } data["requests"] = new ByTable(); foreach (dynamic _c in Lang13.Enumerate(GlobalVars.SSshuttle.requestlist, typeof(SupplyOrder))) { SO2 = _c; data["requests"] += new ByTable(new object [] { new ByTable().Set("object", SO2.pack.name).Set("cost", SO2.pack.cost).Set("orderer", SO2.orderer).Set("reason", SO2.reason).Set("id", SO2.id) }); } return(data); }
// Function from file: console.dm public override int?ui_act(string action = null, ByTable _params = null, Tgui ui = null, UiState state = null) { int?_default = null; dynamic id = null; dynamic name = null; dynamic rank = null; string ckey = null; Mob H = null; dynamic reason = null; dynamic T = null; SupplyOrder SO = null; double? id2 = null; SupplyOrder SO2 = null; double? id3 = null; SupplyOrder SO3 = null; double? id4 = null; SupplyOrder SO4 = null; if (Lang13.Bool(base.ui_act(action, _params, ui, state))) { return(_default); } if (action != "add" && this.requestonly) { return(_default); } switch ((string)(action)) { case "send": if (GlobalVars.SSshuttle.supply.canMove()) { this.say("For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons."); return(_default); } if (GlobalVars.SSshuttle.supply.getDockedId() == "supply_home") { GlobalVars.SSshuttle.moveShuttle("supply", "supply_away", GlobalVars.TRUE); this.say("The supply shuttle has departed."); this.investigate_log("" + GlobalFuncs.key_name(Task13.User) + " sent the supply shuttle away.", "cargo"); } else { this.investigate_log("" + GlobalFuncs.key_name(Task13.User) + " called the supply shuttle.", "cargo"); this.say("The supply shuttle has been called and will arrive in " + GlobalVars.SSshuttle.supply.timeLeft(600) + " minutes."); GlobalVars.SSshuttle.moveShuttle("supply", "supply_home", GlobalVars.TRUE); } _default = GlobalVars.TRUE; break; case "loan": if (!(GlobalVars.SSshuttle.shuttle_loan != null)) { return(_default); } else if (GlobalVars.SSshuttle.supply.mode == 0) { GlobalVars.SSshuttle.shuttle_loan.loan_shuttle(); this.say("The supply shuttle has been loaned to Centcom."); _default = GlobalVars.TRUE; } break; case "add": id = _params["id"]; if (!Lang13.Bool(GlobalVars.SSshuttle.supply_packs[id])) { return(_default); } name = "*None Provided*"; rank = "*None Provided*"; ckey = Task13.User.ckey; if (Task13.User is Mob_Living_Carbon_Human) { H = Task13.User; name = ((Mob_Living_Carbon_Human)H).get_authentification_name(); rank = ((Mob_Living_Carbon_Human)H).get_assignment(); } else if (Task13.User is Mob_Living_Silicon) { name = Task13.User.real_name; rank = "Silicon"; } reason = ""; if (this.requestonly) { reason = Interface13.Input("Reason:", name, "", null, null, InputType.Str | InputType.Null); if (reason == null || Lang13.Bool(base.ui_act(action, _params, ui, state))) { return(_default); } } T = GlobalFuncs.get_turf(this); SO = new SupplyOrder(id, name, rank, ckey, reason); SO.generateRequisition(T); if (this.requestonly) { GlobalVars.SSshuttle.requestlist.Add(SO); } else { GlobalVars.SSshuttle.shoppinglist.Add(SO); } _default = GlobalVars.TRUE; break; case "remove": id2 = String13.ParseNumber(_params["id"]); foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSshuttle.shoppinglist, typeof(SupplyOrder))) { SO2 = _a; if (SO2.id == id2) { GlobalVars.SSshuttle.shoppinglist.Remove(SO2); _default = GlobalVars.TRUE; break; } } break; case "clear": GlobalVars.SSshuttle.shoppinglist.Cut(); _default = GlobalVars.TRUE; break; case "approve": id3 = String13.ParseNumber(_params["id"]); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSshuttle.requestlist, typeof(SupplyOrder))) { SO3 = _b; if (SO3.id == id3) { GlobalVars.SSshuttle.requestlist.Remove(SO3); GlobalVars.SSshuttle.shoppinglist.Add(SO3); _default = GlobalVars.TRUE; break; } } break; case "deny": id4 = String13.ParseNumber(_params["id"]); foreach (dynamic _c in Lang13.Enumerate(GlobalVars.SSshuttle.requestlist, typeof(SupplyOrder))) { SO4 = _c; if (SO4.id == id4) { GlobalVars.SSshuttle.requestlist.Remove(SO4); _default = GlobalVars.TRUE; break; } } break; case "denyall": GlobalVars.SSshuttle.requestlist.Cut(); _default = GlobalVars.TRUE; break; } if (Lang13.Bool(_default)) { this.post_signal("supply"); } return(_default); }