本文整理汇总了C#中Server.Mobiles.PlayerMobile.AddToBackpack方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerMobile.AddToBackpack方法的具体用法?C# PlayerMobile.AddToBackpack怎么用?C# PlayerMobile.AddToBackpack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Mobiles.PlayerMobile
的用法示例。
在下文中一共展示了PlayerMobile.AddToBackpack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GiveArtifactTo
public static void GiveArtifactTo( PlayerMobile pm )
{
Item item = (Item) Activator.CreateInstance( Artifacts[Utility.Random( Artifacts.Length )] );
bool message = true;
if ( !pm.AddToBackpack( item ) )
{
Container bank = pm.BankBox;
if ( !( bank != null && bank.TryDropItem( pm, item, false ) ) )
{
pm.SendLocalizedMessage( 1072523, "", 64 ); // You find an artifact, but your backpack and bank are too full to hold it.
message = false;
item.MoveToWorld( pm.Location, pm.Map );
}
}
if ( message )
pm.SendLocalizedMessage( 1062317, "", 64 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
EffectPool.ArtifactDrop( pm );
pm.DoomCredits = 0;
}
示例2: FixPlayer
public static void FixPlayer( PlayerMobile mob )
{
if ( mob != null )
{
Server.Skills skills = mob.Skills;
int totalDecrease = 0;
for ( int i = 0; i < skills.Length; i++ )
{
Skill skill = skills[i];
if ( skill.CapFixedPoint > 1000 )
skill.CapFixedPoint = 1000;
if ( skill.BaseFixedPoint > 1000 )
{
totalDecrease += skill.BaseFixedPoint - 1000;
skill.BaseFixedPoint = 1000;
}
}
mob.SkillsCap = 7000;
int totalGiveSkill = Math.Min( totalDecrease, 7000 - skills.Total );
if ( totalGiveSkill > 0 )
{
EtherealSoulStone stone = new EtherealSoulStone( mob.Account.Username );
stone.SkillValue = (totalGiveSkill / 10.0);
mob.AddToBackpack( stone );
}
}
}
示例3: Reward
public virtual void Reward( PlayerMobile player, CollectionItem reward, int hue )
{
Item item = QuestHelper.Construct( reward.Type ) as Item;
if ( item != null && player.AddToBackpack( item ) )
{
if ( hue > 0 )
item.Hue = hue;
player.AddCollectionPoints( CollectionID, (int) reward.Points * -1 );
player.SendLocalizedMessage( 1073621 ); // Your reward has been placed in your backpack.
player.PlaySound( 0x5A7 );
}
else if ( item != null )
{
player.SendLocalizedMessage( 1074361 ); // The reward could not be given. Make sure you have room in your pack.
item.Delete();
}
reward.OnGiveReward( player, this, hue );
player.SendGump( new ComunityCollectionGump( player, this, Location ) );
}
示例4: OnGivenFungi
public void OnGivenFungi( PlayerMobile player, ZoogiFungus fungi )
{
this.Direction = this.GetDirectionTo( player );
SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest;
if ( qs != null && qs.RedSolen == this.RedSolen )
{
QuestObjective obj = qs.FindObjective( typeof( ProcessFungiObjective ) );
if ( obj != null && !obj.Completed )
{
int amount = fungi.Amount / 2;
if ( amount > 100 )
{
amount = 100;
}
if ( amount > 0 )
{
if ( amount * 2 >= fungi.Amount )
{
fungi.Delete();
}
else
{
fungi.Amount -= amount * 2;
}
PowderOfTranslocation powder = new PowderOfTranslocation( amount );
player.AddToBackpack( powder );
player.SendLocalizedMessage( 1054100 ); // You receive some powder of translocation.
obj.Complete();
}
}
}
}
示例5: OnTalk
public override void OnTalk(PlayerMobile player, bool contextMenu)
{
QuestSystem qs = player.Quest;
if (qs.GetType() == ParentQuestSystem)
{
if (HaochisTrialsQuest.HasLostHaochisKatana(player))
{
qs.AddConversation(new LostSwordConversation());
return;
}
QuestObjective obj = qs.FindObjective(typeof(FindHaochiObjective));
if (obj != null && !obj.Completed)
{
obj.Complete();
return;
}
obj = qs.FindObjective(typeof(FirstTrialReturnObjective));
if (obj != null && !obj.Completed)
{
player.AddToBackpack(new LeatherDo());
obj.Complete();
return;
}
obj = qs.FindObjective(typeof(SecondTrialReturnObjective));
if (obj != null && !obj.Completed)
{
if (((SecondTrialReturnObjective)obj).Dragon)
player.AddToBackpack(new LeatherSuneate());
obj.Complete();
return;
}
obj = qs.FindObjective(typeof(ThirdTrialReturnObjective));
if (obj != null && !obj.Completed)
{
player.AddToBackpack(new LeatherHiroSode());
obj.Complete();
return;
}
obj = qs.FindObjective(typeof(FourthTrialReturnObjective));
if (obj != null && !obj.Completed)
{
if (!((FourthTrialReturnObjective)obj).KilledCat)
{
Container cont = GetNewContainer();
cont.DropItem(new LeatherHiroSode());
cont.DropItem(new JinBaori());
player.AddToBackpack(cont);
}
obj.Complete();
return;
}
obj = qs.FindObjective(typeof(FifthTrialReturnObjective));
if (obj != null && !obj.Completed)
{
Container pack = player.Backpack;
if (pack != null)
{
Item katana = pack.FindItemByType(typeof(HaochisKatana));
if (katana != null)
{
katana.Delete();
obj.Complete();
obj = qs.FindObjective(typeof(FifthTrialIntroObjective));
if (obj != null && ((FifthTrialIntroObjective)obj).StolenTreasure)
qs.AddConversation(new SixthTrialIntroConversation(true));
else
qs.AddConversation(new SixthTrialIntroConversation(false));
}
}
return;
}
obj = qs.FindObjective(typeof(SixthTrialReturnObjective));
if (obj != null && !obj.Completed)
{
obj.Complete();
return;
}
obj = qs.FindObjective(typeof(SeventhTrialReturnObjective));
if (obj != null && !obj.Completed)
//.........这里部分代码省略.........
示例6: BonusAction
public virtual void BonusAction( PlayerMobile player, Mobile attacker )
{
if( player != null && player.Backpack != null )
{
Diamond diamond = new Diamond();
diamond.ItemID = 0xF29;
player.AddToBackpack( diamond );
}
if( attacker != null )
attacker.Poison = Poison.Lethal;
}
示例7: OnTalk
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
QuestSystem qs = player.Quest;
if ( qs is EminosUndertakingQuest )
{
if ( EminosUndertakingQuest.HasLostNoteForZoel( player ) )
{
Item note = new NoteForZoel();
if ( player.PlaceInBackpack( note ) )
{
qs.AddConversation( new LostNoteConversation() );
}
else
{
note.Delete();
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
}
}
else if ( EminosUndertakingQuest.HasLostEminosKatana( player ) )
{
qs.AddConversation( new LostSwordConversation() );
}
else
{
QuestObjective obj = qs.FindObjective( typeof( FindEminoBeginObjective ) );
if ( obj != null && !obj.Completed )
{
obj.Complete();
}
else
{
obj = qs.FindObjective( typeof( UseTeleporterObjective ) );
if ( obj != null && !obj.Completed )
{
Item note = new NoteForZoel();
if ( player.PlaceInBackpack( note ) )
{
obj.Complete();
player.AddToBackpack( new LeatherNinjaPants() );
player.AddToBackpack( new LeatherNinjaMitts() );
}
else
{
note.Delete();
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
}
}
else
{
obj = qs.FindObjective( typeof( ReturnFromInnObjective ) );
if ( obj != null && !obj.Completed )
{
Container cont = GetNewContainer();
for ( int i = 0; i < 10; i++ )
cont.DropItem( new LesserHealPotion() );
cont.DropItem( new LeatherNinjaHood() );
cont.DropItem( new LeatherNinjaJacket() );
if ( player.PlaceInBackpack( cont ) )
{
obj.Complete();
}
else
{
cont.Delete();
player.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
}
}
else
{
if ( qs.IsObjectiveInProgress( typeof( SlayHenchmenObjective ) ) )
{
qs.AddConversation( new ContinueSlayHenchmenConversation() );
}
else
{
obj = qs.FindObjective( typeof( GiveEminoSwordObjective ) );
if ( obj != null && !obj.Completed )
{
Item katana = null;
if ( player.Backpack != null )
katana = player.Backpack.FindItemByType( typeof( EminosKatana ) );
if ( katana != null )
{
bool stolenTreasure = false;
HallwayWalkObjective walk = qs.FindObjective( typeof( HallwayWalkObjective ) ) as HallwayWalkObjective;
if ( walk != null )
//.........这里部分代码省略.........
示例8: OnTalk
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
Direction = this.GetDirectionTo( player );
QuestSystem qs = player.Quest;
if ( qs is EminosUndertakingQuest )
{
if ( qs.IsObjectiveInProgress( typeof( FindDaimyoEminoObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( FindDaimyoEminoObjective ) );
if ( obj != null )
{
obj.Complete();
}
qs.AddConversation( new DaimyoEminoBeginConversation() );
qs.AddObjective( new FindEliteNinjaZoelObjective() );
}
if ( qs.IsObjectiveInProgress( typeof( TakeGreenTeleporterObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( TakeGreenTeleporterObjective ) );
if ( obj != null )
{
obj.Complete();
}
qs.AddConversation( new EminoSecondConversation() );
player.AddToBackpack( new NoteForZoel() );
player.AddToBackpack( new LeatherNinjaPants() );
player.AddToBackpack( new LeatherNinjaMitts() );
qs.AddObjective( new BringNoteToZoelObjective() );
}
if ( qs.IsObjectiveInProgress( typeof( GoBackBlueTeleporterObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( GoBackBlueTeleporterObjective ) );
if ( obj != null )
{
obj.Complete();
}
qs.AddConversation( new FrownsConversation() );
Bag bag = new Bag();
bag.Hue = 0x660;
bag.DropItem( new LeatherNinjaJacket() );
bag.DropItem( new LeatherNinjaHood() );
for ( int i = 0; i < 10; i++ )
{
bag.DropItem( new LesserHealPotion() );
}
player.AddToBackpack( bag );
qs.AddObjective( new TakeWhiteTeleporterObjective() );
}
if ( qs.IsObjectiveInProgress( typeof( KillHenchmensObjective ) ) )
{
qs.AddConversation( new ContinueKillHenchmensConversation() );
}
if ( qs.IsObjectiveInProgress( typeof( ReturnToDaimyoObjective ) ) )
{
List<Item> list = player.Backpack.Items;
DaimyoEminosKatana katana = null;
for ( int i = 0; i < list.Count; i++ )
{
if ( list[i] is DaimyoEminosKatana )
{
katana = list[i] as DaimyoEminosKatana;
break;
}
}
if ( katana == null )
{
qs.AddConversation( new TakeSwordAgainConversation() );
}
else
{
katana.Delete();
QuestObjective obj = qs.FindObjective( typeof( ReturnToDaimyoObjective ) );
//.........这里部分代码省略.........
示例9: OnTalk
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
Direction = this.GetDirectionTo( player );
QuestSystem qs = player.Quest;
if ( qs is HaochisTrialsQuest )
{
HaochisTrialsQuest htq = qs as HaochisTrialsQuest;
if ( qs.IsObjectiveInProgress( typeof( SpeakToDaimyoHaochiObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( SpeakToDaimyoHaochiObjective ) );
if ( obj != null )
{
obj.Complete();
}
qs.AddConversation( new DaimyoHaochiBeginConversation() );
qs.AddObjective( new FollowGreenPathObjective() );
}
if ( qs.IsObjectiveInProgress( typeof( KillRoninsOrSoulsObjective ) ) )
{
bool ronins = false;
if ( htq.KilledRonins > htq.KilledSouls )
{
ronins = true;
}
if ( ronins )
{
qs.AddConversation( new ContinueSlayingRoninsConversation() );
}
else if ( htq.KilledSouls > 0 )
{
qs.AddConversation( new ContinueSlayingSoulsConversation() );
}
}
if ( qs.IsObjectiveInProgress( typeof( FirstTrialCompleteObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( FirstTrialCompleteObjective ) );
if ( obj != null )
{
obj.Complete();
}
if ( htq.KilledRonins == 3 )
{
qs.AddConversation( new ThanksForRoninsConversation() );
}
if ( htq.KilledSouls == 3 )
{
qs.AddConversation( new ThanksForSoulsConversation() );
}
player.AddToBackpack( new LeatherDo() );
qs.AddObjective( new FollowYellowPathObjective() );
}
if ( qs.IsObjectiveInProgress( typeof( SecondTrialCompleteObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( SecondTrialCompleteObjective ) );
if ( obj != null )
{
obj.Complete();
}
if ( htq.Opponent == OpponentType.FierceDragon )
{
qs.AddConversation( new DragonConversation() );
}
if ( htq.Opponent == OpponentType.DeadlyImp )
{
qs.AddConversation( new ImpConversation() );
}
player.AddToBackpack( new LeatherSuneate() );
qs.AddObjective( new FollowBluePathObjective() );
}
if ( qs.IsObjectiveInProgress( typeof( ThirdTrialCompleteObjective ) ) )
{
QuestObjective obj = qs.FindObjective( typeof( ThirdTrialCompleteObjective ) );
if ( obj != null )
{
obj.Complete();
}
//.........这里部分代码省略.........
示例10: GiveReward
public virtual Item[] GiveReward(PlayerMobile pm)
{
if (pm == null || pm.Deleted || !Enabled)
{
return new Item[0];
}
Item e = CreateInstance();
if (e == null)
{
return new Item[0];
}
var items = new List<Item>
{
e
};
if (e.Stackable)
{
e.Amount = Amount;
}
else
{
int count = Amount - 1;
while (--count >= 0)
{
items.Add(CreateInstance());
}
}
items.ToArray().ForEach(
item =>
{
switch (_DeliveryMethod)
{
case PvPRewardDeliveryMethod.Bank:
{
if (pm.BankBox == null || pm.BankBox.Deleted || !pm.BankBox.TryDropItem(pm, item, true))
{
if (!pm.AddToBackpack(item))
{
item.Delete();
items.Remove(item);
}
}
}
break;
default:
{
if (!pm.AddToBackpack(item))
{
if (pm.BankBox == null || pm.BankBox.Deleted || !pm.BankBox.TryDropItem(pm, item, true))
{
item.Delete();
items.Remove(item);
}
}
}
break;
}
});
return items.ToArray();
}
示例11: withdrawTokens
internal bool withdrawTokens(PlayerMobile player, ulong amount, bool intoTokensCheck)
{
#if USE_TOKENS
if ( !IsOwner(player) )
return false;
if ( !TokenLedger )
return false;
if (amount > TokensAmount)
amount = TokensAmount;
if (amount > int.MaxValue)
amount = int.MaxValue;
if (intoTokensCheck)
{
if (player.AddToBackpack(new TokenCheck((int)amount)))
{
TokensAmount -= amount;
return true;
}
}
else
{
while (amount > 0)
{
if (amount > 60000 && player.AddToBackpack(new Daat99Tokens(60000)))
{
amount -= 60000;
TokensAmount -= 60000;
}
else if (amount < 60000)
{
if (player.AddToBackpack(new Daat99Tokens((int)amount)))
{
TokensAmount -= amount;
return true;
}
else
return false;
}
else
return false;
}
}
#endif
return false;
}
示例12: withdrawGold
internal bool withdrawGold(PlayerMobile player, ulong amount, bool intoGoldCheck)
{
if ( !IsOwner(player) )
return false;
if ( !GoldLedger )
return false;
if (amount > GoldAmount)
amount = GoldAmount;
if (amount > int.MaxValue)
amount = int.MaxValue;
if (intoGoldCheck)
{
if (player.AddToBackpack(new BankCheck((int)amount)))
{
GoldAmount -= amount;
return true;
}
}
else
{
while (amount > 0)
{
if (amount > 60000 && player.AddToBackpack(new Gold(60000)))
{
amount -= 60000;
GoldAmount -= 60000;
}
else if (amount < 60000)
{
if (player.AddToBackpack(new Gold((int)amount)))
{
GoldAmount -= amount;
return true;
}
else
return false;
}
else
return false;
}
}
return false;
}
示例13: OnTalk
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
Direction = this.GetDirectionTo( player );
QuestSystem qs = player.Quest;
if ( qs is TerribleHatchlingsQuest )
{
if ( qs.IsObjectiveInProgress( typeof( ReturnToAnsellaGryenObjective ) ) )
{
Container cont = GetNewContainer();
cont.DropItem( new Gold( Utility.RandomMinMax( 100, 200 ) ) );
switch ( Utility.Random( 1 ) )
{
case 0:
{
BaseWeapon weapon = Loot.RandomWeapon( true );
BaseRunicTool.ApplyAttributesTo( weapon, 3, 10, 30 );
cont.DropItem( weapon );
break;
}
case 1:
{
BaseArmor armor = Loot.RandomArmor( true );
BaseRunicTool.ApplyAttributesTo( armor, 1, 10, 20 );
cont.DropItem( armor );
break;
}
}
player.AddToBackpack( cont );
qs.AddConversation( new RewardsConversation() );
}
else
{
qs.AddConversation( new DeathwatchBeetlesLocationConversation() );
}
}
else
{
QuestSystem newQuest = new TerribleHatchlingsQuest( player );
bool inRestartPeriod = false;
if ( qs != null )
{
SayTo( player, 1063322 ); // Before you can help me with the Terrible Hatchlings, you'll need to finish the quest you've already taken!
}
else if ( QuestSystem.CanOfferQuest( player, typeof( TerribleHatchlingsQuest ), out inRestartPeriod ) )
{
PlaySound( 0x2A3 );
newQuest.SendOffer();
}
else if ( inRestartPeriod && contextMenu )
{
SayTo( player, 1049357 ); // I have nothing more for you at this time.
}
}
}
示例14: SellResource
public static bool SellResource(TradeAdvisor trader, PlayerMobile buyer, CraftResource r, int amount)
{
if(trader.Government == null || trader.Government.Deleted)
return false;
if (trader.Government.TradeInformation == null)
return false;
if (!CanDoBusiness(trader.Government, buyer))
{
trader.Say("I cannot do business with you.");
return false;
}
#region Amount Checking
if (trader.Government.Resources[GetType(r)] < 1)
{
trader.Say("I have no " + GetType(r).ToString() + " in stock.");
return false;
}
else if (amount / GetDivisor(r) > trader.Government.Resources[GetType(r)])
{
trader.Say("I only have " + trader.Government.Resources[GetType(r)] + " units of " + GetType(r).ToString() + " in stock.");
return false;
}
else if (amount < GetDivisor(r))
{
trader.Say("You must purchase at least " + GetDivisor(r).ToString() + " " + GetString(r) + ".");
return false;
}
else if (r != CraftResource.Gold && amount % GetDivisor(r) > 0)
{
trader.Say(r.ToString() + " is handled in units of " + GetDivisor(r).ToString() + ".");
return false;
}
#endregion
if (CustomGuildStone.IsGuildEconomic(buyer, trader.Government))
{
Item res = (Item)Activator.CreateInstance(GetResourceObject(r), amount);
buyer.AddToBackpack(res);
trader.Say("Of course you may freely access " + trader.Government.Name + "'s resources.");
trader.Government.Resources[GetType(r)] -= (int)(amount / GetDivisor(r));
return true;
}
else
{
if (trader.Government.Resources[GetType(r)] - (amount / GetDivisor(r)) < GetMinimum(r, trader.Government))
{
trader.Say("I have been ordered not to go below " + GetMinimum(r, trader.Government).ToString() + " units of " + GetType(r).ToString() + " in my stock.");
return false;
}
else if (buyer.Backpack.GetAmount(typeof(Copper)) < ((amount / GetDivisor(r)) * GetSellPrice(r, trader.Government)))
{
trader.Say("You don't have enough coin to buy " + (amount / GetDivisor(r)) + " units of " + GetType(r).ToString() + ".");
return false;
}
else if (buyer.Backpack.ConsumeTotal(typeof(Copper), ((int)(amount / GetDivisor(r)) * GetSellPrice(r, trader.Government))))
{
#region Successful Sale of Resources to a Player
switch (Utility.Random(3))
{
case 0: buyer.PlaySound(0x2E5); break;
case 1: buyer.PlaySound(0x2E6); break;
case 2: buyer.PlaySound(0x2E7); break;
}
Item res = (Item)Activator.CreateInstance(GetResourceObject(r), amount);
buyer.AddToBackpack(res);
trader.Government.Resources[GetType(r)] -= (int)(amount / GetDivisor(r));
return true;
#endregion
}
else
{
trader.Say("You do not have enough copper coins.");
return false;
}
}
}
示例15: OnTeamMemberAdded
public override void OnTeamMemberAdded(PvPTeam team, PlayerMobile pm)
{
if (TeamStats.ContainsKey(pm))
{
TeamStats[pm] = team;
}
else
{
TeamStats.Add(pm, team);
}
base.OnTeamMemberAdded(team, pm);
if (UseTemplates)
{
PvPTemplates.FetchProfile(pm).ApplyDelta(UseTemplateEquipment);
}
if (IncognitoMode)
{
IncogMode(pm);
}
if (ThrowableMode)
{
if (_Axes == null)
{
_Axes = new Dictionary<PlayerMobile, ThrowableAxe>();
}
if (ThrowableID == 0)
{
ThrowableID = 0x13FB;
}
if (ThrowableHue == 0)
{
ThrowableHue = 1161;
}
var Axe = new ThrowableAxe
{
Movable = false,
ItemID = ThrowableID,
};
if (Utility.RandomDouble() <= 0.1)
{
Axe.Name = "Stone Chair";
Axe.ItemID = 4632;
}
Axe.EffectID = Axe.ItemID;
Axe.Hue = ThrowableHue;
Axe.EffectHue = Axe.Hue-1;
Axe.Stackable = false;
if (_Axes != null && !_Axes.ContainsKey(pm))
{
_Axes.Add(pm, Axe);
}
if (pm.Backpack != null)
{
pm.AddToBackpack(Axe);
}
}
}