本文整理汇总了C#中Server.MirObjects.PlayerObject.GainExp方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerObject.GainExp方法的具体用法?C# PlayerObject.GainExp怎么用?C# PlayerObject.GainExp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.MirObjects.PlayerObject
的用法示例。
在下文中一共展示了PlayerObject.GainExp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Act
//.........这里部分代码省略.........
break;
case ActionType.TakeItem:
ItemInfo info = (ItemInfo)act.Params[0];
count = (uint)act.Params[1];
for (int o = 0; o < player.Info.Inventory.Length; o++)
{
UserItem item = player.Info.Inventory[o];
if (item == null) continue;
if (item.Info != info) continue;
if (count > item.Count)
{
player.Enqueue(new S.DeleteItem { UniqueID = item.UniqueID, Count = item.Count });
player.Info.Inventory[o] = null;
count -= item.Count;
continue;
}
player.Enqueue(new S.DeleteItem { UniqueID = item.UniqueID, Count = count });
if (count == item.Count)
player.Info.Inventory[o] = null;
else
item.Count -= count;
break;
}
player.RefreshStats();
break;
case ActionType.GiveExp:
player.GainExp((uint)act.Params[0]);
break;
case ActionType.GivePet:
for (var c = 0; c < (byte)act.Params[1]; c++)
{
MonsterObject monster = MonsterObject.GetMonster((MonsterInfo)act.Params[0]);
if (monster == null) return;
monster.PetLevel = (byte)act.Params[2];
monster.Master = player;
monster.MaxPetLevel = 7;
monster.Direction = player.Direction;
monster.ActionTime = SMain.Envir.Time + 1000;
monster.Spawn(player.CurrentMap, player.CurrentLocation);
player.Pets.Add(monster);
}
break;
case ActionType.AddNameList:
path = (string)act.Params[0];
if (File.ReadAllLines(path).All(t => player.Name != t))
{
using (var line = File.AppendText(path))
{
line.WriteLine(player.Name);
}
}
break;
case ActionType.DelNameList:
path = (string)act.Params[0];
File.WriteAllLines(path, File.ReadLines(path).Where(l => l != player.Name).ToList());
break;