本文整理汇总了C#中GamePlayer.ReceiveItem方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.ReceiveItem方法的具体用法?C# GamePlayer.ReceiveItem怎么用?C# GamePlayer.ReceiveItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.ReceiveItem方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PromotePlayer
/// <summary>
/// Called to promote a player
/// </summary>
/// <param name="player">the player to promote</param>
/// <param name="classid">the new classid</param>
/// <param name="messageToPlayer">the message for the player</param>
/// <param name="gifts">Array of inventory items as promotion gifts</param>
/// <returns>true if successfull</returns>
public bool PromotePlayer(GamePlayer player, int classid, string messageToPlayer, InventoryItem[] gifts)
{
if (player == null) return false;
ICharacterClass oldClass = player.CharacterClass;
// Player was promoted
if (player.SetCharacterClass(classid))
{
player.RemoveAllStyles();
player.RemoveAllAbilities();
player.RemoveAllSpellLines();
if (messageToPlayer != "")
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Says", this.Name, messageToPlayer), eChatType.CT_System, eChatLoc.CL_PopupWindow);
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Upgraded", player.CharacterClass.Name), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
player.CharacterClass.OnLevelUp(player, player.Level);
player.RefreshSpecDependantSkills(true);
player.StartPowerRegeneration();
player.Out.SendUpdatePlayerSkills();
player.Out.SendUpdatePlayer();
// drop any non usable item
CheckAbilityToUseItem(player);
// Initiate equipment
if (gifts != null && gifts.Length > 0)
{
for (int i = 0; i < gifts.Length; i++)
{
player.ReceiveItem(this, gifts[i]);
}
}
// after gifts
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameTrainer.PromotePlayer.Accepted", player.CharacterClass.Profession), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
Notify(GameTrainerEvent.PlayerPromoted, this, new PlayerPromotedEventArgs(player, oldClass));
player.SaveIntoDatabase();
return true;
}
return false;
}
示例2: GiveItem
protected static bool GiveItem(GameLiving source, GamePlayer player, ItemTemplate itemTemplate, bool canDrop)
{
InventoryItem item = null;
if (itemTemplate is ItemUnique)
{
GameServer.Database.AddObject(itemTemplate as ItemUnique);
item = GameInventoryItem.Create(itemTemplate as ItemUnique);
}
else
{
item = GameInventoryItem.Create(itemTemplate);
}
if (!player.ReceiveItem(source, item))
{
if (canDrop)
{
player.CreateItemOnTheGround(item);
player.Out.SendMessage(String.Format("Your backpack is full, {0} is dropped on the ground.", itemTemplate.Name), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
}
else
{
player.Out.SendMessage("Your backpack is full!", eChatType.CT_Important, eChatLoc.CL_PopupWindow);
return false;
}
}
return true;
}
示例3: BuildTask
/// <summary>
/// Create an Item, Search for a NPC to consign the Item and give Item to the Player
/// </summary>
/// <param name="player"></param>
/// <param name="source"></param>
/// <returns></returns>
public static bool BuildTask(GamePlayer player, GameLiving source)
{
if (source == null)
return false;
GameNPC NPC = GetRandomNPC(player);
if(NPC == null)
{
player.Out.SendMessage("I have no task for you, come back some time later.",eChatType.CT_System,eChatLoc.CL_PopupWindow);
return false;
}
else
{
InventoryItem TaskItems = GenerateNPCItem(NPC.Name, player.Level);
player.Task = new MoneyTask(player);
player.Task.TimeOut = DateTime.Now.AddHours(2);
player.Task.ItemName = TaskItems.Name;
player.Task.RecieverName = NPC.Name;
((MoneyTask)player.Task).RecieverZone = NPC.CurrentZone.Description;
player.Out.SendMessage("Bring "+TaskItems.GetName(0,false)+" to "+NPC.Name +" in "+ NPC.CurrentZone.Description, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
//Player.Out.SendCustomDialog("", new CustomDialogResponse(TaskDialogResponse));
player.ReceiveItem(source,TaskItems);
return true;
}
}
示例4: GiveItem
/// <summary>
/// Hand out an artifact.
/// </summary>
/// <param name="source"></param>
/// <param name="player"></param>
/// <param name="artifactID"></param>
/// <param name="itemTemplate"></param>
protected new static bool GiveItem(GamePlayer player, ItemTemplate itemTemplate)
{
InventoryArtifact item = new InventoryArtifact(itemTemplate);
if (!player.ReceiveItem(null, item))
{
player.Out.SendMessage(String.Format("Your backpack is full, please make some room and try again."), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
return false;
}
return true;
}
示例5: ReturnArtifact
protected void ReturnArtifact(GamePlayer player)
{
ItemTemplate itemTemplate = GameServer.Database.FindObjectByKey<ItemTemplate>(GetCustomProperty("Id_nb"));
InventoryArtifact artifact = new InventoryArtifact(itemTemplate);
artifact.ArtifactLevel = Convert.ToInt32(GetCustomProperty("ALevel"));
artifact.Experience = Convert.ToInt64(GetCustomProperty("AXP"));
artifact.UpdateAbilities(itemTemplate);
if (!player.ReceiveItem(null, artifact))
{
player.Out.SendMessage(String.Format("Your backpack is full, please make some room and try again. You may have to relog to get to complete this quest."), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
return;
}
FinishQuest();
}
示例6: GiveItem
/// <summary>
/// Hand out an artifact.
/// </summary>
/// <param name="source"></param>
/// <param name="player"></param>
/// <param name="artifactID"></param>
/// <param name="itemTemplate"></param>
protected static bool GiveItem(GameLiving source, GamePlayer player, String artifactID, ItemTemplate itemTemplate)
{
InventoryItem item = new InventoryArtifact(itemTemplate);
if (!player.ReceiveItem(source, item))
{
player.Out.SendMessage(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactQuest.GiveItem.BackpackFull"), eChatType.CT_Important, eChatLoc.CL_PopupWindow);
return false;
}
return true;
}