popo
Initiate
Installed FS pvp point system:
link:
http://www.runuo.com/community/threads/runuo-2-0-rc1-fs-pvp-point-system.70177/
Installation steps: (from attached file)
READ FIRST!!! ALWAYS BACK UP YOUR FILES BEFORE EDITING!!!!!!!!!!!!
#
#-----[ OPEN ]----------------------------------
#
PlayerMobile.cs
#
#-----[ FIND ]----------------------------------
#
#-----[ ADD, AFTER ]----------------------------
#
#
#-----[ FIND ]----------------------------------
#
#-----[ ADD, AFTER ]----------------------------
#
#
#-----[ FIND ]----------------------------------
#
#
#-----[ ADD, AFTER ]----------------------------
#
//NOTE: NEXTCASE is the next case in your Deserialize meaning if the last case was 20 make the new one 21
#
#-----[ FIND ]----------------------------------
#
//NOTE: LASTCASE will be the last case from your Deserialize
#
#-----[ CHANGE TO ]----------------------------
#
//NOTE: NEXTCASE will be the case number you just added in your Deserialze
#
#-----[ FIND ]----------------------------------
#
#-----[ ADD, AFTER ]----------------------------
#
//NOTE: Your all done. Enjoy
That was the installation steps
--------------------------------------------------------------------------------------------------------------------------------------------
My edited playermobile:
Playermobile.cs Serialize
Playermobile.cs Deserialize
After adding the system and saving the world y restart server im getting this message in console:
if i say yes, account gets deleted.
if i say no i get this error:
I noticed that my player mobile doesnt have
Thanks... i attached the installation file.
I hope someone can help me.
Serialize and Deserialize always have been confusing for me
link:
http://www.runuo.com/community/threads/runuo-2-0-rc1-fs-pvp-point-system.70177/
Installation steps: (from attached file)
READ FIRST!!! ALWAYS BACK UP YOUR FILES BEFORE EDITING!!!!!!!!!!!!
#
#-----[ OPEN ]----------------------------------
#
PlayerMobile.cs
#
#-----[ FIND ]----------------------------------
Code:
private int m_Profession;
#
#-----[ ADD, AFTER ]----------------------------
#
Code:
//Start Pvp Point System
private int m_TotalPoints;
private int m_TotalWins;
private int m_TotalLoses;
private int m_TotalResKills;
private int m_TotalResKilled;
private Mobile m_LastPwner;
private Mobile m_LastPwned;
private DateTime m_ResKillTime;
private int m_TotalPointsLost;
private int m_TotalPointsSpent;
private string m_PvpRank = "Newbie";
[CommandProperty( AccessLevel.GameMaster )]
public string PvpRank
{
get{ return m_PvpRank; }
set{ m_PvpRank = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalPoints
{
get{ return m_TotalPoints; }
set{ m_TotalPoints = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalWins
{
get{ return m_TotalWins; }
set{ m_TotalWins = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalLoses
{
get{ return m_TotalLoses; }
set{ m_TotalLoses = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalResKills
{
get{ return m_TotalResKills; }
set{ m_TotalResKills = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalResKilled
{
get{ return m_TotalResKilled; }
set{ m_TotalResKilled = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public Mobile LastPwner
{
get{ return m_LastPwner; }
set{ m_LastPwner = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public Mobile LastPwned
{
get{ return m_LastPwned; }
set{ m_LastPwned = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan ResKillTime
{
get
{
TimeSpan ts = m_ResKillTime - DateTime.Now;
if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;
return ts;
}
set
{
try{ m_ResKillTime = DateTime.Now + value; }
catch{}
}
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalPointsLost
{
get{ return m_TotalPointsLost; }
set{ m_TotalPointsLost = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int TotalPointsSpent
{
get{ return m_TotalPointsSpent; }
set{ m_TotalPointsSpent = value; }
}
//End Pvp Point System
#
#-----[ FIND ]----------------------------------
Code:
if ( m_InsuranceAward is PlayerMobile )
((PlayerMobile)m_InsuranceAward).m_InsuranceBonus = 0;
#
#-----[ ADD, AFTER ]----------------------------
#
Code:
Mobile kill = FindMostRecentDamager( false );
if ( kill is PlayerMobile )
{
PlayerMobile killer = (PlayerMobile)kill;
if ( PvpPointSystem.EnablePointSystem == true )
PvpPointSystem.GivePoints( this, killer );
if ( PvpPointSystem.EnableRankSystem == true )
PvpPointSystem.CheckTitle( this, killer );
}
#
#-----[ FIND ]----------------------------------
#
Code:
switch ( version )
{
#
#-----[ ADD, AFTER ]----------------------------
#
//NOTE: NEXTCASE is the next case in your Deserialize meaning if the last case was 20 make the new one 21
Code:
case NEXTCASE:
{
m_TotalPointsLost = reader.ReadInt();
m_TotalPointsSpent = reader.ReadInt();
ResKillTime = reader.ReadTimeSpan();
m_LastPwned = reader.ReadMobile();
m_TotalResKills = reader.ReadInt();
m_TotalResKilled = reader.ReadInt();
m_LastPwner = reader.ReadMobile();
m_TotalPoints = reader.ReadInt();
m_TotalWins = reader.ReadInt();
m_TotalLoses = reader.ReadInt();
m_PvpRank = reader.ReadString();
goto case LASTCASE;
}
#-----[ FIND ]----------------------------------
#
//NOTE: LASTCASE will be the last case from your Deserialize
Code:
writer.Write( (int) LASTCASE );
#
#-----[ CHANGE TO ]----------------------------
#
//NOTE: NEXTCASE will be the case number you just added in your Deserialze
Code:
writer.Write( (int) NEXTCASE ); // version
#
#-----[ FIND ]----------------------------------
Code:
writer.Write( (int) ## ); // version
#
#-----[ ADD, AFTER ]----------------------------
#
Code:
writer.Write( m_TotalPointsLost );
writer.Write( m_TotalPointsSpent );
writer.Write( ResKillTime );
writer.Write( m_LastPwned );
writer.Write( m_TotalResKills );
writer.Write( m_TotalResKilled );
writer.Write( m_LastPwner );
writer.Write( m_TotalPoints );
writer.Write( m_TotalWins );
writer.Write( m_TotalLoses );
writer.Write( m_PvpRank );
//NOTE: Your all done. Enjoy
That was the installation steps
--------------------------------------------------------------------------------------------------------------------------------------------
My edited playermobile:
Playermobile.cs Serialize
Code:
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] );
}
CheckKillDecay();
CheckAtrophies( this );
base.Serialize( writer );
writer.Write( 46 );
writer.Write( m_TotalPointsLost );
writer.Write( m_TotalPointsSpent );
writer.Write( ResKillTime );
writer.Write( m_LastPwned );
writer.Write( m_TotalResKills );
writer.Write( m_TotalResKilled );
writer.Write( m_LastPwner );
writer.Write( m_TotalPoints );
writer.Write( m_TotalWins );
writer.Write( m_TotalLoses );
writer.Write( m_PvpRank );
writer.Write( 45 ); // version
writer.Write( m_City );
writer.Write( m_CityTitle );
writer.Write( m_ShowCityTitle );
writer.Write( m_OwesBackTaxes );
writer.Write( m_BackTaxesAmount );
//ver 44
writer.Write(AntiMacroGump);
//ver 43
writer.Write(ShowTipsOnLogin);
//ver 42
writer.Write(AllowMulti);
//ver 41
writer.Write((int)GameInfoGumpType);
//ver 40
writer.Write((byte)m_EventType);
writer.Write(m_CurrentEvent);
//ver 39
writer.Write(TempCheck);
//ver 38
writer.Write(m_AutoStabled, true);
writer.Write((DateTime)m_AnkhNextUse);
writer.Write((DateTime)m_PeacedUntil);
//ver 37
writer.Write(ShowArriveMsg);
//ver 36
writer.Write(m_Rating);
writer.Write(m_TournamentRating);
//ver 35
writer.Write(m_Snoopers, true);
//ver 34
writer.Write(m_HasStartingSkillBoost);
//ver 33
writer.Write(m_OriginalHairHue);
writer.Write(m_OriginalHairItemID);
writer.Write(m_OriginalHue);
writer.Write(m_HasCustomRace);
//ver 32
writer.Write( VirtualArmor = 0 );
//ver 31
writer.Write(m_PlayerGuildGameTime);
//ver 30
writer.Write(m_AlwaysMurderer);
//ver 29
writer.Write(m_Imported);
//ver 28
//writer.Write((TownMemberState)m_TownMemberState);
//ver 27
writer.Write(m_Stoned);
//ver 26
writer.Write( UseUnicodeSpeech );
if( m_AcquiredRecipes == null )
{
writer.Write( 0 );
}
else
{
writer.Write( m_AcquiredRecipes.Count );
foreach( KeyValuePair<int, bool> kvp in m_AcquiredRecipes )
{
writer.Write( kvp.Key );
writer.Write( kvp.Value );
}
}
writer.WriteDeltaTime( m_LastHonorLoss );
ChampionTitleInfo.Serialize( writer, m_ChampionTitles );
writer.Write( m_LastValorLoss );
writer.WriteEncodedInt( m_ToTItemsTurnedIn );
writer.Write( m_ToTTotalMonsterFame ); //This ain't going to be a small #.
writer.WriteEncodedInt( AllianceMessageHue );
writer.WriteEncodedInt( GuildMessageHue );
writer.WriteEncodedInt( m_GuildRank.Rank );
writer.Write( LastOnline );
writer.WriteEncodedInt( (int) m_SolenFriendship );
QuestSerializer.Serialize( m_Quest, writer );
if ( m_DoneQuests == null )
{
writer.WriteEncodedInt( 0 );
}
else
{
writer.WriteEncodedInt( m_DoneQuests.Count );
for ( int i = 0; i < m_DoneQuests.Count; ++i )
{
QuestRestartInfo restartInfo = m_DoneQuests[i];
QuestSerializer.Write( restartInfo.QuestType, QuestSystem.QuestTypes, writer );
writer.Write( restartInfo.RestartTime );
}
}
writer.WriteEncodedInt( Profession );
writer.WriteDeltaTime( m_LastCompassionLoss );
writer.WriteEncodedInt( m_CompassionGains );
if ( m_CompassionGains > 0 )
writer.WriteDeltaTime( m_NextCompassionDay );
m_BOBFilter.Serialize( writer );
bool useMods = ( m_HairModID != -1 || m_BeardModID != -1 );
writer.Write( useMods );
if ( useMods )
{
writer.Write( m_HairModID );
writer.Write( m_HairModHue );
writer.Write( m_BeardModID );
writer.Write( m_BeardModHue );
}
writer.Write( SavagePaintExpiration );
writer.Write( (int) NpcGuild );
writer.Write( NpcGuildJoinTime );
writer.Write( NpcGuildGameTime );
writer.Write( m_PermaFlags, true );
writer.Write( NextTailorBulkOrder );
writer.Write( NextSmithBulkOrder );
writer.WriteDeltaTime( m_LastJusticeLoss );
writer.Write( m_JusticeProtectors, true );
writer.WriteDeltaTime( m_LastSacrificeGain );
writer.WriteDeltaTime( m_LastSacrificeLoss );
writer.Write( m_AvailableResurrects );
writer.Write( (int) m_Flags );
writer.Write( m_LongTermElapse );
writer.Write( m_ShortTermElapse );
writer.Write( GameTime );
}
Playermobile.cs Deserialize
Code:
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 46:
{
m_TotalPointsLost = reader.ReadInt();
m_TotalPointsSpent = reader.ReadInt();
ResKillTime = reader.ReadTimeSpan();
m_LastPwned = reader.ReadMobile();
m_TotalResKills = reader.ReadInt();
m_TotalResKilled = reader.ReadInt();
m_LastPwner = reader.ReadMobile();
m_TotalPoints = reader.ReadInt();
m_TotalWins = reader.ReadInt();
m_TotalLoses = reader.ReadInt();
m_PvpRank = reader.ReadString();
goto case 45;
}
case 45:
{
m_City = (CityManagementStone)reader.ReadItem();
m_CityTitle = reader.ReadString();
m_ShowCityTitle = reader.ReadBool();
m_OwesBackTaxes = reader.ReadBool();
m_BackTaxesAmount = reader.ReadInt();
goto case 44;
}
case 44:
{
AntiMacroGump = reader.ReadBool();
goto case 43;
}
case 43:
{
ShowTipsOnLogin = reader.ReadBool();
goto case 42;
}
case 42:
{
AllowMulti = reader.ReadBool();
goto case 41;
}
case 41:
{
GameInfoGumpType = (GameInfoGumpType)reader.ReadInt();
goto case 40;
}
case 40:
{
m_EventType = (EventType)reader.ReadByte();
m_CurrentEvent = reader.ReadItem() as BaseGame;
goto case 39;
}
case 39:
{
TempCheck = reader.ReadBool();
goto case 38;
}
case 38:
{
m_AutoStabled = reader.ReadStrongMobileList();
m_AnkhNextUse = reader.ReadDateTime();
m_PeacedUntil = reader.ReadDateTime();
goto case 37;
}
case 37:
{
ShowArriveMsg = reader.ReadBool();
goto case 36;
}
case 36:
{
m_Rating = reader.ReadInt();
m_TournamentRating = reader.ReadInt();
m_CurrentEvent = null;
goto case 35;
}
case 35:
{
m_Snoopers = reader.ReadStrongMobileList();
goto case 34;
}
case 34:
m_HasStartingSkillBoost = reader.ReadBool();
goto case 33;
case 33:
{
m_OriginalHairHue = reader.ReadInt();
m_OriginalHairItemID = reader.ReadInt();
m_OriginalHue = reader.ReadInt();
m_HasCustomRace = reader.ReadBool();
goto case 32;
}
case 32:
VirtualArmor = reader.ReadInt();
goto case 31;
case 31:
m_PlayerGuildGameTime = reader.ReadTimeSpan();
goto case 30;
case 30:
m_AlwaysMurderer = reader.ReadBool();
goto case 29;
case 29:
m_Imported = reader.ReadBool();
goto case 28;
case 28:
/*Item nullItem = reader.ReadItem();
goto case 27;*/
case 27:
m_Stoned = reader.ReadBool();
goto case 26;
case 26:
UseUnicodeSpeech = reader.ReadBool();
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:
{
AllianceMessageHue = reader.ReadEncodedInt();
GuildMessageHue = reader.ReadEncodedInt();
goto case 19;
}
case 19:
{
int rank = reader.ReadEncodedInt();
int maxRank = RankDefinition.Ranks.Length -1;
if( rank > maxRank )
rank = maxRank;
m_GuildRank = RankDefinition.Ranks[rank];
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 ) );
}
}
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 BOBFilter( reader );
goto case 11;
}
case 11:
{
if ( version < 13 )
{
List<Item> payed = reader.ReadStrongItemList();
for ( int i = 0; i < payed.Count; ++i )
payed[i].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();
}
goto case 9;
}
case 9:
{
SavagePaintExpiration = reader.ReadTimeSpan();
if ( SavagePaintExpiration > TimeSpan.Zero )
{
BodyMod = ( Female ? 184 : 183 );
HueMod = 0;
}
goto case 8;
}
case 8:
{
NpcGuild = (NpcGuild)reader.ReadInt();
NpcGuildJoinTime = reader.ReadDateTime();
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 < 43)
ShowTipsOnLogin = true;
if (version < 38)
m_AutoStabled = new List<Mobile>();
break;
}
}
// Professions weren't verified on 1.0 RC0
if ( !CharacterCreation.VerifyProfession( Profession ) )
Profession = 0;
if ( m_PermaFlags == null )
m_PermaFlags = new List<Mobile>();
if ( m_Snoopers == null)
m_Snoopers = new List<Mobile>();
if ( m_JusticeProtectors == null )
m_JusticeProtectors = new List<Mobile>();
if ( m_BOBFilter == null )
m_BOBFilter = new BOBFilter();
if( m_GuildRank == null )
m_GuildRank = RankDefinition.Member; //Default to member if going from older verstion to new version (only time it should be null)
if( LastOnline == DateTime.MinValue && Account != null )
LastOnline = ((Account)Account).LastLogin;
if( m_ChampionTitles == null )
m_ChampionTitles = new ChampionTitleInfo();
if (AccessLevel > AccessLevel.Player)
m_IgnoreMobiles = true;
List<Mobile> list = Stabled;
for ( int i = 0; i < list.Count; ++i )
{
BaseCreature bc = list[i] as BaseCreature;
if ( bc != null )
bc.IsStabled = true;
}
CheckAtrophies( this );
if( Hidden ) //Hiding is the only buff where it has an effect that's serialized.
AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );
}
Code:
public override bool OnBeforeDeath()
{
PolymorphSpell.StopTimer(this);
m_OldMana = Mana;
m_OldStam = Stam;
NetState state = NetState;
if (state != null)
state.CancelAllTrades();
DropHolding();
if (Backpack != null && !Backpack.Deleted)
{
List<Item> ilist = Backpack.FindItemsByType<Item>(FindItems_Callback);
for (int i = 0; i < ilist.Count; i++)
{
Backpack.AddItem(ilist);
}
m_ItemLocations = new Dictionary<Item, Point2D>();
for (int i = 0; i < Backpack.Items.Count; i++)
{
Item item = Backpack.Items;
//Taran: Empty reward can on death
if (item is MiniRewardCan)
{
MiniRewardCan mrc = item as MiniRewardCan;
if (mrc.trashedItem != null)
mrc.trashedItem.Delete();
}
//Save location of the item if it's newbied
if (item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || AccessLevel > AccessLevel.Player)
m_ItemLocations[item] = new Point2D(item.X, item.Y);
}
}
m_EquipSnapshot = new List<Item>(this.Items);
m_NonAutoreinsuredItems = 0;
m_InsuranceCost = 0;
m_InsuranceAward = FindMostRecentDamager( false );
if ( m_InsuranceAward is BaseCreature )
{
Mobile master = ((BaseCreature)m_InsuranceAward).GetMaster();
if ( master != null )
m_InsuranceAward = master;
}
if ( m_InsuranceAward != null && (!m_InsuranceAward.Player || m_InsuranceAward == this) )
m_InsuranceAward = null;
if ( m_InsuranceAward is PlayerMobile )
((PlayerMobile)m_InsuranceAward).m_InsuranceBonus = 0;
///////////////////////FS PVP POINT SYSTEM////////////////
Mobile kill = FindMostRecentDamager( false );
if ( kill is PlayerMobile )
{
PlayerMobile killer = (PlayerMobile)kill;
if ( PvpPointSystem.EnablePointSystem == true )
PvpPointSystem.GivePoints( this, killer );
if ( PvpPointSystem.EnableRankSystem == true )
PvpPointSystem.CheckTitle( this, killer );
}
///////////END OF FPS PVP SYSTEM///////////
if ( m_ReceivedHonorContext != null )
m_ReceivedHonorContext.OnTargetKilled();
if ( m_SentHonorContext != null )
m_SentHonorContext.OnSourceKilled();
RecoverAmmo();
return base.OnBeforeDeath();
}
After adding the system and saving the world y restart server im getting this message in console:
if i say yes, account gets deleted.
if i say no i get this error:
I noticed that my player mobile doesnt have
Code:
private int m_Profession;
Thanks... i attached the installation file.
I hope someone can help me.
Serialize and Deserialize always have been confusing for me