當前位置: 首頁>>代碼示例>>C#>>正文


C# HarvestDefinition.SendAsciiMessageTo方法代碼示例

本文整理匯總了C#中Server.Engines.Harvest.HarvestDefinition.SendAsciiMessageTo方法的典型用法代碼示例。如果您正苦於以下問題:C# HarvestDefinition.SendAsciiMessageTo方法的具體用法?C# HarvestDefinition.SendAsciiMessageTo怎麽用?C# HarvestDefinition.SendAsciiMessageTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Engines.Harvest.HarvestDefinition的用法示例。


在下文中一共展示了HarvestDefinition.SendAsciiMessageTo方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CheckRange

        public virtual bool CheckRange( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
        {
            bool inRange = ( from.Map == map && from.InRange( loc, def.MaxRange ) );

            if ( !inRange )
                def.SendAsciiMessageTo( from, timed ? def.TimedOutOfRangeMessage : def.OutOfRangeMessage );

            return inRange;
        }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:9,代碼來源:HarvestSystem.cs

示例2: FinishHarvesting


//.........這裏部分代碼省略.........
            {
                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 );
        }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:101,代碼來源:HarvestSystem.cs

示例3: SendPackFullTo

 public virtual void SendPackFullTo( Mobile from, Item item, HarvestDefinition def, HarvestResource resource )
 {
     def.SendAsciiMessageTo( from, def.PackFullMessage );
 }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:4,代碼來源:HarvestSystem.cs

示例4: CheckResources

        public virtual bool CheckResources( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
        {
            HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

            bool available = ( bank != null && bank.GetCurrentFor( from ) >= def.ConsumedPerHarvest );

            if ( !available )
                def.SendAsciiMessageTo( from, timed ? def.DoubleHarvestMessage : def.NoResourcesMessage );

            return available;
        }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:11,代碼來源:HarvestSystem.cs


注:本文中的Server.Engines.Harvest.HarvestDefinition.SendAsciiMessageTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。