public override void Execute(MinEventParams _params) { // Debug.Log("NotifyTeam Of Attack"); // Grab the leader ID of the entity. float Leader = EntityUtilities.GetCVarValue(_params.Self.entityId, "Leader"); if (Leader == 0f) { return; } for (int j = 0; j < targets.Count; j++) { // Check the entity to see if its leader matches the current one. float myLeader = EntityUtilities.GetCVarValue(targets[j].entityId, "Leader"); if (myLeader == Leader) { // Debug.Log(" Entity has the same Leader as me: " + targets[j].EntityName); // the current entity doesn't have an attack target, give them one. if (EntityUtilities.GetAttackOrReventTarget(targets[j].entityId) == null) { // Debug.Log(" Sharing my Revenge Target with the team."); targets[j].SetAttackTarget(EntityUtilities.GetAttackOrReventTarget(_params.Self.entityId) as EntityAlive, 500); } } } }
// This loops through all the targets, giving each target the quest. // <triggered_effect trigger="onSelfBuffStart" action="GiveQuestSDX, Mods" target="self" quest="myNewQuest" /> public override void Execute(MinEventParams _params) { for (int j = 0; j < this.targets.Count; j++) { EntityAliveSDX entity = this.targets[j] as EntityAliveSDX; if (entity != null) { if (string.IsNullOrEmpty(this.strQuest)) { continue; } entity.GiveQuest(this.strQuest); } // If the target is a player. EntityPlayerLocal Playerentity = this.targets[j] as EntityPlayerLocal; if (Playerentity != null) { if (string.IsNullOrEmpty(this.strQuest)) { continue; } Quest myQuest = QuestClass.CreateQuest(this.strQuest); myQuest.QuestGiverID = -1; Playerentity.QuestJournal.AddQuest(myQuest); } } }
public override void ExecuteUncatch(MinEventParams _params) { foreach (EntityAlive target in this.targets) { Execute(target); } }
public void _Execute(MinEventParams _params) { bool netSync = !_params.Self.isEntityRemote | _params.IsLocal; int entityId = _params.Self.entityId; for (int j = 0; j < this.targets.Count; j++) { string buff = ""; if (this.targets[j] is EntityPlayer) { buff = this.buffNames[0]; } else if (this.targets[j] is EntityZombie) { buff = this.buffNames[1]; } else if (this.targets[j] is EntityAnimal) { buff = this.buffNames[2]; } else { buff = this.buffNames[3]; } if (BuffManager.GetBuff(buff) == null) { continue; } this.targets[j].Buffs.AddBuff(buff, entityId, netSync, false); } }
// This loops through all the targets, refreshing the quest. // <triggered_effect trigger="onSelfBuffStart" action="PumpQuestSDX, Mods" target="self" /> public override void Execute(MinEventParams _params) { for (int j = 0; j < this.targets.Count; j++) { EntityAliveSDX entity = this.targets[j] as EntityAliveSDX; if (entity != null) { for (int k = 0; k < entity.QuestJournal.quests.Count; k++) { for (int l = 0; l < entity.QuestJournal.quests[k].Objectives.Count; l++) { entity.QuestJournal.quests[k].Objectives[l].Refresh(); } } continue; } EntityPlayerLocal entityPlayer = this.targets[j] as EntityPlayerLocal; if (entityPlayer != null) { for (int k = 0; k < entityPlayer.QuestJournal.quests.Count; k++) { for (int l = 0; l < entityPlayer.QuestJournal.quests[k].Objectives.Count; l++) { entityPlayer.QuestJournal.quests[k].Objectives[l].Refresh(); } } } } }
/** * Executing the upgrades */ public override void Execute(MinEventParams _params) { if (GameManager.Instance.World == null) { return; } World world = GameManager.Instance.World; for (int i = 0; i < this.targets.Count; i++) { Log.Out("Checking for Entity"); if (this.targets[i] as Entity == null) { Log.Out("Null, continue"); continue; } Vector3i currentPosition = new Vector3i(this.targets[i].GetPosition()); Dictionary <Vector3i, Block> blockPositions = CoordinateHelper.GetBlocksFromCoordinates(world, CoordinateHelper.GetCoOrdinatesAround(currentPosition, this.range)); foreach (KeyValuePair <Vector3i, Block> entry in blockPositions) { Block blockToCheck = entry.Value; if (blockToCheck.GetBlockName() != this.blockName) { continue; } BlockHelpers.DoBlockUpgrade(entry.Key, this.targets[i], this.requireMaterials); } } }
public override void Execute(MinEventParams _params) { for (int i = 0; i < this.buffNames.Length; i++) { if (BuffManager.GetBuff(this.buffNames[i]) != null) { for (int j = 0; j < this.targets.Count; j++) { Debug.Log(" Target: " + targets[j].EntityName + " Faction: " + targets[j].factionId); Debug.Log(" Self: " + _params.Self.EntityName + " Faction: " + _params.Self.factionId); // Check to make sure that the faction is the same if (MustMatch) { if (this.targets[j].factionId == _params.Self.factionId) { this.targets[j].Buffs.AddBuff(this.buffNames[i], _params.Self.entityId, !_params.Self.isEntityRemote); } } else { if (this.targets[j].factionId != _params.Self.factionId) { this.targets[j].Buffs.AddBuff(this.buffNames[i], _params.Self.entityId, !_params.Self.isEntityRemote); } } } } } }
public override void Execute(MinEventParams _params) { EntityPlayerLocal entityPlayer = _params.Self as EntityPlayerLocal; // Loot group if (_params.Self as EntityPlayerLocal != null && this.lootgroup > 0) { ItemStack[] array = LootContainer.lootList[lootgroup].Spawn(GameManager.Instance.lootManager.Random, this.CreateItemCount, EffectManager.GetValue(PassiveEffects.LootGamestage, null, (float)entityPlayer.HighestPartyGameStage, entityPlayer, null, default(FastTags), true, true, true, true, 1, true), 0f, entityPlayer, new FastTags()); for (int i = 0; i < array.Length; i++) { if (!LocalPlayerUI.GetUIForPlayer(entityPlayer).xui.PlayerInventory.AddItem(array[i], true)) { entityPlayer.world.gameManager.ItemDropServer(array[i], entityPlayer.GetPosition(), Vector3.zero, -1, 60f, false); } } return; } // item value. if (_params.Self as EntityPlayerLocal != null && this.CreateItem != null && this.CreateItemCount > 0) { ItemStack itemStack = new ItemStack(ItemClass.GetItem(this.CreateItem, false), this.CreateItemCount); if (!LocalPlayerUI.GetUIForPlayer(entityPlayer).xui.PlayerInventory.AddItem(itemStack, true)) { entityPlayer.world.gameManager.ItemDropServer(itemStack, entityPlayer.GetPosition(), Vector3.zero, -1, 60f, false); } } }
public override void Execute(MinEventParams _params) { for (int j = 0; j < this.targets.Count; j++) { EntityAliveSDX entity = this.targets[j] as EntityAliveSDX; if (entity) { int EntityID = entity.entityClass; // If the group is set, then use it. if (!string.IsNullOrEmpty(this.strSpawnGroup)) { EntityID = EntityGroups.GetRandomFromGroup(this.strSpawnGroup); } Entity NewEntity = EntityFactory.CreateEntity(EntityID, entity.position, entity.rotation); if (NewEntity) { NewEntity.SetSpawnerSource(EnumSpawnerSource.StaticSpawner); GameManager.Instance.World.SpawnEntityInWorld(NewEntity); Debug.Log("An entity was created: " + NewEntity.ToString()); if (NewEntity is EntityAliveSDX) { Debug.Log("Setting Mother ID to Baby: " + entity.entityId + " for " + NewEntity.entityId); (NewEntity as EntityAliveSDX).Buffs.SetCustomVar("Mother", entity.entityId, true); } } else { Debug.Log(" Could not Spawn baby for: " + entity.EntityName + " : " + entity.entityId); } } } }
public override void ExecuteUncatch(MinEventParams _params) { // Printer.Print("MinEventActionEject", _params.Self, _params.Other); if (CheckOthers && null == _params.Other) { return; // bleeding would cause jumping infinitely } EntityMover mover; Vector3 dir; if (null != this.targets) { // Printer.Print("MinEventActionEject has targets", targets.Count); mover = new EntityMover((int)dsi[0], dsi[1], (int)dsi[2]); foreach (EntityAlive ent in this.targets) { dir = strength * Vectors.Float.Randomize(Zombiome.rand, dirrandom, Vectors.Float.UnitY); if (ent != null) { mover.Apply(ent, dir); } } return; } mover = new EntityMover((int)dsi[0], dsi[1], (int)dsi[2]); dir = strength * Vectors.Float.Randomize(Zombiome.rand, dirrandom, Vectors.Float.UnitY); if (_params.Self != null) { mover.Apply(_params.Self, dir); } }
public override void Execute(MinEventParams _params) { // FromItem(_params, options.attr_xml); Debug.Log(String.Format(" MEA ZBManager Execute: {0} {1} {2} {3} ", _params, _params.Self, this.arg, started)); long delta = Tick(); if (delta > 10) { Zombiome.ExitGame(); // force re-init. should happen in between games. make sure dt_ref >> frequency } if (this.arg == "start" || this.arg == "enter") { Zombiome.Init(_params.Self.entityId); started = true; // also act on reborn ! } if (this.arg == "stop") { Zombiome.OnDisconnect(); started = false; // also act on reborn ! } }
public static void Execute(MinEventParams _params, Action <MinEventParams> action, Type mea, bool swallow = false) { try { action(_params); } catch (Exception ex) { if (GameManager.Instance == null) { Printer.Print("Routines Catcher with null GameManager"); } if (GameManager.Instance.World == null) { Printer.Print("Routines Catcher with null World"); } else { if (swallow) { Printer.WriteError(mea, ex); } else { Printer.WriteError(mea, ex); Printer.Print("ERROR in Routine:", mea); Printer.Print(ex); // prints the stack trace, even better than adding actual names ? throw ex; } } } }
public override void Execute(MinEventParams _params) { Debug.Log("Executing Random Loot"); EntityAliveSDX entity = _params.Self as EntityAliveSDX; // Only EntityAliveSDX if (entity == null) { return; } GameRandom _random = GameManager.Instance.World.GetGameRandom(); float Count = 1f; if (entity.Buffs.HasCustomVar("spLootExperience")) { Count = entity.Buffs.GetCustomVar("spLootExperience"); } Count = MathUtils.Clamp(Count, 1, 5); int MaxCount = (int)Math.Round(Count); // Loot group if (this.lootgroup.Length > 0) { Debug.Log("Generating Items : " + MaxCount); for (int x = 0; x < MaxCount; x++) { ItemStack item = LootContainer.GetRewardItem(lootgroup, Count); Debug.Log("Adding Item: " + item.ToString()); entity.lootContainer.AddItem(item); } } }
public override void ExecuteUncatch(MinEventParams _params) { foreach (EntityAlive Self in this.targets) // Expect ghost only if Self { Execute(Self, _params.Position); // Expects Position at ProjectileImpact break; } }
public override bool ParamsValid(MinEventParams _params) { int hour = GameUtils.WorldTimeToHours(GameManager.Instance.World.GetWorldTime()); if (hour == this.value) { return(true); } return(false); }
public override bool ParamsValid(MinEventParams _params) { Faction myFaction = FactionManager.Instance.GetFaction(_params.Self.factionId); if (myFaction.Name == strFaction) { return(true); } return(false); }
// <triggered_effect trigger="onSelfBuffStart" action="SkillPointSDX, Mods" target="self" value="2" /> // two Skill points public override void Execute(MinEventParams _params) { for (int i = 0; i < this.targets.Count; i++) { EntityPlayer entity = this.targets[i] as EntityPlayer; if (entity != null) { entity.Progression.SkillPoints += this.SkillPoint; } } }
public override bool ParamsValid(MinEventParams _params) { int hour = GameUtils.WorldTimeToHours(GameManager.Instance.World.GetWorldTime()); if (hour == this.value) { Debug.Log("Requirement hour match: " + hour); return(true); } return(false); }
/** Randomly drop item from hand/belt */ public override void ExecuteUncatch(MinEventParams _params) { foreach (EntityAlive target in this.targets) // Expect ghost only if Self { EntityPlayer player = target as EntityPlayer; if (null != player) { Execute(player); // Expects Position at ProjectileImpact break; } } }
/** * Checks whether the weather is overcast. */ public override bool IsValid(MinEventParams _params) { if (!this.ParamsValid(_params)) { return(false); } if (this.target == null) { return(false); } return(WeatherManager.GetCloudThickness() > 0.4f); }
public override void ExecuteUncatch(MinEventParams _params) { if (running) { return; } foreach (EntityAlive Self in this.targets) { Execute(Self); break; } }
public void _Execute(MinEventParams _params) { if (_params.Self as EntityPlayerLocal != null) { float intensity = 0; if (Zombiome.rand.RandomFloat > this.rate0) { intensity = Zombiome.rand.RandomFloat * this.intensity; } (_params.Self as EntityPlayerLocal).ScreenEffectManager.SetScreenEffect(this.effect_name, intensity, this.fade); } }
/** * Executing: If entity is dead, set it alive again and at max health. */ public override void Execute(MinEventParams _params) { for (int i = 0; i < this.targets.Count; i++) { Log.Out("Checking for Entity"); if (this.targets[i] as Entity != null) { Log.Out("Found Entity"); this.targets[i].SetAlive(); this.targets[i].AddHealth(this.targets[i].GetMaxHealth() / 2); } } }
public override void Execute(MinEventParams _params) { EntityPlayerLocal entityPlayer = _params.Self as EntityPlayerLocal; if (_params.Self as EntityPlayerLocal != null && this.CreateItem != null && this.CreateItemCount > 0) { ItemStack itemStack = new ItemStack(ItemClass.GetItem(this.CreateItem, false), this.CreateItemCount); if (!LocalPlayerUI.GetUIForPlayer(entityPlayer).xui.PlayerInventory.AddItem(itemStack, true)) { entityPlayer.world.gameManager.ItemDropServer(itemStack, entityPlayer.GetPosition(), Vector3.zero, -1, 60f, false); } } }
/** Kills self on contact with another Entity */ public override void ExecuteUncatch(MinEventParams _params) { Printer.Log(39, "ContactKill", _params.Self, this.targets.Count); foreach (Entity target in this.targets) { if (target != _params.Self) { SdtdUtils.EntityCreation.Kill(_params.Self); Printer.Log(39, "ContactKill", _params.Self, "KILLED"); return; } } }
string block = ""; // TODO: check standing on XXX ? public override bool IsValid(MinEventParams _params) { Printer.Log(82, "OnGroundRequirement", _params.Self); // FIXME self ou target ?? target probably ! if (!this.ParamsValid(_params)) { return(false); } if (_params.Self == null) { return(false); } return(_params.Self.onGround); }
/** * Executing the drop */ public override void Execute(MinEventParams _params) { for (int i = 0; i < this.targets.Count; i++) { Log.Out("Checking for Local Player"); if (this.targets[i] as EntityAlive != null) { Log.Out("Player Found! Dropping item on ground."); EntityHelper.DropItemOnGround(this.targets[i], ItemClass.GetItem(this.item), this.count); } Log.Warning("Player not found..."); } }
// changes the self's faction. // <triggered_effect trigger="onSelfBuffStart" action="ChangeFactionSDX, Mods" target="self" value="bandits" /> // change faction to bandits // <triggered_effect trigger="onSelfBuffStart" action="ChangeFactionSDX, Mods" target="self" value="undead" /> //change faction to undead // <triggered_effect trigger="onSelfBuffStart" action="ChangeFactionSDX, Mods" target="self" value="original" /> //change faction to the original value public override void Execute(MinEventParams _params) { for (int i = 0; i < this.targets.Count; i++) { EntityAlive entity = this.targets[i] as EntityAlive; if (entity != null) { // If the faction name is original, try to find the original faction of the entity, stored via cvar. if (Faction == "original") { // If there's already a factionoriginal cvar, retrive the faction name to be re-assigned. if (entity.Buffs.HasCustomVar("FactionOriginal")) { var FactionID = (byte)entity.Buffs.GetCustomVar("FactionOriginal"); Faction Temp = FactionManager.Instance.GetFaction(FactionID); if (Temp != null) { Faction = Temp.Name; } } else { if (FactionManager.Instance.GetFactionByName(entity.EntityName).ID == 0) { entity.factionId = FactionManager.Instance.CreateFaction(entity.EntityName, true, "").ID; entity.factionRank = byte.MaxValue; } } } // Search for the faction Faction newFaction = FactionManager.Instance.GetFactionByName(Faction); if (newFaction != null) { // If there's no original cvar, store it here. That's because it doesn't seem to persist over restarts, but cvars will if (!entity.Buffs.HasCustomVar("FactionOriginal")) { entity.Buffs.SetCustomVar("FactionOriginal", entity.factionId); } // Set the new faction ID as a cvar for saving. entity.Buffs.SetCustomVar("FactionNew", newFaction.ID); Debug.Log("Changing " + entity.EntityName + " faction from " + entity.factionId + " to " + newFaction.ID); entity.factionId = newFaction.ID; Debug.Log("\nNew Faction: " + entity.factionId); } } } }
// This loops through all the targets, giving each target the quest. // <triggered_effect trigger="onSelfBuffStart" action="AnimatorSpeedSDX, Mods" target="self" value="1" /> // normal speed // <triggered_effect trigger="onSelfBuffStart" action="AnimatorSpeedSDX, Mods" target="self" value="2" /> // twice the speed public override void Execute(MinEventParams _params) { for (int i = 0; i < this.targets.Count; i++) { EntityAliveSDX entity = this.targets[i] as EntityAliveSDX; if (entity != null) { if (this.targets[i].emodel != null && this.targets[i].emodel.avatarController != null) { this.targets[i].emodel.avatarController.anim.speed = floatSpeed; } } } }
// <triggered_effect trigger="onSelfBuffStart" action="PlayerLevelSDX, Mods" target="self" /> public override void Execute(MinEventParams _params) { for (int i = 0; i < this.targets.Count; i++) { EntityPlayerLocal entity = this.targets[i] as EntityPlayerLocal; if (entity != null) { if (entity.Progression.Level < Progression.MaxLevel) { entity.Progression.Level++; GameManager.ShowTooltipWithAlert(entity, string.Format(Localization.Get("ttLevelUp", string.Empty), entity.Progression.Level.ToString(), entity.Progression.SkillPoints), "levelupplayer"); } } } }