public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile pm = sender.Mobile as PlayerMobile; if (!IsMember(pm, guild)) { return; } RankDefinition playerRank = pm.GuildRank; WarDeclaration war = guild.FindPendingWar(m_Other); WarDeclaration activeWar = guild.FindActiveWar(m_Other); WarDeclaration otherWar = m_Other.FindPendingWar(guild); AllianceInfo alliance = guild.Alliance; AllianceInfo otherAlliance = m_Other.Alliance; switch (info.ButtonID) { #region War case 5: //Accept the war { if (war != null && !war.WarRequester && activeWar == null) { if (!playerRank.GetFlag(RankFlags.ControlWarStatus)) { pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. } else { //Accept the war guild.PendingWars.Remove(war); war.WarBeginning = DateTime.Now; guild.AcceptedWars.Add(war); if (guild.Alliance != null && guild.Alliance.IsMember(guild)) { guild.Alliance.AllianceMessage(1070769, ((m_Other.Alliance != null) ? m_Other.Alliance.Name : m_Other.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~ guild.Alliance.InvalidateMemberProperties(); } else { guild.GuildMessage(1070769, ((m_Other.Alliance != null) ? m_Other.Alliance.Name : m_Other.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~ guild.InvalidateMemberProperties(); } //Technically SHOULD say Your guild is now at war w/out any info, intentional diff. m_Other.PendingWars.Remove(otherWar); otherWar.WarBeginning = DateTime.Now; m_Other.AcceptedWars.Add(otherWar); if (m_Other.Alliance != null && m_Other.Alliance.IsMember(m_Other)) { m_Other.Alliance.AllianceMessage(1070769, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~ m_Other.Alliance.InvalidateMemberProperties(); } else { m_Other.GuildMessage(1070769, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name)); // Guild Message: Your guild is now at war with ~1_GUILDNAME~ m_Other.InvalidateMemberProperties(); } } } break; } case 6: //Modify war terms { if (war != null && !war.WarRequester && activeWar == null) { if (!playerRank.GetFlag(RankFlags.ControlWarStatus)) { pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. } else { pm.SendGump(new WarDeclarationGump(pm, guild, m_Other)); } } break; } case 7: //Dismiss war { if (war != null) { if (!playerRank.GetFlag(RankFlags.ControlWarStatus)) { pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. } else { //Dismiss the war guild.PendingWars.Remove(war); m_Other.PendingWars.Remove(otherWar); pm.SendLocalizedMessage(1070752); // The proposal has been updated. //Messages to opposing guild? (Testing on OSI says no) } } break; } case 8: //Surrender { if (!playerRank.GetFlag(RankFlags.ControlWarStatus)) { pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. } else { if (activeWar != null) { if (guild.Alliance != null && guild.Alliance.IsMember(guild)) { guild.Alliance.AllianceMessage(1070740, ((m_Other.Alliance != null) ? m_Other.Alliance.Name : m_Other.Name)); // You have lost the war with ~1_val~. guild.Alliance.InvalidateMemberProperties(); } else { guild.GuildMessage(1070740, ((m_Other.Alliance != null) ? m_Other.Alliance.Name : m_Other.Name)); // You have lost the war with ~1_val~. guild.InvalidateMemberProperties(); } guild.AcceptedWars.Remove(activeWar); if (m_Other.Alliance != null && m_Other.Alliance.IsMember(m_Other)) { m_Other.Alliance.AllianceMessage(1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name)); // You have won the war against ~1_val~! m_Other.Alliance.InvalidateMemberProperties(); } else { m_Other.GuildMessage(1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name)); // You have won the war against ~1_val~! m_Other.InvalidateMemberProperties(); } m_Other.AcceptedWars.Remove(m_Other.FindActiveWar(guild)); } } break; } case 1: //Declare War { if (war == null && activeWar == null) { if (!playerRank.GetFlag(RankFlags.ControlWarStatus)) { pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. } else if (alliance != null && alliance.Leader != guild) { pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead. } else if (otherAlliance != null && otherAlliance.Leader != m_Other) { pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", m_Other.Name, otherAlliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage(1070707, otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead. } else { pm.SendGump(new WarDeclarationGump(pm, guild, m_Other)); } } break; } #endregion case 2: //Request Alliance { #region New alliance if (alliance == null) { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance. } else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader)) { pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance. } else if (otherAlliance != null) { if (otherAlliance.IsPendingMember(m_Other)) { pm.SendLocalizedMessage(1063416, m_Other.Name); // ~1_val~ is currently considering another alliance proposal. } else { pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance. } } else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0) { pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war. } else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0) { pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war. } else { pm.SendLocalizedMessage(1063439); // Enter a name for the new alliance: pm.BeginPrompt(new PromptCallback(CreateAlliance_Callback)); } } #endregion #region Existing Alliance else { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (alliance.Leader != guild) { pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance. } else if (otherAlliance != null) { if (otherAlliance.IsPendingMember(m_Other)) { pm.SendLocalizedMessage(1063416, m_Other.Name); // ~1_val~ is currently considering another alliance proposal. } else { pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance. } } else if (alliance.IsPendingMember(guild)) { pm.SendLocalizedMessage(1063416, guild.Name); // ~1_val~ is currently considering another alliance proposal. } else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0) { pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war. } else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0) { pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war. } else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader)) { pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance. } else { pm.SendLocalizedMessage(1070750, m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~. m_Other.GuildMessage(1070780, guild.Name); // ~1_val~ has proposed an alliance. m_Other.Alliance = alliance; //Calls addPendingGuild //alliance.AddPendingGuild( m_Other ); } } #endregion break; } case 10: //Show Alliance Roster { if (alliance != null && alliance == otherAlliance) { pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, alliance)); } break; } case 11: //Leave Alliance { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (alliance != null && alliance.IsMember(guild)) { guild.Alliance = null; //Calls alliance.Removeguild // alliance.RemoveGuild( guild ); } break; } case 12: //Remove Guild from alliance { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (alliance != null && alliance.Leader != guild) { pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance. } else if (alliance != null && alliance.IsMember(guild) && alliance.IsMember(m_Other)) { m_Other.Alliance = null; } break; } case 13: //Promote to Alliance leader { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (alliance != null && alliance.Leader != guild) { pm.SendLocalizedMessage(1063239, String.Format("{0}\t{1}", guild.Name, alliance.Name)); // ~1_val~ is not the leader of the ~2_val~ alliance. } else if (alliance != null && alliance.IsMember(guild) && alliance.IsMember(m_Other)) { pm.SendLocalizedMessage(1063434, String.Format("{0}\t{1}", m_Other.Name, alliance.Name)); // ~1_val~ is now the leader of ~2_val~. alliance.Leader = m_Other; } break; } case 14: //Withdraw Request { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (alliance != null && alliance.Leader == guild && alliance.IsPendingMember(m_Other)) { m_Other.Alliance = null; pm.SendLocalizedMessage(1070752); // The proposal has been updated. } break; } case 15: //Deny Alliance Request { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember(guild)) { pm.SendLocalizedMessage(1070752); // The proposal has been updated. //m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. //Per OSI commented out. guild.Alliance = null; } break; } case 16: //Accept Alliance Request { if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1063436); // You don't have permission to negotiate an alliance. } else if (otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember(guild)) { pm.SendLocalizedMessage(1070752); // The proposal has been updated. otherAlliance.TurnToMember(m_Other); //No need to verify it's in the guild or already a member, the function does this otherAlliance.TurnToMember(guild); } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { base.OnResponse(sender, info); PlayerMobile pm = (PlayerMobile)sender.Mobile; if (!IsMember(pm, guild)) { return; } switch (info.ButtonID) { //1-3 handled by base.OnResponse case 4: { if (IsLeader(pm, guild)) { pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max): pm.BeginPrompt(SetCharter_Callback, true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of "" } break; } case 5: { if (IsLeader(pm, guild)) { pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max): pm.BeginPrompt(SetWebsite_Callback, true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of "" } break; } case 6: { //Alliance Roster if (guild.Alliance != null && guild.Alliance.IsMember(guild)) { pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, guild.Alliance)); } break; } case 7: { //Resign if (!m_IsResigning) { pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild? pm.SendGump(new GuildInfoGump(pm, guild, true, false)); } else { guild.RemoveMember(pm, 1063411); // You resign from your guild. } break; } case 8: if (pm.Young) { pm.SendLocalizedMessage(1155562); // Young players may not join Vice vs Virtue. Renounce your young player status by saying, "I renounce my young player status" and try again. } else { pm.SendGump(new Engines.VvV.ConfirmSignupGump(pm)); } break; case 9: if (Engines.Points.PointsSystem.ViceVsVirtue.IsResigning(pm, guild)) { pm.SendLocalizedMessage(1155560); // You are currently in the process of quitting Vice vs Virtue. } else if (m_IsResigningVvV) { pm.SendLocalizedMessage(1155559); // You have begun the Vice vs Virtue resignation process. You will be removed from VvV in 3 days. Engines.Points.PointsSystem.ViceVsVirtue.OnResign(pm); } else { pm.SendLocalizedMessage(1155558); // Are you sure you wish to resign from Vice vs Virtue? You will not be allowed to rejoin for 3 days. pm.SendGump(new GuildInfoGump(pm, guild, false, true)); } break; case 10: pm.SendGump(new Engines.VvV.ViceVsVirtueLeaderboardGump(pm)); break; } }