本文整理汇总了C#中Game.Server.GameObjects.GamePlayer.AddGold方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.AddGold方法的具体用法?C# GamePlayer.AddGold怎么用?C# GamePlayer.AddGold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Server.GameObjects.GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.AddGold方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDailyAward
//0表示男女,1男2女
//type 1表示物品,2表示金币,3表示点券,4表示经验,5表示功勋,6表示BUFF
public static bool AddDailyAward(GamePlayer player)
{
if (DateTime.Now.Date == player.PlayerCharacter.LastAward.Date)
{
return false;
}
//if (player.PlayerCharacter.DayLoginCount > 0)
// return false;
player.PlayerCharacter.DayLoginCount++;
player.PlayerCharacter.LastAward = DateTime.Now;
DailyAwardInfo[] infos = GetAllAwardInfo();
StringBuilder msg = new StringBuilder();
string full = string.Empty;
bool has = false;
foreach (DailyAwardInfo info in infos)
{
if (info.Sex != 0 && (player.PlayerCharacter.Sex ? 1 : 2) != info.Sex)
continue;
has = true;
switch (info.Type)
{
case 1:
ItemTemplateInfo itemTemplateInfo = Bussiness.Managers.ItemMgr.FindItemTemplate(info.TemplateID);
if (itemTemplateInfo != null)
{
int itemCount = info.Count;
for (int len = 0; len < itemCount; len += itemTemplateInfo.MaxCount)
{
int count = len + itemTemplateInfo.MaxCount > itemCount ? itemCount - len : itemTemplateInfo.MaxCount;
ItemInfo item = ItemInfo.CreateFromTemplate(itemTemplateInfo, count, (int)ItemAddType.DailyAward);
item.ValidDate = info.ValidDate;
item.IsBinds = info.IsBinds;
//if (player.AddItem(item, Game.Server.Statics.ItemAddType.DailyAward, item.GetBagType()) == -1)
if (!player.AddTemplate(item,item.Template.BagType,item.Count))
{
using (PlayerBussiness db = new PlayerBussiness())
{
item.UserID = 0;
db.AddGoods(item);
MailInfo message = new MailInfo();
message.Annex1 = item.ItemID.ToString();
message.Content = LanguageMgr.GetTranslation("AwardMgr.AddDailyAward.Content", item.Template.Name);
message.Gold = 0;
message.Money = 0;
message.Receiver = player.PlayerCharacter.NickName;
message.ReceiverID = player.PlayerCharacter.ID;
message.Sender = message.Receiver;
message.SenderID = message.ReceiverID;
message.Title = LanguageMgr.GetTranslation("AwardMgr.AddDailyAward.Title", item.Template.Name);
message.Type = (int)eMailType.DailyAward;
db.SendMail(message);
full = LanguageMgr.GetTranslation("AwardMgr.AddDailyAward.Mail");
}
}
}
}
break;
case 2:
player.AddGold(info.Count);
break;
case 3:
player.AddMoney(info.Count);
LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Daily, player.PlayerCharacter.ID, info.Count, player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", "");
break;
case 4:
player.AddGP(info.Count);
break;
case 5:
player.AddOffer(info.Count, false);
break;
case 6:
ItemTemplateInfo template = Bussiness.Managers.ItemMgr.FindItemTemplate(info.TemplateID);
if (template != null)
{
AbstractBuffer buffer = BufferList.CreateBufferHour(template, info.ValidDate);
buffer.Start(player);
}
break;
}
}
if (has)
{
//player.Out.SendMessage(eMessageType.DailyAward, full + msg.ToString());
if (!string.IsNullOrEmpty(full))
{
player.Out.SendMailResponse(player.PlayerCharacter.ID, eMailRespose.Receiver);
}
}
return true;
//.........这里部分代码省略.........