Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Merging UserID with ID
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Velaski" data-source="post: 385350" data-attributes="member: 61835"><p>Ok, title may be a bit confusing I will explain.</p><p>I have my code here:</p><p>[CODE]class Character</p><p> {</p><p> public int Id { get; set; }</p><p> public int HP { get; set; }</p><p> public int Kills { get; set; }</p><p> public int Deaths { get; set; }</p><p></p><p> public Character(int Id, int HP, int Kills, int Deaths)</p><p> {</p><p> this.Id = Id;</p><p> this.HP = HP;</p><p> this.Kills = Kills;</p><p> this.Deaths = Deaths;</p><p> }</p><p> }[/CODE]</p><p>And I want that "ID" to match the current userid, and I'm coding the manager. This is my current code:</p><p>[CODE]using log4net;</p><p>using Plus.Database.Interfaces;</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Data;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Threading.Tasks;</p><p></p><p>namespace Plus.HabboHotel.Minigames</p><p>{</p><p> class CharacterManager</p><p> {</p><p> private static readonly ILog log = LogManager.GetLogger("Plus.HabboHotel.Minigames.CharacterManager");</p><p> private readonly Dictionary<int, Character> _character = new Dictionary<int, Character>();</p><p></p><p> public CharacterManager()</p><p> {</p><p></p><p> }</p><p> public void Init()</p><p> {</p><p> if (this._character.Count > 0)</p><p> this._character.Clear();</p><p></p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT * FROM `userminigame_stats`;");</p><p> DataTable GetCharacter = dbClient.getTable();</p><p></p><p> if (GetCharacter != null)</p><p> {</p><p> foreach (DataRow Row in GetCharacter.Rows)</p><p> {</p><p> if (!this._character.ContainsKey(Convert.ToInt32(Row["id"])))</p><p> this._character.Add(Convert.ToInt32(Row["id"]), new Character(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["hp"]), Convert.ToInt32(Row["kills"]), Convert.ToInt32(Row["deaths"])));</p><p> }</p><p> }</p><p> }</p><p></p><p> log.Info("Loaded " + this._character.Count + " Minigame Character Codes.");</p><p> }</p><p></p><p></p><p></p><p> }</p><p>}</p><p></p><p> </p><p></p><p> </p><p></p><p>[/CODE]</p><p></p><p>I also want it to start as default: </p><p>ID = Default userid</p><p>HP = 100</p><p>Kills = 0</p><p>Deaths = 0</p><p></p><p>Can anybody help real quick?</p><p></p><p>[USER=36373]@JayCustom[/USER] [USER=591]@Sledmore[/USER] [USER=59038]@Altercationz[/USER] [USER=1553]@Meap[/USER]</p></blockquote><p></p>
[QUOTE="Velaski, post: 385350, member: 61835"] Ok, title may be a bit confusing I will explain. I have my code here: [CODE]class Character { public int Id { get; set; } public int HP { get; set; } public int Kills { get; set; } public int Deaths { get; set; } public Character(int Id, int HP, int Kills, int Deaths) { this.Id = Id; this.HP = HP; this.Kills = Kills; this.Deaths = Deaths; } }[/CODE] And I want that "ID" to match the current userid, and I'm coding the manager. This is my current code: [CODE]using log4net; using Plus.Database.Interfaces; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Plus.HabboHotel.Minigames { class CharacterManager { private static readonly ILog log = LogManager.GetLogger("Plus.HabboHotel.Minigames.CharacterManager"); private readonly Dictionary<int, Character> _character = new Dictionary<int, Character>(); public CharacterManager() { } public void Init() { if (this._character.Count > 0) this._character.Clear(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `userminigame_stats`;"); DataTable GetCharacter = dbClient.getTable(); if (GetCharacter != null) { foreach (DataRow Row in GetCharacter.Rows) { if (!this._character.ContainsKey(Convert.ToInt32(Row["id"]))) this._character.Add(Convert.ToInt32(Row["id"]), new Character(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["hp"]), Convert.ToInt32(Row["kills"]), Convert.ToInt32(Row["deaths"]))); } } } log.Info("Loaded " + this._character.Count + " Minigame Character Codes."); } } } [/CODE] I also want it to start as default: ID = Default userid HP = 100 Kills = 0 Deaths = 0 Can anybody help real quick? [USER=36373]@JayCustom[/USER] [USER=591]@Sledmore[/USER] [USER=59038]@Altercationz[/USER] [USER=1553]@Meap[/USER] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Merging UserID with ID
Top