public string GetName() { return(Type.ToString()); }
public PlayerActionResult DoAction(PlayerActionType type, int uid, string pparam = null, int amount = 0, string svalue = null) { Player player; PlayerActionResult result; PlayerAction action = (PlayerAction)Activator.CreateInstance(null, string.Concat("Conquest.Players.Actions.", type.ToString())).Unwrap(); action.Logic = (ActionLogic)Activator.CreateInstance(null, string.Concat("Conquest.Players.Actions.", type.ToString(), "Logic")).Unwrap(); action.Logic.Action = action; action.amount = amount; // Verify executor exists if (!PlayerExists(uid)) { return(new PlayerActionResult(false, ResultType.NotFound)); } else { player = GetPlayer(uid); } if (pparam != null & !PlayerExists(pparam)) { if (!PlayerExists(pparam)) { return(new PlayerActionResult(false, ResultType.NotFound)); } action.playerparam = GetPlayer(pparam); } result = player.DoAction(action); entities.Entry(player).State = System.Data.EntityState.Modified; entities.SaveChanges(); return(result); }