Warning!
This is an AddOn to the LUA functions library based on the GuaEngine. This means you will have to use the GuaEngine in order to use these additions. These additions are made by Claiver, and were able to me made thanks to GastricPenguin, the creator of the GuaEngine. This thread will be updated quite frequently. Some functions may be directly implemented into the core, meaning they won't be necessary into the AddOn. However, more functions will be added over time.
__[ GuaAddon ]__
The Addition to the GuaEngine
Current Features
Arguments in this color are required.
Arguments in this color are optional.
SendMail(Player, Subject, Message, Gold, Item, ItemCount)
For your message you can currently use the following variables:
$N will Print the Player's Name.
$C will Print the Player's Class.
$G will Print the Player's Gold.
$R will Print the Player's Race.
[Example]
Code:
SendMail(Player, "Welcome!","Hello $N, we have seen you are a great $R $C, and would like to welcome you to our server. You currently have $G gold. We will give you 6 gold.",6)
CheckCombat(Player, IncombatMessage)
This function will return 'true' when the player is not in combat. If the player is in combat, it will display the IncombatMessage.
[Example]
Code:
if (CheckCombat(Player,"You are in Combat!") == true) then
print("You are not in combat!")
end
DebugPrint(Message)
This function will print Message to console when GA_DEBUG is set to 'true' in the GuaAddonSettings.conf. (GA_DEBUG = true)
So instead of
Code:
if (DEBUG == true) then
print("[DEBUG] Spawned Creature.")
end
> Will output:
> [DEBUG] Spawned Creature.
You will have:
[Example]
Code:
DebugPrint("Spawned Creature")
> Will output:
> [DEBUG] Spawned Creature.
Download
I hope to have a SVN ready for this soon, to make it easier for you. But for now I have to stick to a download, and posted the whole script in CODE format for you too, to preview.
CLICK HERE TO DOWNLOAD
or create the files yourself:
SCRIPTS/[GuaEngine].LUA
Code:
--#####################################################################################################################
--## SETTINGS ###
--## ###
GuaAddonSettings_Folder = "configs"
GuaAddonSettings_File = "[GuaAddon] Settings.LUA"
--## ###
--#####################################################################################################################
--## ##### ! READ THIS ! ###
--## - GuaAddon - ##### ###
--## GUAENGINE ADDON ##### This script is intended to add extra funtionality to the GuaEngine. ###
--## ##### I, Claiver, want every function to function as intended. Sometimes ###
--##--------------------------------##### bugs may occur. Therefor it is strictly recommended to report any ###
--## GuaEngine by GastricPenguin ##### possible bugs found to Claiver @ MMOWNED, and ask questions if any. ###
--## ©Copywrite 2009 ##### - Claiver ###
--## ##### ###
--#####################################################################################################################
ADDON_VERSION = "1.0BETA"
--[[#################################################################################################################]]
--------------------------------------------------------------------------------------|
--\ [Function] SendMail(Player)
--------------------------------------------------------------------------------------|
function SendMail(_P,_Subject,_Message,_Gold,_Item,_ItemCount)
if (_P ~= nil) then
if (_Gold == nil) then _Gold = 0 else _Gold=_Gold*10000 end
if (_Item == nil) then _Item = 0 end
if (_ItemCount == nil) then _ItemCount = 1 end
if (_Message == nil) then _Message = "Missing Message for $N" end
if (_Subject == nil) then _Subject = "Message to ".._P:GetName() end
GRace = _P:GetPlayerRace()
if (GRace == 1) then PRace = "Human" end
if (GRace == 2) then PRace = "Orc" end
if (GRace == 3) then PRace = "Dwarf" end
if (GRace == 4) then PRace = "NightElf" end
if (GRace == 5) then PRace = "Undead" end
if (GRace == 6) then PRace = "Tauren" end
if (GRace == 7) then PRace = "Gnome" end
if (GRace == 8) then PRace = "Troll" end
if (GRace == 10) then PRace = "Blood Elf" end
if (GRace == 11) then PRace = "Draenei" end
_Message = string.gsub(_Message,"$N",_P:GetName())
_Message = string.gsub(_Message,"$C",_P:GetPlayerClass())
_Message = string.gsub(_Message,"$G",string.sub(string.format("%s",_P:GetMoney()/10000),1,string.find(string.format("%s",_P:GetMoney()/10000),"%.",1)-1))
_Message = string.gsub(_Message,"$R",PRace)
Execute(1, "INSERT INTO mailbox_insert_queue (`sender_guid`, `receiver_guid`, `subject`, `body`, `stationary`, `money`, `item_id`, `item_stack`) VALUES (".._P:GetLowGUID()..", ".._P:GetLowGUID()..", '".. _Subject .."', '".. _Message .."', 41, ".. _Gold ..", ".. _Item ..",".. _ItemCount ..");")
end
end
--------------------------------------------------------------------------------------|
--\ [Function] CheckCombat
--------------------------------------------------------------------------------------|
function CheckCombat(_P,_EMSG)
if (_P:IsInCombat()==true) then
if (_EMSG ~= nil) then _P:SendAreaTriggerMessage("[ ".. _EMSG .." ]") end
return false elseif (_P:IsInCombat()==false) then return true else return true
end
end
--------------------------------------------------------------------------------------|
--\ [Function] LoadConfig
--------------------------------------------------------------------------------------|
function LoadConfig(_folder,_conf)
dofile(_folder .."/".. _conf)
end LoadConfig(GuaAddonSettings_Folder,GuaAddonSettings_File)
--------------------------------------------------------------------------------------|
--\ [Function] DebugPrint
--------------------------------------------------------------------------------------|
function DebugPrint(_d)
if (string.upper(GA_DEBUG) == "ENABLED") then
if (CheckValue(_d) == true) then print("[DEBUG] ".. string.format("%s",_d) ..".") end
end
end
--------------------------------------------------------------------------------------|
--\ [Function] PrintGAInfo
--------------------------------------------------------------------------------------|
function PrintGAInfo()
print("\n------------------------------------------------------------------------------")
print("\tLoaded GuaAddon version "..ADDON_VERSION.." \n\t'The Addition to GuaEngine' by Claiver")
print("------------------------------------------------------------------------------\n")
end PrintGAInfo()
CONFIGS/[GuaAddon] Settings.LUA
Code:
--#########################################################################################################################
--## ##### ! READ THIS ! ###
--## - GuaAddon - ##### ###
--## GUAENGINE ADDON ##### This script is intended to add extra funtionality to the GuaEngine. ###
--## ##### I, Claiver, want every function to function as intended. Sometimes ###
--##------------------------------------##### bugs may occur. Therefor it is strictly recommended to report any ###
--## GuaEngine by GastricPenguin ##### possible bugs found to Claiver @ MMOWNED, and ask questions if any. ###
--## ©Copywrite 2009 ##### - Claiver ###
--## ##### ###
--#########################################################################################################################
ADDON_VERSION = "1.0BETA"
--#########################################################################################################################
--|#######################################################
--|
--| GA_DEBUG
--| Enable or Disable Debugging. (Enabled/Disabled)
--| Default: Disabled
--|
--|#######################################################
GA_DEBUG = "Enabled"
Greetings Claiver!