本文整理汇总了C#中IRoom.InformPlayersInRoom方法的典型用法代码示例。如果您正苦于以下问题:C# IRoom.InformPlayersInRoom方法的具体用法?C# IRoom.InformPlayersInRoom怎么用?C# IRoom.InformPlayersInRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRoom
的用法示例。
在下文中一共展示了IRoom.InformPlayersInRoom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendRoundOutcomeMessage
/// <summary>
/// Informs all parties of the outcome of the combat round.
/// </summary>
/// <param name="player"></param>
/// <param name="enemy"></param>
/// <param name="room"></param>
/// <param name="damage"></param>
/// <param name="defense"></param>
/// <param name="attack"></param>
private static void SendRoundOutcomeMessage(IUser player, IUser enemy, IRoom room, double damage, double defense, double attack) {
//TODO: Get the message based weapon type/special weapon (blunt, blade, axe, pole, etc.)
//Get the weapon type and append it to the "Hit" or "Miss" type when getting the message
//ex: HitSword, HitClub, MissAxe, MissUnarmed could even get really specific HitRustyShortSword, MissLegendaryDaggerOfBlindness
//Make a method to figure out the type by having a lookup table in the DB that points to a weapon type string
IMessage message = new Message();
message.InstigatorID = player.UserID.ToString();
message.InstigatorType = player.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc;
message.TargetID = enemy.UserID.ToString();
message.TargetType = enemy.Player.IsNPC == false ? ObjectType.Player : ObjectType.Npc;
if (damage < 0) {
message.Self = ParseMessage(GetMessage("Combat", "Hit", MessageType.Self), player, enemy, damage, defense, attack);
message.Target = ParseMessage(GetMessage("Combat", "Hit", MessageType.Target), player, enemy, damage, defense, attack);
message.Room = ParseMessage(GetMessage("Combat", "Hit", MessageType.Room), player, enemy, damage, defense, attack);
enemy.Player.ApplyEffectOnAttribute("Hitpoints", damage);
INpc npc = enemy.Player as INpc;
if (npc != null) {
npc.IncreaseXPReward(player.UserID, (damage * -1.0));
}
}
else {
message.Self = ParseMessage(GetMessage("Combat", "Miss", MessageType.Self), player, enemy, damage, defense, attack);
message.Target = ParseMessage(GetMessage("Combat", "Miss", MessageType.Target), player, enemy, damage, defense, attack);
message.Room = ParseMessage(GetMessage("Combat", "Miss", MessageType.Room), player, enemy, damage, defense, attack);
}
if (player.Player.IsNPC) {
player.MessageHandler(message);
}
else {
player.MessageHandler(message.Self);
}
if (enemy.Player.IsNPC) {
enemy.MessageHandler(message);
}
else {
enemy.MessageHandler(message.Target);
}
room.InformPlayersInRoom(message, new List<ObjectId>() { player.UserID, enemy.UserID });
}