Merge branch 'develop' into feature/add-vfx

# Conflicts:
#	Assets/PerfectWorld/Prefab/GameController.prefab
#	Assets/PerfectWorld/Scripts/Managers/EC_ManPlayer.cs
#	Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs
#	Assets/Scripts/CECGameRun.cs
#	Assets/Scripts/CECHostPlayer.cs
#	Assets/Scripts/PlayerVisual.cs
This commit is contained in:
NguyenVanDat
2025-11-12 11:03:25 +07:00
84 changed files with 5388 additions and 1605 deletions
+13
View File
@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/.idea.perfect-world-unity.iml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
@@ -9,8 +9,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2780428059708698453}
- component: {fileID: 4062305846887961480}
- component: {fileID: 1890210201668811196}
- component: {fileID: 6919949516443544071}
m_Layer: 0
m_Name: GameController
m_TagString: Untagged
@@ -33,27 +33,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4062305846887961480
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6950113420985123515}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 839d10a1a7b2c4a44a99e77558b12d02, type: 3}
m_Name:
m_EditorClassIdentifier:
characterPrefab: {fileID: 6513559496054861882, guid: 1f80fef119a826b4a826baf52a8f92d7, type: 3}
monsterPrefab: {fileID: 2542060226037108388, guid: 244942d3fb9382846b82581ce24fbf4e, type: 3}
npcServerPrefab: {fileID: -5899287755522118344, guid: 9bd42cdc18b3d624db35707155fc50de, type: 3}
cinemachineCamera: {fileID: 0}
_testVfxPrefab: {fileID: 2282869967233380084, guid: 88e840e5dac12ed4383d994c7fadfef1, type: 3}
SelectingVfxPrefab: {fileID: 6894650530511576330, guid: 412301bece3ebe640b2da0e18c5f4028, type: 3}
freeLookCam: {fileID: 0}
rotateSpeedX: 300
rotateSpeedY: 2
--- !u!114 &1890210201668811196
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -70,3 +49,23 @@ MonoBehaviour:
uiPrefabs: []
npsUI: {fileID: 0}
currentTargetNPCID: 0
--- !u!114 &6919949516443544071
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6950113420985123515}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5de219a5b9756ae4ebf01e2919b92cde, type: 3}
m_Name:
m_EditorClassIdentifier:
characterPrefab: {fileID: 6513559496054861882, guid: 1f80fef119a826b4a826baf52a8f92d7, type: 3}
monsterPrefab: {fileID: 2542060226037108388, guid: 244942d3fb9382846b82581ce24fbf4e, type: 3}
npcServerPrefab: {fileID: -5899287755522118344, guid: 9bd42cdc18b3d624db35707155fc50de, type: 3}
cinemachineCamera: {fileID: 0}
_testVfxPrefab: {fileID: 0}
freeLookCam: {fileID: 0}
rotateSpeedX: 300
rotateSpeedY: 2
@@ -12,6 +12,7 @@ namespace BrewMonster
private void Awake()
{
Initialize();
SkillStubs.Init();
DontDestroyOnLoad(gameObject);
}
@@ -600,13 +600,11 @@ namespace ModelRenderer.Scripts.GameData
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_SUB_TYPE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
foreach (var item in npc_essence_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_NPC_ESSENCE);
add_id_data(ID_SPACE.ID_SPACE_ESSENCE, item.id, item);
}
foreach (var item in weapon_essence_array)
{
add_id_index(ID_SPACE.ID_SPACE_ESSENCE, item.id, DATA_TYPE.DT_WEAPON_ESSENCE);
@@ -1519,7 +1517,16 @@ namespace ModelRenderer.Scripts.GameData
return 0;
}
public T GetDataTypeMap<T>(ID_SPACE type) where T : class
{
object result = type switch
{
ID_SPACE.ID_SPACE_ESSENCE => essence_id_data_type_map,
_ => null
};
return result as T;
}
void add_id_data(ID_SPACE idSpace, uint id, object data)
{
@@ -1641,7 +1648,42 @@ namespace ModelRenderer.Scripts.GameData
}
return DATA_TYPE.DT_INVALID;
}
public object[] GetAllDataTypeWithType(ID_SPACE idspace,DATA_TYPE dataType )
{
List<object> results = new List<object>();
switch (idspace)
{
case ID_SPACE.ID_SPACE_ESSENCE:
foreach (var kvp in essence_id_data_type_map)
{
if (kvp.Value == dataType)
{
if (essence_id_data_map.TryGetValue(kvp.Key, out var data))
{
results.Add(data);
}
}
}
break;
// Optionally add other cases if you have other *_id_data_type_map dictionaries
// case ID_SPACE.ID_SPACE_CONFIG:
// foreach (var kvp in config_id_data_type_map)
// {
// if (kvp.Value == dataType)
// {
// if (config_id_data_map.TryGetValue(kvp.Key, out var data))
// {
// results.Add(data);
// }
// }
// }
// break;
}
return results.ToArray();
}
public object get_data_ptr(uint id, ID_SPACE idspace, ref DATA_TYPE dataType)
{
object data = null;
@@ -1,162 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using ModelRenderer.Scripts.Common;
namespace BrewMonster.Common
{
public class CECStringTab
{
private Dictionary<int, string> m_AStrTab = new Dictionary<int, string>();
private Dictionary<int, string> m_WStrTab = new Dictionary<int, string>();
protected bool m_bInit = false;
protected bool m_bUnicode = false;
public bool IsInitialized() => m_bInit;
public void Clear()
{
m_AStrTab.Clear();
m_WStrTab.Clear();
m_bInit = false;
m_bUnicode = false;
}
public bool Init(string szFile, bool bUnicode)
{
bool bRet = false;
if (bUnicode)
{
bRet = LoadWideStrings(szFile);
}
if (!bRet)
{
BMLogger.LogError($"EC_StringTab::Init: {szFile} File load failed");
return false;
}
m_bInit = true;
return true;
}
private bool LoadWideStrings(string szFile)
{
AWScriptFile ScriptFile = new AWScriptFile();
if (!ScriptFile.Open(szFile)) return false;
bool bIndex = false;
bool bFileEnd = true;
// Read configs
while (ScriptFile.GetNextToken(true))
{
string tokenStr = ByteToStringUtils.UshortArrayToUnicodeString(ScriptFile.m_szToken);
if (ByteToStringUtils.UshortArrayToUnicodeString(ScriptFile.m_szToken).StartsWith("#_index"))
bIndex = true;
else if (ByteToStringUtils.UshortArrayToUnicodeString(ScriptFile.m_szToken).StartsWith("#_begin"))
{
bFileEnd = false;
break;
}
}
if (bFileEnd)
{
ScriptFile.Close();
return true;
}
if (bIndex)
{
// Every string has a preset index
while (ScriptFile.PeekNextToken(true))
{
int n = ScriptFile.GetNextTokenAsInt(true);
ScriptFile.GetNextToken(false);
string pstr = ByteToStringUtils.UshortArrayToUnicodeString(ScriptFile.m_szToken);
if (string.IsNullOrEmpty(pstr))
{
ScriptFile.Close();
BMLogger.LogError($"EC_StringTab::LoadWideStrings: {szFile} Not enough memory");
return false;
}
if (!m_WStrTab.TryAdd(n, pstr))
{
BMLogger.LogError($"EC_StringTab::LoadWideStrings: {szFile} Failed to add string to dictionary");
return false;
}
}
}
else
{
int iCnt = 0;
// Read strings sequently
while (ScriptFile.GetNextToken(true))
{
string pstr = ByteToStringUtils.UshortArrayToUnicodeString(ScriptFile.m_szToken);
if (string.IsNullOrEmpty(pstr))
{
ScriptFile.Close();
BMLogger.LogError($"EC_StringTab::LoadWideStrings: {szFile} Not enough memory");
return false;
}
if (!m_WStrTab.TryAdd(iCnt++, pstr))
{
BMLogger.LogError($"EC_StringTab::LoadWideStrings: {szFile} Failed to add string to dictionary");
return false;
}
}
}
ScriptFile.Close();
return true;
}
/// <summary>
/// Get a string by index from the Unicode string table
/// </summary>
/// <param name="index">The index of the string to retrieve</param>
/// <returns>The string at the given index, or null if not found</returns>
public string GetString(int index)
{
if (m_WStrTab.TryGetValue(index, out string result))
{
return result;
}
return null;
}
/// <summary>
/// Get a string by index from the ANSI string table
/// </summary>
/// <param name="index">The index of the string to retrieve</param>
/// <returns>The string at the given index, or null if not found</returns>
public string GetANSIString(int index)
{
if (m_AStrTab.TryGetValue(index, out string result))
{
return result;
}
return null;
}
/// <summary>
/// Check if a string exists at the given index
/// </summary>
/// <param name="index">The index to check</param>
/// <returns>True if a string exists at the index</returns>
public bool HasString(int index)
{
return m_WStrTab.ContainsKey(index) || m_AStrTab.ContainsKey(index);
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: b95d268e43a5da14f9cf8e1ed98bfd73
@@ -0,0 +1,18 @@
using System.Collections.Generic;
using UnityEngine;
namespace BrewMonster
{
public static class ListExtensions
{
public static int UniquelyAdd<T>(this List<T> list, T item)
{
int index = list.IndexOf(item);
if (index >= 0)
return index;
list.Add(item);
return list.Count - 1;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: db1eed55761115545b7046325b4ab7f7
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrewMonster.Assets.PerfectWorld.Scripts.Common
{
public abstract class Singleton<T> where T : class, new()
{
private static readonly Lazy<T> _instance = new Lazy<T>(() => new T());
public static T Instance => _instance.Value;
// Protected constructor prevents external instantiation
protected Singleton()
{
if (_instance.IsValueCreated)
throw new InvalidOperationException($"Singleton<{typeof(T).Name}> already created!");
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6034e7cce8bae674c88f8d3de26c06aa
@@ -14,7 +14,7 @@ namespace BrewMonster.Common
{
m_pStringTab = new CECStringTab();
}
m_pStringTab.Clear();
//m_pStringTab.Clear();
string path = Path.Combine(Application.streamingAssetsPath, "configs/skillstr.txt");
m_pStringTab.Init(path, true);
}
@@ -27,7 +27,7 @@ namespace BrewMonster.Common
m_pStringTab = new CECStringTab();
}
m_pStringTab.Clear();
//m_pStringTab.Clear();
string path = Path.Combine(Application.streamingAssetsPath, "configs/item_desc.txt");
m_pStringTab.Init(path, true);
}
@@ -40,7 +40,7 @@ namespace BrewMonster.Common
m_pStringTab = new CECStringTab();
}
m_pStringTab.Clear();
//m_pStringTab.Clear();
string path = Path.Combine(Application.streamingAssetsPath, "configs/fixed_msg.txt");
m_pStringTab.Init(path, true);
}
File diff suppressed because it is too large Load Diff
@@ -1,25 +0,0 @@
using BrewMonster;
using BrewMonster.Scripts.World;
using CSNetwork.GPDataType;
using System;
using UnityEngine;
public class CECGameRun
{
private CECWorld m_pWorld;
public CECWorld GetWorld() { return m_pWorld; }
public bool StartGame(int idInst, Vector3 vHostPos)
{
if (!JumpToInstance(idInst, vHostPos))
{
BMLogger.LogError ( "CECGameRun::StartGame, Failed to create game world.");
return false;
}
return true;
}
private bool JumpToInstance(int idInst, Vector3 vHostPos, int iParallelWorldID = 0)
{
return true;
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 923b4102fc6857a4e94d7a662b2e6e1a
@@ -1,7 +1,7 @@
using ModelRenderer.Scripts.GameData;
using BrewMonster.Scripts.Task;
using UnityEngine;
using BrewMonster.Common;
using BrewMonster;
using System.Collections.Generic;
using System.IO;
namespace BrewMonster.Network
@@ -14,11 +14,11 @@ namespace BrewMonster.Network
private static CECGameRun m_pGameRun; // Game running object
private static CECGFXCaster m_pGFXCaster; // GFX caster
private static BrewMonster.Common.CECStringTab m_FixedMsgs; // Fixed message table
private static BrewMonster.Common.CECStringTab m_ItemDesc; // Item desciption string table
private static BrewMonster.Common.CECStringTab m_ItemExtDesc; // Item extend description string table
private static BrewMonster.Common.CECStringTab m_SkillDesc; // Skill description string table
private static BrewMonster.Common.CECStringTab m_BuffDesc; // Buff description string table
private static BrewMonster.CECStringTab m_FixedMsgs; // Fixed message table
private static BrewMonster.CECStringTab m_ItemDesc; // Item desciption string table
private static BrewMonster.CECStringTab m_ItemExtDesc; // Item extend description string table
private static BrewMonster.CECStringTab m_SkillDesc; // Skill description string table
private static BrewMonster.CECStringTab m_BuffDesc; // Buff description string table
private static Dictionary<int, ItemMsgMapEntry> m_ItemMsgMap; // TemplateId -> (MessageId, DisplayMode)
#endregion
@@ -27,11 +27,11 @@ namespace BrewMonster.Network
public static elementdataman GetElementDataMan() { return m_pElementDataMan; }
// String table getters
public static BrewMonster.Common.CECStringTab GetFixedMsgs() { return m_FixedMsgs; }
public static BrewMonster.Common.CECStringTab GetItemDesc() { return m_ItemDesc; }
public static BrewMonster.Common.CECStringTab GetItemExtDesc() { return m_ItemExtDesc; }
public static BrewMonster.Common.CECStringTab GetSkillDesc() { return m_SkillDesc; }
public static BrewMonster.Common.CECStringTab GetBuffDesc() { return m_BuffDesc; }
public static BrewMonster.CECStringTab GetFixedMsgs() { return m_FixedMsgs; }
public static BrewMonster.CECStringTab GetItemDesc() { return m_ItemDesc; }
public static BrewMonster.CECStringTab GetItemExtDesc() { return m_ItemExtDesc; }
public static BrewMonster.CECStringTab GetSkillDesc() { return m_SkillDesc; }
public static BrewMonster.CECStringTab GetBuffDesc() { return m_BuffDesc; }
public static bool TryGetItemMsg(int templateId, out int messageId, out int displayMode)
{
messageId = 0;
@@ -60,7 +60,7 @@ namespace BrewMonster.Network
BMLogger.LogError("[Dat]- CECGame::Init, Storage task Init Failed!");
return false;
}
m_pGameRun = new CECGameRun();
m_pGameRun = CECGameRun.Instance;
if (m_pGameRun == null)
{
BMLogger.LogError("CECGame::Init");
@@ -86,11 +86,11 @@ namespace BrewMonster.Network
private static void InitializeStringTables()
{
// Initialize string table instances
m_FixedMsgs = new BrewMonster.Common.CECStringTab();
m_ItemDesc = new BrewMonster.Common.CECStringTab();
m_ItemExtDesc = new BrewMonster.Common.CECStringTab();
m_SkillDesc = new BrewMonster.Common.CECStringTab();
m_BuffDesc = new BrewMonster.Common.CECStringTab();
m_FixedMsgs = new BrewMonster.CECStringTab();
m_ItemDesc = new BrewMonster.CECStringTab();
m_ItemExtDesc = new BrewMonster.CECStringTab();
m_SkillDesc = new BrewMonster.CECStringTab();
m_BuffDesc = new BrewMonster.CECStringTab();
// Load string files from StreamingAssets/configs directory
string dataPath = Application.streamingAssetsPath + "/configs/";
@@ -64,7 +64,6 @@ public class CECAttacksMan : MonoSingleton<CECAttacksMan>
nTimeFly // timeToDoDamage
);
m_AttackLinkedList.AddLast(newEvent);
BMLogger.LogError("HoangDev: AddMeleeAttack CECAttackEvent: " + m_AttackLinkedList.Count);
newEvent.UpdateTargetFlag();
return m_AttackLinkedList.Last.Value;
@@ -322,9 +321,9 @@ bool DoFire()
BMLogger.LogError("Target is null!");
return false;
}
var vfx = GameController.Instance.GetTestVfx();
var vfx = CECGameRun.Instance.GetTestVfx();
vfx.transform.position = target.position;
GameController.Instance.DestroyTestVfx(vfx, 1f);
CECGameRun.Instance.DestroyTestVfx(vfx, 1f);
}
}
}
@@ -455,7 +454,6 @@ bool DoFire()
TARGET_DATA data = m_targets[i];
int idTarget = data.idTarget;
string strName;
BMLogger.LogError("HoangDev: GPDataTypeHelper.ISPLAYERID(idTarget) " + GPDataTypeHelper.ISPLAYERID(idTarget));
if (GPDataTypeHelper.ISNPCID(idTarget))
{
@@ -480,7 +478,7 @@ bool DoFire()
{
CECPlayer pPlayer = EC_ManMessageMono.Instance.GetECManPlayer.GetPlayer(idTarget);
BMLogger.LogError("HoangDev: CECPlayer pPlayer = " + pPlayer );
//BMLogger.LogError("HoangDev: CECPlayer pPlayer = " + pPlayer );
if (!pPlayer)
return true;
@@ -100,7 +100,7 @@ public class CECNPCMan : IMsgHandler
RemoveNPCFromMiniMap(pNPC);*/
pNPC.m_iMMIndex = -1;
var hostplayer = GameController.Instance.GetHostPlayer();
var hostplayer = CECGameRun.Instance.GetHostPlayer();
// If this NPC is selected by host, cancel the selection
if (pNPC.GetNPCID() == hostplayer.GetSelectedTarget())
hostplayer.SelectTarget(0);
@@ -129,7 +129,7 @@ public class CECNPCMan : IMsgHandler
if (pNPC)
{
// Remove tab-selected array
CECHostPlayer pHost = GameController.Instance.GetHostPlayer();
CECHostPlayer pHost = CECGameRun.Instance.GetHostPlayer();
if (pHost)
pHost.RemoveObjectFromTabSels(pNPC);
@@ -348,7 +348,6 @@ public class CECNPCMan : IMsgHandler
}
case CommandID.NPC_INFO_00:
{
BMLogger.LogError("HoangDev: NPCMAN NPC_INFO_00");
var buffer = (byte[])msg.dwParam1;
cmd_npc_info_00 pCmd = GPDataTypeHelper.FromBytes<cmd_npc_info_00>(buffer);
@@ -362,7 +361,6 @@ public class CECNPCMan : IMsgHandler
ep.bs.max_hp = pCmd.iMaxHP;
pNPC.SetSelectedTarget(pCmd.iTargetID);
pNPC.SetWorldHealthImage((float)pCmd.iHP , (float)pCmd.iMaxHP);
BMLogger.LogError("HoangDev: publish NPCMAN NPC_INFO_00");
EventBus.Publish(new NPCINFO(pNPC.GetName(),pCmd.iHP,pCmd.iMaxHP, pCmd.idNPC));
}
@@ -462,10 +460,10 @@ public class CECNPCMan : IMsgHandler
switch (dataType)
{
case DATA_TYPE.DT_NPC_ESSENCE:
pNPC = GameController.Instance.GetNPCServer();
pNPC = CECGameRun.Instance.GetNPCServer();
break;
case DATA_TYPE.DT_MONSTER_ESSENCE:
pNPC = GameController.Instance.GetMonster();
pNPC = CECGameRun.Instance.GetMonster();
break;
case DATA_TYPE.DT_PET_ESSENCE:/* pNPC = new CECPet(this);*/ break;
default:
@@ -239,17 +239,17 @@ public class CECTracedNPC : CECTracedObject
//a_LogOutput(1, "[NormalATK]- CECTracedNPC- OnTouched- TRACE_ATTACK");
}
}
//else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
//{
// //a_LogOutput(1, "[NormalATK]- CECTracedNPC- OnTouched- TRACE_SPELL");
// if (!m_pHost.CannotAttack())
// {
// if (m_pHost.CastSkill(m_iObjectId, m_bForceAttack))
// bActionDone = true;
// }
// else
// m_pHost.m_pPrepSkill = null;
//}
else if (m_iReason == CECHPWorkTrace.Trace_reason.TRACE_SPELL)
{
//a_LogOutput(1, "[NormalATK]- CECTracedNPC- OnTouched- TRACE_SPELL");
if (!m_pHost.CannotAttack())
{
if (m_pHost.CastSkill(m_iObjectId, m_bForceAttack))
bActionDone = true;
}
else
m_pHost.m_pPrepSkill = null;
}
}
return bActionDone;
}
@@ -723,7 +723,7 @@ public class CECHPWorkTrace : CECHPWork
public void SetForceAttack(bool bTrue) { m_bForceAttack = bTrue; }
public bool GetForceAttack() { return m_bForceAttack; }
// Set / Get prepared skill
public void SetPrepSkill(CECSkill pSkill) { /*m_pPrepSkill = pSkill;*/ }
public void SetPrepSkill(CECSkill pSkill) { m_pPrepSkill = pSkill; }
public CECSkill GetPrepSkill() { /*return m_pPrepSkill;*/ return null; }
// Get target ID
public int GetTarget() { return m_pTraceObject.GetObjectID(); }
@@ -563,7 +563,7 @@ namespace BrewMonster.Scripts.Managers
var itemDesc = EC_Game.GetItemDesc();
if (itemDesc != null && itemDesc.IsInitialized())
{
string description = itemDesc.GetString(messageId);
string description = itemDesc.GetWideString(messageId);
if (!string.IsNullOrEmpty(description))
{
return description;
@@ -576,7 +576,7 @@ namespace BrewMonster.Scripts.Managers
var itemDesc = EC_Game.GetItemDesc();
if (itemDesc != null && itemDesc.IsInitialized())
{
string description = itemDesc.GetString(templateId);
string description = itemDesc.GetWideString(templateId);
if (!string.IsNullOrEmpty(description))
return description;
}
@@ -605,7 +605,7 @@ namespace BrewMonster.Scripts.Managers
var itemExtDesc = EC_Game.GetItemExtDesc();
if (itemExtDesc != null && itemExtDesc.IsInitialized())
{
string extendedDesc = itemExtDesc.GetString(messageId);
string extendedDesc = itemExtDesc.GetWideString(messageId);
if (!string.IsNullOrEmpty(extendedDesc))
{
return extendedDesc;
@@ -618,7 +618,7 @@ namespace BrewMonster.Scripts.Managers
var itemExtDesc = EC_Game.GetItemExtDesc();
if (itemExtDesc != null && itemExtDesc.IsInitialized())
{
string extendedDesc = itemExtDesc.GetString(templateId);
string extendedDesc = itemExtDesc.GetWideString(templateId);
if (!string.IsNullOrEmpty(extendedDesc))
return extendedDesc;
}
@@ -1381,7 +1381,7 @@ namespace PerfectWorld.Scripts.Managers
var tab = EC_Game.GetItemDesc();
if (tab != null && tab.IsInitialized())
{
string s = tab.GetString(id);
string s = tab.GetWideString(id);
if (!string.IsNullOrEmpty(s)) return s;
}
// Fallback labels for common IDs when the table lacks #_index entries
@@ -186,7 +186,7 @@ namespace PerfectWorld.Scripts.Managers
}
// Get the host player
var hostPlayer = GameController.Instance?.GetHostPlayer();
var hostPlayer = CECGameRun.Instance?.GetHostPlayer();
if (hostPlayer == null)
{
Debug.LogWarning("Host player not found");
@@ -1,12 +1,17 @@
using CSNetwork;
using BrewMonster;
using BrewMonster.Network;
using CSNetwork;
using CSNetwork.GPDataType;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using PerfectWorld.Scripts.Player;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace PerfectWorld.Scripts.Managers
{
@@ -24,9 +29,9 @@ namespace PerfectWorld.Scripts.Managers
{
if (Msg.iSubID == 0)
{
if (GameController.Instance == null) return true;
if (GameController.Instance.GetHostPlayer() == null) return true;
GameController.Instance.GetHostPlayer().ProcessMessage(Msg);
if (CECGameRun.Instance == null) return true;
if (CECGameRun.Instance.GetHostPlayer() == null) return true;
CECGameRun.Instance.GetHostPlayer().ProcessMessage(Msg);
}
else if (Msg.iSubID < 0)
{
@@ -42,14 +47,14 @@ namespace PerfectWorld.Scripts.Managers
OnMsgPlayerMove(Msg);
break;
}
case int value when value == EC_MsgDef.MSG_PM_PLAYERLEVELUP:
OnMsgPlayerLevelUp(Msg);
break;
case int value when value == EC_MsgDef.MSG_PM_PLAYERSTOPMOVE:
{
OnMsgPlayerStopMove(Msg);
break;
}
case int value when value == EC_MsgDef.MSG_PM_PLAYERLEVELUP:
OnMsgPlayerLevelUp(Msg);
break;
case int value when value == EC_MsgDef.MSG_PM_FACTION_PVP_MASK_MODIFY:
case int value1 when value1 == EC_MsgDef.MSG_PM_PLAYERATKRESULT:
Debug.Log("EC_MsgDef.MSG_PM_FACTION_PVP_MASK_MODIFY");
@@ -123,7 +128,7 @@ namespace PerfectWorld.Scripts.Managers
info_player_1 info_Player_1 = GPDataTypeHelper.FromBytes<info_player_1>((byte[])Msg.dwParam1);
RoleInfo roleInfo = (RoleInfo)Msg.dwParam4;
ElsePlayerEnter(info_Player_1, commandID, roleInfo);
GameController.Instance.Log("ElsePlayer has join");
CECGameRun.Instance.Log("ElsePlayer has join");
}
break;
}
@@ -259,6 +264,24 @@ namespace PerfectWorld.Scripts.Managers
}
}
}
private bool OnMsgPlayerLevelUp(ECMSG Msg)
{
cmd_level_up pCmd = GPDataTypeHelper.FromBytes<cmd_level_up>((byte[])Msg.dwParam1);
CECHostPlayer pHost = GetHostPlayer();
if (pCmd.id == pHost.GetCharacterID())
{
pHost.LevelUp();
}
else
{
EC_ElsePlayer pPlayer = SeekOutElsePlayer(pCmd.id);
if (pPlayer)
pPlayer.LevelUp();
}
return true;
}
public bool HostPlayerInfo1(cmd_self_info_1 info)
{
@@ -289,7 +312,7 @@ namespace PerfectWorld.Scripts.Managers
// isDoneWorldRender = value;
// actLoadChar?.Invoke();
//});
GameController.Instance.InitCharacter(info);
CECGameRun.Instance.InitCharacter(info);
return true;
}
@@ -350,7 +373,7 @@ namespace PerfectWorld.Scripts.Managers
private EC_ElsePlayer CreateElsePlayer(RoleInfo roleInfo, info_player_1 info, int iAppearFlag)
{
GameObject ob = GameController.Instance.InitCharacter(info);
GameObject ob = CECGameRun.Instance.InitCharacter(info);
EC_ElsePlayer elsePlayer = ob.AddComponent<EC_ElsePlayer>();
elsePlayer.Init(roleInfo, info);
@@ -395,23 +418,6 @@ namespace PerfectWorld.Scripts.Managers
pPlayer.StopMoveTo(pCmd);
return true;
}
private bool OnMsgPlayerLevelUp(ECMSG Msg)
{
cmd_level_up pCmd = GPDataTypeHelper.FromBytes<cmd_level_up>((byte[])Msg.dwParam1);
CECHostPlayer pHost = GetHostPlayer();
if (pCmd.id == pHost.GetCharacterID())
{
pHost.LevelUp();
}
else
{
EC_ElsePlayer pPlayer = SeekOutElsePlayer(pCmd.id);
if (pPlayer)
pPlayer.LevelUp();
}
return true;
}
public bool OnMsgPlayerRunOut(ECMSG Msg)
{
@@ -514,7 +520,7 @@ namespace PerfectWorld.Scripts.Managers
public bool TransmitMessage(ECMSG msg)
{
int cid = 0;
var host = GameController.Instance.GetHostPlayer();
var host = CECGameRun.Instance.GetHostPlayer();
switch (msg.dwMsg)
{
@@ -585,8 +591,20 @@ namespace PerfectWorld.Scripts.Managers
public CECHostPlayer GetHostPlayer()
{
return GameController.Instance.GetHostPlayer();
return CECGameRun.Instance.GetHostPlayer();
}
}
}
public struct EC_PLAYERLOADRESULT
{
public uint dwValidMask;
public CECModel pPlayerModel;
public int iShape;
public CECModel pDummyModel;
public CECModel pPetModel;
/* CECFace pFaceModel;
A3DShader pBodyShaders[3];*/
public CECModel pFlyNviagteModel;
//CECPlayer::EquipsLoadResult EquipResult;
};
}
@@ -1,6 +1,508 @@
using BrewMonster.Network;
using BrewMonster.Scripts.Skills;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
public class CECSkill
namespace BrewMonster
{
}
// CECSkillStr class - inherits from SkillStr
public class CECSkillStr : SkillStr
{
public override string Find(int id)
{
// TODO: Implement GetNameDisplay - requires game instance access
BrewMonster.CECStringTab pStrTab = EC_Game.GetSkillDesc();
string str = pStrTab.GetWideString(id);
return string.IsNullOrEmpty(str) ? str : string.Empty;
}
}
// Skill array wrapper structure
public struct SkillArrayWrapper
{
public Dictionary<uint, int> Array;
public SkillArrayWrapper(Dictionary<uint, int> rhs)
{
Array = rhs ?? new Dictionary<uint, int>();
RemoveInvalid();
}
// Remove invalid skills (for example, those with ID == 0)
public void RemoveInvalid()
{
if (Array == null) return;
var invalidKeys = Array
.Where(kv => kv.Key == 0)
.Select(kv => kv.Key)
.ToList();
foreach (var key in invalidKeys)
Array.Remove(key);
}
public bool Find(uint id)
{
return Array != null && Array.ContainsKey(id);
}
public bool Empty()
{
return Array == null || Array.Count == 0;
}
public int Count()
{
return Array?.Count ?? 0;
}
public uint this[int index]
{
get
{
if (Array == null || index < 0 || index >= Array.Count)
throw new System.IndexOutOfRangeException();
return Array.ElementAt(index).Key;
}
}
}
// CECSkill class
public class CECSkill
{
// Skill type enum
public enum SkillType
{
TYPE_ATTACK = 1, // 攻击技能
TYPE_BLESS, // 祝福技能
TYPE_CURSE, // 诅咒技能
TYPE_SUMMON, // 召唤
TYPE_PASSIVE, // 被动
TYPE_ENABLED, // 启用
TYPE_LIVE, // 生活
TYPE_FLASHMOVE, // 瞬移
TYPE_PRODUCE, // 生产
TYPE_BLESSPET, // 宠物祝福
TYPE_NEUTRALBLESS, // 中立祝福
}
// Range type enum
public enum RangeType
{
RANGE_POINT = 0, // 点
RANGE_LINE, // 线
RANGE_SELFSPHERE, // 自身为圆心的圆
RANGE_TARGETSPHERE, // 目标为圆心的圆
RANGE_TAPER, // 圆锥
RANGE_SLEF, // 自身
}
// Attributes
private ElementSkill m_pSkillCore;
private int m_idSkill; // Skill ID
private int m_iLevel; // Skill level
private int m_iCoolCnt; // Cooling time counter
private int m_iCoolTime; // Total cooling time
private bool m_bCooling; // In cooling state
private int m_iChargeCnt; // Charging time counter
private int m_iChargeMax; // Charging time maximum count value
private bool m_bCharging; // In charging state
// Static skill string provider
private static CECSkillStr l_SkillStr = new CECSkillStr();
// Constructor
public CECSkill(int id, int iLevel)
{
m_pSkillCore = ElementSkill.Create((uint)id, iLevel);
if (m_pSkillCore == null)
{
// Fallback to default skill
m_pSkillCore = ElementSkill.Create(1, 1);
}
m_idSkill = id;
m_iLevel = iLevel;
m_iCoolTime = m_pSkillCore != null ? m_pSkillCore.GetCoolingTime() : 0;
m_iCoolCnt = 0;
m_bCooling = false;
m_iChargeCnt = 0;
m_iChargeMax = 0;
m_bCharging = false;
}
// Tick routine
public void Tick(float deltaTime)
{
// Convert deltaTime (seconds) to milliseconds
int tickTime = (int)(deltaTime * 1000f);
if (m_bCooling)
{
// In cooling state
m_iCoolCnt -= tickTime;
if (m_iCoolCnt <= 0)
{
m_iCoolCnt = 0;
m_bCooling = false;
// TODO: do something here ?
}
}
if (m_bCharging)
{
// In charging state
m_iChargeCnt += tickTime;
if (m_iChargeCnt >= m_iChargeMax)
{
m_iChargeCnt = m_iChargeMax;
m_bCharging = false;
// TODO: do something here ?
}
}
}
// Skill level up
public void LevelUp()
{
m_iLevel++;
if (m_pSkillCore != null)
{
m_pSkillCore.SetLevel(m_iLevel);
}
}
// Set Skill level
public void SetLevel(int iLevel)
{
m_iLevel = iLevel;
if (m_pSkillCore != null)
{
m_pSkillCore.SetLevel(m_iLevel);
}
}
// Start into cooling state
// iTotalTime: total cooling time, 0 means to use cooling time in database
public void StartCooling(int iTotalTime, int iStartCnt)
{
m_iCoolTime = iTotalTime != 0 ? iTotalTime : GetCoreCoolingTime();
m_iCoolCnt = iStartCnt;
m_bCooling = true;
}
// Ready to be cast ?
public bool ReadyToCast()
{
return !m_bCooling;
}
// Get cooling time counter
public int GetCoolingCnt()
{
return m_iCoolCnt;
}
// Get total cooling time
public int GetCoolingTime()
{
return m_iCoolTime;
}
// Start charging
public void StartCharging(int iChargeMax)
{
if (m_pSkillCore != null && m_pSkillCore.IsWarmup())
{
m_iChargeMax = iChargeMax;
m_iChargeCnt = 0;
m_bCharging = true;
}
}
// End charging
public void EndCharging()
{
m_bCharging = false;
}
// Get charging flag
public bool IsCharging()
{
return m_bCharging;
}
// Get charging counter
public int GetChargingCnt()
{
return m_iChargeCnt;
}
// Get charging maximum count
public int GetChargingMax()
{
return m_iChargeMax;
}
// Charge full
public bool ChargeFull()
{
return m_pSkillCore != null && m_pSkillCore.IsWarmup() && m_iChargeCnt >= m_iChargeMax;
}
// Get skill ID
public int GetSkillID()
{
return m_idSkill;
}
// Get skill level
public int GetSkillLevel()
{
return m_iLevel;
}
// Get skill icon file
public string GetIconFile()
{
return m_pSkillCore != null ? m_pSkillCore.GetIcon() ?? string.Empty : string.Empty;
}
public string GetName()
{
return m_pSkillCore != null ? m_pSkillCore.GetName() ?? string.Empty : string.Empty;
}
public string GetNameDisplay()
{
// TODO: Implement GetNameDisplay - requires game instance access
// return g_pGame->GetSkillDesc()->GetWideString(GetSkillID() * 10);
return string.Empty;
}
public string GetDesc()
{
if (m_pSkillCore == null || l_SkillStr == null)
return string.Empty;
StringBuilder sb = new StringBuilder(1024);
var skillStr = l_SkillStr as SkillStr;
string result = m_pSkillCore.GetIntroduction(sb, 1024, skillStr);
return result;
}
public int GetCoreCoolingTime()
{
return m_pSkillCore != null ? m_pSkillCore.GetCoolingTime() : 0;
}
public int GetExecuteTime()
{
return m_pSkillCore != null ? m_pSkillCore.GetExecuteTime() : 0;
}
public int GetType()
{
return m_pSkillCore != null ? m_pSkillCore.GetType() : 0;
}
public int GetRangeType()
{
return m_pSkillCore != null ? m_pSkillCore.GetRangeType() : 0;
}
public float GetCastRange(float fAtkDist, float fPrayDistancePlus)
{
return m_pSkillCore != null ? m_pSkillCore.GetPrayRange(fAtkDist, fPrayDistancePlus) : 0f;
}
/* public string GetEffect()
{
return m_pSkillCore != null ? m_pSkillCore.GetEffect() ?? string.Empty : string.Empty;
}
*/
public int GetTargetType()
{
return m_pSkillCore != null ? m_pSkillCore.GetTargetType() : 0;
}
public int GetCastEnv()
{
return m_pSkillCore != null ? m_pSkillCore.GetCastEnv() : 0;
}
/* public int[] GetRequiredGenius()
{
return m_pSkillCore != null ? m_pSkillCore.GetRequiredGenius(m_idSkill) ?? new int[0] : new int[0];
}*/
public int GetShowOrder()
{
return m_pSkillCore != null ? m_pSkillCore.GetShowOrder() : 0;
}
public bool IsChargeable()
{
return m_pSkillCore != null && m_pSkillCore.IsWarmup();
}
/* public string GetNativeName()
{
return m_pSkillCore != null ? m_pSkillCore.GetNativeName() ?? string.Empty : string.Empty;
}*/
public bool ValidWeapon(int idWeapon)
{
return m_pSkillCore != null && m_pSkillCore.ValidWeapon(idWeapon);
}
/*
public bool ValidShape(int iShape)
{
return m_pSkillCore != null && m_pSkillCore.IsValidForm((char)iShape);
}*/
public bool ChangeToMelee()
{
return m_pSkillCore != null && m_pSkillCore.IsAutoAttack();
}
public bool IsInstant()
{
return m_pSkillCore != null && m_pSkillCore.IsInstant();
}
public bool IsDurative()
{
return m_pSkillCore != null && m_pSkillCore.IsDurative();
}
public SkillArrayWrapper GetJunior()
{
var juniorList = m_pSkillCore.GetJunior();
return new SkillArrayWrapper(juniorList);
}
public int GetRequiredLevel()
{
return m_pSkillCore != null ? m_pSkillCore.GetRequiredLevel() : 0;
}
public int GetRequiredSp()
{
return m_pSkillCore != null ? m_pSkillCore.GetRequiredSp() : 0;
}
public int GetRequiredBook()
{
return m_pSkillCore != null ? m_pSkillCore.GetRequiredBook() : 0;
}
/* public SkillArrayWrapper GetRequiredSkill()
{
return m_pSkillCore != null ? m_pSkillCore.GetRequiredSkill() : new SkillArrayWrapper(new List<SkillArrayWrapper.IDLevelPair>());
}*/
public int GetRequiredMoney()
{
return m_pSkillCore != null ? m_pSkillCore.GetRequiredMoney() : 0;
}
/* public int GetRequiredItem()
{
return m_pSkillCore != null ? m_pSkillCore.GetItemCost() : 0;
}*/
// 获取技能公共冷却mask,其中bit0-4为技能公共冷却,bit5-9为物品公共冷却
/* public int GetCommonCoolDown()
{
return m_pSkillCore != null ? m_pSkillCore.GetCommonCoolDown() : 0;
}*/
// 获取技能公共冷却时间,单位毫秒
/* public int GetCommonCoolDownTime()
{
return m_pSkillCore != null ? m_pSkillCore.GetCommonCoolDownTime() : 0;
}*/
// Get skill description (static method)
public static bool GetDesc(int idSkill, int iLevel, out string szText, int iBufLen)
{
szText = string.Empty;
if (iBufLen <= 0)
{
return false;
}
CECSkill pSkill = new CECSkill(idSkill, iLevel);
if (pSkill == null)
{
return false;
}
string sz = pSkill.GetDesc();
if (sz != null && sz.Length < iBufLen)
{
szText = sz;
return true;
}
return false;
}
// Check skill type
public bool IsGoblinSkill()
{
return m_pSkillCore != null && m_pSkillCore.GetCls() == 258;
}
public bool IsPlayerSkill()
{
// TODO: NUM_PROFESSION should be defined elsewhere
const int NUM_PROFESSION = 256; // Placeholder
int cls = m_pSkillCore != null ? m_pSkillCore.GetCls() : -1;
return cls >= 0 && cls < NUM_PROFESSION;
}
public bool IsGeneralSkill()
{
return GetCls() == 255;
}
public int GetCls()
{
return m_pSkillCore != null ? m_pSkillCore.GetCls() : -1;
}
// 技能等级
public int GetRank()
{
return m_pSkillCore != null ? m_pSkillCore.GetRank() : 0;
}
// 技能最大等级
public int GetMaxLevel()
{
return m_pSkillCore != null ? m_pSkillCore.GetMaxLevel() : 0;
}
/* public int GetComboSkPreSkill()
{
return m_pSkillCore != null ? m_pSkillCore.GetComboSkPreSkill() : 0;
}*/
public bool IsPositiveSkill()
{
int t = GetType();
return t != (int)SkillType.TYPE_PASSIVE
&& t != (int)SkillType.TYPE_PRODUCE
&& t != (int)SkillType.TYPE_LIVE;
}
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8a66485e503bcc04fa01f3cc91813a50
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using UnityEngine;
namespace BrewMonster
{
public class CECComboSkillState
{
public static CECComboSkillState instance;
public static CECComboSkillState Instance
{
get
{
if (instance == null)
{
instance = new CECComboSkillState();
}
return instance;
}
set => instance = value;
}
private Dictionary<uint, CECSkill> m_inherentSkillMap = new Dictionary<uint, CECSkill>();
public CECSkill GetInherentSkillByID(uint skillID)
{
if (m_inherentSkillMap.TryGetValue(skillID, out CECSkill skill))
{
return skill;
}
else
{
return null;
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b844e9caa9f65d74d8430fa7e120d665
@@ -0,0 +1,123 @@
using Unity.VisualScripting;
using UnityEngine;
namespace BrewMonster
{
public class CECTaoistRank
{
private int m_id; // ID
private string m_name; // ID
private CECTaoistRank m_next;
static bool initComplete = false;
public static CECTaoistRank[] s_allTaoistRanks = new CECTaoistRank[(int)ToaistRank.TotalRankCount];
public static readonly int[] TaoistRankIDs = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 20, 21, 22, 30, 31, 32 };
public bool IsGodRank()
{
CECTaoistRank GodRank;
for (GodRank = GetGodRankBegin(); GodRank != GetGodRankEnd();
GodRank = GodRank.GetNext())
{
if (this == GodRank)
{
return true;
}
}
return false;
}
public CECTaoistRank GetGodRankBegin()
{
init();
return s_allTaoistRanks[(int)ToaistRank.BaseRankCount];
}
public CECTaoistRank GetGodRankEnd()
{
init();
return GetLastGodRank().m_next;
}
public CECTaoistRank GetLastGodRank()
{
init();
return s_allTaoistRanks[(int)ToaistRank.BaseRankCount + (int)ToaistRank.GodRankCount - 1];
}
public bool IsEvilRank()
{
CECTaoistRank EvilRank;
for (EvilRank = GetEvilRankBegin(); EvilRank != GetEvilRankEnd();
EvilRank = EvilRank.GetNext())
{
if (this == EvilRank)
{
return true;
}
}
return false;
}
public CECTaoistRank GetNext()
{
return m_next;
}
public static CECTaoistRank GetEvilRankBegin()
{
init();
return s_allTaoistRanks[(int)ToaistRank.BaseRankCount + (int)ToaistRank.GodRankCount];
}
public static CECTaoistRank GetEvilRankEnd()
{
init();
return GetLastEvilRank().m_next;
}
public static CECTaoistRank GetLastEvilRank()
{
init();
return s_allTaoistRanks[(int)ToaistRank.TotalRankCount - 1];
}
public static CECTaoistRank GetTaoistRank(int id)
{
init();
for (int i = 0; i < (int)ToaistRank.TotalRankCount; i++)
{
if (TaoistRankIDs[i] == id)
{
return s_allTaoistRanks[i];
}
}
return null;
}
public static void init()
{
if (initComplete)
{
return;
}
for (int i = 0; i < (int)ToaistRank.TotalRankCount; i++)
{
s_allTaoistRanks[i].m_id = TaoistRankIDs[i];
/* s_allTaoistRanks[i].m_name =
g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan()->GetStringFromTable(1001 + s_allTaoistRanks[i].m_id);*/
if (i != (int)ToaistRank.BaseRankCount - 1 &&
i != (int)ToaistRank.BaseRankCount + (int)ToaistRank.GodRankCount - 1 &&
i != (int)ToaistRank.TotalRankCount - 1)
{
s_allTaoistRanks[i].m_next = s_allTaoistRanks[i + 1];
}
else
{
s_allTaoistRanks[i].m_next = null;
}
}
initComplete = true;
}
}
public enum ToaistRank
{
TotalRankCount = 15,
BaseRankCount = 9,
GodRankCount = 3,
EvilRankCount = 3,
};
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0af7ab2d9c8f26f409468880e8e6e951
@@ -28,7 +28,7 @@ public abstract class CECPlayer : CECObject
protected GameObject _pPlayerModel;
protected float rotationSpeed = 5;
internal int m_iMoveMode; // Player's move mode
internal int m_idSelTarget;
[SerializeField] internal int m_idSelTarget;
protected int m_iShape; // Ñ¡ÖÐÄ¿±êµÄID
protected uint m_dwStates; // Player's basic states
protected uint m_uAttackType;
+1 -1
View File
@@ -51,7 +51,7 @@ public class CECModel
strKey += szHook;
// var vfxPrefab = AddressableManager.Instance.LoadPrefabAsync(szPath).Result;
var testVfx = GameController.Instance.GetTestVfx();
var testVfx = CECGameRun.Instance.GetTestVfx();
testVfx.name = "PlayGfx";
testVfx.transform.position = new Vector3(vOffset.x, vOffset.y, vOffset.z);
+6 -9
View File
@@ -7,6 +7,7 @@ using CSNetwork.GPDataType;
using ModelRenderer.Scripts.Common;
using System;
using System.IO;
using System.Threading.Tasks;
using UnityEngine;
public class CECNPC : CECObject
@@ -160,7 +161,7 @@ public class CECNPC : CECObject
m_cdr.fStepHeight = 0.4f;
m_cdr.vVelocity.Clear();
var pHost = GameController.Instance.GetHostPlayer();
var pHost = CECGameRun.Instance.GetHostPlayer();
if (pHost != null)
{
m_fDistToHost = Vector3.Distance(m_vServerPos, pHost.transform.position);
@@ -181,7 +182,7 @@ public class CECNPC : CECObject
}
public void OnMsgAttackHostResult(int idHost, int nDamage, int nFlag, int nSpeed)
{
BMLogger.LogError("HoangDev: OnMsgAttackHostResultNPC");
//BMLogger.LogError("HoangDev: OnMsgAttackHostResultNPC");
if (!IsDead())
{
// 🔹 Quay mặt về mục tiêu
@@ -232,7 +233,7 @@ public class CECNPC : CECObject
}
}
var pHost = GameController.Instance.GetHostPlayer();
var pHost = CECGameRun.Instance.GetHostPlayer();
int iDamage = -1;
// Attacker is host's pet
@@ -272,8 +273,6 @@ public class CECNPC : CECObject
int nAttackSpeed,
int nSection = 0)
{
BMLogger.LogError("HoangDev: PlayAttackEffectNPC");
if (m_pNPCModelPolicy == null)
return;
@@ -391,8 +390,6 @@ public class CECNPC : CECObject
private bool PlayAttackAction(int nAttackSpeed, CECAttackEvent attackevent)
{
BMLogger.LogError("HoangDev: PlayAttackActionNPC");
return m_pNPCModelPolicy.PlayAttackAction(nAttackSpeed, attackevent);
}
void NPCTurnFaceTo(int idTarget, float dwTime = 0)
@@ -788,7 +785,7 @@ public class CECNPC : CECObject
QueueLoadNPCModel();
}
public void QueueLoadNPCModel()
public async Task QueueLoadNPCModel()
{
/* if (ShouldUseMasterModel())
{
@@ -803,7 +800,7 @@ public class CECNPC : CECObject
{
return;
}
var model = NPCBuilder.Instance.GetModelByPath(szModelFile.ToLower());
var model = await NPCBuilder.Instance.GetModelByPath(szModelFile.ToLower());
if (model == null) {
model = GameObject.CreatePrimitive(PrimitiveType.Capsule);
+4 -14
View File
@@ -10,7 +10,8 @@ using BrewMonster;
#if UNITY_EDITOR
using Animancer;
using BrewMonster.Scripts; // B?o đ?m b?n có Animancer package
using BrewMonster.Scripts;
using System.Threading.Tasks; // B?o đ?m b?n có Animancer package
#endif
public class NPCBuilder : MonoSingleton<NPCBuilder>
@@ -25,21 +26,10 @@ public class NPCBuilder : MonoSingleton<NPCBuilder>
private Dictionary<string, GameObject> modelNPCDic;
private void Awake()
{
if (modelNPCList == null || modelNPCList.Count == 0)
{
Debug.LogError("[NPCBuilder] modelNPCList rỗng ? hãy quét l?i prefab! " + transform.gameObject.name);
}
modelNPCDic = modelNPCList
.GroupBy(obj => obj.name)
.ToDictionary(g => g.Key, g => g.First());
}
public GameObject GetModelByPath(string path)
public async Task<GameObject> GetModelByPath(string path)
{
return AddressableManager.Instance.LoadPrefabAsync(path).Result;
return await AddressableManager.Instance.LoadPrefabAsync(path);
}
#if UNITY_EDITOR
@@ -1,6 +1,7 @@
using CSNetwork.GPDataType;
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace CSNetwork.C2SCommand
{
@@ -1,3 +1,4 @@
using BrewMonster;
using CSNetwork.GPDataType;
using CSNetwork.S2CCommand;
using System;
@@ -5,6 +6,7 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using static Unity.Burst.Intrinsics.X86.Avx;
namespace CSNetwork.C2SCommand
{
@@ -181,7 +183,10 @@ namespace CSNetwork.C2SCommand
return;
}
WriteBasicValue(octets, array.Length);
if (array.Length != 1 )
{
WriteBasicValue(octets, array.Length);
}
var elementType = array.GetType().GetElementType();
if (NeedsCustomSerialization(elementType))
@@ -239,7 +244,6 @@ namespace CSNetwork.C2SCommand
byte byDir, ushort wStamp, ushort iTime
)
{
_logger.Log(LogType.Warning, $"HoangDev : vDest : {vDest}\n speed {FloatToFix8(FloatToFix8(fSpeed))} \n useTime : {iTime}\n moveMode: {iMoveMode} \n stamp: {wStamp}");
var cmd = new CMD_StopMove
{
vCurPos = vDest,
@@ -251,6 +255,28 @@ namespace CSNetwork.C2SCommand
};
return SerializeCommand(CommandID.STOP_MOVE, cmd);
}
public static Octets CreatePlayerCastSkill(int idSkill, byte byPVPMask, int iNumTarget, int aTargets)
{
var cmd = new CMD_CastSkill
{
skillId = idSkill,
pvpMask = byPVPMask,
targetCount = (byte)iNumTarget,
targets = null
};
if (iNumTarget > 0)
{
if (iNumTarget > 0)
{
cmd.targets = new int[iNumTarget];
cmd.targets[0] = aTargets;
}
}
var cmdBuf = SerializeCommand(CommandID.CAST_SKILL, cmd);
return cmdBuf;
}
public static short FloatToFix8(float x)
{
return (short)(x * 256.0f + 0.5f);
@@ -442,7 +468,6 @@ namespace CSNetwork.C2SCommand
// Serialize the command and return the serialized data
return SerializeCommand(eCommandID.TASK_VAR_DATA, cmd);
}
public static Octets CreateGetAllDataCommand(bool byPack, bool byEquip, bool byTask)
{
var cmd = new CMD_GetAllData
@@ -615,7 +615,7 @@ namespace CSNetwork.GPDataType
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_host_attacked
public struct cmd_host_attacked
{
public int idAttacker;
public int iDamage;
@@ -789,7 +789,22 @@ namespace CSNetwork.GPDataType
public override string ToString() => $"({x}, {y}, {z})";
}
// PVP mask
[Flags]
public enum PVPMask
{
GP_PVPMASK_FORCE = 0x0001, // Ç¿Á¦¹¥»÷
GP_PVPMASK_NOMAFIA = 0x0002,
GP_PVPMASK_NOWHITE = 0x0004,
GP_PVPMASK_NOALLIANCE = 0x0008,
GP_PVPMASK_NOFORCE = 0x0010,//²»¹¥»÷Í¬ÊÆÁ¦µÄ
GP_BLSMASK_NORED = 0x0008,
GP_BLSMASK_NOMAFIA = 0x0010,
GP_BLSMASK_SELF = 0x0020,
GP_BLSMASK_NOALLIANCE = 0x0040,
GP_BLSMASK_NOFORCE = 0x0080, // ÊÆÁ¦ÆÁ±Î
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_self_info_1
{
@@ -807,19 +822,19 @@ namespace CSNetwork.GPDataType
//TO DO: Check Valid
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_self_info_00
public struct cmd_self_info_00
{
public short sLevel;
public byte State;
public byte Level2;
public int iHP;
public int iMaxHP;
public int iMP;
public int iMaxMP;
public int iExp;
public int iSP;
public int iAP;
public int iMaxAP;
public short sLevel;
public byte State;
public byte Level2;
public int iHP;
public int iMaxHP;
public int iMP;
public int iMaxMP;
public int iExp;
public int iSP;
public int iAP;
public int iMaxAP;
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@@ -975,7 +990,7 @@ namespace CSNetwork.GPDataType
{
public int cash_amount;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_unfreeze_ivtr_slot
{
@@ -1028,8 +1043,8 @@ namespace CSNetwork.GPDataType
public int expire_date;
public uint amount;
public uint slot_amount;
public byte where;
public byte index;
public byte where;
public byte index;
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct cmd_pickup_item
@@ -1216,7 +1231,33 @@ namespace CSNetwork.GPDataType
public const float MIN_MOVELEN_ON_GROUND = 0.5f;
public const float MIN_MOVELEN_FOR_DETECT_VIBRATION = 0.05f;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_skill_data
{
public uint skill_count;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SKILL
{
public short id_skill;
public byte level;
public short ability;
}
public SKILL[] skill_list;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_scene_service_npc_list
{
public uint count;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct NpcEntry
{
public int tid; // npc template id
public int nid; // npc id
}
public NpcEntry[] list;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct cmd_npc_info_list
{
@@ -1,22 +1,23 @@
using System.Text;
using System;
using BrewMonster;
using BrewMonster.Managers;
using BrewMonster.Scripts.Player;
using BrewMonster.Scripts.Skills;
using CSNetwork.C2SCommand;
using CSNetwork.GPDataType;
using CSNetwork.Protocols;
using CSNetwork.Protocols.RPCData;
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Text;
using System.Threading.Tasks;
using CommandID = CSNetwork.GPDataType.CommandID;
using System.IO;
using System.Diagnostics;
using System.Numerics;
using CSNetwork.C2SCommand;
using CSNetwork.GPDataType;
using BrewMonster;
using BrewMonster.Managers;
using BrewMonster.Scripts.Player;
namespace CSNetwork
{
@@ -409,7 +410,6 @@ namespace CSNetwork
case CommandID.PLAYER_INFO_1_LIST:
case CommandID.PLAYER_INFO_00:
case CommandID.SELF_INFO_1:
// OnMsgPlayerInfo(-1, pDataBuf, pCmdHeader);
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERINFO, (int)MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf,
pCmdHeader, iHostID, _selectedRole);
break;
@@ -430,18 +430,18 @@ namespace CSNetwork
break;
case CommandID.OBJECT_STOP_MOVE:
{
int id1 = GPDataTypeHelper.FromBytes<int>(pDataBuf);
if (ISPLAYERID(id1))
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERSTOPMOVE, (int)MANAGER_INDEX.MAN_PLAYER, -1,
pDataBuf, pCmdHeader);
}
else if (ISNPCID(id1))
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCSTOPMOVE, (int)MANAGER_INDEX.MAN_NPC, 0, pDataBuf,
pCmdHeader);
}
int id1 = GPDataTypeHelper.FromBytes<int>(pDataBuf);
if (ISPLAYERID(id1))
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERSTOPMOVE, (int)MANAGER_INDEX.MAN_PLAYER, -1,
pDataBuf, pCmdHeader);
}
else if (ISNPCID(id1))
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCSTOPMOVE, (int)MANAGER_INDEX.MAN_NPC, 0, pDataBuf,
pCmdHeader);
}
break;
}
@@ -480,11 +480,11 @@ namespace CSNetwork
pDataBuf, pCmdHeader);
break;
case CommandID.PLAYER_CASH:
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_IVTRINFO, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf,
pCmdHeader, iHostID);
break;
}
{
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_IVTRINFO, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf,
pCmdHeader, iHostID);
break;
}
case CommandID.MATTER_INFO_LIST:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_MM_MATTERINFO, (int)MANAGER_INDEX.MAN_MATTER, 0, pDataBuf,
pCmdHeader);
@@ -556,12 +556,10 @@ namespace CSNetwork
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCATKRESULT, MANAGER_INDEX.MAN_NPC, 0, pDataBuf, pCmdHeader);
break;
case CommandID.HOST_ATTACKRESULT:
_logger.Info($"HOST_ATTACKRESULT: " + pCmdHeader);
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_ATKRESULT, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf,
pCmdHeader);
break;
case CommandID.HOST_ATTACKED:
_logger.Info($"HOST_ATTACKED: " + pCmdHeader);
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_ATTACKED, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf,
pCmdHeader);
break;
@@ -607,8 +605,7 @@ namespace CSNetwork
pGameUI->EndNPCService();*/
}
else if
(pCmd.iMessage ==
108 /*&& pGameRun->GetHostPlayer()->GetOfflineShopCtrl()->GetNPCSevFlag() != COfflineShopCtrl::NPCSEV_NULL*/
(pCmd.iMessage == 108 /*&& pGameRun->GetHostPlayer()->GetOfflineShopCtrl()->GetNPCSevFlag() != COfflineShopCtrl::NPCSEV_NULL*/
)
{
/* CECGameUIMan* pGameUI = pGameRun->GetUIManager()->GetInGameUIMan();
@@ -637,23 +634,31 @@ namespace CSNetwork
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCDIED, MANAGER_INDEX.MAN_NPC, 0, pDataBuf, pCmdHeader);
break;
case CommandID.OBJECT_DISAPPEAR:
{
int lenghtDataType1 = Marshal.SizeOf<int>();
byte[] arrByteData1 = GetBytes(pDataBuf, lenghtDataType1, 0);
int idObjMove1 = BitConverter.ToInt32(arrByteData1);
if (ISPLAYERID(idObjMove1))
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERDISAPPEAR, MANAGER_INDEX.MAN_PLAYER, -1,
pDataBuf, pCmdHeader);
else if (ISNPCID(idObjMove1))
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCDISAPPEAR, MANAGER_INDEX.MAN_NPC, 0, pDataBuf,
pCmdHeader);
{
int lenghtDataType1 = Marshal.SizeOf<int>();
byte[] arrByteData1 = GetBytes(pDataBuf, lenghtDataType1, 0);
int idObjMove1 = BitConverter.ToInt32(arrByteData1);
if (ISPLAYERID(idObjMove1))
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERDISAPPEAR, MANAGER_INDEX.MAN_PLAYER, -1,
pDataBuf, pCmdHeader);
else if (ISNPCID(idObjMove1))
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCDISAPPEAR, MANAGER_INDEX.MAN_NPC, 0, pDataBuf,
pCmdHeader);
break;
}
break;
}
case CommandID.SELF_INFO_00:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_INFO00, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf,
pCmdHeader);
break;
case CommandID.SCENE_SERVICE_NPC_LIST:
{
CECHostSkillModel.Instance.RecvNPCServiceList(protocol.Data);
break;
}
case CommandID.SKILL_DATA:
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_SKILLDATA, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
break;
case CommandID.LEVEL_UP:
{
cmd_level_up pCmdLevelUp = GPDataTypeHelper.FromBytes<cmd_level_up>(pDataBuf);;
@@ -666,41 +671,6 @@ namespace CSNetwork
}
}
public void OnMsgPlayerInfo(int iSubID, byte[] data, ushort pCmdHeader)
{
if (iSubID == 0)
{
}
else if (iSubID < 0)
{
int iHostID = _selectedRole.roleid;
int lenghtByte = Marshal.SizeOf<int>();
byte[] byteArray = new byte[lenghtByte];
for (int i = 0; i < lenghtByte; i++)
{
byteArray[i] = data[i];
}
int cid = BitConverter.ToInt32(byteArray);
switch (pCmdHeader)
{
case CommandID.PLAYER_INFO_1:
case CommandID.PLAYER_ENTER_WORLD:
case CommandID.PLAYER_ENTER_SLICE:
{
if (cid != iHostID)
{
_logger.Info("### OnMsgPlayerInfo: ElsePlayer join");
}
break;
}
}
}
else
{
}
}
private void HandleSelectRoleResponse(SelectRole_Re protocol)
{
@@ -933,6 +903,15 @@ namespace CSNetwork
C2SCommandFactory.CreatePlayerMove(vCurPos, vDest, (ushort)iTime, fSpeed, (byte)iMoveMode, wStamp);
SendProtocol(gamedatasend);
}
public void c2s_CmdCastSkill(int idSkill, byte byPVPMask, int iNumTarget, int aTargets)
{
gamedatasend gamedatasend = new gamedatasend();
gamedatasend.Data =
C2SCommandFactory.CreatePlayerCastSkill(idSkill, byPVPMask, iNumTarget, aTargets);
SendProtocol(gamedatasend);
}
public void c2s_SendCmdStopMove(in Vector3 vDest, float fSpeed, int iMoveMode,
byte byDir, ushort wStamp, int iTime)
@@ -944,6 +923,12 @@ namespace CSNetwork
SendProtocol(gamedatasend);
}
public void c2s_CmdSendEnterPKPrecinctint()
{
gamedatasend gamedatasend = new gamedatasend();
gamedatasend.Data = C2SCommandFactory.CreateNakeCmd(C2SCommand.CommandID.ENTER_PK_PROTECTED);
SendProtocol(gamedatasend);
}
public void SendChatData(byte cChannel, in string szMsg, int iPack, int iSlot)
{
publicchat publicChat = new publicchat();
@@ -307,15 +307,6 @@ namespace CSNetwork
_receiveOctets.Capacity,
token
);
// if (bytesRead > 0)
// {
// _logger.Log(LogType.Info, $"ProcessReceivedData:: Last Byte: {_receiveOctets.RawBuffer[currentBufferLength + bytesRead - 1]}");
// if (_previousLength > 0)
// _logger.Log(LogType.Info, $"ProcessReceivedData:: Buffer remaining data size from {_previousLength} to {currentBufferLength + bytesRead} --- Last byte: {_receiveOctets.RawBuffer[_previousLength - 1]}");
// }
//
// _previousLength = currentBufferLength + bytesRead; // cache to check if the buffer is growing
}
catch (IOException ex)
when (ex.InnerException is SocketException se
@@ -17,7 +17,10 @@ namespace CSNetwork
_buffer = new byte[capacity];
_size = 0;
}
public void Clear()
{
_size = 0; // reset logical length
}
public Octets(byte[] data)
{
if (data == null)
@@ -72,7 +72,10 @@ namespace BrewMonster.Network
Instance._ip = ip;
Instance._port = port;
}
public static void c2s_CmdCastSkill(int idSkill, byte byPVPMask, int iNumTarget, int aTargets)
{
Instance._gameSession.c2s_CmdCastSkill(idSkill, byPVPMask, iNumTarget, aTargets);
}
public static async Task Login(string username, string password, Action<bool> onLoginComplete = null)
{
Instance._username = username;
@@ -254,7 +257,10 @@ namespace BrewMonster.Network
{
Instance._gameSession.c2s_CmdSelectTarget(idTarget);
}
public static void c2s_CmdSendEnterPKPrecinct()
{
Instance._gameSession.c2s_CmdSendEnterPKPrecinctint();
}
#region Task
public static void c2s_CmdGetAllData(bool byPack, bool byEquip, bool byTask)
{
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4d8aa48b7719fb24ea83a779c1bf10eb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
using System;
using UnityEngine;
namespace BrewMonster
{
public class CECObservableChange : IDisposable
{
public virtual void Dispose()
{
// Cleanup logic here
}
};
public class CECObserver
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 85f9d76b7820b1445aefd08f3f700001
@@ -0,0 +1,23 @@
using UnityEngine;
namespace BrewMonster
{
public enum ActionContextType
{
AC_NONE = 0,
AC_RIDETOFLY,
AC_RIDETOSKILL,
AC_FLYTORIDE,
AC_RIDETOUSETARGETITEM,
}
public class CECActionContext
{
public ActionContextType ContextType { get; set; }
public bool IsContext(ActionContextType contextType)
{
return ContextType == contextType;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 540c5cee0c186fc468d10477343db08f
@@ -0,0 +1,99 @@
using BrewMonster.Assets.PerfectWorld.Scripts.Players;
using UnityEngine;
namespace BrewMonster
{
public class CECActionSwitcher : CECActionSwitcherBase
{
private System.Collections.Generic.List<CECActionContext> m_actionContexts =
new System.Collections.Generic.List<CECActionContext>();
public CECActionSwitcher(CECHostPlayer pHost) : base(pHost)
{
}
public void Tick(float deltaTime)
{
ProcessMessage();
// Convert DWORD to uint for milliseconds (Unity deltaTime is in seconds)
uint dt = (uint)(deltaTime * 1000f);
// Iterate backwards to safely remove items during iteration
for (int i = m_actionContexts.Count - 1; i >= 0; i--)
{
CECActionContext pContext = m_actionContexts[i];
if (pContext != null)
{
/*pContext.Update(dt);
if (pContext.NeedBeRemoved())
{
// In C#, we just remove from list - GC handles cleanup
m_actionContexts.RemoveAt(i);
}*/
}
else
{
m_actionContexts.RemoveAt(i);
}
}
}
public void ProcessMessage()
{
for (int i = 0; i < m_msgs.Count; i++)
{
EMsgActionSwitcher eMsg = (EMsgActionSwitcher)m_msgs[i];
switch (eMsg)
{
/* case EMsgActionSwitcher.MSG_FLY:
{
OnFly();
}
break;
case EMsgActionSwitcher.MSG_MOUNTPET:
{
OnRide();
}
break;*/
case EMsgActionSwitcher.MSG_CASTSKILL:
{
OnCastSkill();
}
break;
}
}
m_msgs.Clear();
}
public void OnCastSkill()
{
RemoveRideFlyRelatedContext();
}
public void RemoveRideFlyRelatedContext()
{
// Iterate backwards to safely remove items while iterating
for (int i = m_actionContexts.Count - 1; i >= 0; i--)
{
CECActionContext context = m_actionContexts[i];
if (context != null)
{
bool isRelated = context.IsContext(ActionContextType.AC_FLYTORIDE)
|| context.IsContext(ActionContextType.AC_RIDETOSKILL)
|| context.IsContext(ActionContextType.AC_RIDETOFLY)
|| context.IsContext(ActionContextType.AC_RIDETOUSETARGETITEM);
if (isRelated)
{
// In C#, we don't need explicit delete - GC will handle it
// But if context implements IDisposable, call Dispose() here
if (context is System.IDisposable disposable)
{
disposable.Dispose();
}
m_actionContexts.RemoveAt(i);
}
}
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 04f7866e9c0cb8f49828b88ed3f8caeb
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrewMonster.Assets.PerfectWorld.Scripts.Players
{
public class CECActionSwitcherBase
{
CECHostPlayer m_pHostPlayer;
bool m_bCanAddMsg;
protected List<int> m_msgs = new List<int>();
List<CECActionContext> m_actionContexts;
public CECActionSwitcherBase(CECHostPlayer pHost)
{
m_pHostPlayer = pHost;
}
public virtual bool OnRideToSkillAction(int skill, bool bCom, int iSel, int iForceAtk) { return false; }
public bool CanAddMessage() { return m_bCanAddMsg; }
public void PostMessge(int msg)
{
if (CanAddMessage())
m_msgs.UniquelyAdd(msg);
}
}
public enum EMsgActionSwitcher
{
MSG_FLY = 0,
MSG_MOUNTPET,
MSG_CASTSKILL,
};
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 89b7392ff459f7446843305c44b262dd
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrewMonster.Assets.PerfectWorld.Scripts.Players
{
public class CECPlayerWrapper
{
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fad92b0f2869eb0459d2e0a2dc6bb74e
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0dedb87fb40f4f19a0a958e12fbf1832
timeCreated: 1760588049
@@ -0,0 +1,63 @@
using BrewMonster.Network;
using BrewMonster.Scripts.Skills;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity.VisualScripting;
using static BrewMonster.SkillArrayWrapper;
namespace BrewMonster.Assets.PerfectWorld.Scripts.Skills
{
public class CECSCSkill
{
CECSkill m_pSkill;
public bool Init(CECSkill pSkill)
{
m_pSkill = pSkill;
return true;
}
public bool Execute()
{
if (m_pSkill == null)
return false;
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
if (ElementSkill.IsGoblinSkill((uint)m_pSkill.GetSkillID()))
{
/* int idSelected = pHost->GetSelectedTarget();
bool bForctAttack = glb_GetForceAttackFlag(NULL);
CECHostGoblin* pHostGoblin = (CECHostGoblin*)pHost->GetGoblinModel();
int i;
for (i = 0; i < pHostGoblin->GetSkillNum(); i++)
{
if (m_pSkill == pHostGoblin->GetSkill(i))
{
break;
}
}
if (i < pHostGoblin->GetSkillNum())
{
a_LogOutput(1, "HoangDev: Shortcut: pHostGoblin->GetSkillNum()");
pHostGoblin->CastSkill(i, idSelected, bForctAttack);
}*/
}
else
{
//BMLogger.LogError("HoangDev: Shortcut: IsGoblinSkill else");
if (pHost.GetActionSwitcher() == null || !pHost.GetActionSwitcher().OnRideToSkillAction(m_pSkill.GetSkillID(), false, 0, -1))
{
//BMLogger.LogError("HoangDev: Shortcut: pHost->GetActionSwitcher()");
pHost.ApplySkillShortcut(m_pSkill.GetSkillID());
}
}
return true;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 521292c25e4a79a40b44eb732d0faa91
@@ -0,0 +1,428 @@
using CSNetwork;
using CSNetwork.GPDataType;
using ModelRenderer.Scripts.GameData;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace BrewMonster.Scripts.Skills
{
public class CECHostSkillModel
{
public static CECHostSkillModel instance;
public static CECHostSkillModel Instance
{
get
{
if (instance == null)
{
instance = new CECHostSkillModel();
}
return instance;
}
set => instance = value;
}
Dictionary<int, ElementSkill> m_allProfSkills = new Dictionary<int, ElementSkill>();
Dictionary<int, List<int>> m_allRankProfSkills = new Dictionary<int, List<int>>();
private HashSet<int> m_allProfNPCs = new HashSet<int>();
private Dictionary<int, int> m_treeHeightMap = new Dictionary<int, int>();
private Dictionary<int, int> m_evilRootMap = new Dictionary<int, int>();
private Dictionary<int, int> m_godRootMap = new Dictionary<int, int>();
private Dictionary<int, int> m_baseRootMap = new Dictionary<int, int>();
private int m_skillLearnNPCNID;
private bool m_bInitialized;
private Octets m_npcListData;
public void Initialize()
{
// Çå¿ÕËùÓм¼ÄÜ£¬·ÀÖ¹ÒòΪ¶à¸ö½ÇÉ«µÇ¼µ¼ÖÂÖØ¸´¼ÓÔØ¼¼ÄÜ
Release();
InitAllSkillsOfCurProf();
FindAllNPCsOfCurProf();
HashSet<int> rootSkills = GetRootSkillSet();
InitSkillTreeHeightMap(rootSkills);
InitSkillTreeRootMap(rootSkills);
m_bInitialized = true;
// ÖØÐ´¦ÀíNPCLIST
ProcessServiceList();
}
public void ProcessServiceList()
{
if (m_npcListData == null)
{
BMLogger.LogWarning("CECHostSkillModel::ProcessServiceList, m_npcListData is null.");
return;
}
if (m_npcListData.Size > 0)
{
byte[] data = m_npcListData.RawBuffer;
int headerSize = Marshal.SizeOf(typeof(cmd_header));
int offset = headerSize;
int bodySize = m_npcListData.Size - offset;
byte[] bodyBytes = new byte[bodySize];
Buffer.BlockCopy(data, offset, bodyBytes, 0, bodySize);
cmd_scene_service_npc_list npcList = default;
npcList.count = GPDataTypeHelper.FromBytes<uint>(bodyBytes);
offset = sizeof(uint);
int NpcEntrySize = Marshal.SizeOf<cmd_scene_service_npc_list.NpcEntry>();
npcList.list = new cmd_scene_service_npc_list.NpcEntry[npcList.count];
for (int z = 0; z < npcList.count; z++)
{
npcList.list[z] = GPDataTypeHelper.FromBytes<cmd_scene_service_npc_list.NpcEntry>(bodyBytes, offset);
offset += NpcEntrySize;
}
int i;
for (i = 0; i < npcList.count; i++)
{
int tid = npcList.list[i].tid;
if (m_allProfNPCs.Contains(tid))
{
if (m_skillLearnNPCNID != npcList.list[i].nid)
{
m_skillLearnNPCNID = npcList.list[i].nid;
SetCurServiceSkills(tid);
var change = new CECSkillPanelChange(CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_NPC, 0, 0);
//NotifyObservers(change);
break;
}
}
}
if (i == npcList.count && m_skillLearnNPCNID != 0)
{
m_skillLearnNPCNID = 0;
SetCurServiceSkills(0);
var change = new CECSkillPanelChange(CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_NPC, 0, 0);
//NotifyObservers(change);
}
m_npcListData.Clear();
}
}
private readonly HashSet<int> m_curServiceSkills = new HashSet<int>();
public void SetCurServiceSkills(int tid)
{
m_curServiceSkills.Clear();
if (tid == 0)
return;
var pDB = ElementDataManProvider.GetElementDataMan();
// Read NPC_ESSENCE from element data
DATA_TYPE dt = default;
var dataprt = pDB.get_data_ptr((uint)tid, ID_SPACE.ID_SPACE_ESSENCE, ref dt);
if (dataprt == null)
return;
var npcEssence = (NPC_ESSENCE)dataprt;
// Get skill service block from id_skill_service
var dataprt2 = pDB.get_data_ptr(npcEssence.id_skill_service, ID_SPACE.ID_SPACE_ESSENCE, ref dt);
if (dataprt2 == null)
return;
var skillService = (NPC_SKILL_SERVICE)dataprt2;
// Copy all non-zero skill ids into m_curServiceSkills
foreach (int skillId in skillService.id_skills)
{
if (skillId != 0)
m_curServiceSkills.Add(skillId);
}
}
public void RecvNPCServiceList(Octets Data)
{
m_npcListData = Data;
if (!m_bInitialized)
{
return;
}
else
{
ProcessServiceList();
}
}
private void InitSkillTreeRootMap(IEnumerable<int> rootSkills)
{
foreach (int rootSkillID in rootSkills)
{
InitializeRootOfSkillTree(rootSkillID);
}
}
private void InitializeRootOfSkillTree(int rootSkillID)
{
var skillRootMap = GetSkillRootMap(rootSkillID);
var toTravelSkills = new Queue<int>();
toTravelSkills.Enqueue(rootSkillID);
while (toTravelSkills.Count > 0)
{
int skillID = toTravelSkills.Dequeue();
var juniors = GetJunior(skillID);
foreach (var (id, level) in juniors)
{
int juniorSkillID = (int)id;
skillRootMap[juniorSkillID] = rootSkillID;
toTravelSkills.Enqueue(juniorSkillID);
}
}
}
private Dictionary<int, int> GetSkillRootMap(int rootSkillID)
{
var skill = m_allProfSkills[rootSkillID];
var taoistRank = CECTaoistRank.GetTaoistRank(skill.GetRank());
if (taoistRank.IsEvilRank())
return m_evilRootMap;
else if (taoistRank.IsGodRank())
return m_godRootMap;
else
return m_baseRootMap;
}
private void InitSkillTreeHeightMap(IEnumerable<int> rootSkills)
{
foreach (var rootSkillID in rootSkills)
{
m_treeHeightMap[rootSkillID] = GetSkillTreeHeight(rootSkillID);
}
}
private int GetSkillTreeHeight(int rootSkillID)
{
var juniors = GetJunior(rootSkillID);
int maxHeight = 0;
for (int i = 0; i < juniors.Count; i++)
{
int subHeight = GetSkillTreeHeight((int)juniors[i].id);
if (subHeight > maxHeight)
{
maxHeight = subHeight;
}
}
return 1 + maxHeight;
}
private List<(uint id, int level)> GetJunior(int skillID)
{
if (!m_allProfSkills.TryGetValue(skillID, out var skill))
{
throw new Exception($"Skill {skillID} not found in m_allProfSkills");
}
var juniors = skill.GetJunior();
var ret = new List<(uint id, int level)>();
foreach (var (id, level) in juniors)
{
if (id != 0)
ret.Add((id, level));
}
return ret;
}
private HashSet<int> GetRootSkillSet()
{
var rootSkills = new HashSet<int>();
foreach (var kvp in m_allProfSkills)
if (kvp.Value.GetJunior().Count != 0)
rootSkills.Add(kvp.Key);
foreach (var kvp in m_allProfSkills)
foreach (var (id, level) in kvp.Value.GetJunior())
rootSkills.Remove((int)id);
return rootSkills;
}
private void FindAllNPCsOfCurProf()
{
DATA_TYPE dt = DATA_TYPE.DT_NPC_ESSENCE;
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
var map = pDB.GetAllDataTypeWithType(ID_SPACE.ID_SPACE_ESSENCE, dt);
foreach (var obj in map)
{
NPC_ESSENCE npcEssence = (NPC_ESSENCE)obj;
if (npcEssence.id_skill_service != 0 &&
(npcEssence.combined_switch & (uint)NPC_COMBINED_SWITCH.NCS_IGNORE_DISTANCE_CHECK) != 0)
{
NPC_SKILL_SERVICE skillService = (NPC_SKILL_SERVICE)pDB.get_data_ptr(npcEssence.id_skill_service, ID_SPACE.ID_SPACE_ESSENCE, ref dt);
bool profCorrect = false;
for (int i = 0; i < skillService.id_skills.Length; i++)
{
if (skillService.id_skills[i] != 0)
{
ElementSkill pSkill = ElementSkill.Create(skillService.id_skills[i], 1);
if (pSkill == null) return;
if (pSkill.GetCls() == CECGameRun.Instance.GetHostPlayer().GetProfession())
{
// NPCǰְҵܣҪ¼NPCID
profCorrect = true;
break;
}
}
}
if (profCorrect)
{
m_allProfNPCs.Add((int)npcEssence.id);
}
}
}
}
public void InitAllSkillsOfCurProf()
{
// --- B1: Thu thập toàn bộ skill từ các NPC có cung cấp dịch vụ học skill ---
HashSet<uint> npcSkills = new HashSet<uint>();
{
elementdataman pDB = ElementDataManProvider.GetElementDataMan();
DATA_TYPE dt = DATA_TYPE.DT_NPC_ESSENCE;
// uint id = pDB.get_id_with_data_type(ID_SPACE.ID_SPACE_ESSENCE, dt);
var map = pDB.GetAllDataTypeWithType(ID_SPACE.ID_SPACE_ESSENCE, dt);
foreach (var obj in map)
{
NPC_ESSENCE npcEssence = (NPC_ESSENCE)obj;
if (npcEssence.id_skill_service != 0 &&
(npcEssence.combined_switch & (uint)NPC_COMBINED_SWITCH.NCS_IGNORE_DISTANCE_CHECK) != 0)
{
NPC_SKILL_SERVICE skillService = (NPC_SKILL_SERVICE)pDB.get_data_ptr(
npcEssence.id_skill_service, ID_SPACE.ID_SPACE_ESSENCE, ref dt
);
for (int i = 0; i < skillService.id_skills.Length; i++)
{
uint skillId = skillService.id_skills[i];
if (skillId != 0 &&
CECComboSkillState.Instance.GetInherentSkillByID(skillId) == null)
{
npcSkills.Add(skillId);
}
}
}
}
}
// --- B2: Duyệt tất cả skill, lọc skill theo class hiện tại của người chơi ---
uint curID = 0;
while ((curID = ElementSkill.NextSkill(curID)) != 0)
{
ElementSkill pSkill = ElementSkill.Create(curID, 1);
int cls = pSkill.GetCls();
int playerCls = CECGameRun.Instance.GetHostPlayer().GetProfession();
bool isSameClass = (cls == playerCls || cls == 255);
bool isProvidedByNPC = npcSkills.Contains(curID);
if (isSameClass && isProvidedByNPC)
{
m_allProfSkills[(int)curID] = pSkill;
if (!m_allRankProfSkills.ContainsKey(pSkill.GetRank()))
m_allRankProfSkills[pSkill.GetRank()] = new List<int>();
m_allRankProfSkills[pSkill.GetRank()].Add((int)curID);
}
}
// --- B3: Sắp xếp skill trong từng rank theo thứ tự hiển thị ---
foreach (var kvp in m_allRankProfSkills)
{
kvp.Value.Sort((lhs, rhs) =>
{
var lSkill = ElementSkill.Create((uint)lhs, 1);
var rSkill = ElementSkill.Create((uint)rhs, 1);
bool result;
if (lSkill.GetType() == (byte)skill_type.TYPE_PASSIVE &&
rSkill.GetType() != (byte)skill_type.TYPE_PASSIVE)
{
result = false;
}
else if (lSkill.GetType() != (byte)skill_type.TYPE_PASSIVE &&
rSkill.GetType() == (byte)skill_type.TYPE_PASSIVE)
{
result = true;
}
else
{
result = lSkill.GetShowOrder() < rSkill.GetShowOrder();
}
return result ? -1 : 1;
});
}
}
private void Release()
{
m_allProfSkills.Clear();
// Dọn sạch tất cả dictionary / map
m_allProfSkills.Clear();
m_allRankProfSkills.Clear();
m_evilRootMap.Clear();
m_godRootMap.Clear();
m_baseRootMap.Clear();
m_treeHeightMap.Clear();
m_allProfNPCs.Clear();
m_curServiceSkills.Clear();
m_skillLearnNPCNID = 0;
m_bInitialized = false;
}
}
public enum enumSkillFitLevelState
{
SKILL_FIT_LEVEL, // ȼ / Skill meets level, cultivation, realm requirements
SKILL_NOT_FIT_LEVEL, // ܲȼ / Skill does not meet level, cultivation, realm requirements
}
public enum enumSkillLearnedState
{
SKILL_NOT_LEARNED, // δѧϰ / Skill not learned
SKILL_LEARNED, // ѧϰ / Skill learned but not at max level
SKILL_FULL, // / Skill at max level
SKILL_OVERRIDDEN, // ѱ / Skill has been overridden
}
public enum enumEvilGod
{
SKILL_BASE, // ͨ / Normal skill
SKILL_EVIL, // ɼ / Immortal skill
SKILL_GOD, // ħ / Demonic skill
}
public class CECSkillPanelChange : CECObservableChange
{
public enum enumChangeMask
{
CHANGE_SKILL_LEVEL_UP, // Skill level up
CHANGE_SKILL_OVERRIDDEN, // Skill overridden
CHANGE_SKILL_NPC // NPC providing skill changed
}
public enumChangeMask m_changeMask;
public int m_skillID;
public int m_skillLevel;
public CECSkillPanelChange(enumChangeMask mask, int id, int level)
{
m_changeMask = mask;
m_skillID = id;
m_skillLevel = level;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0ac9cd34c55ab4c668b852e4e2d6a67c
@@ -0,0 +1,251 @@
using BrewMonster.Assets.PerfectWorld.Scripts.Skills;
using CSNetwork.GPDataType;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Unity.VisualScripting;
namespace BrewMonster.Scripts.Skills
{
public enum skill_type
{
TYPE_ATTACK = 1, // Attack //
TYPE_BLESS = 2, // Blessing // ף
TYPE_CURSE = 3, // Curse //
TYPE_SUMMON = 4, // Summon // Ʒ
TYPE_PASSIVE = 5, // Passive //
TYPE_ENABLED = 6, // Enabled //
TYPE_LIVE = 7, // Live //
TYPE_JUMP = 8, // Jump // ˲
TYPE_PRODUCE = 9, // Production (Crafting) // ()
TYPE_BLESSPET = 10, // Pet Blessing // ף
TYPE_NEUTRALBLESS = 11, // Neutral Blessing // ף
};
public enum range_type
{
TYPE_POINT = 0, //
TYPE_LINE = 1, //
TYPE_SELFSPHERE = 2, // Ϊĵ
TYPE_TARGETSPHERE = 3, // ĿΪĵ
TYPE_TAPER = 4, // Բ׶
TYPE_SLEF = 5, //
};
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct LearnRequirement
{
public int level; // ȼҪ // Level requirement
public int sp; // ܵ // Skill points
public int money; // Ǯ // Money
public int profession; // ְҵ // Profession
public int rank; // ׼ // Rank level
public int realm_level; // ȼ // Realm level
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct PetRequirement
{
public int level; // ȼ // Level requirement
public int sp; // ܵ // Pet skill points
public int list; // б // Pet skill list
public int lsize; // бС // List size
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct GoblinRequirement
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public int[] genius; // С츳 // Goblin skill talents
public int profession; // ְҵ // Profession
public int sp; // Ԫ // Spirit points
public int money; // Ǯ // Money
public int level; // Сȼ // Goblin level
public int mp; // С鵱ǰħ // Current magic points
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ComboSkillState
{
public const int MAX_COMBO_ARG = 3;
public uint skillid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_COMBO_ARG)]
public int[] arg;
}
public struct UseRequirement
{
public int mp; //ħ // Magic points
public int ap; //ŭֵ // Anger points
public int form; //״̬ // Form state
public int weapon; // // Weapon
public int freepackage; //ʣĿ // Remaining inventory slots
public int arrow; //װ֧Ŀ // Number of arrows loaded
public int move_env; //ƶ // Movement environment
public bool is_combat; //Ƿս״̬ // Whether in combat state
public int hp; //ǰhp // Current HP
public int max_hp; //hp // Maximum HP
// public ComboSkillState combo_state; // // Combo skill state
};
public struct GoblinUseRequirement
{
public int mp; //)
public int ap; //()
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public int[] genius; //С
public int profession; //ְҵ
public int level; //Сȼڼ?
public int move_env; //˵ǰƶ
};
public class SkillStr
{
public virtual string Find(int id) { return ""; }
}
public enum SKILL_STATE
{
SKILL_PERFORM,
SKILL_DONE,
}
public class ElementSkill
{
public const byte FORM_MASK_HIGH = 0xC0;
public const byte FORM_NORMAL = 0; //̬ͨ
public const byte FORM_CLASS = 1; //ְҵ
public const byte FORM_BEASTIE = 2; //С
public static uint NextSkill(uint id = 0)
{
//TODO: Implement this
var map = SkillStub.GetMap();
// if map is empty, return 0
if (map.Count == 0)
return 0;
// If start == 0, return the first entrys value
if (id == 0)
{
var first = map.First();
return first.Value.GetId();
}
// Try to find 'start' key
var keys = map.Keys.OrderBy(k => k).ToList();
int index = keys.IndexOf(id);
if (index == -1 || index + 1 >= keys.Count)
return 0; // no next skill
var nextKey = keys[index + 1];
return map[nextKey].GetId();
}
public static ElementSkill Create(uint id, int n)
{
return Skill.Create(id, n);
}
public virtual Dictionary<uint, int> GetJunior()
{
return new Dictionary<uint, int>();
}
public virtual string GetName() { return null; }
public virtual byte[] GetNativeName() { return null; }
// ?,skill_type
public virtual byte GetType() { return 1; }
// ͼ
public virtual string GetIcon() { return null; }
// ˵
public virtual string GetIntroduction(StringBuilder buf, int len, SkillStr table) { return ""; }
// ְҵ
public virtual int GetCls() { return -1; }
// ȴʱλ
public virtual int GetCoolingTime() { return 5000; }
// ִʱλ
public virtual int GetExecuteTime() { return 1000; }
// Ŀ, 0:Ŀ꣬1:ҪĿ꣬2:Ŀ?, 3:Ŀ?, 4:Ŀ?
public virtual int GetTargetType() { return 0; }
// Чͷž: <-0.001Ŀ -0.001-0.001 ĬϹ룬>0.001 ͷž
public virtual float GetPrayRange(float range, float prayplus) { return 0; }
public static bool IsGoblinSkill(uint id)
{
SkillStub s = SkillStub.GetStub(id);
return s != null && (s.GetCls() == 258);
}
public static void LoadSkillData(cmd_skill_data data)
{
SkillWrapper.Instance.LoadData(data);
}
public virtual int GetRank() { return 0; }
// ѧϰnҪҼ
public virtual int GetRequiredLevel() { return 0; }
// ѧϰnҪļܵ
public virtual int GetRequiredSp() { return 0; }
// ѧϰnҪļ
public virtual int GetRequiredBook() { return 0; }
// ѧϰҪǮ
public virtual int GetRequiredMoney() { return 0; }
// ѧϰ󾳽ȼ?
public virtual int GetRequiredRealmLevel() { return 0; }
// ǰ
public virtual Dictionary<uint, int> GetRequiredSkill() => new Dictionary<uint, int>();
// ʾ˳
public virtual int GetShowOrder() { return 0; }
// üܼ
public virtual int SetLevel(int level) { return 0; }
// 󼶱?
public virtual int GetMaxLevel() { return 0; }
// Ƿ
public virtual bool IsWarmup() { return false; }
// ʹúǷԶ
public virtual bool IsAutoAttack() { return false; }
// ˲
public virtual bool IsInstant() { return false; }
// Ƿ?
public virtual bool IsDurative() { return false; }
// ɱ˷Χ
public virtual int GetRangeType() { return 0; }
// ͷŻС桢ˮ
public virtual int GetCastEnv() { return 0; }
// ȡСѧϰͷż
public virtual int GetRequiredGenius(int idSkill) { return 0; }
// Чļ
public virtual byte[] GetEffect() { return null; }
public virtual byte[] GetElseEffect() { return null; }
// ʹҪMP
public virtual int GetMpCost() { return 1; }
// ʹҪAP
public virtual int GetApCost() { return 0; }
// ֧
public virtual int GetArrowCost() { return 0; }
// ж
public virtual bool ValidWeapon(int w) { return true; }
// 0, ɹ1ƥ䣻2, mp㣻3λ㣻4?5ID, 6δѡĿ
public int Condition(UseRequirement info)
{
return 0;
}
public virtual bool IsAllowLand() { return true; }
public virtual bool IsAllowWater() { return true; }
public virtual bool IsAllowAir() { return true; }
public virtual bool GetNotuseInCombat() { return false; }
//Ƿƶʩ
public virtual bool IsMovingSkill() { return false; }
// ܷڵǰ״̬ʹ
public bool IsValidForm(byte form)
{
byte form_type = (byte)((form & FORM_MASK_HIGH) >> 6);
return ((GetAllowForms() & (1 << form_type)) != 0);
}
public virtual byte GetAllowForms() { return 0; }
public virtual bool Interrupt() { return true; }
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fc68b472f6584455b9960c566b282a3e
@@ -0,0 +1,190 @@
using System.Runtime.InteropServices;
using UnityEngine;
namespace BrewMonster
{
public class PlayerInfo { }
public struct ComboArg
{
public const int MAX_COMBO_ARG = 3;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_COMBO_ARG)]
public int[] arg;
public int GetValue(uint index)
{
if (arg == null)
arg = new int[MAX_COMBO_ARG];
return index < MAX_COMBO_ARG ? arg[index] : 0;
}
public void SetValue(uint index, int value)
{
if (arg == null)
arg = new int[MAX_COMBO_ARG];
if (index < MAX_COMBO_ARG)
arg[index] = value;
}
}
public class PlayerWrapper
{
public float range;
public float pray_range_plus;
public int elf_level;
public ComboArg comboarg;
private PlayerInfo object_;
public PlayerWrapper()
{
range = 0;
pray_range_plus = 0;
elf_level = 0;
comboarg = new ComboArg { arg = new int[ComboArg.MAX_COMBO_ARG] };
}
public PlayerWrapper(PlayerInfo o)
{
range = 0;
pray_range_plus = 0;
elf_level = 0;
object_ = o;
comboarg = new ComboArg { arg = new int[ComboArg.MAX_COMBO_ARG] };
}
public int GetLevel() { return 50; }
public void SetRange(float r) { range = r; }
public void SetPrayrangeplus(float p) { pray_range_plus = p; }
public int GetMP()
{
return 10000;
}
public int GetMp()
{
return 0;
}
public int GetSp()
{
return 10000;
}
public bool IsRiding()
{
return false;
}
public bool IsUsingWeapon(int weapon)
{
return true;
}
public bool HasSkillBook(uint id)
{
return true;
}
public bool SetDecsp(int sp)
{
return true;
}
public bool SetDistance(float d)
{
return true;
}
public float GetWeapondistance()
{
return -1;
}
public bool SetDecmp(int m)
{
return true;
}
public bool SetPray(bool value)
{
return true;
}
public bool SetInform(bool value)
{
return true;
}
public bool SetPerform(bool value)
{
return true;
}
public bool SetDamage(int value)
{
return true;
}
public int GetPerform()
{
return 1;
}
public int GetDamage()
{
return 1;
}
public float GetRange()
{
return range;
}
public float GetPrayrangeplus()
{
return pray_range_plus;
}
public bool SetCheckbook(int i) { return true; }
public int GetCheckbook() { return 0; }
public bool SetCheckmoney(int m) { return true; }
public int GetCheckmoney() { return 0; }
public bool SetUsebook(int i) { return true; }
public int GetUsebook() { return 0; }
public bool SetUsemoney(int m) { return true; }
public int GetUsemoney() { return 0; }
public void SetElflevel(int iLevel) { elf_level = iLevel; }
public int GetElflevel() { return elf_level; }
public ref ComboArg GetComboarg() { return ref comboarg; }
public int GetForm() { return 0; }
}
public class TargetWrapper
{
public int id;
public TargetWrapper(int i)
{
id = i;
}
public bool IsValid() { return -1 != id; }
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 04cb4df0f3d12eb45a583da23d83ad5d
@@ -0,0 +1,526 @@
using BrewMonster.Scripts.Skills;
using UnityEngine;
namespace BrewMonster
{
public static class SkillStubs
{
public static void Init() { int i = 0; }
// Skill stub declarations
public static Skill1Stub __stub_Skill1Stub = new Skill1Stub();
/*public static Skill2Stub __stub_Skill2Stub = new Skill2Stub();
public static Skill3Stub __stub_Skill3Stub = new Skill3Stub();
public static Skill4Stub __stub_Skill4Stub = new Skill4Stub();
public static Skill5Stub __stub_Skill5Stub = new Skill5Stub();
public static Skill6Stub __stub_Skill6Stub = new Skill6Stub();
public static Skill54Stub __stub_Skill54Stub = new Skill54Stub();
public static Skill55Stub __stub_Skill55Stub = new Skill55Stub();
public static Skill56Stub __stub_Skill56Stub = new Skill56Stub();
public static Skill57Stub __stub_Skill57Stub = new Skill57Stub();
public static Skill58Stub __stub_Skill58Stub = new Skill58Stub();
public static Skill59Stub __stub_Skill59Stub = new Skill59Stub();
public static Skill60Stub __stub_Skill60Stub = new Skill60Stub();
public static Skill61Stub __stub_Skill61Stub = new Skill61Stub();
public static Skill62Stub __stub_Skill62Stub = new Skill62Stub();
public static Skill63Stub __stub_Skill63Stub = new Skill63Stub();
public static Skill64Stub __stub_Skill64Stub = new Skill64Stub();
public static Skill65Stub __stub_Skill65Stub = new Skill65Stub();
public static Skill66Stub __stub_Skill66Stub = new Skill66Stub();
public static Skill67Stub __stub_Skill67Stub = new Skill67Stub();
public static Skill68Stub __stub_Skill68Stub = new Skill68Stub();
public static Skill69Stub __stub_Skill69Stub = new Skill69Stub();
public static Skill70Stub __stub_Skill70Stub = new Skill70Stub();
public static Skill71Stub __stub_Skill71Stub = new Skill71Stub();
public static Skill72Stub __stub_Skill72Stub = new Skill72Stub();
public static Skill73Stub __stub_Skill73Stub = new Skill73Stub();
public static Skill74Stub __stub_Skill74Stub = new Skill74Stub();
public static Skill75Stub __stub_Skill75Stub = new Skill75Stub();
public static Skill76Stub __stub_Skill76Stub = new Skill76Stub();
public static Skill77Stub __stub_Skill77Stub = new Skill77Stub();
public static Skill78Stub __stub_Skill78Stub = new Skill78Stub();
public static Skill79Stub __stub_Skill79Stub = new Skill79Stub();
public static Skill80Stub __stub_Skill80Stub = new Skill80Stub();
public static Skill176Stub __stub_Skill176Stub = new Skill176Stub();
public static Skill177Stub __stub_Skill177Stub = new Skill177Stub();
public static Skill178Stub __stub_Skill178Stub = new Skill178Stub();
public static Skill179Stub __stub_Skill179Stub = new Skill179Stub();
public static Skill187Stub __stub_Skill187Stub = new Skill187Stub();
public static Skill226Stub __stub_Skill226Stub = new Skill226Stub();
public static Skill227Stub __stub_Skill227Stub = new Skill227Stub();
public static Skill362Stub __stub_Skill362Stub = new Skill362Stub();
public static Skill363Stub __stub_Skill363Stub = new Skill363Stub();
public static Skill374Stub __stub_Skill374Stub = new Skill374Stub();
public static Skill375Stub __stub_Skill375Stub = new Skill375Stub();
public static Skill376Stub __stub_Skill376Stub = new Skill376Stub();
public static Skill377Stub __stub_Skill377Stub = new Skill377Stub();
public static Skill378Stub __stub_Skill378Stub = new Skill378Stub();
public static Skill379Stub __stub_Skill379Stub = new Skill379Stub();
public static Skill380Stub __stub_Skill380Stub = new Skill380Stub();
public static Skill381Stub __stub_Skill381Stub = new Skill381Stub();
public static Skill382Stub __stub_Skill382Stub = new Skill382Stub();
public static Skill383Stub __stub_Skill383Stub = new Skill383Stub();
public static Skill384Stub __stub_Skill384Stub = new Skill384Stub();
public static Skill385Stub __stub_Skill385Stub = new Skill385Stub();
public static Skill386Stub __stub_Skill386Stub = new Skill386Stub();
public static Skill387Stub __stub_Skill387Stub = new Skill387Stub();
public static Skill388Stub __stub_Skill388Stub = new Skill388Stub();
public static Skill389Stub __stub_Skill389Stub = new Skill389Stub();
public static Skill390Stub __stub_Skill390Stub = new Skill390Stub();
public static Skill391Stub __stub_Skill391Stub = new Skill391Stub();
public static Skill392Stub __stub_Skill392Stub = new Skill392Stub();
public static Skill393Stub __stub_Skill393Stub = new Skill393Stub();
public static Skill394Stub __stub_Skill394Stub = new Skill394Stub();
public static Skill395Stub __stub_Skill395Stub = new Skill395Stub();
public static Skill396Stub __stub_Skill396Stub = new Skill396Stub();
public static Skill397Stub __stub_Skill397Stub = new Skill397Stub();
public static Skill398Stub __stub_Skill398Stub = new Skill398Stub();
public static Skill399Stub __stub_Skill399Stub = new Skill399Stub();
public static Skill400Stub __stub_Skill400Stub = new Skill400Stub();
public static Skill401Stub __stub_Skill401Stub = new Skill401Stub();
public static Skill402Stub __stub_Skill402Stub = new Skill402Stub();
public static Skill403Stub __stub_Skill403Stub = new Skill403Stub();
public static Skill404Stub __stub_Skill404Stub = new Skill404Stub();
public static Skill405Stub __stub_Skill405Stub = new Skill405Stub();
public static Skill406Stub __stub_Skill406Stub = new Skill406Stub();
public static Skill407Stub __stub_Skill407Stub = new Skill407Stub();
public static Skill408Stub __stub_Skill408Stub = new Skill408Stub();
public static Skill409Stub __stub_Skill409Stub = new Skill409Stub();
public static Skill410Stub __stub_Skill410Stub = new Skill410Stub();
public static Skill411Stub __stub_Skill411Stub = new Skill411Stub();
public static Skill412Stub __stub_Skill412Stub = new Skill412Stub();
public static Skill413Stub __stub_Skill413Stub = new Skill413Stub();
public static Skill414Stub __stub_Skill414Stub = new Skill414Stub();
public static Skill415Stub __stub_Skill415Stub = new Skill415Stub();
public static Skill416Stub __stub_Skill416Stub = new Skill416Stub();
public static Skill417Stub __stub_Skill417Stub = new Skill417Stub();
public static Skill418Stub __stub_Skill418Stub = new Skill418Stub();
public static Skill419Stub __stub_Skill419Stub = new Skill419Stub();
public static Skill420Stub __stub_Skill420Stub = new Skill420Stub();
public static Skill421Stub __stub_Skill421Stub = new Skill421Stub();
public static Skill422Stub __stub_Skill422Stub = new Skill422Stub();
public static Skill423Stub __stub_Skill423Stub = new Skill423Stub();
public static Skill424Stub __stub_Skill424Stub = new Skill424Stub();
public static Skill425Stub __stub_Skill425Stub = new Skill425Stub();
public static Skill426Stub __stub_Skill426Stub = new Skill426Stub();
public static Skill427Stub __stub_Skill427Stub = new Skill427Stub();
public static Skill428Stub __stub_Skill428Stub = new Skill428Stub();
public static Skill429Stub __stub_Skill429Stub = new Skill429Stub();
public static Skill430Stub __stub_Skill430Stub = new Skill430Stub();
public static Skill431Stub __stub_Skill431Stub = new Skill431Stub();
public static Skill432Stub __stub_Skill432Stub = new Skill432Stub();
public static Skill433Stub __stub_Skill433Stub = new Skill433Stub();
public static Skill434Stub __stub_Skill434Stub = new Skill434Stub();
public static Skill435Stub __stub_Skill435Stub = new Skill435Stub();
public static Skill436Stub __stub_Skill436Stub = new Skill436Stub();
public static Skill437Stub __stub_Skill437Stub = new Skill437Stub();
public static Skill438Stub __stub_Skill438Stub = new Skill438Stub();
public static Skill439Stub __stub_Skill439Stub = new Skill439Stub();
public static Skill896Stub __stub_Skill896Stub = new Skill896Stub();
public static Skill897Stub __stub_Skill897Stub = new Skill897Stub();
public static Skill898Stub __stub_Skill898Stub = new Skill898Stub();
public static Skill899Stub __stub_Skill899Stub = new Skill899Stub();
public static Skill900Stub __stub_Skill900Stub = new Skill900Stub();
public static Skill923Stub __stub_Skill923Stub = new Skill923Stub();
public static Skill924Stub __stub_Skill924Stub = new Skill924Stub();
public static Skill1195Stub __stub_Skill1195Stub = new Skill1195Stub();
public static Skill1815Stub __stub_Skill1815Stub = new Skill1815Stub();
public static Skill1816Stub __stub_Skill1816Stub = new Skill1816Stub();
public static Skill1817Stub __stub_Skill1817Stub = new Skill1817Stub();
public static Skill1818Stub __stub_Skill1818Stub = new Skill1818Stub();
public static Skill1819Stub __stub_Skill1819Stub = new Skill1819Stub();
public static Skill1868Stub __stub_Skill1868Stub = new Skill1868Stub();
public static Skill1871Stub __stub_Skill1871Stub = new Skill1871Stub();
public static Skill1872Stub __stub_Skill1872Stub = new Skill1872Stub();
public static Skill2206Stub __stub_Skill2206Stub = new Skill2206Stub();
public static Skill2207Stub __stub_Skill2207Stub = new Skill2207Stub();
public static Skill2208Stub __stub_Skill2208Stub = new Skill2208Stub();
public static Skill2209Stub __stub_Skill2209Stub = new Skill2209Stub();
public static Skill2210Stub __stub_Skill2210Stub = new Skill2210Stub();
public static Skill2211Stub __stub_Skill2211Stub = new Skill2211Stub();
public static Skill2352Stub __stub_Skill2352Stub = new Skill2352Stub();
public static Skill2367Stub __stub_Skill2367Stub = new Skill2367Stub();
public static Skill2368Stub __stub_Skill2368Stub = new Skill2368Stub();
public static Skill2369Stub __stub_Skill2369Stub = new Skill2369Stub();
public static Skill2370Stub __stub_Skill2370Stub = new Skill2370Stub();
public static Skill2371Stub __stub_Skill2371Stub = new Skill2371Stub();
public static Skill2372Stub __stub_Skill2372Stub = new Skill2372Stub();
public static Skill2373Stub __stub_Skill2373Stub = new Skill2373Stub();
public static Skill2374Stub __stub_Skill2374Stub = new Skill2374Stub();
public static Skill2375Stub __stub_Skill2375Stub = new Skill2375Stub();
public static Skill7Stub __stub_Skill7Stub = new Skill7Stub();
public static Skill8Stub __stub_Skill8Stub = new Skill8Stub();
public static Skill9Stub __stub_Skill9Stub = new Skill9Stub();
public static Skill10Stub __stub_Skill10Stub = new Skill10Stub();
public static Skill53Stub __stub_Skill53Stub = new Skill53Stub();
public static Skill81Stub __stub_Skill81Stub = new Skill81Stub();
public static Skill84Stub __stub_Skill84Stub = new Skill84Stub();
public static Skill85Stub __stub_Skill85Stub = new Skill85Stub();
public static Skill86Stub __stub_Skill86Stub = new Skill86Stub();
public static Skill87Stub __stub_Skill87Stub = new Skill87Stub();
public static Skill88Stub __stub_Skill88Stub = new Skill88Stub();
public static Skill89Stub __stub_Skill89Stub = new Skill89Stub();
public static Skill90Stub __stub_Skill90Stub = new Skill90Stub();
public static Skill91Stub __stub_Skill91Stub = new Skill91Stub();
public static Skill92Stub __stub_Skill92Stub = new Skill92Stub();
public static Skill93Stub __stub_Skill93Stub = new Skill93Stub();
public static Skill94Stub __stub_Skill94Stub = new Skill94Stub();
public static Skill95Stub __stub_Skill95Stub = new Skill95Stub();
public static Skill96Stub __stub_Skill96Stub = new Skill96Stub();
public static Skill97Stub __stub_Skill97Stub = new Skill97Stub();
public static Skill98Stub __stub_Skill98Stub = new Skill98Stub();
public static Skill99Stub __stub_Skill99Stub = new Skill99Stub();
public static Skill100Stub __stub_Skill100Stub = new Skill100Stub();
public static Skill101Stub __stub_Skill101Stub = new Skill101Stub();
public static Skill180Stub __stub_Skill180Stub = new Skill180Stub();
public static Skill181Stub __stub_Skill181Stub = new Skill181Stub();
public static Skill182Stub __stub_Skill182Stub = new Skill182Stub();
public static Skill183Stub __stub_Skill183Stub = new Skill183Stub();
public static Skill184Stub __stub_Skill184Stub = new Skill184Stub();
public static Skill228Stub __stub_Skill228Stub = new Skill228Stub();
public static Skill229Stub __stub_Skill229Stub = new Skill229Stub();
public static Skill364Stub __stub_Skill364Stub = new Skill364Stub();
public static Skill365Stub __stub_Skill365Stub = new Skill365Stub();
public static Skill440Stub __stub_Skill440Stub = new Skill440Stub();
public static Skill441Stub __stub_Skill441Stub = new Skill441Stub();
public static Skill442Stub __stub_Skill442Stub = new Skill442Stub();
public static Skill443Stub __stub_Skill443Stub = new Skill443Stub();
public static Skill444Stub __stub_Skill444Stub = new Skill444Stub();
public static Skill445Stub __stub_Skill445Stub = new Skill445Stub();
public static Skill446Stub __stub_Skill446Stub = new Skill446Stub();
public static Skill447Stub __stub_Skill447Stub = new Skill447Stub();
public static Skill448Stub __stub_Skill448Stub = new Skill448Stub();
public static Skill449Stub __stub_Skill449Stub = new Skill449Stub();
public static Skill450Stub __stub_Skill450Stub = new Skill450Stub();
public static Skill451Stub __stub_Skill451Stub = new Skill451Stub();
public static Skill452Stub __stub_Skill452Stub = new Skill452Stub();
public static Skill453Stub __stub_Skill453Stub = new Skill453Stub();
public static Skill454Stub __stub_Skill454Stub = new Skill454Stub();
public static Skill455Stub __stub_Skill455Stub = new Skill455Stub();
public static Skill456Stub __stub_Skill456Stub = new Skill456Stub();
public static Skill457Stub __stub_Skill457Stub = new Skill457Stub();
public static Skill458Stub __stub_Skill458Stub = new Skill458Stub();
public static Skill459Stub __stub_Skill459Stub = new Skill459Stub();
public static Skill460Stub __stub_Skill460Stub = new Skill460Stub();
public static Skill461Stub __stub_Skill461Stub = new Skill461Stub();
public static Skill462Stub __stub_Skill462Stub = new Skill462Stub();
public static Skill463Stub __stub_Skill463Stub = new Skill463Stub();
public static Skill464Stub __stub_Skill464Stub = new Skill464Stub();
public static Skill465Stub __stub_Skill465Stub = new Skill465Stub();
public static Skill466Stub __stub_Skill466Stub = new Skill466Stub();
public static Skill467Stub __stub_Skill467Stub = new Skill467Stub();
public static Skill468Stub __stub_Skill468Stub = new Skill468Stub();
public static Skill469Stub __stub_Skill469Stub = new Skill469Stub();
public static Skill470Stub __stub_Skill470Stub = new Skill470Stub();
public static Skill471Stub __stub_Skill471Stub = new Skill471Stub();
public static Skill472Stub __stub_Skill472Stub = new Skill472Stub();
public static Skill473Stub __stub_Skill473Stub = new Skill473Stub();
public static Skill474Stub __stub_Skill474Stub = new Skill474Stub();
public static Skill475Stub __stub_Skill475Stub = new Skill475Stub();
public static Skill476Stub __stub_Skill476Stub = new Skill476Stub();
public static Skill477Stub __stub_Skill477Stub = new Skill477Stub();
public static Skill478Stub __stub_Skill478Stub = new Skill478Stub();
public static Skill479Stub __stub_Skill479Stub = new Skill479Stub();
public static Skill480Stub __stub_Skill480Stub = new Skill480Stub();
public static Skill481Stub __stub_Skill481Stub = new Skill481Stub();
public static Skill482Stub __stub_Skill482Stub = new Skill482Stub();
public static Skill483Stub __stub_Skill483Stub = new Skill483Stub();
public static Skill484Stub __stub_Skill484Stub = new Skill484Stub();
public static Skill485Stub __stub_Skill485Stub = new Skill485Stub();
public static Skill486Stub __stub_Skill486Stub = new Skill486Stub();
public static Skill487Stub __stub_Skill487Stub = new Skill487Stub();
public static Skill488Stub __stub_Skill488Stub = new Skill488Stub();
public static Skill489Stub __stub_Skill489Stub = new Skill489Stub();
public static Skill490Stub __stub_Skill490Stub = new Skill490Stub();
public static Skill491Stub __stub_Skill491Stub = new Skill491Stub();
public static Skill901Stub __stub_Skill901Stub = new Skill901Stub();
public static Skill902Stub __stub_Skill902Stub = new Skill902Stub();
public static Skill903Stub __stub_Skill903Stub = new Skill903Stub();
public static Skill904Stub __stub_Skill904Stub = new Skill904Stub();
public static Skill905Stub __stub_Skill905Stub = new Skill905Stub();
public static Skill925Stub __stub_Skill925Stub = new Skill925Stub();
public static Skill926Stub __stub_Skill926Stub = new Skill926Stub();
public static Skill1805Stub __stub_Skill1805Stub = new Skill1805Stub();
public static Skill1806Stub __stub_Skill1806Stub = new Skill1806Stub();
public static Skill1807Stub __stub_Skill1807Stub = new Skill1807Stub();
public static Skill1808Stub __stub_Skill1808Stub = new Skill1808Stub();
public static Skill1809Stub __stub_Skill1809Stub = new Skill1809Stub();
public static Skill1864Stub __stub_Skill1864Stub = new Skill1864Stub();
public static Skill1865Stub __stub_Skill1865Stub = new Skill1865Stub();
public static Skill1873Stub __stub_Skill1873Stub = new Skill1873Stub();
public static Skill1874Stub __stub_Skill1874Stub = new Skill1874Stub();
public static Skill1951Stub __stub_Skill1951Stub = new Skill1951Stub();
public static Skill2254Stub __stub_Skill2254Stub = new Skill2254Stub();
public static Skill2255Stub __stub_Skill2255Stub = new Skill2255Stub();
public static Skill2256Stub __stub_Skill2256Stub = new Skill2256Stub();
public static Skill2257Stub __stub_Skill2257Stub = new Skill2257Stub();
public static Skill2258Stub __stub_Skill2258Stub = new Skill2258Stub();
public static Skill2259Stub __stub_Skill2259Stub = new Skill2259Stub();
public static Skill2260Stub __stub_Skill2260Stub = new Skill2260Stub();
public static Skill2261Stub __stub_Skill2261Stub = new Skill2261Stub();
public static Skill2262Stub __stub_Skill2262Stub = new Skill2262Stub();
public static Skill2263Stub __stub_Skill2263Stub = new Skill2263Stub();
public static Skill2264Stub __stub_Skill2264Stub = new Skill2264Stub();
public static Skill2265Stub __stub_Skill2265Stub = new Skill2265Stub();
public static Skill2452Stub __stub_Skill2452Stub = new Skill2452Stub();
public static Skill2453Stub __stub_Skill2453Stub = new Skill2453Stub();*/
#if SKILL_SERVER
public static Skill1 __stub_Skill1 = new Skill1();
public static Skill2 __stub_Skill2 = new Skill2();
public static Skill3 __stub_Skill3 = new Skill3();
public static Skill4 __stub_Skill4 = new Skill4();
public static Skill5 __stub_Skill5 = new Skill5();
public static Skill6 __stub_Skill6 = new Skill6();
public static Skill54 __stub_Skill54 = new Skill54();
public static Skill55 __stub_Skill55 = new Skill55();
public static Skill56 __stub_Skill56 = new Skill56();
public static Skill57 __stub_Skill57 = new Skill57();
public static Skill58 __stub_Skill58 = new Skill58();
public static Skill59 __stub_Skill59 = new Skill59();
public static Skill60 __stub_Skill60 = new Skill60();
public static Skill61 __stub_Skill61 = new Skill61();
public static Skill62 __stub_Skill62 = new Skill62();
public static Skill63 __stub_Skill63 = new Skill63();
public static Skill64 __stub_Skill64 = new Skill64();
public static Skill65 __stub_Skill65 = new Skill65();
public static Skill66 __stub_Skill66 = new Skill66();
public static Skill67 __stub_Skill67 = new Skill67();
public static Skill68 __stub_Skill68 = new Skill68();
public static Skill69 __stub_Skill69 = new Skill69();
public static Skill70 __stub_Skill70 = new Skill70();
public static Skill71 __stub_Skill71 = new Skill71();
public static Skill72 __stub_Skill72 = new Skill72();
public static Skill73 __stub_Skill73 = new Skill73();
public static Skill74 __stub_Skill74 = new Skill74();
public static Skill75 __stub_Skill75 = new Skill75();
public static Skill76 __stub_Skill76 = new Skill76();
public static Skill77 __stub_Skill77 = new Skill77();
public static Skill78 __stub_Skill78 = new Skill78();
public static Skill79 __stub_Skill79 = new Skill79();
public static Skill80 __stub_Skill80 = new Skill80();
public static Skill176 __stub_Skill176 = new Skill176();
public static Skill177 __stub_Skill177 = new Skill177();
public static Skill178 __stub_Skill178 = new Skill178();
public static Skill179 __stub_Skill179 = new Skill179();
public static Skill187 __stub_Skill187 = new Skill187();
public static Skill226 __stub_Skill226 = new Skill226();
public static Skill227 __stub_Skill227 = new Skill227();
public static Skill362 __stub_Skill362 = new Skill362();
public static Skill363 __stub_Skill363 = new Skill363();
public static Skill374 __stub_Skill374 = new Skill374();
public static Skill375 __stub_Skill375 = new Skill375();
public static Skill376 __stub_Skill376 = new Skill376();
public static Skill377 __stub_Skill377 = new Skill377();
public static Skill378 __stub_Skill378 = new Skill378();
public static Skill379 __stub_Skill379 = new Skill379();
public static Skill380 __stub_Skill380 = new Skill380();
public static Skill381 __stub_Skill381 = new Skill381();
public static Skill382 __stub_Skill382 = new Skill382();
public static Skill383 __stub_Skill383 = new Skill383();
public static Skill384 __stub_Skill384 = new Skill384();
public static Skill385 __stub_Skill385 = new Skill385();
public static Skill386 __stub_Skill386 = new Skill386();
public static Skill387 __stub_Skill387 = new Skill387();
public static Skill388 __stub_Skill388 = new Skill388();
public static Skill389 __stub_Skill389 = new Skill389();
public static Skill390 __stub_Skill390 = new Skill390();
public static Skill391 __stub_Skill391 = new Skill391();
public static Skill392 __stub_Skill392 = new Skill392();
public static Skill393 __stub_Skill393 = new Skill393();
public static Skill394 __stub_Skill394 = new Skill394();
public static Skill395 __stub_Skill395 = new Skill395();
public static Skill396 __stub_Skill396 = new Skill396();
public static Skill397 __stub_Skill397 = new Skill397();
public static Skill398 __stub_Skill398 = new Skill398();
public static Skill399 __stub_Skill399 = new Skill399();
public static Skill400 __stub_Skill400 = new Skill400();
public static Skill401 __stub_Skill401 = new Skill401();
public static Skill402 __stub_Skill402 = new Skill402();
public static Skill403 __stub_Skill403 = new Skill403();
public static Skill404 __stub_Skill404 = new Skill404();
public static Skill405 __stub_Skill405 = new Skill405();
public static Skill406 __stub_Skill406 = new Skill406();
public static Skill407 __stub_Skill407 = new Skill407();
public static Skill408 __stub_Skill408 = new Skill408();
public static Skill409 __stub_Skill409 = new Skill409();
public static Skill410 __stub_Skill410 = new Skill410();
public static Skill411 __stub_Skill411 = new Skill411();
public static Skill412 __stub_Skill412 = new Skill412();
public static Skill413 __stub_Skill413 = new Skill413();
public static Skill414 __stub_Skill414 = new Skill414();
public static Skill415 __stub_Skill415 = new Skill415();
public static Skill416 __stub_Skill416 = new Skill416();
public static Skill417 __stub_Skill417 = new Skill417();
public static Skill418 __stub_Skill418 = new Skill418();
public static Skill419 __stub_Skill419 = new Skill419();
public static Skill420 __stub_Skill420 = new Skill420();
public static Skill421 __stub_Skill421 = new Skill421();
public static Skill422 __stub_Skill422 = new Skill422();
public static Skill423 __stub_Skill423 = new Skill423();
public static Skill424 __stub_Skill424 = new Skill424();
public static Skill425 __stub_Skill425 = new Skill425();
public static Skill426 __stub_Skill426 = new Skill426();
public static Skill427 __stub_Skill427 = new Skill427();
public static Skill428 __stub_Skill428 = new Skill428();
public static Skill429 __stub_Skill429 = new Skill429();
public static Skill430 __stub_Skill430 = new Skill430();
public static Skill431 __stub_Skill431 = new Skill431();
public static Skill432 __stub_Skill432 = new Skill432();
public static Skill433 __stub_Skill433 = new Skill433();
public static Skill434 __stub_Skill434 = new Skill434();
public static Skill435 __stub_Skill435 = new Skill435();
public static Skill436 __stub_Skill436 = new Skill436();
public static Skill437 __stub_Skill437 = new Skill437();
public static Skill438 __stub_Skill438 = new Skill438();
public static Skill439 __stub_Skill439 = new Skill439();
public static Skill896 __stub_Skill896 = new Skill896();
public static Skill897 __stub_Skill897 = new Skill897();
public static Skill898 __stub_Skill898 = new Skill898();
public static Skill899 __stub_Skill899 = new Skill899();
public static Skill900 __stub_Skill900 = new Skill900();
public static Skill923 __stub_Skill923 = new Skill923();
public static Skill924 __stub_Skill924 = new Skill924();
public static Skill1195 __stub_Skill1195 = new Skill1195();
public static Skill1815 __stub_Skill1815 = new Skill1815();
public static Skill1816 __stub_Skill1816 = new Skill1816();
public static Skill1817 __stub_Skill1817 = new Skill1817();
public static Skill1818 __stub_Skill1818 = new Skill1818();
public static Skill1819 __stub_Skill1819 = new Skill1819();
public static Skill1868 __stub_Skill1868 = new Skill1868();
public static Skill1871 __stub_Skill1871 = new Skill1871();
public static Skill1872 __stub_Skill1872 = new Skill1872();
public static Skill2206 __stub_Skill2206 = new Skill2206();
public static Skill2207 __stub_Skill2207 = new Skill2207();
public static Skill2208 __stub_Skill2208 = new Skill2208();
public static Skill2209 __stub_Skill2209 = new Skill2209();
public static Skill2210 __stub_Skill2210 = new Skill2210();
public static Skill2211 __stub_Skill2211 = new Skill2211();
public static Skill2352 __stub_Skill2352 = new Skill2352();
public static Skill2367 __stub_Skill2367 = new Skill2367();
public static Skill2368 __stub_Skill2368 = new Skill2368();
public static Skill2369 __stub_Skill2369 = new Skill2369();
public static Skill2370 __stub_Skill2370 = new Skill2370();
public static Skill2371 __stub_Skill2371 = new Skill2371();
public static Skill2372 __stub_Skill2372 = new Skill2372();
public static Skill2373 __stub_Skill2373 = new Skill2373();
public static Skill2374 __stub_Skill2374 = new Skill2374();
public static Skill2375 __stub_Skill2375 = new Skill2375();
public static Skill7 __stub_Skill7 = new Skill7();
public static Skill8 __stub_Skill8 = new Skill8();
public static Skill9 __stub_Skill9 = new Skill9();
public static Skill10 __stub_Skill10 = new Skill10();
public static Skill53 __stub_Skill53 = new Skill53();
public static Skill81 __stub_Skill81 = new Skill81();
public static Skill84 __stub_Skill84 = new Skill84();
public static Skill85 __stub_Skill85 = new Skill85();
public static Skill86 __stub_Skill86 = new Skill86();
public static Skill87 __stub_Skill87 = new Skill87();
public static Skill88 __stub_Skill88 = new Skill88();
public static Skill89 __stub_Skill89 = new Skill89();
public static Skill90 __stub_Skill90 = new Skill90();
public static Skill91 __stub_Skill91 = new Skill91();
public static Skill92 __stub_Skill92 = new Skill92();
public static Skill93 __stub_Skill93 = new Skill93();
public static Skill94 __stub_Skill94 = new Skill94();
public static Skill95 __stub_Skill95 = new Skill95();
public static Skill96 __stub_Skill96 = new Skill96();
public static Skill97 __stub_Skill97 = new Skill97();
public static Skill98 __stub_Skill98 = new Skill98();
public static Skill99 __stub_Skill99 = new Skill99();
public static Skill100 __stub_Skill100 = new Skill100();
public static Skill101 __stub_Skill101 = new Skill101();
public static Skill180 __stub_Skill180 = new Skill180();
public static Skill181 __stub_Skill181 = new Skill181();
public static Skill182 __stub_Skill182 = new Skill182();
public static Skill183 __stub_Skill183 = new Skill183();
public static Skill184 __stub_Skill184 = new Skill184();
public static Skill228 __stub_Skill228 = new Skill228();
public static Skill229 __stub_Skill229 = new Skill229();
public static Skill364 __stub_Skill364 = new Skill364();
public static Skill365 __stub_Skill365 = new Skill365();
public static Skill440 __stub_Skill440 = new Skill440();
public static Skill441 __stub_Skill441 = new Skill441();
public static Skill442 __stub_Skill442 = new Skill442();
public static Skill443 __stub_Skill443 = new Skill443();
public static Skill444 __stub_Skill444 = new Skill444();
public static Skill445 __stub_Skill445 = new Skill445();
public static Skill446 __stub_Skill446 = new Skill446();
public static Skill447 __stub_Skill447 = new Skill447();
public static Skill448 __stub_Skill448 = new Skill448();
public static Skill449 __stub_Skill449 = new Skill449();
public static Skill450 __stub_Skill450 = new Skill450();
public static Skill451 __stub_Skill451 = new Skill451();
public static Skill452 __stub_Skill452 = new Skill452();
public static Skill453 __stub_Skill453 = new Skill453();
public static Skill454 __stub_Skill454 = new Skill454();
public static Skill455 __stub_Skill455 = new Skill455();
public static Skill456 __stub_Skill456 = new Skill456();
public static Skill457 __stub_Skill457 = new Skill457();
public static Skill458 __stub_Skill458 = new Skill458();
public static Skill459 __stub_Skill459 = new Skill459();
public static Skill460 __stub_Skill460 = new Skill460();
public static Skill461 __stub_Skill461 = new Skill461();
public static Skill462 __stub_Skill462 = new Skill462();
public static Skill463 __stub_Skill463 = new Skill463();
public static Skill464 __stub_Skill464 = new Skill464();
public static Skill465 __stub_Skill465 = new Skill465();
public static Skill466 __stub_Skill466 = new Skill466();
public static Skill467 __stub_Skill467 = new Skill467();
public static Skill468 __stub_Skill468 = new Skill468();
public static Skill469 __stub_Skill469 = new Skill469();
public static Skill470 __stub_Skill470 = new Skill470();
public static Skill471 __stub_Skill471 = new Skill471();
public static Skill472 __stub_Skill472 = new Skill472();
public static Skill473 __stub_Skill473 = new Skill473();
public static Skill474 __stub_Skill474 = new Skill474();
public static Skill475 __stub_Skill475 = new Skill475();
public static Skill476 __stub_Skill476 = new Skill476();
public static Skill477 __stub_Skill477 = new Skill477();
public static Skill478 __stub_Skill478 = new Skill478();
public static Skill479 __stub_Skill479 = new Skill479();
public static Skill480 __stub_Skill480 = new Skill480();
public static Skill481 __stub_Skill481 = new Skill481();
public static Skill482 __stub_Skill482 = new Skill482();
public static Skill483 __stub_Skill483 = new Skill483();
public static Skill484 __stub_Skill484 = new Skill484();
public static Skill485 __stub_Skill485 = new Skill485();
public static Skill486 __stub_Skill486 = new Skill486();
public static Skill487 __stub_Skill487 = new Skill487();
public static Skill488 __stub_Skill488 = new Skill488();
public static Skill489 __stub_Skill489 = new Skill489();
public static Skill490 __stub_Skill490 = new Skill490();
public static Skill491 __stub_Skill491 = new Skill491();
public static Skill901 __stub_Skill901 = new Skill901();
public static Skill902 __stub_Skill902 = new Skill902();
public static Skill903 __stub_Skill903 = new Skill903();
public static Skill904 __stub_Skill904 = new Skill904();
public static Skill905 __stub_Skill905 = new Skill905();
public static Skill925 __stub_Skill925 = new Skill925();
public static Skill926 __stub_Skill926 = new Skill926();
public static Skill1805 __stub_Skill1805 = new Skill1805();
public static Skill1806 __stub_Skill1806 = new Skill1806();
public static Skill1807 __stub_Skill1807 = new Skill1807();
public static Skill1808 __stub_Skill1808 = new Skill1808();
public static Skill1809 __stub_Skill1809 = new Skill1809();
public static Skill1864 __stub_Skill1864 = new Skill1864();
public static Skill1865 __stub_Skill1865 = new Skill1865();
public static Skill1873 __stub_Skill1873 = new Skill1873();
public static Skill1874 __stub_Skill1874 = new Skill1874();
public static Skill1951 __stub_Skill1951 = new Skill1951();
public static Skill2254 __stub_Skill2254 = new Skill2254();
public static Skill2255 __stub_Skill2255 = new Skill2255();
public static Skill2256 __stub_Skill2256 = new Skill2256();
public static Skill2257 __stub_Skill2257 = new Skill2257();
public static Skill2258 __stub_Skill2258 = new Skill2258();
public static Skill2259 __stub_Skill2259 = new Skill2259();
public static Skill2260 __stub_Skill2260 = new Skill2260();
public static Skill2261 __stub_Skill2261 = new Skill2261();
public static Skill2262 __stub_Skill2262 = new Skill2262();
public static Skill2263 __stub_Skill2263 = new Skill2263();
public static Skill2264 __stub_Skill2264 = new Skill2264();
public static Skill2265 __stub_Skill2265 = new Skill2265();
public static Skill2452 __stub_Skill2452 = new Skill2452();
public static Skill2453 __stub_Skill2453 = new Skill2453();
#endif
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: de0c956f1778a204c99aab11791923eb
@@ -0,0 +1,36 @@
using BrewMonster.Assets.PerfectWorld.Scripts.Common;
using CSNetwork.GPDataType;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrewMonster.Assets.PerfectWorld.Scripts.Skills
{
public struct PersistentData
{
public int ability; // ÊìÁ·¶È
public int level; // ¼¶±ð
public PersistentData(int _t = 0, int _l = 1) { ability = (_t); level = (_l); }
};
public class SkillWrapper : Singleton<SkillWrapper>
{
Dictionary<uint, PersistentData> map = new Dictionary<uint, PersistentData>();
public void LoadData(cmd_skill_data pdata)
{
map.Clear();
PersistentData skill;
for (int i = 0; i < (int)pdata.skill_count; i++)
{
cmd_skill_data.SKILL item = pdata.skill_list[i];
skill.level = item.level;
skill.ability = item.ability;
map[(uint)item.id_skill] = skill;
}
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9475bf4d7aee23340a1a7444cafb502e
+224
View File
@@ -0,0 +1,224 @@
using System.Collections.Generic;
namespace BrewMonster.Scripts.Skills
{
public class Range
{
/// <summary>0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self</summary>
public byte type; // 0 1 2 3Ŀ 4Բ׶ 5
public bool IsPoint() { return type == 0; }
public bool IsLine() { return type == 1; }
public bool IsSelfBall() { return type == 2; }
public bool IsTargetBall() { return type == 3; }
public bool IsSector() { return type == 4; }
public bool IsSelf() { return type == 5; }
public bool NoTarget() { return type == 2 || type == 5; }
}
// ռλ // Placeholder Skill class
public class Skill : ElementSkill
{
protected SkillStub stub;
protected PlayerWrapper player;
protected uint id;
protected uint level;
Skill(uint i, SkillStub s)
{
id = i;
stub = s;
}
public static Skill Create(uint id, int n)
{
SkillStub stub = SkillStub.GetStub(id);
if (stub == null)
return null;
Skill skill = new Skill(id, stub);
int max = skill.GetMaxLevel();
if (n > max)
skill.SetLevel(max);
else
skill.SetLevel(n);
return skill;
}
public int GetLevel() { return (int)level; }
public PlayerWrapper GetPlayer()
{
return player;
}
public override int GetCls()
{
return stub.GetCls();
}
public override Dictionary<uint, int> GetJunior()
{
return stub.is_senior != 0 ? stub.pre_skills : new Dictionary<uint, int>();
}
public override string GetIcon()
{
return stub.GetIcon();
}
public override string GetName() { return stub.GetName(); }
}
public abstract class SkillStub
{
public const int MIN_LEVEL = 1;
public const int MAX_LEVEL = 10;
// Base info
public uint id; // Ψһֱʶ // Unique identifier
public int cls; // ְҵ // Class/Profession
public string name; // // Skill name
public string nativename; // // Native name
public string icon; // ͼ // Skill icon
public int max_level; // 󼶱? // Maximum level
public byte type; // ? 1 2 3ٻ 4 5 // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other
// Execute condition
public bool allow_ride; // ? // Allow while riding
public short attr; // , 1256 ѡһ Ĭϣ // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none)
public int rank; // // Rank
public int eventflag; // Event flag
public byte is_senior; // Senior flag
public bool is_inherent; // ܣѧ // Inherent skill, cannot be learned
public bool is_movingcast; // ƶʩ // Can cast while moving
public int npcdelay; // NPC delay
public int showorder; // Display order
public byte allow_forms; // Allowed forms
public int apcost; // AP cost
public int apgain; // AP gain
public byte doenchant; // Do enchant
public byte dobless; // Do bless
public int arrowcost; // Arrow cost
public Dictionary<uint, int> pre_skills;
// Execute condition
public bool allow_land; // ½Ч // Effective on land
public bool allow_air; // Ч // Effective in air
public bool allow_water; // ˮЧ // Effective in water
public bool notuse_in_combat; // ս״̬ // Cannot use in combat state
public int restrict_corpse; // ֻʬЧ // Only effective on corpses
public bool restrict_change; // ǷԱ // Whether can transform
public bool restrict_attach; // ǷԸ // Whether can possess
public bool auto_attack; // ʹúǷԶ // Whether to auto attack after use
public byte time_type; // ˲ // Instant cast type
public byte long_range;
public byte posdouble; // λѡ // Position selection
public int clslimit; // ְҵ // Class restriction
public int commoncooldown; // ȴmask bit0-4 ȴ0-4 bit5-9 Ʒȴ0-4
// Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4
public int commoncooldowntime; // ȴʱλ // Cooldown time in milliseconds
public int itemcost; // ͷʱƷ >0Ч // Item cost when casting, effective if >0
// // Combo related
public int combosk_preskill;
public int combosk_interval;
public int combosk_nobreak;
public string effect;
public string aerial_effect;
public Range range;
public bool has_stateattack;
public List<int> restrict_weapons = new List<int>();
public static Dictionary<uint, SkillStub> map = new Dictionary<uint, SkillStub>();
public static Dictionary<uint, SkillStub> GetMap() => map;
public static Dictionary<uint, List<uint>> inheritSkillMap = new();
public SkillStub(uint i)
{
id = i;
is_inherent = (false);
is_movingcast = (false);
itemcost = (0);
combosk_preskill = (0);
combosk_interval = (0);
combosk_nobreak = (0);
if (GetStub(id) == null)
{
GetMap().Add(id, this);
}
}
public static List<uint> GetInherentSkillList(uint cls)
{
return inheritSkillMap[cls];
}
public static Dictionary<uint, List<uint>> comboSkillMap;
public static Dictionary<uint, List<uint>> GetComboSkMap() => comboSkillMap;
public static SkillStub GetStub(uint i)
{
return GetMap().TryGetValue(i, out var stub) ? stub : null;
}
public static void InitStaticData()
{
var map = GetMap();
foreach (var skill in map)
{
SkillStub sk = skill.Value;
if (sk.is_inherent) GetInherentSkillList((uint)sk.cls).Add(sk.id);
if (sk.combosk_preskill > 0) GetComboSkMap()[(uint)sk.combosk_preskill].Add(sk.id);
}
}
public List<uint> GetPostComboSkill(uint id)
{
var m = GetComboSkMap();
if (m.TryGetValue(id, out var list)) return list;
return null;
}
// ΪC++תĽӿ // The following methods are converted from C++
public uint GetId() { return id; }
public int GetCls() { return cls; }
public string GetName() { return name; }
public string GetIcon() { return icon; }
public int GetMaxLevel() { return max_level; }
public Range GetRange() { return range; }
public int GetItemCost() { return itemcost; }
public bool IsMovingSkill() { return is_movingcast; }
public new byte GetType() { return type; } // System.Object.GetType // Hide System.Object.GetType
// ʱ // Runtime-related virtual functions
public virtual int GetCoolingtime(Skill skill) { return 0; }
public virtual int GetRequiredSp(Skill skill) { return 0; }
public virtual int GetRequiredLevel(Skill skill) { return 0; }
public virtual int GetMaxAbility(Skill skill) { return 0; }
public virtual int GetRequiredItem(Skill skill) { return 0; }
public virtual int GetRequiredMoney(Skill skill) { return 0; }
public virtual int GetRequiredRealmLevel(Skill skill) { return 0; }
public virtual float GetPraydistance(Skill skill) { return 0f; }
public virtual float GetMpcost(Skill skill) { return 0f; }
public virtual int GetExecutetime(Skill skill) { return 1000; }
public virtual bool CheckHpCondition(int hp, int max_hp) { return true; }
public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; }
public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; }
// ЧԼ // Validate weapon restriction
public bool ValidWeapon(int weapon)
{
if (restrict_weapons != null)
{
int i;
for (i = 0; i < restrict_weapons.Count; i++)
{
if (weapon == restrict_weapons[i])
return true;
}
if (i > 0 && i >= restrict_weapons.Count)
return false;
}
return true;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d862905bd32244cdbb4755279b5e84cd
timeCreated: 1760588062
@@ -0,0 +1,309 @@
#define SKILL_CLIENT
using BrewMonster.Scripts.Skills;
using System.Text;
using UnityEngine;
using static BrewMonster.PET_EVOLVE_CONFIG;
namespace BrewMonster
{
#if SKILL_SERVER
public class Skill1 : Skill
{
public const int SKILL_ID = 1;
public Skill1() : base(SKILL_ID)
{
}
}
#endif
public class Skill1Stub : SkillStub
{
// Static arrays for skill requirements
private static readonly int[] RequiredLevelArray = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45 };
private static readonly int[] RequiredSpArray = { 0, 300, 1200, 2800, 5200, 8400, 12800, 18600, 26300, 36500 };
private static readonly int[] RequiredMoneyArray = { 0, 30, 130, 280, 480, 730, 1180, 1630, 2080, 2580 };
#if SKILL_SERVER
public class State1 : SkillStub.State
{
public int GetTime(Skill skill)
{
return 400;
}
public bool Quit(Skill skill)
{
return false;
}
public bool Loop(Skill skill)
{
return false;
}
public bool Bypass(Skill skill)
{
return false;
}
public void Calculate(Skill skill)
{
skill.GetPlayer().SetDecmp(0.2f * (-5 + 7 * skill.GetLevel()));
skill.GetPlayer().SetPray(1);
}
public bool Interrupt(Skill skill)
{
return false;
}
public bool Cancel(Skill skill)
{
return true;
}
public bool Skip(Skill skill)
{
return false;
}
}
#endif
#if SKILL_SERVER
public class State2 : SkillStub.State
{
public int GetTime(Skill skill)
{
return 700;
}
public bool Quit(Skill skill)
{
return false;
}
public bool Loop(Skill skill)
{
return false;
}
public bool Bypass(Skill skill)
{
return false;
}
public void Calculate(Skill skill)
{
skill.GetPlayer().SetDecmp(0.8f * (-5 + 7 * skill.GetLevel()));
skill.SetPlus(1.9f * skill.GetLevel() * skill.GetLevel() + 64 * skill.GetLevel() + 36.7f);
skill.SetRatio(0);
skill.SetDamage(skill.GetAttack());
skill.GetPlayer().SetPerform(1);
}
public bool Interrupt(Skill skill)
{
return false;
}
public bool Cancel(Skill skill)
{
return false;
}
public bool Skip(Skill skill)
{
return false;
}
}
#endif
#if SKILL_SERVER
public class State3 : SkillStub.State
{
public int GetTime(Skill skill)
{
return 0;
}
public bool Quit(Skill skill)
{
return false;
}
public bool Loop(Skill skill)
{
return false;
}
public bool Bypass(Skill skill)
{
return false;
}
public void Calculate(Skill skill)
{
}
public bool Interrupt(Skill skill)
{
return false;
}
public bool Cancel(Skill skill)
{
return false;
}
public bool Skip(Skill skill)
{
return false;
}
}
#endif
public Skill1Stub() : base(1)
{
cls = 0;
name = "";
nativename = "";
icon = ".dds";
max_level = 10;
type = 1;
apcost = 0;
arrowcost = 0;
apgain = 10;
attr = 1;
rank = 0;
eventflag = 0;
posdouble = 0;
clslimit = 0;
time_type = 0;
showorder = 1101;
allow_land = true;
allow_air = true;
allow_water = true;
allow_ride = false;
auto_attack = true;
long_range = 0;
restrict_corpse = 0;
allow_forms = 1;
restrict_weapons.Add(0);
restrict_weapons.Add(1);
restrict_weapons.Add(182);
restrict_weapons.Add(5);
restrict_weapons.Add(292);
restrict_weapons.Add(9);
effect = ".sgc";
range = new Range();
range.type = 0;
doenchant = 0;
dobless = 0;
commoncooldown = 0;
commoncooldowntime = 0;
#if SKILL_SERVER
statestub.Add(new State1());
statestub.Add(new State2());
statestub.Add(new State3());
#endif
}
~Skill1Stub()
{
}
public float GetMpcost(Skill skill)
{
return (float)(-5 + 7 * skill.GetLevel());
}
public int GetExecutetime(Skill skill)
{
return 700;
}
public int GetCoolingtime(Skill skill)
{
return 3000;
}
public int GetRequiredLevel(Skill skill)
{
return RequiredLevelArray[skill.GetLevel() - 1];
}
public int GetRequiredSp(Skill skill)
{
return RequiredSpArray[skill.GetLevel() - 1];
}
public int GetRequiredMoney(Skill skill)
{
return RequiredMoneyArray[skill.GetLevel() - 1];
}
public float GetRadius(Skill skill)
{
return 0f;
}
public float GetAttackdistance(Skill skill)
{
return 0f;
}
public float GetAngle(Skill skill)
{
return (float)(1 - 0.0111111 * 0);
}
public float GetPraydistance(Skill skill)
{
return (float)skill.GetPlayer().GetRange();
}
#if SKILL_CLIENT
public int GetIntroduction(Skill skill, StringBuilder buffer, int length, string format)
{
string result = string.Format(format,
skill.GetLevel(),
-5 + 7 * skill.GetLevel(),
1.9 * skill.GetLevel() * skill.GetLevel() + 64 * skill.GetLevel() + 36.7);
if (result.Length < length)
{
buffer.Append(result);
return result.Length;
}
return 0;
}
#endif
#if SKILL_SERVER
public int GetEnmity(Skill skill)
{
return 0;
}
public bool TakeEffect(Skill skill)
{
return true;
}
public float GetEffectdistance(Skill skill)
{
return 13.3f;
}
public int GetAttackspeed(Skill skill)
{
return 3;
}
public float GetHitrate(Skill skill)
{
return (float)(1.2 + 0.05 * skill.GetLevel());
}
#endif
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d0031361f3c360648b74e192f6aa04f7
@@ -0,0 +1,254 @@
using BrewMonster.Assets.PerfectWorld.Scripts.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BrewMonster.Assets.PerfectWorld.Scripts.UI
{
public class CECUIConfig : Singleton<CECUIConfig>
{
GameUI m_gameUI;
public GameUI GetGameUI()
{
return m_gameUI;
}
}
public struct RandomMapItem
{
public int itemID;
public int count;
public RandomMapItem(int itemId, int itemCount)
{
itemID = itemId;
count = itemCount;
}
}
// Wallow hint info type
public enum WallowHintType
{
WHT_DEFAULT = 0, // Default mode
WHT_KOREA = 1, // Korean mode
}
// Recommend shop item type
public enum RecommendShopItemType
{
RECOMMEND_REFINE_1, // Equipment refinement level 1
RECOMMEND_REFINE_2, // Equipment refinement level 2
RECOMMEND_REFINE_3, // Equipment refinement level 3
RECOMMEND_REFINE_4, // Equipment refinement level 4
RECOMMEND_REFINE_5, // Equipment refinement level 5
RECOMMEND_SAVE_LIFE, // Save life
RECOMMEND_ACTIVITY, // Activity reminder
}
// Game logic and UI related configuration
public struct GameUI
{
public bool bMailToFriendsSwitch; // Mail to friends
public int nMailToFriendsDaysNoLogin; // Days not logged in to trigger mail to friends
public int nMailToFriendsLevel; // Level required to use mail to friends
public int nMailToFriendsDaysSendMail; // Days interval to send mail again
public bool bActivityReminder; // Activity reminder
public int nActivityReminderLevel; // Level requirement
public int nActivityReminderMaxLevelSoFar; // Historical maximum level requirement
public int nActivityReminderLevel2; // Second level requirement
public int nActivityReminderReincarnationTimes;// Reincarnation times requirement
public int nActivityReminderRealmLevel; // Realm level requirement
public int nActivityReminderReputation; // Reputation requirement
public DateTime tActivityReminderStartTime; // Start time (local time)
public DateTime tActivityReminderEndTime; // End time (local time)
public bool bEnableTalkToGM; // Enable sending non-standard messages to GM
public bool bEnableTrashPwdRemind; // Enable trash password reminder for users
public WallowHintType nWallowHintType; // Wallow hint display type
public bool bEnableIE; // Enable IE to display web pages
public bool bEnableShowIP; // Whether to show last login information
public bool bEnableCompleteAccount; // Whether to show account completion information
public bool bEnableFortressBuildDestroy; // Whether to enable fortress build/destroy facilities
public List<int> nCountryWarBonus; // Country war bonus levels
public bool bShowNameInCountryWar; // Whether to show player names in country war
public int nCountryWarEnterLevel; // Country war entry level requirement
public int nCountryWarEnterItem; // Country war entry item id
public int nCountryWarEnterItemCount; // Country war entry item count
public bool bEnableQuickPay; // Enable quick payment
public int nEquipMarkMinInkNum; // Minimum ink number required for equipment mark modification
public bool bEnableReportPlayerSpeakToGM; // Enable reporting player speech to GM
public bool bEnableReportPluginWithFeedback; // Enable plugin reporting with feedback
public uint nGTLoginCoolDown; // Game GT account login cooldown time (in seconds)
public bool bEnableGTOnSpecialServer; // Whether to enable GT on special servers
public int nCrossServerEnterLevel; // Cross server entry level requirement
public int nCrossServerEnterLevel2; // Cross server entry level requirement 2
public bool bEnableWebTradeSort; // Enable sorting when searching for items in web trade
public bool bEnablePlayerRename; // Enable player rename
public bool bEnableCheckNewbieGift; // Enable newbie gift display
public bool bEnableQShopFilter; // Enable QShop filter display function (filtered by player level)
public bool bEnableGivingFor; // Enable QShop gift and receive function
public bool bEnableGivingForTaskLimitedItem; // Enable QShop certain task-limited items gift and receive function
public List<int> nCountryWarPlayerLimit; // Country war battle player count limit
public int nCountryWarKingMaxDomainLimit; // Country war king maximum domain limit
public int nFashionSplitCost; // Fashion split cost
public bool bEnableTouch; // Touch shop enable
public bool bEnableOptimize; // Whether to enable client optimization
public int nMemoryUsageLow; // Low memory value, system will automatically restore normal model
public int nMemoryUsageHigh; // High memory value, system will automatically reduce level model
public int nAutoSimplifySpeed; // Auto simplify speed after long time
public List<int> nTouchEnabledMap; // TOUCH shop enabled maps
public bool bEnableTWRecharge; // Shop recharge button (for Taiwan region recharge platform)
public string strTWRechargeAppID; // Taiwan recharge platform parameter AppID (developer code)
public string strTWRechargeGame; // Taiwan recharge platform parameter Game (game code)
public string strTWRechargeKey; // Taiwan recharge platform parameter Key (additional verification key)
public bool bEnableTitle; // Enable Title UI
public List<int> nAutoTeamTransmitEnabledMap; // Auto team transmit enabled map IDs
public int nChariotApplyLevel; // Chariot application level requirement
public int nChariotApplyLevel2; // Chariot application level requirement 2
public int nChariotApplyReincarnation; // Chariot application reincarnation requirement
public int nChariotReviveTimeout; // Chariot revive timeout
public int nChariotAmount; // Chariot battle chariot count
public int nHistoryQueryTimeInterval; // History query time interval
public bool bEnableAutoWiki; // Auto wiki enable
public int nExitAutoExtractWikiStateTime; // Auto wiki: exit auto extract time
public int nCloseWikiPopDlgTime; // Auto wiki: close time
public int nCloseWikiMsgInfoTime; // Auto wiki: message disappear time
public int nOpenWikiPopDlgTime; // Auto wiki: open time
public List<int> nTaskDisabledInMiniClient; // Tasks disabled in mini client
public List<int> nItemDisabledInMiniClient; // Items disabled in mini client
public List<int> nMeridianFreeItem; // Meridian free item ID list
public List<int> nMeridianNotFreeItem; // Meridian not free item ID list
public int nMonsterSpiritGatherTimesPerWeekMax;// Maximum monster spirit gather times per week
public bool bEnableAutoPolicy; // Auto policy system enable
public bool bEnablePWService; // Enable PW service page
public bool bEnableActionSwitch; // Action switch enable (attack->defense, defense->attack, auto return before using skill)
public int nCountryWarLiveShowUpdateInterval; // Country war live show data update interval
public List<int> nDefaultSystemModuleIndex; // System module default function index
public bool bEnableRecommendQShopItem; // Recommend QShop items when appropriate
public List<int> nRecommendShopItems; // Recommended shop items list
public bool bEnableRandShop; // Whether to enable random shop (in new version, old version follows original agreement, this function is disabled)
public int nPokerShopConfig; // Poker shop config table ID
public int nPokerShopLevelLimit; // Poker shop usage level requirement
public int nContributionTaskLevelLimit; // Contribution task system usage level requirement
public List<string> strFashionShopAdImage; // Fashion shop advertisement images
public bool bEnableQShopFashionShop; // QShop fashion shop enable
public bool bEnableBackShopFashionShop; // Back shop fashion shop enable
public bool bEnableCeilPriceBeforeDiscountToGold; // Shop discount item original price only shows gold, if original price can be converted to gold, show original price (except market)
public List<string> strFullScreenGfxForeground; // Full screen effect foreground effect
public List<string> strFullScreenGfxBackground; // Full screen effect background effect
public List<int> nRandomMaps; // Random maps
public List<int> nTaskIDForDisableWayPointUITips; // Task IDs that need to disable waypoint tip display when doing these tasks
public RandomMapItem DefaultRandomMapItem; // Default random map item distribution item
public Dictionary<int, RandomMapItem> SpecialRandomMapItems; // Specific random map special random map item distribution item
public int nMaxFriendRemarksNameLength; // Friend remarks name maximum length
public bool bEnableQShopFashionShopFlashSale; // QShop fashion shop flash sale enable
public bool bEnableBackShopFashionShopFlashSale; // Back shop fashion shop flash sale enable
public string strQShopFashionShopFlashSaleTitle; // QShop fashion shop flash sale button title
public string strBackShopFashionShopFlashSaleTitle; // Back shop fashion shop flash sale button title
public bool bEnablePlayerChangeGender;
public int GetCountryWarBonusLevel(int currentBonus)
{
// Get country war current bonus level, starting from level 0, return -1 if invalid
int level = -1;
while (level + 1 < nCountryWarBonus.Count && currentBonus > nCountryWarBonus[level + 1])
{
level++;
}
return level;
}
public int GetCountryWarPlayerLimit(int warType)
{
if (warType >= 0 && warType < nCountryWarPlayerLimit.Count)
{
return nCountryWarPlayerLimit[warType];
}
return 0;
}
public bool GetCanShowTouchShop(int idInst)
{
return nTouchEnabledMap.Contains(idInst);
}
public bool IsTaskDisabledInMiniClient(int task_id)
{
return nTaskDisabledInMiniClient.Contains(task_id);
}
public bool IsItemDisabledInMiniClient(int item_id)
{
return nItemDisabledInMiniClient.Contains(item_id);
}
public bool IsMeridianFreeItem(int item_id)
{
return nMeridianFreeItem.Contains(item_id);
}
public bool IsMeridianNotFreeItem(int item_id)
{
return nMeridianNotFreeItem.Contains(item_id);
}
public bool IsRandomMap(int mapid)
{
return nRandomMaps.Contains(mapid);
}
public int GetRandomMapCount()
{
return nRandomMaps.Count;
}
public int GetRandomMapID(int idx)
{
if (idx >= 0 && idx < nRandomMaps.Count)
{
return nRandomMaps[idx];
}
return 0;
}
public bool GetRandomMapItemInfo(int mapID, out RandomMapItem info)
{
if (SpecialRandomMapItems.TryGetValue(mapID, out info))
{
return true;
}
// If not found in special items, return false (not using default)
info = default(RandomMapItem);
return false;
}
public int GetTaskIDDisableWayPointsUITipsCount()
{
return nTaskIDForDisableWayPointUITips.Count;
}
public int GetTaskIDDisableWayPointsUITips(int idx)
{
if (idx >= 0 && idx < nTaskIDForDisableWayPointUITips.Count)
{
return nTaskIDForDisableWayPointUITips[idx];
}
return 0;
}
public int GetRecommendShopItem(RecommendShopItemType type)
{
int index = (int)type;
if (index >= 0 && index < nRecommendShopItems.Count)
{
return nRecommendShopItems[index];
}
return 0;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2db7d5cd42386b448927779069efcf1c
@@ -160,7 +160,6 @@ namespace BrewMonster.UI
await Task.Delay(10000);
UnityGameSession.RequesrQueryPlayerCash();
await Task.Delay(1000);
UnityGameSession.c2s_CmdGetAllData(true, true, false);
EC_Game.Init();
}
@@ -12,7 +12,7 @@ public class ShopCategoryManager : MonoBehaviour
{
"Category 1", // Original category 1
"Category 2", // Original category 2
"Categories 3-5", // Merged categories 3, 4, 5
"Categories 1, 3, 4", // Merged categories 1, 3, 4
"Category 6", // Original category 6
"Category 7", // Original category 7
"Category 8" // Original category 8
@@ -27,7 +27,7 @@ public class ShopCategoryManager : MonoBehaviour
public Color disabledButtonColor = Color.gray;
private int currentSelectedCategory = 0;
private ShopUIManager shopManager;
public ShopUIManager shopManager;
void Start()
{
@@ -68,13 +68,9 @@ public class ShopCategoryManager : MonoBehaviour
currentSelectedCategory = categoryIndex;
UpdateCategoryDisplay();
// Notify shop manager
// Notify shop manager to actually update the item list
if (shopManager != null)
{
// Use reflection to call the private method, or make it public
// For now, we'll assume there's a public method to handle category change
Debug.Log($"Category {categoryIndex} selected: {categoryNames[categoryIndex]}");
}
shopManager.SetCategoryIndex(categoryIndex);
}
void UpdateCategoryDisplay()
@@ -124,12 +120,12 @@ public class ShopCategoryManager : MonoBehaviour
public bool IsItemInCategory(GShopItem item, int categoryIndex)
{
// Category mapping: 0=1, 1=2, 2=3+4+5, 3=6, 4=7, 5=8
// Category mapping: 0=1, 1=2, 2=1+3+4, 3=6, 4=7, 5=8
switch (categoryIndex)
{
case 0: return item.mainType == 0; // Category 1
case 1: return item.mainType == 1; // Category 2
case 2: return item.mainType >= 2 && item.mainType <= 4; // Categories 3, 4, 5 merged
case 2: return item.mainType == 0 || item.mainType == 2 || item.mainType == 3; // Categories 1, 3, 4 merged
case 3: return item.mainType == 5; // Category 6
case 4: return item.mainType == 6; // Category 7
case 5: return item.mainType == 7; // Category 8
@@ -146,8 +142,8 @@ public class ShopCategoryManager : MonoBehaviour
{
int originalCategory = item.mainType;
if (originalCategory >= 2 && originalCategory <= 4)
return "Categories 3-5";
if (originalCategory == 0 || originalCategory == 2 || originalCategory == 3)
return "Categories 1, 3, 4";
if (originalCategory < categoryNames.Length)
return categoryNames[originalCategory];
@@ -91,7 +91,7 @@ public class ShopUIManager : MonoBehaviour
{
if (shopMainPanel != null)
{
shopMainPanel.SetActive(true);
OnCategorySelected(0);
RefreshShopDisplay();
}
}
@@ -129,6 +129,12 @@ public class ShopUIManager : MonoBehaviour
Debug.Log($"Category switch to {categoryIndex} completed in {switchTime * 1000f:F2}ms");
}
// Allow external components (e.g., ShopCategoryManager) to switch category
public void SetCategoryIndex(int categoryIndex)
{
OnCategorySelected(categoryIndex);
}
public void RefreshShopDisplay()
{
// Return all current panels to pool
@@ -144,9 +150,11 @@ public class ShopUIManager : MonoBehaviour
List<GShopItem> categoryItems = GetItemsForCategory(currentCategory);
// Create item panels using pooling
int siblingIndexCounter = 0;
foreach (GShopItem item in categoryItems)
{
CreateItemPanelFromPool(item);
CreateItemPanelFromPool(item, siblingIndexCounter);
siblingIndexCounter++;
}
}
@@ -170,20 +178,20 @@ public class ShopUIManager : MonoBehaviour
bool IsItemInCategory(GShopItem item, int categoryIndex)
{
// Category mapping: 0=1, 1=2, 2=3+4+5, 3=6, 4=7, 5=8
// Category mapping: 0=1, 1=2, 2=1+3+4, 3=6, 4=7, 5=8
switch (categoryIndex)
{
case 0: return item.mainType == 0; // Category 1
case 1: return item.mainType == 1; // Category 2
case 2: return item.mainType >= 2 && item.mainType <= 4; // Categories 3, 4, 5 merged
case 3: return item.mainType == 5; // Category 6
case 1: return item.mainType == 2; // Category 2
case 2: return item.mainType == 5; // Categories 1, 3, 4 merged
case 3: return item.mainType == 1 || item.mainType == 3 || item.mainType == 4; // Category 6
case 4: return item.mainType == 6; // Category 7
case 5: return item.mainType == 7; // Category 8
default: return false;
}
}
void CreateItemPanelFromPool(GShopItem item)
void CreateItemPanelFromPool(GShopItem item, int targetSiblingIndex)
{
GameObject itemPanel = null;
@@ -204,8 +212,10 @@ public class ShopUIManager : MonoBehaviour
if (itemPanel != null && itemContainer != null)
{
// Set parent and position
itemPanel.transform.SetParent(itemContainer);
itemPanel.transform.SetParent(itemContainer, false);
itemPanel.transform.localScale = Vector3.one;
// Ensure deterministic ordering regardless of pool retrieval order
itemPanel.transform.SetSiblingIndex(targetSiblingIndex);
// Setup the panel
ShopItemPanel itemPanelScript = itemPanel.GetComponent<ShopItemPanel>();
@@ -26,7 +26,7 @@ namespace BrewMonster
//GameController.Instance.SelectingVfxPrefab
// todo: make pool
BaseVfxObject pGFX = GameController.Instance.InstantiateObject(loadObj).GetComponent<BaseVfxObject>();
BaseVfxObject pGFX = CECGameRun.Instance.InstantiateObject(loadObj).GetComponent<BaseVfxObject>();
if (!pGFX)
{
return null;
+53 -38
View File
@@ -368,9 +368,9 @@ RectTransform:
- {fileID: 8761838049529348566}
m_Father: {fileID: 6279944142683492433}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 73.5, y: -82.4}
m_SizeDelta: {x: 147, y: 116.8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &424813723601076052
@@ -974,9 +974,9 @@ RectTransform:
- {fileID: 2635347666608474034}
m_Father: {fileID: 6279944142683492433}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 73.5, y: -557.43335}
m_SizeDelta: {x: 147, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2783001383898350917
@@ -1458,9 +1458,9 @@ RectTransform:
- {fileID: 3465129417775596107}
m_Father: {fileID: 6921900574306804872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 253.67606, y: -34.225502}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 166.4507, y: 61.887}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2471496789853926854
@@ -1750,9 +1750,9 @@ RectTransform:
- {fileID: 6607009122237547209}
m_Father: {fileID: 6921900574306804872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 753.02814, y: -34.225502}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 166.4507, y: 61.887}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6604777758543866085
@@ -2132,9 +2132,9 @@ RectTransform:
- {fileID: 7453030741144867795}
m_Father: {fileID: 6279944142683492433}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 73.5, y: -438.9}
m_SizeDelta: {x: 147, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5113860492054378637
@@ -2253,9 +2253,9 @@ RectTransform:
- {fileID: 7881121413444915257}
m_Father: {fileID: 6279944142683492433}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 73.5, y: -675.9667}
m_SizeDelta: {x: 147, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &188443220859053986
@@ -2670,11 +2670,11 @@ MonoBehaviour:
m_Content: {fileID: 720995613977598853}
m_Horizontal: 0
m_Vertical: 1
m_MovementType: 0
m_MovementType: 1
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.91
m_ScrollSensitivity: 4
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 7377597886310921903}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
@@ -2871,9 +2871,9 @@ RectTransform:
- {fileID: 3953026038879993000}
m_Father: {fileID: 6279944142683492433}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 73.5, y: -201.83334}
m_SizeDelta: {x: 147, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5160228589296753130
@@ -3302,9 +3302,9 @@ RectTransform:
- {fileID: 7368110207669039191}
m_Father: {fileID: 6921900574306804872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 420.12674, y: -34.225502}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 166.4507, y: 61.887}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5818043599573700572
@@ -3695,7 +3695,7 @@ RectTransform:
m_Father: {fileID: 4310760051865461200}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.22351074, y: 0.023500443}
m_SizeDelta: {x: -24.1577, y: -6.6333}
m_Pivot: {x: 0.5, y: 0.5}
@@ -3846,9 +3846,9 @@ RectTransform:
- {fileID: 1824832118339051429}
m_Father: {fileID: 6921900574306804872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 87.22535, y: -34.225502}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 166.4507, y: 61.887}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5876619622367789936
@@ -3967,9 +3967,9 @@ RectTransform:
- {fileID: 1529712157810231189}
m_Father: {fileID: 6921900574306804872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 586.57745, y: -34.225502}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 166.4507, y: 61.887}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4405492307389281063
@@ -5158,6 +5158,7 @@ GameObject:
- component: {fileID: 720995613977598853}
- component: {fileID: 6400593268502276303}
- component: {fileID: 5246174072855755290}
- component: {fileID: 2179490036099150762}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
@@ -5225,6 +5226,20 @@ MonoBehaviour:
maxPoolSize: 100
expandPool: 1
poolParent: {fileID: 720995613977598853}
--- !u!114 &2179490036099150762
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6592005461581952019}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &6608932894056258649
GameObject:
m_ObjectHideFlags: 0
@@ -5529,7 +5544,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1845571473519222713
RectTransform:
m_ObjectHideFlags: 0
@@ -5886,9 +5901,9 @@ RectTransform:
- {fileID: 5424053570241907517}
m_Father: {fileID: 6279944142683492433}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 73.5, y: -320.36667}
m_SizeDelta: {x: 147, y: 115}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6316976477275547731
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f08a2358f441f066ff36ff6a98d580219dcd8b7629d6675b97643a1f3e09953b
size 33030989
oid sha256:951300c91d8eb0444ef6f6d4231547c757908cba80c036bc743d186711fca527
size 33032375
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:91a4f3bbfdf36a272974726c5c2a620c1ff0300fd1e0762af085e6fadcabb009
size 530349610
oid sha256:4500e3329ef68f0370414228d113f02bbe72321b04ac5e9292e13addf04dc827
size 530349701
@@ -1,10 +1,15 @@
using CSNetwork.GPDataType;
using CSNetwork.GPDataType;
using BrewMonster;
using BrewMonster.Scripts.World;
using CSNetwork.GPDataType;
using CSNetwork.Protocols.RPCData;
using System.Data;
using Unity.Cinemachine;
using UnityEngine;
public class GameController : MonoBehaviour
public partial class CECGameRun : MonoBehaviour
{
private static GameController instance;
private static CECGameRun instance;
[SerializeField] private GameObject characterPrefab;
[SerializeField] private CECMonster monsterPrefab;
@@ -17,15 +22,30 @@ public class GameController : MonoBehaviour
public CinemachineFreeLook freeLookCam;
public float rotateSpeedX = 300f; // tốc độ xoay ngang
public float rotateSpeedY = 2f; // tốc độ xoay dọc
private CECWorld m_pWorld;
public CECWorld GetWorld() { return m_pWorld; }
public bool StartGame(int idInst, Vector3 vHostPos)
{
if (!JumpToInstance(idInst, vHostPos))
{
BMLogger.LogError("CECGameRun::StartGame, Failed to create game world.");
return false;
}
return true;
}
private bool JumpToInstance(int idInst, Vector3 vHostPos, int iParallelWorldID = 0)
{
return true;
}
public static GameController Instance
public static CECGameRun Instance
{
get
{
if (instance == null)
{
instance = FindAnyObjectByType<GameController>();
instance = FindAnyObjectByType<CECGameRun>();
}
return instance;
}
@@ -62,7 +82,6 @@ public class GameController : MonoBehaviour
hostPlayer.InitCharacter(info);
cinemachineCamera.Follow = hostPlayer.transform;
cinemachineCamera.ForceCameraPosition(hostPlayer.transform.position, Quaternion.identity);
CinemachineTouchOrbit.Instance.SetOrbitTarget(hostPlayer.transform);
//Vector3 pos = new Vector3(info.pos.x, info.pos.y, info.pos.z);
//Vector3 posCam = pos;
//posCam.z -= 10f;
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5de219a5b9756ae4ebf01e2919b92cde
+591 -56
View File
@@ -1,9 +1,12 @@
using BrewMonster;
using BrewMonster.Assets.PerfectWorld.Scripts.Players;
using BrewMonster.Assets.PerfectWorld.Scripts.Skills;
using BrewMonster.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.Managers;
using BrewMonster.Scripts.Player;
using BrewMonster.Scripts.Skills;
using CSNetwork;
using CSNetwork.Common;
using CSNetwork.GPDataType;
@@ -20,12 +23,17 @@ using System.Runtime.InteropServices;
using System.Text;
using BrewMonster.PerfectWorld.Scripts.Vfx;
using TMPro;
using Unity.VisualScripting;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using static Unity.Burst.Intrinsics.X86.Avx;
using static UnityEditor.PlayerSettings;
using Scene = UnityEngine.SceneManagement.Scene;
using Trace_reason = CECHPWorkTrace.Trace_reason;
using Host_work_ID = BrewMonster.Scripts.CECHPWork.Host_work_ID;
using BrewMonster.Scripts;
using BrewMonster.Scripts.World;
@@ -37,37 +45,48 @@ public partial class CECHostPlayer : CECPlayer
[SerializeField] private Button btnJump;
[SerializeField] private Button btnRun;
PlayerStateMachine _playerStateMachine;
PlayerMoveState _moveState;
PlayerIdleState _idleState;
private PlayerStateMachine _playerStateMachine;
private PlayerMoveState _moveState;
private PlayerIdleState _idleState;
public CECHostMove m_MoveCtrl;
CECHPWorkMan m_pWorkMan; // Host work manager
uint m_dwLIES; // Logic-influence extend states
FACTION_FORTRESS_ENTER m_fortressEnter; // ½øÈë»ùµØÐÅÏ¢
PVPINFO m_pvp; // pvp information
bool m_bInSanctuary = false; // true, player is in sanctuary
int m_idFaction = 0; // ID of player's faction
private CECHPWorkMan m_pWorkMan; // Host work manager
private uint m_dwLIES; // Logic-influence extend states
private FACTION_FORTRESS_ENTER m_fortressEnter; // ½øÈë»ùµØÐÅÏ¢
private PVPINFO m_pvp; // pvp information
private bool m_bInSanctuary = false; // true, player is in sanctuary
private int m_idFaction = 0; // ID of player's faction
public bool m_bPrepareFight = false; // true, prepare to fight
int m_iJumpCount = 0;
bool m_bJumpInWater = false;
private int m_iJumpCount = 0;
private bool m_bJumpInWater = false;
public A3DVECTOR3 m_vVelocity; // Velocity
List<CECObject> m_aTabSels = new List<CECObject>();
bool m_bChangingFace; // true, host is changing face
private int m_iRoleCreateTime;
private int m_iRoleLastLoginTime; // Role last login time
private int m_iAccountTotalCash;
float playerSpeed = 5.0f;
float jumpHeight = 1.5f;
float gravityValue = -9.81f;
StateAnim stateAnim = StateAnim.Idle;
Vector3 playerVelocity;
bool isGrounded = false;
bool isRun = false;
Vector3 m_vLastSevPos;
private List<CECObject> m_aTabSels = new List<CECObject>();
private List<CECSkill> m_aPtSkills = new List<CECSkill>();
private List<CECSkill> m_aPsSkills = new List<CECSkill>();
private List<CECSkill> m_aEquipSkills = new List<CECSkill>();
private List<CECSkill> m_aGoblinSkills = new List<CECSkill>();
private bool m_bEnterGame;
public CECSkill m_pPrepSkill;
private float playerSpeed = 5.0f;
private float jumpHeight = 1.5f;
private float gravityValue = -9.81f;
private StateAnim stateAnim = StateAnim.Idle;
private Vector3 playerVelocity;
private bool isGrounded = false;
private bool isRun = false;
private Vector3 m_vLastSevPos;
public CDR_INFO m_CDRInfo;
public GNDINFO m_GndInfo;
int m_idUCSelTarget; // Uncertificately selected object's ID
private int m_idUCSelTarget; // Uncertificately selected object's ID
public float m_fVertSpeed = 0f;
CECActionSwitcherBase m_pActionSwitcher;
// ====== Ground cast config ======
[Header("Ground Cast")]
@@ -112,9 +131,56 @@ public partial class CECHostPlayer : CECPlayer
}
}
public void LoadResources()
public bool LoadResources()
{
RoleInfo RoleInfo = UnityGameSession.Instance.GetRoleInfo();
m_iProfession = RoleInfo.occupation;
m_iGender = RoleInfo.gender;
m_iRoleCreateTime = RoleInfo.create_time;
m_iRoleLastLoginTime = RoleInfo.lastlogin_time;
m_iAccountTotalCash = RoleInfo.cash_add;
if (!LoadPlayerSkeleton(true))
{
BMLogger.LogError("HoangDev CECHostPlayer::LoadResources, Failed to load skeleton");
return false;
}
return true;
}
private bool LoadPlayerSkeleton(bool bAtOnce)
{
EC_PLAYERLOADRESULT Ret = default;
if (bAtOnce /*|| !IsLoadThreadReady()*/)
{
// Under normal circumstances, only HostPlayer can reach here
/* if (!LoadPlayerModel(m_iProfession, m_iGender, m_CustomizeData.bodyID, aEquips, szPetPath, Ret, false, false))
{
a_LogOutput(1, "CECPlayer::Init, failed to call LoadPlayerModel() !");
return false;
}*/
SetPlayerLoadedResult(Ret);
/* if (IsShapeChanged() && !QueueLoadDummyModel(m_iShape, true))
{
// ignore the dummy model loading failure
a_LogOutput(1, "CECPlayer::Init, failed to call QueueLoadDummyModel() !");
}*/
}
return true;
}
private bool SetPlayerLoadedResult(EC_PLAYERLOADRESULT ret)
{
OnAllResourceReady();
return true;
}
private void OnAllResourceReady()
{
CECHostSkillModel.Instance.Initialize();
}
private void Start()
@@ -132,6 +198,13 @@ public partial class CECHostPlayer : CECPlayer
protected override void Update()
{
base.Update();
#if UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.C))
{
ApplySkillShortcut(1);
}
#endif
//Debug.Log($"(ulong)Time.deltaTime * 1000 {(ulong)(Time.deltaTime * 1000)}");
m_MoveCtrl.Tick((ulong)(Time.deltaTime * 1000));
// Nếu có thay đổi runtime, có thể lấy lại mỗi vài giây/Start nếu bạn thích:
@@ -188,15 +261,15 @@ public partial class CECHostPlayer : CECPlayer
SelectTarget(m_idUCSelTarget);
}
if (idTraceTarget != 0)
{
if (iTraceReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
{
if (!CanDo(ActionCanDo.CANDO_MELEE))
return;
NormalAttackObject(idTraceTarget, bForceAttack);
}
}
/* if (idTraceTarget != 0)
{
if (iTraceReason == CECHPWorkTrace.Trace_reason.TRACE_ATTACK)
{
if (!CanDo(ActionCanDo.CANDO_MELEE))
return;
NormalAttackObject(idTraceTarget, bForceAttack);
}
}*/
}
m_pWorkMan?.Tick(Time.deltaTime);
@@ -340,11 +413,104 @@ public partial class CECHostPlayer : CECPlayer
case int value when value == EC_MsgDef.MSG_HST_ATTACKED: OnMsgHstAttacked(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_HURTRESULT: OnMsgHstHurtResult(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_INFO00: OnMsgHstInfo00(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_SKILLDATA: OnMsgHstSkillData(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_DIED: OnMsgHstDied(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_GOTO: OnMsgHstGoto(Msg); break;
}
}
private void OnMsgHstSkillData(ECMSG Msg)
{
cmd_skill_data pCmd = default;
pCmd.skill_count = GPDataTypeHelper.FromBytes<uint>((byte[])Msg.dwParam1);
int offset = sizeof(uint);
int skillSize = Marshal.SizeOf<cmd_skill_data.SKILL>();
pCmd.skill_list = new cmd_skill_data.SKILL[pCmd.skill_count];
for (int i = 0; i < pCmd.skill_count; i++)
{
pCmd.skill_list[i] = GPDataTypeHelper.FromBytes<cmd_skill_data.SKILL>((byte[])Msg.dwParam1, offset);
offset += skillSize;
}
if (pCmd.skill_list == null)
{
BMLogger.LogError("OnMsgHstSkillData: cmd is null");
return;
}
/* List<SkillShortCutConfig> skillSCConfigArray1 = new List<SkillShortCutConfig>();
List<SkillShortCutConfig> skillSCConfigArray2 = new List<SkillShortCutConfig>();
List<SkillGrpShortCutConfig> skillGrpSCConfigArray1 = new List<SkillGrpShortCutConfig>();
List<SkillGrpShortCutConfig> skillGrpSCConfigArray2 = new List<SkillGrpShortCutConfig>();*/
if (HostIsReady())
{
/*
for (int i = 0; i < HostConstants.NUM_HOSTSCSETS1; i++)
{
if (hostPlayer.m_aSCSets1[i] != null)
{
hostPlayer.m_aSCSets1[i].RemoveSkillShortcuts();
}
}
for (int i = 0; i < HostConstants.NUM_HOSTSCSETS2; i++)
{
if (hostPlayer.m_aSCSets2[i] != null)
{
hostPlayer.m_aSCSets2[i].RemoveSkillShortcuts();
}
}*/
// Release passive skills
m_aPsSkills.Clear();
}
// Load skill data from command
// C++: GNET::ElementSkill::LoadSkillData(pCmd);
ElementSkill.LoadSkillData(pCmd);
// Create skill objects from command data
for (int i = 0; i < pCmd.skill_count; i++)
{
cmd_skill_data.SKILL data = pCmd.skill_list[i];
CECSkill skill = new CECSkill(data.id_skill, data.level);
// Categorize skills into positive and passive
int skillType = skill.GetType();
if (skillType != (int)CECSkill.SkillType.TYPE_PASSIVE &&
skillType != (int)CECSkill.SkillType.TYPE_PRODUCE &&
skillType != (int)CECSkill.SkillType.TYPE_LIVE)
{
m_aPtSkills.Add(skill);
}
else
{
m_aPsSkills.Add(skill);
}
}
// Restore and convert shortcuts after loading new skills
/* if (hostPlayer.HostIsReady())
{
hostPlayer.ConvertSkillShortcut(skillSCConfigArray1);
hostPlayer.AssignSkillShortcut(skillSCConfigArray1, hostPlayer.m_aSCSets1);
hostPlayer.ConvertSkillShortcut(skillSCConfigArray2);
hostPlayer.AssignSkillShortcut(skillSCConfigArray2, hostPlayer.m_aSCSets2);
hostPlayer.ConvertComboSkill();
hostPlayer.ValidateSkillGrpShortcut(skillGrpSCConfigArray1);
hostPlayer.AssignSkillGrpShortcut(skillGrpSCConfigArray1, hostPlayer.m_aSCSets1);
hostPlayer.ValidateSkillGrpShortcut(skillGrpSCConfigArray2);
hostPlayer.AssignSkillGrpShortcut(skillGrpSCConfigArray2, hostPlayer.m_aSCSets2);
}
if (hostPlayer.HostIsReady())
{
// Update UI when profession changes, save all shortcut configurations
// to remove effects from intermediate skills (invalid pointers)
// C++: CECGameUIMan *pGameUIMan = g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan();
// pGameUIMan->UpdateSkillRelatedUI();
hostPlayer.UpdateSkillRelatedUI();
}*/
}
public bool HostIsReady() { return true /*m_bEnterGame*/; }
private void OnMsgHstDied(in ECMSG msg)
{
EventBus.PublishChannel(GetCharacterID(), new CECPlayer.CleearComActFlagAllRankNodesEvent(true));
@@ -418,7 +584,6 @@ public partial class CECHostPlayer : CECPlayer
}
void OnMsgHstAttacked(ECMSG Msg)
{
BMLogger.LogError($"HoangDev OnMsgHstAttacked ");
var m_pPlayerMan = EC_ManMessageMono.Instance.EC_ManPlayer;
cmd_host_attacked pCmd = GPDataTypeHelper.FromBytes<cmd_host_attacked>(Msg.dwParam1 as byte[]);
@@ -489,7 +654,7 @@ public partial class CECHostPlayer : CECPlayer
}*/
private void OnMsgHstHurtResult(ECMSG Msg)
{
BMLogger.LogError("HoangDev : OnMsgHstHurtResult");
//BMLogger.LogError("HoangDev : OnMsgHstHurtResult");
/* int cmd = Convert.ToInt32(Msg.dwParam2);
if (cmd == CommandID.BE_HURT)
{
@@ -600,21 +765,21 @@ public partial class CECHostPlayer : CECPlayer
// Add item to inventory
EC_Inventory.SetItem(byPackage, bySlot, newItem);
//Debug.Log($"[Inventory] Successfully added item {tid} to package {byPackage}, slot {bySlot} with count {iAmount}");
//Debug.Log($"[Inventory] Successfully added item {tid} to package {byPackage}, slot {bySlot} with count {iAmount}");
// Trigger UI refresh if an EC_InventoryUI is present in scene
var ui = GameObject.FindFirstObjectByType<EC_InventoryUI>();
if (ui != null)
{
ui.RefreshAll();
// Trigger UI refresh if an EC_InventoryUI is present in scene
var ui = GameObject.FindFirstObjectByType<EC_InventoryUI>();
if (ui != null)
{
ui.RefreshAll();
}
}
else
{
Debug.LogWarning("[Inventory] PICKUP_ITEM: Invalid data length");
}
break;
}
else
{
Debug.LogWarning("[Inventory] PICKUP_ITEM: Invalid data length");
}
break;
}
}
}
public void OnMsgHstItemOperation(ECMSG Msg)
@@ -853,7 +1018,7 @@ public partial class CECHostPlayer : CECPlayer
// Move to revive position and play revive animation
PlayAction((int)PLAYER_ACTION_TYPE.ACT_REVIVE);
// Clear any running dead work if exists
m_pWorkMan?.FinishRunningWork(CECHPWork.Host_work_ID.WORK_DEAD);
m_pWorkMan?.FinishRunningWork(CECHPWork.Host_work_ID.WORK_DEAD);
// Clear corpse state so player is alive again
m_dwStates &= ~(uint)PlayerNPCState.GP_STATE_CORPSE;
}
@@ -866,13 +1031,13 @@ public partial class CECHostPlayer : CECPlayer
byte[] buf = (byte[])Msg.dwParam1;
cmd_notify_hostpos pCmd = GPDataTypeHelper.FromBytes<cmd_notify_hostpos>(buf);
SetPos(new Vector3(pCmd.vPos.x, pCmd.vPos.y, pCmd.vPos.z));
}
// Message MSG_HST_SELTARGET handler
void OnMsgHstSelTarget(ECMSG Msg)
{
BMLogger.LogError("HoangDev: OnMsgHstSelTarget");
//BMLogger.LogError("HoangDev: OnMsgHstSelTarget");
if (Convert.ToInt32(Msg.dwParam2) == CommandID.SELECT_TARGET)
{
var data = (byte[])Msg.dwParam1;
@@ -915,7 +1080,7 @@ public partial class CECHostPlayer : CECPlayer
{
BMLogger.LogError("HostPlayer InitCharacter no CharacterController");
}
//if (role.name != null && role.name.ByteArray != null)
//{
// roleName = Encoding.UTF8.GetString(role.name.ByteArray, 0, role.name.Length);
@@ -947,11 +1112,13 @@ public partial class CECHostPlayer : CECPlayer
m_CDRInfo.vExtent = EC_Utility.ToVector3(m_aabbServer.Extents);
// Create work manager
m_pWorkMan = new CECHPWorkMan(this);
LoadResources();
if (m_pWorkMan == null)
{
return;
}
LoadGfx();
}
@@ -963,6 +1130,17 @@ public partial class CECHostPlayer : CECPlayer
m_pSelectedGFX = await gfxCaster.LoadGFXEx(EC_Resource.res_GFXFile((int)GfxResourceType.RES_GFX_SELECTED));
// m_pHoverGFX = g_pGame->GetGFXCaster()->LoadGFXEx(res_GFXFile(RES_GFX_CURSORHOVER));
// m_pFloatDust = g_pGame->GetGFXCaster()->LoadGFXEx(res_GFXFile(RES_GFX_FLOATING_DUST));
if (true /*CECUIConfig::Instance().GetGameUI().bEnableActionSwitch*/)
{
m_pActionSwitcher = new CECActionSwitcher(this);
}
else
m_pActionSwitcher = new CECActionSwitcherBase(this);
UnityGameSession.c2s_CmdGetAllData(true, true, false);
// TODO: Move this to right flow later , it's just for test now
UnityGameSession.c2s_CmdSendEnterPKPrecinct();
}
private void JoystickStartDrag(JoystickPressEvent joystickPressEvent)
@@ -1289,7 +1467,7 @@ public partial class CECHostPlayer : CECPlayer
return iRet;
}
public CECActionSwitcherBase GetActionSwitcher() { return m_pActionSwitcher; }
private float A3d_Magnitude(A3DVECTOR3 v)
{
return Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
@@ -1447,10 +1625,313 @@ public partial class CECHostPlayer : CECPlayer
{
return m_ExtProps.mv.swim_speed;
}
public bool ApplySkillShortcut(int idSkill, bool bCombo = false /* false */,
int idSelTarget = 0/* 0 */, int iForceAtk = -1/* -1 */)
{
//StackChecker::ACTrace(4);
if (m_pActionSwitcher != null)
m_pActionSwitcher.PostMessge((int)EMsgActionSwitcher.MSG_CASTSKILL);
// Return-town skill is very special, handle it separately
//if (idSkill == ID_RETURNTOWN_SKILL)
// return ReturnToTargetTown(0, bCombo);
//if (idSkill == ID_SUMMONPLAYER_SKILL)
// return SummonPlayer(idSelTarget, bCombo);
//if (!CanDo(CANDO_SPELLMAGIC))
// return false;
//if (InSlidingState())
// return false;
if (!bCombo)
//ClearComboSkill();
if (idSelTarget == 0)
idSelTarget = m_idSelTarget;
CECSkill pSkill = GetPositiveSkillByID(idSkill);
if (pSkill == null) pSkill = GetEquipSkillByID(idSkill);
if (pSkill == null) pSkill = CECComboSkillState.Instance.GetInherentSkillByID((uint)idSkill);
if (pSkill == null)
{
return false;
}
//// If we press a chargeable skill again when it's being charged,
//// we cast it out at once
//if (IsSpellingMagic() && m_pCurSkill && m_pCurSkill->IsCharging() &&
// m_pCurSkill->GetSkillID() == pSkill->GetSkillID())
//{
// m_pCurSkill->EndCharging();
// g_pGame->GetGameSession()->c2s_CmdContinueAction();
// return true;
//}
//int iCon = CheckSkillCastCondition(pSkill);
//if (iCon)
//{
// ProcessSkillCondition(iCon);
// return false;
//}
//// Get force attack flag
bool bForceAttack = false;
//if (iForceAtk < 0)
// bForceAttack = glb_GetForceAttackFlag(0);
//else
// bForceAttack = iForceAtk > 0 ? true : false;
//// Check negative effect skill
//if (pSkill->GetType() == CECSkill::TYPE_ATTACK || pSkill->GetType() == CECSkill::TYPE_CURSE)
//{
// if (idSelTarget == m_PlayerInfo.cid)
// {
// // Host cannot spell negative effect magic to himself.
// g_pGame->GetGameRun()->AddFixedChannelMsg(FIXMSG_TARGETWRONG, GP_CHAT_FIGHT);
// return false;
// }
// else if (idSelTarget)
// {
// if (AttackableJudge(idSelTarget, bForceAttack) != 1)
// return false;
// }
//}
//// Check whether target type match
int idCastTarget = idSelTarget;
int iTargetType = pSkill.GetTargetType();
//if (pSkill->GetType() == CECSkill::TYPE_BLESS ||
// pSkill->GetType() == CECSkill::TYPE_NEUTRALBLESS)
//{
// if (!iTargetType || !ISPLAYERID(idSelTarget))
// idCastTarget = m_PlayerInfo.cid;
// // In some case, we shouldn't add bless effect to other players
// if (ISPLAYERID(idCastTarget) && idCastTarget != m_PlayerInfo.cid)
// {
// // If host has set bless skill filter only to himself, bless skill couldn't add to other players
// BYTE byBLSMask = glb_BuildBLSMask();
// if (pSkill->GetRangeType() == CECSkill::RANGE_POINT)
// {
// if (!IsTeamMember(idCastTarget))
// {
// if (byBLSMask & GP_BLSMASK_SELF)
// idCastTarget = m_PlayerInfo.cid;
// else
// {
// CECElsePlayer* pPlayer = (CECElsePlayer*)g_pGame->GetGameRun()->GetWorld()->GetPlayerMan()->GetPlayer(idCastTarget);
// if (!pPlayer)
// {
// // Ä¿±êÏûʧ
// return false;
// }
// if (pPlayer->IsInvader() || pPlayer->IsPariah())
// {
// if (byBLSMask & GP_BLSMASK_NORED)
// idCastTarget = m_PlayerInfo.cid;
// }
// if (!IsFactionMember(pPlayer->GetFactionID()))
// {
// if (byBLSMask & GP_BLSMASK_NOMAFIA)
// idCastTarget = m_PlayerInfo.cid;
// }
// if (!IsFactionAllianceMember(pPlayer->GetFactionID()))
// {
// if (byBLSMask & GP_BLSMASK_NOALLIANCE)
// idCastTarget = m_PlayerInfo.cid;
// }
// if (GetForce() != pPlayer->GetForce())
// {
// if (byBLSMask & GP_BLSMASK_NOFORCE)
// idCastTarget = m_PlayerInfo.cid;
// }
// }
// }
// }
// // If host is in duel, bless skill couldn't add to opponent
// if (IsInDuel() && idSelTarget == m_pvp.idDuelOpp)
// idCastTarget = m_PlayerInfo.cid;
// // If host is in battle, bless skill couldn't add to enemies
// if (IsInBattle())
// {
// CECElsePlayer* pPlayer = m_pPlayerMan->GetElsePlayer(idCastTarget);
// if (!InSameBattleCamp(pPlayer))
// idCastTarget = m_PlayerInfo.cid;
// }
// }
//}
//else if (pSkill->GetType() == CECSkill::TYPE_BLESSPET)
//{
// CECPet* pPet = g_pGame->GetGameRun()->GetWorld()->GetNPCMan()->GetPetByID(idSelTarget);
// if (!pPet || pPet->GetMasterID() == GetCharacterID())
// {
// // Spell skill on host's pet
// CECPetData* pPetData = m_pPetCorral->GetActivePet();
// if (!pPetData ||
// pPetData->GetClass() != GP_PET_CLASS_COMBAT &&
// pPetData->GetClass() != GP_PET_CLASS_SUMMON &&
// pPetData->GetClass() != GP_PET_CLASS_EVOLUTION)
// return false;
// idCastTarget = m_pPetCorral->GetActivePetNPCID();
// }
// // Only fighting pet can be blessed.
// if (pPet && !pPet->CanBeAttacked())
// return false;
//}
//else
//{
// if (iTargetType != 0 && !idCastTarget)
// return false;
//}
//// iTargetType == 4 means target must be pet. The problem is that pet will
//// disappear from world after it died, so GetWorld()->GetObject() will return
//// NULL when host spells revive-pet skill on his dead pet. So, the target
//// type of revive-pet skill should be 0
//if (iTargetType)
//{
// // Target shoundn't be a corpse ?
// int iAliveFlag = 0;
// if (iTargetType == 1)
// iAliveFlag = 1;
// else if (iTargetType == 2)
// iAliveFlag = 2;
// CECObject* pObject = g_pGame->GetGameRun()->GetWorld()->GetObject(idCastTarget, iAliveFlag);
// if (!pObject)
// return false;
//}
//if (!IsMeleeing() && !IsSpellingMagic() &&
// (!iTargetType || idCastTarget == m_PlayerInfo.cid))
//{
// // Cast this skill need't checking cast distance
// if (!pSkill->ReadyToCast())
// return false;
// // Prepare to cast skill, if skill isn't INSTANT and FLASHMOVE,
// // we must stop moving and stand
// if (!pSkill->IsInstant() && pSkill->GetType() != CECSkill::TYPE_FLASHMOVE)
// {
// if (!NaturallyStopMoving())
// return false; // Couldn't stop naturally, so cancel casting skill
// }
// else if (pSkill->GetType() == CECSkill::TYPE_FLASHMOVE)
// {
// if (!CanDo(CANDO_FLASHMOVE))
// return false;
// }
m_pPrepSkill = pSkill;
//CastSkill(m_idSelTarget, bForceAttack);
//}
//else if (IsSpellingMagic() && m_pCurSkill == pSkill)
//{
// // If we are casting the same skill and it's in cooling time
// return false;
//}
//else // Have to trace selected object before cast skill
//{
// if (!pSkill->ReadyToCast())
// return false;
// if (CECCastSkillWhenMove::Instance().IsSkillSupported(pSkill->GetSkillID(), this) &&
// m_pWorkMan->IsMovingToPosition() &&
// m_pWorkMan->CanCastSkillImmediately(pSkill->GetSkillID()))
// {
// m_pPrepSkill = pSkill;
// return CastSkill(idCastTarget, bForceAttack);
// }
// else
// {
bool bTraceOK = false;
bool bUseAutoPF = false;
/* CECPlayerWrapper* pWrapper = CECAutoPolicy::GetInstance().GetPlayerWrapper();
if (CECAutoPolicy::GetInstance().IsAutoPolicyEnabled() && pWrapper->GetAttackError() >= 2)
bUseAutoPF = true;*/
if (idCastTarget == 0)
{
idCastTarget = GetCharacterID(); // ±ÜÃâË²ÒÆµÈ¼¼ÄÜʱ idCastTarget Ϊ0µ¼Ö CECWorkTrace::CreateTraceTarget ·µ»Ø¿Õ
}
CECHPWork pWork = m_pWorkMan.GetWork(Host_work_ID.WORK_TRACEOBJECT);
if (pWork != null)
{
CECHPWorkTrace pWorkTrace = (CECHPWorkTrace)(pWork);
if (pWorkTrace.GetTraceReason() == Trace_reason.TRACE_SPELL &&
pWorkTrace.GetTarget() == idCastTarget &&
pWorkTrace.GetPrepSkill() == pSkill)
return false; // We are just doing the same thing
pWorkTrace.SetTraceTarget(pWorkTrace.CreatTraceTarget(idCastTarget, Trace_reason.TRACE_SPELL, bForceAttack), bUseAutoPF);
pWorkTrace.SetPrepSkill(pSkill);
bTraceOK = true;
}
else if (m_pWorkMan.CanStartWork(Host_work_ID.WORK_TRACEOBJECT))
{
CECHPWorkTrace pWork2 = (CECHPWorkTrace)m_pWorkMan.CreateWork(Host_work_ID.WORK_TRACEOBJECT);
pWork2.SetTraceTarget(pWork2.CreatTraceTarget(idCastTarget, Trace_reason.TRACE_SPELL, bForceAttack), bUseAutoPF);
pWork2.SetPrepSkill(pSkill);
m_pWorkMan.StartWork_p1(pWork2);
bTraceOK = true;
}
if (!bTraceOK) return false;
// }
//}
return true;
}
public bool CastSkill(int idTarget, bool bForceAttack, CECObject pTarget = null)
{
byte byPVPMask = glb_BuildPVPMask(bForceAttack);
UnityGameSession.c2s_CmdCastSkill(m_pPrepSkill.GetSkillID(), byPVPMask, 1, idTarget);
return true;
}
public byte glb_BuildPVPMask(bool bForceAttack)
{
byte byMask = 0;
if (bForceAttack)
byMask |= (byte)PVPMask.GP_PVPMASK_FORCE;
else
{
/* CECConfigs pConfigs = EC_Game.GetConfigs();
if (pConfigs->GetGameSettings().bAtk_Player)
{
byMask |= GP_PVPMASK_FORCE;
if (pConfigs->GetGameSettings().bAtk_NoMafia)
byMask |= GP_PVPMASK_NOMAFIA;
if (pConfigs->GetGameSettings().bAtk_NoWhite)
byMask |= GP_PVPMASK_NOWHITE;
if (pConfigs->GetGameSettings().bAtk_NoAlliance)
byMask |= GP_PVPMASK_NOALLIANCE;
if (pConfigs->GetGameSettings().bAtk_NoForce)
byMask |= GP_PVPMASK_NOFORCE;
}*/
}
return byMask;
}
public bool SelectTarget(int idTarget)
{
BMLogger.LogError("HoangDev: HostPlayer SelectTarget");
//BMLogger.LogError("HoangDev: HostPlayer SelectTarget");
bool bRet = false;
bool canDo = CanDo(ActionCanDo.CANDO_CHANGESELECT);
bool canselect = CanSelectTarget(idTarget);
@@ -1459,19 +1940,57 @@ public partial class CECHostPlayer : CECPlayer
bRet = true;
if (idTarget == 0)
{
BMLogger.LogError("HoangDev: HostPlayer Unsetlect npc");
//BMLogger.LogError("HoangDev: HostPlayer Unsetlect npc");
UnityGameSession.c2s_CmdUnselect();
}
else
{
BMLogger.LogError("HoangDev: HostPlayer setlect npc");
//BMLogger.LogError("HoangDev: HostPlayer setlect npc");
UnityGameSession.c2s_CmdSelectTarget(idTarget);
}
}
return bRet;
}
public CECSkill GetPositiveSkillByID(int id, bool bSenior = false)
{
CECSkill pSenior = null;
for (int i = 0; i < m_aPtSkills.Count; i++)
{
if (m_aPtSkills[i].GetSkillID() == id)
return m_aPtSkills[i];
else if (m_aPtSkills[i].GetJunior().Find((uint)id))
pSenior = m_aPtSkills[i];
}
if (bSenior && pSenior != null)
return pSenior;
return null;
}
// C# conversion of CECHostPlayer::GetEquipSkillByID
// Assumes: GetEquipSkillNum() returns the count of equipment skills
// GetEquipSkillByIndex(int) returns a CECSkill at the given index
public CECSkill GetEquipSkillByID(int id)
{
CECSkill pRet = null;
for (int i = 0; i < GetEquipSkillNum(); i++)
{
CECSkill pSkill = GetEquipSkillByIndex(i);
if (pSkill != null && pSkill.GetSkillID() == id)
{
pRet = pSkill;
break;
}
}
return pRet;
}
public int GetEquipSkillNum() { return m_aEquipSkills.Count; }
public CECSkill GetEquipSkillByIndex(int n) { return m_aEquipSkills[n]; }
bool CanSelectTarget(int idTarget)
{
if (idTarget == 0 || idTarget == this.GetCharacterID())
@@ -1755,12 +2274,28 @@ public partial class CECHostPlayer : CECPlayer
return bRet;
}
public int GetProfession()
{
return m_iProfession;
}
public void SetSelectedTarget(int id)
{
m_idSelTarget = id;
}
public bool glb_GetForceAttackFlag(uint pdwParam)
{
/*bool bForceAttack = false;
CECInputCtrl* pInputCtrl = g_pGame->GetGameRun()->GetInputCtrl();
if (pdwParam)
bForceAttack = pInputCtrl->IsCtrlPressed(*pdwParam);
else
bForceAttack = pInputCtrl->KeyIsBeingPressed(VK_CONTROL);
return bForceAttack;*/
return true;
}
//public float GetSwimSpeedSev()
//{
// float fSpeedSev = GetSwimSpeed();
@@ -1952,7 +2487,7 @@ public struct NPCINFO
public int MaxHealth; // Attacking properties
public int IDNPC; // Attacking properties
public NPCINFO(string name, int currentHealth, int maxHealth,int idnpc)
public NPCINFO(string name, int currentHealth, int maxHealth, int idnpc)
{
Name = name;
CurrentHealth = currentHealth;
+158 -155
View File
@@ -5,184 +5,187 @@ using System.IO;
using System.Text;
using UnityEngine; // thêm để dùng Resources & TextAsset
public class CECStringTab
namespace BrewMonster
{
private readonly Dictionary<int, string> m_AStrTab = new Dictionary<int, string>();
private readonly Dictionary<int, string> m_WStrTab = new Dictionary<int, string>();
private bool m_bInit = false;
private bool m_bUnicode = false;
public CECStringTab() { }
~CECStringTab() { Release(); }
public bool Init(string szFile, bool bUnicode)
public class CECStringTab
{
Release();
m_bUnicode = bUnicode;
private readonly Dictionary<int, string> m_AStrTab = new Dictionary<int, string>();
private readonly Dictionary<int, string> m_WStrTab = new Dictionary<int, string>();
try
private bool m_bInit = false;
private bool m_bUnicode = false;
public CECStringTab() { }
~CECStringTab() { Release(); }
public bool Init(string szFile, bool bUnicode)
{
bool ok = bUnicode ? LoadWideStrings(szFile) : LoadANSIStrings(szFile);
m_bInit = ok;
return ok;
}
catch (Exception e)
{
Debug.LogError($"[CECStringTab] Init failed: {e}");
Release();
return false;
}
}
m_bUnicode = bUnicode;
public void Release()
{
m_AStrTab.Clear();
m_WStrTab.Clear();
m_bInit = false;
m_bUnicode = false;
}
public string GetANSIString(int n) => m_AStrTab.TryGetValue(n, out var s) ? s : null;
public string GetWideString(int n) => m_WStrTab.TryGetValue(n, out var s) ? s : null;
public string GetWideStringObject(int n) => GetWideString(n);
public bool IsInitialized() => m_bInit;
// ==== Đọc từ Resources thay vì đường dẫn ====
protected bool LoadANSIStrings(string resourceName)
{
TextAsset textAsset = Resources.Load<TextAsset>(resourceName);
if (textAsset == null)
{
Debug.LogError($"[CECStringTab] Resource not found: {resourceName}");
return false;
}
// Giải mã bytes -> string (ANSI: dùng Encoding.Default)
string content = ByteToStringUtils.ByteArrayToCP936String(textAsset.bytes);
using var sr = new StringReader(content);
return ParseIntoDict(sr, isWide: false);
}
protected bool LoadWideStrings(string resourceName)
{
TextAsset textAsset = Resources.Load<TextAsset>(resourceName);
if (textAsset == null)
{
Debug.LogError($"[CECStringTab] Resource not found: {resourceName}");
return false;
}
// Unity TextAsset mặc định đã decode text UTF8 -> textAsset.text
// nhưng để chắc chắn BOM/Unicode thì đọc từ bytes
string content;
content = ByteToStringUtils.ByteArrayToUnicodeString(textAsset.bytes);
using var sr = new StringReader(content);
return ParseIntoDict(sr, isWide: true);
}
private static Encoding DetectEncoding(byte[] bom)
{
if (bom.Length >= 3 && bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF) return Encoding.UTF8;
if (bom.Length >= 2 && bom[0] == 0xFF && bom[1] == 0xFE) return Encoding.Unicode;
if (bom.Length >= 2 && bom[0] == 0xFE && bom[1] == 0xFF) return Encoding.BigEndianUnicode;
return null;
}
private bool ParseIntoDict(StringReader sr, bool isWide)
{
bool bIndexMode = false;
bool bBegan = false;
int autoIndex = 0;
var allLines = new List<string>();
string line;
while ((line = sr.ReadLine()) != null)
{
allLines.Add(line);
}
for (int i = 0; i < allLines.Count; i++)
{
var ln = allLines[i].Trim();
if (ln.Length == 0) continue;
if (ln.Equals("#_index", StringComparison.OrdinalIgnoreCase))
try
{
bIndexMode = true;
bool ok = bUnicode ? LoadWideStrings(szFile) : LoadANSIStrings(szFile);
m_bInit = ok;
return ok;
}
else if (ln.Equals("#_begin", StringComparison.OrdinalIgnoreCase))
catch (Exception e)
{
bBegan = true;
Debug.LogError($"[CECStringTab] Init failed: {e}");
Release();
return false;
}
}
for (int j = i + 1; j < allLines.Count; j++)
public void Release()
{
m_AStrTab.Clear();
m_WStrTab.Clear();
m_bInit = false;
m_bUnicode = false;
}
public string GetANSIString(int n) => m_AStrTab.TryGetValue(n, out var s) ? s : null;
public string GetWideString(int n) => m_WStrTab.TryGetValue(n, out var s) ? s : null;
public string GetWideStringObject(int n) => GetWideString(n);
public bool IsInitialized() => m_bInit;
// ==== Đọc từ Resources thay vì đường dẫn ====
protected bool LoadANSIStrings(string resourceName)
{
TextAsset textAsset = Resources.Load<TextAsset>(resourceName);
if (textAsset == null)
{
Debug.LogError($"[CECStringTab] Resource not found: {resourceName}");
return false;
}
// Giải mã bytes -> string (ANSI: dùng Encoding.Default)
string content = ByteToStringUtils.ByteArrayToCP936String(textAsset.bytes);
using var sr = new StringReader(content);
return ParseIntoDict(sr, isWide: false);
}
protected bool LoadWideStrings(string resourceName)
{
TextAsset textAsset = Resources.Load<TextAsset>(resourceName);
if (textAsset == null)
{
Debug.LogError($"[CECStringTab] Resource not found: {resourceName}");
return false;
}
// Unity TextAsset mặc định đã decode text UTF8 -> textAsset.text
// nhưng để chắc chắn BOM/Unicode thì đọc từ bytes
string content;
content = ByteToStringUtils.ByteArrayToUnicodeString(textAsset.bytes);
using var sr = new StringReader(content);
return ParseIntoDict(sr, isWide: true);
}
private static Encoding DetectEncoding(byte[] bom)
{
if (bom.Length >= 3 && bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF) return Encoding.UTF8;
if (bom.Length >= 2 && bom[0] == 0xFF && bom[1] == 0xFE) return Encoding.Unicode;
if (bom.Length >= 2 && bom[0] == 0xFE && bom[1] == 0xFF) return Encoding.BigEndianUnicode;
return null;
}
private bool ParseIntoDict(StringReader sr, bool isWide)
{
bool bIndexMode = false;
bool bBegan = false;
int autoIndex = 0;
var allLines = new List<string>();
string line;
while ((line = sr.ReadLine()) != null)
{
allLines.Add(line);
}
for (int i = 0; i < allLines.Count; i++)
{
var ln = allLines[i].Trim();
if (ln.Length == 0) continue;
if (ln.Equals("#_index", StringComparison.OrdinalIgnoreCase))
{
var payload = allLines[j].Trim();
if (payload.Length == 0) continue;
if (payload.StartsWith("#")) continue;
if (payload.StartsWith("//")) continue;
if (bIndexMode)
{
if (!TrySplitIndexAndText(payload, out int idx, out string text))
continue;
PutString(idx, text, isWide);
}
else
{
PutString(autoIndex++, payload, isWide);
}
bIndexMode = true;
}
else if (ln.Equals("#_begin", StringComparison.OrdinalIgnoreCase))
{
bBegan = true;
for (int j = i + 1; j < allLines.Count; j++)
{
var payload = allLines[j].Trim();
if (payload.Length == 0) continue;
if (payload.StartsWith("#")) continue;
if (payload.StartsWith("//")) continue;
if (bIndexMode)
{
if (!TrySplitIndexAndText(payload, out int idx, out string text))
continue;
PutString(idx, text, isWide);
}
else
{
PutString(autoIndex++, payload, isWide);
}
}
break;
}
break;
}
return bBegan;
}
return bBegan;
}
private static bool TrySplitIndexAndText(string line, out int index, out string text)
{
index = 0; text = null;
int eq = line.IndexOf('=');
if (eq >= 0)
private static bool TrySplitIndexAndText(string line, out int index, out string text)
{
var left = line.Substring(0, eq).Trim();
var right = line.Substring(eq + 1);
if (int.TryParse(left, out index))
index = 0; text = null;
int eq = line.IndexOf('=');
if (eq >= 0)
{
text = right;
var left = line.Substring(0, eq).Trim();
var right = line.Substring(eq + 1);
if (int.TryParse(left, out index))
{
text = right;
return true;
}
return false;
}
int sp = FirstWhiteSpaceIndex(line);
if (sp <= 0) return false;
var left2 = line.Substring(0, sp).Trim();
var right2 = line.Substring(sp).TrimStart();
if (int.TryParse(left2, out index))
{
text = right2;
return true;
}
return false;
}
int sp = FirstWhiteSpaceIndex(line);
if (sp <= 0) return false;
var left2 = line.Substring(0, sp).Trim();
var right2 = line.Substring(sp).TrimStart();
if (int.TryParse(left2, out index))
private static int FirstWhiteSpaceIndex(string s)
{
text = right2;
return true;
for (int i = 0; i < s.Length; i++)
if (char.IsWhiteSpace(s[i])) return i;
return -1;
}
return false;
}
private static int FirstWhiteSpaceIndex(string s)
{
for (int i = 0; i < s.Length; i++)
if (char.IsWhiteSpace(s[i])) return i;
return -1;
private void PutString(int id, string value, bool isWide)
{
if (isWide) m_WStrTab[id] = value;
else m_AStrTab[id] = value;
}
}
private void PutString(int id, string value, bool isWide)
{
if (isWide) m_WStrTab[id] = value;
else m_AStrTab[id] = value;
}
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ namespace BrewMonster.Managers
[SerializeField] private ScreenLogin screenLogin;
[SerializeField] private SelecScreenCharacter screenCharacter;
[SerializeField] private GameObject bgr;
[SerializeField] private GameController gameController;
[SerializeField] private CECGameRun gameController;
GameObject screenLoginOb;
GameObject screenCharacterOb;
-2
View File
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 839d10a1a7b2c4a44a99e77558b12d02
+2 -2
View File
@@ -32,13 +32,13 @@ public class PlayerVisual : MonoBehaviour
namedAnimancer = GetComponentInChildren<NamedAnimancerComponent>();
if (namedAnimancer == null)
{
BrewMonster.BMLogger.LogError("InitPlayerEventDoneHandler animancer == null");
BrewMonster.BMLogger.LogWarning("InitPlayerEventDoneHandler animancer == null");
return;
}
var player = GetComponentInParent<CECPlayer>();
if (player == null)
{
BMLogger.LogError("player == null");
BMLogger.LogWarning("player == null");
return;
}