本文整理汇总了C#中Bussiness.PlayerBussiness.SendMail方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerBussiness.SendMail方法的具体用法?C# PlayerBussiness.SendMail怎么用?C# PlayerBussiness.SendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bussiness.PlayerBussiness
的用法示例。
在下文中一共展示了PlayerBussiness.SendMail方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCommand
public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentHotSpringRoom != null)
{
int num = packet.ReadInt();
if (num <= 0)
{
return false;
}
if (player.PlayerCharacter.Money >= num)
{
player.RemoveMoney(num);
LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, "", "", "");
using (PlayerBussiness bussiness = new PlayerBussiness())
{
string translation = LanguageMgr.GetTranslation("LargessCommand.Content", new object[] { player.PlayerCharacter.NickName, num / 2 });
string str2 = LanguageMgr.GetTranslation("LargessCommand.Title", new object[] { player.PlayerCharacter.NickName });
MailInfo mail = new MailInfo {
Annex1 = "",
Content = translation,
Gold = 0,
IsExist = true,
Money = num / 2,
Receiver = player.CurrentHotSpringRoom.Info.playerName,
ReceiverID = player.CurrentHotSpringRoom.Info.playerID,
Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]),
SenderID = 0,
Title = str2,
Type = 14
};
bussiness.SendMail(mail);
player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
MailInfo info2 = new MailInfo {
Annex1 = "",
Content = translation,
Gold = 0,
IsExist = true,
Money = num / 2,
Receiver = player.CurrentHotSpringRoom.Info.GroomName,
ReceiverID = player.CurrentHotSpringRoom.Info.GroomID,
Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]),
SenderID = 0,
Title = str2,
Type = 14
};
bussiness.SendMail(info2);
player.Out.SendMailResponse(info2.ReceiverID, eMailRespose.Receiver);
}
player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed", new object[0]));
GSPacketIn @in = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", new object[] { player.PlayerCharacter.NickName, num }));
player.CurrentHotSpringRoom.SendToPlayerExceptSelf(@in, player);
return true;
}
player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0]));
}
return false;
}
示例2: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
//已经开始游戏则不处理
if (client.Player.CurrentRoom != null && client.Player.CurrentRoom.IsPlaying)
return 0;
int bagType = packet.ReadByte();
int index = packet.ReadInt();
PlayerInventory bag = client.Player.GetInventory((eBageType)bagType);
ItemInfo item = bag.GetItemAt(index);
if (item != null && !item.IsValidItem())
{
if (bagType == 0 && index < 11)
{
int place = bag.FindFirstEmptySlot(31);
if (place != -1)
{
bag.RemoveItem(item);
//bag.MoveItem(item.Place, place);
}
else
{
using (PlayerBussiness pb = new PlayerBussiness())
{
MailInfo mail = new MailInfo();
mail.Annex1 = item.ItemID.ToString();
mail.Content = LanguageMgr.GetTranslation("ItemOverdueHandler.Content");
mail.Gold = 0;
mail.IsExist = true;
mail.Money = 0;
mail.Receiver = client.Player.PlayerCharacter.NickName;
mail.ReceiverID = item.UserID;
mail.Sender = client.Player.PlayerCharacter.NickName;
mail.SenderID = item.UserID;
mail.Title = LanguageMgr.GetTranslation("ItemOverdueHandler.Title");
mail.Type = (int)eMailType.ItemOverdue;
if (pb.SendMail(mail))
{
//item.UserID = 0;
bag.RemoveItem(item);
}
}
}
}
else
{
bag.UpdateItem(item);
}
}
return 0;
}
示例3: LoadFromDatabase
/// <summary>
/// 从数据库中加载
/// </summary>
/// <param name="playerId"></param>
public void LoadFromDatabase(int playerId)
{
using (PlayerBussiness pb = new PlayerBussiness())
{
//ItemInfo[] list = pb.GetUserItem(playerId);
ItemInfo[] list = pb.GetUserBagByType(playerId, _bagType);
foreach (ItemInfo item in list)
{
_items[item.Place] = item;
}
for (int i = 0; i < 11; i++)
{
ItemInfo item = _items[i];
if (item == null)
continue;
if (!_items[i].IsValidItem())
{
UpdatePlayerProperties(item, false);
int place = base.FindFirstEmptySlot(11);
if (place != -1)
{
MoveItem(item.Place, place);
}
else
{
MailInfo mail = new MailInfo();
mail.Annex1 = item.ItemID.ToString();
mail.Content = "物品已过期!";
mail.Gold = 0;
mail.IsExist = true;
mail.Money = 0;
mail.Receiver = _player.PlayerCharacter.NickName;
mail.ReceiverID = item.UserID;
mail.Sender = _player.PlayerCharacter.NickName;
mail.SenderID = item.UserID;
mail.Title = "物品已过期!";
if (pb.SendMail(mail))
{
item.UserID = 0;
RemoveItem(item);
}
}
}
}
UpdatePlayerProperties();
}
}
示例4: SendItemToMail
/// <summary>
/// 发送物品到邮箱中
/// </summary>
/// <param name="item"></param>
/// <param name="pb"></param>
/// <returns></returns>
public bool SendItemToMail(ItemInfo item, PlayerBussiness pb, MailInfo mail)
{
if (m_saveToDb && item.BagType == BagType)
{
if (mail == null)
{
mail = new MailInfo();
mail.Annex1 = item.ItemID.ToString();
mail.Content = LanguageMgr.GetTranslation("Game.Server.GameUtils.Title");
mail.Gold = 0;
mail.IsExist = true;
mail.Money = 0;
mail.Receiver = m_player.PlayerCharacter.NickName;
mail.ReceiverID = item.UserID;
mail.Sender = m_player.PlayerCharacter.NickName;
mail.SenderID = item.UserID;
mail.Title = LanguageMgr.GetTranslation("Game.Server.GameUtils.Title");
mail.Type = (int)eMailType.ItemOverdue;
}
if (pb.SendMail(mail))
{
RemoveItem(item);
item.IsExist = true;
return true;
}
return false;
}
return false;
}
示例5: SendItemsToMail
public bool SendItemsToMail(List<ItemInfo> items, MailInfo mail,PlayerBussiness pb)
{
if (mail == null) return false;
if (items.Count > 5) return false;
if (m_saveToDb)
{
List<ItemInfo> sent = new List<ItemInfo>();
StringBuilder annexRemark = new StringBuilder();
annexRemark.Append(LanguageMgr.GetTranslation("Game.Server.GameUtils.CommonBag.AnnexRemark"));
if (items.Count > 0 && TakeOutItem(items[0]))
{
ItemInfo it = items[0];
mail.Annex1 = it.ItemID.ToString();
mail.Annex1Name = it.Template.Name;
annexRemark.Append("1、" + mail.Annex1Name + "x" + it.Count + ";");
sent.Add(it);
}
if (items.Count > 1 && TakeOutItem(items[1]))
{
ItemInfo it = items[1];
mail.Annex2 = it.ItemID.ToString();
mail.Annex2Name = it.Template.Name;
annexRemark.Append("2、" + mail.Annex2Name + "x" + it.Count + ";");
sent.Add(it);
}
if (items.Count > 2 && TakeOutItem(items[2]))
{
ItemInfo it = items[2];
mail.Annex3 = it.ItemID.ToString();
mail.Annex3Name = it.Template.Name;
annexRemark.Append("3、" + mail.Annex3Name + "x" + it.Count + ";");
sent.Add(it);
}
if (items.Count > 3 && TakeOutItem(items[3]))
{
ItemInfo it = items[3];
mail.Annex4 = it.ItemID.ToString();
mail.Annex4Name = it.Template.Name;
annexRemark.Append("4、" + mail.Annex4Name + "x" + it.Count + ";");
sent.Add(it);
}
if (items.Count > 4 && TakeOutItem(items[4]))
{
ItemInfo it = items[4];
mail.Annex5 = it.ItemID.ToString();
mail.Annex5Name = it.Template.Name;
annexRemark.Append("5、" + mail.Annex5Name + "x" + it.Count + ";");
sent.Add(it);
}
mail.AnnexRemark = annexRemark.ToString();
if (pb.SendMail(mail))
{
return true;
}
else
{
foreach (ItemInfo it in sent)
{
AddItem(it);
}
}
}
return false;
}
示例6: SendStoreToMail
public void SendStoreToMail()
{
if (_player.PlayerCharacter.ConsortiaID != 0)
return;
bool response = false;
int annexIndex = 0;
MailInfo message = new MailInfo();
StringBuilder annexRemark = new StringBuilder();
annexRemark.Append(LanguageMgr.GetTranslation("Game.Server.GameUtils.CommonBag.AnnexRemark"));
_player.SaveIntoDatabase();
using (PlayerBussiness db = new PlayerBussiness())
{
for (int i = 0; i < _count; i++)
{
ItemInfo item = m_items[i];
if (item == null)
continue;
RemoveItem(item);
response = true;
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;
}
if (annexIndex == 5)
{
annexIndex = 0;
message.AnnexRemark = annexRemark.ToString();
annexRemark.Remove(0, annexRemark.Length);
annexRemark.Append(LanguageMgr.GetTranslation("GoodsPresentHandler.AnnexRemark"));
message.Content = "";
message.Gold = 0;
message.Money = 0;
message.Receiver = _player.PlayerCharacter.NickName;
message.ReceiverID = _player.PlayerCharacter.ID;
message.Sender = LanguageMgr.GetTranslation("Game.Server.GameUtils.CommonBag.Sender");
message.SenderID = _player.PlayerCharacter.ID;
message.Title = message.Annex1Name; //message.AnnexRemark;// LanguageMgr.GetTranslation("Game.Server.GameUtils.CommonBag.Title");
message.Type = (int)eMailType.StoreCanel;
db.SendMail(message);
message.Revert();
}
}
if (annexIndex > 0)
{
message.AnnexRemark = annexRemark.ToString();
message.Content = "";
message.Gold = 0;
message.Money = 0;
message.Receiver = _player.PlayerCharacter.NickName;
message.ReceiverID = _player.PlayerCharacter.ID;
message.Sender = LanguageMgr.GetTranslation("Game.Server.GameUtils.CommonBag.Sender");
message.SenderID = _player.PlayerCharacter.ID;
message.Title = message.Annex1Name; //message.AnnexRemark;// LanguageMgr.GetTranslation("Game.Server.GameUtils.CommonBag.Title");
message.Type = (int)eMailType.StoreCanel;
db.SendMail(message);
}
}
_player.SaveIntoDatabase();
if (response)
{
_player.Out.SendMailResponse(_player.PlayerCharacter.ID, eMailRespose.Receiver);
}
}
示例7: 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;
//.........这里部分代码省略.........
示例8: HandlePacket
// <summary>
// 修改: Xiaov
// 时间: 2009-11-7
// 描述: 发送邮件<未测试>
public int HandlePacket(GameClient client, GSPacketIn packet)
{
if (client.Player.PlayerCharacter.Gold < 100)
return 1;
string msg = "UserSendMailHandler.Success";
eMessageType eMsg = eMessageType.Normal;
GSPacketIn pkg = packet.Clone();
pkg.ClearContext();
string nickName = packet.ReadString().Trim();
string title = packet.ReadString();
string content = packet.ReadString();
bool isPay = packet.ReadBoolean();
int validDate = packet.ReadInt();
int money = packet.ReadInt();
eBageType bag1 = (eBageType)packet.ReadByte();
int place1 = packet.ReadInt();
eBageType bag2 = (eBageType)packet.ReadByte();
int place2 = packet.ReadInt();
eBageType bag3 = (eBageType)packet.ReadByte();
int place3 = packet.ReadInt();
eBageType bag4 = (eBageType)packet.ReadByte();
int place4 = packet.ReadInt();
if ((money!=0||place1!=-1||place2!=-1||place3!=-1||place4!=-1)&&(client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked))
{
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
pkg.WriteBoolean(false);
client.Out.SendTCP(pkg);
return 1;
}
using (PlayerBussiness db = new PlayerBussiness())
{
PlayerInfo user;
GamePlayer player = Managers.WorldMgr.GetClientByPlayerNickName(nickName);
if (player == null)
{
user = db.GetUserSingleByNickName(nickName);
}
else
{
user = player.PlayerCharacter;
}
if (user != null && !string.IsNullOrEmpty(nickName))
{
if (user.NickName != client.Player.PlayerCharacter.NickName)
{
client.Player.SaveIntoDatabase();
//附件内容描述(例:邮件最后一行标注附件为:1、大喇叭x5;2、强化石4级x1;3、极•烈火x1;4、点券999999;5、强化公式-朱雀x5
MailInfo message = new MailInfo();
message.SenderID = client.Player.PlayerCharacter.ID;
message.Sender = client.Player.PlayerCharacter.NickName;
message.ReceiverID = user.ID;
message.Receiver = user.NickName;
message.IsExist = true;
message.Gold = 0;
message.Money = 0;
message.Title = title;
message.Content = content;
List<ItemInfo> items = new List<ItemInfo>();
List<eBageType> bagType = new List<eBageType>();
StringBuilder annexRemark = new StringBuilder();
annexRemark.Append(LanguageMgr.GetTranslation("UserSendMailHandler.AnnexRemark"));
int index = 0;
if (place1 != -1)
{
ItemInfo goods = client.Player.GetItemAt(bag1, place1);
if (goods != null && !goods.IsBinds)
{
message.Annex1Name = goods.Template.Name;
message.Annex1 = goods.ItemID.ToString();
items.Add(goods);
bagType.Add(bag1);
//annexRemark = message.Annex1Name + "x" + goods.Count;
index++;
annexRemark.Append(index);
annexRemark.Append("、");
//annexRemark.Append(annexRemark.Length);
annexRemark.Append(message.Annex1Name);
annexRemark.Append("x");
annexRemark.Append(goods.Count);
annexRemark.Append(";");
//goods.UserID = 0;
//client.Player.RemoveAllItem(goods, true, ItemRemoveType.Mail);
//.........这里部分代码省略.........
示例9: 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;
//.........这里部分代码省略.........
示例10: HandlePacket
//.........这里部分代码省略.........
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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;
}
if (annexIndex == 5)
{
annexIndex = 0;
message.AnnexRemark = annexRemark.ToString();
annexRemark.Remove(0, annexRemark.Length);
annexRemark.Append(LanguageMgr.GetTranslation("GoodsPresentHandler.AnnexRemark"));
message.Content = content;
message.Gold = 0;
message.Money = 0;
message.Receiver = receiver.NickName;
message.ReceiverID = receiver.ID;
message.Sender = client.Player.PlayerCharacter.NickName;
message.SenderID = client.Player.PlayerCharacter.ID;
message.Title = message.Sender + LanguageMgr.GetTranslation("GoodsPresentHandler.Content") + message.Annex1Name + "]";
message.Type = (int)eMailType.PresentItem;
db.SendMail(message);
message.Revert();
}
}
if (annexIndex > 0)
{
message.AnnexRemark = annexRemark.ToString();
message.Content = content;
message.Gold = 0;
message.Money = 0;
message.Receiver = receiver.NickName;
message.ReceiverID = receiver.ID;
message.Sender = client.Player.PlayerCharacter.NickName;
message.SenderID = client.Player.PlayerCharacter.ID;
message.Title = message.Sender + LanguageMgr.GetTranslation("GoodsPresentHandler.Content") + message.Annex1Name + "]";
message.Type = (int)eMailType.PresentItem;
db.SendMail(message);
}
LogMgr.LogMoneyAdd(LogMoneyType.Shop, LogMoneyType.Shop_Present, client.Player.PlayerCharacter.ID, money, client.Player.PlayerCharacter.Money, gold, gifttoken, offer, payGoods.ToString(), itemIDs, types.ToString());
client.Out.SendMailResponse(receiver.ID, eMailRespose.Receiver);
client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Send);
}
else
{
eMsg = eMessageType.ERROR;
msg = "GoodsPresentHandler.NoMoney";
}
}
else
{
eMsg = eMessageType.ERROR;
msg = "GoodsPresentHandler.NoUser";
}
}
client.Out.SendMessage(eMsg, LanguageMgr.GetTranslation(msg));
return 0;
}
示例11: HandleCommand
public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
{
if (player.CurrentHotSpringRoom == null /*|| player.CurrentHotSpringRoom.RoomState != eRoomState.FREE*/)
{
return false;
}
//if (player.PlayerCharacter.ID == player.CurrentHotSpringRoom.Info.GroomID || player.PlayerCharacter.ID == player.CurrentHotSpringRoom.Info.BrideID)
//{
// return false;
//}
int num = packet.ReadInt();
if (num > 0)
{
if (player.PlayerCharacter.Money >= num)
{
//player.SetMoney(-num, MoneyAddType.Marry);
player.RemoveMoney(num);
LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, "", "", "");
}
else
{
player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough"));
return false;
}
using (PlayerBussiness pb = new PlayerBussiness())
{
string content = LanguageMgr.GetTranslation("LargessCommand.Content",player.PlayerCharacter.NickName,num / 2);
string title = LanguageMgr.GetTranslation("LargessCommand.Title",player.PlayerCharacter.NickName);
MailInfo mail1 = new MailInfo();
mail1.Annex1 = "";
mail1.Content = content;
mail1.Gold = 0;
mail1.IsExist = true;
mail1.Money = num / 2;
mail1.Receiver = player.CurrentHotSpringRoom.Info.BrideName;
mail1.ReceiverID = player.CurrentHotSpringRoom.Info.BrideID;
mail1.Sender = LanguageMgr.GetTranslation("LargessCommand.Sender");
mail1.SenderID = 0;
mail1.Title = title;
mail1.Type = (int)eMailType.Marry;
pb.SendMail(mail1);
player.Out.SendMailResponse(mail1.ReceiverID, eMailRespose.Receiver);
MailInfo mail2 = new MailInfo();
mail2.Annex1 = "";
mail2.Content = content;
mail2.Gold = 0;
mail2.IsExist = true;
mail2.Money = num / 2;
mail2.Receiver = player.CurrentHotSpringRoom.Info.GroomName;
mail2.ReceiverID = player.CurrentHotSpringRoom.Info.GroomID;
mail2.Sender = LanguageMgr.GetTranslation("LargessCommand.Sender");
mail2.SenderID = 0;
mail2.Title = title;
mail2.Type = (int)eMailType.Marry;
pb.SendMail(mail2);
player.Out.SendMailResponse(mail2.ReceiverID, eMailRespose.Receiver);
}
player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed"));
GSPacketIn msg = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", player.PlayerCharacter.NickName, num));
player.CurrentHotSpringRoom.SendToPlayerExceptSelf(msg,player);
return true;
}
return false;
}
示例12: HandlePacket
//.........这里部分代码省略.........
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;
}
if (annexIndex == 5)
{
annexIndex = 0;
message.AnnexRemark = annexRemark.ToString();
annexRemark.Remove(0, annexRemark.Length);
annexRemark.Append(LanguageMgr.GetTranslation("GoodsPresentHandler.AnnexRemark"));
message.Content = LanguageMgr.GetTranslation("UserBuyItemHandler.Title") + message.Annex1Name + "]";
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 = message.Content;
message.Type = (int)eMailType.BuyItem;
db.SendMail(message);
eMsg = eMessageType.ERROR;
msg = "UserBuyItemHandler.Mail";
message.Revert();
}
}
}
}
if (annexIndex > 0)
{
using (PlayerBussiness db = new PlayerBussiness())
{
message.AnnexRemark = annexRemark.ToString();
message.Content = LanguageMgr.GetTranslation("UserBuyItemHandler.Title") + message.Annex1Name + "]";
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 = message.Content;
message.Type = (int)eMailType.BuyItem;
db.SendMail(message);
eMsg = eMessageType.ERROR;
msg = "UserBuyItemHandler.Mail";
}
}
if (eMsg == eMessageType.ERROR)
{
client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Receiver);
}
client.Player.OnPaid(money, gold, offer, gifttoken, medal, payGoods.ToString());//触发任务事件
LogMgr.LogMoneyAdd(LogMoneyType.Shop, LogMoneyType.Shop_Buy, client.Player.PlayerCharacter.ID, money, client.Player.PlayerCharacter.Money, gold, gifttoken, offer, medal, "牌子编号", itemIDs, types.ToString());
}
else
{
if (gold > client.Player.PlayerCharacter.Gold)
{
msg = "UserBuyItemHandler.NoGold";
}
if (offer > client.Player.PlayerCharacter.Offer)
{
msg = "UserBuyItemHandler.NoOffer";
}
if (gifttoken > client.Player.PlayerCharacter.GiftToken)
{
msg = "UserBuyItemHandler.GiftToken";
}
if (medal > client.Player.PlayerCharacter.medal)
{
msg = "UserBuyItemHandler.Medal";
}
eMsg = eMessageType.ERROR;
}
client.Out.SendMessage(eMsg, LanguageMgr.GetTranslation(msg));
return 0;
}
示例13: 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);
}
示例14: 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; //统计重复数量
//先统计重复数量
//.........这里部分代码省略.........