// Function from file: pai.dm public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null) { dynamic candidate = null; dynamic card = null; Mob_Living_Silicon_Pai pai = null; dynamic candidate2 = null; dynamic option = null; dynamic t = null; Obj_Item_Device_Paicard p = null; if (Lang13.Bool(href_list["download"])) { candidate = Lang13.FindObj(href_list["candidate"]); card = Lang13.FindObj(href_list["device"]); if (Lang13.Bool(card.pai)) { return(null); } if (card is Obj_Item_Device_Paicard && candidate is PaiCandidate) { pai = new Mob_Living_Silicon_Pai(card); if (!Lang13.Bool(candidate.name)) { pai.name = Rand13.PickFromTable(GlobalVars.ninja_names); } else { pai.name = candidate.name; } pai.real_name = pai.name; pai.key = candidate.key; ((Obj_Item_Device_Paicard)card).setPersonality(pai); card.looking_for_personality = false; ((GameMode)GlobalVars.ticker.mode).update_cult_icons_removed(card.pai.mind); ((GameMode)GlobalVars.ticker.mode).update_rev_icons_removed(card.pai.mind); this.candidates.Remove(candidate); Interface13.Browse(Task13.User, null, "window=findPai"); } } if (Lang13.Bool(href_list["new"])) { candidate2 = Lang13.FindObj(href_list["candidate"]); option = href_list["option"]; t = ""; dynamic _b = option; // Was a switch-case, sorry for the mess. if (_b == "name") { t = Interface13.Input("Enter a name for your pAI", "pAI Name", candidate2.name, null, null, InputType.Str); if (Lang13.Bool(t)) { candidate2.name = String13.SubStr(GlobalFuncs.sanitize(t), 1, 26); } } else if (_b == "desc") { t = Interface13.Input("Enter a description for your pAI", "pAI Description", candidate2.description, null, null, InputType.StrMultiline); if (Lang13.Bool(t)) { candidate2.description = String13.SubStr(GlobalFuncs.sanitize(t), 1, 1024); } } else if (_b == "role") { t = Interface13.Input("Enter a role for your pAI", "pAI Role", candidate2.role, null, null, InputType.Str); if (Lang13.Bool(t)) { candidate2.role = String13.SubStr(GlobalFuncs.sanitize(t), 1, 1024); } } else if (_b == "ooc") { t = Interface13.Input("Enter any OOC comments", "pAI OOC Comments", candidate2.comments, null, null, InputType.StrMultiline); if (Lang13.Bool(t)) { candidate2.comments = String13.SubStr(GlobalFuncs.sanitize(t), 1, 1024); } } else if (_b == "save") { ((PaiCandidate)candidate2).savefile_save(Task13.User); } else if (_b == "load") { ((PaiCandidate)candidate2).savefile_load(Task13.User); if (Lang13.Bool(candidate2.name)) { candidate2.name = String13.SubStr(GlobalFuncs.sanitize(candidate2.name), 1, 26); } if (Lang13.Bool(candidate2.description)) { candidate2.description = String13.SubStr(GlobalFuncs.sanitize(candidate2.description), 1, 1024); } if (Lang13.Bool(candidate2.role)) { candidate2.role = String13.SubStr(GlobalFuncs.sanitize(candidate2.role), 1, 1024); } if (Lang13.Bool(candidate2.comments)) { candidate2.comments = String13.SubStr(GlobalFuncs.sanitize(candidate2.comments), 1, 1024); } } else if (_b == "submit") { if (Lang13.Bool(candidate2)) { candidate2.ready = 1; foreach (dynamic _a in Lang13.Enumerate(typeof(Game13), typeof(Obj_Item_Device_Paicard))) { p = _a; if (p.looking_for_personality) { p.alertUpdate(); } } } Interface13.Browse(Task13.User, null, "window=paiRecruit"); return(null); } this.recruitWindow(Task13.User); } return(null); }
// Function from file: pai.dm public void findPAI(Obj_Item_Device_Paicard p = null, Mob user = null) { ByTable available = null; PaiCandidate c = null; bool found = false; Mob_Dead_Observer o = null; string dat = null; PaiCandidate c2 = null; this.requestRecruits(); available = new ByTable(); foreach (dynamic _b in Lang13.Enumerate(GlobalVars.SSpai.candidates, typeof(PaiCandidate))) { c = _b; if (c.ready) { found = false; foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list, typeof(Mob_Dead_Observer))) { o = _a; if (o.key == c.key) { found = true; } } if (found) { available.Add(c); } } } dat = ""; dat += @" <style type=""text/css""> p.top { background-color: #AAAAAA; color: black; } tr.d0 td { background-color: #CC9999; color: black; } tr.d1 td { background-color: #9999CC; color: black; } tr.d2 td { background-color: #99CC99; color: black; } </style> " ; dat += "<p class=\"top\">Requesting AI personalities from central database... If there are no entries, or if a suitable entry is not listed, check again later as more personalities may be added.</p>"; dat += "<table>"; foreach (dynamic _c in Lang13.Enumerate(available, typeof(PaiCandidate))) { c2 = _c; dat += "<tr class=\"d0\"><td>Name:</td><td>" + c2.name + "</td></tr>"; dat += "<tr class=\"d1\"><td>Description:</td><td>" + c2.description + "</td></tr>"; dat += "<tr class=\"d0\"><td>Preferred Role:</td><td>" + c2.role + "</td></tr>"; dat += "<tr class=\"d1\"><td>OOC Comments:</td><td>" + c2.comments + "</td></tr>"; dat += new Txt("<tr class=\"d2\"><td><a href='byond://?src=").Ref(this).str(";download=1;candidate=").Ref(c2).str(";device=").Ref(p).str("'>[Download ").item(c2.name).str("]</a></td><td></td></tr>").ToString(); } dat += "</table>"; Interface13.Browse(user, dat, "window=findPai"); return; }