本文整理汇总了C#中Bussiness.PlayerBussiness.SavePlayerMarryNotice方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerBussiness.SavePlayerMarryNotice方法的具体用法?C# PlayerBussiness.SavePlayerMarryNotice怎么用?C# PlayerBussiness.SavePlayerMarryNotice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bussiness.PlayerBussiness
的用法示例。
在下文中一共展示了PlayerBussiness.SavePlayerMarryNotice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
bool result = packet.ReadBoolean();
int UserID = packet.ReadInt();
int AnswerId = packet.ReadInt(); //答复对话框ID
//先判断自已有没有结婚
if (result && client.Player.PlayerCharacter.IsMarried)
{
client.Player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg2"));
}
using (PlayerBussiness db = new PlayerBussiness())
{
PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID);
//发送好人卡
if (!result)
{
SendGoodManCard(tempSpouse.NickName, tempSpouse.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ID, db);
GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
}
//判断对方有没有结婚
if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
{
return 1;
}
if (tempSpouse.IsMarried)
{
client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg3"));
}
MarryApplyInfo info = new MarryApplyInfo();
info.UserID = UserID;
info.ApplyUserID = client.Player.PlayerCharacter.ID;
info.ApplyUserName = client.Player.PlayerCharacter.NickName;
info.ApplyType = 2;
info.LoveProclamation = "";
info.ApplyResult = result;
int id = 0;
if (db.SavePlayerMarryNotice(info, AnswerId, ref id))
{
if (result)
{
client.Player.Out.SendMarryApplyReply(client.Player, tempSpouse.ID, tempSpouse.NickName, result, false, id);
client.Player.LoadMarryProp();
SendSYSMessages(client.Player, tempSpouse);
}
GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
return 0;
}
}
return 1;
}
示例2: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
if (!client.Player.PlayerCharacter.IsMarried)
{
return 1;
}
if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
{
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
return 0;
}
if(client.Player.PlayerCharacter.IsCreatedMarryRoom)
{
client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg2"));
return 1;
}
int needMoney = GameProperties.PRICE_DIVORCED;
if (client.Player.PlayerCharacter.Money < needMoney)
{
client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1"));
return 1;
}
else
{
client.Player.RemoveMoney(needMoney);
LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Unmarry, client.Player.PlayerCharacter.ID, needMoney, client.Player.PlayerCharacter.Money, 0, 0, 0,0, "", "", "");
CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Divorce);
using (PlayerBussiness db = new PlayerBussiness())
{
PlayerInfo tempSpouse = db.GetUserSingleByUserID(client.Player.PlayerCharacter.SpouseID);
if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
{
return 1;
}
MarryApplyInfo info = new MarryApplyInfo();
info.UserID = client.Player.PlayerCharacter.SpouseID;
info.ApplyUserID = client.Player.PlayerCharacter.ID;
info.ApplyUserName = client.Player.PlayerCharacter.NickName;
info.ApplyType = 3;
info.LoveProclamation = "";
info.ApplyResult = false;
int id = 0;
if (db.SavePlayerMarryNotice(info,0, ref id))
{
GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
client.Player.LoadMarryProp();
}
}
client.Player.QuestInventory.ClearMarryQuest(); //离婚后清除结婚后任务.
client.Player.Out.SendPlayerDivorceApply(client.Player, true,true);
client.Player.SendMessage(LanguageMgr.GetTranslation("DivorceApplyHandler.Msg3"));
}
return 0;
}
示例3: HandlePacket
public int HandlePacket(GameClient client, GSPacketIn packet)
{
//判断是否结婚
if(client.Player.PlayerCharacter.IsMarried)
{
return 1;
}
//是否有二级密码
if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
{
client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
return 1;
}
//开始求婚,购买戒指
int SpouseID = packet.ReadInt();
string loveProclamation = packet.ReadString();
bool Broadcast = packet.ReadBoolean();
bool result = false;
bool removeRing = true;
string SpouseName = "";
using (PlayerBussiness db = new PlayerBussiness())
{
PlayerInfo tempSpouse = db.GetUserSingleByUserID(SpouseID);
if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
{
return 1;
}
if (tempSpouse.IsMarried)
{
client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg2"));
return 1;
}
ItemInfo WeddingRing = client.Player.PropBag.GetItemByTemplateID(0,11103);
if (WeddingRing == null)
{
ShopItemInfo tempRing = ShopMgr.FindShopbyTemplatID(11103).FirstOrDefault();
if (tempRing != null)
{
//玩家身上钱是否足够。
if (client.Player.PlayerCharacter.Money >= tempRing.AValue1)
{
removeRing = false;
}
else
{
client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1"));
return 1;
}
}
else
{
client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg6"));
return 1;
}
}
//插入结婚消息
MarryApplyInfo info = new MarryApplyInfo();
info.UserID = SpouseID;
info.ApplyUserID = client.Player.PlayerCharacter.ID;
info.ApplyUserName = client.Player.PlayerCharacter.NickName;
info.ApplyType = 1;
info.LoveProclamation = loveProclamation;
info.ApplyResult = false;
int id=0;
if (db.SavePlayerMarryNotice(info,0,ref id))
{
if (removeRing)
{
client.Player.RemoveItem(WeddingRing);
}
else
{
//未开始
ShopItemInfo tempRing = ShopMgr.FindShopbyTemplatID(11103).FirstOrDefault();
client.Player.RemoveMoney(tempRing.AValue1);
LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Spark, client.Player.PlayerCharacter.ID, tempRing.AValue1, client.Player.PlayerCharacter.Money, 0, 0, 0, "", tempRing.TemplateID.ToString(), "1");
}
client.Player.Out.SendPlayerMarryApply(client.Player, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, loveProclamation,id); //发送求婚信息
//发送消息给中心服务器
GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(SpouseID);
SpouseName = tempSpouse.NickName;
result = true;
client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg3"));
}
}
if (result && Broadcast && SpouseName != "")
{
string msg = LanguageMgr.GetTranslation("MarryApplyHandler.Msg5", client.Player.PlayerCharacter.NickName, SpouseName);
GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
pkg.WriteInt(2);
pkg.WriteString(msg);
GameServer.Instance.LoginServer.SendPacket(pkg);
GamePlayer[] players = WorldMgr.GetAllPlayers();
foreach (GamePlayer p in players)
{
p.Out.SendTCP(pkg);
}
}
//.........这里部分代码省略.........