本文整理汇总了C#中Bussiness.PlayerBussiness.AddGoods方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerBussiness.AddGoods方法的具体用法?C# PlayerBussiness.AddGoods怎么用?C# PlayerBussiness.AddGoods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bussiness.PlayerBussiness
的用法示例。
在下文中一共展示了PlayerBussiness.AddGoods方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveToDatabase
/// <summary>
/// 保存到数据库中
/// </summary>
public void SaveToDatabase()
{
using (PlayerBussiness pb = new PlayerBussiness())
{
lock (_lock)
{
for (int i = 0; i < _items.Length; i++)
{
ItemInfo item = _items[i];
if (item != null)
{
if (item.IsDirty)
{
if (item.ItemID > 0)
{
pb.UpdateGoods(item);
}
else
{
pb.AddGoods(item);
}
}
}
}
foreach (ItemInfo item in _removedList)
{
pb.UpdateGoods(item);
}
_removedList.Clear();
}
}
}
示例2: SendGoodManCard
public void SendGoodManCard(string receiverName, int receiverID, string senderName, int senderID, PlayerBussiness db)
{
ItemTemplateInfo goodMan = ItemMgr.FindItemTemplate(11105);
ItemInfo goodManCard = ItemInfo.CreateFromTemplate(goodMan, 1, (int)ItemAddType.webing);
goodManCard.IsBinds = true;
goodManCard.UserID = 0;
db.AddGoods(goodManCard);
MailInfo mail = new MailInfo();
mail.Annex1 = goodManCard.ItemID.ToString();
mail.Content = LanguageMgr.GetTranslation("MarryApplyReplyHandler.Content");
mail.Gold = 0;
mail.IsExist = true;
mail.Money = 0;
mail.Receiver = receiverName;
mail.ReceiverID = receiverID;
mail.Sender = senderName;
mail.SenderID = senderID;
mail.Title = LanguageMgr.GetTranslation("MarryApplyReplyHandler.Title");
mail.Type = (int)eMailType.Marry;
db.SendMail(mail);
//Spouse.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
}
示例3: HandleCommand
public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE)
{
return false;
}
if(player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID )
{
return false;
}
int needMoney = GameProperties.PRICE_PROPOSE;
if(player.CurrentMarryRoom.Info.IsHymeneal)
{
if (player.PlayerCharacter.Money < needMoney)
{
player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough"));
return false;
}
}
GamePlayer Groom = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.GroomID);
if(Groom == null)
{
player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoGroom"));
return false;
}
GamePlayer Bride = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.BrideID);
if (Bride == null)
{
player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoBride"));
return false;
}
bool result = false;
bool isFirst = false;
GSPacketIn pkg = packet.Clone();
int hymenealState = packet.ReadInt();
if (1 == hymenealState)
{
player.CurrentMarryRoom.RoomState = eRoomState.FREE;
}
else
{
player.CurrentMarryRoom.RoomState = eRoomState.Hymeneal;
player.CurrentMarryRoom.BeginTimerForHymeneal(170 * 1000);
if (!player.PlayerCharacter.IsGotRing)
{
isFirst = true;
ItemTemplateInfo ringTemplate = ItemMgr.FindItemTemplate(9022);
ItemInfo ring1 = ItemInfo.CreateFromTemplate(ringTemplate, 1, (int)ItemAddType.webing);
ring1.IsBinds = true;
//Groom.CurrentInventory.AddItem(ring1, 11);
using (PlayerBussiness pb = new PlayerBussiness())
{
ring1.UserID = 0;
pb.AddGoods(ring1);
string content = LanguageMgr.GetTranslation("HymenealCommand.Content", Bride.PlayerCharacter.NickName);
MailInfo mail = new MailInfo();
mail.Annex1 = ring1.ItemID.ToString();
mail.Content = content;
mail.Gold = 0;
mail.IsExist = true;
mail.Money = 0;
mail.Receiver = Groom.PlayerCharacter.NickName;
mail.ReceiverID = Groom.PlayerCharacter.ID;
mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender");
mail.SenderID = 0;
mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title");
mail.Type = (int)eMailType.Marry;
if (pb.SendMail(mail))
{
result = true;
}
player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
}
ItemInfo ring2 = ItemInfo.CreateFromTemplate(ringTemplate, 1, (int)ItemAddType.webing);
ring2.IsBinds = true;
//Bride.CurrentInventory.AddItem(ring2, 11);
using (PlayerBussiness pb = new PlayerBussiness())
{
ring2.UserID = 0;
pb.AddGoods(ring2);
string content = LanguageMgr.GetTranslation("HymenealCommand.Content", Groom.PlayerCharacter.NickName);
MailInfo mail = new MailInfo();
mail.Annex1 = ring2.ItemID.ToString();
mail.Content = content;
mail.Gold = 0;
mail.IsExist = true;
mail.Money = 0;
//.........这里部分代码省略.........
示例4: 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;
//.........这里部分代码省略.........
示例5: HandlePacket
//.........这里部分代码省略.........
eMsg = eMessageType.ERROR;
msg = "UserBuyItemHandler.NoBuyItem";
return 1;
}
/////////////////////////////////////////////////////////////
if (gold <= client.Player.PlayerCharacter.Gold && money <= client.Player.PlayerCharacter.Money && offer <= client.Player.PlayerCharacter.Offer && gifttoken <= client.Player.PlayerCharacter.GiftToken)
{
types.Remove(types.Length - 1, 1);
client.Player.RemoveMoney(money);
client.Player.RemoveGold(gold);
client.Player.RemoveOffer(offer);
client.Player.RemoveGiftToken(gifttoken);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//从玩家背包中删除兑换所需要的物品
for (int j = 0; j < needitemsinfo.Count; j += 2)
{
client.Player.RemoveTemplate(needitemsinfo[j], needitemsinfo[j + 1]);
payGoods.Append(needitemsinfo[j].ToString() + ":");
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string itemIDs = "";
int annexIndex = 0;
MailInfo message = new MailInfo();
StringBuilder annexRemark = new StringBuilder();
annexRemark.Append(LanguageMgr.GetTranslation("GoodsPresentHandler.AnnexRemark"));
foreach (ItemInfo item in items)
{
itemIDs += (itemIDs == "" ? item.TemplateID.ToString() : "," + item.TemplateID.ToString());
item.UserID = 0;
db.AddGoods(item);
annexIndex++;
annexRemark.Append(annexIndex);
annexRemark.Append("、");
annexRemark.Append(item.Template.Name);
annexRemark.Append("x");
annexRemark.Append(item.Count);
annexRemark.Append(";");
switch (annexIndex)
{
case 1:
message.Annex1 = item.ItemID.ToString();
message.Annex1Name = item.Template.Name;
break;
case 2:
message.Annex2 = item.ItemID.ToString();
message.Annex2Name = item.Template.Name;
break;
case 3:
message.Annex3 = item.ItemID.ToString();
message.Annex3Name = item.Template.Name;
break;
case 4:
message.Annex4 = item.ItemID.ToString();
message.Annex4Name = item.Template.Name;
break;
case 5:
message.Annex5 = item.ItemID.ToString();
message.Annex5Name = item.Template.Name;
break;
}
示例6: HandlePacket
//.........这里部分代码省略.........
string itemIDs = "";
int annexIndex = 0;
MailInfo message = new MailInfo();
StringBuilder annexRemark = new StringBuilder();
annexRemark.Append(LanguageMgr.GetTranslation("GoodsPresentHandler.AnnexRemark"));
for (int i = 0; i < buyitems.Count; i++)
{
itemIDs += (itemIDs == "" ? buyitems[i].TemplateID.ToString() : "," + buyitems[i].TemplateID.ToString());
if (client.Player.AddTemplate(buyitems[i], buyitems[i].Template.BagType, buyitems[i].Count))
{
if (dresses[i] && buyitems[i].CanEquip())
{
int slot = client.Player.MainBag.FindItemEpuipSlot(buyitems[i].Template);
if ((slot == 9 || slot == 10) && (places[i] == 9 || places[i] == 10))
{
slot = places[i];
}
else if ((slot == 7 || slot == 8) && (places[i] == 7 || places[i] == 8))
{
slot = places[i];
}
client.Player.MainBag.MoveItem(buyitems[i].Place, slot, 0);
msg = "UserBuyItemHandler.Save";
}
}
else
{
using (PlayerBussiness db = new PlayerBussiness())
{
buyitems[i].UserID = 0;
db.AddGoods(buyitems[i]);
annexIndex++;
annexRemark.Append(annexIndex);
annexRemark.Append("、");
annexRemark.Append(buyitems[i].Template.Name);
annexRemark.Append("x");
annexRemark.Append(buyitems[i].Count);
annexRemark.Append(";");
switch (annexIndex)
{
case 1:
message.Annex1 = buyitems[i].ItemID.ToString();
message.Annex1Name = buyitems[i].Template.Name;
break;
case 2:
message.Annex2 = buyitems[i].ItemID.ToString();
message.Annex2Name = buyitems[i].Template.Name;
break;
case 3:
message.Annex3 = buyitems[i].ItemID.ToString();
message.Annex3Name = buyitems[i].Template.Name;
break;
case 4:
message.Annex4 = buyitems[i].ItemID.ToString();
message.Annex4Name = buyitems[i].Template.Name;
break;
case 5:
message.Annex5 = buyitems[i].ItemID.ToString();
message.Annex5Name = buyitems[i].Template.Name;
break;
}
示例7: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
int bagType = packet.ReadByte();
int place = packet.ReadInt();
PlayerInventory arkBag = client.Player.GetInventory((eBageType)bagType);
ItemInfo goods = arkBag.GetItemAt(place);
string full = "";
List<ItemInfo> infos = new List<ItemInfo>();
if (goods != null && goods.IsValidItem() &&
goods.Template.CategoryID == 11 &&
goods.Template.Property1 == 6 &&
client.Player.PlayerCharacter.Grade >= goods.Template.NeedLevel)
{
int money = 0;
int gold = 0;
int giftToken = 0;
int medal = 0;
int[] bags = new int[3];
OpenUpItem(goods.Template.Data, bags, infos, ref gold, ref money,ref giftToken, ref medal);
bags[goods.GetBagType()]--;
if (client.Player.RemoveTemplate(goods.TemplateID, 1)) //trminhpc
{
//格式如:你获得了 数量 点券,数量 金币,武器/装备/美容,数量 道具
StringBuilder notice = new StringBuilder();
int index = 0;
StringBuilder msg = new StringBuilder();
msg.Append(LanguageMgr.GetTranslation("OpenUpArkHandler.Start"));
if (money != 0)
{
msg.Append(money + LanguageMgr.GetTranslation("OpenUpArkHandler.Money"));
client.Player.AddMoney(money);
LogMgr.LogMoneyAdd(LogMoneyType.Box, LogMoneyType.Box_Open, client.Player.PlayerCharacter.ID, money, client.Player.PlayerCharacter.Money, gold, 0, 0,0, "", "", "");//添加日志
}
if (gold != 0)
{
msg.Append(gold + LanguageMgr.GetTranslation("OpenUpArkHandler.Gold"));
client.Player.AddGold(gold);
}
if (giftToken != 0)
{
msg.Append(giftToken + LanguageMgr.GetTranslation("OpenUpArkHandler.GiftToken"));
client.Player.AddGiftToken(giftToken);
}
if (medal != 0) //trminhpc
{
msg.Append(medal + LanguageMgr.GetTranslation("OpenUpArkHandler.Medal"));
client.Player.AddMedal(medal);
}
StringBuilder msga = new StringBuilder();
foreach (ItemInfo info in infos)
{
//IBag bag = client.Player.GetBag(info.GetBagType());
//bag.AddItem(info);
//msg.Append((info.GetBagType() == 0 ? "" : info.Count.ToString()) + " " + info.Template.Name + ",");
msga.Append(info.Template.Name + "x" + info.Count.ToString() + ",");
if ((info.Template.Quality >= goods.Template.Property2) & (goods.Template.Property2 != 0))
{
notice.Append(info.Template.Name + ",");
index++;
}
//msg.Append(info.Template.Name + "x" + info.Count.ToString() + ",");
if (!client.Player.AddTemplate(info, info.Template.BagType, info.Count))
{
using (PlayerBussiness db = new PlayerBussiness())
{
info.UserID = 0;
db.AddGoods(info);
MailInfo message = new MailInfo();
message.Annex1 = info.ItemID.ToString();
message.Content = LanguageMgr.GetTranslation("OpenUpArkHandler.Content1") + info.Template.Name + LanguageMgr.GetTranslation("OpenUpArkHandler.Content2");
message.Gold = 0;
message.Money = 0;
message.Receiver = client.Player.PlayerCharacter.NickName;
message.ReceiverID = client.Player.PlayerCharacter.ID;
message.Sender = message.Receiver;
message.SenderID = message.ReceiverID;
message.Title = LanguageMgr.GetTranslation("OpenUpArkHandler.Title") + info.Template.Name + "]";
message.Type = (int)eMailType.OpenUpArk;
db.SendMail(message);
full = LanguageMgr.GetTranslation("OpenUpArkHandler.Mail");
}
}
}
if (msga.Length > 0)
{
msga.Remove(msga.Length - 1, 1);
string[] msgstr = msga.ToString().Split(',');
for (int i = 0; i < msgstr.Length; i++)
{
int counts = 1; //统计重复数量
//先统计重复数量
//.........这里部分代码省略.........