Tips25


殺人カウントの減少間隔(バグ修正含む)

  • カテゴリー: 設定
  • 重要性: 普通
  • 投稿日: 2005-08-11 (木) 21:01:18

メッセージ

殺人カウントは通常長期40時間、短期8時間で減少します。 Scripts\Mobiles\PlayerMobile.cs

#code(csharp){{
public override void Serialize( GenericWriter writer )
//decay our kills
if ( m_ShortTermElapse < this.GameTime )
{
m_ShortTermElapse += TimeSpan.FromHours( 8 );
if ( ShortTermMurders > 0 )
--ShortTermMurders;
}

if ( m_LongTermElapse < this.GameTime )
{
m_LongTermElapse += TimeSpan.FromHours( 40 );
if ( Kills > 0 )
--Kills;
}
}}

#code(csharp){{
public void ResetKillTime()
{
m_ShortTermElapse = this.GameTime + TimeSpan.FromHours( 8 );
m_LongTermElapse = this.GameTime + TimeSpan.FromHours( 40 );
}
}} この辺のTimeSpan.FromHours( 8 )あたりの数字で間隔を変更することが出来ますが、 殺人カウントの減少はセーブと同時に行われる関係で、セーブ間隔が長いと正常に減少しないバグが存在します。 例えばセーブ間隔が4時間で短期カウントが2時間の場合、セーブ毎に2減少するはずなのに1しか減少しない現象が発生します。

バグ修正

PlayerMobile.cs

#code(csharp){{
public PlayerMobile()
{
m_VisList = new ArrayList();
m_PermaFlags = new ArrayList();
m_AntiMacroTable = new Hashtable();

m_BOBFilter = new Engines.BulkOrders.BOBFilter();

m_GameTime = TimeSpan.Zero;
//m_ShortTermElapse = TimeSpan.FromHours( 8.0 );
//m_LongTermElapse = TimeSpan.FromHours( 40.0 );
m_ShortTermElapse = m_ShortTerm;
m_LongTermElapse = m_LongTerm;

m_JusticeProtectors = new ArrayList();

InvalidateMyRunUO();
}
}}

#code(csharp){{
private static TimeSpan m_ShortTerm = TimeSpan.FromHours( 8.0 );//短期カウント減少時間
private static TimeSpan m_LongTerm = TimeSpan.FromHours( 40.0 );//長期カウント減少時間
public override void Serialize( GenericWriter writer )
{
//cleanup our anti-macro table
foreach ( Hashtable t in m_AntiMacroTable.Values )
{
ArrayList remove = new ArrayList();
foreach ( CountAndTimeStamp time in t.Values )
{
if ( time.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now )
remove.Add( time );
}

for (int i=0;i<remove.Count;++i)
t.Remove( remove[i] );
}

//decay our kills
TimeSpan elapse = this.GameTime - m_ShortTermElapse;
if ( elapse < TimeSpan.Zero )
elapse = TimeSpan.Zero;

while ( elapse > m_ShortTerm )
{
elapse -= m_ShortTerm;
if ( ShortTermMurders > 0 )
--ShortTermMurders;
}
m_ShortTermElapse = this.GameTime - elapse;

elapse = this.GameTime - m_LongTermElapse;
if ( elapse < TimeSpan.Zero )
elapse = TimeSpan.Zero;

while ( elapse > m_LongTerm )
{
elapse -= m_LongTerm;
if ( Kills > 0 )
--Kills;
}
m_LongTermElapse = this.GameTime - elapse;
/*
if ( m_ShortTermElapse < this.GameTime )
{
m_ShortTermElapse += TimeSpan.FromHours( 8 );
if ( ShortTermMurders > 0 )
--ShortTermMurders;
}

if ( m_LongTermElapse < this.GameTime )
{
m_LongTermElapse += TimeSpan.FromHours( 40 );
if ( Kills > 0 )
--Kills;
}
*/
}}

#code(csharp){{
public void ResetKillTime()
{
//m_ShortTermElapse = this.GameTime + TimeSpan.FromHours( 8 );
//m_LongTermElapse = this.GameTime + TimeSpan.FromHours( 40 );
m_ShortTermElapse = this.GameTime;
m_LongTermElapse = this.GameTime;
}
}}


  • 勉強始めたばかりで、適当なのですが上の6行目と7行目を13行目と14行目と同じする?では、駄目ですか?ご教授ください。 -- 通りすがり? 2005-08-11 (木) 23:26:13
    • 駄目です。というかバグの原因を理解されていないようです。
      それと「通りすがり」にまともな解答するほど暇ではありません。 -- Hermit? 2005-08-13 (土) 00:59:57
  • 通りすがり改めGramaryです。申し訳ございません。 -- Gramary? 2005-08-13 (土) 15:24:27

メニュー

オリジナル

T2A

  • InPorYelm?

UOR+T2A

AOS

  • なし

UOML

 

  • counter: 636
  • today: 1
  • yesterday: 0
  • online: 1