本文整理汇总了C#中Bussiness.PlayerBussiness.AddAuction方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerBussiness.AddAuction方法的具体用法?C# PlayerBussiness.AddAuction怎么用?C# PlayerBussiness.AddAuction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bussiness.PlayerBussiness
的用法示例。
在下文中一共展示了PlayerBussiness.AddAuction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
eBageType bagType = (eBageType)packet.ReadByte();
int place = packet.ReadInt();
int payType = packet.ReadByte();
int price = packet.ReadInt();
int mouthful = packet.ReadInt();
int validDate = packet.ReadInt();
string msg = "AuctionAddHandler.Fail";
payType = 1;
if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
{
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
return 0;
}
if (price < 0 || (mouthful != 0 && mouthful < price))
return 0;
int multiple = 1;
if (payType != 0)
{
//multiple = 10;
multiple = 1;
payType = 1;
}
int needGold = (int)(multiple * price * 0.03 * (validDate == 0 ? 1 : validDate == 1 ? 3 : 6));
needGold = needGold < 1 ? 1 : needGold;
ItemInfo goods = client.Player.GetItemAt(bagType, place);
if (price < 0)
{
msg = "AuctionAddHandler.Msg1";
}
else if (mouthful != 0 && mouthful < price)
{
msg = "AuctionAddHandler.Msg2";
}
else if (needGold > client.Player.PlayerCharacter.Gold)
{
msg = "AuctionAddHandler.Msg3";
}
else if (goods == null)
{
msg = "AuctionAddHandler.Msg4";
}
else if (goods.IsBinds)
{
msg = "AuctionAddHandler.Msg5";
}
else
{
client.Player.SaveIntoDatabase();
AuctionInfo info = new AuctionInfo();
info.AuctioneerID = client.Player.PlayerCharacter.ID;//获取物品ID
info.AuctioneerName = client.Player.PlayerCharacter.NickName;//获取物品妮称
info.BeginDate = DateTime.Now;
info.BuyerID = 0;
info.BuyerName = "";
info.IsExist = true;
info.ItemID = goods.ItemID;
info.Mouthful = mouthful;
info.PayType = payType;
info.Price = price;
info.Rise = price / 10;
info.Rise = info.Rise < 1 ? 1 : info.Rise;
info.Name = goods.Template.Name;
info.Category = goods.Template.CategoryID;
info.ValidDate = validDate == 0 ? 8 : validDate == 1 ? 24 : 48;
info.TemplateID = goods.TemplateID;
info.Random = Bussiness.ThreadSafeRandom.NextStatic(GameProperties.BeginAuction, GameProperties.EndAuction);
using (PlayerBussiness db = new PlayerBussiness())//写数据库
{
if (db.AddAuction(info))
{
//client.Player.RemoveAllItem(goods, true, Game.Server.Statics.ItemRemoveType.Auction, bagType);
//client.Player.up
//client.Player.SaveIntoDatabase();
//client.Player.SetGold(-needGold, Game.Server.Statics.GoldRemoveType.Auction);
//msg = "AuctionAddHandler.Msg6";
//client.Out.SendAuctionRefresh(info, info.AuctionID, true, goods);
client.Player.RemoveItem(goods);
goods.IsExist = true;
client.Player.SaveIntoDatabase();
client.Player.RemoveGold(needGold);
msg = "AuctionAddHandler.Msg6";
client.Out.SendAuctionRefresh(info, info.AuctionID, true, goods);
}
}
}
//client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Receiver);
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation(msg));
return 0;
//.........这里部分代码省略.........