Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-04-2009, 07:41 PM
mixxit
Hill Giant
 
Join Date: Sep 2006
Posts: 155
Default How soon do rules apply

If i apply a rule - when will it apply? Instantly?

Cheers guys!
Reply With Quote
  #2  
Old 07-04-2009, 08:51 PM
Zeice
Sarnak
 
Join Date: Oct 2008
Location: USA
Posts: 92
Default

I believe you have reboot the server.
Reply With Quote
  #3  
Old 07-04-2009, 08:58 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

I've been using #rules setdb in game and the change works instantly.
Reply With Quote
  #4  
Old 07-04-2009, 09:41 PM
Zeice
Sarnak
 
Join Date: Oct 2008
Location: USA
Posts: 92
Default

I didn't even know that command existed. -_-

Well learn something new everyday.
Reply With Quote
  #5  
Old 07-05-2009, 02:21 AM
mixxit
Hill Giant
 
Join Date: Sep 2006
Posts: 155
Default

thanks for the info
Reply With Quote
  #6  
Old 07-05-2009, 02:46 AM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

The downside to #rules setdb is that it appears to wipe out the Notes field.
Reply With Quote
  #7  
Old 07-05-2009, 04:02 AM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

I can see how to fix that algorithmically, but my C++ isn't up to it.

---
In memory, add a 1 byte field to the rule struct, called hasNote, default value false

When loading rules from DB, set hasNote to true if note field is non empty

In _SaveRule use an UPDATE instead of REPLACE if hasNote is true.
---

If rule isn't in DB then hasNote is false and the current REPLACE query is run.

Cost is slightly longer load time at server startup, and less than a kb of memory (assuming that there are less than a k of rules!).

I'll learn C++ by breaking my server trying to implement this.... it'll take me a while.
Reply With Quote
  #8  
Old 07-05-2009, 12:19 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

should be able to use INSERT ... ON DUPLICATE KEY UPDATE ... ; syntax and not need to track if the notes field exists.
Reply With Quote
  #9  
Old 07-05-2009, 12:51 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Here's the function from common/rulesys.cpp:

Code:
void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
	char vstr[100];

	switch(type) {
	case IntRule:
		sprintf(vstr, "%d", m_RuleIntValues[index]);
		break;
	case RealRule:
		sprintf(vstr, "%.13f", m_RuleRealValues[index]);
		break;
	case BoolRule:
		sprintf(vstr, "%s", m_RuleBoolValues[index]?"true":"false");
		break;
	}
	
	char errbuf[MYSQL_ERRMSG_SIZE];
    char* query = 0;
	if (!db->RunQuery(query, MakeAnyLenString(&query, 
		"REPLACE INTO rule_values (ruleset_id, rule_name, rule_value) "
		" VALUES(%d, '%s', '%s')",
		m_activeRuleset, _GetRuleName(type, index), vstr),errbuf))
	{
		_log(RULES__ERROR, "Fauled to set rule in the database: %s: %s", query,errbuf);
	}
	safe_delete_array(query);
}
I'd commit the change real quick, but I don't really have enough time to test it out. If someone else ends up committing this, please change that typo
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #10  
Old 07-05-2009, 04:39 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

That change works.
Reply With Quote
  #11  
Old 07-06-2009, 05:43 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

You can also do "#rules reload" but it only reloads them for the current zone you are in.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:52 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3