public void AddEnemy(Guild g) { if (!Enemies.Contains(g)) { Enemies.Add(g); g.AddEnemy(this); } }
public override void OnResponse(NetState sender, RelayInfo info) { int m_Rank = (m_Mobile as PlayerMobile).GuildRank; if (m_Guild.BadMember(m_Mobile)) { return; } switch (info.ButtonID) { case 0: { m_Mobile.CloseGump <ReceiveWarGump>(); BaseGuild[] guilds = Guild.Search(""); m_Mobile.SendGump(new DiplomacyGump(m_Mobile, m_Guild, new ArrayList(guilds), 2)); break; } case 201: { if (m_Rank != 4 && m_Rank != 5) { m_Mobile.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. return; } if (i_Guild != null) { m_Guild.WarInvitations.Remove(i_Guild); i_Guild.WarDeclarations.Remove(m_Guild); i_Guild.RemoveEnemy(m_Guild); i_Guild.DelWar(m_Guild); m_Mobile.CloseGump <ReceiveWarGump>(); } break; } case 200: { if (m_Rank != 4 && m_Rank != 5) { m_Mobile.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. return; } if (i_Guild != null) { m_Guild.WarInvitations.Remove(i_Guild); i_Guild.WarDeclarations.Remove(m_Guild); m_Guild.AddEnemy(i_Guild); Guild a_Guild, wa_Guild; if (m_Guild.Allies.Count > 0) { for (int i = 0; i < m_Guild.Allies.Count; i++) { a_Guild = m_Guild.Allies[i] as Guild; a_Guild.WarInitializations.Add(i_Guild); a_Guild.AddWar(i_Guild, 0, i_Guild.GetMaxKills(m_Guild), i_Guild.GetWarTime(m_Guild), i_Guild.GetExpTime(m_Guild)); a_Guild.AddEnemy(i_Guild); if (i_Guild.AllianceLeader) { for (int j = 0; j < i_Guild.Allies.Count; j++) { wa_Guild = i_Guild.Allies[j] as Guild; a_Guild.AddWar(wa_Guild, 0, i_Guild.GetMaxKills(m_Guild), i_Guild.GetWarTime(m_Guild), i_Guild.GetExpTime(m_Guild)); a_Guild.AddEnemy(wa_Guild); wa_Guild.AddWar(a_Guild, 0, i_Guild.GetMaxKills(m_Guild), i_Guild.GetWarTime(m_Guild), i_Guild.GetExpTime(m_Guild)); wa_Guild.AddEnemy(a_Guild); } } } } m_Guild.AddWar(i_Guild, 0, i_Guild.GetMaxKills(m_Guild), i_Guild.GetWarTime(m_Guild), i_Guild.GetExpTime(m_Guild)); if (i_Guild.AllianceLeader) { for (int i = 0; i < i_Guild.Allies.Count; i++) { a_Guild = i_Guild.Allies[i] as Guild; m_Guild.AddWar(a_Guild, 0, i_Guild.GetMaxKills(m_Guild), i_Guild.GetWarTime(m_Guild), i_Guild.GetExpTime(m_Guild)); m_Guild.AddEnemy(a_Guild); } } m_Guild.WarInitializations.Add(i_Guild); m_Guild.GuildMessage(1018020, ""); // Guild Message: Your guild is now at war. i_Guild.GuildMessage(1018020, ""); // Guild Message: Your guild is now at war. m_Mobile.SendLocalizedMessage(1070752); // The proposal has been updated. m_Mobile.CloseGump <ReceiveWarGump>(); } break; } case 202: { if (m_Rank != 4 && m_Rank != 5) { m_Mobile.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars. return; } if (i_Guild != null) { m_Guild.WarInvitations.Remove(i_Guild); i_Guild.WarDeclarations.Remove(m_Guild); i_Guild.RemoveEnemy(m_Guild); i_Guild.DelWar(m_Guild); } m_Mobile.CloseGump <ReceiveWarGump>(); m_Mobile.SendGump(new DeclareWarGump(m_Mobile, i_Guild)); break; } } }
public void AddEnemy( Guild g ) { if ( !m_Enemies.Contains( g ) ) { m_Enemies.Add( g ); g.AddEnemy( this ); } }