public static void SendMessageToDiscord(string message, KothConfig config) { if (Ready && AlliancePlugin.config.DiscordChannelId > 0 && config.doDiscordMessages) { DiscordChannel chann = Discord.GetChannelAsync(AlliancePlugin.config.DiscordChannelId).Result; botId = Discord.SendMessageAsync(chann, message.Replace("/n", "\n")).Result.Author.Id; } else { ShipyardCommands.SendMessage(config.KothName, message, Color.LightGreen, 0L); } }
private static Task Discord_MessageCreated(DSharpPlus.EventArgs.MessageCreateEventArgs e) { if (AlliancePlugin.config.DiscordChannelId == e.Channel.Id) { if (e.Author.IsBot) { ShipyardCommands.SendMessage(e.Author.Username, e.Message.Content, Color.LightGreen, 0L); } } return(Task.CompletedTask); }
public static void SendChatMessageFromDiscord(Guid allianceId, string prefix, string message, ulong discordId = 0) { log.Info(allianceId.ToString() + " : " + prefix + " " + message); Alliance alliance = AlliancePlugin.GetAllianceNoLoading(allianceId); List <ulong> OtherMembers = new List <ulong>(); foreach (MyPlayer player in MySession.Static.Players.GetOnlinePlayers()) { MyFaction fac = MySession.Static.Factions.TryGetPlayerFaction(player.Identity.IdentityId) as MyFaction; if (fac != null) { if (alliance.AllianceMembers.Contains(fac.FactionId)) { OtherMembers.Add(player.Id.SteamId); } } } if (discordId > 0) { log.Info(allianceId.ToString() + " : " + alliance.name + " : " + prefix + " " + message + " discord id " + discordId); } else { log.Info(allianceId.ToString() + " : " + alliance.name + " : " + prefix + " " + message + " the bot"); } foreach (ulong id in OtherMembers) { ShipyardCommands.SendMessage(prefix, message, new Color(alliance.r, alliance.g, alliance.b), (long)id); MyGpsCollection gpscol = (MyGpsCollection)MyAPIGateway.Session?.GPS; if (ScanChat(message, null) != null) { MyGps gpsRef = ScanChat(message, null); gpsRef.GPSColor = Color.Yellow; gpsRef.AlwaysVisible = true; gpsRef.ShowOnHud = true; long idenId = MySession.Static.Players.TryGetIdentityId(id); MyAPIGateway.Utilities.InvokeOnGameThread(() => { gpscol.SendAddGps(idenId, ref gpsRef); }); } } }
public static void SendChatMessage(Guid allianceId, string prefix, string message, bool toDiscord, long playerId) { prefix = prefix.Replace(":", ""); Alliance alliance = AlliancePlugin.GetAllianceNoLoading(allianceId); List <ulong> OtherMembers = new List <ulong>(); message = message.Replace("@", ""); log.Info(allianceId.ToString() + " : " + alliance.name + " : " + prefix + " " + message); if (toDiscord && DiscordStuff.AllianceHasBot(allianceId)) { try { DiscordStuff.SendAllianceMessage(alliance, prefix, message); } catch (Exception ex) { AlliancePlugin.Log.Error(ex); if (DiscordStuff.debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord", "Bot not connected 1", Color.Blue, (long)player.Id.SteamId); } } } } else { if (DiscordStuff.debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord", "Bot not connected 2", Color.Blue, (long)player.Id.SteamId); } } } foreach (MyPlayer player in MySession.Static.Players.GetOnlinePlayers()) { if (player.Identity.IdentityId == playerId) { ShipyardCommands.SendMessage("Alliance chat", "You are in alliance chat.", new Color(alliance.r, alliance.g, alliance.b), (long)player.Id.SteamId); continue; } MyFaction fac = MySession.Static.Factions.TryGetPlayerFaction(player.Identity.IdentityId) as MyFaction; if (fac != null) { if (alliance.AllianceMembers.Contains(fac.FactionId)) { OtherMembers.Add(player.Id.SteamId); } } } foreach (ulong id in OtherMembers) { ShipyardCommands.SendMessage(prefix, message, new Color(alliance.r, alliance.g, alliance.b), (long)id); MyGpsCollection gpscol = (MyGpsCollection)MyAPIGateway.Session?.GPS; if (ScanChat(message, null) != null) { MyGps gpsRef = ScanChat(message, null); gpsRef.GPSColor = Color.Yellow; gpsRef.AlwaysVisible = true; gpsRef.ShowOnHud = true; long idenId = MySession.Static.Players.TryGetIdentityId(id); gpscol.SendAddGps(idenId, ref gpsRef); } } }
private static Task Discord_AllianceMessage(DSharpPlus.EventArgs.MessageCreateEventArgs e) { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord", "Got a message " + e.Message.ChannelId + " " + e.Channel.Id, Color.Blue, (long)player.Id.SteamId); } } if (allianceChannels.ContainsKey(e.Channel.Id)) { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord 1", "Is an alliance channel " + e.Message.ChannelId + " " + e.Channel.Id, Color.Blue, (long)player.Id.SteamId); } } if (e.Author.IsBot) { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord 2", "Bot message " + e.Message.ChannelId + " " + e.Channel.Id, Color.Blue, (long)player.Id.SteamId); } } //if (LastMessageSent.ContainsKey(allianceChannels[e.Channel.Id])) //{ // if (LastMessageSent[allianceChannels[e.Channel.Id]].Equals(e.Message.Content)) // { // return Task.CompletedTask; // } //} String[] split = e.Message.Content.Split(':'); int i = 0; if (WorldName.Equals("") && MyMultiplayer.Static.HostName != null) { if (MyMultiplayer.Static.HostName.Contains("SENDS")) { WorldName = MyMultiplayer.Static.HostName.Replace("SENDS", ""); } else { if (MyMultiplayer.Static.HostName.Equals("Sigma Draconis Lobby")) { WorldName = "01"; } else { WorldName = MyMultiplayer.Static.HostName; } } } String exclusionBeforeFormat = GetStringBetweenCharacters(split[0], '[', ']'); if (!exclusionBeforeFormat.Contains(WorldName)) { StringBuilder message = new StringBuilder(); foreach (String s in split) { if (i == 0) { i++; continue; } message.Append(s); } StringBuilder newMessage = new StringBuilder(); string output = e.Message.Content.Substring(e.Message.Content.IndexOf(':') + 1); AllianceChat.SendChatMessageFromDiscord(allianceChannels[e.Channel.Id], split[0].Replace("**", ""), output.Replace("**", "").Trim(), 0); } } else { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord 3", "Player message " + e.Message.ChannelId + " " + e.Channel.Id, Color.Blue, (long)player.Id.SteamId); } } if (WorldName.Equals("") && MyMultiplayer.Static.HostName != null) { if (MyMultiplayer.Static.HostName.Contains("SENDS")) { WorldName = MyMultiplayer.Static.HostName.Replace("SENDS", ""); } else { if (MyMultiplayer.Static.HostName.Equals("Sigma Draconis Lobby")) { WorldName = "01"; } else { WorldName = MyMultiplayer.Static.HostName; } } } if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord 4", "Player message 1", Color.Blue, (long)player.Id.SteamId); } } //if (nickNames.ContainsKey(e.Message.Author.Id)) //{ // if (debugMode) // { // if (MySession.Static.Players.GetPlayerByName("Crunch") != null) // { // MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); // ShipyardCommands.SendMessage("Discord 5", "Player message 2", Color.Blue, (long)player.Id.SteamId); // } // } AllianceChat.SendChatMessageFromDiscord(allianceChannels[e.Channel.Id], "[D] " + e.Message.Author.Username, e.Message.Content.Trim(), e.Author.Id); //} //else //{ // if (debugMode) // { // if (MySession.Static.Players.GetPlayerByName("Crunch") != null) // { // MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); // ShipyardCommands.SendMessage("Discord 6", "Player message 3", Color.Blue, (long)player.Id.SteamId); // } // } // Task.Run(async () => // { // String nick; // DiscordMember mem = await e.Guild.GetMemberAsync(e.Author.Id); // nick = mem.Nickname; // if (String.IsNullOrEmpty(nick)) // { // nickNames.Add(e.Message.Author.Id, mem.DisplayName); // } // else // { // nickNames.Add(e.Message.Author.Id, nick); // } // AllianceChat.SendChatMessageFromDiscord(allianceChannels[e.Channel.Id], "[D] " + nickNames[e.Message.Author.Id], e.Message.Content.Trim(), e.Author.Id); // }); //} //e.Message.Author. //String nick = e.Guild.GetMemberAsync(e.Author.Id).Result.Nickname; //if (String.IsNullOrEmpty(nick)) //{ //} //else //{ // AllianceChat.SendChatMessageFromDiscord(allianceChannels[e.Channel.Id], "[D] " + nick, e.Message.Content.Trim(), e.Author.Id); //} } } else { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord 3", "Message channel not alliance channel " + e.Message.ChannelId + " " + e.Channel.Id, Color.Blue, (long)player.Id.SteamId); } } } return(Task.CompletedTask); }
public static void SendAllianceMessage(Alliance alliance, string prefix, string message) { if (AllianceHasBot(alliance.AllianceId) && alliance.DiscordChannelId > 0) { DiscordClient bot = allianceBots[alliance.AllianceId]; DiscordChannel chann = bot.GetChannelAsync(alliance.DiscordChannelId).Result; if (bot == null) { return; } if (WorldName.Equals("") && MyMultiplayer.Static.HostName != null) { if (MyMultiplayer.Static.HostName.Contains("SENDS")) { WorldName = MyMultiplayer.Static.HostName.Replace("SENDS", ""); } else { if (MyMultiplayer.Static.HostName.Equals("Sigma Draconis Lobby")) { WorldName = "01"; } else { WorldName = MyMultiplayer.Static.HostName; } } } try { botId = bot.SendMessageAsync(chann, "**[" + WorldName + "] " + prefix + "**: " + message.Replace(" /n", "\n")).Result.Author.Id; } catch (DSharpPlus.Exceptions.RateLimitException) { if (attempt <= 5) { attempt++; SendAllianceMessage(alliance, prefix, message); attempt = 0; } else { attempt = 0; } } catch (System.Net.Http.HttpRequestException) { AllianceChat.SendChatMessageFromDiscord(alliance.AllianceId, "Bot", "Failed to send message.", 0); } catch (Exception ex) { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord", "" + ex.ToString(), Color.Blue, (long)player.Id.SteamId); } } } } else { if (debugMode) { if (MySession.Static.Players.GetPlayerByName("Crunch") != null) { MyPlayer player = MySession.Static.Players.GetPlayerByName("Crunch"); ShipyardCommands.SendMessage("Discord", "doesnt have bot or channel id is 0", Color.Blue, (long)player.Id.SteamId); } } } }
public static void TestPatchMethod(MyDrillBase __instance, MyVoxelMaterialDefinition material, VRageMath.Vector3 hitPosition, int removedAmount, bool onlyCheck) { if (__instance.OutputInventory != null && __instance.OutputInventory.Owner != null) { if (__instance.OutputInventory.Owner.GetBaseEntity() is MyShipDrill shipDrill) { if (drill == null) { drill = __instance.GetType(); } if (string.IsNullOrEmpty(material.MinedOre)) { return; } if (!onlyCheck) { long playerId = 0; bool HasContract = false; foreach (IMyCockpit cockpit in shipDrill.CubeGrid.GetFatBlocks().OfType <IMyCockpit>()) { if (cockpit.Pilot != null) { MyCharacter pilot = cockpit.Pilot as MyCharacter; if (playerWithContract.ContainsKey(pilot.GetPlayerIdentityId())) { PlayerStorage storage = playerWithContract[pilot.GetPlayerIdentityId()]; if (storage.CheckIfInMiningArea(hitPosition, material.MinedOre)) { playerId = pilot.GetPlayerIdentityId(); HasContract = true; break; } } } } if (!HasContract) { return; } MyObjectBuilder_Ore newObject = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_Ore>(material.MinedOre); newObject.MaterialTypeName = new MyStringHash?(material.Id.SubtypeId); float num = (float)((double)removedAmount / (double)byte.MaxValue * 1.0) * __instance.VoxelHarvestRatio * material.MinedOreRatio; if (!MySession.Static.AmountMined.ContainsKey(material.MinedOre)) { MySession.Static.AmountMined[material.MinedOre] = (MyFixedPoint)0; } MySession.Static.AmountMined[material.MinedOre] += (MyFixedPoint)num; MyPhysicalItemDefinition physicalItemDefinition = MyDefinitionManager.Static.GetPhysicalItemDefinition((MyObjectBuilder_Base)newObject); MyFixedPoint amountItems1 = (MyFixedPoint)(num / physicalItemDefinition.Volume); MyFixedPoint maxAmountPerDrop = (MyFixedPoint)(float)(0.150000005960464 / (double)physicalItemDefinition.Volume); MyFixedPoint collectionRatio = (MyFixedPoint)drill.GetField("m_inventoryCollectionRatio", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); MyFixedPoint b = amountItems1 * ((MyFixedPoint)1 - collectionRatio); MyFixedPoint amountItems2 = MyFixedPoint.Min(maxAmountPerDrop * 10 - (MyFixedPoint)0.001, b); MyFixedPoint totalAmount = amountItems1 * collectionRatio - amountItems2; if (playerWithContract[playerId].AddToContractAmount(material.MinedOre, totalAmount.ToIntSafe())) { foreach (ContractHolder contractHolder in playerWithContract[playerId].MiningContracts.Values) { if (contractHolder.contract.subTypeId.Equals(material.MinedOre)) { ShipyardCommands.SendMessage("Big Boss Dave", "Contract progress :" + material.MinedOre + " " + contractHolder.minedAmount + " / " + contractHolder.amountToMine, Color.Gold, (long)MySession.Static.Players.TryGetSteamId(playerId)); } } } } } else { return; } } }
public void UnlockHangar() { if (!AlliancePlugin.config.HangarEnabled) { Context.Respond("Alliance hangar is not enabled."); return; } Boolean console = false; if (Context.Player == null) { console = true; } MyFaction fac = MySession.Static.Factions.GetPlayerFaction(Context.Player.IdentityId); if (fac == null) { Context.Respond("You must be in a faction to use alliance features."); return; } Alliance alliance = AlliancePlugin.GetAlliance(fac); if (alliance == null) { Context.Respond("You are not a member of an alliance."); return; } if (AlliancePlugin.HasFailedUpkeep(alliance)) { Context.Respond("Alliance failed to pay upkeep. Upgrades disabled."); return; } if (!alliance.hasUnlockedHangar) { ConcurrentBag <MyGroups <MyCubeGrid, MyGridPhysicalGroupData> .Group> gridWithSubGrids = GridFinder.FindLookAtGridGroup(Context.Player.Character); List <MyCubeGrid> grids = new List <MyCubeGrid>(); foreach (var item in gridWithSubGrids) { foreach (MyGroups <MyCubeGrid, MyGridPhysicalGroupData> .Node groupNodes in item.Nodes) { MyCubeGrid grid = groupNodes.NodeData; if (grid.Projector != null) { continue; } if (FacUtils.GetPlayersFaction(FacUtils.GetOwner(grid)) != null) { if (FacUtils.InSameFaction(FacUtils.GetOwner(grid), Context.Player.IdentityId)) { if (!grids.Contains(grid)) { grids.Add(grid); } } } else { if (FacUtils.GetOwner(grid).Equals(Context.Player.Identity.IdentityId)) { if (!grids.Contains(grid)) { grids.Add(grid); } } } } } //Do stuff with taking components from grid storage //GridCosts localGridCosts = GetComponentsAndCost(projectedGrid); //gridCosts.setComponents(localGridCosts.getComponents()); UpgradeCost cost = new UpgradeCost(); List <VRage.Game.ModAPI.IMyInventory> invents = new List <VRage.Game.ModAPI.IMyInventory>(); foreach (MyCubeGrid grid in grids) { invents.AddList(ShipyardCommands.GetInventories(grid)); } cost = ShipyardCommands.LoadUnlockCost(AlliancePlugin.path + "//HangarUnlockCost.txt"); if (cost != null) { if (cost.MetaPointCost > 0) { if (alliance.CurrentMetaPoints < cost.MetaPointCost) { Context.Respond("Cannot afford the meta point cost of " + cost.MetaPointCost); return; } } if (cost.MoneyRequired > 0) { if (EconUtils.getBalance(Context.Player.IdentityId) >= cost.MoneyRequired) { if (ShipyardCommands.ConsumeComponents(invents, cost.itemsRequired, Context.Player.SteamUserId)) { alliance.CurrentMetaPoints -= cost.MetaPointCost; EconUtils.takeMoney(Context.Player.IdentityId, cost.MoneyRequired); alliance.hasUnlockedHangar = true; HangarData hangar = alliance.LoadHangar(); AlliancePlugin.SaveAllianceData(alliance); ShipyardCommands.SendMessage("[Alliance Hangar]", "Unlocking the hangar. You were charged: " + String.Format("{0:n0}", cost.MoneyRequired) + " and components taken", Color.Green, (long)Context.Player.SteamUserId); } } else { ShipyardCommands.SendMessage("[Alliance Hangar]", "You cant afford the upgrade price of: " + String.Format("{0:n0}", cost.MoneyRequired), Color.Red, (long)Context.Player.SteamUserId); } } else { if (ShipyardCommands.ConsumeComponents(invents, cost.itemsRequired, Context.Player.SteamUserId)) { alliance.CurrentMetaPoints -= cost.MetaPointCost; alliance.hasUnlockedHangar = true; HangarData hangar = alliance.LoadHangar(); AlliancePlugin.SaveAllianceData(alliance); } } } else { Context.Respond("Error loading upgrade details."); return; } } }
public void Upgrade(Boolean upgrade = false) { if (!AlliancePlugin.config.HangarEnabled) { Context.Respond("Hangar not enabled."); return; } if (Context.Player != null) { IMyFaction faction = FacUtils.GetPlayersFaction(Context.Player.IdentityId); if (faction == null) { ShipyardCommands.SendMessage("[Hangar]", " You arent in a faction.", Color.Red, (long)Context.Player.SteamUserId); return; } Alliance alliance = AlliancePlugin.GetAlliance(faction as MyFaction); if (alliance == null) { Context.Respond("You are not a member of an alliance with an unlocked shipyard."); return; } if (AlliancePlugin.HasFailedUpkeep(alliance)) { Context.Respond("Alliance failed to pay upkeep. Upgrades disabled."); return; } if (!alliance.hasUnlockedHangar) { ShipyardCommands.SendMessage("[Alliance Hangar]", "To unlock use !ah unlock", Color.Cyan, (long)Context.Player.SteamUserId); return; } HangarData hangar = alliance.LoadHangar(); UpgradeCost cost = new UpgradeCost(); if (!upgrade) { ShipyardCommands.SendMessage("[Alliance Hangar]", "To upgrade use !ah upgrade true ,while looking at an owned grid.", Color.Cyan, (long)Context.Player.SteamUserId); StringBuilder sb = new StringBuilder(); try { cost = slotUpgrades[hangar.SlotUpgradeNum += 1]; } catch (Exception ex) { Context.Respond("Cannot upgrade any further as there are no more defined upgrade files."); return; } if (cost != null) { if (cost.MoneyRequired > 0) { ShipyardCommands.SendMessage("[Alliance Hangar]", "SC Cost for next slot upgrade " + String.Format("{0:n0}", cost.MoneyRequired), Color.Cyan, (long)Context.Player.SteamUserId); } if (cost.MetaPointCost > 0) { ShipyardCommands.SendMessage("[Alliance Hangar]", "Metapoint cost for next slot upgrade " + cost.MetaPointCost, Color.Cyan, (long)Context.Player.SteamUserId); } sb.AppendLine("Items required."); foreach (KeyValuePair <MyDefinitionId, int> id in cost.itemsRequired) { sb.AppendLine(id.Key.ToString() + " - " + id.Value); } Context.Respond(sb.ToString()); } } else { ConcurrentBag <MyGroups <MyCubeGrid, MyGridMechanicalGroupData> .Group> gridWithSubGrids = GridFinder.FindLookAtGridGroupMechanical(Context.Player.Character); List <MyCubeGrid> grids = new List <MyCubeGrid>(); foreach (var item in gridWithSubGrids) { foreach (MyGroups <MyCubeGrid, MyGridMechanicalGroupData> .Node groupNodes in item.Nodes) { MyCubeGrid grid = groupNodes.NodeData; if (grid.Projector != null) { continue; } if (FacUtils.GetPlayersFaction(FacUtils.GetOwner(grid)) != null) { if (FacUtils.InSameFaction(FacUtils.GetOwner(grid), Context.Player.IdentityId)) { if (!grids.Contains(grid)) { grids.Add(grid); } } } else { if (FacUtils.GetOwner(grid).Equals(Context.Player.Identity.IdentityId)) { if (!grids.Contains(grid)) { grids.Add(grid); } } } } } List <VRage.Game.ModAPI.IMyInventory> invents = new List <VRage.Game.ModAPI.IMyInventory>(); foreach (MyCubeGrid grid in grids) { invents.AddList(ShipyardCommands.GetInventories(grid)); } if (hangar.SlotsAmount >= AlliancePlugin.config.MaxHangarSlots) { Context.Respond("Cannot upgrade any further"); return; } try { cost = slotUpgrades[hangar.SlotUpgradeNum += 1]; } catch (Exception) { Context.Respond("Cannot upgrade any further as there are no more defined upgrade files."); return; } if (cost != null) { if (cost.MetaPointCost > 0) { if (alliance.CurrentMetaPoints < cost.MetaPointCost) { Context.Respond("Cannot afford the meta point cost of " + cost.MetaPointCost); return; } } if (cost.MoneyRequired > 0) { if (EconUtils.getBalance(Context.Player.IdentityId) >= cost.MoneyRequired) { if (ShipyardCommands.ConsumeComponents(invents, cost.itemsRequired, Context.Player.SteamUserId)) { alliance.CurrentMetaPoints -= cost.MetaPointCost; EconUtils.takeMoney(Context.Player.IdentityId, cost.MoneyRequired); hangar.SlotsAmount = (int)cost.NewLevel; hangar.SlotUpgradeNum++; hangar.SaveHangar(alliance); AlliancePlugin.SaveAllianceData(alliance); ShipyardCommands.SendMessage("[Alliance Hangar]", "Upgrading slots. You were charged: " + String.Format("{0:n0}", cost.MoneyRequired), Color.LightBlue, (long)Context.Player.SteamUserId); } } else { ShipyardCommands.SendMessage("[Alliance Hangar]", "You cant afford the upgrade price of: " + String.Format("{0:n0}", cost.MoneyRequired), Color.Red, (long)Context.Player.SteamUserId); } } else { if (ShipyardCommands.ConsumeComponents(invents, cost.itemsRequired, Context.Player.SteamUserId)) { alliance.CurrentMetaPoints -= cost.MetaPointCost; hangar.SlotsAmount = (int)cost.NewLevel; hangar.SlotUpgradeNum++; hangar.SaveHangar(alliance); AlliancePlugin.SaveAllianceData(alliance); } } } else { Context.Respond("Error loading upgrade details."); return; } } } }