public void ExecuteScreenEffect(string name, float intens = 1f) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; player.ScreenEffectManager.SetScreenEffect(name); GameManager.Instance.StartCoroutine(Routines.Call( () => player.ScreenEffectManager.SetScreenEffect(name, intens), 4f )); /* * Blur : flou * Bright : brillant lumineux * Cold : contour ecran * Dark : contour ecran * Dead (no intensity) : contour ecran * Distortion : taré ! * Drunk * Dying (no intensity) * Hot : contour ecran * Posterize : effets de gamma bizarre ? * Underwater * Vibrant : lumineux * VibrantDeSat */ }
public static bool ConvertAndCraft(Recipe recipe, EntityPlayerLocal player, XUiController ItemController) { bool result = false; XUi xui = ItemController.xui; XUiC_CraftingWindowGroup childByType = xui.FindWindowGroupByName("crafting").GetChildByType <XUiC_CraftingWindowGroup>(); ItemValue itemValue = ((XUiC_ItemStack)ItemController).ItemStack.itemValue; if (!CheckIngredients(recipe.ingredients, player)) { return(false); } // Verify we can craft this. if (!recipe.CanCraft(recipe.ingredients, player)) { return(false); } if (!childByType.AddRepairItemToQueue(recipe.craftingTime, itemValue.Clone(), itemValue.MaxUseTimes)) { WarnQueueFull(player); return(false); } ((XUiC_ItemStack)ItemController).ItemStack = ItemStack.Empty.Clone(); xui.PlayerInventory.RemoveItems(recipe.ingredients, 1); result = true; return(result); }
private static void ShowBlockMap(List <string> _params) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; Vector3i pos = Vectors.ToInt(player.GetPosition()); BlockValue current; pos.y = 0; current = GameManager.Instance.World.GetBlock(pos); Printer.Print(pos, "->", current.Block, current); pos.y = 1; current = GameManager.Instance.World.GetBlock(pos); Printer.Print(pos, "->", current.Block, current); pos.y = 254; current = GameManager.Instance.World.GetBlock(pos); Printer.Print(pos, "->", current.Block, current); pos.y = 255; current = GameManager.Instance.World.GetBlock(pos); Printer.Print(pos, "->", current.Block, current); pos.y = 256; current = GameManager.Instance.World.GetBlock(pos); Printer.Print(pos, "->", current.Block, current); pos.y = -1; current = GameManager.Instance.World.GetBlock(pos); Printer.Print(pos, "->", current.Block, current); }
public IEnumerator _Execute(List <string> _params, CommandSenderInfo _senderInfo) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; int eb = int.Parse(_params[0]); string buffname = buffs[eb]; Printer.Print("ConsoleCmdExplShowExplo", _params, buffname); // todo: surface Emplacement place = Emplacement.At(player.GetPosition() + new Vector3(0, 1, 10), Vectors.Float.Zero); // N Entity Requested = SdtdUtils.EntityCreation.Spawn(place.position, "zombieMoe"); int eid = Requested.entityId; yield return(SdtdUtils.EntityCreation.WaitEntity(Requested)); Entity ent = GameManager.Instance.World.GetEntity(eid); if (ent == null) { Debug.Log(String.Format("SpawnAndbuff failed entity {0} {1}", eid, Requested)); yield break; } EntityAlive entity = ent as EntityAlive; if (entity != null) { if (!entity.Buffs.HasBuff(buffname)) { entity.Buffs.AddBuff(buffname); } } }
public static bool CheckIngredients(List <ItemStack> ingredients, EntityPlayerLocal player) { bool result = true; foreach (ItemStack ingredient in ingredients) { // Check if the palyer hs the items in their inventory or bag. int playerHas = player.inventory.GetItemCount(ingredient.itemValue); if (ingredient.count > playerHas) { playerHas = player.bag.GetItemCount(ingredient.itemValue); if (ingredient.count > playerHas) { result = false; } } } //// The player has all the ingredients. //if ( result ) //{ // if (ingredient.count < playerHas) // { // ItemClass itemClass = ItemClass.GetItemClass(ingredient.itemValue.ItemClass.GetItemName(), false); // ItemStack missingStack = new ItemStack(ingredient.itemValue, ingredient.count); // player.AddUIHarvestingItem(missingStack, true); // result = false; // } //} return(result); }
private static void ShowInventory(List <string> _params) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; Inventory inventory = player.inventory; for (int k = 0; k < 9; k++) { Printer.Print("Inventory", k, inventory.GetItemInSlot(k), inventory[k]); } // CanStack/ TryStackItem / CanStackNoEmpty // Bag bag = player.bag; // ItemStack adding = new ItemStack(ItemClass.GetItem("resourceSnowBall", false), 1); // bag.AddItem(adding); for (int k = 0; k < 5; k++) { EffectsInventory.AddToBag(player, "resourceSnowBall", false, 1); } string item; item = "drinkJarYuccaJuice"; Printer.Print(item, EffectsBag.IsGroup(item)); item = "drinkJarGoldenRodTea"; Printer.Print(item, EffectsBag.IsGroup(item)); item = "foodEggBoiled"; Printer.Print(item, EffectsBag.IsGroup(item)); }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; string buff = _params[0]; bool force = false; int eid = -1; if (_params.Count > 1) { eid = int.Parse(_params[1]); } if (_params.Count > 2) { force = true; } if (eid == -1) { eid = player.entityId; } Entity ent = GameManager.Instance.World.GetEntity(eid); EntityAlive ea = ent as EntityAlive; Printer.Print("ConsoleCmdBuffSelf", _params, buff); if (buff.StartsWith("-")) { ea.Buffs.RemoveBuff(buff.Substring(1)); // only if Has ? return; } if (force || !ea.Buffs.HasBuff(buff)) { ea.Buffs.AddBuff(buff); } // NETWORK ? }
// Take logic to replace it with the Downgrade block, matching rotations. private void TakeTarget(object obj) { World world = GameManager.Instance.World; object[] array = (object[])obj; int clrIdx = (int)array[0]; BlockValue _blockValue = (BlockValue)array[1]; Vector3i vector3i = (Vector3i)array[2]; BlockValue block = world.GetBlock(vector3i); EntityPlayerLocal entityPlayerLocal = array[3] as EntityPlayerLocal; // Find the block value for the pick up value, and add it to the inventory BlockValue pickUpBlock = Block.GetBlockValue(this.PickedUpItemValue, true); LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayerLocal); ItemStack itemStack = new ItemStack(pickUpBlock.ToItemValue(), 1); if (!uiforPlayer.xui.PlayerInventory.AddItem(itemStack, true)) { uiforPlayer.xui.PlayerInventory.DropItem(itemStack); } entityPlayerLocal.PlayOneShot("Sounds/DestroyBlock/wooddestroy1"); // Damage the block for its full health this.DamageBlock(world, clrIdx, vector3i, block, block.Block.blockMaterial.MaxDamage, entityPlayerLocal.entityId, false); }
public static void ShowOthers() { List <EntityPlayerLocal> players = GameManager.Instance.World.GetLocalPlayers(); EntityPlayerLocal player = players[0]; World world = GameManager.Instance.World; Vector3i where = Vectors.ToInt(player.GetPosition()); BiomeIntensity bi = new BiomeIntensity(); world.GetBiomeIntensity(where, out bi); Printer.Print("BiomeIntensity:", bi); bool osa = world.IsOpenSkyAbove(0, where.x, where.y, where.z); Printer.Print("IsOpenSkyAbove:", osa); Printer.Print("player (stuck, prevPos, taregtPos):", player, player.IsStuck, player.prevPos, "private");// player.targetPos); Printer.Print("player (motion, dwalked, dclimbed):", player, player.motion, player.distanceWalked, player.distanceClimbed); ulong wt = world.GetWorldTime(); int day = GameUtils.WorldTimeToDays(wt); int hou = GameUtils.WorldTimeToHours(wt); int min = GameUtils.WorldTimeToMinutes(wt); Printer.Print("world time", wt, day, hou, min); }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { /* * Subbiomes seem always equal to main main biome * Subbiomes have no subbiomes */ List <EntityPlayerLocal> players = GameManager.Instance.World.GetLocalPlayers(); EntityPlayerLocal player = players[0]; foreach (string b in new string[] { "snow", "pine_forest", "desert", "water", "radiated", "wasteland" }) { BiomeDefinition bd = WorldBiomes.Instance.GetBiome(b); // or World.Biomes.GetBiome(b) ! ShowBiome(bd); } if (false) { // BiomeDefinition biome = this.world.GetBiome(this.blockPosStandingOn.x, this.blockPosStandingOn.z); BiomeDefinition bd = player.biomeStandingOn; ShowBiome(bd); ShowOthers(); } }
// Handles what happens to the contents of the box when you pick up the block. private void EventData_Event(object obj) { #region EventData_Event World world = GameManager.Instance.World; object[] array = (object[])obj; int clrIdx = (int)array[0]; BlockValue blockValue = (BlockValue)array[1]; Vector3i vector3i = (Vector3i)array[2]; BlockValue block = world.GetBlock(vector3i); EntityPlayerLocal entityPlayerLocal = array[3] as EntityPlayerLocal; TileEntityLootContainer tileEntityLootContainer = world.GetTileEntity(clrIdx, vector3i) as TileEntityLootContainer; if (tileEntityLootContainer != null) { world.GetGameManager().DropContentOfLootContainerServer(blockValue, vector3i, tileEntityLootContainer.entityId); } // Pick up the item and put it inyor your inventory. LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayerLocal); ItemStack itemStack = new ItemStack(block.ToItemValue(), 1); if (!uiforPlayer.xui.PlayerInventory.AddItem(itemStack, true)) { uiforPlayer.xui.PlayerInventory.DropItem(itemStack); } world.SetBlockRPC(clrIdx, vector3i, BlockValue.Air); #endregion }
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 static void AddQuestToRadius(String strQuest, Vector3 position, int Radius) { // If there's no radius, pick 30 blocks. if (Radius <= 0) { Radius = 30; } World world = GameManager.Instance.World; List <Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(null, new Bounds(position, Vector3.one * Radius)); if (entitiesInBounds.Count > 0) { for (int i = 0; i < entitiesInBounds.Count; i++) { EntityAliveSDX entity = entitiesInBounds[i] as EntityAliveSDX; if (entity != null) { entity.QuestJournal.AddQuest(QuestClass.CreateQuest(strQuest)); } EntityPlayerLocal player = entitiesInBounds[i] as EntityPlayerLocal; if (player != null) { player.QuestJournal.AddQuest(QuestClass.CreateQuest(strQuest)); } } } }
private static IEnumerator TestMB(List <string> _params) { int mpos = int.Parse(_params[0]); int mblk = int.Parse(_params[1]); int mmid = int.Parse(_params[2]); int my = int.Parse(_params[3]); EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; Vector3 pos = player.GetPosition(); Vector3i ipos = Vectors.ToInt(pos) + 5 * Vectors.North; BlockValue block = Block.GetBlockValue("rockResource"); GameManager.Instance.World.SetBlockRPC(0, ipos, block); yield return(new WaitForSeconds(1f)); /* * scrapIronFrameMaster: ok efface tout (pas de downgraded rockResourceBroke !) * rockResource : ne marche pas. car mb, ou car identique ? * chemistryStation: marche bien */ // scrapIronFrameMaster Vector3i at = ipos + mpos * Vectors.North; string[] blocks = new string[] { "air", "scrapIronFrameMaster", "rockResource", "chemistryStation", "airFake" }; // both air work. do I need intermediate yield ? /* Sans yield, air détuit le block et empeche le nv, alor que airFake fonctionne ... * */ if (mmid == -1) { List <BlockChangeInfo> changes = new List <BlockChangeInfo>(); changes.Add(new BlockChangeInfo(0, at, Block.GetBlockValue("airFake"))); changes.Add(new BlockChangeInfo(0, at, Block.GetBlockValue(blocks[mblk]))); GameManager.Instance.World.SetBlocksRPC(changes); } else { if (mmid == 1) { GameManager.Instance.World.SetBlockRPC(0, at, BlockValue.Air); if (my > 0) { yield return(new WaitForSeconds(my * 0.1f)); } } else if (mmid == 2) { GameManager.Instance.World.SetBlockRPC(0, at, Block.GetBlockValue("airFake")); if (my > 0) { yield return(new WaitForSeconds(my * 0.1f)); } } GameManager.Instance.World.SetBlockRPC(0, at, Block.GetBlockValue(blocks[mblk])); } }
public static bool ConvertAndCraft(string strRecipe, int Reduction, EntityPlayerLocal player, XUiController ItemController) { bool result = false; Recipe newRecipe = GetReducedRecipes(strRecipe, Reduction); result = ConvertAndCraft(newRecipe, player, ItemController); return(result); }
public static bool Prefix(ItemActionEntryRepair __instance) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return(true); } XUi xui = __instance.ItemController.xui; ItemValue itemValue = ((XUiC_ItemStack)__instance.ItemController).ItemStack.itemValue; ItemClass forId = ItemClass.GetForId(itemValue.type); EntityPlayerLocal player = xui.playerUI.entityPlayer; XUiC_CraftingWindowGroup childByType = xui.FindWindowGroupByName("crafting").GetChildByType <XUiC_CraftingWindowGroup>(); List <ItemStack> repairItems = new List <ItemStack>(); // If the item has a repairItems, use that, instead of the vanilla version. if (forId.Properties.Classes.ContainsKey("RepairItems")) { Recipe recipe = new Recipe(); DynamicProperties dynamicProperties3 = forId.Properties.Classes["RepairItems"]; recipe.ingredients = ItemsUtilities.ParseProperties(dynamicProperties3); // Get an adjusted Craftint time from the player. recipe.craftingTime = (int)EffectManager.GetValue(PassiveEffects.CraftingTime, null, recipe.craftingTime, xui.playerUI.entityPlayer, recipe, FastTags.Parse(recipe.GetName()), true, true, true, true, 1, true); ItemsUtilities.ConvertAndCraft(recipe, player, __instance.ItemController); return(false); } else if (forId.Properties.Contains("RepairItems")) // to support <property name="RepairItems" value="resourceWood,10,resourceForgedIron,10" /> { Recipe recipe = new Recipe(); string strData = forId.Properties.Values["RepairItems"].ToString(); recipe.ingredients = ItemsUtilities.ParseProperties(strData); // Get an adjusted Craftint time from the player. recipe.craftingTime = (int)EffectManager.GetValue(PassiveEffects.CraftingTime, null, recipe.craftingTime, xui.playerUI.entityPlayer, recipe, FastTags.Parse(recipe.GetName()), true, true, true, true, 1, true); ItemsUtilities.ConvertAndCraft(recipe, player, __instance.ItemController); return(false); } // If there's no RepairTools defined, then fall back to recipe reduction else if (forId.RepairTools == null || forId.RepairTools.Length <= 0) { // Determine, based on percentage left, int RecipeCountReduction = 2; if (itemValue.PercentUsesLeft < 0.2) { RecipeCountReduction = 3; } // Use the helper method to reduce the recipe count, and control displaying on the UI for consistenncy. ItemsUtilities.ConvertAndCraft(forId.GetItemName(), RecipeCountReduction, player, __instance.ItemController); return(false); } // Fall back to possible RepairTools return(true); }
public static bool Prefix(PlayerMoveController __instance, EntityPlayerLocal ___entityPlayerLocal) { if (___entityPlayerLocal.inventory.GetFocusedItemIdx() < 0 || ___entityPlayerLocal.inventory.GetFocusedItemIdx() > 10) { ___entityPlayerLocal.inventory.SetFocusedItemIdx(0); ___entityPlayerLocal.inventory.SetHoldingItemIdx(0); } return(false); }
private static void ShowPos(List <string> _params) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; Vector3i pos = Vectors.ToInt(player.GetPosition()); Vector3i c1 = ZChunk.TL1(pos.x, pos.z); Vector3i c4 = ZChunk.TL4(pos); Printer.FPrint("Pos {0} -> {1}. C4={2}", pos, c1, c4); }
private void DisplayToolTipText(string str) { EntityPlayerLocal entity = GameManager.Instance.World.GetLocalPlayer(); if (DateTime.Now > dteNextToolTipDisplayTime) { GameManager.ShowTooltip(entity, str); dteNextToolTipDisplayTime = DateTime.Now.AddSeconds(0.6f); } }
public static void WarnQueueFull(EntityPlayerLocal player) { string text = "No room in queue!"; if (Localization.Exists("wrnQueueFull", "")) { text = Localization.Get("wrnQueueFull", ""); } GameManager.ShowTooltip(player, text); Audio.Manager.PlayInsidePlayerHead("ui_denied", -1, 0f, false, false); }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; string sound = _params[0]; Printer.Print("ConsoleCmdBuffSelf", _params, sound); // Audio.Manager.PlayInsidePlayerHead(sound, player.entityId); // 0f, false, false // -1 isentityID, could be player's // local player only (Vs. Manager.BroadcastPlay) Audio.Manager.Play(player, sound, 1f, false); // NB: sound uses # and $ for 1/2 and male/female }
static void Postfix(EntityPlayerLocal __instance) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return; } AdvLogging.DisplayLog(AdvFeatureClass, "Activating One Block Crouch"); __instance.vp_FPController.PhysicsCrouchHeightModifier = 0.49f; __instance.vp_FPController.SyncCharacterController(); }
private bool UpdateCluster(EntityPlayerLocal player) { if (!PlayerClusters.ContainsKey(player.entityId)) { PlayerClusterState Insert = new PlayerClusterState(player); PlayerClusters[player.entityId] = Insert; } PlayerClusterState State = PlayerClusters[player.entityId]; State.inner_state.MoveNext(); return(State.stopped); }
/* * 1: petite explo (mine qui pete, small smoke trail only, no fire) * 2: med/Large explo orange / rouge + etincelles (pas vraiment explo) * 3: redish fire, flamme rouge montante + bcp black smoke * 4: redish idem, larger * 5: yellow/orange expl, +bcp black smoke * 6 :idem * 7: vomit, 8: gore block explo * 9: like 6 * * 10: molotov (fire ball when in the air) * 11-12: yellow etincelles only, no smoke * 13: orange boom no smoke, like 1 * 14-19: crée un bout de bidons détruit * 14: le bout part en l'air avec une trainée de flamme ("napalm") * 15/ 16: additionnal "napalm" */ public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { Printer.Print("ConsoleCmdExplShowExplo", _params); EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; if (_params[0] == "p") { Color color = Color.white; if (_params.Count >= 3) { string[] split = _params[2].Split(','); float[] def = new float[] { 0, 0, 0, 1 }; for (int k = 0; k < split.Length; k++) { def[k] = float.Parse(split[k]); } color = new Color(def[0], def[1], def[2], def[3]); } Printer.Print(color); ExecuteParticle(_params[1], player.GetPosition() + new Vector3(0, 0, 6), color); return; } else if (_params[0] == "pa") { ExecuteParticleAttach(_params[1], player.GetPosition()); return; } else if (_params[0] == "pg") { ExecuteParticleGhost(_params[1], player.GetPosition()); return; } else if (_params[0] == "s") { float intens = 1f; if (_params.Count > 0) { intens = float.Parse(_params[1]); } ExecuteScreenEffect(_params[1]); return; } int ei = int.Parse(_params[0]); Emplacement place = Emplacement.At(player.GetPosition() + new Vector3(0, 1, 10), Vectors.Float.Zero); // N ItemClass itemClass = ItemClass.GetItemClass("thrownAmmoMolotovCocktail", false); DynamicProperties baseProps = itemClass.Properties; ExplosionData ed = new ExplosionData(baseProps); ed.ParticleIndex = ei; GameManager.Instance.ExplosionServer(0, place.position, place.ipos, Quaternion.identity, ed, player.entityId, 0.1f, false, null); // try -1 }
public static void OnDisconnect() { /* Done: quit game and restart another * - Don't stop "forever" * - Allow bools to restart * */ EntityPlayerLocal player = GameManager.Instance.World.GetLocalPlayers()[0]; ZombiomeManager.Stop(player.entityId, true); IsInit = false; }
static void Postfix(PlayerMoveController __instance, ref EntityPlayerLocal ___entityPlayerLocal) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return; } if (__instance.playerInput.Crouch.IsPressed && !___entityPlayerLocal.IsFlyMode.Value) { ___entityPlayerLocal.cameraTransform.position -= Vector3.down; } }
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); } } }
/** * When the player activates this entityclass with an empty hand, try to pick it up. */ public override void Kill(DamageResponse _dmgResponse) { if (_dmgResponse.Source.getEntityId() == -1) { base.Kill(_dmgResponse); Log.Warning("Killer was not a player."); return; } EntityPlayerLocal entityPlayerLocal = GameManager.Instance.World.GetLocalPlayerFromID(_dmgResponse.Source.getEntityId()) as EntityPlayerLocal; if (!(entityPlayerLocal is EntityPlayerLocal)) { base.Kill(_dmgResponse); Log.Warning("Killer was an entity, but not a player."); return; } LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(entityPlayerLocal); if (uiforPlayer.xui.isUsingItemActionEntryUse) { base.Kill(_dmgResponse); Log.Warning("XUI interfering."); return; } ItemStack pickup = new ItemStack(this.itemReturned, 1); if (!entityPlayerLocal.inventory.CanTakeItem(pickup) & !entityPlayerLocal.bag.CanTakeItem(pickup)) { base.Kill(_dmgResponse); Log.Warning("Canot take item - no room in inventory."); return; } Log.Out("Player is holding: " + entityPlayerLocal.inventory.holdingItem.GetItemName()); if (entityPlayerLocal.inventory.holdingItem.GetItemName() == "meleeHandPlayer") { Log.Out("Server, despawn the entity."); GameManager.Instance.World.RemoveEntity(this.entityId, EnumRemoveEntityReason.Killed); Log.Out("Player, add the item."); entityPlayerLocal.inventory.AddItem(pickup); return; } Log.Warning("Cannot activate."); base.Kill(_dmgResponse); return; }
public static EntityPlayerLocal BuildLocalPlayer(ClientInfo _cInfo) { Log.Out("[SERVERTOOLS] Building local player"); EntityPlayer _entityPlayer = GameManager.Instance.World.Players.dict[_cInfo.entityId]; EntityPlayerLocal _entityPlayerLocal = new EntityPlayerLocal(); _entityPlayerLocal.clientEntityId = _entityPlayer.clientEntityId; _entityPlayerLocal.belongsPlayerId = _entityPlayer.belongsPlayerId; _entityPlayerLocal.inventory = _entityPlayer.inventory; _entityPlayerLocal.bag = _entityPlayer.bag; _entityPlayerLocal.equipment = _entityPlayer.equipment; _entityPlayerLocal.persistentPlayerData = GameManager.Instance.GetPersistentPlayerList().GetPlayerDataFromEntityID(_entityPlayer.entityId); return(_entityPlayerLocal); }
// Returns true for the default PlaceBlock code to execute. If it returns false, it won't execute it at all. static bool Prefix(PlayerMoveController __instance, EntityPlayerLocal ___entityPlayerLocal) { if (__instance.playerInput.Jump.IsPressed || __instance.playerInput.Menu.IsPressed) { foreach (BuffValue buff in ___entityPlayerLocal.Buffs.ActiveBuffs) { if (buff.BuffName.ToLower().Contains("buffcutscene")) { ___entityPlayerLocal.Buffs.RemoveBuff(buff.BuffName); } } } return(true); }