public ConvoTimer(BaseConvo owner, Mobile m) : base(TimeSpan.FromSeconds(30.0)) { m_Owner = owner; m_Mob = m; Priority = TimerPriority.OneSecond; }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; while (true) { for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } if (test < Attitude.Neutral) { test = (Attitude)(((int)test) + 1); } else if (test > Attitude.Neutral) { test = (Attitude)(((int)test) - 1); } else { break; } } return(null); }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } // If we're here, it means that no corresponding attitude phrase has been found. // What happens when no matching Attitude is found? There's a generic npc response. // So basically, we'll find a pseudo "closest" attitude to use. //If Belligerent -> go to Random(Wicked, Neutral) // If Kindly -> go to Random(Neutral, Goodhearted) // Then retry. Attitude closeAttitude; int result = -1; int index = -1; Random rnd = new Random(); if (test == Attitude.Belligerent) { int[] attitudes = { 0, 2 }; index = rnd.Next(attitudes.Length); result = attitudes[index]; Console.WriteLine(result); } else if (test == Attitude.Kindly) { int[] attitudes = { 2, 4 }; index = rnd.Next(attitudes.Length); result = attitudes[index]; } closeAttitude = (Attitude)result; for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == closeAttitude) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } return(null); }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; int iat = (int)npc.Attitude; if (pc.Fame > 4000) { iat++; if (pc.Fame > 9000) { iat++; } } if (iat >= 4) { test = Attitude.Goodhearted; } else if (iat <= 0) { test = Attitude.Wicked; } else { test = (Attitude)iat; } while (true) { for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } if (test < Attitude.Neutral) { test = (Attitude)(((int)test) + 1); } else if (test > Attitude.Neutral) { test = (Attitude)(((int)test) - 1); } else { break; } } return(null); }
public string GetString(BaseConvo npc, Mobile pc, string said) { for (int i = 0; i < m_Keys.Count; i++) { Keyword k = (Keyword)m_Keys[i]; if (k.Match(said)) { string str = null; for (int s = 0; s < k.Lists.Length && str == null; s++) { str = k.Lists[s].GetString(npc, pc); } return(str); } } return(null); }
public string GetString(BaseConvo npc, Mobile pc) { NotoVal noto = GetNotoValFor(pc); for (int i = 0; i < m_Notos.Length; i++) { if (m_Notos[i] == noto || m_Notos[i] == noto + 1 || m_Notos[i] == noto - 1) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } return(null); }
public string GetString(BaseConvo npc, Mobile pc) { if (m_Strings != null && m_Strings.Count > 0) { object obj = m_Strings[Utility.Random(m_Strings.Count)]; if (obj is string) { return((string)obj); } else if (obj is string[]) { return(((string[])obj)[pc.Female ? 1 : 0]); } else { return(null); } } else { return(null); } }
public string GetString(BaseConvo npc, Mobile pc, string said) { int soph = (int)npc.Sophistication; string str = null; str = m_Collections[soph].GetString(npc, pc, said); if (str == null) { if (soph == (int)Sophistication.High) { soph--; } else if (soph == (int)Sophistication.Low) { soph++; } else { return(null); } str = m_Collections[soph].GetString(npc, pc, said); } return(str); }
public string GetString(BaseConvo npc, Mobile pc, string said) { int soph = (int)npc.Sophistication; string str = null; str = m_Collections[soph].GetString(npc, pc, said); if (str == null) { if (soph == (int)Sophistication.High) soph--; else if (soph == (int)Sophistication.Low) soph++; else return null; str = m_Collections[soph].GetString(npc, pc, said); } return str; }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; int iat = (int)npc.Attitude; if (pc.Fame > 4000) { iat++; if (pc.Fame > 9000) iat++; } if (iat >= 4) test = Attitude.Goodhearted; else if (iat <= 0) test = Attitude.Wicked; else test = (Attitude)iat; while (true) { for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) str = m_Strings[s].GetString(npc, pc); return str; } } if (test < Attitude.Neutral) test = (Attitude)(((int)test) + 1); else if (test > Attitude.Neutral) test = (Attitude)(((int)test) - 1); else break; } return null; }
public string GetString(BaseConvo npc, Mobile pc) { if (m_Strings != null && m_Strings.Count > 0) { object obj = m_Strings[Utility.Random(m_Strings.Count)]; if (obj is string) return (string)obj; else if (obj is string[]) return ((string[])obj)[pc.Female ? 1 : 0]; else return null; } else { return null; } }
public string GetString(BaseConvo npc, Mobile pc) { NotoVal noto = GetNotoValFor(pc); for (int i = 0; i < m_Notos.Length; i++) { if (m_Notos[i] == noto || m_Notos[i] == noto + 1 || m_Notos[i] == noto - 1) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) str = m_Strings[s].GetString(npc, pc); return str; } } return null; }
public string GetString(BaseConvo npc, Mobile pc, string said) { for (int i = 0; i < m_Keys.Count; i++) { Keyword k = (Keyword)m_Keys[i]; if (k.Match(said)) { string str = null; for (int s = 0; s < k.Lists.Length && str == null; s++) str = k.Lists[s].GetString(npc, pc); return str; } } return null; }
public string GetString( BaseConvo npc, Mobile pc ) { Attitude test = npc.Attitude; while ( true ) { for(int i=0;i<m_Atts.Length;i++) { if ( m_Atts[i] == test ) { string str = null; for(int s=0;s<m_Strings.Length && str == null;s++) str = m_Strings[s].GetString( npc, pc ); return str; } } if ( test < Attitude.Neutral ) test = (Attitude)( ((int)test) + 1 ); else if ( test > Attitude.Neutral ) test = (Attitude)( ((int)test) - 1 ); else break; } return null; }