초기커밋
This commit is contained in:
1848
GameServer/Entity/Inventory/Base/Action/InventoryActionBase.cs
Normal file
1848
GameServer/Entity/Inventory/Base/Action/InventoryActionBase.cs
Normal file
File diff suppressed because it is too large
Load Diff
1173
GameServer/Entity/Inventory/Base/BagInven.cs
Normal file
1173
GameServer/Entity/Inventory/Base/BagInven.cs
Normal file
File diff suppressed because it is too large
Load Diff
40
GameServer/Entity/Inventory/Base/ClothEquipInven.cs
Normal file
40
GameServer/Entity/Inventory/Base/ClothEquipInven.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_META_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
|
||||
|
||||
public class ClothEquipInven : InventoryBase<ClothSlotType>
|
||||
{
|
||||
public ClothEquipInven(EntityBase parent)
|
||||
: base(EntityType.ClothEquipInven, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string toSummaryString()
|
||||
{
|
||||
return $"{this.getTypeName()}";
|
||||
}
|
||||
}
|
||||
}
|
||||
40
GameServer/Entity/Inventory/Base/TattooEquipInven.cs
Normal file
40
GameServer/Entity/Inventory/Base/TattooEquipInven.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_META_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class TattooEquipInven : InventoryBase<TattooSlotType>
|
||||
{
|
||||
private readonly ConcurrentDictionary<string/*TattooSlotType*/, bool> m_slot_visibles = new();
|
||||
|
||||
public TattooEquipInven(EntityBase parent)
|
||||
: base(EntityType.TattooEquipInven, parent)
|
||||
{
|
||||
}
|
||||
|
||||
public override string toSummaryString()
|
||||
{
|
||||
return $"{this.getTypeName()}";
|
||||
}
|
||||
}
|
||||
}
|
||||
40
GameServer/Entity/Inventory/Base/ToolEquipInven.cs
Normal file
40
GameServer/Entity/Inventory/Base/ToolEquipInven.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_META_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class ToolEquipInven : InventoryBase<ToolSlotType>
|
||||
{
|
||||
public ToolEquipInven(EntityBase parent)
|
||||
: base(EntityType.ToolEquipInven, parent)
|
||||
{
|
||||
}
|
||||
|
||||
public override string toSummaryString()
|
||||
{
|
||||
return $"{this.getTypeName()}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using Google.Protobuf;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
internal class MyhomeInventoryAction : InventoryActionBase
|
||||
{
|
||||
public MyhomeInventoryAction(Myhome owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
var result = new Result();
|
||||
|
||||
var owner = getOwner() as Myhome;
|
||||
ArgumentNullException.ThrowIfNull(owner, $"owner is null !!!");
|
||||
|
||||
result = await getBagInven().onInit();
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void onClear()
|
||||
{
|
||||
var owner = getOwner();
|
||||
ArgumentNullException.ThrowIfNull(owner, $"owner is null !!!");
|
||||
|
||||
var bag_inven = getBagInven();
|
||||
ArgumentNullException.ThrowIfNull(bag_inven, $"bag_inven is null !!! - {owner.toBasicString()}");
|
||||
var has_items = bag_inven.getHasItemBases();
|
||||
ArgumentNullException.ThrowIfNull(has_items, $"has_items is null !!! - {owner.toBasicString()}");
|
||||
|
||||
has_items.Clear();
|
||||
}
|
||||
|
||||
public override Item onAllocItem()
|
||||
{
|
||||
var owner = getOwner() as Myhome;
|
||||
ArgumentNullException.ThrowIfNull(owner, $"owner is null !!!");
|
||||
|
||||
return new MyhomeItem(owner);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using SESSION_ID = System.Int32;
|
||||
using WORLD_META_ID = System.UInt32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class UgcNpcInventoryAction : InventoryActionBase
|
||||
{
|
||||
public UgcNpcInventoryAction(UgcNpc owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var ugc_npc = getOwner() as UgcNpc;
|
||||
NullReferenceCheckHelper.throwIfNull(ugc_npc, () => $"ugc_npc is null !!!");
|
||||
|
||||
var result = new Result();
|
||||
|
||||
result = await getBagInven().onInit();
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
getEquipInvens().TryAdd(InvenEquipType.Cloth, new ClothEquipInven(ugc_npc));
|
||||
getEquipInvens().TryAdd(InvenEquipType.Tattoo, new TattooEquipInven(ugc_npc));
|
||||
|
||||
var equip_inven_initializers = new Initializers();
|
||||
foreach (var each in getEquipInvens())
|
||||
{
|
||||
equip_inven_initializers.appendInitializer(each.Value as IInitializer);
|
||||
}
|
||||
result = await equip_inven_initializers.init("UgcNpc EquipInvens");
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void onClear()
|
||||
{
|
||||
var owner = getOwner();
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => $"owner is null !!!");
|
||||
|
||||
// 삭제할 가방 인벤토리내의 아이템 목록을 초기화 한다.
|
||||
var bag_inven = getBagInven();
|
||||
NullReferenceCheckHelper.throwIfNull(bag_inven, () => $"bag_inven is null !!! - {owner.toBasicString()}");
|
||||
|
||||
bag_inven.clearItemAll();
|
||||
// 가방 인벤토리내의 Tab별 개수 정보 초기화 한다.
|
||||
bag_inven.resetItemCountInTabs();
|
||||
|
||||
// 삭제할 장착 인벤토리내의 아이템 목록을 초기화 한다.
|
||||
var to_clear_equip_invens = new List<InvenEquipType>() {
|
||||
InvenEquipType.Cloth
|
||||
, InvenEquipType.Tattoo
|
||||
};
|
||||
foreach (var inven_equip_type in to_clear_equip_invens)
|
||||
{
|
||||
if (true == getEquipInvens().TryGetValue(inven_equip_type, out var found_equip_inven))
|
||||
{
|
||||
var tool_equip_inven = found_equip_inven as IWithInventoryAccessor;
|
||||
NullReferenceCheckHelper.throwIfNull(tool_equip_inven, () => $"tool_equip_inven is null !!! - {owner.toBasicString()}");
|
||||
|
||||
tool_equip_inven.clearItemAll();
|
||||
}
|
||||
}
|
||||
|
||||
// 능력치 속성 정보들도 초기화 한다.
|
||||
var ability_action = owner.getEntityAction<AbilityAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(ability_action, () => $"ability_action is null !!! - {owner.toBasicString()}" );
|
||||
|
||||
ability_action.clearAbility();
|
||||
}
|
||||
|
||||
public override Item onAllocItem()
|
||||
{
|
||||
var ugc_npc = getOwner() as UgcNpc;
|
||||
NullReferenceCheckHelper.throwIfNull(ugc_npc, () => $"ugc_npc is null !!!");
|
||||
|
||||
return new UgcNpcItem(ugc_npc);
|
||||
}
|
||||
|
||||
public Dictionary<ITEM_GUID, global::Item> toItemAll4Client()
|
||||
{
|
||||
var ugc_npc = getOwner() as UgcNpc;
|
||||
NullReferenceCheckHelper.throwIfNull(ugc_npc, () => $"ugc_npc is null !!!");
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
|
||||
var inventory_rule = server_logic.findRule<InventoryRule>();
|
||||
NullReferenceCheckHelper.throwIfNull(inventory_rule, () => $"inventory_rule is null !!! - {ugc_npc.toBasicString()}");
|
||||
|
||||
var bag_inven = getBagInven();
|
||||
NullReferenceCheckHelper.throwIfNull(bag_inven, () => $"bag_inven is null !!! - {ugc_npc.toBasicString()}");
|
||||
|
||||
var items = new Dictionary<ITEM_GUID, global::Item>();
|
||||
|
||||
var has_items = bag_inven.getHasItemBases();
|
||||
|
||||
foreach (var item in has_items)
|
||||
{
|
||||
var item_ui = item.toItemData4Client();
|
||||
NullReferenceCheckHelper.throwIfNull(item_ui, () => $"item_ui is null !!! - {ugc_npc.toBasicString()}");
|
||||
var item_meta = item.getItemMeta();
|
||||
NullReferenceCheckHelper.throwIfNull(item_meta, () => $"item_meta is null !!! - {ugc_npc.toBasicString()}");
|
||||
|
||||
if(false == items.TryAdd(item_ui.ItemGuid, item_ui))
|
||||
{
|
||||
var err_msg = $"Already added Item !!! : itemGuid:{item_ui.ItemGuid}, itemMetaId:{item_meta.ItemId} - {ugc_npc.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public Dictionary<Int32, global::TattooSlotInfo> toTattooAll4Client()
|
||||
{
|
||||
var ugc_npc = getOwner() as UgcNpc;
|
||||
NullReferenceCheckHelper.throwIfNull(ugc_npc, () => $"ugc_npc is null !!!");
|
||||
|
||||
var item_tattoo_action = ugc_npc.getEntityAction<ItemTattooAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(item_tattoo_action, () => $"item_tattoo_action is null !!! - {ugc_npc.toBasicString()}");
|
||||
|
||||
var tattoo_slots = new Dictionary<Int32, global::TattooSlotInfo>();
|
||||
|
||||
var inven_tattoo = getEquipInvens()[InvenEquipType.Tattoo] as TattooEquipInven;
|
||||
NullReferenceCheckHelper.throwIfNull(inven_tattoo, () => $"inven_tattoo is null !!! - {ugc_npc.toBasicString()}");
|
||||
|
||||
var custom_defined_ui_action = ugc_npc.getEntityAction<CustomDefinedUiAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(custom_defined_ui_action, () => $"custom_defined_ui_action is null !!! - {ugc_npc.toBasicString()}");
|
||||
|
||||
var tattoo_slot_types = InvenEquipType.Tattoo.toEquipableTattooSlotTypes(ugc_npc.getEntityType());
|
||||
foreach (var tattoo_slot_type in tattoo_slot_types)
|
||||
{
|
||||
var tattoo_slot = new TattooSlotInfo();
|
||||
tattoo_slot.ItemInfo = new();
|
||||
if (false == custom_defined_ui_action.getTattooVisible(tattoo_slot_type, out var found_visible))
|
||||
{
|
||||
found_visible = true;
|
||||
}
|
||||
tattoo_slot.IsVisible = found_visible == true ? 1 : 0;
|
||||
|
||||
if(false == tattoo_slots.TryAdd((Int32)tattoo_slot_type, tattoo_slot))
|
||||
{
|
||||
var err_msg = $"Already added Tattoo Item !!! : tattooSlotType:{tattoo_slot_type} - {ugc_npc.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
var found_tattoo = inven_tattoo.getData().findEntityBaseInSlotType(tattoo_slot_type) as Item;
|
||||
if (null == found_tattoo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
item_tattoo_action.fillupTattooSlotInfo(tattoo_slot_type, found_tattoo, ref tattoo_slot);
|
||||
}
|
||||
|
||||
return tattoo_slots;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
GameServer/Entity/Inventory/Owner/User/UserInventoryAction.cs
Normal file
103
GameServer/Entity/Inventory/Owner/User/UserInventoryAction.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Amazon.S3.Model;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class UserInventoryAction : InventoryActionBase
|
||||
{
|
||||
public UserInventoryAction(Player owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var result = new Result();
|
||||
|
||||
var owner = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => $"owner is null !!!");
|
||||
|
||||
result = await getBagInven().onInit();
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
getEquipInvens().TryAdd(InvenEquipType.Tool, new ToolEquipInven(owner));
|
||||
getEquipInvens().TryAdd(InvenEquipType.Cloth, new ClothEquipInven(owner));
|
||||
getEquipInvens().TryAdd(InvenEquipType.Tattoo, new TattooEquipInven(owner));
|
||||
|
||||
var equip_inven_initializers = new Initializers();
|
||||
foreach (var each in getEquipInvens())
|
||||
{
|
||||
equip_inven_initializers.appendInitializer(each.Value as IInitializer);
|
||||
}
|
||||
result = await equip_inven_initializers.init("User EquipInvens");
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void onClear()
|
||||
{
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
|
||||
// 삭제할 가방 인벤토리내의 아이템 목록을 초기화 한다.
|
||||
var bag_inven = getBagInven();
|
||||
NullReferenceCheckHelper.throwIfNull(bag_inven, () => $"bag_inven is null !!! - {player.toBasicString()}");
|
||||
|
||||
bag_inven.clearItemAll();
|
||||
// 가방 인벤토리내의 Tab별 개수 정보 초기화 한다.
|
||||
bag_inven.resetItemCountInTabs();
|
||||
|
||||
// 삭제할 장착 인벤토리내의 아이템 목록을 초기화 한다.
|
||||
var to_clear_equip_invens = new List<InvenEquipType>() {
|
||||
InvenEquipType.Tool
|
||||
, InvenEquipType.Cloth
|
||||
, InvenEquipType.Tattoo
|
||||
};
|
||||
foreach(var inven_equip_type in to_clear_equip_invens)
|
||||
{
|
||||
if (true == getEquipInvens().TryGetValue(inven_equip_type, out var found_equip_inven))
|
||||
{
|
||||
var tool_equip_inven = found_equip_inven as IWithInventoryAccessor;
|
||||
NullReferenceCheckHelper.throwIfNull(tool_equip_inven, () => $"tool_equip_inven is null !!! - {player.toBasicString()}");
|
||||
|
||||
tool_equip_inven.clearItemAll();
|
||||
}
|
||||
}
|
||||
|
||||
// 능력치 속성 정보들도 초기화 한다.
|
||||
var ability_action = player.getEntityAction<AbilityAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(ability_action, () => $"ability_action is null !!! - {player.toBasicString()}");
|
||||
|
||||
ability_action.clearAbility();
|
||||
}
|
||||
|
||||
public override Item onAllocItem()
|
||||
{
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
|
||||
return new UserItem(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user