public static void CreatePotion(PotionTypes potionType, Transform parent = null) { GameObject potionObject = new GameObject("Potion", typeof(Potion)); potionObject.GetComponent <Potion>().SetPotionStats(potionType); potionObject.transform.parent = parent; }
public static Image Shuffle() { switch (ReturnItem()) { case ItemTypes.EnergyPotion: typePotion = PotionTypes.Energy; typeBonus = 0; return new Image("PotionsContents/energyPotion"); case ItemTypes.Damage: typeBonus = BonusType.Damage; typePotion = 0; return new Image("BonusContents/boltBonus"); case ItemTypes.Freeze: typeBonus = BonusType.Freeze; typePotion = 0; return new Image("BonusContents/freezBonus"); case ItemTypes.HPPotion: typePotion = PotionTypes.Health; typeBonus = 0; return new Image("PotionsContents/hpPotion"); case ItemTypes.ShieldPotion: typePotion = PotionTypes.Shields; typeBonus = 0; return new Image("PotionsContents/shieldPotion"); case ItemTypes.Wind: typeBonus = BonusType.Wind; typePotion = 0; return new Image("BonusContents/windBonus"); default: // TODO NOT WORKING PROPERLY throw new NotImplementedException("inccorect shuffle case !"); } }
public PotionManager(string Name, string id, string Desc, int agility, int strength, int wisdom, int defence, PotionTypes type, int spellEffectID) { name = Name; description = Desc; itemid = "item.potion." + type.ToString().ToLower() + "." + id.ToLower(); Agility = agility; Strength = strength; Wisdom = wisdom; Defence = defence; PotionType = type; SpellEffectID = spellEffectID; }
public void Spawn(Vector3 spawnPosition, PotionTypes type, float _speed) { refill = false; speed = _speed; transform.position = spawnPosition; CurrentType = type; SetMaterial(); CurrentState = PotionState.inGame; if (EventManager.OnPotionSpawn != null) { EventManager.OnPotionSpawn(this); } }
private int PotionStrength(int potionStrengthGenerated, PotionTypes potionTypes) { switch (potionTypes) { case PotionTypes.Health: if (potionStrengthGenerated == 1) { return(20); } else if (potionStrengthGenerated == 2) { return(60); } else { return(100); } case PotionTypes.Defence: if (potionStrengthGenerated == 1) { return(5); } else if (potionStrengthGenerated == 2) { return(10); } else { return(20); } case PotionTypes.Attack: if (potionStrengthGenerated == 1) { return(5); } else if (potionStrengthGenerated == 2) { return(10); } else { return(20); } default: return(0); } }
private string PotionDescription(PotionTypes potionTypes, int potionStrengthGenerated) { switch (potionTypes) { case PotionTypes.Health: if (potionStrengthGenerated == 1) { return("A small health potion"); } else if (potionStrengthGenerated == 2) { return("A medium health potion"); } else { return("A large health potion"); } case PotionTypes.Defence: if (potionStrengthGenerated == 1) { return("A small Defence potion"); } else if (potionStrengthGenerated == 2) { return("A medium Defence potion"); } else { return("A large Defence potion"); } case PotionTypes.Attack: if (potionStrengthGenerated == 1) { return("A small Strength potion"); } else if (potionStrengthGenerated == 2) { return("A medium Strength potion"); } else { return("A large Strength potion"); } default: return("A empty vial"); } }
private string PotionType(int potionTypeGenerated) { if (potionTypeGenerated == 1) { potionTypes = PotionTypes.Health; return("Health Potion"); } else if (potionTypeGenerated == 2) { potionTypes = PotionTypes.Defence; return("Defence Potion"); } else { potionTypes = PotionTypes.Attack; return("Attack Potion"); } }
public static void ExtractEffect(IShip targetShip, PotionTypes type) { switch (type) { case PotionTypes.Energy: targetShip.Energy += (int)type; break; case PotionTypes.Health: targetShip.Health += (int)type; break; case PotionTypes.Shields: targetShip.Shields += (int)type; break; case PotionTypes.Null: break; //default: // throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public static Image Shuffle() { switch (ReturnItem()) { case ItemTypes.EnergyPotion: typePotion = PotionTypes.Energy; typeBonus = 0; return(new Image("PotionsContents/energyPotion")); case ItemTypes.Damage: typeBonus = BonusType.Damage; typePotion = 0; return(new Image("BonusContents/boltBonus")); case ItemTypes.Freeze: typeBonus = BonusType.Freeze; typePotion = 0; return(new Image("BonusContents/freezBonus")); case ItemTypes.HPPotion: typePotion = PotionTypes.Health; typeBonus = 0; return(new Image("PotionsContents/hpPotion")); case ItemTypes.ShieldPotion: typePotion = PotionTypes.Shields; typeBonus = 0; return(new Image("PotionsContents/shieldPotion")); case ItemTypes.Wind: typeBonus = BonusType.Wind; typePotion = 0; return(new Image("BonusContents/windBonus")); default: // TODO NOT WORKING PROPERLY throw new NotImplementedException("inccorect shuffle case !"); } }
public BasePotionItem( string itemName, string itemDescription, int itemId, ItemTypes itemType, int stackSize, Sprite spriteNeutral, Sprite spriteHighlighted, PotionTypes potionType, int stamina, int endurance, int agility, int strenght ) : base(itemName, itemDescription, itemId, itemType, stackSize, spriteNeutral, spriteHighlighted) { this.stamina = stamina; this.strenght = strenght; this.agility = agility; this.endurance = endurance; this.potionType = potionType; }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Q)) { keypressed = PotionTypes.Q; CheckFill(); } else if (Input.GetKeyDown(KeyCode.R)) { keypressed = PotionTypes.R; CheckFill(); } else if (Input.GetKeyDown(KeyCode.U)) { keypressed = PotionTypes.U; CheckFill(); } else if (Input.GetKeyDown(KeyCode.P)) { keypressed = PotionTypes.P; CheckFill(); } }
public void GetPotion(PotionTypes potionType) { CreatePotionEffect.ExtractEffect(this.Ship, potionType); }
public void Update(GameTime gameTime) { previousInputAction = inputAction; characterAdjuster.UpdateCharacter(gameTime); characterAdjuster.GrabInput(inputAction, playerIndex, playerSpeed, stunned, slowed, slept, incapped, impactLocation); playerAnimations.currentFrame = characterAdjuster.PassInFrame(); if (potionType != PotionTypes.None) { potionTimer += gameTime.ElapsedGameTime.Milliseconds; if (incrementRed == true) { r += 50; if (r >= 255) { r = 0; incrementRed = false; incrementBlue = true; } } if (incrementBlue == true) { b += 50; if (b >= 255) { b = 0; incrementBlue = false; incrementGreen = true; } } if (incrementGreen == true) { g += 50; if (g >= 255) { g = 0; incrementGreen = false; incrementRed = true; } } if (potionType == PotionTypes.Shield) { if (potionTimer >= 10000) { potionType = PotionTypes.None; } } else { if (potionTimer >= 5000) { potionType = PotionTypes.None; } } } DashEffects(gameTime); UpdateDashEffects(gameTime); StatusEffects(gameTime); input.slowed = slowed; input.incapped = incapped; if (AI == false) { angle = input.ReturnAngle(); if (stunned == false && slept == false && incapped == false) { input.Update(gameTime); } ShotMeter(); if (incapped == false) { inputAction = input.inputAction; } else if (incapped == true) { inputAction = InputAction.None; } PlayerMovement(gameTime); CalculateRotationOrigin(); CalculateProjectileOriginAndDirection(); shootingAngle = input.ReturnAngle(); input.GetRotationOrigin(reticalLocation); } else if (AI == true) { } if (playerChoice == 2) { if (inputAction == InputAction.Reflect && tiredreflectAnimation.currentFrame < 0) { tiredWizardCloud = true; if (playerIndex == PlayerIndex.One) { tiredreflectAnimation.currentFrame = 0; } else if (playerIndex == PlayerIndex.Two) { tiredreflectAnimation.currentFrame = 12; } } if (tiredreflectAnimation.currentFrame >= 0) { tiredReflectCounter += gameTime.ElapsedGameTime.Milliseconds; tiredreflectAnimation.Update(gameTime); if (playerIndex == PlayerIndex.One) { if (tiredreflectAnimation.currentFrame == 11) { tiredreflectAnimation.currentFrame = 8; } } if (playerIndex == PlayerIndex.Two) { if (tiredreflectAnimation.currentFrame == 23) { tiredreflectAnimation.currentFrame = 20; } } if (tiredReflectCounter >= 3500) { tiredreflectAnimation.currentFrame = -1; tiredReflectCounter = 0; tiredWizardCloud = false; } } } for (int i = 0; i < chargePotAnims1.Count; i++) { chargePotAnims1[i].Update(gameTime); if (i + 1 > chargePotAnims1.Count - 1) { if (chargePotAnims1[i].currentFrame == 3) { chargePotAnims1[i - 4].currentFrame = 0; } } else { if (chargePotAnims1[i].currentFrame == 3) { chargePotAnims1[i + 1].currentFrame = 0; } } if (chargePotAnims1[i].currentFrame == 6) { chargePotAnims1[i].currentFrame = 6; } } foreach (Animation shieldPanel in shieldPanels) { if (potionType == PotionTypes.Shield) { if (shieldPanel.currentFrame < 46 || shieldPanel.currentFrame > 46) { shieldPanel.Update(gameTime); } if (potionTimer > 9700 && potionTimer < 9750) { shieldPanel.currentFrame = 47; } } } if (potionType == PotionTypes.Shield) { if (shieldFrame.currentFrame < 46 || shieldFrame.currentFrame > 46) { shieldFrame.Update(gameTime); } if (potionTimer > 9700 && potionTimer < 9750) { shieldFrame.currentFrame = 47; } } }
public Player(ControlType controlType, PlayerIndex playerIndex, GraphicsDeviceManager graphics, GameStates gameState) { characterAdjuster = new CharacterAdjuster(); this.graphics = graphics; this.playerIndex = playerIndex; this.gameState = gameState; impactLocation = ImpactLocations.None; if (this.gameState == GameStates.SinglePlayer && playerIndex == PlayerIndex.Two) { AI = true; } input = new Input(controlType, playerIndex, AI); health = 3; score = 0; playerSpeed = 5; potionType = PotionTypes.None; chargePotAnims1.Add(new Animation(chargePotAnimT1, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT2, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT3, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT4, 2, 3)); chargePotAnims1.Add(new Animation(chargePotAnimT5, 2, 3)); kickedUpDust = new Animation(kickedUpDustT, 3, 8); landingPoof = new Animation(landingPoofT, 3, 10); sleepEffect = new Animation(sleepEffectT, 1, 4); slowEffect = new Animation(slowEffectT, 2, 2); stunnedEffect = new Animation(stunnedEffectT, 2, 3); playerAnimations = new Animation(buffSpriteT, 6, 20); if (playerChoice == 1) { playerAnimations = new Animation(buffSpriteT, 6, 20); } if (playerChoice == 2) { playerAnimations = new Animation(tiredSpriteT, 14, 10); } if (playerIndex == PlayerIndex.One) { playerLocation = new Vector2((graphics.PreferredBackBufferWidth / 2) - (playerAnimations.width / 2), graphics.PreferredBackBufferHeight - playerAnimations.height + 13); reticalLocation = new Vector2((playerLocation.X + playerAnimations.width / 2), playerLocation.Y + playerAnimations.height / 2); } else if (playerIndex == PlayerIndex.Two) { playerLocation = new Vector2((graphics.PreferredBackBufferWidth / 2) - (playerAnimations.width / 2), -5); reticalLocation = new Vector2(playerLocation.X + (playerAnimations.width / 2), playerLocation.Y + playerAnimations.height / 2); if (AI == true) { aiRectangle = new Rectangle((int)playerLocation.X - 45, (int)playerLocation.Y, 120, hitBox.Height); } } tiredreflectAnimation = new Animation(tiredReflectT, 3, 10); tiredreflectAnimation.currentFrame = -1; tiredreflectAnimation.frameTime = 75; kickedUpDust.currentFrame = -1; landingPoof.currentFrame = -1; kickedUpDust.frameTime = 25; chargePotionAnimLocation = new Vector2(playerLocation.X + 35, playerLocation.Y + 45); chargePotAnims1[0].currentFrame = 0; chargePotAnims1[1].currentFrame = 6; chargePotAnims1[2].currentFrame = 6; chargePotAnims1[3].currentFrame = 6; chargePotAnims1[4].currentFrame = 6; shieldFrame = new Animation(shieldFrameT, 5, 12); shieldFrame.frameTime = 75; shieldFrame.currentFrame = 0; shieldPanels.Add(new Animation(panel1, 5, 12)); shieldPanels.Add(new Animation(panel2, 5, 12)); shieldPanels.Add(new Animation(panel3, 5, 12)); shieldPanels.Add(new Animation(panel4, 5, 12)); shieldPanels.Add(new Animation(panel5, 5, 12)); shieldPanels.Add(new Animation(panel6, 5, 12)); shieldPanels.Add(new Animation(panel7, 5, 12)); shieldPanels.Add(new Animation(panel8, 5, 12)); shieldPanels.Add(new Animation(panel9, 5, 12)); shieldPanels.Add(new Animation(panel10, 5, 12)); foreach (Animation shieldPanel in shieldPanels) { shieldPanel.frameTime = 75; shieldPanel.rainbow = true; } shieldPanels[0].r = 0; shieldPanels[0].g = 85; shieldPanels[0].b = 170; shieldPanels[1].r = 20; shieldPanels[1].g = 105; shieldPanels[1].b = 190; shieldPanels[2].r = 40; shieldPanels[2].g = 125; shieldPanels[2].b = 210; shieldPanels[3].r = 60; shieldPanels[3].g = 145; shieldPanels[3].b = 230; shieldPanels[4].r = 80; shieldPanels[4].g = 165; shieldPanels[4].b = 250; shieldPanels[5].r = 100; shieldPanels[5].g = 185; shieldPanels[5].b = 15; shieldPanels[6].r = 120; shieldPanels[6].g = 205; shieldPanels[6].b = 35; shieldPanels[7].r = 140; shieldPanels[7].g = 225; shieldPanels[7].b = 55; shieldPanels[8].r = 160; shieldPanels[8].g = 245; shieldPanels[8].b = 75; shieldPanels[9].r = 180; shieldPanels[9].g = 10; shieldPanels[9].b = 95; shieldLocation = new Vector2(playerAnimations.drawingLocation.X + playerAnimations.width / 2 - shieldFrame.width / 2, playerAnimations.drawingLocation.Y + playerAnimations.height / 2 - shieldFrame.height / 2 + 5); shieldHitbox = new Rectangle((int)shieldLocation.X, (int)shieldLocation.Y, shieldFrame.width, shieldFrame.height); }
static ShuffleItems() { random = new Random(); typeBonus = 0; typePotion = 0; }
public Potions(GraphicsDeviceManager graphics, int potionTypeInt) { this.graphics = graphics; potionVector = new PotionVectors(graphics); player1HP = 5; player2HP = 5; int constructorincrement = 0; for (int i = 0; i < 30; i++) { if (constructorincrement > 3) { constructorincrement = 0; } potionParticles.Add(new Animation(potionParticleT, 2, 3, constructorincrement)); constructorincrement++; } if (potionTypeInt == 1) { potionType = PotionTypes.Skull; } if (potionTypeInt == 2) { potionType = PotionTypes.Shield; } if (potionTypeInt == 3) { potionType = PotionTypes.Wall; } if (potionTypeInt == 4) { potionType = PotionTypes.Fireball; } if (potionTypeInt == 5) { potionType = PotionTypes.Charge; } if (potionType == PotionTypes.Charge) { glass = new Animation(chargeGlassT, 6, 10); location.X = graphics.PreferredBackBufferWidth / 2 - glass.width / 2; location.Y = graphics.PreferredBackBufferHeight / 2 - glass.height / 2 - 40; hitBox = new Rectangle((int)location.X + 36, (int)location.Y + 31, 28, 47); smokeLocation = new Vector2((int)location.X + 48, (int)location.Y + 17); LeftRightMovement = true; } if (potionType == PotionTypes.Shield) { glass = new Animation(shieldGlassT, 3, 10); location.X = graphics.PreferredBackBufferWidth / 2 - glass.width / 2; location.Y = graphics.PreferredBackBufferHeight / 2 - glass.height / 2 - 40; hitBox = new Rectangle((int)location.X + 30, (int)location.Y + 30, 44, 40); smokeLocation = new Vector2((int)location.X + 44, (int)location.Y + 15); LeftRightMovement = true; } if (potionType == PotionTypes.Wall) { glass = new Animation(wallGlassT, 6, 10); location.X = graphics.PreferredBackBufferWidth / 2 - glass.width / 2; location.Y = graphics.PreferredBackBufferHeight / 2 - glass.height / 2 - 40; hitBox = new Rectangle((int)location.X + 21, (int)location.Y + 37, 60, 30); smokeLocation = new Vector2((int)location.X + 45, (int)location.Y + 23); LeftRightMovement = true; WallCenter = new Vector2(location.X + glass.width / 2, location.Y + glass.height / 2); wallParticleCapture = new Rectangle((int)WallCenter.X - 3, (int)WallCenter.Y - 3, 6, 6); potionWallTop = new Animation(wallPotionTopT, 3, 7); potionWallMiddle = new Animation(wallPotionMiddleT, 3, 7); potionWallBottom = new Animation(wallPotionBottomT, 3, 7); potionWallLiquid = new Animation(wallPotionLiquidT, 5, 6); potionWallMiddle2 = new Animation(wallPotionMiddleT, 3, 7); potionWallBottom2 = new Animation(wallPotionBottomT, 3, 7); potionWallBottom.rainbow = true; potionWallMiddle.rainbow = true; potionWallTop.rainbow = true; potionWallMiddle2.rainbow = true; potionWallBottom2.rainbow = true; potionWallLiquid.rainbow = true; potionWallTop.frameTime = 75; potionWallMiddle.frameTime = 75; potionWallBottom.frameTime = 75; potionWallLiquid.frameTime = 75; potionWallMiddle2.frameTime = 75; potionWallBottom2.frameTime = 75; if (playerIndex == PlayerIndex.One) { potionWallPassThrough = new Animation(wallPotionPassThroughBottomT, 3, 7); } if (playerIndex == PlayerIndex.Two) { potionWallPassThrough = new Animation(wallPotionPassThroughTopT, 3, 7); } potionWallPassThrough.frameTime = 75; potionWallPassThrough.rainbow = true; potionWallBottom.r = 0; potionWallBottom.g = 30; potionWallBottom.b = 60; potionWallMiddle.r = 30; potionWallMiddle.g = 60; potionWallMiddle.b = 90; potionWallTop.r = 60; potionWallTop.g = 90; potionWallTop.b = 120; if (playerIndex == PlayerIndex.Two) { potionWallPassThrough.r = 90; potionWallPassThrough.g = 120; potionWallPassThrough.b = 150; } if (playerIndex == PlayerIndex.One) { potionWallPassThrough.r = 225; potionWallPassThrough.g = 0; potionWallPassThrough.b = 30; } potionWallLiquid.r = 0; potionWallLiquid.g = 85; potionWallLiquid.b = 170; potionWallBottom2.r = 120; potionWallBottom2.g = 150; potionWallBottom2.b = 180; potionWallMiddle2.r = 90; potionWallMiddle2.g = 120; potionWallMiddle2.b = 150; } if (potionType == PotionTypes.Skull) { glass = new Animation(skullGlassT, 6, 10); location.X = graphics.PreferredBackBufferWidth / 2 - glass.width / 2; location.Y = graphics.PreferredBackBufferHeight / 2 - glass.height / 2 - 40; hitBox = new Rectangle((int)location.X + 32, (int)location.Y + 28, 36, 54); smokeLocation = new Vector2((int)location.X + 44, (int)location.Y + 14); player1HP = 1; player2HP = 1; CenterofSkull = new Vector2(location.X + glass.width / 2, location.Y + glass.height / 2); } if (potionType == PotionTypes.Fireball) { glass = new Animation(fireballGlassT, 4, 10); location.X = graphics.PreferredBackBufferWidth / 2 - glass.width / 2; location.Y = graphics.PreferredBackBufferHeight / 2 - glass.height / 2 - 40; hitBox = new Rectangle((int)location.X + 29, (int)location.Y + 38, 45, 42); smokeLocation = new Vector2((int)location.X + 44, (int)location.Y + 22); LeftRightMovement = true; } potionSeller = new Animation(potionSellerT, 1, 2); traveler = new Animation(travelerT, 1, 2); potionSeller.frameTime = 300; traveler.frameTime = 300; sellerLoc = new Vector2(-potionSeller.width, graphics.PreferredBackBufferHeight / 2 - potionSeller.height / 2); travelerLoc = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight / 2 - traveler.height / 2); potionDuration = new Random(); potionTimeOnField = potionDuration.Next(10000, 20000); }
public BaseInvoItems(int num, string name, string description, bool stackable, ItemTypes itemType, bool quest, bool inventoryBattle, int cost, string tag, InvoItemTypes invoItemType, bool inventoryField, int spellEffectId, PotionTypes potionType, bool infinteUsage) { this.ItemID = num; this.ItemName = name; this.ItemDescription = description; this.Stackable = stackable; this.ItemType = itemType; this.Quest = quest; this.InventoryBattle = InventoryBattle; this.Cost = cost; this.ItemTag = tag; this.InvoItemType = invoItemType; this.InventoryField = inventoryField; this.SpellEffectsID = spellEffectId; this.PotionType = potionType; this.InfinteUsage = infinteUsage; }
public void SetPotionStats(PotionTypes potionType) { this.potionType = potionType; CheckPotionStats(); }
public CacheACDItem(ACDItem item) { ACDItem = item; SNO=item.ActorSNO; ThisInternalName = item.InternalName; try { _thisLevel = item.Level; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item level for {0} \r\n {1}", SimpleDebugString, ex.Message); } ItemDataEntry itemEntry; if (TheCache.ObjectIDCache.ItemDataEntries.TryGetValue(SNO, out itemEntry)) { ItemType=itemEntry.ItemType; ThisDBItemType = ItemFunc.PluginItemTypeToDBItemType(ItemType); ThisFollowerType = ItemFunc.ReturnFollowerType(ItemType); LegendaryItemType = itemEntry.LegendaryType; } else { ThisFollowerType = item.FollowerSpecialType; ThisDBItemType = item.ItemType; ItemType = ItemFunc.DetermineItemType(ThisInternalName, ThisDBItemType, ThisFollowerType); } BaseItemType = ItemFunc.DetermineBaseType(ItemType); IsStackableItem = ItemFunc.DetermineIsStackable(ItemType, SNO); IsTwoSlot = !IsStackableItem && ItemFunc.DetermineIsTwoSlot(ItemType); //Armor / Jewelery / Weapons / Offhand / Follower Items if (BaseItemType== PluginBaseItemTypes.Armor || BaseItemType== PluginBaseItemTypes.Jewelry || BaseItemType== PluginBaseItemTypes.Offhand || BaseItemType == PluginBaseItemTypes.WeaponOneHand || BaseItemType == PluginBaseItemTypes.WeaponRange || BaseItemType == PluginBaseItemTypes.WeaponTwoHand || BaseItemType == PluginBaseItemTypes.FollowerItem) { if (BaseItemType == PluginBaseItemTypes.WeaponOneHand) ThisOneHanded = true; else if (BaseItemType == PluginBaseItemTypes.WeaponTwoHand) TwoHanded = true; try { ItemStats thesestats = item.Stats; ItemStatString = thesestats.ToString(); ItemStatProperties = new ItemProperties(thesestats); if (ItemStatProperties.Sockets > 0) { SocketsFilled = item.NumSocketsFilled; } } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stats {0} \r\n {1}", SimpleDebugString, ex.Message); } #region Durability try { //Durability DurabilityCurrent = item.CurrentDurability; DurabilityMax = item.MaxDurability; DurabilityPercent = item.DurabilityPercent; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item durability {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemQualityLevel try { _thisQuality = item.ItemQualityLevel; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item quality {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } else {//Gem, Misc if (ItemType == PluginItemTypes.KeyStone) { KeystoneRank = ItemFunc.GetGreaterRiftKeystoneRank(SNO); if (KeystoneRank == -1) { try { KeystoneRank = item.TieredLootRunKeyLevel; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get TieredLootRunKeyLevel for Keystone!{0} \r\n {1}", SimpleDebugString, ex.Message); } } } else if (BaseItemType == PluginBaseItemTypes.Gem && ItemType == PluginItemTypes.LegendaryGem) { try { LegendaryGemRank = item.JewelRank; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get Jewel Rank for Legendary Gem!{0} \r\n {1}", SimpleDebugString, ex.Message); } try { LegendaryGemType = (LegendaryGemTypes)Enum.Parse(typeof(LegendaryGemTypes), SNO.ToString()); } catch (Exception) { LegendaryGemType = LegendaryGemTypes.None; } } else { IsPotion = ItemType == PluginItemTypes.HealthPotion || ItemType == PluginItemTypes.LegendaryHealthPotion; if (IsPotion) PotionType = ItemFunc.ReturnPotionType(SNO); } #region DyeType try { _thisDyeType = item.DyeType; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item dye type {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (IsStackableItem) { #region ItemStackQuantity try { _thisItemStackQuantity = item.ItemStackQuantity; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemStackMaxQuantity try { _maxstackquanity = item.MaxStackCount; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item max stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } } #region GameBalanceId try { ThisBalanceID = item.GameBalanceId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item GameBalanceId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ACDGuid try { ACDGUID = item.ACDGuid; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item ACDGUID {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region DynamicId try { ThisDynamicID = item.DynamicId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item DynamicId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Name try { _thisRealName = item.Name; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item name {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Gold try { _thisGoldAmount = item.Gold; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item gold amount {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (!IsStackableItem) { #region IsUnidentified try { _isUnidentified = item.IsUnidentified; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is identified {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } #region IsVendorBought try { _isVendorBought = item.IsVendorBought; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is vendor bought {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region InventoryRow/Column try { invRow = item.InventoryRow; invCol = item.InventoryColumn; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item inventory row/column {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (itemEntry==null && !_isUnidentified && ItemType!= PluginItemTypes.Unknown && _thisRealName!=String.Empty) { if (FunkyBaseExtension.Settings.Debugging.DebuggingData && FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items)) { ObjectCache.DebuggingData.CheckEntry(this); } } }
public static PotionFlags ToPotionFlags(this PotionTypes value) { return(EnumConverter.ConvertByName <PotionFlags>(value)); }
public CacheACDItem(ACDItem item) { ACDItem = item; SNO = item.ActorSNO; ThisInternalName = item.InternalName; try { _thisLevel = item.Level; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item level for {0} \r\n {1}", SimpleDebugString, ex.Message); } ItemDataEntry itemEntry; if (TheCache.ObjectIDCache.ItemDataEntries.TryGetValue(SNO, out itemEntry)) { ItemType = itemEntry.ItemType; ThisDBItemType = ItemFunc.PluginItemTypeToDBItemType(ItemType); ThisFollowerType = ItemFunc.ReturnFollowerType(ItemType); LegendaryItemType = itemEntry.LegendaryType; } else { ThisFollowerType = item.FollowerSpecialType; ThisDBItemType = item.ItemType; ItemType = ItemFunc.DetermineItemType(ThisInternalName, ThisDBItemType, ThisFollowerType); } BaseItemType = ItemFunc.DetermineBaseType(ItemType); IsStackableItem = ItemFunc.DetermineIsStackable(ItemType, SNO); IsTwoSlot = !IsStackableItem && ItemFunc.DetermineIsTwoSlot(ItemType); //Armor / Jewelery / Weapons / Offhand / Follower Items if (BaseItemType == PluginBaseItemTypes.Armor || BaseItemType == PluginBaseItemTypes.Jewelry || BaseItemType == PluginBaseItemTypes.Offhand || BaseItemType == PluginBaseItemTypes.WeaponOneHand || BaseItemType == PluginBaseItemTypes.WeaponRange || BaseItemType == PluginBaseItemTypes.WeaponTwoHand || BaseItemType == PluginBaseItemTypes.FollowerItem) { if (BaseItemType == PluginBaseItemTypes.WeaponOneHand) { ThisOneHanded = true; } else if (BaseItemType == PluginBaseItemTypes.WeaponTwoHand) { TwoHanded = true; } try { ItemStats thesestats = item.Stats; ItemStatString = thesestats.ToString(); ItemStatProperties = new ItemProperties(thesestats); if (ItemStatProperties.Sockets > 0) { SocketsFilled = item.NumSocketsFilled; } } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stats {0} \r\n {1}", SimpleDebugString, ex.Message); } #region Durability try { //Durability DurabilityCurrent = item.CurrentDurability; DurabilityMax = item.MaxDurability; DurabilityPercent = item.DurabilityPercent; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item durability {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemQualityLevel try { _thisQuality = item.ItemQualityLevel; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item quality {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } else { //Gem, Misc if (ItemType == PluginItemTypes.KeyStone) { KeystoneRank = ItemFunc.GetGreaterRiftKeystoneRank(SNO); if (KeystoneRank == -1) { try { KeystoneRank = item.TieredLootRunKeyLevel; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get TieredLootRunKeyLevel for Keystone!{0} \r\n {1}", SimpleDebugString, ex.Message); } } } else if (BaseItemType == PluginBaseItemTypes.Gem && ItemType == PluginItemTypes.LegendaryGem) { try { LegendaryGemRank = item.JewelRank; } catch (Exception ex) { Logger.DBLog.DebugFormat("Failed to get Jewel Rank for Legendary Gem!{0} \r\n {1}", SimpleDebugString, ex.Message); } try { LegendaryGemType = (LegendaryGemTypes)Enum.Parse(typeof(LegendaryGemTypes), SNO.ToString()); } catch (Exception) { LegendaryGemType = LegendaryGemTypes.None; } } else { IsPotion = ItemType == PluginItemTypes.HealthPotion || ItemType == PluginItemTypes.LegendaryHealthPotion; if (IsPotion) { PotionType = ItemFunc.ReturnPotionType(SNO); } } #region DyeType try { _thisDyeType = item.DyeType; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item dye type {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (IsStackableItem) { #region ItemStackQuantity try { _thisItemStackQuantity = item.ItemStackQuantity; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ItemStackMaxQuantity try { _maxstackquanity = item.MaxStackCount; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item max stack quanity {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } } #region GameBalanceId try { ThisBalanceID = item.GameBalanceId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item GameBalanceId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region ACDGuid try { ACDGUID = item.ACDGuid; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item ACDGUID {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region DynamicId try { ThisDynamicID = item.DynamicId; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item DynamicId {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Name try { _thisRealName = item.Name; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item name {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region Gold try { _thisGoldAmount = item.Gold; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item gold amount {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (!IsStackableItem) { #region IsUnidentified try { _isUnidentified = item.IsUnidentified; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is identified {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion } #region IsVendorBought try { _isVendorBought = item.IsVendorBought; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item is vendor bought {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion #region InventoryRow/Column try { invRow = item.InventoryRow; invCol = item.InventoryColumn; } catch (Exception ex) { Logger.Write(LogLevel.Items, "Failed to retrieve item inventory row/column {0} \r\n {1}", SimpleDebugString, ex.Message); } #endregion if (itemEntry == null && !_isUnidentified && ItemType != PluginItemTypes.Unknown && _thisRealName != String.Empty) { if (FunkyBaseExtension.Settings.Debugging.DebuggingData && FunkyBaseExtension.Settings.Debugging.DebuggingDataTypes.HasFlag(DebugDataTypes.Items)) { ObjectCache.DebuggingData.CheckEntry(this); } } }
internal static bool PickupItemValidation(CacheItem item) { //if (FunkyTownRunPlugin.ItemRulesEval != null) //{ // Interpreter.InterpreterAction action = FunkyTownRunPlugin.ItemRulesEval.checkPickUpItem(item.DynamicID.Value, item.BalanceData.thisItemType, item.ref_DiaItem.Name, item.InternalName, item.Itemquality.Value, item.BalanceData.iThisItemLevel, item.BalanceData.bThisOneHand, item.BalanceData.bThisTwoHand, item.BalanceID.Value, ItemEvaluationType.PickUp); // if (action== Interpreter.InterpreterAction.PICKUP) // { // return true; // } //} // Calculate giles item types and base types etc. PluginItemTypes thisPluginItemType = PluginItemTypes.Unknown; PluginBaseItemTypes thisGilesBaseType = PluginBaseItemTypes.Unknown; if (item.BalanceID.HasValue && item.BalanceData != null) { thisPluginItemType = item.BalanceData.PluginType; thisGilesBaseType = item.BalanceData.PluginBase; } else { thisPluginItemType = ItemFunc.DetermineItemType(item.InternalName, ItemType.Unknown, FollowerType.None, item.SNOID); thisGilesBaseType = ItemFunc.DetermineBaseType(thisPluginItemType); } if (thisPluginItemType == PluginItemTypes.MiscBook) { return(FunkyBaseExtension.Settings.Loot.ExpBooks); } if (thisPluginItemType == PluginItemTypes.RamaladnisGift) { return(true); } // Error logging for DemonBuddy item mis-reading ItemType gilesDBItemType = ItemFunc.PluginItemTypeToDBItemType(thisPluginItemType); if (item.BalanceID.HasValue && item.BalanceData != null && gilesDBItemType != item.BalanceData.Type) { Logger.DBLog.InfoFormat("GSError: Item type mis-match detected: Item Internal=" + item.InternalName + ". DemonBuddy ItemType thinks item type is=" + item.BalanceData.Type + ". Giles thinks item type is=" + gilesDBItemType + ". [pickup]", true); } switch (thisGilesBaseType) { case PluginBaseItemTypes.WeaponTwoHand: case PluginBaseItemTypes.WeaponOneHand: case PluginBaseItemTypes.WeaponRange: case PluginBaseItemTypes.Armor: case PluginBaseItemTypes.Offhand: case PluginBaseItemTypes.Jewelry: case PluginBaseItemTypes.FollowerItem: if (FunkyBaseExtension.Settings.Loot.PickupWhiteItems == 1 && FunkyBaseExtension.Settings.Loot.PickupMagicItems == 1 && FunkyBaseExtension.Settings.Loot.PickupRareItems == 1 && FunkyBaseExtension.Settings.Loot.PickupLegendaryItems == 1) { return(true); } if (item.Itemquality.HasValue && item.BalanceID.HasValue && item.BalanceData != null) { switch (item.Itemquality.Value) { case ItemQuality.Inferior: case ItemQuality.Normal: case ItemQuality.Superior: return(FunkyBaseExtension.Settings.Loot.PickupWhiteItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupWhiteItems)); case ItemQuality.Magic1: case ItemQuality.Magic2: case ItemQuality.Magic3: return(FunkyBaseExtension.Settings.Loot.PickupMagicItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupMagicItems)); case ItemQuality.Rare4: case ItemQuality.Rare5: case ItemQuality.Rare6: return(FunkyBaseExtension.Settings.Loot.PickupRareItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupRareItems)); case ItemQuality.Legendary: return(FunkyBaseExtension.Settings.Loot.PickupLegendaryItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupLegendaryItems)); } } return(false); case PluginBaseItemTypes.Gem: if (thisPluginItemType == PluginItemTypes.LegendaryGem) { return(true); } GemQualityTypes qualityType = ItemFunc.ReturnGemQualityType(item.SNOID, item.BalanceData != null?item.BalanceData.ItemLevel:-1); int qualityLevel = (int)qualityType; if (qualityLevel < FunkyBaseExtension.Settings.Loot.MinimumGemItemLevel || (thisPluginItemType == PluginItemTypes.Ruby && !FunkyBaseExtension.Settings.Loot.PickupGems[0]) || (thisPluginItemType == PluginItemTypes.Emerald && !FunkyBaseExtension.Settings.Loot.PickupGems[1]) || (thisPluginItemType == PluginItemTypes.Amethyst && !FunkyBaseExtension.Settings.Loot.PickupGems[2]) || (thisPluginItemType == PluginItemTypes.Topaz && !FunkyBaseExtension.Settings.Loot.PickupGems[3]) || (thisPluginItemType == PluginItemTypes.Diamond && !FunkyBaseExtension.Settings.Loot.PickupGemDiamond)) { return(false); } break; case PluginBaseItemTypes.Misc: // Note; Infernal keys are misc, so should be picked up here - we aren't filtering them out, so should default to true at the end of this function if (thisPluginItemType == PluginItemTypes.CraftingMaterial) { return(FunkyBaseExtension.Settings.Loot.PickupCraftMaterials); } if (thisPluginItemType == PluginItemTypes.LegendaryCraftingMaterial) { return(true); } if (thisPluginItemType == PluginItemTypes.CraftingPlan) { if (!FunkyBaseExtension.Settings.Loot.PickupCraftPlans) { return(false); } if (item.BalanceID.HasValue && item.BalanceData != null) { if (item.BalanceData.IsBlacksmithPlanSixProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanSix) { return(false); } if (item.BalanceData.IsBlacksmithPlanFiveProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanFive) { return(false); } if (item.BalanceData.IsBlacksmithPlanFourProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanFour) { return(false); } if (item.BalanceData.IsBlacksmithPlanArchonSpaulders && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanArchonSpaulders) { return(false); } if (item.BalanceData.IsBlacksmithPlanArchonGauntlets && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanArchonGauntlets) { return(false); } if (item.BalanceData.IsBlacksmithPlanRazorspikes && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanRazorspikes) { return(false); } if (item.BalanceData.IsJewelcraftDesignAmulet && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignAmulet) { return(false); } if (item.BalanceData.IsJewelcraftDesignFlawlessStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignFlawlessStar) { return(false); } if (item.BalanceData.IsJewelcraftDesignMarquiseGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignMarquise) { return(false); } if (item.BalanceData.IsJewelcraftDesignPerfectStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignPerfectStar) { return(false); } if (item.BalanceData.IsJewelcraftDesignRadiantStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignRadiantStar) { return(false); } } } if (thisPluginItemType == PluginItemTypes.InfernalKey) { return(FunkyBaseExtension.Settings.Loot.PickupInfernalKeys); } if (thisPluginItemType == PluginItemTypes.KeyStone) { return(FunkyBaseExtension.Settings.Loot.PickupKeystoneFragments); } if (thisPluginItemType == PluginItemTypes.BloodShard) { return(Backpack.GetBloodShardCount() < 500); } // Potion filtering if (thisPluginItemType == PluginItemTypes.HealthPotion || thisPluginItemType == PluginItemTypes.LegendaryHealthPotion) { PotionTypes potionType = ItemFunc.ReturnPotionType(item.SNOID); if (potionType == PotionTypes.Regular) { if (FunkyBaseExtension.Settings.Loot.MaximumHealthPotions <= 0) { return(false); } var BestPotionToUse = Backpack.ReturnBestPotionToUse(); if (BestPotionToUse == null) { return(true); } var Potions = Backpack.ReturnRegularPotions(); if (Potions.Sum(potions => potions.ThisItemStackQuantity) >= FunkyBaseExtension.Settings.Loot.MaximumHealthPotions) { return(false); } } } break; case PluginBaseItemTypes.HealthGlobe: return(false); case PluginBaseItemTypes.Unknown: return(false); default: return(false); } // Switch giles base item type // Didn't cancel it, so default to true! return(true); }