RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[Runuo 2.0 RC1-RC2 Rus / Eng ] Full sleeping system от NewUO

newuo

Sorceror
[Runuo 2.0 RC1-RC2 Rus / Eng ] Full sleeping system от NewUO

Description / Описание

Full system of sleeping, meal and thirst.

By using completed beds for sleeping, we added new parameter - sleeping.

Now players will need to sleep for refreshing their powers.
(May be used in hotels)
Player can sleep only on special beds, and his sleeping parameter increase during sleeping.

****************************************************

Полная система сна жажды и еды.

Используя готовые кровати для сна, мы добавили новый параметр - сон.
Теперь игрокам нужно будет спать, чтобы восстановить силы.
(К этому можно привязать пустые гостинцы в мире уо)

Игрок ложится спать на специальную кровать, и у него восстанавливается параметр сна.

Install / Установка :cool:


1. Coppy all scripts / Копировать новые скрипты
2. Find and delete defolt FoodDecay.cs / Удалить стандартный скрипт FoodDecay.cs
3. Edit PlayerMobile.cs / Изменить PlayerMobile.cs

Find
private DateTime m_LastOnline;
private Server.Guilds.RankDefinition m_GuildRank;
private int m_GuildMessageHue, m_AllianceMessageHue;
add

private bool m_Sleeping;
public bool Sleeping { get{ return m_Sleeping; } set { m_Sleeping = value; }}

Find
[CommandProperty( AccessLevel.GameMaster )]
public bool PublicMyRunUO
{
get{ return GetFlag( PlayerFlag.PublicMyRunUO ); }
set{ SetFlag( PlayerFlag.PublicMyRunUO, value ); InvalidateMyRunUO(); }
}

[CommandProperty( AccessLevel.GameMaster )]
public bool AcceptGuildInvites
{
get{ return GetFlag( PlayerFlag.AcceptGuildInvites ); }
set{ SetFlag( PlayerFlag.AcceptGuildInvites, value ); }
}

add

[CommandProperty( AccessLevel.GameMaster )]
public int Sleep { get { return m_Sleep; } set { m_Sleep = value; } }
private int m_Sleep;


fined

public PlayerMobile()

add

m_Sleep = 20;

Find

if( m_AcquiredRecipes == null )
{
writer.Write( (int)0 );

add befor if( m_AcquiredRecipes == null )

writer.Write( (int) Sleep );
writer.Write((bool) m_Sleeping);

find

public override void Deserialize( GenericReader reader )

add

Sleep = reader.ReadInt();

find public override void Deserialize( GenericReader reader )

add cose

case ?:
{
m_Sleeping = reader.ReadBool();
goto case ?;
}

Addon / Дополнение

To sleeping parametre you can add everything, what you want. For example if your character wants to sleep, you can add increasing misses chance and add losing of stamina.

basewapon.cs
find
if (attacker is PlayerMobile)

add
Code:
                    else if (aapm.Sleep <= 3)
                    {                
                        aapm.Stam -= 3;
                        aapm.SendMessage( "You want to sleep" );
                    }
                    else if (aapm.Sleep <= 1)
                    {                    
                        AOS.Damage( attacker, Utility.RandomMinMax( 8, 10 ), 100, 0, 0, 0, 0 );
                        aapm.SendMessage( "You are very tired." );
                    }


You can add your own gump with the indicator of sleeping,thirst and meal, as type of my...
Вы можете добавить свой гамп, с индикаторами сна жажды и еды
Example / Пример

Code:
			//AddLabel( 15, 180, 1152, "Голод" );
			AddHtmlLocalized( 15, 180, 1152, 20, 3006536, owner.Exp.ToString(),SergeClassSystem.TextHue,false, false );
			AddImageTiled( 15, 200, 150, 14, 0x2340 );
			AddImage( 15, 200, 0x233F );
			AddImage( 165, 200, 0x2341 );
			percent = (double)owner.Hunger / 20;
			pos = (int)( 148.0 * percent );
			AddImage( 15 + pos, 200, 0x233E );

			//AddLabel( 15, 215, 1152, "Жажда" );
			AddHtmlLocalized( 15, 215, 1152, 20, 3006539, owner.Exp.ToString(),SergeClassSystem.TextHue,false, false );			
			AddImageTiled( 15, 235, 150, 14, 0x2340 );
			AddImage( 15, 235, 0x233F );
			AddImage( 165, 235, 0x2341 );
			percent = (double)owner.Thirst / 20;
			pos = (int)( 148.0 * percent );
			AddImage( 15 + pos, 235, 0x233E );

			//AddLabel( 15, 250, 1152, "Сон" );
			AddHtmlLocalized( 15, 250, 1152, 20, 3006249, owner.Exp.ToString(),SergeClassSystem.TextHue,false, false );		
			AddImageTiled( 15, 270, 150, 14, 0x2340 );
			AddImage( 15, 270, 0x233F );
			AddImage( 165, 270, 0x2341 );
			percent = (double)owner.Sleep / 30;
			pos = (int)( 148.0 * percent );	
			AddImage( 15 + pos, 270, 0x233E );





Example from NewUO server
Так это выглядит на сервере NewUO :eek:

View attachment 19378


P.S. ;)
Набираем новых людей в стафф
also entering to staff of NewUO is opened

icq 437-187

MORE INFO >>>> New Ultima Online


******************************

UPDATE 17.07.2010

add easy status gump >>>

*****************************
 

Attachments

  • NewUO Sleep System.rar
    21.5 KB · Views: 148
  • sleep.png
    sleep.png
    404.3 KB · Views: 306
  • HungerGump (2).cs
    2 KB · Views: 91

CJCJDJ

Sorceror
HOLY SHIT THIS LOOKS AWESOME. Looks amazing. Unfourtanetly it wouldn't fit in with my shard but ive bookmarked this and i will poll it on my forums see who wants this put in !!
 

Liacs

Sorceror
There has been a sleeper script a few years back, but this looks more sophisticated... I will check it out. Thanks for sharing!
 

ft2085267

Sorceror
After sleep. Save the server data.
Then restart the server
Archives wrong.

Code:
World: Loading...An error was encountered while loading a saved object
 - Type: Server.Mobiles.PlayerMobile
 - Serial: 0x00000001
Delete the object? (y/n)
 

maphreal

Sorceror
He forgot to add instructions on how to deserialize it, so you're going to have to do that in order to load after saves.
 

newuo

Sorceror
add in playermobile

find public override void Deserialize( GenericReader reader )


add case №
Sleep = reader.ReadInt();
 

ft2085267

Sorceror
newuo;846207 said:
add in playermobile

find public override void Deserialize( GenericReader reader )


add case №
Sleep = reader.ReadInt();

Thank you very much.
Great system.
Did not succeed, do not know why,

Code:
writer.Write ((int) 31); / / version


        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
       
            switch (version)
            {
                case 31:
                        {
                            Sleep = reader.ReadInt();
                            goto case 30;
                        }

                case 30:
                    {
		m_City = (CityManagementStone)reader.ReadItem();
		m_CityTitle = reader.ReadString();
		m_ShowCityTitle = reader.ReadBool();
		m_OwesBackTaxes = reader.ReadBool();
		m_BackTaxesAmount = reader.ReadInt();    
                goto case 29;
 

newuo

Sorceror
find public override void Deserialize( GenericReader reader )

add cose m_Sleeping = reader.ReadBool();
 

maphreal

Sorceror
ft2085267;846231 said:
Thank you very much.
Great system.
Did not succeed, do not know why,

Post your Serialize and Deserialize methods and we can be of more help. You have to deserialize in the same order you serialized. You also need to make sure your version integer is properly set.
 

ft2085267

Sorceror
newuo;846295 said:
UPDATE 17.07.2010
add easy status gump >>> HungerGump.cs

Игрок ложится спать на специальную кровать, и у него восстанавливается параметр сна.

What is this language?
I opened the script, see is garbled.
I can not translate. Is there English version of it?

If so, thank you very much.
SleeperBedBody.cs, SleepableBeds.cs
I need these two documents, which the strings are in English.
 

Dragonas

Sorceror
i make it so, how you said in the install and get this lines:
Errors:
+ Mobiles/PlayerMobile.cs:
CS1513: Line 2645: } needed

I searched the error, but cannot find him. can you take a look pls?
 

Attachments

  • PlayerMobile.cs
    102.8 KB · Views: 9

newuo

Sorceror
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();

switch ( version )
{
case 28:
{
//cose
m_Sleeping = reader.ReadBool();
goto case 27;
}
case 27:
{
m_AnkhNextUse = reader.ReadDateTime();

goto case 26;
}
case 26:
{
m_AutoStabled = reader.ReadStrongMobileList();

goto case 25;
}
case 25:
{
int recipeCount = reader.ReadInt();

if( recipeCount > 0 )
{
m_AcquiredRecipes = new Dictionary<int, bool>();

for( int i = 0; i < recipeCount; i++ )
{
int r = reader.ReadInt();
if( reader.ReadBool() ) //Don't add in recipies which we haven't gotten or have been removed
m_AcquiredRecipes.Add( r, true );
}
}
goto case 24;
}
case 24:
{
m_LastHonorLoss = reader.ReadDeltaTime();
goto case 23;
}
case 23:
{
m_ChampionTitles = new ChampionTitleInfo( reader );
goto case 22;
}
case 22:
{
m_LastValorLoss = reader.ReadDateTime();
goto case 21;
}
case 21:
{
m_ToTItemsTurnedIn = reader.ReadEncodedInt();
m_ToTTotalMonsterFame = reader.ReadInt();
goto case 20;
}
case 20:
{
m_AllianceMessageHue = reader.ReadEncodedInt();
m_GuildMessageHue = reader.ReadEncodedInt();

goto case 19;
}
case 19:
{
int rank = reader.ReadEncodedInt();
int maxRank = Guilds.RankDefinition.Ranks.Length -1;
if( rank > maxRank )
rank = maxRank;

m_GuildRank = Guilds.RankDefinition.Ranks[rank];
m_LastOnline = reader.ReadDateTime();
goto case 18;
}
case 18:
{
m_SolenFriendship = (SolenFriendship) reader.ReadEncodedInt();

goto case 17;
}
case 17: // changed how DoneQuests is serialized
case 16:
{
m_Quest = QuestSerializer.DeserializeQuest( reader );

if ( m_Quest != null )
m_Quest.From = this;

int count = reader.ReadEncodedInt();

if ( count > 0 )
{
m_DoneQuests = new List<QuestRestartInfo>();

for ( int i = 0; i < count; ++i )
{
Type questType = QuestSerializer.ReadType( QuestSystem.QuestTypes, reader );
DateTime restartTime;

if ( version < 17 )
restartTime = DateTime.MaxValue;
else
restartTime = reader.ReadDateTime();

m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) );
}
}

m_Profession = reader.ReadEncodedInt();
goto case 15;
}
case 15:
{
m_LastCompassionLoss = reader.ReadDeltaTime();
goto case 14;
}
case 14:
{
m_CompassionGains = reader.ReadEncodedInt();

if ( m_CompassionGains > 0 )
m_NextCompassionDay = reader.ReadDeltaTime();

goto case 13;
}
case 13: // just removed m_PayedInsurance list
case 12:
{
m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );
goto case 11;
}
case 11:
{
if ( version < 13 )
{
List<Item> payed = reader.ReadStrongItemList();

for ( int i = 0; i < payed.Count; ++i )
payed.PayedInsurance = true;
}

goto case 10;
}
case 10:
{
if ( reader.ReadBool() )
{
m_HairModID = reader.ReadInt();
m_HairModHue = reader.ReadInt();
m_BeardModID = reader.ReadInt();
m_BeardModHue = reader.ReadInt();

// We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
}

goto case 9;
}
case 9:
{
SavagePaintExpiration = reader.ReadTimeSpan();

if ( SavagePaintExpiration > TimeSpan.Zero )
{
BodyMod = ( Female ? 184 : 183 );
HueMod = 0;
}

goto case 8;
}
case 8:
{
m_NpcGuild = (NpcGuild)reader.ReadInt();
m_NpcGuildJoinTime = reader.ReadDateTime();
m_NpcGuildGameTime = reader.ReadTimeSpan();
goto case 7;
}
case 7:
{
m_PermaFlags = reader.ReadStrongMobileList();
goto case 6;
}
case 6:
{
NextTailorBulkOrder = reader.ReadTimeSpan();
goto case 5;
}
case 5:
{
NextSmithBulkOrder = reader.ReadTimeSpan();
goto case 4;
}
case 4:
{
m_LastJusticeLoss = reader.ReadDeltaTime();
m_JusticeProtectors = reader.ReadStrongMobileList();
goto case 3;
}
case 3:
{
m_LastSacrificeGain = reader.ReadDeltaTime();
m_LastSacrificeLoss = reader.ReadDeltaTime();
m_AvailableResurrects = reader.ReadInt();
goto case 2;
}
case 2:
{
m_Flags = (PlayerFlag)reader.ReadInt();
goto case 1;
}
case 1:
{
m_LongTermElapse = reader.ReadTimeSpan();
m_ShortTermElapse = reader.ReadTimeSpan();
m_GameTime = reader.ReadTimeSpan();
goto case 0;
}
case 0:
{
if( version < 26 )
m_AutoStabled = new List<Mobile>();
break;
}
}


try this )))
 

Dragonas

Sorceror
now i get the following error:
SleeperBedBody.cs
Line 229: Server.Items.SleeperBedBody.SendInfoTo(Server.Network.NetState): der geerbte Member Server.Items.SleeperBedBody.SendInfoTo(Server.Network.Netstate) kann nicht überschrieben werden, da es nicht als "virtual", "abstract" oder "override" gekennzeichnet ist

How can i fix that problem?
 

ft2085267

Sorceror
Dragonas;847792 said:
now i get the following error:
SleeperBedBody.cs
Line 229: Server.Items.SleeperBedBody.SendInfoTo(Server.Network.NetState): der geerbte Member Server.Items.SleeperBedBody.SendInfoTo(Server.Network.Netstate) kann nicht überschrieben werden, da es nicht als "virtual", "abstract" oder "override" gekennzeichnet ist

How can i fix that problem?

My approach is to
Change to:

Code:
		public void SendInfoTo( NetState state )
		{
			base.SendInfoTo( state );

			if ( ItemID == 0x2006 )
			{
				state.Send( new SleeperBedBodyContent( state.Mobile, this ) );
				state.Send( new SleeperBedBodyEquip( state.Mobile, this ) );
			}
		}
 
Top