Skip to content

Commit

Permalink
some work on the inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
bierdosenhalter committed Dec 3, 2024
1 parent 9d66826 commit 5e6bc01
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 138 deletions.
4 changes: 4 additions & 0 deletions Client/Config/ClientConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ private static void LoadSingleSetting(string argName, string argValue)
MsPerTick = int.Parse(argValue);
return;

case "useinventory":
UseInventory = bool.Parse(argValue);
break;

default:
RyzomClient.GetInstance().GetLogger().Warn($"Could not parse setting {argName} with value '{argValue}'.");
return;
Expand Down
2 changes: 1 addition & 1 deletion Client/Database/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public DatabaseNodeLeaf GetDbProp(string name, bool create = true)
/// </summary>
/// <param name="name">The name of the leaf node.</param>
/// <param name="create">Specifies if the node should be created if it doesn't exist yet.</param>
public DatabaseNodeLeaf GetDbLeaf(string name, bool create)
private DatabaseNodeLeaf GetDbLeaf(string name, bool create)
{
if (string.IsNullOrEmpty(name))
{
Expand Down
6 changes: 3 additions & 3 deletions Client/Database/DatabaseNodeBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ internal override void Init(XmlElement node, Action progressCallBack, bool mapBa
/// <inheritdoc/>
public override bool AddObserver(IPropertyObserver observer, TextId id)
{
//test if this node is the desired one, if yes, add the observer to all the children nodes
// test if this node is the desired one, if yes, add the observer to all the children nodes
if (id.GetCurrentIndex() == (int)id.Size())
{
for (int i = 0; i < _nodes.Count; ++i)
Expand Down Expand Up @@ -220,7 +220,7 @@ private static void AddNode(DatabaseNode newDatabaseNode, string newName, Databa
/// </summary>
/// <param name="id">the TextId identifying the database node</param>
/// <param name="bCreate">true, if the node should be created</param>
internal override DatabaseNode GetNode(TextId id, bool bCreate = true)
internal override DatabaseNode GetNode(TextId id, bool bCreate = false)
{
// lookup next element from textid in my index => idx
var str = id.ReadNext();
Expand All @@ -235,7 +235,7 @@ internal override DatabaseNode GetNode(TextId id, bool bCreate = true)
// Yoyo: must not be SERVER or LOCAL, cause definied through xml.
// This may cause some important crash error
Debug.Assert(id != null);
Debug.Assert(id.GetElement(0) != "SERVER");
//Debug.Assert(id.GetElement(0) != "SERVER");
//Debug.Assert(id.GetElement(0) != "LOCAL");

DatabaseNode newNode;
Expand Down
8 changes: 8 additions & 0 deletions Client/Database/TextId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public TextId(string str)
_ids.Add(s.Substring(i, j));
}

/// <summary>
/// Default constructor
/// </summary>
public TextId()
{
_idx = 0;
}

/// <summary>
/// Build a string from this text id
/// </summary>
Expand Down
9 changes: 7 additions & 2 deletions Client/Interface/InterfaceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Client.Brick;
using Client.Config;
using Client.Database;
using Client.Inventory;
using Client.Network.Web;
using Client.Phrase;
using Client.Skill;
Expand All @@ -32,6 +33,7 @@ public class InterfaceManager
private readonly BrickManager _brickManager;
private readonly PhraseManager _phraseManager;
private readonly IWebTransfer _webTransfer;
private readonly InventoryManager _inventoryManager;

ServerToLocalAutoCopy ServerToLocalAutoCopyInventory;
ServerToLocalAutoCopy ServerToLocalAutoCopyExchange;
Expand All @@ -55,6 +57,7 @@ public InterfaceManager(RyzomClient client)
_skillManager = client.GetSkillManager();
_brickManager = client.GetBrickManager();
_phraseManager = client.GetPhraseManager();
_inventoryManager = client.GetInventoryManager();
_webTransfer = client.GetWebTransfer();

ServerToLocalAutoCopyInventory = new ServerToLocalAutoCopy(this, _databaseManager);
Expand All @@ -79,7 +82,10 @@ public void InitInGame()
// SPhrase Manager DB Init (BEFORE loading). Must be init AFTER skill and brick init
_phraseManager.InitInGame();

// Start the WebIG Thread
// Initialize inventory manager : link to DB and to interface element so must be here
_inventoryManager.Init();

// Start the WebIG Thread - TODO ADD PROXY
WebigThread.StartThread(_client, _webTransfer);

// Start the Browser Proxy
Expand All @@ -96,7 +102,6 @@ public void CreateLocalBranch(string fileName)

// Init an xml stream
file.Load(fileName);
file.Load(fileName);

// Parse the parser output!!!
var localNode = new DatabaseNodeBranch("LOCAL");
Expand Down
1 change: 1 addition & 0 deletions Client/Interface/ServerToLocalAutoCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void Init(string dbPath)
// **** Init the Nodes shortcut
// Parse all Local Nodes
DatabaseNodeBranch localBranch = _databaseManager.GetDbBranch("LOCAL:" + dbPath);

if (localBranch != null)
{
int i;
Expand Down
Loading

0 comments on commit 5e6bc01

Please sign in to comment.