Mythli
Members-
Posts
25 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
Mythli's Achievements
Member (2/3)
0
Reputation
-
Where is the creature scale/size stored in dbc files?
Mythli replied to a topic in OldGeneral discussion
No, Database data is by default 0 (that means dbc-data is used) Thanks for your help -
WAD is a very old emulator supporting patch 1.x if you want to call it so (it is more about playing with the wow world) for more info read http://www.gotwow.ic.cz/wowd/ "Database" files in WAD look like this: #include scripts/extra/creatures_auctioneers.scp ... #include scripts/afg/afgcreatures.scp #include scripts/afg/afgqiraj.scp #include scripts/chronos/chronos_vendors.scp #include scripts/chronos/chronos_creatures.scp [creature 0] name=Spawn Points (Only GM can see it) faction=35 level=255 attack=2000 2200 bounding_radius=1.5 combat_reach=2.25 damage=0 2 maxhealth=56 model=262 size=0.5 type=1 maxmana=0 money=127500 [creature 1] name=Spawn Point (Only GM can see it) faction=35 level=255 attack=2000 2200 bounding_radius=1.5 combat_reach=2.25 damage=0 2 maxhealth=56 model=262 size=0.5 type=1 maxmana=0 money=127500
-
I have written this tool long time ago for personal use and learning reasons (first c# programm i have ever wrote) SQLUpdate Merging Tool This is my little tool for merging various sql-updates to one big update. i have written this in .net (c#) but dont look at the code it's horrible Features: 1. Support SD2, Mangos, UDB and many other SQL Update formats ^\\\\d+_{1}(\\\\d+)_{1}\\\\d+_{1}([A-Z]|[a-z]+)_{1}(.*)$", //match mangos update style (provide revision number, databasename, tablename) ^r{1}(\\\\d+)_{1}(\\\\w+).*$", //match SD2 Update style with some on official style (provide revision number& database name) ^r{1}(\\\\d+)_{1}(.*)$", //match SD2 update style (provide revision number& database name) 2. Grouping 3. Editing 4. Drag& Drop 5. Apply filter Screenshots& Explanation: Feel free to comment this tool/ post feedback. regards Mythli <3 Download: http://mythli.ath.cx/websvn/wsvn/Downloads/sqlupdatemerge_1.0/?op=dl&isdir=1& Changelog: http://mythli.ath.cx/websvn/wsvn/sqlMerge/trunk/?op=log&isdir=1& RSS: http://mythli.ath.cx/websvn/wsvn/sqlMerge/trunk/?op=rss&isdir=1& requires .net framework 2.0 or newest mono release.
-
In the hope someone find this snippet usefull using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Text.RegularExpressions; using System.Data; namespace scpparser.Classes { public class ScpParser { public String IncludeRoot; public String FileName; public List<String> ParsedFiles = new List<String>(); private Regex IncludeSearchPattern = new Regex("^(?!//)#include\\\\s*(.*)"); private Regex SectionStartSearchPattern = new Regex("^(?!//)\\\\[(\\\\w+)\\\\s*([^]]+)\\\\]$"); private Regex ValuePairSearchPattern = new Regex("^(?!//)(\\\\w+)\\\\s*=\\\\s*(.*)$"); private String currentSection; private String currentPrimaryKey; public Dictionary<String, Dictionary<String, List<String>>> ParseResult = new Dictionary<String, Dictionary<String, List<String>>>(); public Dictionary<String, String> ParsedColumns = new Dictionary<String, String>(); public ScpParser() { } public ScpParser(String IncludeRoot, String FileName) : this() { this.Open(IncludeRoot, FileName); } public void HandleInclude(String FileName) { FileName = Path.Combine(this.IncludeRoot, FileName); this.ParseFile(FileName); } public void HandleSection(String SectionName, String PrimaryKey) { this.currentSection = SectionName; this.currentPrimaryKey = PrimaryKey; this.ParseResult.Add(PrimaryKey, new Dictionary<String, List<String>>()); } public void HandleValuePair(String ValueName, String Value) { if (String.IsNullOrEmpty(this.currentSection) || String.IsNullOrEmpty(this.currentPrimaryKey)) return; if (!this.ParseResult[this.currentPrimaryKey].ContainsKey(ValueName)) { this.ParseResult[this.currentPrimaryKey].Add(ValueName, new List<String>()); } if (!this.ParsedColumns.ContainsKey(ValueName)) this.ParsedColumns.Add(ValueName, ""); this.ParseResult[this.currentPrimaryKey][ValueName].Add(Value); } public void ParseLine(String Line) { Match match = null; match = this.IncludeSearchPattern.Match(Line); if (match.Success) { this.HandleInclude(match.Groups[1].Value); return; } match = this.SectionStartSearchPattern.Match(Line); if (match.Success) { this.HandleSection(match.Groups[1].Value, match.Groups[2].Value); return; } match = this.ValuePairSearchPattern.Match(Line); if (match.Success) { this.HandleValuePair(match.Groups[1].Value, match.Groups[2].Value); return; } } public void ParseFile(String FileName) { using (StreamReader fStream = File.OpenText(FileName)) { String line; while ((line = fStream.ReadLine()) != null) { this.ParseLine(line); } } this.ParsedFiles.Add(FileName); } public void Open(String IncludeRoot, String FileName) { this.IncludeRoot = IncludeRoot; this.FileName = FileName; this.ParseFile(FileName); } } }
-
Where is the creature scale/size stored in dbc files?
Mythli posted a topic in OldGeneral discussion
The Subject tells you everything you need to know Thanks in advance -
look at my source, i don't make anything different.
-
that's true and... I have already said that this was just programmed for learning reasons so sscanf(..) is faster and i never said that regular expressions make the performance boost if we look at the code while(std::getline(this->fileStream, line)) { parselinehere(line); } would end in: * read line from file * parse line * waiting for parsing line to read next line until all lines are parsed with multiple threads we can read lines without waiting for parsing - on my hardware reading lines is very fast (ssd) and parsing lines is the time consuming thing. With multiple threads and a line buffer we can reduce the overhead to a minimum.
-
"additemset" is a method in the player class which is derived from the unit class. so do research on your own before posing...
-
i started programming with c++ a few weeks ago but i still think this is a good thing ("this->) "logical divide" member and local variables like m_ do. we are talking about 100-200ms or something around
-
I've programmed this for learning reasons and i need some feedback (coding style, correct pointers, ...) this codesnip will parse mangos-like configuration files using regular expressions and multiple threads (you need the boost c++ libary to compile) On a AMD Phenom x4 945 (+intel ssd) this code is up to 20 times faster in parsing than the dotconfpp mangos configuration class i don't think performance matter if we parse configuration files but this is still an interesting fact. here is my code: header-file: #ifndef CONFIG_H #define CONFIG_H #include "Common.h" #include <fstream> #include <boost/regex.hpp> class Config { public: Config(std::string ConfigFileName); void ReloadConfig(); std::string GetStringDefault(std::string Name, std::string DefaultValue = ""); bool GetBoolDefault(std::string Name, bool DefaultValue = false); int GetIntDefault(std::string Name, int DefaultValue = 0); float GetFloatDefault(std::string Name, float DefaultValue = 0); std::string GetFileName() { return this->configFileName; } ~Config(); private: std::string configFileName; std::ifstream fileStream; boost::regex searchPattern; stringMapType configMap; //--used for threading boost::mutex lineBufferMutex; boost::mutex configMapMutex; std::list<std::string> lineBuffer; bool isFileFinish; void lineParser(); //-- }; #endif code-file: #include "Config.h" Config::Config(std::string ConfigFileName) { this->configFileName = ConfigFileName; this->fileStream.open(this->configFileName); if (this->fileStream.is_open()) { this->searchPattern = boost::regex("^([ \\\\t]+)?([^#][^\\\\s]+)\\\\s*=\\\\s*(?\\\\d+)|(?:\\"([^\\"]*)\\")).*$"); this->ReloadConfig(); } } void Config::lineParser() { //--keep thread alive until file is fully pushed into lineBuffer and lineBuffer is empty while(this->isFileFinish == false || this->lineBuffer.size() != 0) { //--wait until lines for parsing are avaible if (this->lineBuffer.size() == 0) boost::this_thread::sleep(boost::Posix_time::millisec(1)); //-- else { boost::match_results<std::string::const_iterator> matches; //--lock lineBuffer object this->lineBufferMutex.lock(); //copy first line into temp var std::string line = *this->lineBuffer.begin(); //remove first line from lineBuffer this->lineBuffer.pop_front(); this->lineBufferMutex.unlock(); //-- if (boost::regex_match(line, matches, this->searchPattern)) { //--insert match into our configMap (we have to lock our configMap object first) this->configMapMutex.lock(); if (matches[3].matched) //insert number (without qoutes) this->configMap.insert(std::make_pair(matches[2], matches[3])); else //insert string (in quoutes) this->configMap.insert(std::make_pair(matches[2], matches[4])); this->configMapMutex.unlock(); //-- } } //-- } } void Config::ReloadConfig() { //--reset this->configMap.clear(); this->fileStream.seekg(0, ios::beg); this->isFileFinish = false; //-- //--define variables std::string line; boost::thread_group threadPool; //-- //--create parser-threads for each logical cpu for(uint32 i = 0; i < boost::thread::hardware_concurrency(); i++) { threadPool.create_thread(boost::bind(&Config::lineParser, this)); } //-- //--push lines from file in our lineBuffer while(std::getline(this->fileStream, line)) { this->lineBuffer.push_back(line); } //-- this->isFileFinish = true; //wait until all lines are parsed threadPool.join_all(); } std::string Config::GetStringDefault(std::string Name, std::string DefaultValue) { stringMapType::const_iterator configNode = this->configMap.find(Name); if(configNode != this->configMap.end()) return configNode->second; else return DefaultValue; } bool Config::GetBoolDefault(std::string Name, bool DefaultValue) { std::string baseValue = this->GetStringDefault(Name, ""); if (baseValue == "") return DefaultValue; else return boost::lexical_cast<bool>(baseValue); } int Config::GetIntDefault(std::string Name, int DefaultValue) { std::string baseValue = this->GetStringDefault(Name, ""); if (baseValue == "") return DefaultValue; else return boost::lexical_cast<int>(baseValue); } float Config::GetFloatDefault(std::string Name, float DefaultValue) { std::string baseValue = this->GetStringDefault(Name, ""); if (baseValue == "") return DefaultValue; else return boost::lexical_cast<float>(baseValue); } Config::~Config() { this->fileStream.close(); }
-
mangos use multiple threads if you mean that - but i think it only support 2 logical cores fully wasn't it?
-
public class DotConfParser : Dictionary<String, String> { public DotConfParser() :base() {} public DotConfParser(String FileName) { this.configFileName = FileName; this.Reload(); } public void Reload() { using (StreamReader streamReader = new StreamReader(File.OpenRead(this.configFileName))) { while (!streamReader.EndOfStream) { Match match = this.searchPattern.Match(streamReader.ReadLine()); if (match.Success) if (!base.ContainsKey(match.Groups[2].Value)) base.Add(match.Groups[2].Value, match.Groups[3].Value.Trim('"')); } } } private String configFileName; private Regex searchPattern = new Regex(@"^([ \\\\t]+)?([^#].+)\\\\s*=\\\\s*(?\\\\d)|(?:\\"([^\\"]*)\\")).*$", RegexOptions.Compiled | RegexOptions.Multiline); } A c# class to read mangos configuration files. Enjoy.
-
And the "new" already very shiny wiki would be more shiny with more activity inside take this as attention
-
If you look at DBCReader.cs you will see that there is no detection: for (int r = 0; r < header.RecordsCount; ++r) { uint key = reader.ReadUInt32(); reader.BaseStream.Position -= 4; T T_entry = reader.ReadStruct<T>(); dict.Add(key, T_entry); } He try to read a struct from DBCFile with predefined types, structure of Spell.dbc is defined in "Structure.cs" - this is exactly that what i don't want.
-
I have done some research on mangos code (DBCLoader) and figured out that you have string-reference fields which contain a Int32 value that point to a string with the following offset: StrReadOffset = StringStartOffset + FieldValue Problem now is that i have to detect if column is a string reference or not.
Contact Us
To contact us
click here
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
Copyright © getMaNGOS. All rights Reserved.
This website is in no way associated with or endorsed by Blizzard Entertainment®
This website is in no way associated with or endorsed by Blizzard Entertainment®