gift to chars work
This commit is contained in:
parent
d0e91fdc78
commit
6a39a2960e
@ -46,6 +46,7 @@ namespace Campofinale.Game.Spaceship
|
||||
IsWorking = isWorking,
|
||||
PhysicalStrength = physicalStrength,
|
||||
StationedRoomId = stationedRoomId,
|
||||
|
||||
Skills =
|
||||
{
|
||||
new ScdSpaceshipCharSkill()
|
||||
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||
using MongoDB.Bson.Serialization.IdGenerators;
|
||||
using static Campofinale.Resource.ResourceManager;
|
||||
using Campofinale.Resource;
|
||||
using Campofinale.Resource.Table;
|
||||
|
||||
namespace Campofinale.Game.Spaceship
|
||||
{
|
||||
@ -84,6 +85,39 @@ namespace Campofinale.Game.Spaceship
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GiftToChar(CsSpaceshipPresentGiftToChar req)
|
||||
{
|
||||
SpaceshipChar chara = GetChar(req.CharId);
|
||||
if (chara != null)
|
||||
{
|
||||
foreach (var item in req.Gifts)
|
||||
{
|
||||
GiftItemTable giftItem = ResourceManager.giftItemTable[item.Id];
|
||||
chara.favorability += giftItem.favorablePoint * item.Count;
|
||||
//TODO item consume
|
||||
}
|
||||
ScSpaceshipPresentGiftToChar confirm = new()
|
||||
{
|
||||
CurFav = chara.favorability,
|
||||
CharId = chara.id,
|
||||
RecvGiftCnt = req.Gifts.Count,
|
||||
};
|
||||
//TODO packet class
|
||||
/*ScSpaceshipCharFavorabilityChange change = new()
|
||||
{
|
||||
ChangeInfos =
|
||||
{
|
||||
new SpaceshipCharFavorabilityChangeInfo()
|
||||
{
|
||||
CharId = chara.id,
|
||||
CurFav=chara.favorability,
|
||||
}
|
||||
}
|
||||
};*/
|
||||
owner.Send(Protocol.ScMsgId.ScSpaceshipPresentGiftToChar, confirm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,7 +241,7 @@ namespace Campofinale.Packets.Cs
|
||||
session.Send(new PacketScSpaceshipSync(session));
|
||||
session.Send(new PacketScSyncFullDungeonStatus(session));
|
||||
session.Send(new PacketScActivitySync(session));
|
||||
|
||||
session.Send(new PacketScSnsGetChatList(session));
|
||||
session.Send(ScMsgId.ScSyncFullDataEnd, new ScSyncFullDataEnd());
|
||||
session.EnterScene();
|
||||
session.Initialized = true;
|
||||
|
28
Campofinale/Packets/Cs/HandleCsSpaceshipPresentGiftToChar.cs
Normal file
28
Campofinale/Packets/Cs/HandleCsSpaceshipPresentGiftToChar.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Campofinale.Network;
|
||||
using Campofinale.Packets.Sc;
|
||||
using Campofinale.Protocol;
|
||||
using Google.Protobuf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Campofinale.Packets.Cs
|
||||
{
|
||||
public class HandleCsSpaceshipPresentGiftToChar
|
||||
{
|
||||
|
||||
[Server.Handler(CsMsgId.CsSpaceshipPresentGiftToChar)]
|
||||
public static void Handle(Player session, CsMsgId cmdId, Packet packet)
|
||||
{
|
||||
CsSpaceshipPresentGiftToChar req = packet.DecodeBody<CsSpaceshipPresentGiftToChar>();
|
||||
session.spaceshipManager.GiftToChar(req);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
33
Campofinale/Packets/Sc/PacketScSnsGetChatList.cs
Normal file
33
Campofinale/Packets/Sc/PacketScSnsGetChatList.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Campofinale.Network;
|
||||
using Campofinale.Protocol;
|
||||
using Campofinale.Resource;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Campofinale.Packets.Sc
|
||||
{
|
||||
public class PacketScSnsGetChatList : Packet
|
||||
{
|
||||
public PacketScSnsGetChatList(Player player) {
|
||||
ScSnsGetChatList proto = new ScSnsGetChatList() {
|
||||
|
||||
};
|
||||
foreach (var chat in ResourceManager.snsChatTable)
|
||||
{
|
||||
var chatInfo = new SnsChatInfo()
|
||||
{
|
||||
ChatId = chat.Value.chatId,
|
||||
ChatType = chat.Value.chatType,
|
||||
Timestamp = DateTime.UtcNow.ToUnixTimestampMilliseconds(),
|
||||
|
||||
};
|
||||
proto.ChatList.Add(chatInfo);
|
||||
}
|
||||
SetData(ScMsgId.ScSnsGetChatList, proto);
|
||||
}
|
||||
}
|
||||
}
|
@ -68,6 +68,8 @@ namespace Campofinale.Resource
|
||||
public static Dictionary<string, FacSTTNodeTable> facSTTNodeTable = new();
|
||||
public static Dictionary<string, FacSTTLayerTable> facSTTLayerTable = new();
|
||||
public static Dictionary<int, ItemTypeTable> itemTypeTable = new(); //
|
||||
public static Dictionary<string, SNSChatTable> snsChatTable = new();//
|
||||
public static Dictionary<string, GiftItemTable> giftItemTable = new();
|
||||
public static InteractiveTable interactiveTable = new(); //
|
||||
public static List<LevelScene> levelDatas = new();
|
||||
public static List<InteractiveData> interactiveData = new();
|
||||
|
15
Campofinale/Resource/Table/GiftItemTable.cs
Normal file
15
Campofinale/Resource/Table/GiftItemTable.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Campofinale.Resource.Table
|
||||
{
|
||||
[TableCfgType("TableCfg/GiftItemTable.json", LoadPriority.LOW)]
|
||||
public class GiftItemTable
|
||||
{
|
||||
public int favorablePoint;
|
||||
public string id;
|
||||
}
|
||||
}
|
16
Campofinale/Resource/Table/SNSChatTable.cs
Normal file
16
Campofinale/Resource/Table/SNSChatTable.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Campofinale.Resource.Table
|
||||
{
|
||||
[TableCfgType("TableCfg/SNSChatTable.json", LoadPriority.LOW)]
|
||||
public class SNSChatTable
|
||||
{
|
||||
public string chatId;
|
||||
public int chatType;
|
||||
public int tagType;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user