using System.Collections.Generic; using System.Xml.Linq; public class MinEventActionChangeModelLayer : MinEventActionRemoveBuff { public override void Execute(MinEventParams _params) { //Log.Out("MinEventActionChangeModelLayer-Execute strOption: " + strOption); if (GameManager.IsDedicatedServer) { //Log.Out("MinEventActionChangeModelLayer-Execute 1"); return; } var player = _params.Self as EntityPlayerLocal; if (player != null) { //Log.Out("MinEventActionChangeModelLayer-Execute 2"); if (strOption == "player") { //Log.Out("MinEventActionChangeModelLayer-Execute 3"); if (player.Buffs.GetCustomVar("$SetModelLayerPlayer") == 0f) { //Log.Out("MinEventActionChangeModelLayer-Execute 4"); player.Buffs.SetCustomVar("$SetModelLayerPlayer", 1f); player.SetModelLayer(2, true, null); GameManager.ShowTooltip(player, "SET PLAYER MODEL LAYER TO 2"); } else { //Log.Out("MinEventActionChangeModelLayer-Execute 5"); player.Buffs.SetCustomVar("$SetModelLayerPlayer", 0f); player.SetModelLayer(24, true, null); GameManager.ShowTooltip(player, "SET PLAYER MODEL LAYER TO 24"); } } else if (strOption == "zombies") { //Log.Out("MinEventActionChangeModelLayer-Execute 6"); int minMax = 50; List entitiesInBounds = player.world.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(player.position.x - minMax, player.position.y - 50, player.position.z - minMax, player.position.x + minMax, player.position.y + 30, player.position.z + minMax), new List()); float getValue = player.Buffs.GetCustomVar("$SetModelLayerZombies"); if (player.Buffs.GetCustomVar("$SetModelLayerZombies") == 0f) { //Log.Out("MinEventActionChangeModelLayer-Execute 7"); player.Buffs.SetCustomVar("$SetModelLayerZombies", 1f); GameManager.ShowTooltip(player, "SET SURROUNDING ZOMBIE MODEL LAYERS TO 2"); } else { //Log.Out("MinEventActionChangeModelLayer-Execute 8"); player.Buffs.SetCustomVar("$SetModelLayerZombies", 0f); GameManager.ShowTooltip(player, "SET SURROUNDING ZOMBIE MODEL LAYERS TO 0"); } foreach (EntityZombieSDX entity in entitiesInBounds) { if (getValue == 0f) { //Log.Out("MinEventActionChangeModelLayer-Execute 9"); entity.SetModelLayer(2, true, null); } else { //Log.Out("MinEventActionChangeModelLayer-Execute 10"); entity.SetModelLayer(0, true, null); } } } } } public override bool ParseXmlAttribute(XAttribute _attribute) { //Log.Out("MinEventActionChangeModelLayer-ParseXmlAttribute START"); var flag = base.ParseXmlAttribute(_attribute); if (flag) return true; var name = _attribute.Name; if (name == null) { return flag; } else if (name == "option") { strOption = _attribute.Value; //Log.Out("MinEventActionChangeModelLayer-ParseXmlAttribute strOption: " + strOption); return true; } else { return false; } } private string strOption = ""; }