public void MessageAllExcept(string client, string team, string msgtype, string msgstring, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "", string a11 = "", string a12 = "", string a13 = "") { foreach (coGameConnection recipient in ClientGroup.Where(recipient => ((coGameConnection)recipient != client) && ((coGameConnection)recipient)["team"] != team)) { MessageClient(recipient, msgtype, msgstring, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } }
public void MessageTeam(string team, string msgType, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "", string a11 = "", string a12 = "", string a13 = "") { foreach (coGameConnection clientid in ClientGroup.Where(clientid => ((coGameConnection)clientid)["team"] == team)) { MessageClient(clientid, msgType, msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } }
public void MessageTeamExcept(coGameConnection client, string msgType, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "", string a11 = "", string a12 = "", string a13 = "") { string team = client["team"]; foreach (coGameConnection clientid in ClientGroup.Where(clientid => client["team"] == team && (clientid != client))) { MessageClient(clientid, msgType, msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } }
public void BottomPrintAll(string message, string time, string lines) { if (lines == "" || lines.AsInt() > 3 || lines.AsInt() < 1) { lines = "1"; } foreach (coGameConnection client in ClientGroup.Where(client => !((coGameConnection)client).isAIControlled())) { console.commandToClient(client, "bottomPrint", new[] { message, time, lines }); } }
public virtual void loadMission(string missionName, bool isFirstMission) { EndMission(); console.print("*** LOADING MISSION: " + missionName); console.print("*** Stage 1 load"); // Reset all of these centerPrint.ClearCenterPrintAll(); centerPrint.ClearBottomPrintAll(); // increment the mission sequence (used for ghost sequencing) iGlobal["$missionSequence"] = iGlobal["$missionSequence"] + 1; bGlobal["$missionRunning"] = false; sGlobal["$Server::MissionFile"] = missionName; sGlobal["$Server::LoadFailMsg"] = string.Empty; // Extract mission info from the mission file, // including the display name and stuff to send // to the client. levelInfo.BuildLoadInfo(missionName); // Download mission info to the clients foreach ( GameConnection client in ClientGroup.Where(client => !((GameConnection)client).isAIControlled())) { client.sendLoadInfoToClient(); } // Now that we've sent the LevelInfo to the clients // clear it so that it won't conflict with the actual // LevelInfo loaded in the level levelInfo.ClearLoadInfo(); // if this isn't the first mission, allow some time for the server // to transmit information to the clients: if (isFirstMission || sGlobal["$Server::ServerType"] == "SinglePlayer") { LoadMissionStage2(); } else { Util._schedule(sGlobal["$MissionLoadPause"], "0", "loadMissionStage2"); } }
public void ChatMessageTeam(coGameConnection sender, string team, string msgString, string a1 = "", string a2 = "", string a3 = "", string a4 = "", string a5 = "", string a6 = "", string a7 = "", string a8 = "", string a9 = "", string a10 = "") { if ((msgString.Trim().Length == 0) || SpamAlert(sender)) { return; } foreach (coGameConnection obj in ClientGroup.Where(obj => ((coGameConnection)obj)["team"] == sender["team"])) { ChatMessageClient(obj, sender, console.GetVarString(string.Format("{0}.voiceTag", sender)), console.GetVarString(string.Format("{0}.voicePitch", sender)), msgString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } }
public bool SpawnPlayer(coGameConnection client, string spawnpoint, bool nocontrol) { coPlayer player = client["player"]; if (player.isObject()) { console.error("Attempting to create a player for a client that already has one!"); return(false); } if ((spawnpoint.Split(' ').GetUpperBound(0) == 0) && (spawnpoint.isObject())) { // Attempt to treat %spawnPoint as an object string spawnclass = Game__DefaultPlayerClass; string spawndatablock = Game__DefaultPlayerDataBlock; coSimObject ospawnpoint = spawnpoint; // Overrides by the %spawnPoint if (ospawnpoint["spawnClass"] != "") { spawnclass = ospawnpoint["spawnClass"]; spawndatablock = ospawnpoint["spawnDataBlock"]; } else if (ospawnpoint["spawnDatablock"] != "") { // This may seem redundant given the above but it allows // the SpawnSphere to override the datablock without // overriding the default player class spawndatablock = ospawnpoint["spawnDatablock"]; } string spawnproperties = ospawnpoint["spawnProperties"]; string spawnScript = ospawnpoint["spawnScript"]; // Spawn with the engine's Sim::spawnObject() function player = console.SpawnObject(spawnclass, spawndatablock, "", spawnproperties, spawnScript); // If we have an object do some initial setup if (console.isObject(player)) { // Pick a location within the spawn sphere. player.setTransform(PointInSpawnSphere(player, ((coSpawnSphere)spawnpoint))); } else { // If we weren't able to create the player object then warn the user // When the player clicks OK in one of these message boxes, we will fall through // to the "if (!isObject(%player))" check below. if (console.GetVarString(spawndatablock).Trim() != "") { console.Call("MessageBoxOK", new[] { "Spawn Player Failed", "Unable to create a player with class " + spawnclass + " and datablock " + spawndatablock + ".\n\nStarting as an Observer instead.", "" }); } else { console.Call("MessageBoxOK", new[] { "Spawn Player Failed", "Unable to create a player with class " + spawnclass + ".\n\nStarting as an Observer instead.", "" }); } } } else { // Create a default player player = console.SpawnObject(Game__DefaultPlayerClass, Game__DefaultPlayerDataBlock, "", "", ""); if (player.isMemberOfClass("Player")) { //if (SimObject.SimObject_isMemberOfClass(player, "Player")) console.warn("Trying to spawn a class that does not derive from player!!!!!"); } // Treat %spawnPoint as a transform player.setTransform(new TransformF(spawnpoint)); } // Update the default camera to start with the player if (!console.isObject(player)) { client["spawnCamera"] = spawnpoint; return(false); } ((coSimSet)"MissionCleanup").pushToBack(player); // Update the default camera to start with the player // Store the client object on the player object for // future reference player["client"] = client; // If the player's client has some owned turrets, make sure we let them // know that we're a friend too. if (client["ownedTurrets"].AsInt() >= 1) { coSimSet turrets = client["ownedTurrets"]; for (uint i = 0; i < turrets.getCount(); i++) { ((coTurretShape)turrets.getObject(i)).call("addToIgnoreList", player); } } player.setShapeName(client["playerName"]); player.setEnergyLevel(((coPlayerData)player.getDataBlock())["maxEnergy"].AsFloat()); if (client["skin"] != "") { string availableSkins = ((coPlayerData)player.getDataBlock())["availableSkins"]; foreach (coGameConnection other in ClientGroup.Where(other => other != client)) { availableSkins = availableSkins.Replace(console.GetVarString(other + ".skin"), " "); availableSkins = availableSkins.Replace(" ", " "); } List <string> availskin = availableSkins.Split('\t').ToList(); if (availskin.Count > 0) { int r = new Random().Next(0, availskin.Count - 1); client["skin"] = availskin[r]; } } player.setSkinName(client["skin"]); client["player"] = player; coSimObject control = null; if (console.GetVarString("$startWorldEditor") == "1") { control = client["camera"]; console.Call("EditorGui", "syncCameraGui"); } else { control = player; } if (!nocontrol) { client.setControlObject(control); } int team = new Random().Next(1, 2); AddObjectTo_MobSearchGroup(player, team); MessageClient(client, "System", "Your on Team " + team); console.error(DateTime.Now + " --- PLAYER JOIN::Name '" + Util.StripMLControlChars(player.getShapeName()) + "'::ID '" + player + "'"); return(true); }