Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 09-24-2018, 10:12 PM
superpally1
Sarnak
 
Join Date: Jul 2018
Location: Tennessee
Posts: 33
Default Server variables changed easily

I know changing variables in the database is easily done with heidisql and other programs. It is nice to be able to change the values while in the game to.
I made this code to show how to change hot zones from within the game using an npc http://www.eqemulator.org/forums/sho...238#post260238
and found it useful myself.
So I added a few more options to it. Maybe some of you will also find it useful.
All of the directions are at the top of the script.
This can be used for an npc people hail and get a list of current hotzones. They can not change anything.
The reason for this code: $say_links = quest::saylink("$zone_row[0]", 1);
$client->Message(15,"$say_links.");

I added all of this to Kingly_Krab's custom teleporter script and wanted the hotzones to be clicked and teleported to like in his script for teleporting. I can also post it all together if he doesn't mind and someone would like to have it.

Code:
#
#
# Can be used for an NPC that will only list current hot zones to players with status < 150
#
#
# Must have status > 150 to change server settings.
#
#
# To change hotzones type: /say add hotzone zonesn or /say remove hotzone zonesn.
# Example: /say add hotzone nro
# This would add nro to the hotzone list.
# Example: /say remove hotzone nro
# This would remove nro from the hotzone list.
#
#
# To set the AA XP Modifier value, type /say set aaxpmod value
# Example : /say set aaxpmod 1.50
# This would set the AA XP Modifier to double the default setting. (default = 0.75)
#
#
# To set the EXP Modifier value, type /say set expmod value
# Example : /say set expmod 1.50
# This would set the EXP Modifier to double the default setting. (default = 0.75)
#
#
# To set the Group EXP Modifier value, type /say set groupexpmod value
# Example : /say set groupexpmod 1.20
# This would set the Group EXP Modifier to double the default setting. (default = 0.60)
#
#
# To set the Global Loot Multiplier value, type /say set lootmod value
# Example : /say set lootmod 2
# This would set the Global Loot Multiplier to double the default setting. (default = 1)
#
#
sub EVENT_SAY {
	@args = split(' ', $text);
 	if ($text=~/hail/i) {
		$client->Message(15,""  .quest::saylink("Current hotzones", 1)."");
		if($status > 150) {
		    $client->Message(15,""  .quest::saylink("Server Settings", 1)."");
		}
	}
	if($text=~/Current hotzones/i) {
		$client->Message(15,"Current hotzones are : ");
		my $connect = plugin::LoadMysql();
		my $found_zone = 0;
                my $sql_query = ("SELECT short_name FROM zone WHERE hotzone=1");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
		while (@zone_row = $sql_handler->fetchrow_array()) {
		$found_zone++;
    		$say_links = quest::saylink("$zone_row[0]", 1);
		$client->Message(15,"$say_links.");
                $connect->disconnect();
		}
		if($status > 150) {
		    $client->Message(12,"To change hotzones type: /say add hotzone zonesn or /say remove hotzone zonesn.");
		    $client->Message(12,"Example: /say add hotzone nro");
		    $client->Message(12,"This would add nro to the hotzone list.");
		    $client->Message(12,"Example: /say remove hotzone nro");
		    $client->Message(12,"This would remove nro from the hotzone list.");
		}
	}
	if($status > 150) {
	    if($text=~/add hotzone/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE zone SET hotzone = 1 WHERE short_name = '$args[2]'");
	        $client->Message(14,"$args[2], added to hotzone list.");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;		
	    }
	    if($text=~/remove hotzone/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE zone SET hotzone = 0 WHERE short_name = '$args[2]'");
		$client->Message(13,"$args[2], removed from hotzone list.");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
	    }
	    if($text=~/Server Settings/i) {
	        $client->Message(15,"Display_"  .  quest::saylink("AA XP Modifier", 1)  .  ".");
		$client->Message(15,"Display_"  .  quest::saylink("EXP Modifier", 1)  .  ".");
		$client->Message(15,"Display_"  .  quest::saylink("Group EXP Modifier", 1)  .  ".");
		$client->Message(15,"Display_"  .  quest::saylink("LOOT Multiplier", 1)  .  ".");
	    }
	    if($text=~/AA XP Modifier/i) {
	        $client->Message(15,"Current AA XP Modifier is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT value FROM variables WHERE varname='AAXPMod'");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 0.75");
		$client->Message(12,"To set the AA XP Modifier value, type /say set aaxpmod value");
		$client->Message(12,"Example : /say set aaxpmod 1.50");
		$client->Message(12,"This would set the AA XP Modifier to double the default setting.");
	    }
	    if($text=~/set aaxpmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE variables SET value='$args[2]' WHERE varname='AAXPMod'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
		$connect->disconnect;
                $client->Message(14,"AA XP Modifier set to : $args[2].");	
            }
	    if($text=~/EXP Modifier/i) {
	        $client->Message(15,"Current EXP Modifier is : ");
	        my $connect = plugin::LoadMysql();
	        my $sql_query = ("SELECT value FROM variables WHERE varname='EXPMod'");
	        my $sql_handler = $connect->prepare($sql_query);
	        $sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
	        $client->Message(15,"$data_found[0].");
	        $connect->disconnect();
	        $client->Message(12,"Default value is 0.75");
	        $client->Message(12,"To set the EXP Modifier value, type /say set expmod value");
	        $client->Message(12,"Example : /say set expmod 1.50");
	        $client->Message(12,"This would set the EXP Modifier to double the default setting.");
	    }
	    if($text=~/set expmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE variables SET value='$args[2]' WHERE varname='EXPMod'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
                $client->Message(14,"EXP Modifier set to : $args[2].");
            }
	    if($text=~/Group EXP Modifier/i) {
	        $client->Message(15,"Current Group EXP Modifier is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT value FROM variables WHERE varname='GroupEXPBonus'");
		my $sql_handler = $connect->prepare($sql_query);
	        $sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 0.60");
		$client->Message(12,"To set the Group EXP Modifier value, type /say set groupexpmod value");
		$client->Message(12,"Example : /say set groupexpmod 1.20");
		$client->Message(12,"This would set the Group EXP Modifier to double the default setting.");
	    }
	    if($text=~/set groupexpmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE variables SET value='$args[2]' WHERE varname='GroupEXPBonus'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
                $client->Message(14,"Group EXP Modifier set to : $args[2].");	
            }
	    if($text=~/LOOT Multiplier/i) {
	        $client->Message(15,"Current Global Loot Multiplier is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT rule_value FROM rule_values WHERE rule_name='Zone:GlobalLootMultiplier'");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 1");
		$client->Message(12,"To set the Global Loot Multiplier value, type /say set lootmod value");
		$client->Message(12,"Example : /say set lootmod 2");
		$client->Message(12,"This would set the Global Loot Multiplier to double the default setting. (Double Loot)");
	    }
	    if($text=~/set lootmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE rule_values SET rule_value='$args[2]' WHERE rule_name='Zone:GlobalLootMultiplier'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
                $client->Message(14,"Global Loot Multiplier set to : $args[2].");		
            }
	}
}
Reply With Quote
  #2  
Old 09-25-2018, 06:35 AM
jpyou127's Avatar
jpyou127
Discordant
 
Join Date: Nov 2005
Posts: 270
Default

Combo would be cool!
Reply With Quote
  #3  
Old 09-25-2018, 09:18 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

Release the combo, I don’t mind as long as it works.

Edit: My code I release is a part of the open source project, you may use it, change it, or do whatever with it. For future reference, my permission is not required. Thanks for being cool about it though.
Reply With Quote
  #4  
Old 09-25-2018, 06:40 PM
superpally1
Sarnak
 
Join Date: Jul 2018
Location: Tennessee
Posts: 33
Default

Ok here it is with the added teleporter code. I also added options to view/edit hotzone bonus value

Code:
#
#
# Can be used for an NPC that will only list current hot zones to players with status < 150
#
#
# Must have status > 150 to change server settings.
#
#
# To change hotzones type: /say add hotzone zonesn or /say remove hotzone zonesn.
# Example: /say add hotzone nro
# This would add nro to the hotzone list.
# Example: /say remove hotzone nro
# This would remove nro from the hotzone list.
#
#
# To set the Hot Zone Bonus value, type /say set hotzonebonus value
# Example : /say set hotzonebonus 1.50
# This would set the Hot Zone Bonus to double the default setting. (default = 0.75)
#
#
# To set the AA XP Modifier value, type /say set aaxpmod value
# Example : /say set aaxpmod 1.50
# This would set the AA XP Modifier to double the default setting. (default = 0.75)
#
#
# To set the EXP Modifier value, type /say set expmod value
# Example : /say set expmod 1.50
# This would set the EXP Modifier to double the default setting. (default = 0.75)
#
#
# To set the Group EXP Modifier value, type /say set groupexpmod value
# Example : /say set groupexpmod 1.20
# This would set the Group EXP Modifier to double the default setting. (default = 0.60)
#
#
# To set the Global Loot Multiplier value, type /say set lootmod value
# Example : /say set lootmod 2
# This would set the Global Loot Multiplier to double the default setting. (default = 1)
#
#
sub EVENT_SAY {
	@args = split(' ', $text);
	my @zone_array = plugin::NonCustomZoneArray();
	my $count = 0;
 	if ($text=~/hail/i) {
		$client->Message(15,"Tell me the short name of a zone and I will see if I have a spell to send you there.");
		$client->Message(15,"I will " . quest::saylink("display", 1) . " zone names if you like.");
		$client->Message(15,"I can also list the"  .  quest::saylink("Current hotzones", 1) . ".");
		$client->Message(15,"And I can"  .  quest::saylink("bind you here", 1)  .  ".");
		if($status > 150) {
		    $client->Message(15,""  .quest::saylink("Server Settings", 1)."");
		}
	}
	if($text=~/Current hotzones/i) {
		$client->Message(15,"Current hotzones are : ");
		my $connect = plugin::LoadMysql();
		my $found_zone = 0;
                my $sql_query = ("SELECT short_name FROM zone WHERE hotzone=1");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
		while (@zone_row = $sql_handler->fetchrow_array()) {
		$found_zone++;
    		$say_links = quest::saylink("$zone_row[0]", 1);
		$client->Message(15,"$say_links.");
                $connect->disconnect();
		}
		if($status > 150) {
		    $client->Message(12,"To change hotzones type: /say add hotzone zonesn or /say remove hotzone zonesn.");
		    $client->Message(12,"Example: /say add hotzone nro");
		    $client->Message(12,"This would add nro to the hotzone list.");
		    $client->Message(12,"Example: /say remove hotzone nro");
		    $client->Message(12,"This would remove nro from the hotzone list.");
		}
	}
	if($status > 150) {
	    if($text=~/add hotzone/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE zone SET hotzone = 1 WHERE short_name = '$args[2]'");
	        $client->Message(14,"$args[2], added to hotzone list.");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;		
	    }
	    if($text=~/remove hotzone/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE zone SET hotzone = 0 WHERE short_name = '$args[2]'");
		$client->Message(13,"$args[2], removed from hotzone list.");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
	    }
	    if($text=~/Server Settings/i) {
                $client->Message(15,"Display_"  .  quest::saylink("HOTZONE Bonus", 1)  .  ".");
	        $client->Message(15,"Display_"  .  quest::saylink("AA XP Modifier", 1)  .  ".");
		$client->Message(15,"Display_"  .  quest::saylink("EXP Modifier", 1)  .  ".");
		$client->Message(15,"Display_"  .  quest::saylink("Group EXP Modifier", 1)  .  ".");
		$client->Message(15,"Display_"  .  quest::saylink("LOOT Multiplier", 1)  .  ".");
	    }
            if($text=~/HOTZONE Bonus/i) {
	        $client->Message(15,"Current Hot Zone bonus  is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT rule_value FROM rule_values WHERE rule_name='Zone:HotZoneBonus'");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 0.75");
		$client->Message(12,"To set the Hot Zone Bonus value, type /say set hotzonebonus value");
		$client->Message(12,"Example : /say set hotzonebonus 1.50");
		$client->Message(12,"This would set the Hot Zone Bonus to double the default setting.");
	    }
	    if($text=~/set hotzonebonus/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE rule_values SET rule_value='$args[2]' WHERE rule_name='Zone:HotZoneBonus'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
		$connect->disconnect;
                $client->Message(14,"Hot Zone Bonus set to : $args[2].");	
            }		
	    if($text=~/AA XP Modifier/i) {
	        $client->Message(15,"Current AA XP Modifier is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT value FROM variables WHERE varname='AAXPMod'");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 0.75");
		$client->Message(12,"To set the AA XP Modifier value, type /say set aaxpmod value");
		$client->Message(12,"Example : /say set aaxpmod 1.50");
		$client->Message(12,"This would set the AA XP Modifier to double the default setting.");
	    }
	    if($text=~/set aaxpmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE variables SET value='$args[2]' WHERE varname='AAXPMod'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
		$connect->disconnect;
                $client->Message(14,"AA XP Modifier set to : $args[2].");	
            }
	    if($text=~/EXP Modifier/i) {
	        $client->Message(15,"Current EXP Modifier is : ");
	        my $connect = plugin::LoadMysql();
	        my $sql_query = ("SELECT value FROM variables WHERE varname='EXPMod'");
	        my $sql_handler = $connect->prepare($sql_query);
	        $sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
	        $client->Message(15,"$data_found[0].");
	        $connect->disconnect();
	        $client->Message(12,"Default value is 0.75");
	        $client->Message(12,"To set the EXP Modifier value, type /say set expmod value");
	        $client->Message(12,"Example : /say set expmod 1.50");
	        $client->Message(12,"This would set the EXP Modifier to double the default setting.");
	    }
	    if($text=~/set expmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE variables SET value='$args[2]' WHERE varname='EXPMod'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
                $client->Message(14,"EXP Modifier set to : $args[2].");
            }
	    if($text=~/Group EXP Modifier/i) {
	        $client->Message(15,"Current Group EXP Modifier is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT value FROM variables WHERE varname='GroupEXPBonus'");
		my $sql_handler = $connect->prepare($sql_query);
	        $sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 0.60");
		$client->Message(12,"To set the Group EXP Modifier value, type /say set groupexpmod value");
		$client->Message(12,"Example : /say set groupexpmod 1.20");
		$client->Message(12,"This would set the Group EXP Modifier to double the default setting.");
	    }
	    if($text=~/set groupexpmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE variables SET value='$args[2]' WHERE varname='GroupEXPBonus'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
                $client->Message(14,"Group EXP Modifier set to : $args[2].");	
            }
	    if($text=~/LOOT Multiplier/i) {
	        $client->Message(15,"Current Global Loot Multiplier is : ");
		my $connect = plugin::LoadMysql();
		my $sql_query = ("SELECT rule_value FROM rule_values WHERE rule_name='Zone:GlobalLootMultiplier'");
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
                @data_found = $sql_handler->fetchrow_array();
		$client->Message(15,"$data_found[0].");
		$connect->disconnect();
		$client->Message(12,"Default value is 1");
		$client->Message(12,"To set the Global Loot Multiplier value, type /say set lootmod value");
		$client->Message(12,"Example : /say set lootmod 2");
		$client->Message(12,"This would set the Global Loot Multiplier to double the default setting. (Double Loot)");
	    }
	    if($text=~/set lootmod/i) {
                my $connect = plugin::LoadMysql();
                $query = ("UPDATE rule_values SET rule_value='$args[2]' WHERE rule_name='Zone:GlobalLootMultiplier'");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;
                $client->Message(14,"Global Loot Multiplier set to : $args[2].");		
            }
	}
	if($text=~/bind you here/i) {
	    quest::say("Binding your soul. You will return here when you die.");
	    quest::selfcast(2049);
	}
	if($text=~/display/i) {
	    plugin::Whisper("I may list them alphabetically, just say a letter from 'A' to 'Z'.");
	}
	if($text=~/[a-zA-Z]/ && length($text) == 1) {
	    foreach $zone (@zone_array) {
	        if(substr($zone, 0, 1)=~/$text/i) {
		    $count++;
	            plugin::Message("$count: " . quest::saylink($zone, 1, plugin::Zone("SN", "LN", $zone)));
		}
	    }
	    plugin::Message("There are $count zones that begin with $text!");
	}
	if($text!~/[a-zA-Z]/) {
	    plugin::Whisper("You must search with alphabetic characters, try again.");
	}
	if($text!~/hail/i && $text!~/list/i && $text!~/bind you here/i && $text!~/Current hotzones/i 
	&& $text!~/add hotzone/i && $text!~/remove hotzone/i && $text!~/Server Settings/i && $text!~/AA XP Modifier/i 
	&& $text!~/set aaxpmod/i && $text!~/EXP Modifier/i && $text!~/set expmod/i && $text!~/Group EXP Modifier/i 
	&& $text!~/set groupexpmod/i && $text!~/LOOT Multiplier/i && $text!~/set lootmod/i 
        && $text!~/HOTZONE Bonus/i && $text!~/set hotzonebonus/i && length($text) != 1) {
		foreach $zone (@zone_array) 
		{
		    if($text eq $zone) {
		        quest::zone($text);
		    }
		}
	}
}
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 09:46 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3