本文整理汇总了C#中GamePlayer.SetCharacterClass方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.SetCharacterClass方法的具体用法?C# GamePlayer.SetCharacterClass怎么用?C# GamePlayer.SetCharacterClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.SetCharacterClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SetClass
public void SetClass(GamePlayer target, int classID)
{
//remove all their tricks and abilities!
target.RemoveAllSkills();
target.RemoveAllSpecs();
target.RemoveAllSpellLines();
target.RemoveAllStyles();
//reset before, and after changing the class.
target.Reset();
target.SetCharacterClass(classID);
target.Reset();
//this is just for additional updates
//that add all the new class changes.
target.OnLevelUp(0);
target.Out.SendUpdatePlayer();
target.Out.SendUpdatePlayerSkills();
target.Out.SendUpdatePoints();
}