public virtual bool OnHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked, bool last ) { if ( !CheckHarvest( from, tool ) ) { from.EndAction( locked ); return false; } int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { from.EndAction( locked ); OnBadHarvestTarget( from, tool, toHarvest ); return false; } else if ( !def.Validate( tileID ) ) { from.EndAction( locked ); OnBadHarvestTarget( from, tool, toHarvest ); return false; } else if ( !CheckRange( from, tool, def, map, loc, true ) ) { from.EndAction( locked ); return false; } else if ( !CheckResources( from, tool, def, map, loc, true ) ) { from.EndAction( locked ); return false; } else if ( !CheckHarvest( from, tool, def, toHarvest ) ) { from.EndAction( locked ); return false; } DoHarvestingEffect( from, tool, def, map, loc ); new HarvestSoundTimer( from, tool, this, def, toHarvest, locked, last ).Start(); return !last; }
public virtual void FinishHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked ) { from.EndAction( locked ); if ( !CheckHarvest( from, tool ) ) return; int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } else if ( !def.Validate( tileID ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } if ( !CheckRange( from, tool, def, map, loc, true ) ) return; else if ( !CheckResources( from, tool, def, map, loc, true ) ) return; else if ( !CheckHarvest( from, tool, def, toHarvest ) ) return; if ( SpecialHarvest( from, tool, def, map, loc ) ) return; HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if ( bank == null ) return; HarvestVein vein = bank.Vein; if ( vein != null ) vein = MutateVein( from, tool, def, bank, toHarvest, vein ); if ( vein == null ) return; HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource( from, tool, def, map, loc, vein, primary, fallback ); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if ( skillBase >= resource.ReqSkill && from.CheckSkill( def.Skill, resource.MinSkill, resource.MaxSkill ) ) { type = GetResourceType( from, tool, def, map, loc, resource ); if ( type != null ) type = MutateType( type, from, tool, def, map, loc, resource ); if ( type != null ) { Item item = Construct( type, from ); if ( item == null ) { type = null; } else { //The whole harvest system is kludgy and I'm sure this is just adding to it. if ( item.Stackable ) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; int racialAmount = (int)Math.Ceiling( amount * 1.1 ); int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 ); bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human ); bool inFelucca = (map == Map.Felucca); if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount ) item.Amount = feluccaRacialAmount; else if( inFelucca && bank.Current >= feluccaAmount ) item.Amount = feluccaAmount; else if( eligableForRacialBonus && bank.Current >= racialAmount ) item.Amount = racialAmount; else item.Amount = amount; } bank.Consume( item.Amount, from ); if ( Give( from, item, def.PlaceAtFeetIfFull ) ) { SendSuccessTo( from, item, resource ); } else { SendPackFullTo( from, item, def, resource ); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if ( bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill ) { Item bonusItem = Construct( bonus.Type, from ); if ( Give( from, bonusItem, true ) ) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo( from ); } else { //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** START *** //item.Delete(); bonusItem.Delete(); //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** END *** } } if ( tool is IUsesRemaining ) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if ( toolWithUses.UsesRemaining > 0 ) --toolWithUses.UsesRemaining; if ( toolWithUses.UsesRemaining < 1 ) { tool.Delete(); def.SendMessageTo( from, def.ToolBrokeMessage ); } } } } } if ( type == null ) def.SendMessageTo( from, def.FailMessage ); OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest ); }
public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { //Lava fishing needs to have its own set of rules. if (IsLavaHarvest(tool, toHarvest)) { from.EndAction(locked); if (!CheckHarvest(from, tool)) return; int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID) && !def.ValidateSpecial(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) return; else if (!CheckResources(from, tool, def, map, loc, true)) return; else if (!CheckHarvest(from, tool, def, toHarvest)) return; HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) return; HarvestVein vein = bank.Vein; if (vein == null) return; Type type = null; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, vein.PrimaryResource, vein.FallbackResource); if (from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { //Special eye candy item type = GetSpecialLavaItem(from, tool, map, loc, toHarvest); //Special fish if (type == null) type = FishInfo.GetSpecialItem(from, tool, loc, IsLavaHarvest(tool, tileID)); if (type != null) { Item item = Construct(type, from, tool); if (item == null) { type = null; } else { if (from.AccessLevel == AccessLevel.Player) bank.Consume(Convert.ToInt32(map != null && map.Rules == MapRules.FeluccaRules ? Math.Ceiling(item.Amount / 2.0) : item.Amount), from); if (Give(from, item, true)) { SendSuccessTo(from, item, null); } else { SendPackFullTo(from, item, def, null); item.Delete(); } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); double skill = (double)from.Skills[SkillName.Fishing].Value / 50; if (0.5 / skill > Utility.RandomDouble()) OnToolUsed(from, tool, false); } else OnToolUsed(from, tool, true); OnHarvestFinished(from, tool, def, vein, bank, null, null); } else base.FinishHarvesting(from, tool, def, toHarvest, locked); }
public virtual void FinishHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked ) { from.EndAction( locked ); if ( !CheckHarvest( from, tool ) ) return; int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } else if ( !def.Validate( tileID ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } if ( !CheckRange( from, tool, def, map, loc, true ) ) return; else if ( !CheckResources( from, tool, def, map, loc, true ) ) return; else if ( !CheckHarvest( from, tool, def, toHarvest ) ) return; if ( SpecialHarvest( from, tool, def, map, loc ) ) return; HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if ( bank == null ) return; HarvestVein vein = bank.Vein; if ( vein != null ) vein = MutateVein( from, tool, def, bank, toHarvest, vein ); if ( vein == null ) return; HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource( from, tool, def, map, loc, vein, primary, fallback ); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if ( skillBase >= resource.ReqSkill && from.CheckSkill( def.Skill, resource.MinSkill, resource.MaxSkill ) ) { type = GetResourceType( from, tool, def, map, loc, resource ); if ( type != null ) type = MutateType( type, from, tool, def, map, loc, resource ); if ( type != null ) { Item item = Construct( type, from ); if ( item == null ) { type = null; } else { if ( item.Stackable ) { if ( map == Map.Felucca && bank.Current >= def.ConsumedPerFeluccaHarvest ) item.Amount = def.ConsumedPerFeluccaHarvest; else item.Amount = def.ConsumedPerHarvest; } bank.Consume( def, item.Amount ); if ( Give( from, item, def.PlaceAtFeetIfFull ) ) { SendSuccessTo( from, item, resource ); } else { SendPackFullTo( from, item, def, resource ); item.Delete(); } if ( tool is IUsesRemaining ) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if ( toolWithUses.UsesRemaining > 0 ) --toolWithUses.UsesRemaining; if ( toolWithUses.UsesRemaining < 1 ) { tool.Delete(); def.SendMessageTo( from, def.ToolBrokeMessage ); } } } } } if ( type == null ) def.SendMessageTo( from, def.FailMessage ); OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest ); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!this.CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!this.GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { this.OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID) && !def.ValidateSpecial(tileID)) { this.OnBadHarvestTarget(from, tool, toHarvest); return; } if (!this.CheckRange(from, tool, def, map, loc, true)) { return; } else if (!this.CheckResources(from, tool, def, map, loc, true)) { return; } else if (!this.CheckHarvest(from, tool, def, toHarvest)) { return; } if (this.SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = this.MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = this.MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; //daat99 OWLTR start - daat99 harvesting type = GetResourceType(from, tool, def, map, loc, resource); bool daatHarvesting = false; if (daat99.OWLTROptionsManager.IsEnabled(daat99.OWLTROptionsManager.OPTIONS_ENUM.DAAT99_MINING) && (type.IsSubclassOf(typeof(BaseOre)) || type.IsSubclassOf(typeof(BaseGranite)))) { daatHarvesting = true; } else if (daat99.OWLTROptionsManager.IsEnabled(daat99.OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING) && type.IsSubclassOf(typeof(BaseLog))) { daatHarvesting = true; } if (daatHarvesting || (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill))) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (daatHarvesting) { type = ResourceHelper.GetDaat99HarvestedType(type, bank.Vein.IsProspected, skillValue); from.CheckSkill(def.Skill, 0.0, from.Skills[def.Skill].Cap + (vein.IsProspected?10.0:0.0)); } //daat99 OWLTR end - daat99 harvesting if (type != null) { Item item = this.Construct(type, from, tool); if (item == null) { type = null; } else { //The whole harvest system is kludgy and I'm sure this is just adding to it. if (item.Stackable) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; int racialAmount = (int)Math.Ceiling(amount * 1.1); int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1); bool eligableForRacialBonus = (def.RaceBonus && from.Race == Race.Human); bool inFelucca = (map == Map.Felucca); if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = feluccaRacialAmount; } else if (inFelucca && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = racialAmount; } else { item.Amount = amount; } // Void Pool Rewards item.Amount += WoodsmansTalisman.CheckHarvest(from, type, this); } bank.Consume(item.Amount, from); //daat99 OWLTR start - custom harvesting CraftResource craftResourceFromType = CraftResources.GetFromType(type); string s_Type = "UNKNOWN"; int i_Tokens = 1; if (craftResourceFromType != CraftResource.None) { s_Type = CraftResources.GetInfo(craftResourceFromType).Name; i_Tokens = CraftResources.GetIndex(craftResourceFromType) + 1; } if (craftResourceFromType != CraftResource.None && daat99.OWLTROptionsManager.IsEnabled(daat99.OWLTROptionsManager.OPTIONS_ENUM.DAAT99_MINING) && def.Skill == SkillName.Mining && (type.IsSubclassOf(typeof(Server.Items.BaseOre)) || type.IsSubclassOf(typeof(Server.Items.BaseGranite)))) { if (type.IsSubclassOf(typeof(Server.Items.BaseOre))) { if (Give(from, item, def.PlaceAtFeetIfFull)) { from.SendMessage("You dig some {0} ore and placed it in your backpack.", s_Type); } else { from.SendMessage("Your backpack is full, so the ore you mined is lost."); item.Delete(); } } else { if (Give(from, item, def.PlaceAtFeetIfFull)) { from.SendMessage("You carefully extract some workable stone from the ore vein."); } else { from.SendMessage("Your backpack is full, so the ore you mined is lost."); item.Delete(); } } } else if (craftResourceFromType != CraftResource.None && OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING) && def.Skill == SkillName.Lumberjacking) { if (Give(from, item, def.PlaceAtFeetIfFull)) { from.SendMessage("You placed some {0} logs in your backpack.", s_Type); } else { from.SendMessage("You can't place any wood into your backpack!"); item.Delete(); } } else { //daat99 OWLTR end - custom harvesting if (this.Give(from, item, def.PlaceAtFeetIfFull)) { this.SendSuccessTo(from, item, resource); } else { this.SendPackFullTo(from, item, def, resource); item.Delete(); } //daat99 OWLTR start - custom harvesting } if (from.Map == Map.Felucca) { i_Tokens = (int)(i_Tokens * 1.5); } if (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.HARVEST_GIVE_TOKENS)) { TokenSystem.GiveTokensToPlayer(from as Server.Mobiles.PlayerMobile, i_Tokens); } //daat99 OWLTR end - custom harvesting BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { if (bonus.RequiredMap == null || bonus.RequiredMap == from.Map) { Item bonusItem = this.Construct(bonus.Type, from, tool); if (this.Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { item.Delete(); } } } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } #region High Seas OnToolUsed(from, tool, item != null); #endregion } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } //daat99 OWLTR start - custom harvesting if (this is Lumberjacking || this is Mining) { OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest, type); } else { //daat99 OWLTR end - custom harvesting OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); } }
public virtual void FinishHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked ) { if (from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); if (!CheckHarvest(from, tool)) return; if (!CheckAllowed(from)) return; if (Utility.Random(1000) <= 2) AntiMacro.AntiMacroGump.SendGumpThreaded((PlayerMobile)from); int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } else if ( !def.Validate( tileID ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } if (!CheckRange(from, tool, def, map, loc, true)) return; else if (!CheckResources(from, tool, def, map, loc, true)) return; else if (!CheckHarvest(from, tool, def, toHarvest)) return; if ( SpecialHarvest( from, tool, def, map, loc ) ) return; HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if ( bank == null ) return; HarvestVein vein = bank.Vein; if ( vein != null ) vein = MutateVein( from, tool, def, bank, toHarvest, vein ); if ( vein == null ) return; //Check if we can mine the vein CheckMutateVein(from, def, bank, vein); HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource( from, tool, def, map, loc, vein, primary, fallback ); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; //Gain the skill from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill); //hacky All harvest now has 15 percent, if you can mine them. if ( skillBase >= resource.ReqSkill && 0.15 < Utility.RandomDouble()) { type = GetResourceType( from, tool, def, map, loc, resource ); if ( type != null ) type = MutateType( type, from, tool, def, map, loc, resource ); if ( type != null ) { Item item = Construct( type, from ); if ( item == null ) { type = null; } else { //bool spawnNew = false; //The whole harvest system is kludgy and I'm sure this is just adding to it. if ( item.Stackable ) { int amount = GetOreAmount(vein); int racialAmount = (int)Math.Ceiling( amount * 1.1 ); bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human ); if( eligableForRacialBonus && bank.Current >= racialAmount ) item.Amount = racialAmount; else if( bank.Current >= amount ) item.Amount = amount; else item.Amount = bank.Current; //if ( bank.Current <= item.Amount) //spawnNew = true; } bank.Consume(def, item.Amount, from); //Maka //if (spawnNew) // bank.Vein = def.GetVeinAt(from.Map, from.Location.X, from.Location.Y); if ( Give( from, item, /*def.PlaceAtFeetIfFull*/true ) ) //Is there something we dont want to place at the feet { SendSuccessTo( from, item, resource ); } else { SendPackFullTo( from, item, def, resource ); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = Construct(bonus.Type, from); if (Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { item.Delete(); } } if ( tool is IUsesRemaining ) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; //if ( toolWithUses.UsesRemaining > 0 ) // --toolWithUses.UsesRemaining; if ( toolWithUses.UsesRemaining < 1 ) { tool.Delete(); def.SendMessageTo( from, def.ToolBrokeMessage ); } } } } } if ( type == null ) def.SendMessageTo( from, def.FailMessage ); OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest ); }
public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; StaticTarget harvestTarget = toHarvest as StaticTarget; if (harvestTarget != null) { // re-write the code so CheckSkill determines resources, add FailMessage (TC) if (from.CheckSkill(def.Skill, 0, 120)) { BaseHarvestablePhase hTreePhase = BaseHarvestablePhase.LookupPhase(harvestTarget.ItemID); if (hTreePhase != null && hTreePhase is BaseTreeHarvestPhase) { hTreePhase.Harvest(from, harvestTarget.ItemID, harvestTarget.Location, map); } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } else { def.SendMessageTo(from, def.FailMessage); } } }
public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { //Lava fishing needs to have its own set of rules. if (IsLavaHarvest(tool, toHarvest)) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID) && !def.ValidateSpecial(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein == null) { return; } Type type = null; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, vein.PrimaryResource, vein.FallbackResource); if (from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { //Special eye candy item type = GetSpecialLavaItem(from, tool, map, loc, toHarvest); //Special fish if (type == null) { type = FishInfo.GetSpecialItem(from, tool, loc, IsLavaHarvest(tool, tileID)); } if (type != null) { Item item = Construct(type, from, tool); if (item == null) { type = null; } else { if (from.AccessLevel == AccessLevel.Player) { bank.Consume(Convert.ToInt32(map != null && map.Rules == MapRules.FeluccaRules ? Math.Ceiling(item.Amount / 2.0) : item.Amount), from); } if (Give(from, item, true)) { SendSuccessTo(from, item, null); } else { SendPackFullTo(from, item, def, null); item.Delete(); } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); double skill = (double)from.Skills[SkillName.Fishing].Value / 50; if (0.5 / skill > Utility.RandomDouble()) { OnToolUsed(from, tool, false); } } else { OnToolUsed(from, tool, true); } OnHarvestFinished(from, tool, def, vein, bank, null, null); } else { base.FinishHarvesting(from, tool, def, toHarvest, locked); } }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from); if (item == null) { type = null; } else { if (item.Stackable) { if (map == Map.Felucca && bank.GetCurrentFor(from) >= def.ConsumedPerFeluccaHarvest) { item.Amount = def.ConsumedPerFeluccaHarvest; } else { item.Amount = def.ConsumedPerHarvest; } } bank.Consume(def, item.Amount); if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendAsciiMessageTo(from, def.ToolBrokeMessage); } } } } } if (type == null) { def.SendAsciiMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } if (!GetHarvestDetails(from, tool, toHarvest, out int tileID, out Map map, out Point3D loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!def.Validate(tileID) && !def.ValidateSpecial(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, def, map, loc, true)) { return; } if (!CheckResources(from, tool, def, map, loc, true)) { return; } if (!CheckHarvest(from, tool, def, toHarvest)) { return; } if (SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; Type type = null; if (CheckHarvestSkill(map, loc, from, resource, def)) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from, tool); if (item == null) { type = null; } else { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; if (item is BaseGranite) { feluccaAmount = 3; } Caddellite.OnHarvest(from, tool, this, item); //The whole harvest system is kludgy and I'm sure this is just adding to it. if (item.Stackable) { int racialAmount = (int)Math.Ceiling(amount * 1.1); int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1); bool eligableForRacialBonus = def.RaceBonus && from.Race == Race.Human; bool inFelucca = map == Map.Felucca && !Siege.SiegeShard; if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = feluccaRacialAmount; } else if (inFelucca && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = racialAmount; } else { item.Amount = amount; } // Void Pool Rewards item.Amount += WoodsmansTalisman.CheckHarvest(from, type, this); } if (from.AccessLevel == AccessLevel.Player) { bank.Consume(amount, from); } if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); Item bonusItem = null; if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { if (bonus.RequiredMap == null || bonus.RequiredMap == from.Map) { bonusItem = Construct(bonus.Type, from, tool); Caddellite.OnHarvest(from, tool, this, bonusItem, false); if (Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { bonusItem.Delete(); } } } EventSink.InvokeResourceHarvestSuccess(new ResourceHarvestSuccessEventArgs(from, tool, item, bonusItem, this)); } OnToolUsed(from, tool, item != null); } // Siege rules will take into account axes and polearms used for lumberjacking if (tool is IUsesRemaining withUses && (withUses is BaseHarvestTool || withUses is Pickaxe || withUses is SturdyPickaxe || withUses is GargoylesPickaxe || Siege.SiegeShard)) { withUses.ShowUsesRemaining = true; if (withUses.UsesRemaining > 0) { --withUses.UsesRemaining; } if (withUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } if (SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from); if (item == null) { type = null; } else { //The whole harvest system is kludgy and I'm sure this is just adding to it. if (item.Stackable) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; int racialAmount = (int)Math.Ceiling(amount * 1.1); int feluccaRacialAmount = (int)Math.Ceiling(feluccaAmount * 1.1); bool eligableForRacialBonus = def.RaceBonus && @from.Race == Race.Human; bool inFelucca = map == Map.Felucca; if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = feluccaRacialAmount; } else if (inFelucca && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = racialAmount; } else { item.Amount = amount; } } bank.Consume(item.Amount, from); if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = Construct(bonus.Type, from); if (Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { item.Delete(); } } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) return; int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) return; else if (!CheckResources(from, tool, def, map, loc, false)) return; else if (!CheckHarvest(from, tool, def, toHarvest)) return; if (SpecialHarvest(from, tool, def, map, loc)) return; HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) return; HarvestVein vein = bank.Vein; if (vein == null) return; HarvestResource resource = null; TreeHarvestTool thtool = null; TreeResourceItem trsource = null; HarvestSuccessRating rating = HarvestSuccessRating.Failure; bool gave = false; TreeHarvestMethod method = TreeHarvestMethod.Picking; string toolType = "unknown"; string resType = "resources"; if (tool is TreeHarvestTool) { thtool = tool as TreeHarvestTool; switch (thtool.ResourceType) { case TreeResourceType.BarkSkin: toolType = "carving"; method = TreeHarvestMethod.Carving; break; case TreeResourceType.FruitNut: toolType = "picking"; method = TreeHarvestMethod.Picking; break; case TreeResourceType.LeafSpine: toolType = "pinching"; method = TreeHarvestMethod.Picking; break; case TreeResourceType.RootBranch: toolType = "digging"; method = TreeHarvestMethod.Digging; break; case TreeResourceType.SapJuice: toolType = "sapping"; method = TreeHarvestMethod.Sapping; break; case TreeResourceType.LogsBranches: toolType = "chopping"; method = TreeHarvestMethod.Chopping; break; } bool found = false; for (int x = 0; x < def.Resources.Length && !found; x++) { if (method == TreeHarvestMethod.Chopping) { //give logs Item logs = Activator.CreateInstance((Type) def.DoubleHarvestMessage) as Item; if (logs is CustomTreeLog) { rating = from.CheckSkill(SkillName.Lumberjacking, ((CustomTreeLog)logs).MinSkill, 100.0) ? Utility.RandomBool() ? HarvestSuccessRating.PartialSuccess : HarvestSuccessRating.Success : HarvestSuccessRating.Failure; if (rating >= HarvestSuccessRating.PartialSuccess) { logs.Amount = 10; if (Give(from, logs, def.PlaceAtFeetIfFull)) { from.SendMessage("You receive some {0}.", logs.DefaultName); gave = true; } else { from.SendMessage("Your pack is full. Some logs were lost."); logs.Delete(); return; } bank.Consume(def.ConsumedPerHarvest, from); } } found = true; continue; } object[] obj = new object[] { def.Resources[x].SuccessMessage }; Item item = Activator.CreateInstance(def.Resources[x].Types[0], obj) as Item; if (item is TreeResourceItem) { trsource = item as TreeResourceItem; switch (trsource.ResourceType) { case TreeResourceType.BarkSkin: resType = "bark or skin"; break; case TreeResourceType.FruitNut: resType = "fruits or nuts"; break; case TreeResourceType.LeafSpine: resType = "leaves or spines"; break; case TreeResourceType.RootBranch: resType = "roots or buried branches"; break; case TreeResourceType.SapJuice: resType = "sap or juice"; break; case TreeResourceType.LogsBranches: resType = "logs or sturdy branches"; break; } if (thtool.ResourceType == trsource.ResourceType) { found = true; resource = def.Resources[x]; } else trsource.Delete(); } else if (item != null) item.Delete(); } if (!found) { from.SendMessage("You will not get any {0} with the {1} tool.", resType, toolType); return; } } else { Console.WriteLine("How did someone try to harvest a tree without a Tree Harvest Tool?"); return; } if (trsource != null) { rating = from.CheckSkill(SkillName.Camping, 0.0, 100.0)? Utility.RandomBool() ? HarvestSuccessRating.PartialSuccess : HarvestSuccessRating.Success : HarvestSuccessRating.Failure; if (rating >= HarvestSuccessRating.PartialSuccess) { if (trsource.Stackable) trsource.Amount = def.ConsumedPerHarvest; Container pack = from.Backpack; if (pack == null) { from.SendMessage("Why don't you have a pack?"); trsource.Delete(); return; } Item tap = pack.FindItemByType(typeof(BarrelTap)); if (trsource.ResourceType == TreeResourceType.SapJuice && tap == null) { from.SendMessage("You need a barrel tap to sap this tree."); trsource.Delete(); return; } if (trsource.ResourceType == TreeResourceType.SapJuice) trsource.Amount = 1; bank.Consume(trsource.Amount, from); if (tool is TreeHarvestTool) { TreeHarvestTool toolWithUses = (TreeHarvestTool)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) --toolWithUses.UsesRemaining; if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } if (trsource.ResourceType != TreeResourceType.SapJuice || pack.ConsumeTotal(typeof(EmptyJar), 1)) { if (trsource.ResourceType == TreeResourceType.SapJuice && 0.12 >= Utility.RandomDouble()) { from.SendMessage("Your tap broke in the process, and is now gone."); tap.Delete(); } if (Give(from, trsource, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, trsource, resource); gave = true; } else { SendPackFullTo(from, trsource, def, resource); trsource.Delete(); return; } } else { from.SendMessage("You don't have an empty jar to hold the sap, so it was lost!"); trsource.Delete(); return; } } else trsource.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && rating >= HarvestSuccessRating.Success) { Item bonusItem; if (bonus.Type == typeof(TreeResource)) { object[] obj = new object[] { (TreeResource)bonus.SuccessMessage.Number }; bonusItem = Activator.CreateInstance(bonus.Type, obj) as Item; } else { bonusItem = Activator.CreateInstance(bonus.Type) as Item; } if (Give(from, bonusItem, true)) { from.SendMessage("You find a bonus resource."); gave = true; } else { if (bonusItem != null) bonusItem.Delete(); } } if (gave) { //do nothing } else if (trsource == null || trsource.Deleted) def.SendMessageTo(from, def.FailMessage); OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public virtual bool OnHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked, bool last) { if (!CheckHarvest(from, tool)) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } return(false); } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } OnBadHarvestTarget(from, tool, toHarvest); return(false); } else if (!def.Validate(tileID)) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } OnBadHarvestTarget(from, tool, toHarvest); return(false); } else if (!CheckRange(from, tool, def, map, loc, true)) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } return(false); } else if (!CheckResources(from, tool, def, map, loc, true)) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } return(false); } else if (!CheckHarvest(from, tool, def, toHarvest)) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } return(false); } DoHarvestingEffect(from, tool, def, map, loc); new HarvestSoundTimer(from, tool, this, def, toHarvest, locked, last).Start(); return(!last); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { if (from is PlayerMobile) { ((PlayerMobile)from).EndPlayerAction(); } if (!CheckHarvest(from, tool)) { return; } if (!CheckAllowed(from)) { return; } if (Utility.Random(1000) <= 2) { AntiMacro.AntiMacroGump.SendGumpThreaded((PlayerMobile)from); } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } if (SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } //Check if we can mine the vein CheckMutateVein(from, def, bank, vein); HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; //Gain the skill from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill); //hacky All harvest now has 15 percent, if you can mine them. if (skillBase >= resource.ReqSkill && 0.15 < Utility.RandomDouble()) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from); if (item == null) { type = null; } else { //bool spawnNew = false; //The whole harvest system is kludgy and I'm sure this is just adding to it. if (item.Stackable) { int amount = GetOreAmount(vein); int racialAmount = (int)Math.Ceiling(amount * 1.1); bool eligableForRacialBonus = (def.RaceBonus && from.Race == Race.Human); if (eligableForRacialBonus && bank.Current >= racialAmount) { item.Amount = racialAmount; } else if (bank.Current >= amount) { item.Amount = amount; } else { item.Amount = bank.Current; } //if ( bank.Current <= item.Amount) //spawnNew = true; } bank.Consume(def, item.Amount, from); //Maka //if (spawnNew) // bank.Vein = def.GetVeinAt(from.Map, from.Location.X, from.Location.Y); if (Give(from, item, /*def.PlaceAtFeetIfFull*/ true)) //Is there something we dont want to place at the feet { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = Construct(bonus.Type, from); if (Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { item.Delete(); } } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; //if ( toolWithUses.UsesRemaining > 0 ) // --toolWithUses.UsesRemaining; if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } int tileID; Map map; Point3D loc; if (!GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } else if (!CheckResources(from, tool, def, map, loc, true)) { return; } else if (!CheckHarvest(from, tool, def, toHarvest)) { return; } if (SpecialHarvest(from, tool, def, map, loc)) { return; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein != null) { vein = MutateVein(from, tool, def, bank, toHarvest, vein); } if (vein == null) { return; } HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, primary, fallback); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if (skillBase >= resource.ReqSkill && from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { type = GetResourceType(from, tool, def, map, loc, resource); if (type != null) { type = MutateType(type, from, tool, def, map, loc, resource); } if (type != null) { Item item = Construct(type, from); if (item == null) { type = null; } else { int consumedamount = 1; if (item.Stackable) { /* * if ( map == Map.Felucca && bank.Current >= def.ConsumedPerFeluccaHarvest ) * { * consumedamount = def.ConsumedPerFeluccaHarvest; * if (def.Skill == SkillName.Mining) * consumedamount *= (int)(1 + ((TeiravonMobile)from).ExpertMining * .5); * else if (def.Skill == SkillName.Lumberjacking) * consumedamount *= (int)(1 + ((TeiravonMobile)from).ExpertWoodsman * .5); * * if (tool is ElvenHatchet || tool is DwarvenPickaxe) * item.Amount = (int)(consumedamount * 1.5); * else * item.Amount = consumedamount; * } * else * {*/ consumedamount = def.ConsumedPerFeluccaHarvest; if (def.Skill == SkillName.Mining) { consumedamount *= (int)(1 + ((TeiravonMobile)from).ExpertMining * .5); } else if (def.Skill == SkillName.Lumberjacking) { consumedamount *= (int)(1 + ((TeiravonMobile)from).ExpertWoodsman * .5); } if (tool is ElvenHatchet || tool is DwarvenPickaxe) { item.Amount = (int)(consumedamount * 1.5); } else { item.Amount = consumedamount; } consumedamount = def.ConsumedPerFeluccaHarvest; //} } bank.Consume(def, consumedamount); // bank.Consume( def, item.Amount ); if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, GetRealResource(type, resource, from)); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }