本文整理汇总了C#中Server.Item.GetDropSound方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetDropSound方法的具体用法?C# Item.GetDropSound怎么用?C# Item.GetDropSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Item
的用法示例。
在下文中一共展示了Item.GetDropSound方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDragDrop
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( !Movable && !CheckAccess( from ) )
{
from.SendMessage("You cannot access this");
return false;
}
if ( !( dropped is Seed ) )
{
from.SendMessage( "You can only store seeds in this box." );
return false;
}
BaseHouse house = BaseHouse.FindHouseAt( from );
int lockdowns = 0;
if(house !=null)
lockdowns = house.LockDownCount;
int seeds = lockdowns +1;
if(house != null && !Movable && seeds > house.MaxLockDowns)
{
from.SendMessage( "This would exceed the houses lockdown limit." );
return false;
}
int seedcount = SeedCount();
if( seedcount > m_maxSeeds )
{
from.SendMessage( "This seed box cannot hold any more seeds." );
return false;
}
Seed seed = ( Seed ) dropped;
int type = ConvertType( seed.PlantType );
int hue = ConvertHue( seed.PlantHue );
m_counts[ type, hue ] ++;
itemcount = SeedCount() /5;
this.TotalItems = itemcount;
if (Parent is Container)
{
// calling the full version with (-itemcount - 1) prevents double-counting the seedbox
if (!((Container)Parent).CheckHold(from, this, true, true, (-TotalItems - 1), (int)(-TotalWeight - Weight)))
{
m_counts[type, hue]--; // reverse the change to our state
itemcount = SeedCount() / 5;
TotalItems = itemcount;
return false;
}
}
from.SendSound( ((dropped.GetDropSound() != -1) ? dropped.GetDropSound() : 0x42), GetWorldLocation() );
dropped.Delete();
InvalidateProperties();
return true;
}
示例2: OnDragDrop
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( !(dropped is BasePiece) )
{
// Adam: anything other than a scroll will get dropped into your backpack
// (so your best sword doesn't get dropped on the ground.)
from.AddToBackpack( dropped );
// For richness, we add the drop sound of the item dropped.
from.PlaySound( dropped.GetDropSound() );
return true;
}
BasePiece piece = dropped as BasePiece;
return ( piece != null && piece.Board == this && base.OnDragDrop( from, dropped ) );
}
示例3: Split
public static bool Split(Mobile from, Item item)
{
if (!(item is Gold) || from.Party == null || item.Amount < ((Party)from.Party).Members.Count)
return false;
var party = Party.Get(from);
int share = item.Amount / party.Members.Count;
foreach (var info in party.Members)
{
var partyMember = info.Mobile as PlayerMobile;
if (partyMember == null || partyMember.Backpack == null)
continue;
var receiverGold = partyMember.Backpack.FindItemByType<Gold>();
if (receiverGold != null)
receiverGold.Amount += share;
else
partyMember.Backpack.DropItem(new Gold(share));
partyMember.PlaySound(item.GetDropSound());
if (partyMember == from)
{
from.SendMessage("You take some gold from the corpse and share with the party: {0} for each.", share);
int rest = item.Amount % party.Members.Count;
if (rest > 0)
{
var sharerGold = from.Backpack.FindItemByType<Gold>();
if (sharerGold != null)
sharerGold.Amount += rest;
else
from.Backpack.DropItem(new Gold(rest));
from.SendMessage("You keep the {0} gold left over.", rest);
}
}
else
{
partyMember.SendMessage("{0} takes some gold from the corpse and shares with the party: {1} for each.", from.Name, share);
if (WeightOverloading.IsOverloaded(partyMember))
{
receiverGold.Amount -= share;
var sharerGold = from.Backpack.FindItemByType<Gold>();
if (sharerGold != null)
sharerGold.Amount += share;
else
from.Backpack.DropItem(new Gold(share));
partyMember.SendMessage("But {0} keeps your share, because you are overloaded.", (from.Female ? "she" : "he"));
from.SendMessage("You keep {0}'s share, who is overloaded.", partyMember.Name);
}
}
}
item.Delete();
return true;
}
示例4: OnDragDrop
public override bool OnDragDrop( Mobile from, Item item )
{
if ( item is BasePotion )
{
BasePotion pot = (BasePotion)item;
if ( m_Held == 0 )
{
if ( GiveBottle( from ) )
{
m_Type = pot.PotionEffect;
Held = 1;
from.PlaySound( 0x240 );
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
item.Delete();
return true;
}
else
{
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
return false;
}
}
else if ( pot.PotionEffect != m_Type )
{
from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
return false;
}
else if ( m_Held >= 100 )
{
from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
return false;
}
else
{
if ( GiveBottle( from ) )
{
++Held;
item.Delete();
from.PlaySound( 0x240 );
from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.
item.Delete();
return true;
}
else
{
from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
return false;
}
}
}
else
{
from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
// Adam: anything other than a potion will get dropped into your backpack
// (so your best sword doesn't get dropped on the ground.)
from.AddToBackpack( item );
// For richness, we add the drop sound of the item dropped.
from.PlaySound( item.GetDropSound() );
return true;
}
}
示例5: OnDragDrop
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is SpellScroll && dropped.Amount == 1 )
{
SpellScroll scroll = (SpellScroll)dropped;
SpellbookType type = GetTypeForSpell( scroll.SpellID );
if ( type != this.SpellbookType )
{
return false;
}
else if ( HasSpell( scroll.SpellID ) )
{
from.SendLocalizedMessage( 500179 ); // That spell is already present in that spellbook.
return false;
}
else
{
int val = scroll.SpellID - BookOffset;
if ( val >= 0 && val < BookCount )
{
m_Content |= (ulong)1 << val;
++m_Count;
InvalidateProperties();
scroll.Delete();
from.Send( new PlaySound( 0x249, GetWorldLocation() ) );
return true;
}
return false;
}
}
else
{
// Adam: anything other than a scroll will get dropped into your backpack
// (so your best sword doesn't get dropped on the ground.)
from.AddToBackpack( dropped );
// For richness, we add the drop sound of the item dropped.
from.PlaySound( dropped.GetDropSound() );
return true;
}
}
示例6: OnDragDrop
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is RecallRune )
{
//Close all runebooks
from.CloseGump( typeof( RunebookGump ) );
if ( !CheckAccess( from ) )
{
from.SendLocalizedMessage( 502413 ); // That cannot be done while the book is locked down.
}
//else if ( IsOpen( from ) )
//{
// from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
//}
else if ( m_Entries.Count < 16 )
{
RecallRune rune = (RecallRune)dropped;
if ( rune.Marked && rune.TargetMap != null )
{
m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );
dropped.Delete();
from.Send( new PlaySound( 0x42, GetWorldLocation() ) );
string desc = rune.Description;
if ( desc == null || (desc = desc.Trim()).Length == 0 )
desc = "(indescript)";
from.SendMessage( desc );
return true;
}
else
{
from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
}
}
else
{
from.SendLocalizedMessage( 502401 ); // This runebook is full.
}
}
else if ( dropped is RecallScroll )
{
if ( m_CurCharges < m_MaxCharges )
{
from.Send( new PlaySound( 0x249, GetWorldLocation() ) );
int amount = dropped.Amount;
if ( amount > (m_MaxCharges - m_CurCharges) )
{
dropped.Consume( m_MaxCharges - m_CurCharges );
m_CurCharges = m_MaxCharges;
}
else
{
m_CurCharges += amount;
dropped.Delete();
return true;
}
}
else
{
from.SendLocalizedMessage( 502410 ); // This book already has the maximum amount of charges.
}
}
else
{
// Adam: anything other than a scroll will get dropped into your backpack
// (so your best sword doesn't get dropped on the ground.)
from.AddToBackpack( dropped );
// For richness, we add the drop sound of the item dropped.
from.PlaySound( dropped.GetDropSound() );
return true;
}
return false;
}
示例7: OnDragDrop
public override bool OnDragDrop( Mobile from, Item item )
{
bool bReturn = false;
if( item is Key )
{
if( Count < MAX_KEYS )
{
bReturn = base.OnDragDrop(from, item);
if( bReturn )
{
item.Movable = false;
}
UpdateItemID();
}
else
{
from.SendMessage("That key can't fit on that key ring.");
bReturn = false;
}
}
else
{
// Adam: anything other than a key will get dropped into your backpack
// (so your best sword doesn't get dropped on the ground.)
from.AddToBackpack( item );
// For richness, we add the drop sound of the item dropped.
from.PlaySound( item.GetDropSound() );
return true;
}
return bReturn;
}