BCFindPlayer.cs 923 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Linq;
  3. using BossBase;
  4. using DataCenter;
  5. namespace BossCommand
  6. {
  7. public class BCFindPlayer: ABossCommand
  8. {
  9. public BCFindPlayer(IMessageChannel iMessageChannel, DataCenterEntities entities):
  10. base(iMessageChannel, entities)
  11. {
  12. }
  13. public int FindTypeIndex { get; set; }
  14. public string FindType { get; set; }
  15. public override object Do()
  16. {
  17. t_character result = null;
  18. switch (this.FindTypeIndex)
  19. {
  20. case 0:
  21. {
  22. result = Entities.t_character.FirstOrDefault(
  23. c => c.account == this.FindType);
  24. break;
  25. }
  26. case 1:
  27. {
  28. result = Entities.t_character.FirstOrDefault(
  29. c => c.character_name == this.FindType);
  30. break;
  31. }
  32. case 2:
  33. {
  34. var findGuid = Decimal.Parse(this.FindType);
  35. result = Entities.t_character.FirstOrDefault(
  36. c => c.character_guid == findGuid);
  37. break;
  38. }
  39. }
  40. return result;
  41. }
  42. }
  43. }