rendered paste bodyIndex: HEAD/openbot.iss
===================================================================
--- HEAD/openbot.iss (revision 19)
+++ HEAD/openbot.iss (working copy)
@@ -30,6 +30,7 @@
#include objects/oParty.iss
#include objects/oQuest.iss
#include objects/oBG.iss
+#include objects/oIRCLink.iss
function main()
{
@@ -67,6 +68,7 @@
declarevariable Quest oQuest script
declarevariable BG oBG script
declarevariable BGConfig oBGConfig script
+ declarevariable IRCLink oIRCLink script
call Bot.Start
}
Index: HEAD/gui/gui.xml
===================================================================
--- HEAD/gui/gui.xml (revision 19)
+++ HEAD/gui/gui.xml (working copy)
@@ -3719,6 +3719,91 @@
</OnLeftClick>
</checkbox>
</tab>
+
+ <tab name="IRC">
+ <checkbox name="chkEnableIRC">
+ <x>10</x>
+ <y>10</y>
+ <width>70</width>
+ <height>15</height>
+ <text>Enable IRC</text>
+ <OnLeftClick>
+ Event[OPENBOT_CONFIG_XBOX]:Execute["chkEnableIRC"]
+ </OnLeftClick>
+ </checkbox>
+
+ <text name="lblIRCServer">
+ <x>10</x>
+ <y>30</y>
+ <width>100</width>
+ <height>20</height>
+ <text>Server:</text>
+ </text>
+ <textentry name="tenIRCServer">
+ <Width>130</Width>
+ <Height>18</Height>
+ <x>10</x>
+ <y>38</y>
+ </textentry>
+ <button name="btnIRCServerSet">
+ <x>145</x>
+ <y>38</y>
+ <Width>25</Width>
+ <Height>18</Height>
+ <text>Set</text>
+ <OnLeftClick>
+ Event[GUI_BUTTON_HANDLE]:Execute["IRCServerSet"]
+ </OnLeftClick>
+ </button>
+
+ <text name="lblIRCNick">
+ <x>10</x>
+ <y>60</y>
+ <width>100</width>
+ <height>20</height>
+ <text>Nick:</text>
+ </text>
+ <textentry name="tenIRCNick">
+ <Width>130</Width>
+ <Height>18</Height>
+ <x>10</x>
+ <y>68</y>
+ </textentry>
+ <button name="btnIRCNickSet">
+ <x>145</x>
+ <y>68</y>
+ <Width>25</Width>
+ <Height>18</Height>
+ <text>Set</text>
+ <OnLeftClick>
+ Event[GUI_BUTTON_HANDLE]:Execute["IRCNickSet"]
+ </OnLeftClick>
+ </button>
+
+ <text name="lblIRCChannel">
+ <x>10</x>
+ <y>90</y>
+ <width>100</width>
+ <height>20</height>
+ <text>Channel:</text>
+ </text>
+ <textentry name="tenIRCChannel">
+ <Width>130</Width>
+ <Height>18</Height>
+ <x>10</x>
+ <y>98</y>
+ </textentry>
+ <button name="btnIRCChannelSet">
+ <x>145</x>
+ <y>98</y>
+ <Width>25</Width>
+ <Height>18</Height>
+ <text>Set</text>
+ <OnLeftClick>
+ Event[GUI_BUTTON_HANDLE]:Execute["IRCChannelSet"]
+ </OnLeftClick>
+ </button>
+ </tab>
</tabs>
</TabControl>
</tab>
@@ -4155,4 +4240,4 @@
</Children>
</Window>
-</ISUI>
\ No newline at end of file
+</ISUI>
Index: HEAD/objects/oIRCLink.iss
===================================================================
--- HEAD/objects/oIRCLink.iss (revision 0)
+++ HEAD/objects/oIRCLink.iss (revision 0)
@@ -0,0 +1,177 @@
+objectdef oIRCLink inherits oBase
+{
+ variable string IRCNick = ""
+ variable string IRCServer = ""
+ variable string IRCChannel = ""
+ variable string LastOutput = ""
+
+ method Initialize()
+ {
+ Event[IRC_UnhandledEvent]:AttachAtom[IRCLink:UnhandledEvent]
+ Event[IRC_ReceivedChannelMsg]:AttachAtom[IRCLink:ReceivedChannelMsg]
+ IRCLink.IRCServer:Set[${UIElement[tenIRCServer@IRC@HumanPages@Human@Pages@openbot].Text}]
+ IRCLink.IRCNick:Set[${UIElement[tenIRCNick@IRC@HumanPages@Human@Pages@openbot].Text}]
+ IRCLink.IRCChannel:Set[${UIElement[tenIRCChannel@IRC@HumanPages@Human@Pages@openbot].Text}]
+ }
+
+ method Shutdown()
+ {
+ Event[IRC_UnhandledEvent]:DetachAtom[IRCLink:UnhandledEvent]
+ Event[IRC_ReceivedChannelMsg]:DetachAtom[IRCLink:ReceivedChannelMsg]
+ IRCUser[${This.IRCNick}].Channel:Say["Shutting down"]
+ IRCUser[${This.IRCNick}]:Disconnect
+ }
+
+ method UnhandledEvent(string User, string Command, string Param, string Rest)
+ {
+ if (${Command.Equal[ERROR]})
+ {
+ This:Output["CRITICAL IRC ERROR: ${Rest}"]
+ }
+ }
+
+ method ReceivedChannelMsg(string User, string Channel, string From, string Message)
+ { /* NO authentication here. It's assumed that if someone is in your secret bot channel and +o (op) they have access. */
+ variable string Command = ""
+
+ if ${IRCUser[${User}].Channel[${Channel}].Nick[${From}].Type.Equal["OP"]}
+ {
+ if ${Message.Left[${Math.Calc[${This.IRCNick.Length}+1]}].Equal[!${This.IRCNick}]}
+ {
+ if ${Message.Length} > ${Math.Calc[${This.IRCNick.Length}+2]}
+ {
+ /* My firstborn for a regexp */
+ Command:Set[${Message.Right[${Math.Calc[${Message.Length}-${Math.Calc[${This.IRCNick.Length}+2]}]}]}]
+ switch ${Command}
+ {
+ case status
+ {
+ This:SendStatus
+ break
+ }
+ case logout
+ {
+ POI.NeedLogout:Set[TRUE]
+ break
+ }
+ case logoutnow
+ {
+ POI.NeedLogout:Set[TRUE]
+ Navigator:ClearPath
+ move -stop
+ WoWScript Logout()
+ endscript openbot
+ break
+ }
+
+ }
+ }
+ else
+ { /* No explicit command, dump our status */
+ This:SendStatus
+ }
+ }
+ }
+ }
+
+ method SendStatus()
+ {
+ This:SayToChannel["Killed ${Grind.KillCount} Died ${Grind.RepopCount} XP/hr ${Grind.Xhr} Level ${Me.Level}/${Grind.CurrentLevel} Earned ${Grind.EarnedGold}g ${Grind.EarnedSilver}s ${Grind.EarnedCopper}c Running ${Math.Calc[(${Script.RunningTime}/3600000)%60].Int.LeadingZeroes[2]} hours ${Math.Calc[(${Script.RunningTime}/60000)%60].Int.LeadingZeroes[2]} minutes and ${Math.Calc[(${Script.RunningTime}/1000)%60].Int.LeadingZeroes[2]} seconds."]
+ }
+
+ method Pulse()
+ {
+ if ${UIElement[chkEnableIRC@IRC@HumanPages@Human@Pages@openbot].Checked} && ${This.IRCServer.NotEqual[""]} && ${This.IRCChannel.NotEqual[""]} && ${This.IRCNick.NotEqual[""]} && ${IRC.NumUsers} <= 0
+ {
+ This:Output[Connecting to ${This.IRCServer} as ${This.IRCNick}]
+ IRC:Connect[${This.IRCServer},${This.IRCNick}]
+ }
+ if ${IRC.NumUsers} >= 1 && ${IRCUser[${This.IRCNick}].Channel[${This.IRCChannel}].NumNicks} <= 0
+ {
+ variable int x = 1;
+ /* The ISXIRC module isn't very good about making sure things really happened. This must be above the code that joins channels. */
+ do
+ {
+ IRCUser[${This.IRCNick}].Channel[${This.IRCChannel}]:Leave[${This.IRCChannel}]
+ }
+ while ${x:Inc} <= ${IRCUser[${This.IRCNick}].NumChannelsIn}
+ }
+ if ${IRC.NumUsers} >= 1 && ${IRCUser[${This.IRCNick}].NumChannelsIn} <= 0
+ {
+ This:Output[Joining ${This.IRCChannel}]
+ IRCUser[${This.IRCNick}]:Join[${This.IRCChannel}]
+
+ }
+ }
+
+ method SetIRCServer()
+ {
+ variable int ircUser = 1;
+ if ${UIElement[tenIRCServer@IRC@HumanPages@Human@Pages@openbot].Text.NotEqual[""]}
+ {
+ if ${This.IRCServer.NotEqual[""]} && ${This.IRCServer.NotEqual[${UIElement[tenIRCServer@IRC@HumanPages@Human@Pages@openbot].Text}]} && ${IRC.NumUsers} >= 1
+ {
+ do
+ {
+ if ${IRCUser[${ircUser}].Server.Equal[${This.IRCServer}]}
+ {
+ IRCUser[${ircUser}]:Disconnect
+ }
+ }
+ while ${ircUser:Inc} <= ${IRC.NumUsers}
+ }
+ This.IRCServer:Set[${UIElement[tenIRCServer@IRC@HumanPages@Human@Pages@openbot].Text}]
+ LavishSettings[Settings]:AddSetting[IRCLinkServer,${This.IRCServer}]
+ This:Output[Set and Saved IRC server as ${This.IRCServer}]
+ Config:SaveEditBox[${ISXWoW.RealmName.Replace[',REMOVE,.,REMOVE]}${Me.Name},"IRCLinkServer","tenIRCServer@IRC@HumanPages@Human@Pages@openbot"]
+ }
+ else
+ {
+ This:Output["Please enter the hostname/ip of your IRC Server "]
+ }
+ }
+
+ method SetIRCNick()
+ {
+ if ${UIElement[tenIRCNick@IRC@HumanPages@Human@Pages@openbot].Text.NotEqual[""]}
+ {
+ This.IRCNick:Set[${UIElement[tenIRCNick@IRC@HumanPages@Human@Pages@openbot].Text}]
+ LavishSettings[Settings]:AddSetting[IRCLinkNick,${This.IRCNick}]
+ This:Output[Set and Saved IRC nick as ${This.IRCNick}]
+ Config:SaveEditBox[${ISXWoW.RealmName.Replace[',REMOVE,.,REMOVE]}${Me.Name},"IRCLinkNick","tenIRCNick@IRC@HumanPages@Human@Pages@openbot"]
+ }
+ else
+ {
+ This:Output["Please enter the IRC nick your bot should use."]
+ }
+ }
+
+ method SetIRCChannel()
+ {
+ if ${UIElement[tenIRCChannel@IRC@HumanPages@Human@Pages@openbot].Text.NotEqual[""]}
+ {
+ This.IRCChannel:Set[${UIElement[tenIRCChannel@IRC@HumanPages@Human@Pages@openbot].Text}]
+ LavishSettings[Settings]:AddSetting[IRCLinkChannel,${This.IRCChannel}]
+ This:Output[Set and Saved IRC channel as ${This.IRCChannel}]
+ Config:SaveEditBox[${ISXWoW.RealmName.Replace[',REMOVE,.,REMOVE]}${Me.Name},"IRCLinkChannel","tenIRCChannel@IRC@HumanPages@Human@Pages@openbot"]
+ }
+ else
+ {
+ This:Output["Please enter the IRC channel your bot should join."]
+ }
+ }
+
+ method SayToChannel(string Text)
+ {
+ if ${This.IRCNick.Equal[""]} || ${This.IRCServer.Equal[""]} || ${This.IRCChannel.Equal[""]}
+ {
+ return
+ }
+
+ if ${UIElement[chkEnableIRC@IRC@HumanPages@Human@Pages@openbot].Checked} && ${IRC.NumUsers} >= 1 && ${IRCUser[${This.IRCNick}].NumChannelsIn} >= 1 && ${This.LastOutput.NotEqual[${Text}]}
+ {
+ This.LastOutput:Set[${Text}] /* This should be adjusted or removed if/when we stop calling this from oBase:Output */
+ IRCUser[${This.IRCNick}].Channel[${This.IRCChannel}]:Say["${Text}"]
+ }
+ }
+}
Index: HEAD/objects/oConfig.iss
===================================================================
--- HEAD/objects/oConfig.iss (revision 19)
+++ HEAD/objects/oConfig.iss (working copy)
@@ -149,6 +149,12 @@
This:SetSlider[${uniqueToon},"sldPartyFollowDistance","sldPartyFollowDistance@PartyConfig@HumanPages@Human@Pages@openbot",10]
This:SetSlider[${uniqueToon},"sldPartyNearDistance","sldPartyNearDistance@PartyConfig@HumanPages@Human@Pages@openbot",30]
This:SetSlider[${uniqueToon},"sldAssistRange","sldAssistRange@PartyConfig@HumanPages@Human@Pages@openbot",100]
+
+ This:SetCheckBox[${uniqueToon},"chkEnableIRC","chkEnableIRC@IRC@HumanPages@Human@Pages@openbot",FALSE]
+ This:LoadEditBox[${uniqueToon},"IRCLinkServer","tenIRCServer@IRC@HumanPages@Human@Pages@openbot"]
+ This:LoadEditBox[${uniqueToon},"IRCLinkChannel","tenIRCChannel@IRC@HumanPages@Human@Pages@openbot"]
+ This:LoadEditBox[${uniqueToon},"IRCLinkNick","tenIRCNick@IRC@HumanPages@Human@Pages@openbot"]
+
}
method SaveToon()
@@ -181,6 +187,7 @@
This:SaveCheckBox[${uniqueToon},"chkPartyLeader"]
This:SaveCheckBox[${uniqueToon},"chkCanTank"]
This:SaveCheckBox[${uniqueToon},"chkEnableQuest"]
+ This:SaveCheckBox[${uniqueToon},"chkEnableIRC"]
This:SaveSlider[${uniqueToon},"sldPartyFollowDistance"]
This:SaveSlider[${uniqueToon},"sldPartyNearDistance"]
This:SaveSlider[${uniqueToon},"sldAssistRange"]
@@ -379,4 +386,4 @@
variable string uniqueToon = "${Me.Name}${ISXWoW.RealmName.Replace[',REMOVE,.,REMOVE]}${Me.Class}"
This:SaveSlider[${uniqueToon},${settingName}]
}
-}
\ No newline at end of file
+}
Index: HEAD/objects/oBase.iss
===================================================================
--- HEAD/objects/oBase.iss (revision 19)
+++ HEAD/objects/oBase.iss (working copy)
@@ -30,6 +30,7 @@
}
}
UIElement[ConsoleWindow].FindChild[Console]:Echo["${Time.Time24}: ${Text}"]
+ IRCLink:SayToChannel[${Text}]
This:Debug[${Text}]
if ${UIElement[chkLogOutput@Config@Pages@openbot].Checked}
{
@@ -147,4 +148,4 @@
This.${IndexName}:Clear
This.${IndexName}:Collapse
}
-}
\ No newline at end of file
+}
Index: HEAD/objects/oGUI.iss
===================================================================
--- HEAD/objects/oGUI.iss (revision 19)
+++ HEAD/objects/oGUI.iss (working copy)
@@ -53,6 +53,19 @@
}
UIElement[lowestRepairPCT@Config@InvPages@Inventory@Pages@OpenBot]:SetText[${LavishSettings[Settings].FindSetting[lowestRepairPCT,"10"]}]
UIElement[overAllRepairPCT@Config@InvPages@Inventory@Pages@OpenBot]:SetText[${LavishSettings[Settings].FindSetting[overAllRepairPCT,"20"]}]
+
+ if ${LavishSettings[Settings].FindSetting[chkEnableIRC,FALSE]}
+ {
+ UIElement[chkEnableIRC@IRC@HumanPages@Human@Pages@openbot]:SetChecked
+ }
+ else
+ {
+ UIElement[chkEnableIRC@IRC@HumanPages@Human@Pages@openbot]:UnsetChecked
+ }
+ UIElement[tenIRCServer@IRC@HumanPages@Human@Pages@openbot]:SetText[${LavishSettings[Settings].FindSetting[IRCLinkServer,""]}]
+ UIElement[tenIRCChannel@IRC@HumanPages@Human@Pages@openbot]:SetText[${LavishSettings[Settings].FindSetting[IRCLinkChannel,""]}]
+ UIElement[tenIRCNick@IRC@HumanPages@Human@Pages@openbot]:SetText[${LavishSettings[Settings].FindSetting[IRCLinkNick,""]}]
+
Inventory.lowestRpairPct:Set[${UIElement[lowestRepairPCT@Config@InvPages@Inventory@Pages@OpenBot].Text}]
Inventory.overAllRepairPCT:Set[${UIElement[overAllRepairPCT@Config@InvPages@Inventory@Pages@OpenBot].Text}]
}
@@ -460,6 +473,21 @@
Inventory:SetMule
break
}
+ case IRCChannelSet
+ {
+ IRCLink:SetIRCChannel
+ break
+ }
+ case IRCNickSet
+ {
+ IRCLink:SetIRCNick
+ break
+ }
+ case IRCServerSet
+ {
+ IRCLink:SetIRCServer
+ break
+ }
case FoodRestock
{
if ${UIElement[chkRestockFood@Restock@InvPages@Inventory@Pages@OpenBot].Checked}
@@ -974,4 +1002,4 @@
}
}
}
-}
\ No newline at end of file
+}
Index: HEAD/objects/oBot.iss
===================================================================
--- HEAD/objects/oBot.iss (revision 19)
+++ HEAD/objects/oBot.iss (working copy)
@@ -80,6 +80,7 @@
This:AddPulse["Inventory","Pulse",500,TRUE,FALSE]
;This:AddPulse["TalentTree","Pulse",1000,TRUE,FALSE]
This:AddPulse["Quest","EventPulse",500,TRUE,FALSE]
+ This:AddPulse["IRCLink","Pulse",75,FALSE,FALSE]
}
method BagUpdate()
@@ -177,6 +178,7 @@
Bot:UpdateGlobalCooldown
Inventory:Pulse
BG:Initialize
+ IRCLink:Initialize
WoWScript "pcall(loadstring('function SitOrStand() SitStandOrDescendStart() end'))"
This:Output["OpenBot ${This.Version} is Online. All ur bot r belong 2 us."]
@@ -298,4 +300,4 @@
${This.ObjectName}:${This.PulseName}
}
}
-}
\ No newline at end of file
+}