public ComboTimer(Mobile from, XmlCustomDefenses a, TimeSpan delay) : base(delay) { this.Priority = TimerPriority.OneSecond; this.m_attachment = a; this.m_from = from; }
public static void AddDefense(object target, SpecialDefenses defense) { // is there an existing custom attacks attachment to add to? XmlCustomDefenses a = (XmlCustomDefenses)XmlAttach.FindAttachment(target, typeof(XmlCustomDefenses)); if (a == null) { // add a new custom attacks attachment XmlAttach.AttachTo(target, new XmlCustomDefenses(defense)); } else { // add the new attack to existing attack list a.AddSpecial(defense); } }
public CustomDefenseGump(Mobile from, XmlCustomDefenses a) : base(0, 0) { if (a == null) { return; } if (from != null) { from.CloseGump(typeof(CustomDefenseGump)); } m_attachment = a; int specialcount = a.Specials.Count; // prepare the page AddPage(0); AddBackground(0, 0, 70, 75 + specialcount * vertspacing, 5054); AddLabel(13, 2, 55, "Defense"); // if combos are still active then give it the green light if (m_attachment != null && m_attachment.HasActiveCombos) { // green button //AddImage( 20, 10, 0x2a4e ); AddImage(15, 25, 0x0a53); } else { // red button //AddImage( 20, 10, 0x2a62 ); AddImage(15, 25, 0x0a52); } // go through the list of enabled moves and add buttons for them int y = 70; for (int i = 0; i < specialcount; i++) { SpecialDefense s = (SpecialDefense)m_attachment.Specials[i]; // flag the defense as being selected // this puts a white background behind the selected defense. Doesnt look as nice, but works in both the // 2D and 3D client. I prefer to leave this commented out for best appearance in the 2D client but // feel free to uncomment it for best client compatibility. /* * if(m_attachment != null && m_attachment.m_SelectedDefense != null && m_attachment.m_SelectedDefense == s) * { * AddImageTiled( 2, y-2, 66, vertspacing+2, 0xBBC ); * } */ // add the defense button if (s.IconType == IconTypes.ItemID) { AddButton(5, y, 0x5207, 0x5207, (int)s.DefenseID + 1000, GumpButtonType.Reply, 0); AddImageTiled(5, y, 44, 44, 0x283E); AddItem(5, y, s.Icon); } else { AddButton(5, y, s.Icon, s.Icon, (int)s.DefenseID + 1000, GumpButtonType.Reply, 0); } // flag the defense as being selected // colors the defense icon red. Looks better that the white background highlighting, but only supported by the 2D client. if (m_attachment != null && m_attachment.m_SelectedDefense != null && m_attachment.m_SelectedDefense == s) { if (s.IconType == IconTypes.ItemID) { AddItem(5, y, s.Icon, 33); } else { AddImage(5, y, s.Icon, 33); } } // add the info button AddButton(52, y + 13, 0x4b9, 0x4b9, 2000 + (int)s.DefenseID, GumpButtonType.Reply, 0); y += vertspacing; } }
public CustomDefenseInfoGump(Mobile from, XmlCustomDefenses a, SpecialDefense s) : base(0, 0) { m_attachment = a; m_special = s; // prepare the page AddPage(0); AddBackground(0, 0, 400, 300, 5054); AddAlphaRegion(0, 0, 400, 300); AddLabel(20, 2, 55, String.Format("{0}", s.Name)); StringBuilder text = new StringBuilder(); text.AppendFormat("\n{0}", s.Description); text.AppendFormat("\n\nMinimum Stats/Skills:"); if (s.StrReq > 0) { text.AppendFormat("\n {0} Str", s.StrReq); } if (s.DexReq > 0) { text.AppendFormat("\n {0} Dex", s.DexReq); } if (s.IntReq > 0) { text.AppendFormat("\n {0} Int", s.IntReq); } if (s.Skills != null) { for (int i = 0; i < s.Skills.Length; i++) { if (i < s.MinSkillLevel.Length) { text.AppendFormat("\n {1} {0}", s.Skills[i].ToString(), s.MinSkillLevel[i]); } else { text.AppendFormat("\n {1} {0}", s.Skills[i].ToString(), "???"); } } } text.AppendFormat("\n\nConsumes:"); // generate the text requirements if (s.ManaReq > 0) { text.AppendFormat("\n {0} Mana", s.ManaReq); } if (s.StamReq > 0) { text.AppendFormat("\n {0} Stamina", s.StamReq); } if (s.HitsReq > 0) { text.AppendFormat("\n {0} Hits", s.HitsReq); } if (s.KarmaReq > 0) { text.AppendFormat("\n {0} Karma", s.KarmaReq); } if (s.Reagents != null) { for (int i = 0; i < s.Reagents.Length; i++) { if (i < s.Quantity.Length) { text.AppendFormat("\n {1} {0}", s.Reagents[i].Name, s.Quantity[i]); } else { text.AppendFormat("\n {1} {0}", s.Reagents[i].Name, "???"); } } } AddHtml(20, 20, 360, 260, text.ToString(), true, true); }
public CustomDefenseGump( Mobile from, XmlCustomDefenses a) : base( 0,0) { if(a == null) { return; } if(from != null) from.CloseGump(typeof( CustomDefenseGump)); m_attachment = a; int specialcount = a.Specials.Count; // prepare the page AddPage( 0 ); AddBackground( 0, 0, 70, 75 + specialcount*vertspacing, 5054 ); AddLabel( 13, 2, 55, "Defense" ); // if combos are still active then give it the green light if(m_attachment != null && m_attachment.HasActiveCombos) { // green button //AddImage( 20, 10, 0x2a4e ); AddImage( 15, 25, 0x0a53 ); } else { // red button //AddImage( 20, 10, 0x2a62 ); AddImage( 15, 25, 0x0a52 ); } // go through the list of enabled moves and add buttons for them int y = 70; for(int i = 0;i<specialcount;i++) { SpecialDefense s = (SpecialDefense)m_attachment.Specials[i]; // flag the defense as being selected // this puts a white background behind the selected defense. Doesnt look as nice, but works in both the // 2D and 3D client. I prefer to leave this commented out for best appearance in the 2D client but // feel free to uncomment it for best client compatibility. /* if(m_attachment != null && m_attachment.m_SelectedDefense != null && m_attachment.m_SelectedDefense == s) { AddImageTiled( 2, y-2, 66, vertspacing+2, 0xBBC ); } */ // add the defense button if(s.IconType == IconTypes.ItemID) { AddButton( 5, y, 0x5207, 0x5207, (int)s.DefenseID + 1000, GumpButtonType.Reply, 0 ); AddImageTiled( 5, y, 44, 44, 0x283E ); AddItem(5, y, s.Icon); } else { AddButton( 5, y, s.Icon, s.Icon, (int)s.DefenseID + 1000, GumpButtonType.Reply, 0 ); } // flag the defense as being selected // colors the defense icon red. Looks better that the white background highlighting, but only supported by the 2D client. if(m_attachment != null && m_attachment.m_SelectedDefense != null && m_attachment.m_SelectedDefense == s) { if(s.IconType == IconTypes.ItemID) { AddItem( 5, y, s.Icon, 33 ); } else { AddImage( 5, y, s.Icon, 33 ); } } // add the info button AddButton( 52, y+13, 0x4b9, 0x4b9, 2000+(int)s.DefenseID, GumpButtonType.Reply, 0 ); y += vertspacing; } }
public CustomDefenseInfoGump( Mobile from, XmlCustomDefenses a, SpecialDefense s) : base( 0,0) { m_attachment = a; m_special = s; // prepare the page AddPage( 0 ); AddBackground( 0, 0, 400, 300, 5054 ); AddAlphaRegion( 0, 0, 400, 300 ); AddLabel( 20, 2, 55, String.Format("{0}",s.Name) ); StringBuilder text = new StringBuilder(); text.AppendFormat("\n{0}", s.Description ); text.AppendFormat("\n\nMinimum Stats/Skills:" ); if(s.StrReq > 0) { text.AppendFormat("\n {0} Str", s.StrReq ); } if(s.DexReq > 0) { text.AppendFormat("\n {0} Dex", s.DexReq ); } if(s.IntReq > 0) { text.AppendFormat("\n {0} Int", s.IntReq ); } if(s.Skills != null) for(int i = 0;i < s.Skills.Length;i++) { if(i < s.MinSkillLevel.Length) { text.AppendFormat("\n {1} {0}", s.Skills[i].ToString(), s.MinSkillLevel[i] ); } else { text.AppendFormat("\n {1} {0}", s.Skills[i].ToString(), "???" ); } } text.AppendFormat("\n\nConsumes:" ); // generate the text requirements if(s.ManaReq > 0) { text.AppendFormat("\n {0} Mana", s.ManaReq ); } if(s.StamReq > 0) { text.AppendFormat("\n {0} Stamina", s.StamReq ); } if(s.HitsReq > 0) { text.AppendFormat("\n {0} Hits", s.HitsReq ); } if(s.KarmaReq > 0) { text.AppendFormat("\n {0} Karma", s.KarmaReq ); } if(s.Reagents != null) for(int i = 0;i < s.Reagents.Length;i++) { if(i < s.Quantity.Length) { text.AppendFormat("\n {1} {0}", s.Reagents[i].Name, s.Quantity[i] ); } else { text.AppendFormat("\n {1} {0}", s.Reagents[i].Name, "???" ); } } AddHtml( 20,20, 360, 260, text.ToString(), true , true ); }
public ComboTimer( Mobile from, XmlCustomDefenses a, TimeSpan delay ) : base( delay ) { Priority = TimerPriority.OneSecond; m_attachment = a; m_from = from; }