本文整理汇总了C#中PlayerObject.ReceiveChat方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerObject.ReceiveChat方法的具体用法?C# PlayerObject.ReceiveChat怎么用?C# PlayerObject.ReceiveChat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject.ReceiveChat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attacked
// Player attacking trainer.
public override int Attacked(PlayerObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = false)
{
if (attacker == null) return 0;
if (_currentAttacker != null && _currentAttacker != attacker)
{
OutputAverage();
ResetStats();
}
damage += attacker.AttackBonus;
_currentAttacker = attacker;
_hitCount++;
_totalDamage += damage;
_lastAttackTime = Envir.Time;
switch (type)
{
case DefenceType.ACAgility:
attacker.ReceiveChat(damage + " Physical Agility Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.AC:
attacker.ReceiveChat(damage + " Physical Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.MACAgility:
attacker.ReceiveChat(damage + " Magic Agility Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.MAC:
attacker.ReceiveChat(damage + " Magic Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.Agility:
attacker.ReceiveChat(damage + " Agility Damage inflicted on the trainer.", ChatType.Trainer);
break;
}
return 1;
}
示例2: Harvest
public override bool Harvest(PlayerObject player)
{
if (RemainingSkinCount == 0)
{
for (int i = _drops.Count - 1; i >= 0; i--)
if (player.CanGainItem(_drops[i]))
{
player.GainItem(_drops[i]);
_drops.RemoveAt(i);
}
if (_drops.Count == 0)
{
Harvested = true;
_drops = null;
Broadcast(new S.ObjectHarvested { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
}
else player.ReceiveChat("You cannot carry anymore.", ChatType.System);
return true;
}
if (--RemainingSkinCount > 0) return true;
_drops = new List<UserItem>();
for (int i = 0; i < Info.Drops.Count; i++)
{
DropInfo drop = Info.Drops[i];
int rate = (int)(drop.Chance / Settings.DropRate); if (rate < 1) rate = 1;
if (drop.Gold > 0 || Envir.Random.Next(rate) != 0) continue;
UserItem item = Envir.CreateDropItem(drop.Item);
if (item == null) continue;
if (item.Info.Type == ItemType.Meat)
item.CurrentDura = (ushort)Math.Max(0, item.CurrentDura + Quality);
_drops.Add(item);
}
if (_drops.Count == 0)
{
player.ReceiveChat("Nothing was found.", ChatType.System);
Harvested = true;
_drops = null;
Broadcast(new S.ObjectHarvested { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
}
return true;
}
示例3: Attacked
// Player attacking trainer.
public override int Attacked(PlayerObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = false)
{
switch (type)
{
case DefenceType.ACAgility:
attacker.ReceiveChat(damage + " AC Agility Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.AC:
attacker.ReceiveChat(damage + " AC Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.MACAgility:
attacker.ReceiveChat(damage + " MAC Agility Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.MAC:
attacker.ReceiveChat(damage + " MAC Damage inflicted on the trainer.", ChatType.Trainer);
break;
case DefenceType.Agility:
attacker.ReceiveChat(damage + " Agility Damage inflicted on the trainer.", ChatType.Trainer);
break;
}
return 1;
}
示例4: PoisonDamage
public override void PoisonDamage(int damage, MapObject attacker)
{
damage = damage * (-1);
if (attacker == null) return;
if (_currentAttacker != null && _currentAttacker != attacker)
{
OutputAverage();
ResetStats();
}
if (_currentAttacker == null)
_StartTime = Envir.Time;
_currentAttacker = (PlayerObject)attacker;
_hitCount++;
_totalDamage += damage;
_lastAttackTime = Envir.Time;
long timespend = Math.Max(1000, (Envir.Time - _StartTime));//avoid division by 0
if (_StartTime == 0)
timespend = 1000;
double Dps = _totalDamage / (timespend * 0.001);
_currentAttacker.ReceiveChat(string.Format("{1} inflicted {0} Damage, Dps: {2:#.00}.", damage, "Your poison", Dps), ChatType.Trainer);
Poisoned = true;
}