本文整理汇总了C#中GamePlayer.SaveIntoDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.SaveIntoDatabase方法的具体用法?C# GamePlayer.SaveIntoDatabase怎么用?C# GamePlayer.SaveIntoDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.SaveIntoDatabase方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: RemovePlayer
/// <summary>
/// Delete's a member from this Guild
/// </summary>
/// <param name="removername">the player (client) removing</param>
/// <param name="member">the player named beeing remove</param>
/// <returns>true or false</returns>
public bool RemovePlayer(string removername, GamePlayer member)
{
try
{
GuildMgr.RemovePlayerFromAllGuildPlayersList(member);
RemoveOnlineMember(member);
member.GuildName = "";
member.GuildNote = "";
member.GuildID = "";
member.GuildRank = null;
member.Guild = null;
member.SaveIntoDatabase();
member.Out.SendObjectGuildID(member, member.Guild);
// Send message to removerClient about successful removal
if (removername == member.Name)
member.Out.SendMessage("You leave the guild.", DOL.GS.PacketHandler.eChatType.CT_System, DOL.GS.PacketHandler.eChatLoc.CL_SystemWindow);
else
member.Out.SendMessage(removername + " removed you from " + this.Name, PacketHandler.eChatType.CT_System, PacketHandler.eChatLoc.CL_SystemWindow);
}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.Error("RemovePlayer", e);
return false;
}
return true;
}
示例3: RespecDialogResponse
protected void RespecDialogResponse(GamePlayer player, byte response)
{
if (response != 0x01) return; //declined
int specPoints = 0;
int realmSpecPoints = 0;
if (player.TempProperties.getProperty(ALL_RESPEC, false))
{
specPoints = player.RespecAll();
player.TempProperties.removeProperty(ALL_RESPEC);
}
if (player.TempProperties.getProperty(DOL_RESPEC, false))
{
specPoints = player.RespecDOL();
player.TempProperties.removeProperty(DOL_RESPEC);
}
if (player.TempProperties.getProperty(RA_RESPEC, false))
{
realmSpecPoints = player.RespecRealm();
player.TempProperties.removeProperty(RA_RESPEC);
}
if (player.TempProperties.getProperty<object>(LINE_RESPEC, null) != null)
{
Specialization specLine = (Specialization)player.TempProperties.getProperty<object>(LINE_RESPEC, null);
specPoints = player.RespecSingle(specLine);
player.TempProperties.removeProperty(LINE_RESPEC);
}
if (player.TempProperties.getProperty(BUY_RESPEC, false))
{
player.TempProperties.removeProperty(BUY_RESPEC);
if (player.RespecCost >= 0 && player.RemoveMoney(player.RespecCost * 10000))
{
InventoryLogging.LogInventoryAction(player, "(respec)", eInventoryActionType.Merchant, player.RespecCost * 10000);
player.RespecAmountSingleSkill++;
player.RespecBought++;
DisplayMessage(player, "You bought a single line respec!");
}
player.Out.SendUpdateMoney();
}
// Assign full points returned
if (specPoints > 0)
{
player.SkillSpecialtyPoints += specPoints;
player.RemoveAllStyles(); // Kill styles
player.UpdateSpellLineLevels(false);
DisplayMessage(player, "You regain " + specPoints + " specialization points!");
}
if (realmSpecPoints > 0)
{
player.RealmSpecialtyPoints += realmSpecPoints;
DisplayMessage(player, "You regain " + realmSpecPoints + " realm specialization points!");
}
player.RefreshSpecDependantSkills(false);
// Notify Player of points
player.Out.SendUpdatePlayerSkills();
player.Out.SendUpdatePoints();
player.Out.SendUpdatePlayer();
player.SendTrainerWindow();
player.SaveIntoDatabase();
}
示例4: AddPlayer
/// <summary>
/// Add a player to a guild with the specified rank
/// </summary>
/// <param name="addPlayer"></param>
/// <param name="rank"></param>
/// <returns></returns>
public bool AddPlayer(GamePlayer addPlayer, DBRank rank)
{
if (addPlayer == null || addPlayer.Guild != null)
return false;
if (log.IsDebugEnabled)
log.Debug("Adding player to the guild, guild name=\"" + Name + "\"; player name=" + addPlayer.Name);
try
{
AddOnlineMember(addPlayer);
addPlayer.GuildName = Name;
addPlayer.GuildID = GuildID;
addPlayer.GuildRank = rank;
addPlayer.Guild = this;
addPlayer.SaveIntoDatabase();
GuildMgr.AddPlayerToAllGuildPlayersList(addPlayer);
addPlayer.Out.SendMessage("You have agreed to join " + this.Name + "!", eChatType.CT_Group, eChatLoc.CL_SystemWindow);
addPlayer.Out.SendMessage("Your current rank is " + addPlayer.GuildRank.Title + "!", eChatType.CT_Group, eChatLoc.CL_SystemWindow);
SendMessageToGuildMembers(addPlayer.Name + " has joined the guild!", eChatType.CT_Group, eChatLoc.CL_SystemWindow);
}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.Error("AddPlayer", e);
return false;
}
return true;
}
示例5: WithdrawGuildBank
public void WithdrawGuildBank(GamePlayer withdraw, double amount)
{
if (amount < 0)
{
withdraw.Out.SendMessage(LanguageMgr.GetTranslation(withdraw.Client, "Scripts.Player.Guild.WithdrawInvalid"), eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
return;
}
else if ((withdraw.Guild.GetGuildBank() - amount) < 0)
{
withdraw.Out.SendMessage(LanguageMgr.GetTranslation(withdraw.Client, "Scripts.Player.Guild.WithdrawTooMuch"), eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
return;
}
withdraw.Out.SendMessage(LanguageMgr.GetTranslation(withdraw.Client, "Scripts.Player.Guild.Withdrawamount", Money.GetString(long.Parse(amount.ToString()))), eChatType.CT_Guild, eChatLoc.CL_SystemWindow);
withdraw.Guild.UpdateGuildWindow();
m_DBguild.Bank -= amount;
var amt = long.Parse(amount.ToString());
withdraw.AddMoney(amt);
InventoryLogging.LogInventoryAction("(GUILD;" + Name + ")", withdraw, eInventoryActionType.Other, amt);
withdraw.Out.SendUpdatePlayer();
withdraw.SaveIntoDatabase();
withdraw.Guild.SaveIntoDatabase();
return;
}
示例6: RemoveProc
public void RemoveProc(GamePlayer player, int procNumber)
{
InventoryItem item = player.TempProperties.getProperty<InventoryItem>(TempProperty);
player.TempProperties.removeProperty(TempProperty);
if (item == null || item.OwnerID != player.InternalID || item.OwnerID == null)
return;
player.Inventory.RemoveItem(item);
ItemUnique unique = new ItemUnique(item.Template);
if (procNumber == 1)
{
unique.ProcSpellID = 0;
unique.SpellID = 0;
}
else if (procNumber == 2)
{
unique.ProcSpellID1 = 0;
unique.SpellID1 = 0;
}
else
{
SendReply(player, "Error, contact a GM");
}
GameServer.Database.AddObject(unique);
InventoryItem newInventoryItem = GameInventoryItem.Create<ItemUnique>(unique);
player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, newInventoryItem);
player.Out.SendInventoryItemsUpdate(new InventoryItem[] { newInventoryItem });
player.SaveIntoDatabase();
}
示例7: OnLevelUp
/// <summary>
/// Add all skills and other things that are required for current level
/// </summary>
/// <param name="player">player to modify</param>
public virtual void OnLevelUp(GamePlayer player)
{
// Grav: autotrain in player.OnLevelUp()
// If this is a PvE server, issue one realm specialty point
// for each level starting at level 20.
if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_PvE)
{
// Somewhere in the code, regardless of server type, one RA point
// is being assigned at lvl 20 already (I don't know where that's
// coming from). That's why the following is <= 20 and not just < 20.
if (player.Level <= 20) return;
player.RealmSpecialtyPoints++;
player.SaveIntoDatabase();
}
}
示例8: SetModel
public void SetModel(GamePlayer player, int number)
{
InventoryItem item = player.TempProperties.getProperty<InventoryItem>(TempProperty);
player.TempProperties.removeProperty(TempProperty);
if (item == null || item.OwnerID != player.InternalID || item.OwnerID == null)
return;
player.Inventory.RemoveItem(item);
ItemUnique unique = new ItemUnique(item.Template);
unique.Model = number;
GameServer.Database.AddObject(unique);
InventoryItem newInventoryItem = GameInventoryItem.Create<ItemUnique>(unique);
player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, newInventoryItem);
player.Out.SendInventoryItemsUpdate(new InventoryItem[] { newInventoryItem });
player.RemoveBountyPoints(300);
player.SaveIntoDatabase();
}