Untitled diff

Created Diff never expires
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- Client Lua Script for WillYouBeMyNeighbor
-- Client Lua Script for WillYouBeMyNeighbor
-- Copyright (c) NCsoft. All rights reserved
-- Copyright (c) NCsoft. All rights reserved
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
require "Window"
require "Window"
require "HousingLib"
require "HousingLib"
local DEBUGDATA={}
local DEBUGDATA={}
local function DEBUG(s)
local function DEBUG(s)
table.insert(DEBUGDATA, 1, {st=debug.getinfo(2).name, msg=s})
table.insert(DEBUGDATA, 1, {st=debug.getinfo(2).name, msg=s})
DEBUGDATA[101] = nil
DEBUGDATA[101] = nil
end
end
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- WillYouBeMyNeighbor Module Definition
-- WillYouBeMyNeighbor Module Definition
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
WillYouBeMyNeighbor = {}
WillYouBeMyNeighbor = {}
WillYouBeMyNeighbor.tLocale = {}
WillYouBeMyNeighbor.tLocale = {}
NBR_NEIGHBORS = {
NBR_NEIGHBORS = {
crnt = 0,
crnt = 0,
next = 0,
next = 0,
nk = "",
nk = "",
list = {}
list = {}
}
}
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- Constants
-- Constants
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
local version = 1.047
local version = 1.047
local kcrOnline = ApolloColor.new("UI_TextHoloBodyHighlight")
local kcrOnline = ApolloColor.new("UI_TextHoloBodyHighlight")
local kcrOffline = ApolloColor.new("UI_BtnTextGrayNormal")
local kcrOffline = ApolloColor.new("UI_BtnTextGrayNormal")
local kcrIgnored = ApolloColor.new("UI_WindowAlert")
local kcrIgnored = ApolloColor.new("UI_WindowAlert")
local RegisteredUsers = {}
local RegisteredUsers = {}
local lastVisit = {}
local lastVisit = {}
local OnlineUsers = {}
local OnlineUsers = {}
local AutoDisplay = true
local AutoDisplay = true
local AutoAccept = false
local AutoAccept = false
local DeclineByFilter = false
local DeclineByFilter = false
local NodeFilter = "Mineral Deposit"
local NodeFilter = "Mineral Deposit"
local ShareFilter = 0
local ShareFilter = 0
local NodeLevelFilter = 1
local NodeLevelFilter = 1
local GuildFilter = ""
local GuildFilter = ""
local PlantPiratesAlert = true
local PlantPiratesAlert = true
local HarvestNotifications = true
local HarvestNotifications = true
local AcceptAllSocials = false
local AcceptAllSocials = false
local currentZone = ""
local currentZone = ""
local IgnoredPlots = {
local IgnoredPlots = {
ignore = false,
ignore = false,
ignoreList = {}
ignoreList = {}
}
}
local ResourceTypes = {
local ResourceTypes = {
filter = { mineral=false, relic=false, thicket=false },
filter = { mineral=false, relic=false, thicket=false },
mineral = {},
mineral = {},
relic = {},
relic = {},
thicket = {}
thicket = {}
}
}
local PlotRatings = {}
local PlotRatings = {}
local wybmnOptions = {
local wybmnOptions = {
takeMail = false,
takeMail = false,
autoZone = false
autoZone = false
}
}
local autoVisit = false
local autoVisit = false
local skipNeeded = false
local skipNeeded = false
local autoCount = 0
local autoCount = 0
local Plugs = {}
local Plugs = {}
local skipnodeTypes = {}
local skipnodeTypes = {}
--local nameIndex = {}
--local nameIndex = {}
nameIndex = {}
nameIndex = {}
local nodeTypes = {
local nodeTypes = {
-- EN
-- EN
["Elite Mineral Deposit"] = { k="mineral", t=5 },
["Elite Mineral Deposit"] = { k="mineral", t=5 },
["Elite Relic Excavation"] = { k="mineral", t=5 },
["Elite Relic Excavation"] = { k="mineral", t=5 },
["Elite Thicket"] = { k="thicket", t=5 },
["Elite Thicket"] = { k="thicket", t=5 },
["Mineral Deposit"] = { k="mineral", t=1 },
["Mineral Deposit"] = { k="mineral", t=1 },
["Mineral Deposit Tier 1"] = { k="mineral", t=1 },
["Mineral Deposit Tier 1"] = { k="mineral", t=1 },
["Mineral Deposit Tier 2"] = { k="mineral", t=2 },
["Mineral Deposit Tier 2"] = { k="mineral", t=2 },
["Mineral Deposit Tier 3"] = { k="mineral", t=3 },
["Mineral Deposit Tier 3"] = { k="mineral", t=3 },
["Mineral Deposit Tier 4"] = { k="mineral", t=4 },
["Mineral Deposit Tier 4"] = { k="mineral", t=4 },
["Relic Excavation"] = { k="relic", t=1 },
["Relic Excavation"] = { k="relic", t=1 },
["Relic Excavation Tier 1"] = { k="relic", t=1 },
["Relic Excavation Tier 1"] = { k="relic", t=1 },
["Relic Excavation Tier 2"] = { k="relic", t=2 },
["Relic Excavation Tier 2"] = { k="relic", t=2 },
["Relic Excavation Tier 3"] = { k="relic", t=3 },
["Relic Excavation Tier 3"] = { k="relic", t=3 },
["Relic Excavation Tier 4"] = { k="relic", t=4 },
["Relic Excavation Tier 4"] = { k="relic", t=4 },
["Thicket Tier 1"] = { k="thicket", t=1 },
["Thicket Tier 1"] = { k="thicket", t=1 },
["Thicket"] = { k="thicket", t=1 },
["Thicket"] = { k="thicket", t=1 },
["Thicket Tier 2"] = { k="thicket", t=2 },
["Thicket Tier 2"] = { k="thicket", t=2 },
["Thicket Tier 3"] = { k="thicket", t=3 },
["Thicket Tier 3"] = { k="thicket", t=3 },
["Thicket Tier 4"] = { k="thicket", t=4 },
["Thicket Tier 4"] = { k="thicket", t=4 },
-- DE
-- DE
["Mineralvorkommen"] = { k="mineral", t=1 },
["Mineralvorkommen"] = { k="mineral", t=1 },
["Mineralvorkommen (Rang 1)"] = { k="mineral", t=1 },
["Mineralvorkommen (Rang 1)"] = { k="mineral", t=1 },
["Mineralvorkommen (Rang 2)"] = { k="mineral", t=2 },
["Mineralvorkommen (Rang 2)"] = { k="mineral", t=2 },
["Mineralvorkommen (Rang 3)"] = { k="mineral", t=3 },
["Mineralvorkommen (Rang 3)"] = { k="mineral", t=3 },
["Mineralvorkommen (Rang 4)"] = { k="mineral", t=4 },
["Mineralvorkommen (Rang 4)"] = { k="mineral", t=4 },
["Dickicht"] = { k="thicket", t=1 },
["Dickicht"] = { k="thicket", t=1 },
["Dickicht (Rang 1)"] = { k="thicket", t=1 },
["Dickicht (Rang 1)"] = { k="thicket", t=1 },
["Dickicht (Rang 2)"] = { k="thicket", t=2 },
["Dickicht (Rang 2)"] = { k="thicket", t=2 },
["Dickicht (Rang 3)"] = { k="thicket", t=3 },
["Dickicht (Rang 3)"] = { k="thicket", t=3 },
["Dickicht (Rang 4)"] = { k="thicket", t=4 },
["Dickicht (Rang 4)"] = { k="thicket", t=4 },
["Reliktausgrabung"] = { k="relic", t=1 },
["Reliktausgrabung"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 1)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 1)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 2)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 2)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 3)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 3)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 4)"] = { k="relic", t=1 },
["Reliktausgrabung (Rang 4)"] = { k="relic", t=1 },
["Elite-Mineralvorkommen"] = { k="mineral", t=5 },
["Elite-Mineralvorkommen"] = { k="mineral", t=5 },
["Elite-Dickicht"] = { k="thicket", t=5 },
["Elite-Dickicht"] = { k="thicket", t=5 },
["Elite-Reliktausgrabung"] = { k="relic", t=5 },
["Elite-Reliktausgrabung"] = { k="relic", t=5 },
}
}
local unitTypes = {
local unitTypes = {
-- EN
-- EN
["Deradune Tree"] = { k="thicket", t=1 },
["Deradune Tree"] = { k="thicket", t=1 },
["Algoroc Tree"] = { k="thicket", t=1 },
["Algoroc Tree"] = { k="thicket", t=1 },
["Ellevar Tree"] = { k="thicket", t=1 },
["Ellevar Tree"] = { k="thicket", t=1 },
["Celestion Tree"] = { k="thicket", t=1 },
["Celestion Tree"] = { k="thicket", t=1 },
["Galeras Tree"] = { k="thicket", t=2 },
["Galeras Tree"] = { k="thicket", t=2 },
["Whitevale Tree"] = { k="thicket", t=2 },
["Whitevale Tree"] = { k="thicket", t=2 },
["Auroria Tree"] = { k="thicket", t=2 },
["Auroria Tree"] = { k="thicket", t=2 },
["Wilderrun Tree"] = { k="thicket", t=3 },
["Wilderrun Tree"] = { k="thicket", t=3 },
["Farside Tree"] = { k="thicket", t=3 },
["Farside Tree"] = { k="thicket", t=3 },
["Grimvault Tree"] = { k="thicket", t=4 },
["Grimvault Tree"] = { k="thicket", t=4 },
["Malgrave Tree"] = { k="thicket", t=4 },
["Malgrave Tree"] = { k="thicket", t=4 },
["Standard Relic Node"] = { k="relic", t=1 },
["Standard Relic Node"] = { k="relic", t=1 },
["Accelerated Relic Node"] = { k="relic", t=1 },
["Accelerated Relic Node"] = { k="relic", t=1 },
["Advanced Relic Node"] = { k="relic", t=2 },
["Advanced Relic Node"] = { k="relic", t=2 },
["Dynamic Relic Node"] = { k="relic", t=3 },
["Dynamic Relic Node"] = { k="relic", t=3 },
["Kinetic Relic Node"] = { k="relic", t=4 },
["Kinetic Relic Node"] = { k="relic", t=4 },
["Iron Node"] = { k="mineral", t=1 },
["Iron Node"] = { k="mineral", t=1 },
["Titanium Node"] = { k="mineral", t=1 },
["Titanium Node"] = { k="mineral", t=1 },
["Zephyrite Node"] = { k="mineral", t=1 },
["Zephyrite Node"] = { k="mineral", t=1 },
["Platinum Node"] = { k="mineral", t=2 },
["Platinum Node"] = { k="mineral", t=2 },
["Hydrogem Node"] = { k="mineral", t=2 },
["Hydrogem Node"] = { k="mineral", t=2 },
["Xenocite Node"] = { k="mineral", t=3 },
["Xenocite Node"] = { k="mineral", t=3 },
["Shadeslate Node"] = { k="mineral", t=3 },
["Shadeslate Node"] = { k="mineral", t=3 },
["Galactium Node"] = { k="mineral", t=4 },
["Galactium Node"] = { k="mineral", t=4 },
["Novacite Node"] = { k="mineral", t=4 },
["Novacite Node"] = { k="mineral", t=4 },
}
}
local opacity = {
local opacity = {
[false] = 1,
[false] = 1,
[true] = 0.6
[true] = 0.6
}
}
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- Initialization
-- Initialization
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
function WillYouBeMyNeighbor:new(o)
function WillYouBeMyNeighbor:new(o)
o = o or {}
o = o or {}
setmetatable(o, self)
setmetatable(o, self)
self.__index = self
self.__index = self
-- initialize variables here
-- initialize variables here
return o
return o
end
end
function WillYouBeMyNeighbor:Init()
function WillYouBeMyNeighbor:Init()
local bHasConfigureFunction = false
local bHasConfigureFunction = false
local strConfigureButtonText = ""
local strConfigureButtonText = ""
local tDependencies = {
local tDependencies = {
"NeighborList"
"NeighborList"
}
}
Apollo.RegisterAddon(self, bHasConfigureFunction, strConfigureButtonText, tDependencies)
Apollo.RegisterAddon(self, bHasConfigureFunction, strConfigureButtonText, tDependencies)
end
end
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- Saved Information
-- Saved Information
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
function WillYouBeMyNeighbor:OnSave(eLevel)
function WillYouBeMyNeighbor:OnSave(eLevel)
if eLevel ~= GameLib.CodeEnumAddonSaveLevel.Character then
if eLevel ~= GameLib.CodeEnumAddonSaveLevel.Character then
return nil
return nil
end
end
local save = {}
local save = {}
save.AutoDisplay = AutoDisplay
save.AutoDisplay = AutoDisplay
save.AutoAccept = AutoAccept
save.AutoAccept = AutoAccept
save.DeclineByFilter = DeclineByFilter
save.DeclineByFilter = DeclineByFilter
save.NodeFilter = NodeFilter
save.NodeFilter = NodeFilter
save.ShareFilter = ShareFilter
save.ShareFilter = ShareFilter
save.NodeLevelFilter = NodeLevelFilter
save.NodeLevelFilter = NodeLevelFilter
save.GuildFilter = GuildFilter
save.GuildFilter = GuildFilter
save.PlantPiratesAlert = PlantPiratesAlert
save.PlantPiratesAlert = PlantPiratesAlert
save.HarvestNotifications = HarvestNotifications
save.HarvestNotifications = HarvestNotifications
save.AcceptAllSocials = AcceptAllSocials
save.AcceptAllSocials = AcceptAllSocials
save.RegisteredUsers = RegisteredUsers
save.RegisteredUsers = RegisteredUsers
save.lastVisit = lastVisit
save.lastVisit = lastVisit
save.IgnoredPlots = IgnoredPlots
save.IgnoredPlots = IgnoredPlots
save.ResourceTypes = ResourceTypes
save.ResourceTypes = ResourceTypes
save.PlotRatings = PlotRatings
save.PlotRatings = PlotRatings
save.wybmnOptions = wybmnOptions
save.wybmnOptions = wybmnOptions
return save
return save
end
end
function WillYouBeMyNeighbor:OnRestore(eLevel, tData)
function WillYouBeMyNeighbor:OnRestore(eLevel, tData)
if eLevel == GameLib.CodeEnumAddonSaveLevel.Character then
if eLevel == GameLib.CodeEnumAddonSaveLevel.Character then
if tData.AutoDisplay ~= nil then AutoDisplay = tData.AutoDisplay end
if tData.AutoDisplay ~= nil then AutoDisplay = tData.AutoDisplay end
if tData.AutoAccept ~= nil then AutoAccept = tData.AutoAccept end
if tData.AutoAccept ~= nil then AutoAccept = tData.AutoAccept end
if tData.DeclineByFilter ~= nil then DeclineByFilter = tData.DeclineByFilter end
if tData.DeclineByFilter ~= nil then DeclineByFilter = tData.DeclineByFilter end
if tData.NodeFilter ~= nil then NodeFilter = tData.NodeFilter end
if tData.NodeFilter ~= nil then NodeFilter = tData.NodeFilter end
if tData.ShareFilter ~= nil then ShareFilter = tData.ShareFilter end
if tData.ShareFilter ~= nil then ShareFilter = tData.ShareFilter end
if tData.NodeLevelFilter ~= nil then NodeLevelFilter = tData.NodeLevelFilter end
if tData.NodeLevelFilter ~= nil then NodeLevelFilter = tData.NodeLevelFilter end
if tData.GuildFilter ~= nil then GuildFilter = tData.GuildFilter end
if tData.GuildFilter ~= nil then GuildFilter = tData.GuildFilter end
if tData.PlantPiratesAlert ~= nil then PlantPiratesAlert = tData.PlantPiratesAlert end
if tData.PlantPiratesAlert ~= nil then PlantPiratesAlert = tData.PlantPiratesAlert end
if tData.HarvestNotifications ~= nil then HarvestNotifications = tData.HarvestNotifications end
if tData.HarvestNotifications ~= nil then HarvestNotifications = tData.HarvestNotifications end
if tData.AcceptAllSocials ~= nil then AcceptAllSocials = tData.AcceptAllSocials end
if tData.AcceptAllSocials ~= nil then AcceptAllSocials = tData.AcceptAllSocials end
if tData.RegisteredUsers ~= nil then RegisteredUsers = tData.RegisteredUsers end
if tData.RegisteredUsers ~= nil then RegisteredUsers = tData.RegisteredUsers end
if tData.lastVisit then lastVisit = tData.lastVisit end
if tData.lastVisit then lastVisit = tData.lastVisit end
if tData.IgnoredPlots then IgnoredPlots = tData.IgnoredPlots end
if tData.IgnoredPlots then IgnoredPlots = tData.IgnoredPlots end
if tData.ResourceTypes then ResourceTypes = tData.ResourceTypes end
if tData.ResourceTypes then ResourceTypes = tData.ResourceTypes end
if tData.PlotRatings then PlotRatings = tData.PlotRatings end
if tData.PlotRatings then PlotRatings = tData.PlotRatings end
if tData.wybmnOptions then wybmnOptions = tData.wybmnOptions end
if tData.wybmnOptions then wybmnOptions = tData.wybmnOptions end
for k,v in pairs(RegisteredUsers) do
for k,v in pairs(RegisteredUsers) do
if type(v) == "table" then
if type(v) == "table" then
local nt = nodeTypes[v.nodetype]
local nt = nodeTypes[v.nodetype]
if nt and ResourceTypes[nt.k] and ResourceTypes[nt.k][v.name] == nil then
if nt and ResourceTypes[nt.k] and ResourceTypes[nt.k][v.name] == nil then
ResourceTypes[nt.k][v.name] = nt.t
ResourceTypes[nt.k][v.name] = nt.t
end
end
if PlotRatings[v.name] == nil then
if PlotRatings[v.name] == nil then
PlotRatings[v.name] = 1
PlotRatings[v.name] = 1
end
end
end
end
end
end
end
end
end
end
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- OnLoad
-- OnLoad
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
function WillYouBeMyNeighbor:OnLoad()
function WillYouBeMyNeighbor:OnLoad()
-- load our form file
-- load our form file
self.xmlDoc = XmlDoc.CreateFromFile("WillYouBeMyNeighbor.xml")
self.xmlDoc = XmlDoc.CreateFromFile("WillYouBeMyNeighbor.xml")
self.xmlDoc:RegisterCallback("OnDocLoaded", self)
self.xmlDoc:RegisterCallback("OnDocLoaded", self)
if Apollo.GetAddon("VikingContextMenuPlayer") ~= nil then
if Apollo.GetAddon("VikingContextMenuPlayer") ~= nil then
self.contextMenuPlayer = Apollo.GetAddon("VikingContextMenuPlayer")
self.contextMenuPlayer = Apollo.GetAddon("VikingContextMenuPlayer")
else
else
self.contextMenuPlayer = Apollo.GetAddon("ContextMenuPlayer")
self.contextMenuPlayer = Apollo.GetAddon("ContextMenuPlayer")
end
end
local oldRedrawAll = self.contextMenuPlayer.RedrawAll
local oldRedrawAll = self.contextMenuPlayer.RedrawAll
self.contextMenuPlayer.RedrawAll = function(context)
self.contextMenuPlayer.RedrawAll = function(context)
if self.contextMenuPlayer.wndMain ~= nil then
if self.contextMenuPlayer.wndMain ~= nil then
local wndButtonList = self.contextMenuPlayer.wndMain:FindChild("ButtonList")
local wndButtonList = self.contextMenuPlayer.wndMain:FindChild("ButtonList")
if wndButtonList ~= nil then
if wndButtonList ~= nil then
local wndNew = wndButtonList:FindChildByUserData(tObject)
local wndNew = wndButtonList:FindChildByUserData(tObject)
if not wndNew then
if not wndNew then
wndNew = Apollo.LoadForm(self.contextMenuPlayer.xmlDoc, "BtnRegular", wndButtonList, self.contextMenuPlayer)
wndNew = Apollo.LoadForm(self.contextMenuPlayer.xmlDoc, "BtnRegular", wndButtonList, self.contextMenuPlayer)
wndNew:SetData("VisitNeighbor")
wndNew:SetData("VisitNeighbor")
end
end
wndNew:FindChild("BtnText"):SetText("Visit Neighbor")
wndNew:FindChild("BtnText"):SetText("Visit Neighbor")
end
end
end
end
oldRedrawAll(context)
oldRedrawAll(context)
end
end
-- catch the event fired when the player clicks the context menu
-- catch the event fired when the player clicks the context menu
local oldProcessContextClick = self.contextMenuPlayer.ProcessContextClick
local oldProcessContextClick = self.contextMenuPlayer.ProcessContextClick
self.contextMenuPlayer.ProcessContextClick = function(context, eButtonType)
self.contextMenuPlayer.ProcessContextClick = function(context, eButtonType)
if eButtonType == "VisitNeighbor" then
if eButtonType == "VisitNeighbor" then
self:VisitNeighbor(self.contextMenuPlayer.strTarget)
self:VisitNeighbor(self.contextMenuPlayer.strTarget)
else
else
oldProcessContextClick (context, eButtonType)
oldProcessContextClick (context, eButtonType)
end
end
end
end
self.tQueuedUnits = {}
self.tQueuedUnits = {}
self.rosters = {}
self.rosters = {}
Apollo.RegisterEventHandler("UnitCreated", "OnUnitCreated", self)
Apollo.RegisterEventHandler("UnitCreated", "OnUnitCreated", self)
--Apollo.RegisterEventHandler("UnitDestroyed", "OnUnitDestroyed", self)
--Apollo.RegisterEventHandler("UnitDestroyed", "OnUnitDestroyed", self)
Apollo.RegisterEventHandler("InterfaceMenuListHasLoaded", "OnInterfaceMenuListHasLoaded", self)
Apollo.RegisterEventHandler("InterfaceMenuListHasLoaded", "OnInterfaceMenuListHasLoaded", self)
Apollo.RegisterEventHandler("HarvestItemsSentToOwner", "OnHarvest", self)
Apollo.RegisterEventHandler("HarvestItemsSentToOwner", "OnHarvest", self)
self.chanICC = ICCommLib.JoinChannel("WillYouBeMyNeighborChannel", "OnDotMessageWillYouBeMyNeighborChannelMessage", self)
self.chanICC = ICCommLib.JoinChannel("WillYouBeMyNeighborChannel", "OnDotMessageWillYouBeMyNeighborChannelMessage", self)
self.chanICCOL = ICCommLib.JoinChannel("WillYouBeMyNeighborOnlineChannel", "OnDotMessageWillYouBeMyNeighborOnlineChannelMessage", self)
self.chanICCOL = ICCommLib.JoinChannel("WillYouBeMyNeighborOnlineChannel", "OnDotMessageWillYouBeMyNeighborOnlineChannelMessage", self)
self.chanICCPP = ICCommLib.JoinChannel("WillYouBeMyNeighborPPChannel", "OnDotMessageWillYouBeMyNeighborPPChannelMessage", self)
self.chanICCPP = ICCommLib.JoinChannel("WillYouBeMyNeighborPPChannel", "OnDotMessageWillYouBeMyNeighborPPChannelMessage", self)
self.chanICCHN = ICCommLib.JoinChannel("WillYouBeMyNeighborHarvestNotificationChannel", "OnDotMessageWillYouBeMyNeighborHarvestNotificationChannelMessage", self)
self.chanICCHN = ICCommLib.JoinChannel("WillYouBeMyNeighborHarvestNotificationChannel", "OnDotMessageWillYouBeMyNeighborHarvestNotificationChannelMessage", self)
self:SetLocaleData()
self:SetLocaleData()
end
end
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- OnDocLoaded
-- OnDocLoaded
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
function WillYouBeMyNeighbor:OnDocLoaded()
function WillYouBeMyNeighbor:OnDocLoaded()
if self.xmlDoc ~= nil and self.xmlDoc:IsLoaded() then
if self.xmlDoc ~= nil and self.xmlDoc:IsLoaded() then
self.wndMain = Apollo.LoadForm(self.xmlDoc, "WillYouBeMyNeighborForm", nil, self)
self.wndMain = Apollo.LoadForm(self.xmlDoc, "WillYouBeMyNeighborForm", nil, self)
if self.wndMain == nil then
if self.wndMain == nil then
Apollo.AddAddonErrorText(self, "Could not load the main window for some reason.")
Apollo.AddAddonErrorText(self, "Could not load the main window for some reason.")
return
return
end
end
self.wndMain:Show(false, true)
self.wndMain:Show(false, true)
-- if the xmlDoc is no longer needed, you should set it to nil
-- if the xmlDoc is no longer needed, you should set it to nil
-- self.xmlDoc = nil
-- self.xmlDoc = nil
-- Register handlers for events, slash commands and timer, etc.
-- Register handlers for events, slash commands and timer, etc.
-- e.g. Apollo.RegisterEventHandler("KeyDown", "OnKeyDown", self)
-- e.g. Apollo.RegisterEventHandler("KeyDown", "OnKeyDown", self)
Apollo.RegisterSlashCommand("rogers", "OnWillYouBeMyNeighborOn", self)
Apollo.RegisterSlashCommand("rogers", "OnWillYouBeMyNeighborOn", self)
Apollo.RegisterEventHandler("WillYouBeMyNeighborOn", "OnWillYouBeMyNeighborOn", self)
Apollo.RegisterEventHandler("WillYouBeMyNeighborOn", "OnWillYouBeMyNeighborOn", self)
Apollo.RegisterEventHandler("GuildRoster", "OnGuildRoster", self)
Apollo.RegisterEventHandler("GuildRoster", "OnGuildRoster", self)
Apollo.RegisterEventHandler("ZoneCompletionUpdated", "OnZoneCompletionUpdated", self)
Apollo.RegisterEventHandler("ZoneCompletionUpdated", "OnZoneCompletionUpdated", self)
Apollo.RegisterEventHandler("HousingNeighborInviteRecieved", "OnNeighborInviteRecieved", self)
Apollo.RegisterEventHandler("HousingNeighborInviteRecieved", "OnNeighborInviteRecieved", self)
Apollo.RegisterEventHandler("WindowManagementReady", "OnWindowManagementReady", self)
Apollo.RegisterEventHandler("WindowManagementReady", "OnWindowManagementReady", self)
-- Do additional Addon initialization here
-- Do additional Addon initialization here
self.currentNeighbor = 1
self.currentNeighbor = 1
self.currentNeighborName = ""
self.currentNeighborName = ""
self.expanded = false
self.expanded = false
self.performInvites = ""
self.performInvites = ""
self.faction = 0
self.faction = 0
self.timer = ApolloTimer.Create(5.0, true, "UpdateMyself", self)
self.timer = ApolloTimer.Create(5.0, true, "UpdateMyself", self)
self.timer1 = ApolloTimer.Create(1.0, true, "UpdateCurrent", self)
self.timer1 = ApolloTimer.Create(1.0, true, "UpdateCurrent", self)
Apollo.CreateTimer("skiptimer", 0.5, false)
Apollo.CreateTimer("skiptimer", 0.5, false)
Apollo.RegisterTimerHandler("skiptimer","AutoSkipCheck",self)
Apollo.RegisterTimerHandler("skiptimer","AutoSkipCheck",self)
self.wndMain:FindChild("ComboShareRatioList"):AddItem("100% to me", "", "100% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("100% to me", "", "100% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("75% to me", "", "75% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("75% to me", "", "75% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("50% to me", "", "50% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("50% to me", "", "50% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("25% to me", "", "25% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("25% to me", "", "25% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("0% to me", "", "0% to me")
self.wndMain:FindChild("ComboShareRatioList"):AddItem("0% to me", "", "0% to me")
self:PopulateCircles()
self:PopulateCircles()
self.mail = Apollo.GetAddon("Mail")
self.mail = Apollo.GetAddon("Mail")
if self.mail then
if self.mail then
local mailtoggle = self.mail.ToggleWindow
local mailtoggle = self.mail.ToggleWindow
function self.mail.ToggleWindow(s)
function self.mail.ToggleWindow(s)
mailtoggle(s)
mailtoggle(s)
if wybmnOptions.takeMail and MailSystemLib.AtMailbox() then
if wybmnOptions.takeMail and MailSystemLib.AtMailbox() then
if s.wndMain:IsVisible() then
if s.wndMain:IsVisible() then
local blooted = false
local blooted = false
local lootedItems = {}
local lootedItems = {}
for k,v in pairs(MailSystemLib.GetInbox()) do
for k,v in pairs(MailSystemLib.GetInbox()) do
local tMI = v:GetMessageInfo()
local tMI = v:GetMessageInfo()
if tMI and tMI.strSubject == "Harvest Loot" and tMI.strSenderName == "Phineas T. Rotostar" then
if tMI and tMI.strSubject == "Harvest Loot" and tMI.strSenderName == "Phineas T. Rotostar" then
--if tMI and tMI.strSenderName == "Phineas T. Rotostar" then
--if tMI and tMI.strSenderName == "Phineas T. Rotostar" then
--
--
-- /dump Apollo.GetAddon("Mail").tMailItemWnds
-- /dump Apollo.GetAddon("Mail").tMailItemWnds
--
--
if tMI.arAttachments then
if tMI.arAttachments then
local tAttach
local tAttach
for x=1, 10 do
for x=1, 10 do
tAttach = tMI.arAttachments[x]
tAttach = tMI.arAttachments[x]
if tAttach then
if tAttach then
local sN = tAttach.itemAttached:GetName()
local sN = tAttach.itemAttached:GetName()
local nS = tAttach.nStackCount
local nS = tAttach.nStackCount
if lootedItems[sN] then
if lootedItems[sN] then
lootedItems[sN] = lootedItems[sN] + nS
lootedItems[sN] = lootedItems[sN] + nS
else
else
lootedItems[sN] = nS
lootedItems[sN] = nS
blooted = true
blooted = true
end
end
end
end
end
end
end
end
v:TakeAllAttachments()
v:TakeAllAttachments()
local wnd = self.mail.tMailItemWnds[v:GetIdStr()]
local wnd = self.mail.tMailItemWnds[v:GetIdStr()]
if wnd then
if wnd then
wnd:FindChild("SelectMarker"):SetCheck(true)
wnd:FindChild("SelectMarker"):SetCheck(true)
end
end
end
end
end
end
if blooted then
if blooted then
local srtLoot = {}
local srtLoot = {}
for k,v in pairs(lootedItems) do
for k,v in pairs(lootedItems) do
table.insert(srtLoot, {n=k, s=v})
table.insert(srtLoot, {n=k, s=v})
end
end
table.sort(srtLoot, function(a,b) return a.n < b.n end)
table.sort(srtLoot, function(a,b) return a.n < b.n end)
for k,v in ipairs(srtLoot) do
for k,v in ipairs(srtLoot) do
Print(v.n.." x"..tostring(v.s))
Print(v.n.." x"..tostring(v.s))
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- WillYouBeMyNeighbor Functions
-- WillYouBeMyNeighbor Functions
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
function WillYouBeMyNeighbor:GetCurrentZoneName()
function WillYouBeMyNeighbor:GetCurrentZoneName()
if HousingLib:IsOnMyResidence() == true then
if HousingLib:IsOnMyResidence() == true then
if self.NBR_PLAYERNAME then
if self.NBR_PLAYERNAME then
return self.NBR_PLAYERNAME
return self.NBR_PLAYERNAME
else
else
local sZN = GetCurrentZoneName()
local sZN = GetCurrentZoneName()
if sZN then
if sZN then
self.NBR_PLAYERNAME = sZN
self.NBR_PLAYERNAME = sZN
return self.NBR_PLAYERNAME
return self.NBR_PLAYERNAME
else
else
return "YOURSELF"
return "YOURSELF"
end
end
end
end
else
else
local sZN = GetCurrentZoneName()
local sZN = GetCurrentZoneName()
if sZN then
if sZN then
sZN = string.match(GetCurrentZoneName(), "%b[]")
sZN = string.match(GetCurrentZoneName(), "%b[]")
if sZN then
if sZN then
sZN = sZN:sub(2,-2)
sZN = sZN:sub(2,-2)
return sZN
return sZN
end
end
end
end
end
end
return nil
return nil
end
end
function WillYouBeMyNeighbor:GetNextNeighbor()
function WillYouBeMyNeighbor:GetNextNeighbor()
local neighborList=self:GetSortedNeighbors()
local neighborList=self:GetSortedNeighbors()
if neighborList then
if neighborList then
self.currentNeighbor = 1
self.currentNeighbor = 1
if #neighborList > 1 then
if #neighborList > 1 then
local sZN = self:GetCurrentZoneName()
local sZN = self:GetCurrentZoneName()
if sZN then
if sZN then
local nRank = PlotRatings[sZN] or 0
local nRank = PlotRatings[sZN] or 0
nRank = 9-nRank
nRank = 9-nRank
local sortkey = string.format("%d-%s", nRank, sZN)
local sortkey = string.format("%d-%s", nRank, sZN)
NBR_NEIGHBORS.crnt = sortkey
NBR_NEIGHBORS.crnt = sortkey
for x=1, #neighborList do
for x=1, #neighborList do
if neighborList[x].sortKey > sortkey then
if neighborList[x].sortKey > sortkey then
NBR_NEIGHBORS.next = x
NBR_NEIGHBORS.next = x
NBR_NEIGHBORS.nk = neighborList[x].sortKey
NBR_NEIGHBORS.nk = neighborList[x].sortKey
self.currentNeighbor = x
self.currentNeighbor = x
break
break
end
end
end
end
end
end
end
end
end
end
return neighborList
return neighborList
end
end
function WillYouBeMyNeighbor:GetSortedNeighbors()
function WillYouBeMyNeighbor:GetSortedNeighbors()
--if HousingLib:IsHousingWorld() == true and HousingLib:IsWarplotResidence() == false then
--if HousingLib:IsHousingWorld() == true and HousingLib:IsWarplotResidence() == false then
local neighborList=HousingLib.GetNeighborList()
local neighborList=HousingLib.GetNeighborList()
local sZN = self:GetCurrentZoneName()
local sZN = self:GetCurrentZoneName()
self.CURRENTPLOTID = 0
self.CURRENTPLOTID = 0
self.IGNOREDPLOTS = {}
self.IGNOREDPLOTS = {}
nameIndex = {}
nameIndex = {}
if IgnoredPlots.ignore then
if IgnoredPlots.ignore then
for x=#neighborList, 1, -1 do
for x=#neighborList, 1, -1 do
if IgnoredPlots.ignore and IgnoredPlots.ignoreList[neighborList[x].strCharacterName] then
if IgnoredPlots.ignore and IgnoredPlots.ignoreList[neighborList[x].strCharacterName] then
table.remove(neighborList, x)
table.remove(neighborList, x)
end
end
end
end
end
end
local bMin = ResourceTypes.filter.mineral
local bMin = ResourceTypes.filter.mineral
local bRel = ResourceTypes.filter.relic
local bRel = ResourceTypes.filter.relic
local bThi = ResourceTypes.filter.thicket
local bThi = ResourceTypes.filter.thicket
for x=#neighborList, 1, -1 do
for x=#neighborList, 1, -1 do
local bRemove = true
local bRemove = true
if bMin == false and ResourceTypes.mineral[neighborList[x].strCharacterName] then
if bMin == false and ResourceTypes.mineral[neighborList[x].strCharacterName] then
bRemove = false
bRemove = false
end
end
if bRel == false and ResourceTypes.relic[neighborList[x].strCharacterName] then
if bRel == false and ResourceTypes.relic[neighborList[x].strCharacterName] then
bRemove = false
bRemove = false
end
end
if bThi == false and ResourceTypes.thicket[neighborList[x].strCharacterName] then
if bThi == false and ResourceTypes.thicket[neighborList[x].strCharacterName] then
bRemove = false
bRemove = false
end
end
--if sZN == neighborList[x].strCharacterName then
--if sZN == neighborList[x].strCharacterName then
-- bRemove = true
-- bRemove = true
--end
--end
if bRemove then
if bRemove then
self.IGNOREDPLOTS[neighborList[x].strCharacterName] = neighborList[x]
self.IGNOREDPLOTS[neighborList[x].strCharacterName] = neighborList[x]
table.remove(neighborList, x)
table.remove(neighborList, x)
else
else
local sName = neighborList[x].strCharacterName
local sName = neighborList[x].strCharacterName
local nRank = PlotRatings[sName] or 0
local nRank = PlotRatings[sName] or 0
nRank = 9-nRank
nRank = 9-nRank
neighborList[x].sortKey = string.format("%d-%s", nRank, sName)
neighborList[x].sortKey = string.format("%d-%s", nRank, sName)
end
end
end
end
if #neighborList > 1 then
if #neighborList > 1 then
table.sort(neighborList, function(a,b) return a.sortKey < b.sortKey end)
table.sort(neighborList, function(a,b) return a.sortKey < b.sortKey end)
NBR_NEIGHBORS.list = {}
NBR_NEIGHBORS.list = {}
for k,v in ipairs(neighborList) do
for k,v in ipairs(neighborList) do
nameIndex[v.strCharacterName] = k
nameIndex[v.strCharacterName] = k
if (v.strCharacterName == sZN) then
if (v.strCharacterName == sZN) then
self.CURRENTPLOTID = k
self.CURRENTPLOTID = k
end
end
table.insert(NBR_NEIGHBORS.list, {n=v.strCharacterName, k=v.sortKey})
table.insert(NBR_NEIGHBORS.list, {n=v.strCharacterName, k=v.sortKey})
end
end
elseif #neighborList == 1 then
elseif #neighborList == 1 then
nameIndex[neighborList[1].strCharacterName] = 1
nameIndex[neighborList[1].strCharacterName] = 1
end
end
if #neighborList == 0 then
if #neighborList == 0 then
self.wndMain:FindChild("WillYouBeMyNeighborName"):SetText("No Neighbors")
self.wndMain:FindChild("WillYouBeMyNeighborName"):SetText("No Neighbors")
self.wndMain:FindChild("WillYouBeMyNeighborName"):SetTextColor(kcrOffline)
self.wndMain:FindChild("WillYouBeMyNeighborName"):SetTextColor(kcrOffline)
self.wndMain:FindChild("WillYouBeMyNeighborShare"):SetText("No matching neighbors")
self.wndMain:FindChild("WillYouBeMyNeighborShare"):SetText("No matching neighbors")
self.wndMain:FindChild("WillYouBeMyNeighborNodeInfo"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborNodeInfo"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborHarvestInfo"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborHarvestInfo"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborRemaining"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborRemaining"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborActivity"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborActivity"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborLastVisit"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborLastVisit"):SetText("Unknown")
self.wndMain:FindChild("WillYouBeMyNeighborVersionFlag"):Show(false)
self.wndMain:FindChild("WillYouBeMyNeighborVersionFlag"):Show(false)
end
end
return neighborList
return neighborList
--else
--else
-- DEBUG("Getting sorted list outside of housing...")
-- DEBUG("Getting sorted list outside of housing...")
-- return nil
-- return nil
--end
--end
end
end
function WillYouBeMyNeighbor:OnHarvest(data)
function WillYouBeMyNeighbor:OnHarvest(data)
local name = GameLib.GetPlayerUnit():GetName()
local name = GameLib.GetPlayerUnit():GetName()
local onplot = self.wndMain:FindChild("WillYouBeMyNeighborCurrentName"):GetText()
local onplot = self.wndMain:FindChild("WillYouBeMyNeighborCurrentName"):GetText()
if RegisteredUsers[name] == nil then return end
if RegisteredUsers[name] == nil then return end
if type(RegisteredUsers[name]) ~= "table" then return end
if type(RegisteredUsers[name]) ~= "table" then return end
if RegisteredUsers[name].activity == nil then
if RegisteredUsers[name].activity == nil then
RegisteredUsers[name].activity = 0
RegisteredUsers[name].activity = 0
end
end
if RegisteredUsers[name].month ~= GameLib:GetServerTime().nMonth then
if RegisteredUsers[name].month ~= GameLib:GetServerTime().nMonth then
RegisteredUsers[name].month = GameLib:GetServerTime().nMonth
RegisteredUsers[name].month = GameLib:GetServerTime().nMonth
RegisteredUsers[name].activity = 0
RegisteredUsers[name].activity = 0
end
end
for _, val in pairs(data) do
for _, val in pairs(data) do
RegisteredUsers[name].activity = RegisteredUsers[name].activity + val.nCount
RegisteredUsers[name].activity = RegisteredUsers[name].activity + val.nCount
if val.item:GetItemCategory() == 104 then
if val.item:GetItemCategory() == 104 then
local t = {}
local t = {}
t.name = onplot
t.name = onplot
t.message = "PLANT PIRATE ALERT: " .. name .. " harvested " .. val.item:GetName() .. " from your plot"
t.message = "PLANT PIRATE ALERT: " .. name .. " harvested " .. val.item:GetName() .. " from your plot"
self.chanICCPP:SendMessage(t)
self.chanICCPP:SendMessage(t)
else
else
local t = {}
local t = {}
t.name = onplot
t.name = onplot
t.message = name .. " harvested " .. val.nCount .. " " .. val.item:GetName() .. " for you!"
t.message = name .. " harvested " .. val.nCount .. " " .. val.item:GetName() .. " for you!"
self.chanICCHN:SendMessage(t)
self.chanICCHN:SendMessage(t)
end
end
end
end
end
end
function WillYouBeMyNeighbor:OnInterfaceMenuListHasLoaded()
function WillYouBeMyNeighbor:OnInterfaceMenuListHasLoaded()
Event_FireGenericEvent("InterfaceMenuList_NewAddOn", "WillYouBeMyNeighbor", {"WillYouBeMyNeighborOn", "", "BK3:sprHolo_Friends_Account"})
Event_FireGenericEvent("InterfaceMenuList_NewAddOn", "WillYouBeMyNeighbor", {"WillYouBeMyNeighborOn", "", "BK3:sprHolo_Friends_Account"})
end
end
local msgs = {}
local msgs = {}
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborChannelMessage(channel, tMsg)
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborChannelMessage(channel, tMsg)
if tMsg and tMsg.nodetype then
if tMsg and tMsg.nodetype then
if tMsg.nodetype == "No Node" then
if tMsg.nodetype == "No Node" then
-- No node
-- No node
elseif nodeTypes[tMsg.nodetype] then
elseif nodeTypes[tMsg.nodetype] then
local sName = tMsg.name
local sName = tMsg.name
local sType = nodeTypes[tMsg.nodetype].k
local sType = nodeTypes[tMsg.nodetype].k
local nRank = nodeTypes[tMsg.nodetype].t
local nRank = nodeTypes[tMsg.nodetype].t
if ResourceTypes[sType][sName] then
if ResourceTypes[sType][sName] then
if ResourceTypes[sType][sName] ~= nRank then
if ResourceTypes[sType][sName] ~= nRank then
ResourceTypes[sType][sName] = nRank
ResourceTypes[sType][sName] = nRank
end
end
else
else
ResourceTypes[sType][sName] = nRank
ResourceTypes[sType][sName] = nRank
end
end
end
end
end
end
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or RegisteredUsers == nil then
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or RegisteredUsers == nil then
DEBUG("self.tQueuedUnits[1]")
DEBUG("self.tQueuedUnits[1]")
self.tQueuedUnits = {}
self.tQueuedUnits = {}
return
return
end
end
if GameLib.GetPlayerUnit():GetName() == tMsg.name then return end
if GameLib.GetPlayerUnit():GetName() == tMsg.name then return end
if RegisteredUsers[tMsg.name] ~= nil and type(RegisteredUsers[tMsg.name]) == "table" then
if RegisteredUsers[tMsg.name] ~= nil and type(RegisteredUsers[tMsg.name]) == "table" then
if RegisteredUsers[tMsg.name].share ~= nil and tMsg.share == nil then return end
if RegisteredUsers[tMsg.name].share ~= nil and tMsg.share == nil then return end
if RegisteredUsers[tMsg.name].nodetype ~= nil and tMsg.nodetype == nil then return end
if RegisteredUsers[tMsg.name].nodetype ~= nil and tMsg.nodetype == nil then return end
if RegisteredUsers[tMsg.name].faction ~= nil and tMsg.faction == nil then return end
if RegisteredUsers[tMsg.name].faction ~= nil and tMsg.faction == nil then return end
if RegisteredUsers[tMsg.name].remaining ~= nil and tMsg.remaining == nil then return end
if RegisteredUsers[tMsg.name].remaining ~= nil and tMsg.remaining == nil then return end
if RegisteredUsers[tMsg.name].timestamp ~= nil and tMsg.timestamp == nil then return end
if RegisteredUsers[tMsg.name].timestamp ~= nil and tMsg.timestamp == nil then return end
if RegisteredUsers[tMsg.name].month ~= nil and tMsg.month == nil then return end
if RegisteredUsers[tMsg.name].month ~= nil and tMsg.month == nil then return end
if RegisteredUsers[tMsg.name].activity ~= nil and tMsg.activity == nil then return end
if RegisteredUsers[tMsg.name].activity ~= nil and tMsg.activity == nil then return end
if RegisteredUsers[tMsg.name].version ~= nil and tMsg.version == nil then return end
if RegisteredUsers[tMsg.name].version ~= nil and tMsg.version == nil then return end
if RegisteredUsers[tMsg.name].version ~= nil and tMsg.senderversion ~= nil and RegisteredUsers[tMsg.name].version > tMsg.senderversion then return end
if RegisteredUsers[tMsg.name].version ~= nil and tMsg.senderversion ~= nil and RegisteredUsers[tMsg.name].version > tMsg.senderversion then return end
if tMsg.timestamp == nil or (RegisteredUsers[tMsg.name].timestamp ~= nil and RegisteredUsers[tMsg.name].timestamp > tMsg.timestamp) then return end
if tMsg.timestamp == nil or (RegisteredUsers[tMsg.name].timestamp ~= nil and RegisteredUsers[tMsg.name].timestamp > tMsg.timestamp) then return end
if type(RegisteredUsers[tMsg.name].share) == "table" then
if type(RegisteredUsers[tMsg.name].share) == "table" then
RegisteredUsers[tMsg.name] = nil
RegisteredUsers[tMsg.name] = nil
end
end
end
end
if tMsg.nodetype == nil then
if tMsg.nodetype == nil then
if type(RegisteredUsers[tMsg.name]) == "table" then
if type(RegisteredUsers[tMsg.name]) == "table" then
return
return
end
end
if type(tMsg.share) == "table" then return end
if type(tMsg.share) == "table" then return end
RegisteredUsers[tMsg.name] = tMsg.share
RegisteredUsers[tMsg.name] = tMsg.share
else
else
if tMsg.version ~= nil and tMsg.version > version then
if tMsg.version ~= nil and tMsg.version > version then
self.wndMain:FindChild("VersionUpdate"):Show(true)
self.wndMain:FindChild("VersionUpdate"):Show(true)
end
end
RegisteredUsers[tMsg.name] = tMsg
RegisteredUsers[tMsg.name] = tMsg
end
end
end
end
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborPPChannelMessage(channel, tMsg)
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborPPChannelMessage(channel, tMsg)
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or RegisteredUsers == nil then
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or RegisteredUsers == nil then
DEBUG("self.tQueuedUnits[2]")
DEBUG("self.tQueuedUnits[2]")
self.tQueuedUnits = {}
self.tQueuedUnits = {}
return
return
end
end
local name = GameLib.GetPlayerUnit():GetName()
local name = GameLib.GetPlayerUnit():GetName()
if PlantPiratesAlert == true and tMsg.name == name then
if PlantPiratesAlert == true and tMsg.name == name then
ChatSystemLib.PostOnChannel(2, tMsg.message)
ChatSystemLib.PostOnChannel(2, tMsg.message)
end
end
end
end
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborHarvestNotificationChannelMessage(channel, tMsg)
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborHarvestNotificationChannelMessage(channel, tMsg)
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or RegisteredUsers == nil then
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or RegisteredUsers == nil then
DEBUG("self.tQueuedUnits[3]")
DEBUG("self.tQueuedUnits[3]")
self.tQueuedUnits = {}
self.tQueuedUnits = {}
return
return
end
end
local name = GameLib.GetPlayerUnit():GetName()
local name = GameLib.GetPlayerUnit():GetName()
if HarvestNotifications == true and tMsg.name == name then
if HarvestNotifications == true and tMsg.name == name then
ChatSystemLib.PostOnChannel(8, tMsg.message)
ChatSystemLib.PostOnChannel(8, tMsg.message)
end
end
end
end
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborOnlineChannelMessage(channel, tMsg)
function WillYouBeMyNeighbor:OnDotMessageWillYouBeMyNeighborOnlineChannelMessage(channel, tMsg)
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
self.unitPlayerDisposition = GameLib.GetPlayerUnit()
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or OnlineUsers == nil then
if self.unitPlayerDisposition == nil or not self.unitPlayerDisposition:IsValid() or OnlineUsers == nil then
DEBUG("self.tQueuedUnits[4]")
DEBUG("self.tQueuedUnits[4]")
self.tQueuedUnits = {}
self.tQueuedUnits = {}
return
return
end
end
OnlineUsers[tMsg.name] = self.ServerTime()
OnlineUsers[tMsg.name] = self.ServerTime()
end
end
function WillYouBeMyNeighbor:VisitNeighbor(Name)
function WillYouBeMyNeighbor:VisitNeighbor(Name)
if HousingLib.IsHousingWorld() == false then
if HousingLib.IsHousingWorld() == false then
Cha
Cha