Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,83 +1,84 @@
using System;
using Server.Mobiles;
using Server.Network;
namespace Server.Gumps
{
public class PetResurrectGump : Gump
{
private BaseCreature m_Pet;
private double m_HitsScalar;
public class PetResurrectGump : Gump
{
private double m_HitsScalar;
private BaseCreature m_Pet;
public PetResurrectGump( Mobile from, BaseCreature pet )
: this( from, pet, 0.0 )
{
}
public PetResurrectGump(Mobile from, BaseCreature pet)
: this(from, pet, 0.0)
{
}
public PetResurrectGump( Mobile from, BaseCreature pet, double hitsScalar ) : base( 50, 50 )
{
from.CloseGump( typeof( PetResurrectGump ) );
public PetResurrectGump(Mobile from, BaseCreature pet, double hitsScalar) : base(50, 50)
{
from.CloseGump(typeof(PetResurrectGump));
m_Pet = pet;
m_HitsScalar = hitsScalar;
m_Pet = pet;
m_HitsScalar = hitsScalar;
AddPage( 0 );
AddPage(0);
AddBackground( 10, 10, 265, 140, 0x242C );
AddBackground(10, 10, 265, 140, 0x242C);
AddItem( 205, 40, 0x4 );
AddItem( 227, 40, 0x5 );
AddItem(205, 40, 0x4);
AddItem(227, 40, 0x5);
AddItem( 180, 78, 0xCAE );
AddItem( 195, 90, 0xCAD );
AddItem( 218, 95, 0xCB0 );
AddItem(180, 78, 0xCAE);
AddItem(195, 90, 0xCAD);
AddItem(218, 95, 0xCB0);
AddHtmlLocalized( 30, 30, 150, 75, 1049665, false, false ); // <div align=center>Wilt thou sanctify the resurrection of:</div>
AddHtml( 30, 70, 150, 25, $"<div align=CENTER>{pet.Name}</div>", true, false );
AddHtmlLocalized(30, 30, 150, 75, 1049665, false,
false); // <div align=center>Wilt thou sanctify the resurrection of:</div>
AddHtml(30, 70, 150, 25, $"<div align=CENTER>{pet.Name}</div>", true, false);
AddButton( 40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0 ); // Okay
AddButton( 110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0 ); // Cancel
}
AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0); // Okay
AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0); // Cancel
}
public override void OnResponse( NetState state, RelayInfo info )
{
if ( m_Pet.Deleted || !m_Pet.IsBonded || !m_Pet.IsDeadPet )
return;
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Pet.Deleted || !m_Pet.IsBonded || !m_Pet.IsDeadPet)
return;
Mobile from = state.Mobile;
Mobile from = state.Mobile;
if ( info.ButtonID == 1 )
{
if ( m_Pet.Map == null || !m_Pet.Map.CanFit( m_Pet.Location, 16, false, false ) )
{
from.SendLocalizedMessage( 503256 ); // You fail to resurrect the creature.
return;
}
if (info.ButtonID == 1)
{
if (m_Pet.Map == null || !m_Pet.Map.CanFit(m_Pet.Location, 16, false, false))
{
from.SendLocalizedMessage(503256); // You fail to resurrect the creature.
return;
}
if ( m_Pet.Region != null && m_Pet.Region.IsPartOf( "Khaldun" ) ) //TODO: Confirm for pets, as per Bandage's script.
{
from.SendLocalizedMessage( 1010395 ); // The veil of death in this area is too strong and resists thy efforts to restore life.
return;
}
if (m_Pet.Region != null && m_Pet.Region.IsPartOf("Khaldun")
) //TODO: Confirm for pets, as per Bandage's script.
{
from.SendLocalizedMessage(
1010395); // The veil of death in this area is too strong and resists thy efforts to restore life.
return;
}
m_Pet.PlaySound( 0x214 );
m_Pet.FixedEffect( 0x376A, 10, 16 );
m_Pet.ResurrectPet();
m_Pet.PlaySound(0x214);
m_Pet.FixedEffect(0x376A, 10, 16);
m_Pet.ResurrectPet();
double decreaseAmount;
double decreaseAmount;
if ( from == m_Pet.ControlMaster )
decreaseAmount = 0.1;
else
decreaseAmount = 0.2;
if (from == m_Pet.ControlMaster)
decreaseAmount = 0.1;
else
decreaseAmount = 0.2;
for ( int i = 0; i < m_Pet.Skills.Length; ++i ) //Decrease all skills on pet.
m_Pet.Skills[i].Base -= decreaseAmount;
for (int i = 0; i < m_Pet.Skills.Length; ++i) //Decrease all skills on pet.
m_Pet.Skills[i].Base -= decreaseAmount;
if ( !m_Pet.IsDeadPet && m_HitsScalar > 0 )
m_Pet.Hits = (int)(m_Pet.HitsMax * m_HitsScalar);
}
}
}
}
if (!m_Pet.IsDeadPet && m_HitsScalar > 0)
m_Pet.Hits = (int)(m_Pet.HitsMax * m_HitsScalar);
}
}
}
}