wServer.realm.entities.Player.SaveToCharacter C# (CSharp) Méthode

SaveToCharacter() public méthode

public SaveToCharacter ( ) : void
Résultat void
        public void SaveToCharacter()
        {
            var chr = psr.Character;
            chr.Exp = Experience;
            chr.Level = Level;
            chr.Tex1 = Texture1;
            chr.Tex2 = Texture2;
            chr.Pet = (Pet != null ? Pet.ObjectType : -1);
            chr.CurrentFame = Fame;
            chr.HitPoints = HP;
            chr.MagicPoints = MP;
            chr.Equipment = Inventory.Select(_ => _ == null ? (short)-1 : _.ObjectType).ToArray();
            chr.MaxHitPoints = Stats[0];
            chr.MaxMagicPoints = Stats[1];
            chr.Attack = Stats[2];
            chr.Defense = Stats[3];
            chr.Speed = Stats[4];
            chr.HpRegen = Stats[5];
            chr.MpRegen = Stats[6];
            chr.Dexterity = Stats[7];
        }

Usage Example

 protected override bool Process(Player player, RealmTime time, string args)
 {
     if (args.Length == 0)
     {
         player.SendHelp("Usage: /gimme <Itemname>");
         return false;
     }
     ushort objType;
     if (!player.Manager.GameData.IdToObjectType.TryGetValue(args, out objType))
     {
         player.SendError("Unknown item type!");
         return false;
     }
     for (int i = 0; i < player.Inventory.Length; i++)
         if (player.Inventory[i] == null)
         {
             player.Inventory[i] = player.Manager.GameData.Items[objType];
             player.UpdateCount++;
             player.SaveToCharacter();
             player.SendInfo("Success!");
             return true;
         }
     player.SendError("Not enough space in inventory!");
     return false;
 }
All Usage Examples Of wServer.realm.entities.Player::SaveToCharacter