UpdatePlayer() public static method

public static UpdatePlayer ( int objectid, ushort packetcode, byte type, int prob ) : byte[]
objectid int
packetcode ushort
type byte
prob int
return byte[]
Example #1
0
 /////////////////////////////////////////////////////////////////////////////////
 // Update HP
 /////////////////////////////////////////////////////////////////////////////////
 #region Update HP
 public void UpdateHp()
 {
     //Wrap our function inside a catcher
     try
     {
         //Send packet to update player hp
         Send(Packet.UpdatePlayer(this.Character.Information.UniqueID, 0x20, 1, this.Character.Stat.SecondHp));
         //If Character is in a party
         if (Character.Network.Party != null)
         {
             //Update party visual hp update
             Character.Network.Party.Send(Packet.Party_Data(6, this.Character.Information.UniqueID));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Update hp error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
Example #2
0
 /////////////////////////////////////////////////////////////////////////////////
 // Update mp
 /////////////////////////////////////////////////////////////////////////////////
 #region Update MP
 public void UpdateMp()
 {
     //Wrap our function inside a catcher
     try
     {
         //Send update mp packet
         Send(Packet.UpdatePlayer(this.Character.Information.UniqueID, 0x10, 2, this.Character.Stat.SecondMP));
         //If character is in a party
         if (Character.Network.Party != null)
         {
             //Send mp update packet to party
             Character.Network.Party.Send(Packet.Party_Data(6, this.Character.Information.UniqueID));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Update MP Error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }
Example #3
0
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Player Death
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void Player_Up()
 {
     try
     {
         /////////////////////////////////////////////////////////////////////////////////////
         // Normal Death / Return to return point
         /////////////////////////////////////////////////////////////////////////////////////
         //Normal death
         if (Character.State.Die && Character.State.DeadType == 1)
         {
             if (Character.Information.Level <= 11)
             {
                 //Check if character is walking should not be happening
                 if (Character.Position.Walking)
                 {
                     return;
                 }
                 //Stop berserk timer if it were active
                 StopBerserkTimer();
                 //Start sending packets for teleport
                 client.Send(Packet.TeleportOtherStart());
                 //Reset state information
                 Send(Packet.StatePack(this.Character.Information.UniqueID, 0, 1, false));
                 //Set the character hp to max hp / 2
                 this.Character.Stat.SecondHp = this.Character.Stat.Hp / 2;
                 //this.Character.State.SafeState = true;
                 //NotAttackableTimer(5000);
                 this.UpdateHp();
                 //Send packet for updating hp
                 client.Send(Packet.UpdatePlayer(this.Character.Information.UniqueID, 0x20, 1, this.Character.Stat.SecondHp));
                 //Set bool
                 Character.State.Die = false;
                 //Send state pack
                 Send(Packet.StatePack(this.Character.Information.UniqueID, 4, 0, false));
             }
             else
             {
                 //Check if character is walking should not be happening
                 if (Character.Position.Walking)
                 {
                     return;
                 }
                 //Save information for reverse scrolls
                 SavePlayerReturn();
                 //Close buffs
                 BuffAllClose();
                 //Set bool ingame
                 Character.InGame = false;
                 //Despawn
                 DeSpawnMe();
                 //Despawn objects
                 ObjectDeSpawnCheck();
                 //Send teleport packet
                 client.Send(Packet.TeleportOtherStart());
                 //Update location
                 Teleport_UpdateXYZ(Character.Information.Place);
                 //Set hp to max hp / 2
                 this.Character.Stat.SecondHp = this.Character.Stat.Hp / 2;
                 //Send teleport image
                 client.Send(Packet.TeleportImage(Data.PointBase[Character.Information.Place].xSec, Data.PointBase[Character.Information.Place].ySec));
                 //Set bools
                 Character.Teleport  = true;
                 Character.State.Die = false;
             }
         }
         else if (Character.State.Die && Character.State.DeadType == 2)
         {
             //Check if character is walking should not be happening
             if (Character.Position.Walking)
             {
                 return;
             }
             //Stop berserk timer if it were active
             StopBerserkTimer();
             //Start sending packets for teleport
             client.Send(Packet.TeleportOtherStart());
             //Reset state information
             Send(Packet.StatePack(this.Character.Information.UniqueID, 0, 1, false));
             //Set the character hp to max hp / 2
             this.Character.Stat.SecondHp = this.Character.Stat.Hp / 2;
             //this.Character.State.SafeState = true;
             //NotAttackableTimer(5000);
             this.UpdateHp();
             //Send packet for updating hp
             client.Send(Packet.UpdatePlayer(this.Character.Information.UniqueID, 0x20, 1, this.Character.Stat.SecondHp));
             //Set bool
             Character.State.Die = false;
             //Send state pack
             Send(Packet.StatePack(this.Character.Information.UniqueID, 4, 0, false));
         }
         else
         {
             Console.WriteLine("Unknown dead type: " + Character.State.DeadType + "");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Death error {0}", ex);
         Systems.Debugger.Write(ex);
     }
 }