private void DamageTarget(NetIncomingMessage message, MessageTemplate template) { CharacterPlayer character = MapContainer.FindCharacterByID(message.SenderConnection.RemoteUniqueIdentifier); AbilityHead abi = AbilityContainer.GetAbilityByName(template.JsonMessage); Entity entity = Scene.FindEntity(character._name); PlayerComponent pcomp = entity.GetComponent <PlayerComponent>(); if (pcomp != null && abi != null && pcomp.Target != null) { pcomp.Target.GetComponent <DamageComponent>().DealDamageToEntity(abi.BaseDamage); } }
private void StartChanneling(MessageTemplate template, NetIncomingMessage message) { ChannelTemplate ct = Newtonsoft.Json.JsonConvert.DeserializeObject <ChannelTemplate>(template.JsonMessage); if (ct.ChannelType.Equals(ChannelType.Ability)) { AbilityHead ability = AbilityContainer.GetAbilityByName(ct.ChannelName); CharacterPlayer character = MapContainer.FindCharacterByID(message.SenderConnection.RemoteUniqueIdentifier); Entity entity = Scene.FindEntity(character._name); PlayerComponent pc = entity.GetComponent <PlayerComponent>(); if (pc != null && !pc.isChanneling) { if (ability != null) { entity.AddComponent(new DamageChannelingComponent(pc, ability.ChannelTime, ability)); } else { entity.AddComponent(new ChannelingComponent(pc, 4)); } } } }