Akkadius |
08-03-2010 11:52 AM |
Quote:
Originally Posted by KLS
(Post 187810)
Indulge me: what are you getting back?
I don't really agree with this approach since group::GetID() should return the database id correctly and if a group exists in the database it should exist in zone. If it isn't then I say we fix that rather than adding a work around.
|
This still gets the group ID just fine to store it in the database so that a group can recall their instance. But it is very weird about parsing. I don't know exactly why it is unreliable but it is. Once again I agree we should simply fix the existing function. The script below works highlighted in red. But unless you place the 'my $Group' variables in the right part of the script it flakes completely.
I once originally made this script for EZ so that it can do both Guild and Group instances together. And having the Group variables at the top of the script would null trying to get to the rest of the script, meaning if there was say text below the definition it wont show. So unless I define the group variables INSIDE the $text it will not show the rest of the script. I messed with this for several several hours and resorted to breaking these two scripts apart (This was a few months ago). I'm not saying that this doesn't call the ID, but it doesn't call the ID reliably, you have to walk around glass to get it to work in bigger scripts. Even as Perl parser won't pick up the errors and it simply got frustrating.
Code:
#######################WAYPOINT UTILITY SCRIPT########################
##########CREATED BY: AKKADIUS FROM BLOOD OF THE AKKADIAN#############
##########EZ SERVER VERSION###########################################
##########NPC RACE - 127, SPECIAL FLAGS - ABH,
sub EVENT_SPAWN {
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $range = (15);
quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range, $z - 10, $z + 20);
quest::settimer("effect",1);
quest::settimer("effect2",1);
}
sub EVENT_ENTER
{
$client->Message(315, "For Waypoint Options: Target the portal and type [Options]");
}
sub EVENT_TIMER
{
if($timer eq "effect"){
$npc->SpellEffect(178);
$npc->SpellEffect(203);
$npc->SendAppearanceEffect(77,78);
quest::stoptimer("effect");
quest::settimer("effect",12);
}
if($timer eq "effect2"){
$npc->SendAppearanceEffect(77,78);
quest::stoptimer("effect2");
quest::settimer("effect2",4);
}
}
sub EVENT_SAY
{
my $Cx = $client->GetX();
my $Cy = $client->GetY();
my $Cz = $client->GetZ();
my $bind = quest::saylink("Bind in this Zone", 1);
my $halls = quest::saylink("The Forgotten Halls",1);
my $buffs = quest::saylink("Buffs",1);
my $Other = quest::saylink("Other Options",1);
my $instance = quest::saylink("Instance",1);
my $npc_name = $npc->GetCleanName();
my $Withdraw = quest::saylink("Withdraw",1);
my $Deposit = quest::saylink("Deposit",1);
my $Check = quest::saylink("Check Balance",1);
my $Hundred = quest::saylink("100 Platinum",1);
my $Thousand = quest::saylink("1,000 Platinum",1);
my $TenThousand = quest::saylink("10,000 Platinum",1);
my $HundredThousand = quest::saylink("100,000 Platinum",1);
my $accountname1 = $client->AccountName();
my $accountname = "<c \"#FBB117\">$accountname1</c>";
my $accountid = $client->AccountID();
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
my $ManageCredit = quest::saylink("Manage Credit",1);
my $GuildInst = quest::saylink("-Guild Instance-",1);
my $GroupInst = quest::saylink("-Group Instance-",1);
my $EnterGuildInst = quest::saylink("Enter Guild Instance",1);
my $EnterGroupInst = quest::saylink("Enter Group Instance",1);
my $GuildCreate = quest::saylink("Create a Guild Instance",1);
my $GuildDelete = quest::saylink("Delete Guild Instance",1);
my $GroupDelete = quest::saylink("Delete Group Instance",1);
my $GroupCreate = quest::saylink("Create Group Instance",1);
#########################VARIABLES####################
my $BuffCost = $ulevel; ### SETS THE COST FOR BUFFS
#########################VARIABLES####################
######################OPTIONS MENU####################
if ($text=~/options/i)
{
$client->Message(10, "Waypoint:--------$zoneln-------");
####################INSTANCE ZONE CHECKS########################
my $ClientGroup = $client->GetGroup();
my $GroupID = $ClientGroup->GetID();
if (defined($qglobals{"GroupInstance$zonesn$GroupID"}))
{
my $GroupInstanceCreator = $qglobals{"GroupInstanceCreator$zonesn$GroupID"};
$client->Message(315,"This Waypoint already has a Group Instance created by Group Member: [$GroupInstanceCreator]");
$client->Message(315,"[$EnterGroupInst]");
$client->Message(315,"[$GroupDelete]");
$client->Message(10, "------------------------------------------------------------------------------");
}
else{ ### Zone Check
$client->Message(315,"This Waypoint offers an option to create a [$GroupInst], would you like to create it?");
$client->Message(315,"[$GroupCreate] [Cost: 2,000 Platinum from your Credit.]");
$client->Message(10, "------------------------------------------------------------------------------");
}
##############################################################################
####################INSTANCE ZONE CHECKS########################
########REGULAR MENU OPTIONS (GLOBAL)############
$client->Message(315, "[$buffs] [Cost : $BuffCost]");
$client->Message(315, "[$ManageCredit]");
$client->Message(315, "[$Other]");
########REGULAR MENU OPTIONS (GLOBAL)############
}
my $Walkthrough = quest::saylink("Walkthroughs and Guides", 1);
my $Whatis = quest::saylink("What is Waypoint?", 1);
if ($text =~ /Other Options/i)
{
$client->Message(10, " " );
$client->Message(315, "[$Walkthrough]");
$client->Message(315, "[$Whatis]");
}
##################START GROUP INSTANCE SEGMENT#######################
my $GroupInstanceCost = 2000; ###2,000 Platinum Entry fee for Group.
if($text=~/Create Group Instance/i)
{
my $ClientGroup = $client->GetGroup();
my $GroupID = $ClientGroup->GetID();
if ($ClientGroup) {
if ($bankcredit < $GroupInstanceCost)
{
$client->Message(315,"You need "
. ($GuildInstanceCost - $bankcredit) . " more plat!");
}
else {
$bankcredit -= $GroupInstanceCost;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("InstanceLogs/Instance$zonesn.txt","[$timestamp] : $name the $class at $ulevel has used $GuildInstanceCost on $npc_name for an instance, this player now has $bankcredit in his account: $accountname1.");
quest::ze(15,"$name has created Group Instance: $zoneln");
if (defined($qglobals{"GroupInstance$zonesn$GroupID"})) {
$GroupInstanceID = $qglobals{"GroupInstance$zonesn$GroupID"};
quest::AssignToInstance($GroupInstanceID);
quest::MovePCInstance($zoneid, $GroupInstanceID, $Cx, $Cy, $Cz);
}
else {
$GroupInstanceID = quest::CreateInstance("$zonesn", 0, 10800);
quest::AssignToInstance($GroupInstanceID);
quest::setglobal("GroupInstance$zonesn$GroupID",$GroupInstanceID,7,"H3");
quest::setglobal("GroupInstanceCreator$zonesn$GroupID",$name,7,"H3");
quest::write("InstanceLogs/GroupInstance$zonesn.txt","[$timestamp] : $name has created instance $zoneln for Group ID: $GroupID");
quest::MovePCInstance($zoneid, $GroupInstanceID, $Cx, $Cy, $Cz);
}
}
}
else
{
$client->Message(315,"You must be in a Group to create a Group Instance!");
}
}
#########IF CREATED ALREADY, REQUESTING######
if($text =~/Enter Group Instance/i)
{
my $ClientGroup = $client->GetGroup();
my $GroupID = $ClientGroup->GetID();
if (defined($qglobals{"GroupInstance$zonesn$GroupID"})) {
$GroupInstanceID = $qglobals{"GroupInstance$zonesn$GroupID"};
quest::AssignToInstance($GroupInstanceID);
quest::MovePCInstance($zoneid, $GroupInstanceID, $Cx, $Cy, $Cz);
}
else
{
$client->Message(315,"Your Group does not have an instance in this zone, you must create it!");
}
}
my $ClientGroup = $client->GetGroup();
my $GroupID = $ClientGroup->GetID();
#########Delete Instance Group Popup request######
if($text =~/Delete Group Instance/i && $ClientGroup)
{
my $zonecolln = "<c \"#B1FB17\">$zoneln</c>";
quest::popup("Delete Group Instance","<c \"#FFFF66\">Are you sure you want to delete the
instance created for your Group in </c> [$zonecolln]?",111,1);
}
#########Delete Instance Group Popup request######
###############OTHER OPTIONS##################
if ($text =~ /What is Waypoint/i)
{
quest::popup("Waypoint: By Akkadius","<br><br>
<c \"#FFFF66\">
o Waypoint is a script made by Akkadius from the Blood of the
Akkadian server, designed to help the ever growing EZ Server population's
need for instancing for zones.<br><br>
o Waypoint also provides various other benefits and utilities such as a
buff bot script away from the hub zone, but also requires a charge.<br><br>
o Waypoint is a tool that provides information and guides posted from the EZ
Server website.<br>
");
}
if ($text =~ /-Group Instance-/i)
{
quest::popup("Group Instance","<br>
<br>
<c \"#FFFF66\">
o What a Group Instance does, is it makes a new slate of the zone that is
being prompted for an instance for specifically the Group that requests it.
<br>
<br>
Group Instances cost 2,000 Platinum from your Credit system to request.
<br>
</c>
");
}
if ($text =~ /Walkthroughs and Guides/i)
{
quest::popup("Waypoint: By Akkadius","<br><br>
<c \"#FFFF66\">
[EZ SERVER GUIDES]
<br>
----------------------------------------------------------------------------
<br>
o <a href=\"http://ezserveronline.com/forums/index.php?topic=87.0\">-EZ SERVER FAQ-</a><br>
o <a href=\"http://ezserveronline.com/forums/index.php?topic=13.0\">-Casters/Fighters Guild Guide-</a><br>
o <a href=\"http://ezserveronline.com/forums/index.php?topic=12.0\">-EZ SERVER EPIC GUIDE-</a><br>
o <a href=\"http://ezserveronline.com/forums/index.php?topic=449.0\">-Epic 1.0-3.0 Epics Links-</a><br>
o <a href=\"http://ezserveronline.com/forums/index.php?topic=463.0\">-Setting Up the EQ Clients Guide-</a><br>
o <a href=\"http://ezserveronline.com/forums/index.php?topic=439.0\">-Titanium Vs SoF/SoD List-</a><br>
----------------------------------------------------------------------------
<br>
o List provided by Danyelle of the EZ server.
");
}
######################END OPTIONS MENU####################
###############################START CREDIT SEGMENT####################################
if ($text =~ /Manage Credit/i)
{
$client->Message(10, "[MANAGE CREDIT]");
$client->Message(315, "[$Withdraw]");
$client->Message(315, "[$Deposit]");
$client->Message(315, "[$Check]");
}
if($text =~ /Check Balance/i)
{
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You have $bankcredit2 Platinum on the account $accountname!");
}
############WITHDRAW 100 Platinum... Logged################
if($text=~/100 platinum/i)
{
my $CreditAmnt = 100;
if ($bankcredit < $CreditAmnt)
{
quest::popup("Notification","You need "
. ($CreditAmnt - $bankcredit) . " more platinum from your $creditname fund.");
}
else
{
# Only record and say this stuff if there was a cost
if ($CreditAmnt > 0)
{
$bankcredit -= $CreditAmnt;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("CreditLogs/CreditPull_$zonesn.txt","[$timestamp] : $name the $class at level: $ulevel has pulled $CreditAmnt on Credit Keeper: ($npc_name), this player now has $bankcredit in his account: $accountname1.");
quest::givecash(0,0,0,$CreditAmnt);
$client->Message(315,"You have received [$CreditAmnt] platinum pieces!");
}
}
}
############WITHDRAW 1,000 Platinum... Logged################
if($text=~/1,000 platinum/i)
{
my $CreditAmnt = 1000;
if ($bankcredit < $CreditAmnt)
{
quest::popup("Notification","You need "
. ($CreditAmnt - $bankcredit) . " more platinum from your $creditname fund.");
}
else
{
# Only record and say this stuff if there was a cost
if ($CreditAmnt > 0)
{
$bankcredit -= $CreditAmnt;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("CreditLogs/CreditPull_$zonesn.txt","[$timestamp] : $name the $class at level: $ulevel has pulled $CreditAmnt on Credit Keeper: ($npc_name), this player now has $bankcredit in his account: $accountname1.");
quest::givecash(0,0,0,$CreditAmnt);
$client->Message(315,"You have received [$CreditAmnt] platinum pieces!");
}
}
}
############WITHDRAW 10,000 Platinum... Logged################
if($text=~/10,000 platinum/i)
{
my $CreditAmnt = 10000;
if ($bankcredit < $CreditAmnt)
{
quest::popup("Notification","You need "
. ($CreditAmnt - $bankcredit) . " more platinum from your $creditname fund.");
}
else
{
# Only record and say this stuff if there was a cost
if ($CreditAmnt > 0)
{
$bankcredit -= $CreditAmnt;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("CreditLogs/CreditPull_$zonesn.txt","[$timestamp] : $name the $class at level: $ulevel has pulled $CreditAmnt on Credit Keeper: ($npc_name), this player now has $bankcredit in his account: $accountname1.");
quest::givecash(0,0,0,$CreditAmnt);
$client->Message(315,"You have received [$CreditAmnt] platinum pieces!");
}
}
}
############WITHDRAW 100,000 Platinum... Logged################
if($text=~/100,000 platinum/i)
{
my $CreditAmnt = 100000;
if ($bankcredit < $CreditAmnt)
{
quest::popup("Notification","You need "
. ($CreditAmnt - $bankcredit) . " more platinum from your $creditname fund.");
}
else
{
# Only record and say this stuff if there was a cost
if ($CreditAmnt > 0)
{
$bankcredit -= $CreditAmnt;
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("CreditLogs/CreditPull_$zonesn.txt","[$timestamp] : $name the $class at level: $ulevel has pulled $CreditAmnt on Credit Keeper: ($npc_name), this player now has $bankcredit in his account: $accountname1.");
quest::givecash(0,0,0,$CreditAmnt);
$client->Message(315,"You have received [$CreditAmnt] platinum pieces!");
}
}
}
if($text =~ /Withdraw/i)
{
$client->Message(315,"'How much would you like to Withdraw?");
$client->Message(315, "[$Hundred]");
$client->Message(315, "[$Thousand]");
$client->Message(315, "[$TenThousand]");
$client->Message(315, "[$HundredThousand]");
}
if($text =~ /Deposit/i)
{
$client->Message(315,"$npc_name whispers, 'Just hand me the amount of platinum you'd like to deposit!");
}
###############################END CREDIT SEGMENT####################################
if ($text =~ /buffs/i)
{
if ($bankcredit < $BuffCost)
{
$client->Message(315,"You need "
. ($BuffCost - $bankcredit) . " more plat!");
}
else
{
if ($ulevel < 36) {
quest::selfcast(19); # Armor of Faith - AC
quest::selfcast(1445); # Armor of Protection - HP, AC
quest::selfcast(10); # Augmentation - Mana
quest::selfcast(278); # Spirit of Wolf
} # End 1-35
else {
quest::selfcast(5257); # Conviction - HP, AC
quest::selfcast(5513); # Clairvoyance - Mana
quest::selfcast(5507); # Speed of Salik - Haste
quest::selfcast(5396); # Wunshi's Focusing - Stat Cap
quest::selfcast(4054); # Spirit of the Shrew - SoW
quest::selfcast(2886); # Acumen of Dar Khura - Ultravision / See Invis
quest::selfcast(5398); # Spirit of Fortitude - STA
quest::selfcast(5358); # Nettle Shield
} # End 36-70
# Only record and say this stuff if there was a cost
if ($BuffCost > 0)
{
$bankcredit -= $BuffCost;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::popup("Account Balance","<br><br>
-------------ACCOUNT BALANCE: $accountname-------------
<br>
<br>
You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("CreditLogs/UsedBuffs.txt","[$timestamp] : $name the $class at $ulevel has used $BuffCost on $npc_name for buffs, this player now has $bankcredit in his account: $accountname1.");
}
}
}
}
sub EVENT_POPUPRESPONSE {
if ($popupid eq "111") ###Delete response for Group, Works for all Group cases
{
my $ClientGroup = $client->GetGroup();
my $GroupID = $ClientGroup->GetID();
if (defined($qglobals{"GroupInstance$zonesn$GroupID"}))
{
my $GroupInstanceID = $qglobals{"GroupInstance$zonesn$GroupID"};
quest::DestroyInstance($GroupInstanceID);
quest::ze(15,"$name has deleted his Group Instance");
quest::delglobal("GroupInstance$zonesn$GroupID");
quest::delglobal("GroupInstanceCreator$zonesn$GroupID");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("InstanceLogs/InstanceDelete$zonesn.txt","[$timestamp] : $name the $class at $ulevel, has deleted Group # ($GroupID) [$zoneln] instance.");
}
else{
$client->Message(315,"There is no Group Instance to delete!");
}
}
}
sub EVENT_ITEM
{
my $accountname1 = $client->AccountName();
my $accountname = "<c \"#FBB117\">$accountname1</c>";
my $accountid = $client->AccountID();
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
if ($platinum > 0)
{
$bankcredit += $platinum;
my $bankcredit = $qglobals{"BankCredit_$accountid"} ? $qglobals{"BankCredit_$accountid"} : 0;
my $bankcredit2 = "<c \"#FBB117\">$bankcredit</c>";
quest::setglobal("BankCredit_$accountid", "$bankcredit", 7, 'F');
quest::popup("Notification","You now have $bankcredit2 Platinum on the account $accountname!");
$timestamp = localtime(time);
my $npc_name = $npc->GetCleanName();
my $accountname1 = $client->AccountName();
quest::write("CreditLogs/Gavecredit.txt","[$timestamp] : $name the $class at $ulevel has given $npc_name $platinum platinum, this player now has $bankcredit in his account: $accountname1.");
}
else
{
plugin::return_items(\%itemcount);
}
}
|