content
stringlengths 5
1.05M
|
|---|
function love.conf(t)
t.window.title = "Shaders 101"
end
|
local Plugin = script.Parent.Parent.Parent.Parent
local RoduxHooks = require(Plugin.Packages.RoduxHooks)
local Roact = require(Plugin.Packages.Roact)
local Hooks = require(Plugin.Packages.Hooks)
local Actions = require(Plugin.Actions)
local Checkbox = require(Plugin.Components.Checkbox)
local Layout = require(Plugin.Components.Layout)
local e = Roact.createElement
export type SyntaxHighlightingProps = {
order: number?,
}
local function SyntaxHighlighting(props: SyntaxHighlightingProps, hooks)
local dispatch = RoduxHooks.useDispatch(hooks)
local userSettings = RoduxHooks.useSelector(hooks, function(state)
return state.userSettings
end)
local value = userSettings.syntaxHighlighting
return e(Layout.Forms.Section, {
heading = "Syntax Highlighting",
hint = "Enable syntax highlighting in code snippets. Turn this off to increase performance.",
formItem = true,
order = props.order,
}, {
value = e(Checkbox, {
label = "Highlight Code Snippets",
order = 10,
value = value,
onChanged = function(value)
dispatch(Actions.SetSetting({
key = "syntaxHighlighting",
value = value,
}))
end,
}),
})
end
return Hooks.new(Roact)(SyntaxHighlighting)
|
lume = require "libs.lume"
oldprint = print
print = DEBUG and lume.trace or function () end
assert = lume.assert
Object = require "libs.classic"
tick = require "libs.tick"
coil = require "libs.coil"
-- My own :)
buddies = require "libs.buddies"
local libs = {}
function libs.update(dt)
tick.update(dt)
coil.update(dt)
end
return libs
|
local shell = {
list = {}
}
function shell:new(object)
object = object or {}
setmetatable(object, self)
self.__index = self
return object
end
function shell:sort(gap)
local list = self.list
while gap > 0 do
for i = gap + 1, #list, 1 do
local v = list[i]
local j = i
while j > gap and v < list[j - gap] do
list[j] = list[j - gap]
j = j - gap
end
list[j] = v
end
gap = math.floor(gap / 2)
end
end
return shell
|
local json
local fs = require('fs')
local joinPath = require('path').join
local readFileSync,scanDirSync = fs.readFileSync,fs.scandirSync
local Spyfall = {
name = "Spyfall",
Locations = {},
lobbies = {},
PlayerList = {},
lobbiesCreated = 0,
MaxRandomNumber = 1000,
RepeatChance = 200,
LocationCount = 0,
seeded = false
}
--[[
Player List Player Data Structure
int playerID ISKEY
str LobbyName
]]
--[[
Lobby Data Structure
str Name ISKEY
int LeaderID
tabl[players] Players
tabl[int] PlayerNames
int PlayerCount
int CurrentSpy
str CurrentLocation
str LastLocation
int LocationRepeatCount
int CurrentRound
bool Running
str LastSpy
cfg Config
timer Timer
TextChannel FeedBackChat
]]
--[[
Player Data Structure
str Name ISKEY
int ID
bool IsSpy
str CurrentProfession
int TimesRow
user UserObj
]]
--[[
Location Data Structure
str Name
table[str] Professions
]]
function generateRandomNumber(MaxNumber, Max) --Generates random numbers up to #Players
if not Spyfall.seeded then
math.randomseed(os.clock())
Spyfall.seeded = true
end
local rng = math.random(1,MaxNumber)
return math.ceil(rng/(MaxNumber/Max))
end
--[[Player-Lobby Interactions]]
function Spyfall:ReturnLocations(User)
local literal = ''
for _,l in ipairs(self.Locations) do
if literal then literal = literal .. "\n" .. l.name else literal = l.name end
end
User:send("```"..literal.."```")
return true, "Sent to user."
end
function Spyfall:AddLobby(lobbyname, leaderid, leaderName, leaderUser, chat)
local lobbyName = lobbyname or "Spyfall Lobby #" .. self.lobbiesCreated --If no lobby name is given we create it with a default name
if self.lobbies[lobbyname] then
return false, "Lobby with that name already exists"
end
self.lobbies[lobbyName] = {Name = lobbyName, LeaderID = leaderid, Players = {}, PlayerNames = {}, PlayerCount = 0 ,CurrentSpy = "None", CurrentLocation = "None", LastLocation = "None", LocationRepeatCount = 0,CurrentRound = 0,Running = false, Config = {Length = 12}, LastSpy = "None", Timer = nil, FeedBackChat = chat} -- Create Lobby Object
self:PlayerJoin(leaderid, leaderName, lobbyName, leaderUser) --Put the lobby creator inside the lobby
self.lobbiesCreated = self.lobbiesCreated + 1 -- Increase lobby count for default lobby name generation
return self:Feedback(self.lobbies[lobbyName], false, "Lobby \"" .. lobbyName .. "\" created.")
end
function Spyfall:PlayerJoin(playerID, name, lobbyName, userObj)
if not self.lobbies[lobbyName] then
return false, "Lobby does not exist"
end
if self.PlayerList[playerID] then -- Check if the player is already registered.
if self.PlayerList[playerID] == "None" then
self.PlayerList[playerID] = lobbyName --If the player was already registered but is currently in no lobby
else
return false, "Player already in a lobby named " .. self.PlayerList[playerID] .. " if you want to leave the lobby please use sf leave"
end
else -- Register the player and put him in the lobby
self.PlayerList[playerID] = lobbyName
end
self.lobbies[lobbyName].Players[name] = {Name = name, ID = playerID, IsSpy = false, CurrentProfession = "None", UserObj = userObj, TimesRow = 1} -- Create Player Object
table.insert(self.lobbies[lobbyName].PlayerNames, name) --Insert player into PlayerNumber table.
self.lobbies[lobbyName].PlayerCount = self.lobbies[lobbyName].PlayerCount + 1 --Increase player count
return true, "Joined lobby \"" .. lobbyName .. "\" as " .. name
end
function Spyfall:PlayerLeave(playerID, playerName)
if self.PlayerList[playerID] then --Check if this player is registered and which lobby he is in
if self.lobbies[self.PlayerList[playerID]] then --Check if he is indeed in that lobby
if self.lobbies[self.PlayerList[playerID]].Running then --Check if there is a round ongoing
return false, "Cannot leave lobby while a game is ongoing"
end
local lobby = self.lobbies[self.PlayerList[playerID]]
lobby.Players[playerName] = nil --Remove his player object from the Players
lobby.PlayerCount = lobby.PlayerCount - 1 --Reduce from player count
for k,v in ipairs(lobby.PlayerNames) do --Lua table.getn and # both don`t count KEYED elements, so we have to separately keep which playerNumber is which player.
if v == playerName then
table.remove(lobby.PlayerNames, k) --This removes their number from the possible numbers.
end
end
if playerID == lobby.LeaderID and lobby.PlayerCount > 0 then
lobby.LeaderID = lobby.Players[lobby.PlayerNames[1]].ID
self:Feedback(lobby, false, "Lobby leader for " .. lobby.Name .. " is now " .. lobby.Players[lobby.PlayerNames[1]].Name)
end
local oldLobby = lobby.Name --Store the lobby`s name as we are going to remove it next line
if lobby.PlayerCount <= 0 then
lobby = nil
print("Deleted lobby " .. oldLobby)
end
self.PlayerList[playerID] = "None" --Set Player`s lobby to default None
return true, "Removed player " .. playerName .. " from lobby \"" .. oldLobby .."\"." --Send a msg notifying the user.
end
end
return false, "Player is not in a lobby"
end
--Player-Lobby END
--[[
SELECTION METHODS
]]
function Spyfall:ClearSystem()
self.PlayerList = {}
self.lobbies = {}
self.lobbiesCreated = 0
return true, "Cleared lobbies."
end
function Spyfall:SelectSpy(lobby)
local selectedNumber = nil
local allowPass = false
local lastSpy = lobby.LastSpy
while not allowPass do --We loop until we get another spy or the spy is approved to repeat
selectedNumber = generateRandomNumber(self.MaxRandomNumber, lobby.PlayerCount)
selectedPlayerName = lobby.PlayerNames[selectedNumber]
selectedPlayer = lobby.Players[selectedPlayerName]
if selectedPlayer.Name == lastSpy then -- If the selected spy is a repeat we do a 2nd check to see if he is allowed to repeat
selectedPlayer.TimesRow = selectedPlayer.TimesRow + 1
math.randomseed(os.clock())
if (math.random(1,100) < (self.RepeatChance/selectedPlayer.TimesRow)) then --The spy only repeats if this is true, the higher the Repeat Chance is the more frequent Spies repeat.
allowPass = true
end
lastSpy = selectedPlayer.Name
else
if not lastSpy == "None" then
lobby.Players[lastSpy].timesRow = 1 -- We reset the times in a row counter if last spy is not selected.
end
allowPass = true
end
end
return selectedPlayer
end
function Spyfall:SelectLocation(lobby)
local loc = generateRandomNumber(self.MaxRandomNumber, self.LocationCount)
if self.Locations[loc].name == lobby.LastLocation then
if lobby.LocationRepeatCount >= 2 then
repeat
loc = generateRandomNumber(self.MaxRandomNumber, self.LocationCount)
until self.Locations[loc].name ~= lobby.LastLocation
lobby.LocationRepeatCount = 0
elseif lobby.LocationRepeatCount == 1 then
loc = generateRandomNumber(self.MaxRandomNumber, self.LocationCount)
if loc == lobby.LastLocation then
lobby.LocationRepeatCount = lobby.LocationRepeatCount + 1
end
else
lobby.LocationRepeatCount = lobby.LocationRepeatCount + 1
end
end
return loc
end
--SELECTION END
--[[
Lobby methods
]]
function Spyfall:Feedback(lobby, fail, description)
if fail then
lobby.FeedBackChat:send{embed = Response.embeds.spyfall.failFeedback(description)}
else
lobby.FeedBackChat:send{embed = Response.embeds.spyfall.successFeedback(description)}
end
return true,""
end
function Spyfall:TimeOutRound(lobby)
local Timer = coroutine.create(
function ()
Spyfall.Deps.Client:waitFor("WillNeverHappen", ( lobby.Config.Length* 60 * 1000))
Spyfall:LobbyEndRound(lobby)
end
)
return Timer
end
function Spyfall:StartLobby(playerID, playerName)
--Check if the player is in a lobby and if he is, if he is the leader.
local lobby = nil
if self.PlayerList[playerID] then
if self.PlayerList[playerID] ~= "None" then
lobby = self.lobbies[self.PlayerList[playerID]]
end
end
if not lobby then
return false, "Player not in lobby."
end
if lobby.LeaderID ~= playerID then
return self:Feedback(lobby, true, "Only the leader can start a game!.")
--return false, "Only the leader can start the game!"
end
-- Lobby is set, is it already running?
if lobby.Running then
return self:Feedback(lobby, true, "There is already an ongoing session!.")
--return false, "There is already an ongoing session!"
end
if lobby.PlayerCount <= 1 then
return self:Feedback(lobby, true, "Can not start a game with only 1 player.")
--return false, "Can`t start game with only 1 player"
end
if self.LocationCount <= 0 then
return self:Feedback(lobby, true, "There are no Locations configured, please contact the admin.")
--return false, "There are no Locations configured, please contact the admin"
end
--Game start logic
lobby.CurrentRound = lobby.CurrentRound + 1
lobby.Running = true
--Spy selection and notification
lobby.LastSpy = lobby.CurrentSpy
lobby.CurrentSpy = self:SelectSpy(lobby).Name
lobby.Players[lobby.CurrentSpy].IsSpy = true
lobby.Players[lobby.CurrentSpy].CurrentProfession = "Spy"
--Location selection
lobby.LastLocation = lobby.CurrentLocation
lobby.CurrentLocation = self:SelectLocation(lobby)
local possibleProfessions = {table.unpack(self.Locations[lobby.CurrentLocation].roles)} -- Copy possible professions
for player, obj in pairs(lobby.Players) do --Iterate players and assign them Professions and tell them the location.
if not(player == lobby.CurrentSpy) then
if not(#possibleProfessions > 0) then
possibleProfessions = {table.unpack(self.Locations[lobby.CurrentLocation].roles)} --Copy again if we run out
end
local n = generateRandomNumber(self.MaxRandomNumber, #possibleProfessions)
obj.CurrentProfession = possibleProfessions[n]
table.remove(possibleProfessions, n)
obj.UserObj:send("SPYFALL: Round " .. lobby.CurrentRound .. " starting.")
obj.UserObj:send("SPYFALL: You are NOT the spy, the location is " .. string.upper(self.Locations[lobby.CurrentLocation].name) .. " and your profession is " .. string.upper(obj.CurrentProfession)) -- notify the player
else
obj.UserObj:send("SPYFALL: Round " .. lobby.CurrentRound .. " starting.")
obj.UserObj:send("SPYFALL: You are the SPY. Good luck.")
end
end
--First questioner selection
local number = generateRandomNumber(self.MaxRandomNumber, lobby.PlayerCount)
local name = lobby.PlayerNames[number]
lobby.Timer = self:TimeOutRound(lobby)
coroutine.resume(lobby.Timer)
return self:Feedback(lobby, false, "The first person to ask a question is " .. name .. ".\nGame started and will end in " .. lobby.Config.Length .. " minutes.")
end
function Spyfall:LobbyEndRound(lobby)
lobby.Running = false
lobby.CurrentSpy = "None"
lobby.CurrentLocation = "None"
lobby.Timer = nil
for _,p in pairs(lobby.Players) do
p.CurrentProfession = "None"
p.isSpy = false
end
self:Feedback(lobby, false, "Game ended! Please Vote for who you think is the SPY and ask Leader to start next round when ready!")
return self:Feedback(lobby, false, "Round ended! waiting for next round!")
end
function Spyfall:EndRound(playerID)
--Check if the player is in a lobby and if he is, if he is the leader.
local lobby = nil
if self.PlayerList[playerID] then
if self.PlayerList[playerID] ~= "None" then
lobby = self.lobbies[self.PlayerList[playerID]]
end
end
if not lobby then
return false, "Player not in lobby."
end
if lobby.LeaderID ~= playerID then
return self:Feedback(lobby, true, "Only the leader can stop a round!")
end
if lobby.Running then
lobby.Running = false
lobby.CurrentSpy = "None"
lobby.CurrentLocation = "None"
coroutine.yield(lobby.Timer)
lobby.Timer = nil
for _,p in pairs(lobby.Players) do
p.CurrentProfession = "None"
p.isSpy = false
end
return self:Feedback(lobby, false, "Round end. Waiting to start another round!")
else
return self:Feedback(lobby, true, "No round is ongoing!")
end
end
--Lobby END
function Spyfall:__init()
--Read all Location JSON and register
json = self.Deps.Json
local files = {}
local path = "./games/spyfall/locations"
--Scan modules file in path
for k,v in scanDirSync(path) do
if not(k == "template.json") then
if k:find('.json',-5) then
table.insert(files,k)
end
end
end
for _,v in ipairs(files) do
local loc = json.decode(readFileSync(joinPath(path,v)))
if loc then
table.insert(self.Locations,loc)
self.LocationCount = self.LocationCount + 1
end
end
end
return Spyfall
|
-- A library to compute Gear Points for items as described in
-- http://code.google.com/p/epgp/wiki/GearPoints
local MAJOR_VERSION = "LibGearPoints-1.0"
local MINOR_VERSION = tonumber(("$Revision: 1023 $"):match("%d+")) or 0
local lib, oldMinor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
if not lib then return end
local Debug = LibStub("LibDebug-1.0")
-- This is the high price equipslot multiplier.
local EQUIPSLOT_MULTIPLIER_1 = {
INVTYPE_HEAD = 1,
INVTYPE_NECK = 0.5,
INVTYPE_SHOULDER = 0.75,
INVTYPE_CHEST = 1,
INVTYPE_ROBE = 1,
INVTYPE_WAIST = 0.75,
INVTYPE_LEGS = 1,
INVTYPE_FEET = 0.75,
INVTYPE_WRIST = 0.5,
INVTYPE_HAND = 0.75,
INVTYPE_FINGER = 0.5,
INVTYPE_TRINKET = 0.75,
INVTYPE_CLOAK = 0.5,
INVTYPE_WEAPON = 1.5,
INVTYPE_SHIELD = 1.5,
INVTYPE_2HWEAPON = 2,
INVTYPE_WEAPONMAINHAND = 1.5,
INVTYPE_WEAPONOFFHAND = 0.5,
INVTYPE_HOLDABLE = 0.5,
INVTYPE_RANGED = 1.5,
INVTYPE_RANGEDRIGHT = 1.5,
INVTYPE_THROWN = 0.5,
INVTYPE_RELIC = 0.5,
-- Hack for Tier 9 25M heroic tokens.
INVTYPE_CUSTOM_MULTISLOT_TIER = 1,
}
-- This is the low price equipslot multiplier (off hand weapons, non
-- tanking shields).
local EQUIPSLOT_MULTIPLIER_2 = {
INVTYPE_WEAPON = 0.5,
INVTYPE_SHIELD = 0.5,
INVTYPE_2HWEAPON = 1,
INVTYPE_RANGED = 0.5,
INVTYPE_RANGEDRIGHT = 0.5,
}
--Used to display GP values directly on tier tokens
local CUSTOM_ITEM_DATA = {
-- Tier 4
[29753] = { 4, 260, "INVTYPE_CHEST" },
[29754] = { 4, 260, "INVTYPE_CHEST" },
[29755] = { 4, 260, "INVTYPE_CHEST" },
[29756] = { 4, 260, "INVTYPE_HAND" },
[29757] = { 4, 260, "INVTYPE_HAND" },
[29758] = { 4, 260, "INVTYPE_HAND" },
[29759] = { 4, 260, "INVTYPE_HEAD" },
[29760] = { 4, 260, "INVTYPE_HEAD" },
[29761] = { 4, 260, "INVTYPE_HEAD" },
[29762] = { 4, 260, "INVTYPE_SHOULDER" },
[29763] = { 4, 260, "INVTYPE_SHOULDER" },
[29764] = { 4, 260, "INVTYPE_SHOULDER" },
[29765] = { 4, 260, "INVTYPE_LEGS" },
[29766] = { 4, 260, "INVTYPE_LEGS" },
[29767] = { 4, 260, "INVTYPE_LEGS" },
-- Tier 5
[30236] = { 4, 133, "INVTYPE_CHEST" },
[30237] = { 4, 133, "INVTYPE_CHEST" },
[30238] = { 4, 133, "INVTYPE_CHEST" },
[30239] = { 4, 133, "INVTYPE_HAND" },
[30240] = { 4, 133, "INVTYPE_HAND" },
[30241] = { 4, 133, "INVTYPE_HAND" },
[30242] = { 4, 133, "INVTYPE_HEAD" },
[30243] = { 4, 133, "INVTYPE_HEAD" },
[30244] = { 4, 133, "INVTYPE_HEAD" },
[30245] = { 4, 133, "INVTYPE_LEGS" },
[30246] = { 4, 133, "INVTYPE_LEGS" },
[30247] = { 4, 133, "INVTYPE_LEGS" },
[30248] = { 4, 133, "INVTYPE_SHOULDER" },
[30249] = { 4, 133, "INVTYPE_SHOULDER" },
[30250] = { 4, 133, "INVTYPE_SHOULDER" },
-- Tier 5 - BoE recipes - BoP crafts
[30282] = { 4, 128, "INVTYPE_BOOTS" },
[30283] = { 4, 128, "INVTYPE_BOOTS" },
[30305] = { 4, 128, "INVTYPE_BOOTS" },
[30306] = { 4, 128, "INVTYPE_BOOTS" },
[30307] = { 4, 128, "INVTYPE_BOOTS" },
[30308] = { 4, 128, "INVTYPE_BOOTS" },
[30323] = { 4, 128, "INVTYPE_BOOTS" },
[30324] = { 4, 128, "INVTYPE_BOOTS" },
-- Tier 6
[31089] = { 4, 146, "INVTYPE_CHEST" },
[31090] = { 4, 146, "INVTYPE_CHEST" },
[31091] = { 4, 146, "INVTYPE_CHEST" },
[31092] = { 4, 146, "INVTYPE_HAND" },
[31093] = { 4, 146, "INVTYPE_HAND" },
[31094] = { 4, 146, "INVTYPE_HAND" },
[31095] = { 4, 146, "INVTYPE_HEAD" },
[31096] = { 4, 146, "INVTYPE_HEAD" },
[31097] = { 4, 146, "INVTYPE_HEAD" },
[31098] = { 4, 146, "INVTYPE_LEGS" },
[31099] = { 4, 146, "INVTYPE_LEGS" },
[31100] = { 4, 146, "INVTYPE_LEGS" },
[31101] = { 4, 146, "INVTYPE_SHOULDER" },
[31102] = { 4, 146, "INVTYPE_SHOULDER" },
[31103] = { 4, 146, "INVTYPE_SHOULDER" },
[34848] = { 4, 154, "INVTYPE_WRIST" },
[34851] = { 4, 154, "INVTYPE_WRIST" },
[34852] = { 4, 154, "INVTYPE_WRIST" },
[34853] = { 4, 154, "INVTYPE_WAIST" },
[34854] = { 4, 154, "INVTYPE_WAIST" },
[34855] = { 4, 154, "INVTYPE_WAIST" },
[34856] = { 4, 154, "INVTYPE_FEET" },
[34857] = { 4, 154, "INVTYPE_FEET" },
[34858] = { 4, 154, "INVTYPE_FEET" },
-- Tier 6 - BoE recipes - BoP crafts
[32737] = { 4, 141, "INVTYPE_SHOULDER" },
[32739] = { 4, 141, "INVTYPE_SHOULDER" },
[32745] = { 4, 141, "INVTYPE_SHOULDER" },
[32747] = { 4, 141, "INVTYPE_SHOULDER" },
[32749] = { 4, 141, "INVTYPE_SHOULDER" },
[32751] = { 4, 141, "INVTYPE_SHOULDER" },
[32753] = { 4, 141, "INVTYPE_SHOULDER" },
[32755] = { 4, 141, "INVTYPE_SHOULDER" },
-- Magtheridon's Head
[32385] = { 4, 125, "INVTYPE_FINGER" },
[32386] = { 4, 125, "INVTYPE_FINGER" },
-- Kael'thas' Sphere
[32405] = { 4, 138, "INVTYPE_NECK" },
-- T7
[40610] = { 4, 200, "INVTYPE_CHEST" },
[40611] = { 4, 200, "INVTYPE_CHEST" },
[40612] = { 4, 200, "INVTYPE_CHEST" },
[40613] = { 4, 200, "INVTYPE_HAND" },
[40614] = { 4, 200, "INVTYPE_HAND" },
[40615] = { 4, 200, "INVTYPE_HAND" },
[40616] = { 4, 200, "INVTYPE_HEAD" },
[40617] = { 4, 200, "INVTYPE_HEAD" },
[40618] = { 4, 200, "INVTYPE_HEAD" },
[40619] = { 4, 200, "INVTYPE_LEGS" },
[40620] = { 4, 200, "INVTYPE_LEGS" },
[40621] = { 4, 200, "INVTYPE_LEGS" },
[40622] = { 4, 200, "INVTYPE_SHOULDER" },
[40623] = { 4, 200, "INVTYPE_SHOULDER" },
[40624] = { 4, 200, "INVTYPE_SHOULDER" },
-- T7 (heroic)
[40625] = { 4, 213, "INVTYPE_CHEST" },
[40626] = { 4, 213, "INVTYPE_CHEST" },
[40627] = { 4, 213, "INVTYPE_CHEST" },
[40628] = { 4, 213, "INVTYPE_HAND" },
[40629] = { 4, 213, "INVTYPE_HAND" },
[40630] = { 4, 213, "INVTYPE_HAND" },
[40631] = { 4, 213, "INVTYPE_HEAD" },
[40632] = { 4, 213, "INVTYPE_HEAD" },
[40633] = { 4, 213, "INVTYPE_HEAD" },
[40634] = { 4, 213, "INVTYPE_LEGS" },
[40635] = { 4, 213, "INVTYPE_LEGS" },
[40636] = { 4, 213, "INVTYPE_LEGS" },
[40637] = { 4, 213, "INVTYPE_SHOULDER" },
[40638] = { 4, 213, "INVTYPE_SHOULDER" },
[40639] = { 4, 213, "INVTYPE_SHOULDER" },
-- Key to the Focusing Iris
[44569] = { 4, 213, "INVTYPE_NECK" },
[44577] = { 4, 226, "INVTYPE_NECK" },
-- T8
[45635] = { 4, 219, "INVTYPE_CHEST" },
[45636] = { 4, 219, "INVTYPE_CHEST" },
[45637] = { 4, 219, "INVTYPE_CHEST" },
[45647] = { 4, 219, "INVTYPE_HEAD" },
[45648] = { 4, 219, "INVTYPE_HEAD" },
[45649] = { 4, 219, "INVTYPE_HEAD" },
[45644] = { 4, 219, "INVTYPE_HAND" },
[45645] = { 4, 219, "INVTYPE_HAND" },
[45646] = { 4, 219, "INVTYPE_HAND" },
[45650] = { 4, 219, "INVTYPE_LEGS" },
[45651] = { 4, 219, "INVTYPE_LEGS" },
[45652] = { 4, 219, "INVTYPE_LEGS" },
[45659] = { 4, 219, "INVTYPE_SHOULDER" },
[45660] = { 4, 219, "INVTYPE_SHOULDER" },
[45661] = { 4, 219, "INVTYPE_SHOULDER" },
-- T8 (heroic)
[45632] = { 4, 226, "INVTYPE_CHEST" },
[45633] = { 4, 226, "INVTYPE_CHEST" },
[45634] = { 4, 226, "INVTYPE_CHEST" },
[45638] = { 4, 226, "INVTYPE_HEAD" },
[45639] = { 4, 226, "INVTYPE_HEAD" },
[45640] = { 4, 226, "INVTYPE_HEAD" },
[45641] = { 4, 226, "INVTYPE_HAND" },
[45642] = { 4, 226, "INVTYPE_HAND" },
[45643] = { 4, 226, "INVTYPE_HAND" },
[45653] = { 4, 226, "INVTYPE_LEGS" },
[45654] = { 4, 226, "INVTYPE_LEGS" },
[45655] = { 4, 226, "INVTYPE_LEGS" },
[45656] = { 4, 226, "INVTYPE_SHOULDER" },
[45657] = { 4, 226, "INVTYPE_SHOULDER" },
[45658] = { 4, 226, "INVTYPE_SHOULDER" },
-- Reply Code Alpha
[46052] = { 4, 226, "INVTYPE_RING" },
[46053] = { 4, 239, "INVTYPE_RING" },
-- T9.245 (10M heroic/25M)
[47242] = { 4, 255, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
-- T9.258 (25M heroic)
[47557] = { 4, 258, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[47558] = { 4, 258, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[47559] = { 4, 258, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
-- T10.264 (10M heroic/25M)
[52025] = { 4, 260, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[52026] = { 4, 260, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[52027] = { 4, 260, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
-- T10.279 (25M heroic)
[52028] = { 4, 260, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[52029] = { 4, 260, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[52030] = { 4, 260, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
[280005] = { 4, 275, "INVTYPE_CUSTOM_MULTISLOT_TIER" },
}
-- The default quality threshold:
-- 0 - Poor
-- 1 - Uncommon
-- 2 - Common
-- 3 - Rare
-- 4 - Epic
-- 5 - Legendary
-- 6 - Artifact
local quality_threshold = 4
local recent_items_queue = {}
local recent_items_map = {}
local function UpdateRecentLoot(itemLink)
if recent_items_map[itemLink] then return end
Debug("Adding %s to recent items", itemLink)
table.insert(recent_items_queue, 1, itemLink)
recent_items_map[itemLink] = true
if #recent_items_queue > 15 then
local itemLink = table.remove(recent_items_queue)
Debug("Removing %s from recent items", itemLink)
recent_items_map[itemLink] = nil
end
end
function lib:GetNumRecentItems()
return #recent_items_queue
end
function lib:GetRecentItemLink(i)
return recent_items_queue[i]
end
--- Return the currently set quality threshold.
function lib:GetQualityThreshold()
return quality_threshold
end
--- Set the minimum quality threshold.
-- @param itemQuality Lowest allowed item quality.
function lib:SetQualityThreshold(itemQuality)
itemQuality = itemQuality and tonumber(itemQuality)
if not itemQuality or itemQuality > 6 or itemQuality < 0 then
return error("Usage: SetQualityThreshold(itemQuality): 'itemQuality' - number [0,6].", 3)
end
quality_threshold = itemQuality
end
function lib:GetValue(item)
if not item then return end
local _, itemLink, rarity, level, _, _, _, _, equipLoc = GetItemInfo(item)
if not itemLink then return end
-- Get the item ID to check against known token IDs
local itemID = itemLink:match("item:(%d+)")
if not itemID then return end
itemID = tonumber(itemID)
-- Check to see if there is custom data for this item ID
if CUSTOM_ITEM_DATA[itemID] then
rarity, level, equipLoc = unpack(CUSTOM_ITEM_DATA[itemID])
end
-- Is the item above our minimum threshold?
if not rarity or rarity < quality_threshold then
return nil, nil, level, rarity, equipLoc
end
UpdateRecentLoot(itemLink)
local slot_multiplier1 = EQUIPSLOT_MULTIPLIER_1[equipLoc]
local slot_multiplier2 = EQUIPSLOT_MULTIPLIER_2[equipLoc]
if not slot_multiplier1 then
return nil, nil, level, rarity, equipLoc
end
--local gp_base = 0.483 * 2 ^ (level/26 + (rarity - 4))
local gp_base = 0.483 * 2 ^ (level/26 + (rarity - 4))
local high = math.floor(gp_base * slot_multiplier1)
local low = slot_multiplier2 and math.floor(gp_base * slot_multiplier2) or nil
return high, low, level, rarity, equipLoc
end
|
-----------------------------------
--
-- Zone: Northern_San_dOria (231)
--
-----------------------------------
local ID = require("scripts/zones/Northern_San_dOria/IDs")
require("scripts/globals/events/harvest_festivals")
require("scripts/globals/conquest")
require("scripts/globals/missions")
require("scripts/globals/npc_util")
require("scripts/globals/settings")
require("scripts/globals/quests")
require("scripts/globals/titles")
require("scripts/globals/zone")
-----------------------------------
function onInitialize(zone)
SetExplorerMoogles(ID.npc.EXPLORER_MOOGLE)
zone:registerRegion(1, -7,-3,110, 7,-1,155)
applyHalloweenNpcCostumes(zone:getID())
end
function onZoneIn(player,prevZone)
local currentMission = player:getCurrentMission(SANDORIA)
local MissionStatus = player:getCharVar("MissionStatus")
local cs = -1
-- SOA 1-1 Optional CS
if
ENABLE_SOA and
player:getCurrentMission(SOA) == tpz.mission.id.soa.RUMORS_FROM_THE_WEST and
player:getCharVar("SOA_1_CS1") == 0
then
cs = 878
end
-- FIRST LOGIN (START CS)
if (player:getPlaytime(false) == 0) then
if (OPENING_CUTSCENE_ENABLE == 1) then
cs = 535
end
player:setPos(0,0,-11,191)
player:setHomePoint()
end
-- MOG HOUSE EXIT
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(130,-0.2,-3,160)
if (player:getMainJob() ~= player:getCharVar("PlayerMainJob")) then
cs = 30004
end
player:setCharVar("PlayerMainJob",0)
end
-- RDM AF3 CS
if (player:getCharVar("peaceForTheSpiritCS") == 5 and player:getFreeSlotsCount() >= 1) then
cs = 49
elseif (player:getCurrentMission(COP) == tpz.mission.id.cop.THE_ROAD_FORKS and player:getCharVar("EMERALD_WATERS_Status") == 1) then --EMERALD_WATERS-- COP 3-3A: San d'Oria Route
player:setCharVar("EMERALD_WATERS_Status",2)
cs = 14
elseif (currentMission == tpz.mission.id.sandoria.THE_HEIR_TO_THE_LIGHT and MissionStatus == 0) then
cs = 1
elseif (currentMission == tpz.mission.id.sandoria.THE_HEIR_TO_THE_LIGHT and MissionStatus == 4) then
cs = 0
elseif (player:hasCompletedMission(SANDORIA,tpz.mission.id.sandoria.COMING_OF_AGE) and tonumber(os.date("%j")) == player:getCharVar("Wait1DayM8-1_date")) then
cs = 16
end
return cs
end
function onConquestUpdate(zone, updatetype)
tpz.conq.onConquestUpdate(zone, updatetype)
end
function onRegionEnter(player,region)
switch (region:GetRegionID()): caseof
{
[1] = function (x) -- Chateau d'Oraguille access
pNation = player:getNation()
currentMission = player:getCurrentMission(pNation)
if ((pNation == 0 and player:getRank() >= 2) or (pNation > 0 and player:hasCompletedMission(pNation,5) == 1) or (currentMission >= 5 and currentMission <= 9) or (player:getRank() >= 3)) then
player:startEvent(569)
else
player:startEvent(568)
end
end,
}
end
function onRegionLeave(player,region)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
if (csid == 535) then
player:messageSpecial(ID.text.ITEM_OBTAINED,536) -- adventurer coupon
elseif (csid == 1) then
player:setCharVar("MissionStatus",1)
elseif (csid == 0) then
player:setCharVar("MissionStatus",5)
elseif (csid == 30004 and option == 0) then
player:setHomePoint()
player:messageSpecial(ID.text.HOMEPOINT_SET)
elseif (csid == 569) then
player:setPos(0,0,-13,192,233)
elseif (csid == 49 and npcUtil.completeQuest(player, SANDORIA, tpz.quest.id.sandoria.PEACE_FOR_THE_SPIRIT, {item = 12513, fame = 60, title = tpz.title.PARAGON_OF_RED_MAGE_EXCELLENCE})) then
player:setCharVar("peaceForTheSpiritCS",0)
elseif (csid == 16) then
player:setCharVar("Wait1DayM8-1_date",0)
player:setCharVar("Mission8-1Completed",1)
elseif csid == 878 then
player:setCharVar("SOA_1_CS1", 1)
end
end
|
local lib = _3DreamEngine
local function removePostfix(t)
local v = t:match("(.*)%.[^.]+")
return v or t
end
local convertOldLight = function(x, y, z, r, g, b, brightness)
return vec3(x or 0, y or 0, z or 0), vec3(r or 1, g or 1, b or 1), brightness or 1
end
function lib:newLight(typ, pos, color, brightness, old, ...)
--backwards compatibility
if old then
pos, color, brightness = convertOldLight(pos, color, brightness, old, ...)
end
local l = {
typ = typ or "point",
name = "unnamed",
pos = pos or vec3(0, 0, 0),
size = 0.025,
color = color and color:normalize() or vec3(1, 1, 1),
direction = vec3(0, -1, 0),
smooth = nil,
brightness = brightness or 1.0,
godray = nil,
godrayLength = typ == "sun" and 0.15 or 0.05,
godraySize = typ == "sun" and 0.1 or 0.035,
}
return setmetatable(l, self.meta.light)
end
return {
link = {"light", "clone"},
setterGetter = {
name = "string",
size = "number",
godrayLength = "number",
godraySize = "number",
},
setName = function(self, name)
self.name = removePostfix(name)
end,
setGodrays = function(self, e)
self.godrays = e
end,
getGodrays = function(self)
return self.godrays
end,
setBrightness = function(self, brightness)
self.brightness = brightness
end,
getBrightness = function(self)
return self.brightness
end,
setColor = function(self, r, g, b)
self.color = vec3(r, g, b):normalize()
end,
getColor = function(self)
return self.color
end,
setPosition = function(self, x, y, z)
self.pos = vec3(x, y, z)
end,
getPosition = function(self)
return self.pos
end,
setDirection = function(self, x, y, z)
self.direction = vec3(x, y, z):normalize()
end,
getDirection = function(self)
return self.direction
end,
addShadow = function(self, static, res)
if type(static) == "table" then
assert(static.typ, "Provides shadow object does not seem to be a shadow.")
self.shadow = static
self.shadow:refresh()
else
self.shadow = lib:newShadow(self.typ, static or false, res)
end
end,
setSmoothing = function(self, smooth)
assert(type(smooth) == "boolean", "boolean expected!")
self.smooth = smooth
end,
getSmoothing = function(self)
return self.smooth
end,
setShadow = function(self, shadow)
self.shadow = shadow
end,
getShadow = function(self)
return self.shadow
end,
}
|
local GameTooltipHyperLink_obj = GameTooltipHyperLink;
local SetHyperLink_orig=GameTooltipHyperLink_obj["SetHyperLink"];
function GameTooltipHyperLink:SetHyperLink(link)
if (string.sub(self:GetName(), 1,11) == "GameTooltip") then
for _,side in pairs({ "Left", "Right" }) do local j = 1; while true do local line = _G["GameTooltipText" .. side .. tostring(j)]; if not line then break end; line:SetText(""); j = j + 1; end; end;
for _,side in pairs({ "Left", "Right" }) do local j = 1; while true do local line = _G["GameTooltip1Text" .. side .. tostring(j)]; if not line then break end; line:SetText(""); j = j + 1; end; end;
for _,side in pairs({ "Left", "Right" }) do local j = 1; while true do local line = _G["GameTooltip2Text" .. side .. tostring(j)]; if not line then break end; line:SetText(""); j = j + 1; end; end;
for _,side in pairs({ "Left", "Right" }) do local j = 1; while true do local line = _G["GameTooltipHyperLinkText" .. side .. tostring(j)]; if not line then break end; line:SetText(""); j = j + 1; end; end;
end;
SetHyperLink_orig(GameTooltipHyperLink_obj, link);
StatRating_ProcessTooltip(self, link, 'player');
end;
|
E2Helper.Descriptions["createPortalPair(vava)"] = "Creates a link pair of portals and returns them in an entity array.\nIf one of the portals are deleted, its counterpart is also deleted."
E2Helper.Descriptions["createPortal(va)"] = "Creates and returns an unlinked portal."
E2Helper.Descriptions["getPortalExit(e:)"] = "Returns the exit portal entity that this portal is paired with."
E2Helper.Descriptions["getPortalSize(e:)"] = "Returns the size of the portal as a vector2. Returns [0,0] on fail."
E2Helper.Descriptions["getPortalExitSize(e:)"] = E2Helper.Descriptions["getPortalSize(e:)"]
E2Helper.Descriptions["setPortalSize(e:xv2)"] = "Sets the size of the portal, clamped between 0.01 and 10.\nReturns 0 on fail, 1 on success."
E2Helper.Descriptions["setPortalSize(e:nn)"] = E2Helper.Descriptions["setPortalSize(e:xv2)"]
E2Helper.Descriptions["setPortalSize(e:n)"] = E2Helper.Descriptions["setPortalSize(e:xv2)"]
E2Helper.Descriptions["setPortalExitSize(e:xv2)"] = "Sets the size of the portal this is paired with.\nReturns 0 on fail, 1 on success."
E2Helper.Descriptions["setPortalExitSize(e:nn)"] = E2Helper.Descriptions["setPortalExitSize(e:xv2)"]
E2Helper.Descriptions["setPortalExitSize(e:n)"] = E2Helper.Descriptions["setPortalExitSize(e:xv2)"]
E2Helper.Descriptions["setPortalSides(e:n)"] = "Sets the portal sides to the given number clamped between 3 to 100.\nReturns 0 on fail, 1 on success."
E2Helper.Descriptions["setPortalExitSides(e:n)"] = E2Helper.Descriptions["setPortalSides(e:n)"]
E2Helper.Descriptions["linkPortal(e:e)"] = "Links the given portal to another portal.\nReturns 0 on fail, 1 on success."
E2Helper.Descriptions["unlinkPortal(e:)"] = "Unlinks the given portal from its exit portal.\nReturns 0 on fail, 1 on success."
E2Helper.Descriptions["removePortal(e:)"] = "Removes a portal.\nReturns 0 on fail, 1 on success."
|
wait(1)
local hue = 0
local increment = 0.04
local rainbow = script.Parent
local ob = script.Parent.Parent
while true do
wait(3)
if rainbow.Value then
repeat
hue = hue + increment
if hue > 1 then
hue = 0
end
ob.TextColor3 = Color3.fromHSV(hue, 0.35, 1)
wait()
until rainbow.Value == false
end
end
|
return {
name="poker", type="empty", x=0, y=0,
{name="back", type="sprite", x=0, y=0, width=142, height=185, image="image/poker/back_big.png"},
{name="face", type="sprite", x=0, y=0, width=142, height=185, image="image/poker/face_big.png",
{name="joker", type="sprite", x=0, y=0, width=142, height=185, image="image/poker/joker_big.png"},
{name="color", type="sprite", x=0, y=0, width=32, height=32, image="image/poker/ht.png"},
{name="num", type="sprite", x=0, y=0, width=58, height=58, image="image/poker/1.png"}
},
}
|
insulate("Comms", function()
require "init"
require "spec.mocks"
require "spec.asserts"
local station = SpaceStation()
local player = PlayerSpaceship()
describe(":newReply()", function()
it("can create a reply", function()
local reply = Comms:newReply("Foobar", function() end)
assert.is_true(Comms:isReply(reply))
assert.is_same("Foobar", reply:getWhatPlayerSays(station, player))
end)
it("can create a reply with function for name instead of string", function()
local name = function() return "Foobar" end
local reply = Comms:newReply(name, function() end)
assert.is_true(Comms:isReply(reply))
assert.is_same("Foobar", reply:getWhatPlayerSays(station, player))
end)
it("can create a reply with comms screen as return", function()
local screen = Comms:newScreen("Hello World")
local reply = Comms:newReply("Foobar", screen)
assert.is_true(Comms:isReply(reply))
assert.is_same(screen, reply:getNextScreen(station, player))
end)
it("can create a reply condition check", function()
local condition = function() return true end
local reply = Comms:newReply("Foobar", nil, condition)
assert.is_true(Comms:isReply(reply))
assert.is_true(reply:checkCondition(station, player))
end)
it("fails if first argument is a number", function()
assert.has_error(function() Comms:newReply(42, function() end) end)
end)
it("fails if second argument is a number", function()
assert.has_error(function() Comms:newReply("Foobar", 42) end)
end)
it("fails if third argument is a number", function()
assert.has_error(function() Comms:newReply("Foobar", nil, 42) end)
end)
end)
describe(":newScreen()", function()
it("can create a comms screen that it validates", function()
local screen = Comms:newScreen("Hello World", {
Comms:newReply("One", function() end),
Comms:newReply("Two", function () end),
})
assert.is_true(Comms:isScreen(screen))
assert.is_same(2, Util.size(screen:getHowPlayerCanReact(station, player)))
end)
it("allows to add replies", function()
local screen = Comms:newScreen("Hello World")
:addReply(Comms:newReply("One", function() end))
:addReply(Comms:newReply("Two", function() end))
assert.is_true(Comms:isScreen(screen))
assert.is_same(2, Util.size(screen:getHowPlayerCanReact(station, player)))
end)
end)
end)
|
-- AFK Detector script
-- Made by Dr.CrazY
function outputMessage(text)
outputChatBox("#FF0000*#FFFFFF "..text, getRootElement(), 255, 255, 255, true)
end
function onKickedHandler (maxafk)
outputMessage("Player "..getPlayerName(source).."#FFFFFF has been kicked for being AFK #939EAB["..maxafk.."/"..maxafk.."]")
kickPlayer ( source, "AFK Detector", "Reason: being AFK too much" )
end
addEvent( "onKickedForAFK", true )
addEventHandler( "onKickedForAFK", getRootElement(), onKickedHandler )
function onKilledHandler ( countafk, maxafk )
outputMessage("Player "..getPlayerName(source).."#FFFFFF has been killed for being AFK #939EAB["..countafk.."/"..maxafk.."]")
end
addEvent( "onKilledForAFK", true )
addEventHandler( "onKilledForAFK", getRootElement(), onKilledHandler )
-- AUTO-KILL ( /afk )
local autoKillsCounting = false
local countingTimer = nil
local autoKilledPlayers = {}
function updateList(playerName)
table.insert(autoKilledPlayers, playerName)
end
function startCounting()
countingTimer = setTimer(stopCounting, 2000, 1)
autoKillsCounting = true
end
function stopCounting()
killTimer(countingTimer)
countingTimer = nil
autoKillsCounting = false
if(#autoKilledPlayers == 1)then
outputMessage("Player "..autoKilledPlayers[1].."#FFFFFF has been auto-killed for being AFK")
else
local i = 1
local lstr = ""
while(i < #autoKilledPlayers)do
lstr = lstr..autoKilledPlayers[i].."#FFFFFF, "
i = i + 1
end
lstr = lstr..autoKilledPlayers[#autoKilledPlayers].."#FFFFFF"
outputMessage("Players "..lstr.." has been auto-killed for being AFK")
end
autoKilledPlayers = {}
end
function onAutoKilledHandler()
updateList(getPlayerName(source))
if(not autoKillsCounting)then
startCounting()
end
end
addEvent( "onAutoKilled", true )
addEventHandler( "onAutoKilled", getRootElement(), onAutoKilledHandler )
function playerChat(message, messageType)
if(string.find(message, "afk") ~= nil or string.find(message, "Afk") ~= nil or string.find(message, "AFK") ~= nil)then
triggerClientEvent ( source, "onTipTriggered", source )
end
end
addEventHandler("onPlayerChat", root, playerChat)
|
vengefulspirit_command_aura_lua = class({})
LinkLuaModifier( "modifier_vengefulspirit_command_aura_lua", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_vengefulspirit_command_aura_effect_lua", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
function vengefulspirit_command_aura_lua:GetIntrinsicModifierName()
return "modifier_vengefulspirit_command_aura_lua"
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
|
local notify = require "nvim-lsp-installer.notify"
local dispatcher = require "nvim-lsp-installer.dispatcher"
local status_win = require "nvim-lsp-installer.ui.status-win"
local servers = require "nvim-lsp-installer.servers"
local M = {}
function M.display()
status_win().open()
end
function M.install(server_name)
local ok, server = servers.get_server(server_name)
if not ok then
return notify(("Unable to find LSP server %s.\n\n%s"):format(server_name, server), vim.log.levels.ERROR)
end
status_win().install_server(server)
status_win().open()
end
function M.uninstall(server_name)
local ok, server = servers.get_server(server_name)
if not ok then
return notify(("Unable to find LSP server %s.\n\n%s"):format(server_name, server), vim.log.levels.ERROR)
end
status_win().uninstall_server(server)
status_win().open()
end
function M.uninstall_all()
local installed_servers = servers.get_installed_servers()
if #installed_servers > 0 then
local function uninstall(idx)
status_win().uninstall_server(installed_servers[idx])
if installed_servers[idx + 1] then
vim.schedule(function()
uninstall(idx + 1)
end)
end
end
uninstall(1)
end
end
function M.on_server_ready(cb)
dispatcher.register_server_ready_callback(cb)
vim.schedule(function()
local installed_servers = servers.get_installed_servers()
for i = 1, #installed_servers do
dispatcher.dispatch_server_ready(installed_servers[i])
end
end)
end
-- "Proxy" function for triggering attachment of LSP servers to all buffers (useful when just installed a new server
-- that wasn't installed at launch)
local queued = false
function M.lsp_attach_proxy()
if queued then
return
end
queued = true
vim.schedule(function()
-- As of writing, if the lspconfig server provides a filetypes setting, it uses FileType as trigger, otherwise it uses BufReadPost
vim.cmd [[ doautoall FileType | doautoall BufReadPost ]]
queued = false
end)
end
-- old API
M.get_server = servers.get_server
M.get_available_servers = servers.get_available_servers
M.get_installed_servers = servers.get_installed_servers
M.get_uninstalled_servers = servers.get_uninstalled_servers
M.register = servers.register
return M
|
local wibox = require('wibox')
local gears = require('gears')
local clickable_container = require('widget.clickable-container')
local dpi = require('beautiful').xresources.apply_dpi
local icons = require('themes.icons')
--- Widget for dracula icon used in all title bars
-- Icon widget
local widget_icon = wibox.widget {
layout = wibox.layout.align.vertical,
expand = 'none',
nil,
{
id = 'icon',
image = icons.dracula,
resize = true,
widget = wibox.widget.imagebox
},
nil
}
-- Icon widget container
local widget = wibox.widget {
{
{
{
widget_icon,
layout = wibox.layout.fixed.horizontal,
},
margins = dpi(0),
widget = wibox.container.margin
},
forced_height = dpi(50),
widget = clickable_container
},
shape = gears.shape.circle,
bg = 'transparent',
widget = wibox.container.background
}
return widget
|
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
module("luci.statistics.rrdtool.definitions.tcpconns", package.seeall)
function item()
return luci.i18n.translate("TCP Connections")
end
function rrdargs( graph, plugin, plugin_instance, dtype )
return {
title = "%H: TCP connections to port %pi",
vlabel = "Connections/s",
number_format = "%5.0lf",
data = {
types = { "tcp_connections" },
instances = {
tcp_connections = {
"SYN_SENT", "SYN_RECV", "LISTEN", "ESTABLISHED",
"LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT",
"CLOSED", "FIN_WAIT1", "FIN_WAIT2"
},
options = {
load__ESTABLISHED = { title = "%di", noarea = true }
}
}
}
}
end
|
local List = require 'list'
local window = require 'window'
local fonts = require 'fonts'
local gamestate = require 'vendor/gamestate'
local window = require 'window'
local camera = require 'camera'
local Debugger = { on=false, bbox=false }
Debugger.__index = Debugger
Debugger.sampleRate = 0.05
Debugger.lastSample = 0
Debugger.infoToShow = {}
Debugger.infowidth = 100
Debugger.infoheight = 125
Debugger.graphData = {
{ name = 'gc', color = { 255, 0, 0, 150 } }
}
function Debugger:reset()
love.mouse.setVisible( not ( Debugger.on and Debugger.bbox ) )
for k,_ in pairs(Debugger.graphData) do
Debugger.graphData[k].list = List.new()
end
end
function Debugger.set( d, bb )
Debugger.on = d
Debugger.bbox = bb
Debugger:reset()
end
function Debugger:toggle()
if Debugger.on and not Debugger.bbox then
Debugger.bbox = true
elseif Debugger.on and Debugger.bbox then
Debugger.on = false
Debugger.bbox = false
else
Debugger.on = true
end
Debugger:reset()
end
function Debugger:getData(name)
for k,v in pairs(Debugger.graphData) do
if v.name == name then
return Debugger.graphData[k]
end
end
return false
end
function Debugger:listPush( list, val )
List.pushleft( list, val )
if math.abs(list.first) - math.abs(list.last) > window.screen_width then
List.popright( list )
end
end
function Debugger:update( dt )
if Debugger.on and Debugger.lastSample > Debugger.sampleRate then
Debugger:listPush( Debugger:getData('gc').list, collectgarbage( 'count' ) / 100 )
Debugger.lastSample = 0
else
Debugger.lastSample = Debugger.lastSample + dt
end
end
local function scale(t,s)
for i=1,#t do
t[i] = t[i] * s
end
return t
end
function Debugger:draw()
if Debugger.bbox and gamestate.currentState().collider then
local x, y = love.mouse.getPosition()
x, y = x + camera.x, y + camera.y
Debugger.infoToShow = {}
camera:set()
-- draw the boxes
for _,shape in pairs(gamestate.currentState().collider._active_shapes) do
Debugger.drawShape( shape, x, y, 255, 0, 0 )
end
for _,shape in pairs(gamestate.currentState().collider._passive_shapes) do
if shape.node.isActive then
Debugger.drawShape( shape, x, y, 255, 255, 0 )
else
Debugger.drawShape( shape, x, y, 0, 255, 0 )
end
end
for _,shape in pairs(gamestate.currentState().collider._ghost_shapes) do
Debugger.drawShape( shape, x, y, 0, 0, 255 )
end
Debugger.drawInfoBox( x, y )
camera:unset()
love.graphics.setColor(255,255,255,255)
end
for k,v in pairs( Debugger.graphData ) do
love.graphics.setColor( v.color )
for i=v.list.first, v.list.last do
if v.list[i] then
love.graphics.line(
window.screen_width + v.list.first - i,
window.screen_height - v.list[i],
window.screen_width + v.list.first - i,
window.screen_height
)
end
end
end
love.graphics.setColor( 255, 255, 255, 255 )
fonts.set('big')
love.graphics.print( math.floor( collectgarbage( 'count' ) / 10 ) / 10 , window.screen_width - 30, window.screen_height - 10,0,0.5,0.5 )
fonts.revert()
end
function Debugger.drawShape( s, x, y, r, g, b )
love.graphics.setColor(r,g,b,100)
s:draw('fill')
love.graphics.setColor(r,g,b,50)
s:draw('line')
if s:contains( x, y ) and s.node and s.node.node then
table.insert( Debugger.infoToShow, s.node.node )
end
end
function Debugger.drawInfoBox( x, y )
love.graphics.setColor(0,0,0,255)
love.graphics.line( x - 2, y, x + 2, y )
love.graphics.line( x, y - 2, x, y + 2 )
if #Debugger.infoToShow > 0 then
if x + Debugger.infowidth * #Debugger.infoToShow >= camera.x + window.width then x = x - Debugger.infowidth * #Debugger.infoToShow end
if y + Debugger.infoheight >= camera.y + window.height then y = y - Debugger.infoheight end
love.graphics.setColor(0,0,0,100)
love.graphics.rectangle( 'fill', x, y, Debugger.infowidth * #Debugger.infoToShow, Debugger.infoheight )
love.graphics.setColor(0,0,0,50)
love.graphics.rectangle( 'line', x, y, Debugger.infowidth * #Debugger.infoToShow, Debugger.infoheight )
love.graphics.setColor(255,255,255,255)
x, y = x + 5, y + 5
local origy = y
for _,info in pairs(Debugger.infoToShow) do
for key,value in pairs(info) do
if type( value ) ~= 'table' then
love.graphics.print( key .. ' = ' .. value, x, y, 0, 0.5 )
else
love.graphics.print( key .. ' = {', x, y, 0, 0.5 )
y = y + 6
for tablekey,tablevalue in pairs(value) do
if type(tablevalue) == 'table' then
local newtable = ''
for i,n in pairs(tablevalue) do
newtable = newtable .. i .. '=' .. n .. ' '
end
tablevalue = newtable
end
love.graphics.print( ' ' .. tablekey .. ' = ' .. tablevalue, x, y, 0, 0.5 )
y = y + 6
end
love.graphics.print( '}', x, y, 0, 0.5 )
end
y = y + 6
end
x = x + Debugger.infowidth
y = origy
end
end
end
return Debugger
|
female_roba = Creature:new {
objectName = "@mob/creature_names:roba_female",
socialGroup = "roba",
faction = "",
level = 16,
chanceHit = 0.31,
damageMin = 170,
damageMax = 180,
baseXp = 960,
baseHAM = 2900,
baseHAMmax = 3500,
armor = 0,
resists = {5,5,5,140,-1,-1,-1,-1,-1},
meatType = "meat_carnivore",
meatAmount = 10,
hideType = "hide_leathery",
hideAmount = 15,
boneType = "bone_mammal",
boneAmount = 10,
milkType = "milk_wild",
milk = 400,
tamingChance = 0.25,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + HERD,
optionsBitmask = AIENABLED,
diet = CARNIVORE,
templates = {"object/mobile/roba_hue.iff"},
hues = { 8, 9, 10, 11, 12, 13, 14, 15 },
controlDeviceTemplate = "object/intangible/pet/roba_hue.iff",
scale = 0.95,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"dizzyattack",""}
}
}
CreatureTemplates:addCreatureTemplate(female_roba, "female_roba")
|
pg = pg or {}
pg.enemy_data_statistics_9 = {
[230] = {
cannon = 0,
name = "长门",
type = 5,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 230,
bubble_fx = "",
dodge_growth = 0,
icon = "changmen",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 5,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "changmen",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 3,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.065,
0.897,
0
}
},
torpedo = {
{
0.943,
0.98,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.39,
0.69,
0.25
}
}
}
},
{
40,
{
{
"smoke",
{
0.53,
2.1,
2.19
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[231] = {
cannon = 0,
name = "陆奥",
type = 5,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 231,
bubble_fx = "",
dodge_growth = 0,
icon = "luao",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 5,
armor_growth = 0,
torpedo_growth = 0,
speed = 14,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "luao",
cannon_growth = 0,
pilot_ai_template_id = 10001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 3,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
1.58,
0.691,
0
}
},
vicegun = {
{
1.58,
0.691,
0
}
},
torpedo = {
{
0.426,
0.323,
0
}
},
antiaircraft = {
{
1.52,
1.139,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
0.88,
1.02,
-0.2
}
}
}
},
{
40,
{
{
"smoke",
{
-1.54,
1.31,
-0.24
}
},
{
"smoke",
{
-0.35,
2.9,
-0.25
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {
"appearQ"
},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[232] = {
cannon = 0,
name = "俾斯麦",
type = 5,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 232,
bubble_fx = "",
dodge_growth = 0,
icon = "bisimai",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 5,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "bisimai",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 4,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 3,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-0.38,
0.41,
0
}
},
vicegun = {
{
0.97,
1.14,
0
}
},
torpedo = {
{
0,
0,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.78,
0.55,
-0.21
}
}
}
},
{
40,
{
{
"smoke",
{
0.51,
2.28,
2.1
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[233] = {
cannon = 0,
name = "提尔比茨",
type = 5,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 233,
bubble_fx = "",
dodge_growth = 0,
icon = "tierbici",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 5,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "tierbici",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 4,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 3,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-0.314,
0.203,
0
}
},
torpedo = {
{
1.082,
0.175,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.66,
0.52,
0.09
}
}
}
},
{
40,
{
{
"smoke",
{
0.58,
2.35,
2
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[234] = {
cannon = 0,
name = "凤翔",
type = 6,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 234,
bubble_fx = "",
dodge_growth = 0,
icon = "fengxiang",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 6,
armor_growth = 0,
torpedo_growth = 0,
speed = 22,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "fengxiang",
cannon_growth = 0,
pilot_ai_template_id = 10001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 1,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.77,
1.19,
0
}
},
antiaircraft = {
{
0.77,
1.19,
0
}
},
plane = {
{
0.77,
1.19,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.559,
0.97,
-0.4
}
}
}
},
{
30,
{
{
"smoke",
{
-0.67,
2.52,
-0.99
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {
"appearQ"
},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[235] = {
cannon = 0,
name = "龙骧",
type = 6,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 235,
bubble_fx = "",
dodge_growth = 0,
icon = "longxiang",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 6,
armor_growth = 0,
torpedo_growth = 0,
speed = 22,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "longxiang",
cannon_growth = 0,
pilot_ai_template_id = 10001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 1,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.55,
0.51,
0
}
},
vicegun = {
{
0.55,
0.51,
0
}
},
torpedo = {
{
0.15,
0.28,
0
}
},
antiaircraft = {
{
0.55,
0.51,
0
}
},
plane = {
{
0.55,
0.51,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
0.378,
0.78,
-0.394
}
}
}
},
{
40,
{
{
"smoke",
{
-0.68,
2.42,
-0.24
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {
"bossguangxiao",
"appearQ"
},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[236] = {
cannon = 0,
name = "祥凤",
type = 6,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 236,
bubble_fx = "",
dodge_growth = 0,
icon = "xiangfeng",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 6,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "xiangfeng",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 1,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-0.222,
0.425,
0
}
},
plane = {
{
-0.222,
0.425,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
0.48,
0.58,
0.57
}
}
}
},
{
40,
{
{
"smoke",
{
-0.93,
1.75,
2.31
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[237] = {
cannon = 0,
name = "萨拉托加",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 237,
bubble_fx = "",
dodge_growth = 0,
icon = "salatuojia",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "salatuojia",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 1,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.98,
1.07,
0
}
},
plane = {
{
-0.75,
0.57,
0
}
},
torpedo = {
{
0.98,
1.07,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.78,
0.69,
0.39
}
}
}
},
{
40,
{
{
"smoke",
{
0.77,
1.67,
2.22
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[238] = {
cannon = 0,
name = "大黄蜂",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 238,
bubble_fx = "",
dodge_growth = 0,
icon = "dahuangfeng",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "dahuangfeng",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 1,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-0.335,
0.438,
0
}
},
plane = {
{
-0.335,
0.438,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.41,
0.52,
0.14
}
}
}
},
{
40,
{
{
"smoke",
{
0.38,
2.01,
2.02
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[239] = {
cannon = 0,
name = "赤城",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 239,
bubble_fx = "",
dodge_growth = 0,
icon = "chicheng",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "chicheng",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.795,
0.462,
0
}
},
plane = {
{
0.795,
0.462,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
0.59,
0.87,
0.28
}
}
}
},
{
40,
{
{
"smoke",
{
-0.83,
2.62,
1.31
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[240] = {
cannon = 0,
name = "加贺",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 240,
bubble_fx = "",
dodge_growth = 0,
icon = "jiahe",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "jiahe",
cannon_growth = 0,
pilot_ai_template_id = 30001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.861,
0.779,
0.018
}
},
plane = {
{
0.861,
0.779,
0.018
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
0.99,
0.49,
0.15
}
}
}
},
{
40,
{
{
"smoke",
{
-0.45,
2.86,
-0.03
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[241] = {
cannon = 0,
name = "苍龙",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 241,
bubble_fx = "",
dodge_growth = 0,
icon = "canglong",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "Canglong",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-0.644,
0.488,
0
}
},
plane = {
{
-0.644,
0.488,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.29,
0.57,
0.28
}
}
}
},
{
40,
{
{
"smoke",
{
0.6,
2.12,
1.48
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[242] = {
cannon = 0,
name = "飞龙",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 242,
bubble_fx = "",
dodge_growth = 0,
icon = "feilong",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "feilong",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-0.65,
0.53,
0
}
},
plane = {
{
-0.65,
0.53,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.2,
0.57,
0.16
}
}
}
},
{
40,
{
{
"smoke",
{
-0.56,
2.25,
2.11
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[243] = {
cannon = 0,
name = "翔鹤",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 243,
bubble_fx = "",
dodge_growth = 0,
icon = "xianghe",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "xianghe",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
-1.19,
1.31,
0
}
},
plane = {
{
0.62,
1.13,
0
}
}
},
smoke = {
{
50,
{
{
"smoke",
{
-0.64,
2.22,
0
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[244] = {
cannon = 0,
name = "瑞鹤",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 244,
bubble_fx = "",
dodge_growth = 0,
icon = "ruihe",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "ruihe",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 3,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
10
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
0.83,
0.74,
0
}
},
plane = {
{
0.83,
0.74,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-0.468,
0.148,
0.28
}
}
}
},
{
40,
{
{
"smoke",
{
0.932,
1.436,
1.83
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
},
[245] = {
cannon = 0,
name = "齐柏林",
type = 7,
speed_growth = 0,
battle_unit_type = 49,
air = 0,
air_growth = 0,
durability = 99999,
friendly_cld = 0,
armor = 0,
id = 245,
bubble_fx = "",
dodge_growth = 0,
icon = "qibolin",
star = 0,
torpedo = 0,
antisub_growth = 0,
rarity = 0,
luck_growth = 0,
hit_growth = 0,
icon_type = 7,
armor_growth = 0,
torpedo_growth = 0,
speed = 15,
luck = 0,
antisub = 0,
scale = 150,
wave_fx = "movewave",
prefab = "qibolin",
cannon_growth = 0,
pilot_ai_template_id = 20001,
reload = 150,
dodge = 0,
reload_growth = 0,
hit = 0,
nationality = 4,
durability_growth = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
armor_type = 2,
world_enhancement = {
0,
0,
0,
0,
0,
0,
0
},
cld_box = {
5.5,
7.5,
8
},
cld_offset = {
0,
0,
0
},
aim_offset = {
0,
0,
0
},
bound_bone = {
cannon = {
{
1.74,
1,
0
}
},
plane = {
{
0.73,
1.28,
0
}
}
},
smoke = {
{
70,
{
{
"smoke",
{
-1.01,
0.86,
-1.89
}
}
}
},
{
40,
{
{
"smoke",
{
0.87,
0.79,
-1.85
}
}
}
}
},
fx_container = {
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
},
{
0,
0,
0
}
},
specific_fx_scale = {},
appear_fx = {},
position_offset = {
0,
0,
0
},
hp_bar = {
150,
4
},
equipment_list = {},
random_equipment_list = {},
random_nub = {},
buff_list = {}
}
}
return
|
--variables
local lasttime = 0
local cooldown = 0
local bulletSpeed = 1600
local bullets = {}
local playerBossCol = false
local projectileCount = 3
local spread = 7
weaponType = "gun"
--all collision code
local function onCollision (event)
if ( event.phase == "began" ) then
if (event.object1.myName == "player") then
print(event.object1.x)
print(event.object1.y)
end
--player bullet disappears on wall hit
if(event.object1.myName == "bullet" and event.object2.myName == "wall" ) then
event.object1:removeSelf()
elseif(event.object2.myName == "bullet" and event.object1.myName == "wall" ) then
event.object2:removeSelf()
end
--player enters portal
if(event.object1.myName == "player" and event.object2.myName == "portalTo1" ) then
if(enemyCount < 1) then
changeLevelTo1()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo2" ) then
if(enemyCount < 1) then
changeLevelTo2()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo3" ) then
if(enemyCount < 1) then
changeLevelTo3()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo4" ) then
if(enemyCount < 1) then
changeLevelTo4()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo4BowRoom" ) then
changeLevelTo4()
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo5" ) then
if(enemyCount < 1)then
changeLevelTo5()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo6" ) then
if(enemyCount < 1)then
changeLevelTo6()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalTo7" ) then
if(enemyCount < 1)then
changeLevelTo7()
end
end
if(event.object1.myName == "player" and event.object2.myName == "portalToBowRoom" ) then
changeLevelToBowRoom()
end
--end of portals
if(event.object1.myName == "wall" and event.object2.myName == "player" ) then
touchingWall = true
elseif(event.object2.myName == "wall" and event.object1.myName == "player" ) then
touchingWall = true
end
if(event.object1.myName == "void" and event.object2.myName == "player" ) then
touchingWall = true
elseif(event.object2.myName == "void" and event.object1.myName == "player" ) then
touchingWall = true
end
--player bullet hits enemy
if(event.object1.myName == "bullet" and event.object2.myName == "enemy" ) then
event.object1:removeSelf()
print( event.object2.HP)
event.object2.HP = event.object2.HP - 1
print( event.object2.HP)
if(event.object2.HP == 0) then
event.object2:removeSelf()
enemyCount = enemyCount - 1
enemyCountDisplay:removeSelf()
enemyCountDisplay = display.newText(enemyCount, 40, 40, native.systemFont, 30)
end
--remove hp
elseif(event.object2.myName == "bullet" and event.object1.myName == "enemy" ) then
event.object2:removeSelf()
event.object1.HP = event.object1.HP - 1
if(event.object1.HP == 0) then
event.object1:removeSelf()
enemyCount = enemyCount - 1
enemyCountDisplay:removeSelf()
enemyCountDisplay = display.newText(enemyCount, 40, 40, native.systemFont, 30)
end
--remove hp
end
--player bullet hits boss
if(event.object1.myName == "bullet" and event.object2.myName == "boss" ) then
event.object1:removeSelf()
event.object2.HP = event.object2.HP - 1
if(event.object2.HP <= 0 and bossTier == 5) then
event.object2:removeSelf()
enemyCount = enemyCount - 1
enemyCountDisplay:removeSelf()
enemyCountDisplay = display.newText(enemyCount, 40, 40, native.systemFont, 30)
end
--remove hp
elseif(event.object2.myName == "bullet" and event.object1.myName == "boss" ) then
event.object2:removeSelf()
event.object1.HP = event.object1.HP - 1
if(event.object1.HP <= 0 and bossTier == 5) then
event.object1:removeSelf()
enemyCount = enemyCount - 1
enemyCountDisplay = display.newText(enemyCount, 40, 40, native.systemFont, 30)
end
--remove hp
end
--enemy bullet disappears on wall hit
if(event.object1.myName == "enemyBullet" and event.object2.myName == "wall" ) then
event.object1:removeSelf()
elseif(event.object2.myName == "enemyBullet" and event.object1.myName == "wall" ) then
event.object2:removeSelf()
end
--enemy bullet hits player
if(event.object1.myName == "enemyBullet" and event.object2.myName == "player" ) then
event.object1:removeSelf()
myPlayer.alpha = 0.5
myPlayer:setFillColor( 255, 0, 0)
playSFX(playerHit, 1)
--remove hp
elseif(event.object2.myName == "enemyBullet" and event.object1.myName == "player" ) then
event.object2:removeSelf()
myPlayer.alpha = 0.5
myPlayer:setFillColor( 255, 0, 0)
playSFX(playerHit, 1)
--remove hp
end
if(event.object1.myName == "enemyBullet" and event.object2.myName == "player" ) then
event.object1:removeSelf()
playerHP = playerHP - 1
if(playerHP < 1 ) then
gameOver()
end
--remove hp
elseif(event.object2.myName == "enemyBullet" and event.object1.myName == "player" ) then
event.object2:removeSelf()
playerHP = playerHP - 1
--remove hp
if(playerHP < 1 ) then
gameOver()
end
end
--player and boss collision
if(event.object1.myName == "boss" and event.object2.myName == "player" ) then
playerBossCol = true
playerHP = playerHP - 1
playSFX(playerHit, 1)
--remove hp
if(playerHP < 1 ) then
gameOver()
end
elseif(event.object2.myName == "boss" and event.object1.myName == "player" ) then
playerBossCol = true
playerHP = playerHP - 1
playSFX(playerHit, 1)
--remove hp
if(playerHP < 1 ) then
gameOver()
end
end
if(event.object1.myName == "enemy" and event.object2.myName == "player" ) then
playerBossCol = true
playerHP = playerHP - 1
playSFX(playerHit, 1)
myPlayer.alpha = 0.5
myPlayer:setFillColor( 255, 0, 0)
--remove hp
if(playerHP < 1 ) then
gameOver()
end
elseif(event.object2.myName == "enemy" and event.object1.myName == "player" ) then
myPlayer.alpha = 0.5
myPlayer:setFillColor( 255, 0, 0)
playerBossCol = true
playerHP = playerHP - 1
playSFX(playerHit, 1)
--remove hp
if(playerHP < 1 ) then
gameOver()
end
end
elseif ( event.phase == "ended" ) then
if(event.object1.myName == "boss" and event.object2.myName == "player" ) then
playerBossCol = false
elseif(event.object2.myName == "boss" and event.object1.myName == "player" ) then
playerBossCol = false
end
if(event.object1.myName == "wall" and event.object2.myName == "player" ) then
touchingWall = false
grapplePaused = 0
elseif(event.object2.myName == "wall" and event.object1.myName == "player" ) then
touchingWall = false
grapplePaused = 0
end
if(event.object1.myName == "void" and event.object2.myName == "player" ) then
touchingWall = false
grapplePaused = 0
elseif(event.object2.myName == "void" and event.object1.myName == "player" ) then
touchingWall = false
grapplePaused = 0
end
end
end
--bullet code
local function createBullet (event)
if ( event.phase == "began" ) then
if (os.time() > (lasttime + cooldown)) then
if(weaponType == "gun") then
--setting cooldown and angle of the "bullet"
lasttime = os.time()
local vec = ssk.math2d.diff( myPlayer, grapplepos)
local angle = ssk.math2d.vector2Angle(vec)
vec = ssk.math2d.normalize(vec)
vec = ssk.math2d.scale(vec, bulletSpeed)
playSFX(gunShoot, 0.1)
--setting starting position of the "bullet"
local firedBullet = display.newImageRect("graphics/items/gunbullet.png", 16, 16)
firedBullet.x = myPlayer.x
firedBullet.y = myPlayer.y
--adding physics and physics properties
physics.addBody( firedBullet, "dynamic", {density = 1, friction = 0, bounce = 0 } )
firedBullet.rotation = angle + 270
firedBullet.isFixedRotation = true
firedBullet.gravityScale = 0
firedBullet.isBullet = true
firedBullet.isSensor = true
firedBullet:setLinearVelocity(vec.x, vec.y)
firedBullet.myName = "bullet"
firedBullet.collision = "bulletCollision"
elseif(weaponType == "bow") then
bulletSpeed = 1000
lasttime = os.time()
local vec = ssk.math2d.diff( myPlayer, grapplepos)
local angle0 = ssk.math2d.vector2Angle(vec)
local angle = angle0 - spread * (projectileCount - 1) / 2
for i = 1, projectileCount do
local vec2 = ssk.math2d.angle2Vector( angle, true)
vec2 = ssk.math2d.normalize(vec2)
vec2 = ssk.math2d.scale(vec2, bulletSpeed)
playSFX(arrowShoot, 0.1)
--setting starting position of the "bullet"
local firedBullet = display.newImageRect("graphics/items/arrow.png", 32, 16)
firedBullet.x = myPlayer.x
firedBullet.y = myPlayer.y
--adding physics and physics properties
physics.addBody( firedBullet, "dynamic", {density = 1, friction = 0, bounce = 0 } )
firedBullet.rotation = angle + 270
firedBullet.isFixedRotation = true
firedBullet.gravityScale = 0
firedBullet.isBullet = true
firedBullet.isSensor = true
firedBullet:setLinearVelocity(vec2.x, vec2.y)
firedBullet.myName = "bullet"
firedBullet.collision = "bulletCollision"
angle = angle + spread
end
end
end -- ostime end
end --phase end
end -- function end
Runtime:addEventListener("collision", onCollision)
grapplepos:addEventListener ("touch", createBullet)
return bullets
|
return {
[1] = {
["id"] = "110000";
["name"] = "北京";
["children"] = {
[1] = {
["id"] = "110101";
["name"] = "东城区";
};
[2] = {
["id"] = "110102";
["name"] = "西城区";
};
[3] = {
["id"] = "110105";
["name"] = "朝阳区";
};
[4] = {
["id"] = "110106";
["name"] = "丰台区";
};
[5] = {
["id"] = "110107";
["name"] = "石景山区";
};
[6] = {
["id"] = "110108";
["name"] = "海淀区";
};
[7] = {
["id"] = "110109";
["name"] = "门头沟区";
};
[8] = {
["id"] = "110111";
["name"] = "房山区";
};
[9] = {
["id"] = "110112";
["name"] = "通州区";
};
[10] = {
["id"] = "110113";
["name"] = "顺义区";
};
[11] = {
["id"] = "110114";
["name"] = "昌平区";
};
[12] = {
["id"] = "110115";
["name"] = "大兴区";
};
[13] = {
["id"] = "110116";
["name"] = "怀柔区";
};
[14] = {
["id"] = "110117";
["name"] = "平谷区";
};
[15] = {
["id"] = "110228";
["name"] = "密云县";
};
[16] = {
["id"] = "110229";
["name"] = "延庆县";
};
};
};
[2] = {
["id"] = "120000";
["name"] = "天津";
["children"] = {
[1] = {
["id"] = "120101";
["name"] = "和平区";
};
[2] = {
["id"] = "120102";
["name"] = "河东区";
};
[3] = {
["id"] = "120103";
["name"] = "河西区";
};
[4] = {
["id"] = "120104";
["name"] = "南开区";
};
[5] = {
["id"] = "120105";
["name"] = "河北区";
};
[6] = {
["id"] = "120106";
["name"] = "红桥区";
};
[7] = {
["id"] = "120110";
["name"] = "东丽区";
};
[8] = {
["id"] = "120111";
["name"] = "西青区";
};
[9] = {
["id"] = "120112";
["name"] = "津南区";
};
[10] = {
["id"] = "120113";
["name"] = "北辰区";
};
[11] = {
["id"] = "120114";
["name"] = "武清区";
};
[12] = {
["id"] = "120115";
["name"] = "宝坻区";
};
[13] = {
["id"] = "120116";
["name"] = "滨海新区";
};
[14] = {
["id"] = "120221";
["name"] = "宁河县";
};
[15] = {
["id"] = "120223";
["name"] = "静海县";
};
[16] = {
["id"] = "120225";
["name"] = "蓟县";
};
};
};
[3] = {
["id"] = "130000";
["name"] = "河北";
["children"] = {
[1] = {
["id"] = "130100";
["name"] = "石家庄";
["children"] = {
[1] = {
["id"] = "130102";
["name"] = "长安区";
};
[2] = {
["id"] = "130103";
["name"] = "桥东区";
};
[3] = {
["id"] = "130104";
["name"] = "桥西区";
};
[4] = {
["id"] = "130105";
["name"] = "新华区";
};
[5] = {
["id"] = "130107";
["name"] = "井陉矿区";
};
[6] = {
["id"] = "130108";
["name"] = "裕华区";
};
[7] = {
["id"] = "130121";
["name"] = "井陉县";
};
[8] = {
["id"] = "130123";
["name"] = "正定县";
};
[9] = {
["id"] = "130124";
["name"] = "栾城县";
};
[10] = {
["id"] = "130125";
["name"] = "行唐县";
};
[11] = {
["id"] = "130126";
["name"] = "灵寿县";
};
[12] = {
["id"] = "130127";
["name"] = "高邑县";
};
[13] = {
["id"] = "130128";
["name"] = "深泽县";
};
[14] = {
["id"] = "130129";
["name"] = "赞皇县";
};
[15] = {
["id"] = "130130";
["name"] = "无极县";
};
[16] = {
["id"] = "130131";
["name"] = "平山县";
};
[17] = {
["id"] = "130132";
["name"] = "元氏县";
};
[18] = {
["id"] = "130133";
["name"] = "赵县";
};
[19] = {
["id"] = "130181";
["name"] = "辛集";
};
[20] = {
["id"] = "130182";
["name"] = "藁城";
};
[21] = {
["id"] = "130183";
["name"] = "晋州";
};
[22] = {
["id"] = "130184";
["name"] = "新乐";
};
[23] = {
["id"] = "130185";
["name"] = "鹿泉";
};
};
};
[2] = {
["id"] = "130200";
["name"] = "唐山";
["children"] = {
[1] = {
["id"] = "130202";
["name"] = "路南区";
};
[2] = {
["id"] = "130203";
["name"] = "路北区";
};
[3] = {
["id"] = "130204";
["name"] = "古冶区";
};
[4] = {
["id"] = "130205";
["name"] = "开平区";
};
[5] = {
["id"] = "130207";
["name"] = "丰南区";
};
[6] = {
["id"] = "130208";
["name"] = "丰润区";
};
[7] = {
["id"] = "130209";
["name"] = "曹妃甸区";
};
[8] = {
["id"] = "130223";
["name"] = "滦县";
};
[9] = {
["id"] = "130224";
["name"] = "滦南县";
};
[10] = {
["id"] = "130225";
["name"] = "乐亭县";
};
[11] = {
["id"] = "130227";
["name"] = "迁西县";
};
[12] = {
["id"] = "130229";
["name"] = "玉田县";
};
[13] = {
["id"] = "130281";
["name"] = "遵化";
};
[14] = {
["id"] = "130283";
["name"] = "迁安";
};
};
};
[3] = {
["id"] = "130300";
["name"] = "秦皇岛";
["children"] = {
[1] = {
["id"] = "130302";
["name"] = "海港区";
};
[2] = {
["id"] = "130303";
["name"] = "山海关区";
};
[3] = {
["id"] = "130304";
["name"] = "北戴河区";
};
[4] = {
["id"] = "130321";
["name"] = "青龙满族自治县";
};
[5] = {
["id"] = "130322";
["name"] = "昌黎县";
};
[6] = {
["id"] = "130323";
["name"] = "抚宁县";
};
[7] = {
["id"] = "130324";
["name"] = "卢龙县";
};
};
};
[4] = {
["id"] = "130400";
["name"] = "邯郸";
["children"] = {
[1] = {
["id"] = "130402";
["name"] = "邯山区";
};
[2] = {
["id"] = "130403";
["name"] = "丛台区";
};
[3] = {
["id"] = "130404";
["name"] = "复兴区";
};
[4] = {
["id"] = "130406";
["name"] = "峰峰矿区";
};
[5] = {
["id"] = "130421";
["name"] = "邯郸县";
};
[6] = {
["id"] = "130423";
["name"] = "临漳县";
};
[7] = {
["id"] = "130424";
["name"] = "成安县";
};
[8] = {
["id"] = "130425";
["name"] = "大名县";
};
[9] = {
["id"] = "130426";
["name"] = "涉县";
};
[10] = {
["id"] = "130427";
["name"] = "磁县";
};
[11] = {
["id"] = "130428";
["name"] = "肥乡县";
};
[12] = {
["id"] = "130429";
["name"] = "永年县";
};
[13] = {
["id"] = "130430";
["name"] = "邱县";
};
[14] = {
["id"] = "130431";
["name"] = "鸡泽县";
};
[15] = {
["id"] = "130432";
["name"] = "广平县";
};
[16] = {
["id"] = "130433";
["name"] = "馆陶县";
};
[17] = {
["id"] = "130434";
["name"] = "魏县";
};
[18] = {
["id"] = "130435";
["name"] = "曲周县";
};
[19] = {
["id"] = "130481";
["name"] = "武安";
};
};
};
[5] = {
["id"] = "130500";
["name"] = "邢台";
["children"] = {
[1] = {
["id"] = "130502";
["name"] = "桥东区";
};
[2] = {
["id"] = "130503";
["name"] = "桥西区";
};
[3] = {
["id"] = "130521";
["name"] = "邢台县";
};
[4] = {
["id"] = "130522";
["name"] = "临城县";
};
[5] = {
["id"] = "130523";
["name"] = "内丘县";
};
[6] = {
["id"] = "130524";
["name"] = "柏乡县";
};
[7] = {
["id"] = "130525";
["name"] = "隆尧县";
};
[8] = {
["id"] = "130526";
["name"] = "任县";
};
[9] = {
["id"] = "130527";
["name"] = "南和县";
};
[10] = {
["id"] = "130528";
["name"] = "宁晋县";
};
[11] = {
["id"] = "130529";
["name"] = "巨鹿县";
};
[12] = {
["id"] = "130530";
["name"] = "新河县";
};
[13] = {
["id"] = "130531";
["name"] = "广宗县";
};
[14] = {
["id"] = "130532";
["name"] = "平乡县";
};
[15] = {
["id"] = "130533";
["name"] = "威县";
};
[16] = {
["id"] = "130534";
["name"] = "清河县";
};
[17] = {
["id"] = "130535";
["name"] = "临西县";
};
[18] = {
["id"] = "130581";
["name"] = "南宫";
};
[19] = {
["id"] = "130582";
["name"] = "沙河";
};
};
};
[6] = {
["id"] = "130600";
["name"] = "保定";
["children"] = {
[1] = {
["id"] = "130602";
["name"] = "新区";
};
[2] = {
["id"] = "130603";
["name"] = "北区";
};
[3] = {
["id"] = "130604";
["name"] = "南区";
};
[4] = {
["id"] = "130621";
["name"] = "满城县";
};
[5] = {
["id"] = "130622";
["name"] = "清苑县";
};
[6] = {
["id"] = "130623";
["name"] = "涞水县";
};
[7] = {
["id"] = "130624";
["name"] = "阜平县";
};
[8] = {
["id"] = "130625";
["name"] = "徐水县";
};
[9] = {
["id"] = "130626";
["name"] = "定兴县";
};
[10] = {
["id"] = "130627";
["name"] = "唐县";
};
[11] = {
["id"] = "130628";
["name"] = "高阳县";
};
[12] = {
["id"] = "130629";
["name"] = "容城县";
};
[13] = {
["id"] = "130630";
["name"] = "涞源县";
};
[14] = {
["id"] = "130631";
["name"] = "望都县";
};
[15] = {
["id"] = "130632";
["name"] = "安新县";
};
[16] = {
["id"] = "130633";
["name"] = "易县";
};
[17] = {
["id"] = "130634";
["name"] = "曲阳县";
};
[18] = {
["id"] = "130635";
["name"] = "蠡县";
};
[19] = {
["id"] = "130636";
["name"] = "顺平县";
};
[20] = {
["id"] = "130637";
["name"] = "博野县";
};
[21] = {
["id"] = "130638";
["name"] = "雄县";
};
[22] = {
["id"] = "130681";
["name"] = "涿州";
};
[23] = {
["id"] = "130682";
["name"] = "定州";
};
[24] = {
["id"] = "130683";
["name"] = "安国";
};
[25] = {
["id"] = "130684";
["name"] = "高碑店";
};
};
};
[7] = {
["id"] = "130700";
["name"] = "张家口";
["children"] = {
[1] = {
["id"] = "130702";
["name"] = "桥东区";
};
[2] = {
["id"] = "130703";
["name"] = "桥西区";
};
[3] = {
["id"] = "130705";
["name"] = "宣化区";
};
[4] = {
["id"] = "130706";
["name"] = "下花园区";
};
[5] = {
["id"] = "130721";
["name"] = "宣化县";
};
[6] = {
["id"] = "130722";
["name"] = "张北县";
};
[7] = {
["id"] = "130723";
["name"] = "康保县";
};
[8] = {
["id"] = "130724";
["name"] = "沽源县";
};
[9] = {
["id"] = "130725";
["name"] = "尚义县";
};
[10] = {
["id"] = "130726";
["name"] = "蔚县";
};
[11] = {
["id"] = "130727";
["name"] = "阳原县";
};
[12] = {
["id"] = "130728";
["name"] = "怀安县";
};
[13] = {
["id"] = "130729";
["name"] = "万全县";
};
[14] = {
["id"] = "130730";
["name"] = "怀来县";
};
[15] = {
["id"] = "130731";
["name"] = "涿鹿县";
};
[16] = {
["id"] = "130732";
["name"] = "赤城县";
};
[17] = {
["id"] = "130733";
["name"] = "崇礼县";
};
};
};
[8] = {
["id"] = "130800";
["name"] = "承德";
["children"] = {
[1] = {
["id"] = "130802";
["name"] = "双桥区";
};
[2] = {
["id"] = "130803";
["name"] = "双滦区";
};
[3] = {
["id"] = "130804";
["name"] = "鹰手营子矿区";
};
[4] = {
["id"] = "130821";
["name"] = "承德县";
};
[5] = {
["id"] = "130822";
["name"] = "兴隆县";
};
[6] = {
["id"] = "130823";
["name"] = "平泉县";
};
[7] = {
["id"] = "130824";
["name"] = "滦平县";
};
[8] = {
["id"] = "130825";
["name"] = "隆化县";
};
[9] = {
["id"] = "130826";
["name"] = "丰宁满族自治县";
};
[10] = {
["id"] = "130827";
["name"] = "宽城满族自治县";
};
[11] = {
["id"] = "130828";
["name"] = "围场满族蒙古族自治县";
};
};
};
[9] = {
["id"] = "130900";
["name"] = "沧州";
["children"] = {
[1] = {
["id"] = "130902";
["name"] = "新华区";
};
[2] = {
["id"] = "130903";
["name"] = "运河区";
};
[3] = {
["id"] = "130921";
["name"] = "沧县";
};
[4] = {
["id"] = "130922";
["name"] = "青县";
};
[5] = {
["id"] = "130923";
["name"] = "东光县";
};
[6] = {
["id"] = "130924";
["name"] = "海兴县";
};
[7] = {
["id"] = "130925";
["name"] = "盐山县";
};
[8] = {
["id"] = "130926";
["name"] = "肃宁县";
};
[9] = {
["id"] = "130927";
["name"] = "南皮县";
};
[10] = {
["id"] = "130928";
["name"] = "吴桥县";
};
[11] = {
["id"] = "130929";
["name"] = "献县";
};
[12] = {
["id"] = "130930";
["name"] = "孟村回族自治县";
};
[13] = {
["id"] = "130981";
["name"] = "泊头";
};
[14] = {
["id"] = "130982";
["name"] = "任丘";
};
[15] = {
["id"] = "130983";
["name"] = "黄骅";
};
[16] = {
["id"] = "130984";
["name"] = "河间";
};
};
};
[10] = {
["id"] = "131000";
["name"] = "廊坊";
["children"] = {
[1] = {
["id"] = "131002";
["name"] = "安次区";
};
[2] = {
["id"] = "131003";
["name"] = "广阳区";
};
[3] = {
["id"] = "131022";
["name"] = "固安县";
};
[4] = {
["id"] = "131023";
["name"] = "永清县";
};
[5] = {
["id"] = "131024";
["name"] = "香河县";
};
[6] = {
["id"] = "131025";
["name"] = "大城县";
};
[7] = {
["id"] = "131026";
["name"] = "文安县";
};
[8] = {
["id"] = "131028";
["name"] = "大厂回族自治县";
};
[9] = {
["id"] = "131081";
["name"] = "霸州";
};
[10] = {
["id"] = "131082";
["name"] = "三河";
};
};
};
[11] = {
["id"] = "131100";
["name"] = "衡水";
["children"] = {
[1] = {
["id"] = "131102";
["name"] = "桃城区";
};
[2] = {
["id"] = "131121";
["name"] = "枣强县";
};
[3] = {
["id"] = "131122";
["name"] = "武邑县";
};
[4] = {
["id"] = "131123";
["name"] = "武强县";
};
[5] = {
["id"] = "131124";
["name"] = "饶阳县";
};
[6] = {
["id"] = "131125";
["name"] = "安平县";
};
[7] = {
["id"] = "131126";
["name"] = "故城县";
};
[8] = {
["id"] = "131127";
["name"] = "景县";
};
[9] = {
["id"] = "131128";
["name"] = "阜城县";
};
[10] = {
["id"] = "131181";
["name"] = "冀州";
};
[11] = {
["id"] = "131182";
["name"] = "深州";
};
};
};
};
};
[4] = {
["id"] = "140000";
["name"] = "山西";
["children"] = {
[1] = {
["id"] = "140100";
["name"] = "太原";
["children"] = {
[1] = {
["id"] = "140105";
["name"] = "小店区";
};
[2] = {
["id"] = "140106";
["name"] = "迎泽区";
};
[3] = {
["id"] = "140107";
["name"] = "杏花岭区";
};
[4] = {
["id"] = "140108";
["name"] = "尖草坪区";
};
[5] = {
["id"] = "140109";
["name"] = "万柏林区";
};
[6] = {
["id"] = "140110";
["name"] = "晋源区";
};
[7] = {
["id"] = "140121";
["name"] = "清徐县";
};
[8] = {
["id"] = "140122";
["name"] = "阳曲县";
};
[9] = {
["id"] = "140123";
["name"] = "娄烦县";
};
[10] = {
["id"] = "140181";
["name"] = "古交";
};
};
};
[2] = {
["id"] = "140200";
["name"] = "大同";
["children"] = {
[1] = {
["id"] = "140202";
["name"] = "城区";
};
[2] = {
["id"] = "140203";
["name"] = "矿区";
};
[3] = {
["id"] = "140211";
["name"] = "南郊区";
};
[4] = {
["id"] = "140212";
["name"] = "新荣区";
};
[5] = {
["id"] = "140221";
["name"] = "阳高县";
};
[6] = {
["id"] = "140222";
["name"] = "天镇县";
};
[7] = {
["id"] = "140223";
["name"] = "广灵县";
};
[8] = {
["id"] = "140224";
["name"] = "灵丘县";
};
[9] = {
["id"] = "140225";
["name"] = "浑源县";
};
[10] = {
["id"] = "140226";
["name"] = "左云县";
};
[11] = {
["id"] = "140227";
["name"] = "大同县";
};
};
};
[3] = {
["id"] = "140300";
["name"] = "阳泉";
["children"] = {
[1] = {
["id"] = "140302";
["name"] = "城区";
};
[2] = {
["id"] = "140303";
["name"] = "矿区";
};
[3] = {
["id"] = "140311";
["name"] = "郊区";
};
[4] = {
["id"] = "140321";
["name"] = "平定县";
};
[5] = {
["id"] = "140322";
["name"] = "盂县";
};
};
};
[4] = {
["id"] = "140400";
["name"] = "长治";
["children"] = {
[1] = {
["id"] = "140402";
["name"] = "城区";
};
[2] = {
["id"] = "140411";
["name"] = "郊区";
};
[3] = {
["id"] = "140421";
["name"] = "长治县";
};
[4] = {
["id"] = "140423";
["name"] = "襄垣县";
};
[5] = {
["id"] = "140424";
["name"] = "屯留县";
};
[6] = {
["id"] = "140425";
["name"] = "平顺县";
};
[7] = {
["id"] = "140426";
["name"] = "黎城县";
};
[8] = {
["id"] = "140427";
["name"] = "壶关县";
};
[9] = {
["id"] = "140428";
["name"] = "长子县";
};
[10] = {
["id"] = "140429";
["name"] = "武乡县";
};
[11] = {
["id"] = "140430";
["name"] = "沁县";
};
[12] = {
["id"] = "140431";
["name"] = "沁源县";
};
[13] = {
["id"] = "140481";
["name"] = "潞城";
};
};
};
[5] = {
["id"] = "140500";
["name"] = "晋城";
["children"] = {
[1] = {
["id"] = "140502";
["name"] = "城区";
};
[2] = {
["id"] = "140521";
["name"] = "沁水县";
};
[3] = {
["id"] = "140522";
["name"] = "阳城县";
};
[4] = {
["id"] = "140524";
["name"] = "陵川县";
};
[5] = {
["id"] = "140525";
["name"] = "泽州县";
};
[6] = {
["id"] = "140581";
["name"] = "高平";
};
};
};
[6] = {
["id"] = "140600";
["name"] = "朔州";
["children"] = {
[1] = {
["id"] = "140602";
["name"] = "朔城区";
};
[2] = {
["id"] = "140603";
["name"] = "平鲁区";
};
[3] = {
["id"] = "140621";
["name"] = "山阴县";
};
[4] = {
["id"] = "140622";
["name"] = "应县";
};
[5] = {
["id"] = "140623";
["name"] = "右玉县";
};
[6] = {
["id"] = "140624";
["name"] = "怀仁县";
};
};
};
[7] = {
["id"] = "140700";
["name"] = "晋中";
["children"] = {
[1] = {
["id"] = "140702";
["name"] = "榆次区";
};
[2] = {
["id"] = "140721";
["name"] = "榆社县";
};
[3] = {
["id"] = "140722";
["name"] = "左权县";
};
[4] = {
["id"] = "140723";
["name"] = "和顺县";
};
[5] = {
["id"] = "140724";
["name"] = "昔阳县";
};
[6] = {
["id"] = "140725";
["name"] = "寿阳县";
};
[7] = {
["id"] = "140726";
["name"] = "太谷县";
};
[8] = {
["id"] = "140727";
["name"] = "祁县";
};
[9] = {
["id"] = "140728";
["name"] = "平遥县";
};
[10] = {
["id"] = "140729";
["name"] = "灵石县";
};
[11] = {
["id"] = "140781";
["name"] = "介休";
};
};
};
[8] = {
["id"] = "140800";
["name"] = "运城";
["children"] = {
[1] = {
["id"] = "140802";
["name"] = "盐湖区";
};
[2] = {
["id"] = "140821";
["name"] = "临猗县";
};
[3] = {
["id"] = "140822";
["name"] = "万荣县";
};
[4] = {
["id"] = "140823";
["name"] = "闻喜县";
};
[5] = {
["id"] = "140824";
["name"] = "稷山县";
};
[6] = {
["id"] = "140825";
["name"] = "新绛县";
};
[7] = {
["id"] = "140826";
["name"] = "绛县";
};
[8] = {
["id"] = "140827";
["name"] = "垣曲县";
};
[9] = {
["id"] = "140828";
["name"] = "夏县";
};
[10] = {
["id"] = "140829";
["name"] = "平陆县";
};
[11] = {
["id"] = "140830";
["name"] = "芮城县";
};
[12] = {
["id"] = "140881";
["name"] = "永济";
};
[13] = {
["id"] = "140882";
["name"] = "河津";
};
};
};
[9] = {
["id"] = "140900";
["name"] = "忻州";
["children"] = {
[1] = {
["id"] = "140902";
["name"] = "忻府区";
};
[2] = {
["id"] = "140921";
["name"] = "定襄县";
};
[3] = {
["id"] = "140922";
["name"] = "五台县";
};
[4] = {
["id"] = "140923";
["name"] = "代县";
};
[5] = {
["id"] = "140924";
["name"] = "繁峙县";
};
[6] = {
["id"] = "140925";
["name"] = "宁武县";
};
[7] = {
["id"] = "140926";
["name"] = "静乐县";
};
[8] = {
["id"] = "140927";
["name"] = "神池县";
};
[9] = {
["id"] = "140928";
["name"] = "五寨县";
};
[10] = {
["id"] = "140929";
["name"] = "岢岚县";
};
[11] = {
["id"] = "140930";
["name"] = "河曲县";
};
[12] = {
["id"] = "140931";
["name"] = "保德县";
};
[13] = {
["id"] = "140932";
["name"] = "偏关县";
};
[14] = {
["id"] = "140981";
["name"] = "原平";
};
};
};
[10] = {
["id"] = "141000";
["name"] = "临汾";
["children"] = {
[1] = {
["id"] = "141002";
["name"] = "尧都区";
};
[2] = {
["id"] = "141021";
["name"] = "曲沃县";
};
[3] = {
["id"] = "141022";
["name"] = "翼城县";
};
[4] = {
["id"] = "141023";
["name"] = "襄汾县";
};
[5] = {
["id"] = "141024";
["name"] = "洪洞县";
};
[6] = {
["id"] = "141025";
["name"] = "古县";
};
[7] = {
["id"] = "141026";
["name"] = "安泽县";
};
[8] = {
["id"] = "141027";
["name"] = "浮山县";
};
[9] = {
["id"] = "141028";
["name"] = "吉县";
};
[10] = {
["id"] = "141029";
["name"] = "乡宁县";
};
[11] = {
["id"] = "141030";
["name"] = "大宁县";
};
[12] = {
["id"] = "141031";
["name"] = "隰县";
};
[13] = {
["id"] = "141032";
["name"] = "永和县";
};
[14] = {
["id"] = "141033";
["name"] = "蒲县";
};
[15] = {
["id"] = "141034";
["name"] = "汾西县";
};
[16] = {
["id"] = "141081";
["name"] = "侯马";
};
[17] = {
["id"] = "141082";
["name"] = "霍州";
};
};
};
[11] = {
["id"] = "141100";
["name"] = "吕梁";
["children"] = {
[1] = {
["id"] = "141102";
["name"] = "离石区";
};
[2] = {
["id"] = "141121";
["name"] = "文水县";
};
[3] = {
["id"] = "141122";
["name"] = "交城县";
};
[4] = {
["id"] = "141123";
["name"] = "兴县";
};
[5] = {
["id"] = "141124";
["name"] = "临县";
};
[6] = {
["id"] = "141125";
["name"] = "柳林县";
};
[7] = {
["id"] = "141126";
["name"] = "石楼县";
};
[8] = {
["id"] = "141127";
["name"] = "岚县";
};
[9] = {
["id"] = "141128";
["name"] = "方山县";
};
[10] = {
["id"] = "141129";
["name"] = "中阳县";
};
[11] = {
["id"] = "141130";
["name"] = "交口县";
};
[12] = {
["id"] = "141181";
["name"] = "孝义";
};
[13] = {
["id"] = "141182";
["name"] = "汾阳";
};
};
};
};
};
[5] = {
["id"] = "150000";
["name"] = "内蒙古";
["children"] = {
[1] = {
["id"] = "150100";
["name"] = "呼和浩特";
["children"] = {
[1] = {
["id"] = "150102";
["name"] = "新城区";
};
[2] = {
["id"] = "150103";
["name"] = "回民区";
};
[3] = {
["id"] = "150104";
["name"] = "玉泉区";
};
[4] = {
["id"] = "150105";
["name"] = "赛罕区";
};
[5] = {
["id"] = "150121";
["name"] = "土默特左旗";
};
[6] = {
["id"] = "150122";
["name"] = "托克托县";
};
[7] = {
["id"] = "150123";
["name"] = "和林格尔县";
};
[8] = {
["id"] = "150124";
["name"] = "清水河县";
};
[9] = {
["id"] = "150125";
["name"] = "武川县";
};
};
};
[2] = {
["id"] = "150200";
["name"] = "包头";
["children"] = {
[1] = {
["id"] = "150202";
["name"] = "东河区";
};
[2] = {
["id"] = "150203";
["name"] = "昆都仑区";
};
[3] = {
["id"] = "150204";
["name"] = "青山区";
};
[4] = {
["id"] = "150205";
["name"] = "石拐区";
};
[5] = {
["id"] = "150206";
["name"] = "白云鄂博矿区";
};
[6] = {
["id"] = "150207";
["name"] = "九原区";
};
[7] = {
["id"] = "150221";
["name"] = "土默特右旗";
};
[8] = {
["id"] = "150222";
["name"] = "固阳县";
};
[9] = {
["id"] = "150223";
["name"] = "达尔罕茂明安联合旗";
};
};
};
[3] = {
["id"] = "150300";
["name"] = "乌海";
["children"] = {
[1] = {
["id"] = "150302";
["name"] = "海勃湾区";
};
[2] = {
["id"] = "150303";
["name"] = "海南区";
};
[3] = {
["id"] = "150304";
["name"] = "乌达区";
};
};
};
[4] = {
["id"] = "150400";
["name"] = "赤峰";
["children"] = {
[1] = {
["id"] = "150402";
["name"] = "红山区";
};
[2] = {
["id"] = "150403";
["name"] = "元宝山区";
};
[3] = {
["id"] = "150404";
["name"] = "松山区";
};
[4] = {
["id"] = "150421";
["name"] = "阿鲁科尔沁旗";
};
[5] = {
["id"] = "150422";
["name"] = "巴林左旗";
};
[6] = {
["id"] = "150423";
["name"] = "巴林右旗";
};
[7] = {
["id"] = "150424";
["name"] = "林西县";
};
[8] = {
["id"] = "150425";
["name"] = "克什克腾旗";
};
[9] = {
["id"] = "150426";
["name"] = "翁牛特旗";
};
[10] = {
["id"] = "150428";
["name"] = "喀喇沁旗";
};
[11] = {
["id"] = "150429";
["name"] = "宁城县";
};
[12] = {
["id"] = "150430";
["name"] = "敖汉旗";
};
};
};
[5] = {
["id"] = "150500";
["name"] = "通辽";
["children"] = {
[1] = {
["id"] = "150502";
["name"] = "科尔沁区";
};
[2] = {
["id"] = "150521";
["name"] = "科尔沁左翼中旗";
};
[3] = {
["id"] = "150522";
["name"] = "科尔沁左翼后旗";
};
[4] = {
["id"] = "150523";
["name"] = "开鲁县";
};
[5] = {
["id"] = "150524";
["name"] = "库伦旗";
};
[6] = {
["id"] = "150525";
["name"] = "奈曼旗";
};
[7] = {
["id"] = "150526";
["name"] = "扎鲁特旗";
};
[8] = {
["id"] = "150581";
["name"] = "霍林郭勒";
};
};
};
[6] = {
["id"] = "150600";
["name"] = "鄂尔多斯";
["children"] = {
[1] = {
["id"] = "150602";
["name"] = "东胜区";
};
[2] = {
["id"] = "150621";
["name"] = "达拉特旗";
};
[3] = {
["id"] = "150622";
["name"] = "准格尔旗";
};
[4] = {
["id"] = "150623";
["name"] = "鄂托克前旗";
};
[5] = {
["id"] = "150624";
["name"] = "鄂托克旗";
};
[6] = {
["id"] = "150625";
["name"] = "杭锦旗";
};
[7] = {
["id"] = "150626";
["name"] = "乌审旗";
};
[8] = {
["id"] = "150627";
["name"] = "伊金霍洛旗";
};
};
};
[7] = {
["id"] = "150700";
["name"] = "呼伦贝尔";
["children"] = {
[1] = {
["id"] = "150702";
["name"] = "海拉尔区";
};
[2] = {
["id"] = "150703";
["name"] = "扎赉诺尔区";
};
[3] = {
["id"] = "150721";
["name"] = "阿荣旗";
};
[4] = {
["id"] = "150722";
["name"] = "莫力达瓦达斡尔族自治旗";
};
[5] = {
["id"] = "150723";
["name"] = "鄂伦春自治旗";
};
[6] = {
["id"] = "150724";
["name"] = "鄂温克族自治旗";
};
[7] = {
["id"] = "150725";
["name"] = "陈巴尔虎旗";
};
[8] = {
["id"] = "150726";
["name"] = "新巴尔虎左旗";
};
[9] = {
["id"] = "150727";
["name"] = "新巴尔虎右旗";
};
[10] = {
["id"] = "150781";
["name"] = "满洲里";
};
[11] = {
["id"] = "150782";
["name"] = "牙克石";
};
[12] = {
["id"] = "150783";
["name"] = "扎兰屯";
};
[13] = {
["id"] = "150784";
["name"] = "额尔古纳";
};
[14] = {
["id"] = "150785";
["name"] = "根河";
};
};
};
[8] = {
["id"] = "150800";
["name"] = "巴彦淖尔";
["children"] = {
[1] = {
["id"] = "150802";
["name"] = "临河区";
};
[2] = {
["id"] = "150821";
["name"] = "五原县";
};
[3] = {
["id"] = "150822";
["name"] = "磴口县";
};
[4] = {
["id"] = "150823";
["name"] = "乌拉特前旗";
};
[5] = {
["id"] = "150824";
["name"] = "乌拉特中旗";
};
[6] = {
["id"] = "150825";
["name"] = "乌拉特后旗";
};
[7] = {
["id"] = "150826";
["name"] = "杭锦后旗";
};
};
};
[9] = {
["id"] = "150900";
["name"] = "乌兰察布";
["children"] = {
[1] = {
["id"] = "150902";
["name"] = "集宁区";
};
[2] = {
["id"] = "150921";
["name"] = "卓资县";
};
[3] = {
["id"] = "150922";
["name"] = "化德县";
};
[4] = {
["id"] = "150923";
["name"] = "商都县";
};
[5] = {
["id"] = "150924";
["name"] = "兴和县";
};
[6] = {
["id"] = "150925";
["name"] = "凉城县";
};
[7] = {
["id"] = "150926";
["name"] = "察哈尔右翼前旗";
};
[8] = {
["id"] = "150927";
["name"] = "察哈尔右翼中旗";
};
[9] = {
["id"] = "150928";
["name"] = "察哈尔右翼后旗";
};
[10] = {
["id"] = "150929";
["name"] = "四子王旗";
};
[11] = {
["id"] = "150981";
["name"] = "丰镇";
};
};
};
[10] = {
["id"] = "152200";
["name"] = "兴安";
["children"] = {
[1] = {
["id"] = "152201";
["name"] = "乌兰浩特";
};
[2] = {
["id"] = "152202";
["name"] = "阿尔山";
};
[3] = {
["id"] = "152221";
["name"] = "科尔沁右翼前旗";
};
[4] = {
["id"] = "152222";
["name"] = "科尔沁右翼中旗";
};
[5] = {
["id"] = "152223";
["name"] = "扎赉特旗";
};
[6] = {
["id"] = "152224";
["name"] = "突泉县";
};
};
};
[11] = {
["id"] = "152500";
["name"] = "锡林郭勒";
["children"] = {
[1] = {
["id"] = "152501";
["name"] = "二连浩特";
};
[2] = {
["id"] = "152502";
["name"] = "锡林浩特";
};
[3] = {
["id"] = "152522";
["name"] = "阿巴嘎旗";
};
[4] = {
["id"] = "152523";
["name"] = "苏尼特左旗";
};
[5] = {
["id"] = "152524";
["name"] = "苏尼特右旗";
};
[6] = {
["id"] = "152525";
["name"] = "东乌珠穆沁旗";
};
[7] = {
["id"] = "152526";
["name"] = "西乌珠穆沁旗";
};
[8] = {
["id"] = "152527";
["name"] = "太仆寺旗";
};
[9] = {
["id"] = "152528";
["name"] = "镶黄旗";
};
[10] = {
["id"] = "152529";
["name"] = "正镶白旗";
};
[11] = {
["id"] = "152530";
["name"] = "正蓝旗";
};
[12] = {
["id"] = "152531";
["name"] = "多伦县";
};
};
};
[12] = {
["id"] = "152900";
["name"] = "阿拉善";
["children"] = {
[1] = {
["id"] = "152921";
["name"] = "阿拉善左旗";
};
[2] = {
["id"] = "152922";
["name"] = "阿拉善右旗";
};
[3] = {
["id"] = "152923";
["name"] = "额济纳旗";
};
};
};
};
};
[6] = {
["id"] = "210000";
["name"] = "辽宁";
["children"] = {
[1] = {
["id"] = "210100";
["name"] = "沈阳";
["children"] = {
[1] = {
["id"] = "210102";
["name"] = "和平区";
};
[2] = {
["id"] = "210103";
["name"] = "沈河区";
};
[3] = {
["id"] = "210104";
["name"] = "大东区";
};
[4] = {
["id"] = "210105";
["name"] = "皇姑区";
};
[5] = {
["id"] = "210106";
["name"] = "铁西区";
};
[6] = {
["id"] = "210111";
["name"] = "苏家屯区";
};
[7] = {
["id"] = "210112";
["name"] = "东陵区";
};
[8] = {
["id"] = "210113";
["name"] = "沈北新区";
};
[9] = {
["id"] = "210114";
["name"] = "于洪区";
};
[10] = {
["id"] = "210122";
["name"] = "辽中县";
};
[11] = {
["id"] = "210123";
["name"] = "康平县";
};
[12] = {
["id"] = "210124";
["name"] = "法库县";
};
[13] = {
["id"] = "210181";
["name"] = "新民";
};
};
};
[2] = {
["id"] = "210200";
["name"] = "大连";
["children"] = {
[1] = {
["id"] = "210202";
["name"] = "中山区";
};
[2] = {
["id"] = "210203";
["name"] = "西岗区";
};
[3] = {
["id"] = "210204";
["name"] = "沙河口区";
};
[4] = {
["id"] = "210211";
["name"] = "甘井子区";
};
[5] = {
["id"] = "210212";
["name"] = "旅顺口区";
};
[6] = {
["id"] = "210213";
["name"] = "金州区";
};
[7] = {
["id"] = "210224";
["name"] = "长海县";
};
[8] = {
["id"] = "210281";
["name"] = "瓦房店";
};
[9] = {
["id"] = "210282";
["name"] = "普兰店";
};
[10] = {
["id"] = "210283";
["name"] = "庄河";
};
};
};
[3] = {
["id"] = "210300";
["name"] = "鞍山";
["children"] = {
[1] = {
["id"] = "210302";
["name"] = "铁东区";
};
[2] = {
["id"] = "210303";
["name"] = "铁西区";
};
[3] = {
["id"] = "210304";
["name"] = "立山区";
};
[4] = {
["id"] = "210311";
["name"] = "千山区";
};
[5] = {
["id"] = "210321";
["name"] = "台安县";
};
[6] = {
["id"] = "210323";
["name"] = "岫岩满族自治县";
};
[7] = {
["id"] = "210381";
["name"] = "海城";
};
};
};
[4] = {
["id"] = "210400";
["name"] = "抚顺";
["children"] = {
[1] = {
["id"] = "210402";
["name"] = "新抚区";
};
[2] = {
["id"] = "210403";
["name"] = "东洲区";
};
[3] = {
["id"] = "210404";
["name"] = "望花区";
};
[4] = {
["id"] = "210411";
["name"] = "顺城区";
};
[5] = {
["id"] = "210421";
["name"] = "抚顺县";
};
[6] = {
["id"] = "210422";
["name"] = "新宾满族自治县";
};
[7] = {
["id"] = "210423";
["name"] = "清原满族自治县";
};
};
};
[5] = {
["id"] = "210500";
["name"] = "本溪";
["children"] = {
[1] = {
["id"] = "210502";
["name"] = "平山区";
};
[2] = {
["id"] = "210503";
["name"] = "溪湖区";
};
[3] = {
["id"] = "210504";
["name"] = "明山区";
};
[4] = {
["id"] = "210505";
["name"] = "南芬区";
};
[5] = {
["id"] = "210521";
["name"] = "本溪满族自治县";
};
[6] = {
["id"] = "210522";
["name"] = "桓仁满族自治县";
};
};
};
[6] = {
["id"] = "210600";
["name"] = "丹东";
["children"] = {
[1] = {
["id"] = "210602";
["name"] = "元宝区";
};
[2] = {
["id"] = "210603";
["name"] = "振兴区";
};
[3] = {
["id"] = "210604";
["name"] = "振安区";
};
[4] = {
["id"] = "210624";
["name"] = "宽甸满族自治县";
};
[5] = {
["id"] = "210681";
["name"] = "东港";
};
[6] = {
["id"] = "210682";
["name"] = "凤城";
};
};
};
[7] = {
["id"] = "210700";
["name"] = "锦州";
["children"] = {
[1] = {
["id"] = "210702";
["name"] = "古塔区";
};
[2] = {
["id"] = "210703";
["name"] = "凌河区";
};
[3] = {
["id"] = "210711";
["name"] = "太和区";
};
[4] = {
["id"] = "210726";
["name"] = "黑山县";
};
[5] = {
["id"] = "210727";
["name"] = "义县";
};
[6] = {
["id"] = "210781";
["name"] = "凌海";
};
[7] = {
["id"] = "210782";
["name"] = "北镇";
};
};
};
[8] = {
["id"] = "210800";
["name"] = "营口";
["children"] = {
[1] = {
["id"] = "210802";
["name"] = "站前区";
};
[2] = {
["id"] = "210803";
["name"] = "西区";
};
[3] = {
["id"] = "210804";
["name"] = "鲅鱼圈区";
};
[4] = {
["id"] = "210811";
["name"] = "老边区";
};
[5] = {
["id"] = "210881";
["name"] = "盖州";
};
[6] = {
["id"] = "210882";
["name"] = "大石桥";
};
};
};
[9] = {
["id"] = "210900";
["name"] = "阜新";
["children"] = {
[1] = {
["id"] = "210902";
["name"] = "海州区";
};
[2] = {
["id"] = "210903";
["name"] = "新邱区";
};
[3] = {
["id"] = "210904";
["name"] = "太平区";
};
[4] = {
["id"] = "210905";
["name"] = "清河门区";
};
[5] = {
["id"] = "210911";
["name"] = "细河区";
};
[6] = {
["id"] = "210921";
["name"] = "阜新蒙古族自治县";
};
[7] = {
["id"] = "210922";
["name"] = "彰武县";
};
};
};
[10] = {
["id"] = "211000";
["name"] = "辽阳";
["children"] = {
[1] = {
["id"] = "211002";
["name"] = "白塔区";
};
[2] = {
["id"] = "211003";
["name"] = "文圣区";
};
[3] = {
["id"] = "211004";
["name"] = "宏伟区";
};
[4] = {
["id"] = "211005";
["name"] = "弓长岭区";
};
[5] = {
["id"] = "211011";
["name"] = "太子河区";
};
[6] = {
["id"] = "211021";
["name"] = "辽阳县";
};
[7] = {
["id"] = "211081";
["name"] = "灯塔";
};
};
};
[11] = {
["id"] = "211100";
["name"] = "盘锦";
["children"] = {
[1] = {
["id"] = "211102";
["name"] = "双台子区";
};
[2] = {
["id"] = "211103";
["name"] = "兴隆台区";
};
[3] = {
["id"] = "211121";
["name"] = "大洼县";
};
[4] = {
["id"] = "211122";
["name"] = "盘山县";
};
};
};
[12] = {
["id"] = "211200";
["name"] = "铁岭";
["children"] = {
[1] = {
["id"] = "211202";
["name"] = "银州区";
};
[2] = {
["id"] = "211204";
["name"] = "清河区";
};
[3] = {
["id"] = "211221";
["name"] = "铁岭县";
};
[4] = {
["id"] = "211223";
["name"] = "西丰县";
};
[5] = {
["id"] = "211224";
["name"] = "昌图县";
};
[6] = {
["id"] = "211281";
["name"] = "调兵山";
};
[7] = {
["id"] = "211282";
["name"] = "开原";
};
};
};
[13] = {
["id"] = "211300";
["name"] = "朝阳";
["children"] = {
[1] = {
["id"] = "211302";
["name"] = "双塔区";
};
[2] = {
["id"] = "211303";
["name"] = "龙城区";
};
[3] = {
["id"] = "211321";
["name"] = "朝阳县";
};
[4] = {
["id"] = "211322";
["name"] = "建平县";
};
[5] = {
["id"] = "211324";
["name"] = "喀喇沁左翼蒙古族自治县";
};
[6] = {
["id"] = "211381";
["name"] = "北票";
};
[7] = {
["id"] = "211382";
["name"] = "凌源";
};
};
};
[14] = {
["id"] = "211400";
["name"] = "葫芦岛";
["children"] = {
[1] = {
["id"] = "211402";
["name"] = "连山区";
};
[2] = {
["id"] = "211403";
["name"] = "龙港区";
};
[3] = {
["id"] = "211404";
["name"] = "南票区";
};
[4] = {
["id"] = "211421";
["name"] = "绥中县";
};
[5] = {
["id"] = "211422";
["name"] = "建昌县";
};
[6] = {
["id"] = "211481";
["name"] = "兴城";
};
};
};
};
};
[7] = {
["id"] = "220000";
["name"] = "吉林";
["children"] = {
[1] = {
["id"] = "220100";
["name"] = "长春";
["children"] = {
[1] = {
["id"] = "220102";
["name"] = "南关区";
};
[2] = {
["id"] = "220103";
["name"] = "宽城区";
};
[3] = {
["id"] = "220104";
["name"] = "朝阳区";
};
[4] = {
["id"] = "220105";
["name"] = "二道区";
};
[5] = {
["id"] = "220106";
["name"] = "绿园区";
};
[6] = {
["id"] = "220112";
["name"] = "双阳区";
};
[7] = {
["id"] = "220122";
["name"] = "农安县";
};
[8] = {
["id"] = "220181";
["name"] = "九台";
};
[9] = {
["id"] = "220182";
["name"] = "榆树";
};
[10] = {
["id"] = "220183";
["name"] = "德惠";
};
};
};
[2] = {
["id"] = "220200";
["name"] = "吉林";
["children"] = {
[1] = {
["id"] = "220202";
["name"] = "昌邑区";
};
[2] = {
["id"] = "220203";
["name"] = "龙潭区";
};
[3] = {
["id"] = "220204";
["name"] = "船营区";
};
[4] = {
["id"] = "220211";
["name"] = "丰满区";
};
[5] = {
["id"] = "220221";
["name"] = "永吉县";
};
[6] = {
["id"] = "220281";
["name"] = "蛟河";
};
[7] = {
["id"] = "220282";
["name"] = "桦甸";
};
[8] = {
["id"] = "220283";
["name"] = "舒兰";
};
[9] = {
["id"] = "220284";
["name"] = "磐石";
};
};
};
[3] = {
["id"] = "220300";
["name"] = "四平";
["children"] = {
[1] = {
["id"] = "220302";
["name"] = "铁西区";
};
[2] = {
["id"] = "220303";
["name"] = "铁东区";
};
[3] = {
["id"] = "220322";
["name"] = "梨树县";
};
[4] = {
["id"] = "220323";
["name"] = "伊通满族自治县";
};
[5] = {
["id"] = "220381";
["name"] = "公主岭";
};
[6] = {
["id"] = "220382";
["name"] = "双辽";
};
};
};
[4] = {
["id"] = "220400";
["name"] = "辽源";
["children"] = {
[1] = {
["id"] = "220402";
["name"] = "龙山区";
};
[2] = {
["id"] = "220403";
["name"] = "西安区";
};
[3] = {
["id"] = "220421";
["name"] = "东丰县";
};
[4] = {
["id"] = "220422";
["name"] = "东辽县";
};
};
};
[5] = {
["id"] = "220500";
["name"] = "通化";
["children"] = {
[1] = {
["id"] = "220502";
["name"] = "东昌区";
};
[2] = {
["id"] = "220503";
["name"] = "二道江区";
};
[3] = {
["id"] = "220521";
["name"] = "通化县";
};
[4] = {
["id"] = "220523";
["name"] = "辉南县";
};
[5] = {
["id"] = "220524";
["name"] = "柳河县";
};
[6] = {
["id"] = "220581";
["name"] = "梅河口";
};
[7] = {
["id"] = "220582";
["name"] = "集安";
};
};
};
[6] = {
["id"] = "220600";
["name"] = "白山";
["children"] = {
[1] = {
["id"] = "220602";
["name"] = "浑江区";
};
[2] = {
["id"] = "220605";
["name"] = "江源区";
};
[3] = {
["id"] = "220621";
["name"] = "抚松县";
};
[4] = {
["id"] = "220622";
["name"] = "靖宇县";
};
[5] = {
["id"] = "220623";
["name"] = "长白朝鲜族自治县";
};
[6] = {
["id"] = "220681";
["name"] = "临江";
};
};
};
[7] = {
["id"] = "220700";
["name"] = "松原";
["children"] = {
[1] = {
["id"] = "220702";
["name"] = "宁江区";
};
[2] = {
["id"] = "220721";
["name"] = "前郭尔罗斯蒙古族自治县";
};
[3] = {
["id"] = "220722";
["name"] = "长岭县";
};
[4] = {
["id"] = "220723";
["name"] = "乾安县";
};
[5] = {
["id"] = "220781";
["name"] = "扶余";
};
};
};
[8] = {
["id"] = "220800";
["name"] = "白城";
["children"] = {
[1] = {
["id"] = "220802";
["name"] = "洮北区";
};
[2] = {
["id"] = "220821";
["name"] = "镇赉县";
};
[3] = {
["id"] = "220822";
["name"] = "通榆县";
};
[4] = {
["id"] = "220881";
["name"] = "洮南";
};
[5] = {
["id"] = "220882";
["name"] = "大安";
};
};
};
[9] = {
["id"] = "222400";
["name"] = "延边";
["children"] = {
[1] = {
["id"] = "222401";
["name"] = "延吉";
};
[2] = {
["id"] = "222402";
["name"] = "图们";
};
[3] = {
["id"] = "222403";
["name"] = "敦化";
};
[4] = {
["id"] = "222404";
["name"] = "珲春";
};
[5] = {
["id"] = "222405";
["name"] = "龙井";
};
[6] = {
["id"] = "222406";
["name"] = "和龙";
};
[7] = {
["id"] = "222424";
["name"] = "汪清县";
};
[8] = {
["id"] = "222426";
["name"] = "安图县";
};
};
};
};
};
[8] = {
["id"] = "230000";
["name"] = "黑龙江";
["children"] = {
[1] = {
["id"] = "230100";
["name"] = "哈尔滨";
["children"] = {
[1] = {
["id"] = "230102";
["name"] = "道里区";
};
[2] = {
["id"] = "230103";
["name"] = "南岗区";
};
[3] = {
["id"] = "230104";
["name"] = "道外区";
};
[4] = {
["id"] = "230108";
["name"] = "平房区";
};
[5] = {
["id"] = "230109";
["name"] = "松北区";
};
[6] = {
["id"] = "230110";
["name"] = "香坊区";
};
[7] = {
["id"] = "230111";
["name"] = "呼兰区";
};
[8] = {
["id"] = "230112";
["name"] = "阿城区";
};
[9] = {
["id"] = "230123";
["name"] = "依兰县";
};
[10] = {
["id"] = "230124";
["name"] = "方正县";
};
[11] = {
["id"] = "230125";
["name"] = "宾县";
};
[12] = {
["id"] = "230126";
["name"] = "巴彦县";
};
[13] = {
["id"] = "230127";
["name"] = "木兰县";
};
[14] = {
["id"] = "230128";
["name"] = "通河县";
};
[15] = {
["id"] = "230129";
["name"] = "延寿县";
};
[16] = {
["id"] = "230182";
["name"] = "双城";
};
[17] = {
["id"] = "230183";
["name"] = "尚志";
};
[18] = {
["id"] = "230184";
["name"] = "五常";
};
};
};
[2] = {
["id"] = "230200";
["name"] = "齐齐哈尔";
["children"] = {
[1] = {
["id"] = "230202";
["name"] = "龙沙区";
};
[2] = {
["id"] = "230203";
["name"] = "建华区";
};
[3] = {
["id"] = "230204";
["name"] = "铁锋区";
};
[4] = {
["id"] = "230205";
["name"] = "昂昂溪区";
};
[5] = {
["id"] = "230206";
["name"] = "富拉尔基区";
};
[6] = {
["id"] = "230207";
["name"] = "碾子山区";
};
[7] = {
["id"] = "230208";
["name"] = "梅里斯达斡尔族区";
};
[8] = {
["id"] = "230221";
["name"] = "龙江县";
};
[9] = {
["id"] = "230223";
["name"] = "依安县";
};
[10] = {
["id"] = "230224";
["name"] = "泰来县";
};
[11] = {
["id"] = "230225";
["name"] = "甘南县";
};
[12] = {
["id"] = "230227";
["name"] = "富裕县";
};
[13] = {
["id"] = "230229";
["name"] = "克山县";
};
[14] = {
["id"] = "230230";
["name"] = "克东县";
};
[15] = {
["id"] = "230231";
["name"] = "拜泉县";
};
[16] = {
["id"] = "230281";
["name"] = "讷河";
};
};
};
[3] = {
["id"] = "230300";
["name"] = "鸡西";
["children"] = {
[1] = {
["id"] = "230302";
["name"] = "鸡冠区";
};
[2] = {
["id"] = "230303";
["name"] = "恒山区";
};
[3] = {
["id"] = "230304";
["name"] = "滴道区";
};
[4] = {
["id"] = "230305";
["name"] = "梨树区";
};
[5] = {
["id"] = "230306";
["name"] = "城子河区";
};
[6] = {
["id"] = "230307";
["name"] = "麻山区";
};
[7] = {
["id"] = "230321";
["name"] = "鸡东县";
};
[8] = {
["id"] = "230381";
["name"] = "虎林";
};
[9] = {
["id"] = "230382";
["name"] = "密山";
};
};
};
[4] = {
["id"] = "230400";
["name"] = "鹤岗";
["children"] = {
[1] = {
["id"] = "230402";
["name"] = "向阳区";
};
[2] = {
["id"] = "230403";
["name"] = "工农区";
};
[3] = {
["id"] = "230404";
["name"] = "南山区";
};
[4] = {
["id"] = "230405";
["name"] = "兴安区";
};
[5] = {
["id"] = "230406";
["name"] = "东山区";
};
[6] = {
["id"] = "230407";
["name"] = "兴山区";
};
[7] = {
["id"] = "230421";
["name"] = "萝北县";
};
[8] = {
["id"] = "230422";
["name"] = "绥滨县";
};
};
};
[5] = {
["id"] = "230500";
["name"] = "双鸭山";
["children"] = {
[1] = {
["id"] = "230502";
["name"] = "尖山区";
};
[2] = {
["id"] = "230503";
["name"] = "岭东区";
};
[3] = {
["id"] = "230505";
["name"] = "四方台区";
};
[4] = {
["id"] = "230506";
["name"] = "宝山区";
};
[5] = {
["id"] = "230521";
["name"] = "集贤县";
};
[6] = {
["id"] = "230522";
["name"] = "友谊县";
};
[7] = {
["id"] = "230523";
["name"] = "宝清县";
};
[8] = {
["id"] = "230524";
["name"] = "饶河县";
};
};
};
[6] = {
["id"] = "230600";
["name"] = "大庆";
["children"] = {
[1] = {
["id"] = "230602";
["name"] = "萨尔图区";
};
[2] = {
["id"] = "230603";
["name"] = "龙凤区";
};
[3] = {
["id"] = "230604";
["name"] = "让胡路区";
};
[4] = {
["id"] = "230605";
["name"] = "红岗区";
};
[5] = {
["id"] = "230606";
["name"] = "大同区";
};
[6] = {
["id"] = "230621";
["name"] = "肇州县";
};
[7] = {
["id"] = "230622";
["name"] = "肇源县";
};
[8] = {
["id"] = "230623";
["name"] = "林甸县";
};
[9] = {
["id"] = "230624";
["name"] = "杜尔伯特蒙古族自治县";
};
};
};
[7] = {
["id"] = "230700";
["name"] = "伊春";
["children"] = {
[1] = {
["id"] = "230702";
["name"] = "伊春区";
};
[2] = {
["id"] = "230703";
["name"] = "南岔区";
};
[3] = {
["id"] = "230704";
["name"] = "友好区";
};
[4] = {
["id"] = "230705";
["name"] = "西林区";
};
[5] = {
["id"] = "230706";
["name"] = "翠峦区";
};
[6] = {
["id"] = "230707";
["name"] = "新青区";
};
[7] = {
["id"] = "230708";
["name"] = "美溪区";
};
[8] = {
["id"] = "230709";
["name"] = "金山屯区";
};
[9] = {
["id"] = "230710";
["name"] = "五营区";
};
[10] = {
["id"] = "230711";
["name"] = "乌马河区";
};
[11] = {
["id"] = "230712";
["name"] = "汤旺河区";
};
[12] = {
["id"] = "230713";
["name"] = "带岭区";
};
[13] = {
["id"] = "230714";
["name"] = "乌伊岭区";
};
[14] = {
["id"] = "230715";
["name"] = "红星区";
};
[15] = {
["id"] = "230716";
["name"] = "上甘岭区";
};
[16] = {
["id"] = "230722";
["name"] = "嘉荫县";
};
[17] = {
["id"] = "230781";
["name"] = "铁力";
};
};
};
[8] = {
["id"] = "230800";
["name"] = "佳木斯";
["children"] = {
[1] = {
["id"] = "230803";
["name"] = "向阳区";
};
[2] = {
["id"] = "230804";
["name"] = "前进区";
};
[3] = {
["id"] = "230805";
["name"] = "东风区";
};
[4] = {
["id"] = "230811";
["name"] = "郊区";
};
[5] = {
["id"] = "230822";
["name"] = "桦南县";
};
[6] = {
["id"] = "230826";
["name"] = "桦川县";
};
[7] = {
["id"] = "230828";
["name"] = "汤原县";
};
[8] = {
["id"] = "230833";
["name"] = "抚远县";
};
[9] = {
["id"] = "230881";
["name"] = "同江";
};
[10] = {
["id"] = "230882";
["name"] = "富锦";
};
};
};
[9] = {
["id"] = "230900";
["name"] = "七台河";
["children"] = {
[1] = {
["id"] = "230902";
["name"] = "新兴区";
};
[2] = {
["id"] = "230903";
["name"] = "桃山区";
};
[3] = {
["id"] = "230904";
["name"] = "茄子河区";
};
[4] = {
["id"] = "230921";
["name"] = "勃利县";
};
};
};
[10] = {
["id"] = "231000";
["name"] = "牡丹江";
["children"] = {
[1] = {
["id"] = "231002";
["name"] = "东安区";
};
[2] = {
["id"] = "231003";
["name"] = "阳明区";
};
[3] = {
["id"] = "231004";
["name"] = "爱民区";
};
[4] = {
["id"] = "231005";
["name"] = "西安区";
};
[5] = {
["id"] = "231024";
["name"] = "东宁县";
};
[6] = {
["id"] = "231025";
["name"] = "林口县";
};
[7] = {
["id"] = "231081";
["name"] = "绥芬河";
};
[8] = {
["id"] = "231083";
["name"] = "海林";
};
[9] = {
["id"] = "231084";
["name"] = "宁安";
};
[10] = {
["id"] = "231085";
["name"] = "穆棱";
};
};
};
[11] = {
["id"] = "231100";
["name"] = "黑河";
["children"] = {
[1] = {
["id"] = "231102";
["name"] = "爱辉区";
};
[2] = {
["id"] = "231121";
["name"] = "嫩江县";
};
[3] = {
["id"] = "231123";
["name"] = "逊克县";
};
[4] = {
["id"] = "231124";
["name"] = "孙吴县";
};
[5] = {
["id"] = "231181";
["name"] = "北安";
};
[6] = {
["id"] = "231182";
["name"] = "五大连池";
};
};
};
[12] = {
["id"] = "231200";
["name"] = "绥化";
["children"] = {
[1] = {
["id"] = "231202";
["name"] = "北林区";
};
[2] = {
["id"] = "231221";
["name"] = "望奎县";
};
[3] = {
["id"] = "231222";
["name"] = "兰西县";
};
[4] = {
["id"] = "231223";
["name"] = "青冈县";
};
[5] = {
["id"] = "231224";
["name"] = "庆安县";
};
[6] = {
["id"] = "231225";
["name"] = "明水县";
};
[7] = {
["id"] = "231226";
["name"] = "绥棱县";
};
[8] = {
["id"] = "231281";
["name"] = "安达";
};
[9] = {
["id"] = "231282";
["name"] = "肇东";
};
[10] = {
["id"] = "231283";
["name"] = "海伦";
};
};
};
[13] = {
["id"] = "232700";
["name"] = "大兴安岭";
["children"] = {
[1] = {
["id"] = "232721";
["name"] = "呼玛县";
};
[2] = {
["id"] = "232722";
["name"] = "塔河县";
};
[3] = {
["id"] = "232723";
["name"] = "漠河县";
};
};
};
};
};
[9] = {
["id"] = "310000";
["name"] = "上海";
["children"] = {
[1] = {
["id"] = "310101";
["name"] = "黄浦区";
};
[2] = {
["id"] = "310104";
["name"] = "徐汇区";
};
[3] = {
["id"] = "310105";
["name"] = "长宁区";
};
[4] = {
["id"] = "310106";
["name"] = "静安区";
};
[5] = {
["id"] = "310107";
["name"] = "普陀区";
};
[6] = {
["id"] = "310108";
["name"] = "闸北区";
};
[7] = {
["id"] = "310109";
["name"] = "虹口区";
};
[8] = {
["id"] = "310110";
["name"] = "杨浦区";
};
[9] = {
["id"] = "310112";
["name"] = "闵行区";
};
[10] = {
["id"] = "310113";
["name"] = "宝山区";
};
[11] = {
["id"] = "310114";
["name"] = "嘉定区";
};
[12] = {
["id"] = "310115";
["name"] = "浦东新区";
};
[13] = {
["id"] = "310116";
["name"] = "金山区";
};
[14] = {
["id"] = "310117";
["name"] = "松江区";
};
[15] = {
["id"] = "310118";
["name"] = "青浦区";
};
[16] = {
["id"] = "310120";
["name"] = "奉贤区";
};
[17] = {
["id"] = "310230";
["name"] = "崇明县";
};
};
};
[10] = {
["id"] = "320000";
["name"] = "江苏";
["children"] = {
[1] = {
["id"] = "320100";
["name"] = "南京";
["children"] = {
[1] = {
["id"] = "320102";
["name"] = "玄武区";
};
[2] = {
["id"] = "320104";
["name"] = "秦淮区";
};
[3] = {
["id"] = "320105";
["name"] = "建邺区";
};
[4] = {
["id"] = "320106";
["name"] = "鼓楼区";
};
[5] = {
["id"] = "320111";
["name"] = "浦口区";
};
[6] = {
["id"] = "320113";
["name"] = "栖霞区";
};
[7] = {
["id"] = "320114";
["name"] = "雨花台区";
};
[8] = {
["id"] = "320115";
["name"] = "江宁区";
};
[9] = {
["id"] = "320116";
["name"] = "六合区";
};
[10] = {
["id"] = "320117";
["name"] = "溧水区";
};
[11] = {
["id"] = "320118";
["name"] = "高淳区";
};
};
};
[2] = {
["id"] = "320200";
["name"] = "无锡";
["children"] = {
[1] = {
["id"] = "320202";
["name"] = "崇安区";
};
[2] = {
["id"] = "320203";
["name"] = "南长区";
};
[3] = {
["id"] = "320204";
["name"] = "北塘区";
};
[4] = {
["id"] = "320205";
["name"] = "锡山区";
};
[5] = {
["id"] = "320206";
["name"] = "惠山区";
};
[6] = {
["id"] = "320211";
["name"] = "滨湖区";
};
[7] = {
["id"] = "320281";
["name"] = "江阴";
};
[8] = {
["id"] = "320282";
["name"] = "宜兴";
};
};
};
[3] = {
["id"] = "320300";
["name"] = "徐州";
["children"] = {
[1] = {
["id"] = "320302";
["name"] = "鼓楼区";
};
[2] = {
["id"] = "320303";
["name"] = "云龙区";
};
[3] = {
["id"] = "320305";
["name"] = "贾汪区";
};
[4] = {
["id"] = "320311";
["name"] = "泉山区";
};
[5] = {
["id"] = "320312";
["name"] = "铜山区";
};
[6] = {
["id"] = "320321";
["name"] = "丰县";
};
[7] = {
["id"] = "320322";
["name"] = "沛县";
};
[8] = {
["id"] = "320324";
["name"] = "睢宁县";
};
[9] = {
["id"] = "320381";
["name"] = "新沂";
};
[10] = {
["id"] = "320382";
["name"] = "邳州";
};
};
};
[4] = {
["id"] = "320400";
["name"] = "常州";
["children"] = {
[1] = {
["id"] = "320402";
["name"] = "天宁区";
};
[2] = {
["id"] = "320404";
["name"] = "钟楼区";
};
[3] = {
["id"] = "320405";
["name"] = "戚墅堰区";
};
[4] = {
["id"] = "320411";
["name"] = "新北区";
};
[5] = {
["id"] = "320412";
["name"] = "武进区";
};
[6] = {
["id"] = "320481";
["name"] = "溧阳";
};
[7] = {
["id"] = "320482";
["name"] = "金坛";
};
};
};
[5] = {
["id"] = "320500";
["name"] = "苏州";
["children"] = {
[1] = {
["id"] = "320505";
["name"] = "虎丘区";
};
[2] = {
["id"] = "320506";
["name"] = "吴中区";
};
[3] = {
["id"] = "320507";
["name"] = "相城区";
};
[4] = {
["id"] = "320508";
["name"] = "姑苏区";
};
[5] = {
["id"] = "320509";
["name"] = "吴江区";
};
[6] = {
["id"] = "320581";
["name"] = "常熟";
};
[7] = {
["id"] = "320582";
["name"] = "张家港";
};
[8] = {
["id"] = "320583";
["name"] = "昆山";
};
[9] = {
["id"] = "320585";
["name"] = "太仓";
};
};
};
[6] = {
["id"] = "320600";
["name"] = "南通";
["children"] = {
[1] = {
["id"] = "320602";
["name"] = "崇川区";
};
[2] = {
["id"] = "320611";
["name"] = "港闸区";
};
[3] = {
["id"] = "320612";
["name"] = "通州区";
};
[4] = {
["id"] = "320621";
["name"] = "海安县";
};
[5] = {
["id"] = "320623";
["name"] = "如东县";
};
[6] = {
["id"] = "320681";
["name"] = "启东";
};
[7] = {
["id"] = "320682";
["name"] = "如皋";
};
[8] = {
["id"] = "320684";
["name"] = "海门";
};
};
};
[7] = {
["id"] = "320700";
["name"] = "连云港";
["children"] = {
[1] = {
["id"] = "320703";
["name"] = "连云区";
};
[2] = {
["id"] = "320705";
["name"] = "新浦区";
};
[3] = {
["id"] = "320706";
["name"] = "海州区";
};
[4] = {
["id"] = "320721";
["name"] = "赣榆县";
};
[5] = {
["id"] = "320722";
["name"] = "东海县";
};
[6] = {
["id"] = "320723";
["name"] = "灌云县";
};
[7] = {
["id"] = "320724";
["name"] = "灌南县";
};
};
};
[8] = {
["id"] = "320800";
["name"] = "淮安";
["children"] = {
[1] = {
["id"] = "320802";
["name"] = "清河区";
};
[2] = {
["id"] = "320803";
["name"] = "淮安区";
};
[3] = {
["id"] = "320804";
["name"] = "淮阴区";
};
[4] = {
["id"] = "320811";
["name"] = "清浦区";
};
[5] = {
["id"] = "320826";
["name"] = "涟水县";
};
[6] = {
["id"] = "320829";
["name"] = "洪泽县";
};
[7] = {
["id"] = "320830";
["name"] = "盱眙县";
};
[8] = {
["id"] = "320831";
["name"] = "金湖县";
};
};
};
[9] = {
["id"] = "320900";
["name"] = "盐城";
["children"] = {
[1] = {
["id"] = "320902";
["name"] = "亭湖区";
};
[2] = {
["id"] = "320903";
["name"] = "盐都区";
};
[3] = {
["id"] = "320921";
["name"] = "响水县";
};
[4] = {
["id"] = "320922";
["name"] = "滨海县";
};
[5] = {
["id"] = "320923";
["name"] = "阜宁县";
};
[6] = {
["id"] = "320924";
["name"] = "射阳县";
};
[7] = {
["id"] = "320925";
["name"] = "建湖县";
};
[8] = {
["id"] = "320981";
["name"] = "东台";
};
[9] = {
["id"] = "320982";
["name"] = "大丰";
};
};
};
[10] = {
["id"] = "321000";
["name"] = "扬州";
["children"] = {
[1] = {
["id"] = "321002";
["name"] = "广陵区";
};
[2] = {
["id"] = "321003";
["name"] = "邗江区";
};
[3] = {
["id"] = "321012";
["name"] = "江都区";
};
[4] = {
["id"] = "321023";
["name"] = "宝应县";
};
[5] = {
["id"] = "321081";
["name"] = "仪征";
};
[6] = {
["id"] = "321084";
["name"] = "高邮";
};
};
};
[11] = {
["id"] = "321100";
["name"] = "镇江";
["children"] = {
[1] = {
["id"] = "321102";
["name"] = "京口区";
};
[2] = {
["id"] = "321111";
["name"] = "润州区";
};
[3] = {
["id"] = "321112";
["name"] = "丹徒区";
};
[4] = {
["id"] = "321181";
["name"] = "丹阳";
};
[5] = {
["id"] = "321182";
["name"] = "扬中";
};
[6] = {
["id"] = "321183";
["name"] = "句容";
};
};
};
[12] = {
["id"] = "321200";
["name"] = "泰州";
["children"] = {
[1] = {
["id"] = "321202";
["name"] = "海陵区";
};
[2] = {
["id"] = "321203";
["name"] = "高港区";
};
[3] = {
["id"] = "321204";
["name"] = "姜堰区";
};
[4] = {
["id"] = "321281";
["name"] = "兴化";
};
[5] = {
["id"] = "321282";
["name"] = "靖江";
};
[6] = {
["id"] = "321283";
["name"] = "泰兴";
};
};
};
[13] = {
["id"] = "321300";
["name"] = "宿迁";
["children"] = {
[1] = {
["id"] = "321302";
["name"] = "宿城区";
};
[2] = {
["id"] = "321311";
["name"] = "宿豫区";
};
[3] = {
["id"] = "321322";
["name"] = "沭阳县";
};
[4] = {
["id"] = "321323";
["name"] = "泗阳县";
};
[5] = {
["id"] = "321324";
["name"] = "泗洪县";
};
};
};
};
};
[11] = {
["id"] = "330000";
["name"] = "浙江";
["children"] = {
[1] = {
["id"] = "330100";
["name"] = "杭州";
["children"] = {
[1] = {
["id"] = "330102";
["name"] = "上城区";
};
[2] = {
["id"] = "330103";
["name"] = "下城区";
};
[3] = {
["id"] = "330104";
["name"] = "江干区";
};
[4] = {
["id"] = "330105";
["name"] = "拱墅区";
};
[5] = {
["id"] = "330106";
["name"] = "西湖区";
};
[6] = {
["id"] = "330108";
["name"] = "滨江区";
};
[7] = {
["id"] = "330109";
["name"] = "萧山区";
};
[8] = {
["id"] = "330110";
["name"] = "余杭区";
};
[9] = {
["id"] = "330122";
["name"] = "桐庐县";
};
[10] = {
["id"] = "330127";
["name"] = "淳安县";
};
[11] = {
["id"] = "330182";
["name"] = "建德";
};
[12] = {
["id"] = "330183";
["name"] = "富阳";
};
[13] = {
["id"] = "330185";
["name"] = "临安";
};
};
};
[2] = {
["id"] = "330200";
["name"] = "宁波";
["children"] = {
[1] = {
["id"] = "330203";
["name"] = "海曙区";
};
[2] = {
["id"] = "330204";
["name"] = "江东区";
};
[3] = {
["id"] = "330205";
["name"] = "江北区";
};
[4] = {
["id"] = "330206";
["name"] = "北仑区";
};
[5] = {
["id"] = "330211";
["name"] = "镇海区";
};
[6] = {
["id"] = "330212";
["name"] = "鄞州区";
};
[7] = {
["id"] = "330225";
["name"] = "象山县";
};
[8] = {
["id"] = "330226";
["name"] = "宁海县";
};
[9] = {
["id"] = "330281";
["name"] = "余姚";
};
[10] = {
["id"] = "330282";
["name"] = "慈溪";
};
[11] = {
["id"] = "330283";
["name"] = "奉化";
};
};
};
[3] = {
["id"] = "330300";
["name"] = "温州";
["children"] = {
[1] = {
["id"] = "330302";
["name"] = "鹿城区";
};
[2] = {
["id"] = "330303";
["name"] = "龙湾区";
};
[3] = {
["id"] = "330304";
["name"] = "瓯海区";
};
[4] = {
["id"] = "330322";
["name"] = "洞头县";
};
[5] = {
["id"] = "330324";
["name"] = "永嘉县";
};
[6] = {
["id"] = "330326";
["name"] = "平阳县";
};
[7] = {
["id"] = "330327";
["name"] = "苍南县";
};
[8] = {
["id"] = "330328";
["name"] = "文成县";
};
[9] = {
["id"] = "330329";
["name"] = "泰顺县";
};
[10] = {
["id"] = "330381";
["name"] = "瑞安";
};
[11] = {
["id"] = "330382";
["name"] = "乐清";
};
};
};
[4] = {
["id"] = "330400";
["name"] = "嘉兴";
["children"] = {
[1] = {
["id"] = "330402";
["name"] = "南湖区";
};
[2] = {
["id"] = "330411";
["name"] = "秀洲区";
};
[3] = {
["id"] = "330421";
["name"] = "嘉善县";
};
[4] = {
["id"] = "330424";
["name"] = "海盐县";
};
[5] = {
["id"] = "330481";
["name"] = "海宁";
};
[6] = {
["id"] = "330482";
["name"] = "平湖";
};
[7] = {
["id"] = "330483";
["name"] = "桐乡";
};
};
};
[5] = {
["id"] = "330500";
["name"] = "湖州";
["children"] = {
[1] = {
["id"] = "330502";
["name"] = "吴兴区";
};
[2] = {
["id"] = "330503";
["name"] = "南浔区";
};
[3] = {
["id"] = "330521";
["name"] = "德清县";
};
[4] = {
["id"] = "330522";
["name"] = "长兴县";
};
[5] = {
["id"] = "330523";
["name"] = "安吉县";
};
};
};
[6] = {
["id"] = "330600";
["name"] = "绍兴";
["children"] = {
[1] = {
["id"] = "330602";
["name"] = "越城区";
};
[2] = {
["id"] = "330621";
["name"] = "绍兴县";
};
[3] = {
["id"] = "330624";
["name"] = "新昌县";
};
[4] = {
["id"] = "330681";
["name"] = "诸暨";
};
[5] = {
["id"] = "330682";
["name"] = "上虞";
};
[6] = {
["id"] = "330683";
["name"] = "嵊州";
};
};
};
[7] = {
["id"] = "330700";
["name"] = "金华";
["children"] = {
[1] = {
["id"] = "330702";
["name"] = "婺城区";
};
[2] = {
["id"] = "330703";
["name"] = "金东区";
};
[3] = {
["id"] = "330723";
["name"] = "武义县";
};
[4] = {
["id"] = "330726";
["name"] = "浦江县";
};
[5] = {
["id"] = "330727";
["name"] = "磐安县";
};
[6] = {
["id"] = "330781";
["name"] = "兰溪";
};
[7] = {
["id"] = "330782";
["name"] = "义乌";
};
[8] = {
["id"] = "330783";
["name"] = "东阳";
};
[9] = {
["id"] = "330784";
["name"] = "永康";
};
};
};
[8] = {
["id"] = "330800";
["name"] = "衢州";
["children"] = {
[1] = {
["id"] = "330802";
["name"] = "柯城区";
};
[2] = {
["id"] = "330803";
["name"] = "衢江区";
};
[3] = {
["id"] = "330822";
["name"] = "常山县";
};
[4] = {
["id"] = "330824";
["name"] = "开化县";
};
[5] = {
["id"] = "330825";
["name"] = "龙游县";
};
[6] = {
["id"] = "330881";
["name"] = "江山";
};
};
};
[9] = {
["id"] = "330900";
["name"] = "舟山";
["children"] = {
[1] = {
["id"] = "330902";
["name"] = "定海区";
};
[2] = {
["id"] = "330903";
["name"] = "普陀区";
};
[3] = {
["id"] = "330921";
["name"] = "岱山县";
};
[4] = {
["id"] = "330922";
["name"] = "嵊泗县";
};
};
};
[10] = {
["id"] = "331000";
["name"] = "台州";
["children"] = {
[1] = {
["id"] = "331002";
["name"] = "椒江区";
};
[2] = {
["id"] = "331003";
["name"] = "黄岩区";
};
[3] = {
["id"] = "331004";
["name"] = "路桥区";
};
[4] = {
["id"] = "331021";
["name"] = "玉环县";
};
[5] = {
["id"] = "331022";
["name"] = "三门县";
};
[6] = {
["id"] = "331023";
["name"] = "天台县";
};
[7] = {
["id"] = "331024";
["name"] = "仙居县";
};
[8] = {
["id"] = "331081";
["name"] = "温岭";
};
[9] = {
["id"] = "331082";
["name"] = "临海";
};
};
};
[11] = {
["id"] = "331100";
["name"] = "丽水";
["children"] = {
[1] = {
["id"] = "331102";
["name"] = "莲都区";
};
[2] = {
["id"] = "331121";
["name"] = "青田县";
};
[3] = {
["id"] = "331122";
["name"] = "缙云县";
};
[4] = {
["id"] = "331123";
["name"] = "遂昌县";
};
[5] = {
["id"] = "331124";
["name"] = "松阳县";
};
[6] = {
["id"] = "331125";
["name"] = "云和县";
};
[7] = {
["id"] = "331126";
["name"] = "庆元县";
};
[8] = {
["id"] = "331127";
["name"] = "景宁畲族自治县";
};
[9] = {
["id"] = "331181";
["name"] = "龙泉";
};
};
};
};
};
[12] = {
["id"] = "340000";
["name"] = "安徽";
["children"] = {
[1] = {
["id"] = "340100";
["name"] = "合肥";
["children"] = {
[1] = {
["id"] = "340102";
["name"] = "瑶海区";
};
[2] = {
["id"] = "340103";
["name"] = "庐阳区";
};
[3] = {
["id"] = "340104";
["name"] = "蜀山区";
};
[4] = {
["id"] = "340111";
["name"] = "包河区";
};
[5] = {
["id"] = "340121";
["name"] = "长丰县";
};
[6] = {
["id"] = "340122";
["name"] = "肥东县";
};
[7] = {
["id"] = "340123";
["name"] = "肥西县";
};
[8] = {
["id"] = "340124";
["name"] = "庐江县";
};
[9] = {
["id"] = "340181";
["name"] = "巢湖";
};
};
};
[2] = {
["id"] = "340200";
["name"] = "芜湖";
["children"] = {
[1] = {
["id"] = "340202";
["name"] = "镜湖区";
};
[2] = {
["id"] = "340203";
["name"] = "弋江区";
};
[3] = {
["id"] = "340207";
["name"] = "鸠江区";
};
[4] = {
["id"] = "340208";
["name"] = "三山区";
};
[5] = {
["id"] = "340221";
["name"] = "芜湖县";
};
[6] = {
["id"] = "340222";
["name"] = "繁昌县";
};
[7] = {
["id"] = "340223";
["name"] = "南陵县";
};
[8] = {
["id"] = "340225";
["name"] = "无为县";
};
};
};
[3] = {
["id"] = "340300";
["name"] = "蚌埠";
["children"] = {
[1] = {
["id"] = "340302";
["name"] = "龙子湖区";
};
[2] = {
["id"] = "340303";
["name"] = "蚌山区";
};
[3] = {
["id"] = "340304";
["name"] = "禹会区";
};
[4] = {
["id"] = "340311";
["name"] = "淮上区";
};
[5] = {
["id"] = "340321";
["name"] = "怀远县";
};
[6] = {
["id"] = "340322";
["name"] = "五河县";
};
[7] = {
["id"] = "340323";
["name"] = "固镇县";
};
};
};
[4] = {
["id"] = "340400";
["name"] = "淮南";
["children"] = {
[1] = {
["id"] = "340402";
["name"] = "大通区";
};
[2] = {
["id"] = "340403";
["name"] = "田家庵区";
};
[3] = {
["id"] = "340404";
["name"] = "谢家集区";
};
[4] = {
["id"] = "340405";
["name"] = "八公山区";
};
[5] = {
["id"] = "340406";
["name"] = "潘集区";
};
[6] = {
["id"] = "340421";
["name"] = "凤台县";
};
};
};
[5] = {
["id"] = "340500";
["name"] = "马鞍山";
["children"] = {
[1] = {
["id"] = "340503";
["name"] = "花山区";
};
[2] = {
["id"] = "340504";
["name"] = "雨山区";
};
[3] = {
["id"] = "340506";
["name"] = "博望区";
};
[4] = {
["id"] = "340521";
["name"] = "当涂县";
};
[5] = {
["id"] = "340522";
["name"] = "含山县";
};
[6] = {
["id"] = "340523";
["name"] = "和县";
};
};
};
[6] = {
["id"] = "340600";
["name"] = "淮北";
["children"] = {
[1] = {
["id"] = "340602";
["name"] = "杜集区";
};
[2] = {
["id"] = "340603";
["name"] = "相山区";
};
[3] = {
["id"] = "340604";
["name"] = "烈山区";
};
[4] = {
["id"] = "340621";
["name"] = "濉溪县";
};
};
};
[7] = {
["id"] = "340700";
["name"] = "铜陵";
["children"] = {
[1] = {
["id"] = "340702";
["name"] = "铜官山区";
};
[2] = {
["id"] = "340703";
["name"] = "狮子山区";
};
[3] = {
["id"] = "340711";
["name"] = "郊区";
};
[4] = {
["id"] = "340721";
["name"] = "铜陵县";
};
};
};
[8] = {
["id"] = "340800";
["name"] = "安庆";
["children"] = {
[1] = {
["id"] = "340802";
["name"] = "迎江区";
};
[2] = {
["id"] = "340803";
["name"] = "大观区";
};
[3] = {
["id"] = "340811";
["name"] = "宜秀区";
};
[4] = {
["id"] = "340822";
["name"] = "怀宁县";
};
[5] = {
["id"] = "340823";
["name"] = "枞阳县";
};
[6] = {
["id"] = "340824";
["name"] = "潜山县";
};
[7] = {
["id"] = "340825";
["name"] = "太湖县";
};
[8] = {
["id"] = "340826";
["name"] = "宿松县";
};
[9] = {
["id"] = "340827";
["name"] = "望江县";
};
[10] = {
["id"] = "340828";
["name"] = "岳西县";
};
[11] = {
["id"] = "340881";
["name"] = "桐城";
};
};
};
[9] = {
["id"] = "341000";
["name"] = "黄山";
["children"] = {
[1] = {
["id"] = "341002";
["name"] = "屯溪区";
};
[2] = {
["id"] = "341003";
["name"] = "黄山区";
};
[3] = {
["id"] = "341004";
["name"] = "徽州区";
};
[4] = {
["id"] = "341021";
["name"] = "歙县";
};
[5] = {
["id"] = "341022";
["name"] = "休宁县";
};
[6] = {
["id"] = "341023";
["name"] = "黟县";
};
[7] = {
["id"] = "341024";
["name"] = "祁门县";
};
};
};
[10] = {
["id"] = "341100";
["name"] = "滁州";
["children"] = {
[1] = {
["id"] = "341102";
["name"] = "琅琊区";
};
[2] = {
["id"] = "341103";
["name"] = "南谯区";
};
[3] = {
["id"] = "341122";
["name"] = "来安县";
};
[4] = {
["id"] = "341124";
["name"] = "全椒县";
};
[5] = {
["id"] = "341125";
["name"] = "定远县";
};
[6] = {
["id"] = "341126";
["name"] = "凤阳县";
};
[7] = {
["id"] = "341181";
["name"] = "天长";
};
[8] = {
["id"] = "341182";
["name"] = "明光";
};
};
};
[11] = {
["id"] = "341200";
["name"] = "阜阳";
["children"] = {
[1] = {
["id"] = "341202";
["name"] = "颍州区";
};
[2] = {
["id"] = "341203";
["name"] = "颍东区";
};
[3] = {
["id"] = "341204";
["name"] = "颍泉区";
};
[4] = {
["id"] = "341221";
["name"] = "临泉县";
};
[5] = {
["id"] = "341222";
["name"] = "太和县";
};
[6] = {
["id"] = "341225";
["name"] = "阜南县";
};
[7] = {
["id"] = "341226";
["name"] = "颍上县";
};
[8] = {
["id"] = "341282";
["name"] = "界首";
};
};
};
[12] = {
["id"] = "341300";
["name"] = "宿州";
["children"] = {
[1] = {
["id"] = "341302";
["name"] = "埇桥区";
};
[2] = {
["id"] = "341321";
["name"] = "砀山县";
};
[3] = {
["id"] = "341322";
["name"] = "萧县";
};
[4] = {
["id"] = "341323";
["name"] = "灵璧县";
};
[5] = {
["id"] = "341324";
["name"] = "泗县";
};
};
};
[13] = {
["id"] = "341500";
["name"] = "六安";
["children"] = {
[1] = {
["id"] = "341502";
["name"] = "金安区";
};
[2] = {
["id"] = "341503";
["name"] = "裕安区";
};
[3] = {
["id"] = "341521";
["name"] = "寿县";
};
[4] = {
["id"] = "341522";
["name"] = "霍邱县";
};
[5] = {
["id"] = "341523";
["name"] = "舒城县";
};
[6] = {
["id"] = "341524";
["name"] = "金寨县";
};
[7] = {
["id"] = "341525";
["name"] = "霍山县";
};
};
};
[14] = {
["id"] = "341600";
["name"] = "亳州";
["children"] = {
[1] = {
["id"] = "341602";
["name"] = "谯城区";
};
[2] = {
["id"] = "341621";
["name"] = "涡阳县";
};
[3] = {
["id"] = "341622";
["name"] = "蒙城县";
};
[4] = {
["id"] = "341623";
["name"] = "利辛县";
};
};
};
[15] = {
["id"] = "341700";
["name"] = "池州";
["children"] = {
[1] = {
["id"] = "341702";
["name"] = "贵池区";
};
[2] = {
["id"] = "341721";
["name"] = "东至县";
};
[3] = {
["id"] = "341722";
["name"] = "石台县";
};
[4] = {
["id"] = "341723";
["name"] = "青阳县";
};
};
};
[16] = {
["id"] = "341800";
["name"] = "宣城";
["children"] = {
[1] = {
["id"] = "341802";
["name"] = "宣州区";
};
[2] = {
["id"] = "341821";
["name"] = "郎溪县";
};
[3] = {
["id"] = "341822";
["name"] = "广德县";
};
[4] = {
["id"] = "341823";
["name"] = "泾县";
};
[5] = {
["id"] = "341824";
["name"] = "绩溪县";
};
[6] = {
["id"] = "341825";
["name"] = "旌德县";
};
[7] = {
["id"] = "341881";
["name"] = "宁国";
};
};
};
};
};
[13] = {
["id"] = "350000";
["name"] = "福建";
["children"] = {
[1] = {
["id"] = "350100";
["name"] = "福州";
["children"] = {
[1] = {
["id"] = "350102";
["name"] = "鼓楼区";
};
[2] = {
["id"] = "350103";
["name"] = "台江区";
};
[3] = {
["id"] = "350104";
["name"] = "仓山区";
};
[4] = {
["id"] = "350105";
["name"] = "马尾区";
};
[5] = {
["id"] = "350111";
["name"] = "晋安区";
};
[6] = {
["id"] = "350121";
["name"] = "闽侯县";
};
[7] = {
["id"] = "350122";
["name"] = "连江县";
};
[8] = {
["id"] = "350123";
["name"] = "罗源县";
};
[9] = {
["id"] = "350124";
["name"] = "闽清县";
};
[10] = {
["id"] = "350125";
["name"] = "永泰县";
};
[11] = {
["id"] = "350128";
["name"] = "平潭县";
};
[12] = {
["id"] = "350181";
["name"] = "福清";
};
[13] = {
["id"] = "350182";
["name"] = "长乐";
};
};
};
[2] = {
["id"] = "350200";
["name"] = "厦门";
["children"] = {
[1] = {
["id"] = "350203";
["name"] = "思明区";
};
[2] = {
["id"] = "350205";
["name"] = "海沧区";
};
[3] = {
["id"] = "350206";
["name"] = "湖里区";
};
[4] = {
["id"] = "350211";
["name"] = "集美区";
};
[5] = {
["id"] = "350212";
["name"] = "同安区";
};
[6] = {
["id"] = "350213";
["name"] = "翔安区";
};
};
};
[3] = {
["id"] = "350300";
["name"] = "莆田";
["children"] = {
[1] = {
["id"] = "350302";
["name"] = "城厢区";
};
[2] = {
["id"] = "350303";
["name"] = "涵江区";
};
[3] = {
["id"] = "350304";
["name"] = "荔城区";
};
[4] = {
["id"] = "350305";
["name"] = "秀屿区";
};
[5] = {
["id"] = "350322";
["name"] = "仙游县";
};
};
};
[4] = {
["id"] = "350400";
["name"] = "三明";
["children"] = {
[1] = {
["id"] = "350402";
["name"] = "梅列区";
};
[2] = {
["id"] = "350403";
["name"] = "三元区";
};
[3] = {
["id"] = "350421";
["name"] = "明溪县";
};
[4] = {
["id"] = "350423";
["name"] = "清流县";
};
[5] = {
["id"] = "350424";
["name"] = "宁化县";
};
[6] = {
["id"] = "350425";
["name"] = "大田县";
};
[7] = {
["id"] = "350426";
["name"] = "尤溪县";
};
[8] = {
["id"] = "350427";
["name"] = "沙县";
};
[9] = {
["id"] = "350428";
["name"] = "将乐县";
};
[10] = {
["id"] = "350429";
["name"] = "泰宁县";
};
[11] = {
["id"] = "350430";
["name"] = "建宁县";
};
[12] = {
["id"] = "350481";
["name"] = "永安";
};
};
};
[5] = {
["id"] = "350500";
["name"] = "泉州";
["children"] = {
[1] = {
["id"] = "350502";
["name"] = "鲤城区";
};
[2] = {
["id"] = "350503";
["name"] = "丰泽区";
};
[3] = {
["id"] = "350504";
["name"] = "洛江区";
};
[4] = {
["id"] = "350505";
["name"] = "泉港区";
};
[5] = {
["id"] = "350521";
["name"] = "惠安县";
};
[6] = {
["id"] = "350524";
["name"] = "安溪县";
};
[7] = {
["id"] = "350525";
["name"] = "永春县";
};
[8] = {
["id"] = "350526";
["name"] = "德化县";
};
[9] = {
["id"] = "350527";
["name"] = "金门县";
};
[10] = {
["id"] = "350581";
["name"] = "石狮";
};
[11] = {
["id"] = "350582";
["name"] = "晋江";
};
[12] = {
["id"] = "350583";
["name"] = "南安";
};
};
};
[6] = {
["id"] = "350600";
["name"] = "漳州";
["children"] = {
[1] = {
["id"] = "350602";
["name"] = "芗城区";
};
[2] = {
["id"] = "350603";
["name"] = "龙文区";
};
[3] = {
["id"] = "350622";
["name"] = "云霄县";
};
[4] = {
["id"] = "350623";
["name"] = "漳浦县";
};
[5] = {
["id"] = "350624";
["name"] = "诏安县";
};
[6] = {
["id"] = "350625";
["name"] = "长泰县";
};
[7] = {
["id"] = "350626";
["name"] = "东山县";
};
[8] = {
["id"] = "350627";
["name"] = "南靖县";
};
[9] = {
["id"] = "350628";
["name"] = "平和县";
};
[10] = {
["id"] = "350629";
["name"] = "华安县";
};
[11] = {
["id"] = "350681";
["name"] = "龙海";
};
};
};
[7] = {
["id"] = "350700";
["name"] = "南平";
["children"] = {
[1] = {
["id"] = "350702";
["name"] = "延平区";
};
[2] = {
["id"] = "350721";
["name"] = "顺昌县";
};
[3] = {
["id"] = "350722";
["name"] = "浦城县";
};
[4] = {
["id"] = "350723";
["name"] = "光泽县";
};
[5] = {
["id"] = "350724";
["name"] = "松溪县";
};
[6] = {
["id"] = "350725";
["name"] = "政和县";
};
[7] = {
["id"] = "350781";
["name"] = "邵武";
};
[8] = {
["id"] = "350782";
["name"] = "武夷山";
};
[9] = {
["id"] = "350783";
["name"] = "建瓯";
};
[10] = {
["id"] = "350784";
["name"] = "建阳";
};
};
};
[8] = {
["id"] = "350800";
["name"] = "龙岩";
["children"] = {
[1] = {
["id"] = "350802";
["name"] = "新罗区";
};
[2] = {
["id"] = "350821";
["name"] = "长汀县";
};
[3] = {
["id"] = "350822";
["name"] = "永定县";
};
[4] = {
["id"] = "350823";
["name"] = "上杭县";
};
[5] = {
["id"] = "350824";
["name"] = "武平县";
};
[6] = {
["id"] = "350825";
["name"] = "连城县";
};
[7] = {
["id"] = "350881";
["name"] = "漳平";
};
};
};
[9] = {
["id"] = "350900";
["name"] = "宁德";
["children"] = {
[1] = {
["id"] = "350902";
["name"] = "蕉城区";
};
[2] = {
["id"] = "350921";
["name"] = "霞浦县";
};
[3] = {
["id"] = "350922";
["name"] = "古田县";
};
[4] = {
["id"] = "350923";
["name"] = "屏南县";
};
[5] = {
["id"] = "350924";
["name"] = "寿宁县";
};
[6] = {
["id"] = "350925";
["name"] = "周宁县";
};
[7] = {
["id"] = "350926";
["name"] = "柘荣县";
};
[8] = {
["id"] = "350981";
["name"] = "福安";
};
[9] = {
["id"] = "350982";
["name"] = "福鼎";
};
};
};
};
};
[14] = {
["id"] = "360000";
["name"] = "江西";
["children"] = {
[1] = {
["id"] = "360100";
["name"] = "南昌";
["children"] = {
[1] = {
["id"] = "360102";
["name"] = "东湖区";
};
[2] = {
["id"] = "360103";
["name"] = "西湖区";
};
[3] = {
["id"] = "360104";
["name"] = "青云谱区";
};
[4] = {
["id"] = "360105";
["name"] = "湾里区";
};
[5] = {
["id"] = "360111";
["name"] = "青山湖区";
};
[6] = {
["id"] = "360121";
["name"] = "南昌县";
};
[7] = {
["id"] = "360122";
["name"] = "新建县";
};
[8] = {
["id"] = "360123";
["name"] = "安义县";
};
[9] = {
["id"] = "360124";
["name"] = "进贤县";
};
};
};
[2] = {
["id"] = "360200";
["name"] = "景德镇";
["children"] = {
[1] = {
["id"] = "360202";
["name"] = "昌江区";
};
[2] = {
["id"] = "360203";
["name"] = "珠山区";
};
[3] = {
["id"] = "360222";
["name"] = "浮梁县";
};
[4] = {
["id"] = "360281";
["name"] = "乐平";
};
};
};
[3] = {
["id"] = "360300";
["name"] = "萍乡";
["children"] = {
[1] = {
["id"] = "360302";
["name"] = "安源区";
};
[2] = {
["id"] = "360313";
["name"] = "湘东区";
};
[3] = {
["id"] = "360321";
["name"] = "莲花县";
};
[4] = {
["id"] = "360322";
["name"] = "上栗县";
};
[5] = {
["id"] = "360323";
["name"] = "芦溪县";
};
};
};
[4] = {
["id"] = "360400";
["name"] = "九江";
["children"] = {
[1] = {
["id"] = "360402";
["name"] = "庐山区";
};
[2] = {
["id"] = "360403";
["name"] = "浔阳区";
};
[3] = {
["id"] = "360421";
["name"] = "九江县";
};
[4] = {
["id"] = "360423";
["name"] = "武宁县";
};
[5] = {
["id"] = "360424";
["name"] = "修水县";
};
[6] = {
["id"] = "360425";
["name"] = "永修县";
};
[7] = {
["id"] = "360426";
["name"] = "德安县";
};
[8] = {
["id"] = "360427";
["name"] = "星子县";
};
[9] = {
["id"] = "360428";
["name"] = "都昌县";
};
[10] = {
["id"] = "360429";
["name"] = "湖口县";
};
[11] = {
["id"] = "360430";
["name"] = "彭泽县";
};
[12] = {
["id"] = "360481";
["name"] = "瑞昌";
};
[13] = {
["id"] = "360482";
["name"] = "共青城";
};
};
};
[5] = {
["id"] = "360500";
["name"] = "新余";
["children"] = {
[1] = {
["id"] = "360502";
["name"] = "渝水区";
};
[2] = {
["id"] = "360521";
["name"] = "分宜县";
};
};
};
[6] = {
["id"] = "360600";
["name"] = "鹰潭";
["children"] = {
[1] = {
["id"] = "360602";
["name"] = "月湖区";
};
[2] = {
["id"] = "360622";
["name"] = "余江县";
};
[3] = {
["id"] = "360681";
["name"] = "贵溪";
};
};
};
[7] = {
["id"] = "360700";
["name"] = "赣州";
["children"] = {
[1] = {
["id"] = "360702";
["name"] = "章贡区";
};
[2] = {
["id"] = "360721";
["name"] = "赣县";
};
[3] = {
["id"] = "360722";
["name"] = "信丰县";
};
[4] = {
["id"] = "360723";
["name"] = "大余县";
};
[5] = {
["id"] = "360724";
["name"] = "上犹县";
};
[6] = {
["id"] = "360725";
["name"] = "崇义县";
};
[7] = {
["id"] = "360726";
["name"] = "安远县";
};
[8] = {
["id"] = "360727";
["name"] = "龙南县";
};
[9] = {
["id"] = "360728";
["name"] = "定南县";
};
[10] = {
["id"] = "360729";
["name"] = "全南县";
};
[11] = {
["id"] = "360730";
["name"] = "宁都县";
};
[12] = {
["id"] = "360731";
["name"] = "于都县";
};
[13] = {
["id"] = "360732";
["name"] = "兴国县";
};
[14] = {
["id"] = "360733";
["name"] = "会昌县";
};
[15] = {
["id"] = "360734";
["name"] = "寻乌县";
};
[16] = {
["id"] = "360735";
["name"] = "石城县";
};
[17] = {
["id"] = "360781";
["name"] = "瑞金";
};
[18] = {
["id"] = "360782";
["name"] = "南康";
};
};
};
[8] = {
["id"] = "360800";
["name"] = "吉安";
["children"] = {
[1] = {
["id"] = "360802";
["name"] = "吉州区";
};
[2] = {
["id"] = "360803";
["name"] = "青原区";
};
[3] = {
["id"] = "360821";
["name"] = "吉安县";
};
[4] = {
["id"] = "360822";
["name"] = "吉水县";
};
[5] = {
["id"] = "360823";
["name"] = "峡江县";
};
[6] = {
["id"] = "360824";
["name"] = "新干县";
};
[7] = {
["id"] = "360825";
["name"] = "永丰县";
};
[8] = {
["id"] = "360826";
["name"] = "泰和县";
};
[9] = {
["id"] = "360827";
["name"] = "遂川县";
};
[10] = {
["id"] = "360828";
["name"] = "万安县";
};
[11] = {
["id"] = "360829";
["name"] = "安福县";
};
[12] = {
["id"] = "360830";
["name"] = "永新县";
};
[13] = {
["id"] = "360881";
["name"] = "井冈山";
};
};
};
[9] = {
["id"] = "360900";
["name"] = "宜春";
["children"] = {
[1] = {
["id"] = "360902";
["name"] = "袁州区";
};
[2] = {
["id"] = "360921";
["name"] = "奉新县";
};
[3] = {
["id"] = "360922";
["name"] = "万载县";
};
[4] = {
["id"] = "360923";
["name"] = "上高县";
};
[5] = {
["id"] = "360924";
["name"] = "宜丰县";
};
[6] = {
["id"] = "360925";
["name"] = "靖安县";
};
[7] = {
["id"] = "360926";
["name"] = "铜鼓县";
};
[8] = {
["id"] = "360981";
["name"] = "丰城";
};
[9] = {
["id"] = "360982";
["name"] = "樟树";
};
[10] = {
["id"] = "360983";
["name"] = "高安";
};
};
};
[10] = {
["id"] = "361000";
["name"] = "抚州";
["children"] = {
[1] = {
["id"] = "361002";
["name"] = "临川区";
};
[2] = {
["id"] = "361021";
["name"] = "南城县";
};
[3] = {
["id"] = "361022";
["name"] = "黎川县";
};
[4] = {
["id"] = "361023";
["name"] = "南丰县";
};
[5] = {
["id"] = "361024";
["name"] = "崇仁县";
};
[6] = {
["id"] = "361025";
["name"] = "乐安县";
};
[7] = {
["id"] = "361026";
["name"] = "宜黄县";
};
[8] = {
["id"] = "361027";
["name"] = "金溪县";
};
[9] = {
["id"] = "361028";
["name"] = "资溪县";
};
[10] = {
["id"] = "361029";
["name"] = "东乡县";
};
[11] = {
["id"] = "361030";
["name"] = "广昌县";
};
};
};
[11] = {
["id"] = "361100";
["name"] = "上饶";
["children"] = {
[1] = {
["id"] = "361102";
["name"] = "信州区";
};
[2] = {
["id"] = "361121";
["name"] = "上饶县";
};
[3] = {
["id"] = "361122";
["name"] = "广丰县";
};
[4] = {
["id"] = "361123";
["name"] = "玉山县";
};
[5] = {
["id"] = "361124";
["name"] = "铅山县";
};
[6] = {
["id"] = "361125";
["name"] = "横峰县";
};
[7] = {
["id"] = "361126";
["name"] = "弋阳县";
};
[8] = {
["id"] = "361127";
["name"] = "余干县";
};
[9] = {
["id"] = "361128";
["name"] = "鄱阳县";
};
[10] = {
["id"] = "361129";
["name"] = "万年县";
};
[11] = {
["id"] = "361130";
["name"] = "婺源县";
};
[12] = {
["id"] = "361181";
["name"] = "德兴";
};
};
};
};
};
[15] = {
["id"] = "370000";
["name"] = "山东";
["children"] = {
[1] = {
["id"] = "370100";
["name"] = "济南";
["children"] = {
[1] = {
["id"] = "370102";
["name"] = "历下区";
};
[2] = {
["id"] = "370103";
["name"] = "中区";
};
[3] = {
["id"] = "370104";
["name"] = "槐荫区";
};
[4] = {
["id"] = "370105";
["name"] = "天桥区";
};
[5] = {
["id"] = "370112";
["name"] = "历城区";
};
[6] = {
["id"] = "370113";
["name"] = "长清区";
};
[7] = {
["id"] = "370124";
["name"] = "平阴县";
};
[8] = {
["id"] = "370125";
["name"] = "济阳县";
};
[9] = {
["id"] = "370126";
["name"] = "商河县";
};
[10] = {
["id"] = "370181";
["name"] = "章丘";
};
};
};
[2] = {
["id"] = "370200";
["name"] = "青岛";
["children"] = {
[1] = {
["id"] = "370202";
["name"] = "南区";
};
[2] = {
["id"] = "370203";
["name"] = "北区";
};
[3] = {
["id"] = "370211";
["name"] = "黄岛区";
};
[4] = {
["id"] = "370212";
["name"] = "崂山区";
};
[5] = {
["id"] = "370213";
["name"] = "李沧区";
};
[6] = {
["id"] = "370214";
["name"] = "城阳区";
};
[7] = {
["id"] = "370281";
["name"] = "胶州";
};
[8] = {
["id"] = "370282";
["name"] = "即墨";
};
[9] = {
["id"] = "370283";
["name"] = "平度";
};
[10] = {
["id"] = "370285";
["name"] = "莱西";
};
};
};
[3] = {
["id"] = "370300";
["name"] = "淄博";
["children"] = {
[1] = {
["id"] = "370302";
["name"] = "淄川区";
};
[2] = {
["id"] = "370303";
["name"] = "张店区";
};
[3] = {
["id"] = "370304";
["name"] = "博山区";
};
[4] = {
["id"] = "370305";
["name"] = "临淄区";
};
[5] = {
["id"] = "370306";
["name"] = "周村区";
};
[6] = {
["id"] = "370321";
["name"] = "桓台县";
};
[7] = {
["id"] = "370322";
["name"] = "高青县";
};
[8] = {
["id"] = "370323";
["name"] = "沂源县";
};
};
};
[4] = {
["id"] = "370400";
["name"] = "枣庄";
["children"] = {
[1] = {
["id"] = "370402";
["name"] = "中区";
};
[2] = {
["id"] = "370403";
["name"] = "薛城区";
};
[3] = {
["id"] = "370404";
["name"] = "峄城区";
};
[4] = {
["id"] = "370405";
["name"] = "台儿庄区";
};
[5] = {
["id"] = "370406";
["name"] = "山亭区";
};
[6] = {
["id"] = "370481";
["name"] = "滕州";
};
};
};
[5] = {
["id"] = "370500";
["name"] = "东营";
["children"] = {
[1] = {
["id"] = "370502";
["name"] = "东营区";
};
[2] = {
["id"] = "370503";
["name"] = "河口区";
};
[3] = {
["id"] = "370521";
["name"] = "垦利县";
};
[4] = {
["id"] = "370522";
["name"] = "利津县";
};
[5] = {
["id"] = "370523";
["name"] = "广饶县";
};
};
};
[6] = {
["id"] = "370600";
["name"] = "烟台";
["children"] = {
[1] = {
["id"] = "370602";
["name"] = "芝罘区";
};
[2] = {
["id"] = "370611";
["name"] = "福山区";
};
[3] = {
["id"] = "370612";
["name"] = "牟平区";
};
[4] = {
["id"] = "370613";
["name"] = "莱山区";
};
[5] = {
["id"] = "370634";
["name"] = "长岛县";
};
[6] = {
["id"] = "370681";
["name"] = "龙口";
};
[7] = {
["id"] = "370682";
["name"] = "莱阳";
};
[8] = {
["id"] = "370683";
["name"] = "莱州";
};
[9] = {
["id"] = "370684";
["name"] = "蓬莱";
};
[10] = {
["id"] = "370685";
["name"] = "招远";
};
[11] = {
["id"] = "370686";
["name"] = "栖霞";
};
[12] = {
["id"] = "370687";
["name"] = "海阳";
};
};
};
[7] = {
["id"] = "370700";
["name"] = "潍坊";
["children"] = {
[1] = {
["id"] = "370702";
["name"] = "潍城区";
};
[2] = {
["id"] = "370703";
["name"] = "寒亭区";
};
[3] = {
["id"] = "370704";
["name"] = "坊子区";
};
[4] = {
["id"] = "370705";
["name"] = "奎文区";
};
[5] = {
["id"] = "370724";
["name"] = "临朐县";
};
[6] = {
["id"] = "370725";
["name"] = "昌乐县";
};
[7] = {
["id"] = "370781";
["name"] = "青州";
};
[8] = {
["id"] = "370782";
["name"] = "诸城";
};
[9] = {
["id"] = "370783";
["name"] = "寿光";
};
[10] = {
["id"] = "370784";
["name"] = "安丘";
};
[11] = {
["id"] = "370785";
["name"] = "高密";
};
[12] = {
["id"] = "370786";
["name"] = "昌邑";
};
};
};
[8] = {
["id"] = "370800";
["name"] = "济宁";
["children"] = {
[1] = {
["id"] = "370802";
["name"] = "中区";
};
[2] = {
["id"] = "370811";
["name"] = "任城区";
};
[3] = {
["id"] = "370826";
["name"] = "微山县";
};
[4] = {
["id"] = "370827";
["name"] = "鱼台县";
};
[5] = {
["id"] = "370828";
["name"] = "金乡县";
};
[6] = {
["id"] = "370829";
["name"] = "嘉祥县";
};
[7] = {
["id"] = "370830";
["name"] = "汶上县";
};
[8] = {
["id"] = "370831";
["name"] = "泗水县";
};
[9] = {
["id"] = "370832";
["name"] = "梁山县";
};
[10] = {
["id"] = "370881";
["name"] = "曲阜";
};
[11] = {
["id"] = "370882";
["name"] = "兖州";
};
[12] = {
["id"] = "370883";
["name"] = "邹城";
};
};
};
[9] = {
["id"] = "370900";
["name"] = "泰安";
["children"] = {
[1] = {
["id"] = "370902";
["name"] = "泰山区";
};
[2] = {
["id"] = "370911";
["name"] = "岱岳区";
};
[3] = {
["id"] = "370921";
["name"] = "宁阳县";
};
[4] = {
["id"] = "370923";
["name"] = "东平县";
};
[5] = {
["id"] = "370982";
["name"] = "新泰";
};
[6] = {
["id"] = "370983";
["name"] = "肥城";
};
};
};
[10] = {
["id"] = "371000";
["name"] = "威海";
["children"] = {
[1] = {
["id"] = "371002";
["name"] = "环翠区";
};
[2] = {
["id"] = "371081";
["name"] = "文登";
};
[3] = {
["id"] = "371082";
["name"] = "荣成";
};
[4] = {
["id"] = "371083";
["name"] = "乳山";
};
};
};
[11] = {
["id"] = "371100";
["name"] = "日照";
["children"] = {
[1] = {
["id"] = "371102";
["name"] = "东港区";
};
[2] = {
["id"] = "371103";
["name"] = "岚山区";
};
[3] = {
["id"] = "371121";
["name"] = "五莲县";
};
[4] = {
["id"] = "371122";
["name"] = "莒县";
};
};
};
[12] = {
["id"] = "371200";
["name"] = "莱芜";
["children"] = {
[1] = {
["id"] = "371202";
["name"] = "莱城区";
};
[2] = {
["id"] = "371203";
["name"] = "钢城区";
};
};
};
[13] = {
["id"] = "371300";
["name"] = "临沂";
["children"] = {
[1] = {
["id"] = "371302";
["name"] = "兰山区";
};
[2] = {
["id"] = "371311";
["name"] = "罗庄区";
};
[3] = {
["id"] = "371312";
["name"] = "河东区";
};
[4] = {
["id"] = "371321";
["name"] = "沂南县";
};
[5] = {
["id"] = "371322";
["name"] = "郯城县";
};
[6] = {
["id"] = "371323";
["name"] = "沂水县";
};
[7] = {
["id"] = "371324";
["name"] = "苍山县";
};
[8] = {
["id"] = "371325";
["name"] = "费县";
};
[9] = {
["id"] = "371326";
["name"] = "平邑县";
};
[10] = {
["id"] = "371327";
["name"] = "莒南县";
};
[11] = {
["id"] = "371328";
["name"] = "蒙阴县";
};
[12] = {
["id"] = "371329";
["name"] = "临沭县";
};
};
};
[14] = {
["id"] = "371400";
["name"] = "德州";
["children"] = {
[1] = {
["id"] = "371402";
["name"] = "德城区";
};
[2] = {
["id"] = "371421";
["name"] = "陵县";
};
[3] = {
["id"] = "371422";
["name"] = "宁津县";
};
[4] = {
["id"] = "371423";
["name"] = "庆云县";
};
[5] = {
["id"] = "371424";
["name"] = "临邑县";
};
[6] = {
["id"] = "371425";
["name"] = "齐河县";
};
[7] = {
["id"] = "371426";
["name"] = "平原县";
};
[8] = {
["id"] = "371427";
["name"] = "夏津县";
};
[9] = {
["id"] = "371428";
["name"] = "武城县";
};
[10] = {
["id"] = "371481";
["name"] = "乐陵";
};
[11] = {
["id"] = "371482";
["name"] = "禹城";
};
};
};
[15] = {
["id"] = "371500";
["name"] = "聊城";
["children"] = {
[1] = {
["id"] = "371502";
["name"] = "东昌府区";
};
[2] = {
["id"] = "371521";
["name"] = "阳谷县";
};
[3] = {
["id"] = "371522";
["name"] = "莘县";
};
[4] = {
["id"] = "371523";
["name"] = "茌平县";
};
[5] = {
["id"] = "371524";
["name"] = "东阿县";
};
[6] = {
["id"] = "371525";
["name"] = "冠县";
};
[7] = {
["id"] = "371526";
["name"] = "高唐县";
};
[8] = {
["id"] = "371581";
["name"] = "临清";
};
};
};
[16] = {
["id"] = "371600";
["name"] = "滨州";
["children"] = {
[1] = {
["id"] = "371602";
["name"] = "滨城区";
};
[2] = {
["id"] = "371621";
["name"] = "惠民县";
};
[3] = {
["id"] = "371622";
["name"] = "阳信县";
};
[4] = {
["id"] = "371623";
["name"] = "无棣县";
};
[5] = {
["id"] = "371624";
["name"] = "沾化县";
};
[6] = {
["id"] = "371625";
["name"] = "博兴县";
};
[7] = {
["id"] = "371626";
["name"] = "邹平县";
};
};
};
[17] = {
["id"] = "371700";
["name"] = "菏泽";
["children"] = {
[1] = {
["id"] = "371702";
["name"] = "牡丹区";
};
[2] = {
["id"] = "371721";
["name"] = "曹县";
};
[3] = {
["id"] = "371722";
["name"] = "单县";
};
[4] = {
["id"] = "371723";
["name"] = "成武县";
};
[5] = {
["id"] = "371724";
["name"] = "巨野县";
};
[6] = {
["id"] = "371725";
["name"] = "郓城县";
};
[7] = {
["id"] = "371726";
["name"] = "鄄城县";
};
[8] = {
["id"] = "371727";
["name"] = "定陶县";
};
[9] = {
["id"] = "371728";
["name"] = "东明县";
};
};
};
};
};
[16] = {
["id"] = "410000";
["name"] = "河南";
["children"] = {
[1] = {
["id"] = "410100";
["name"] = "郑州";
["children"] = {
[1] = {
["id"] = "410102";
["name"] = "中原区";
};
[2] = {
["id"] = "410103";
["name"] = "二七区";
};
[3] = {
["id"] = "410104";
["name"] = "管城回族区";
};
[4] = {
["id"] = "410105";
["name"] = "金水区";
};
[5] = {
["id"] = "410106";
["name"] = "上街区";
};
[6] = {
["id"] = "410108";
["name"] = "惠济区";
};
[7] = {
["id"] = "410122";
["name"] = "中牟县";
};
[8] = {
["id"] = "410181";
["name"] = "巩义";
};
[9] = {
["id"] = "410182";
["name"] = "荥阳";
};
[10] = {
["id"] = "410183";
["name"] = "新密";
};
[11] = {
["id"] = "410184";
["name"] = "新郑";
};
[12] = {
["id"] = "410185";
["name"] = "登封";
};
};
};
[2] = {
["id"] = "410200";
["name"] = "开封";
["children"] = {
[1] = {
["id"] = "410202";
["name"] = "龙亭区";
};
[2] = {
["id"] = "410203";
["name"] = "顺河回族区";
};
[3] = {
["id"] = "410204";
["name"] = "鼓楼区";
};
[4] = {
["id"] = "410205";
["name"] = "禹王台区";
};
[5] = {
["id"] = "410211";
["name"] = "金明区";
};
[6] = {
["id"] = "410221";
["name"] = "杞县";
};
[7] = {
["id"] = "410222";
["name"] = "通许县";
};
[8] = {
["id"] = "410223";
["name"] = "尉氏县";
};
[9] = {
["id"] = "410224";
["name"] = "开封县";
};
[10] = {
["id"] = "410225";
["name"] = "兰考县";
};
};
};
[3] = {
["id"] = "410300";
["name"] = "洛阳";
["children"] = {
[1] = {
["id"] = "410302";
["name"] = "老城区";
};
[2] = {
["id"] = "410303";
["name"] = "西工区";
};
[3] = {
["id"] = "410304";
["name"] = "瀍河回族区";
};
[4] = {
["id"] = "410305";
["name"] = "涧西区";
};
[5] = {
["id"] = "410306";
["name"] = "吉利区";
};
[6] = {
["id"] = "410311";
["name"] = "洛龙区";
};
[7] = {
["id"] = "410322";
["name"] = "孟津县";
};
[8] = {
["id"] = "410323";
["name"] = "新安县";
};
[9] = {
["id"] = "410324";
["name"] = "栾川县";
};
[10] = {
["id"] = "410325";
["name"] = "嵩县";
};
[11] = {
["id"] = "410326";
["name"] = "汝阳县";
};
[12] = {
["id"] = "410327";
["name"] = "宜阳县";
};
[13] = {
["id"] = "410328";
["name"] = "洛宁县";
};
[14] = {
["id"] = "410329";
["name"] = "伊川县";
};
[15] = {
["id"] = "410381";
["name"] = "偃师";
};
};
};
[4] = {
["id"] = "410400";
["name"] = "平顶山";
["children"] = {
[1] = {
["id"] = "410402";
["name"] = "新华区";
};
[2] = {
["id"] = "410403";
["name"] = "卫东区";
};
[3] = {
["id"] = "410404";
["name"] = "石龙区";
};
[4] = {
["id"] = "410411";
["name"] = "湛河区";
};
[5] = {
["id"] = "410421";
["name"] = "宝丰县";
};
[6] = {
["id"] = "410422";
["name"] = "叶县";
};
[7] = {
["id"] = "410423";
["name"] = "鲁山县";
};
[8] = {
["id"] = "410425";
["name"] = "郏县";
};
[9] = {
["id"] = "410481";
["name"] = "舞钢";
};
[10] = {
["id"] = "410482";
["name"] = "汝州";
};
};
};
[5] = {
["id"] = "410500";
["name"] = "安阳";
["children"] = {
[1] = {
["id"] = "410502";
["name"] = "文峰区";
};
[2] = {
["id"] = "410503";
["name"] = "北关区";
};
[3] = {
["id"] = "410505";
["name"] = "殷都区";
};
[4] = {
["id"] = "410506";
["name"] = "龙安区";
};
[5] = {
["id"] = "410522";
["name"] = "安阳县";
};
[6] = {
["id"] = "410523";
["name"] = "汤阴县";
};
[7] = {
["id"] = "410526";
["name"] = "滑县";
};
[8] = {
["id"] = "410527";
["name"] = "内黄县";
};
[9] = {
["id"] = "410581";
["name"] = "林州";
};
};
};
[6] = {
["id"] = "410600";
["name"] = "鹤壁";
["children"] = {
[1] = {
["id"] = "410602";
["name"] = "鹤山区";
};
[2] = {
["id"] = "410603";
["name"] = "山城区";
};
[3] = {
["id"] = "410611";
["name"] = "淇滨区";
};
[4] = {
["id"] = "410621";
["name"] = "浚县";
};
[5] = {
["id"] = "410622";
["name"] = "淇县";
};
};
};
[7] = {
["id"] = "410700";
["name"] = "新乡";
["children"] = {
[1] = {
["id"] = "410702";
["name"] = "红旗区";
};
[2] = {
["id"] = "410703";
["name"] = "卫滨区";
};
[3] = {
["id"] = "410704";
["name"] = "凤泉区";
};
[4] = {
["id"] = "410711";
["name"] = "牧野区";
};
[5] = {
["id"] = "410721";
["name"] = "新乡县";
};
[6] = {
["id"] = "410724";
["name"] = "获嘉县";
};
[7] = {
["id"] = "410725";
["name"] = "原阳县";
};
[8] = {
["id"] = "410726";
["name"] = "延津县";
};
[9] = {
["id"] = "410727";
["name"] = "封丘县";
};
[10] = {
["id"] = "410728";
["name"] = "长垣县";
};
[11] = {
["id"] = "410781";
["name"] = "卫辉";
};
[12] = {
["id"] = "410782";
["name"] = "辉县";
};
};
};
[8] = {
["id"] = "410800";
["name"] = "焦作";
["children"] = {
[1] = {
["id"] = "410802";
["name"] = "解放区";
};
[2] = {
["id"] = "410803";
["name"] = "中站区";
};
[3] = {
["id"] = "410804";
["name"] = "马村区";
};
[4] = {
["id"] = "410811";
["name"] = "山阳区";
};
[5] = {
["id"] = "410821";
["name"] = "修武县";
};
[6] = {
["id"] = "410822";
["name"] = "博爱县";
};
[7] = {
["id"] = "410823";
["name"] = "武陟县";
};
[8] = {
["id"] = "410825";
["name"] = "温县";
};
[9] = {
["id"] = "410882";
["name"] = "沁阳";
};
[10] = {
["id"] = "410883";
["name"] = "孟州";
};
};
};
[9] = {
["id"] = "410900";
["name"] = "濮阳";
["children"] = {
[1] = {
["id"] = "410902";
["name"] = "华龙区";
};
[2] = {
["id"] = "410922";
["name"] = "清丰县";
};
[3] = {
["id"] = "410923";
["name"] = "南乐县";
};
[4] = {
["id"] = "410926";
["name"] = "范县";
};
[5] = {
["id"] = "410927";
["name"] = "台前县";
};
[6] = {
["id"] = "410928";
["name"] = "濮阳县";
};
};
};
[10] = {
["id"] = "411000";
["name"] = "许昌";
["children"] = {
[1] = {
["id"] = "411002";
["name"] = "魏都区";
};
[2] = {
["id"] = "411023";
["name"] = "许昌县";
};
[3] = {
["id"] = "411024";
["name"] = "鄢陵县";
};
[4] = {
["id"] = "411025";
["name"] = "襄城县";
};
[5] = {
["id"] = "411081";
["name"] = "禹州";
};
[6] = {
["id"] = "411082";
["name"] = "长葛";
};
};
};
[11] = {
["id"] = "411100";
["name"] = "漯河";
["children"] = {
[1] = {
["id"] = "411102";
["name"] = "源汇区";
};
[2] = {
["id"] = "411103";
["name"] = "郾城区";
};
[3] = {
["id"] = "411104";
["name"] = "召陵区";
};
[4] = {
["id"] = "411121";
["name"] = "舞阳县";
};
[5] = {
["id"] = "411122";
["name"] = "临颍县";
};
};
};
[12] = {
["id"] = "411200";
["name"] = "三门峡";
["children"] = {
[1] = {
["id"] = "411202";
["name"] = "湖滨区";
};
[2] = {
["id"] = "411221";
["name"] = "渑池县";
};
[3] = {
["id"] = "411222";
["name"] = "陕县";
};
[4] = {
["id"] = "411224";
["name"] = "卢氏县";
};
[5] = {
["id"] = "411281";
["name"] = "义马";
};
[6] = {
["id"] = "411282";
["name"] = "灵宝";
};
};
};
[13] = {
["id"] = "411300";
["name"] = "南阳";
["children"] = {
[1] = {
["id"] = "411302";
["name"] = "宛城区";
};
[2] = {
["id"] = "411303";
["name"] = "卧龙区";
};
[3] = {
["id"] = "411321";
["name"] = "南召县";
};
[4] = {
["id"] = "411322";
["name"] = "方城县";
};
[5] = {
["id"] = "411323";
["name"] = "西峡县";
};
[6] = {
["id"] = "411324";
["name"] = "镇平县";
};
[7] = {
["id"] = "411325";
["name"] = "内乡县";
};
[8] = {
["id"] = "411326";
["name"] = "淅川县";
};
[9] = {
["id"] = "411327";
["name"] = "社旗县";
};
[10] = {
["id"] = "411328";
["name"] = "唐河县";
};
[11] = {
["id"] = "411329";
["name"] = "新野县";
};
[12] = {
["id"] = "411330";
["name"] = "桐柏县";
};
[13] = {
["id"] = "411381";
["name"] = "邓州";
};
};
};
[14] = {
["id"] = "411400";
["name"] = "商丘";
["children"] = {
[1] = {
["id"] = "411402";
["name"] = "梁园区";
};
[2] = {
["id"] = "411403";
["name"] = "睢阳区";
};
[3] = {
["id"] = "411421";
["name"] = "民权县";
};
[4] = {
["id"] = "411422";
["name"] = "睢县";
};
[5] = {
["id"] = "411423";
["name"] = "宁陵县";
};
[6] = {
["id"] = "411424";
["name"] = "柘城县";
};
[7] = {
["id"] = "411425";
["name"] = "虞城县";
};
[8] = {
["id"] = "411426";
["name"] = "夏邑县";
};
[9] = {
["id"] = "411481";
["name"] = "永城";
};
};
};
[15] = {
["id"] = "411500";
["name"] = "信阳";
["children"] = {
[1] = {
["id"] = "411502";
["name"] = "浉河区";
};
[2] = {
["id"] = "411503";
["name"] = "平桥区";
};
[3] = {
["id"] = "411521";
["name"] = "罗山县";
};
[4] = {
["id"] = "411522";
["name"] = "光山县";
};
[5] = {
["id"] = "411523";
["name"] = "新县";
};
[6] = {
["id"] = "411524";
["name"] = "商城县";
};
[7] = {
["id"] = "411525";
["name"] = "固始县";
};
[8] = {
["id"] = "411526";
["name"] = "潢川县";
};
[9] = {
["id"] = "411527";
["name"] = "淮滨县";
};
[10] = {
["id"] = "411528";
["name"] = "息县";
};
};
};
[16] = {
["id"] = "411600";
["name"] = "周口";
["children"] = {
[1] = {
["id"] = "411602";
["name"] = "川汇区";
};
[2] = {
["id"] = "411621";
["name"] = "扶沟县";
};
[3] = {
["id"] = "411622";
["name"] = "西华县";
};
[4] = {
["id"] = "411623";
["name"] = "商水县";
};
[5] = {
["id"] = "411624";
["name"] = "沈丘县";
};
[6] = {
["id"] = "411625";
["name"] = "郸城县";
};
[7] = {
["id"] = "411626";
["name"] = "淮阳县";
};
[8] = {
["id"] = "411627";
["name"] = "太康县";
};
[9] = {
["id"] = "411628";
["name"] = "鹿邑县";
};
[10] = {
["id"] = "411681";
["name"] = "项城";
};
};
};
[17] = {
["id"] = "411700";
["name"] = "驻马店";
["children"] = {
[1] = {
["id"] = "411702";
["name"] = "驿城区";
};
[2] = {
["id"] = "411721";
["name"] = "西平县";
};
[3] = {
["id"] = "411722";
["name"] = "上蔡县";
};
[4] = {
["id"] = "411723";
["name"] = "平舆县";
};
[5] = {
["id"] = "411724";
["name"] = "正阳县";
};
[6] = {
["id"] = "411725";
["name"] = "确山县";
};
[7] = {
["id"] = "411726";
["name"] = "泌阳县";
};
[8] = {
["id"] = "411727";
["name"] = "汝南县";
};
[9] = {
["id"] = "411728";
["name"] = "遂平县";
};
[10] = {
["id"] = "411729";
["name"] = "新蔡县";
};
};
};
[18] = {
["id"] = "419001";
["name"] = "济源";
};
};
};
[17] = {
["id"] = "420000";
["name"] = "湖北";
["children"] = {
[1] = {
["id"] = "420100";
["name"] = "武汉";
["children"] = {
[1] = {
["id"] = "420102";
["name"] = "江岸区";
};
[2] = {
["id"] = "420103";
["name"] = "江汉区";
};
[3] = {
["id"] = "420104";
["name"] = "硚口区";
};
[4] = {
["id"] = "420105";
["name"] = "汉阳区";
};
[5] = {
["id"] = "420106";
["name"] = "武昌区";
};
[6] = {
["id"] = "420107";
["name"] = "青山区";
};
[7] = {
["id"] = "420111";
["name"] = "洪山区";
};
[8] = {
["id"] = "420112";
["name"] = "东西湖区";
};
[9] = {
["id"] = "420113";
["name"] = "汉南区";
};
[10] = {
["id"] = "420114";
["name"] = "蔡甸区";
};
[11] = {
["id"] = "420115";
["name"] = "江夏区";
};
[12] = {
["id"] = "420116";
["name"] = "黄陂区";
};
[13] = {
["id"] = "420117";
["name"] = "新洲区";
};
};
};
[2] = {
["id"] = "420200";
["name"] = "黄石";
["children"] = {
[1] = {
["id"] = "420202";
["name"] = "黄石港区";
};
[2] = {
["id"] = "420203";
["name"] = "西塞山区";
};
[3] = {
["id"] = "420204";
["name"] = "下陆区";
};
[4] = {
["id"] = "420205";
["name"] = "铁山区";
};
[5] = {
["id"] = "420222";
["name"] = "阳新县";
};
[6] = {
["id"] = "420281";
["name"] = "大冶";
};
};
};
[3] = {
["id"] = "420300";
["name"] = "十堰";
["children"] = {
[1] = {
["id"] = "420302";
["name"] = "茅箭区";
};
[2] = {
["id"] = "420303";
["name"] = "张湾区";
};
[3] = {
["id"] = "420321";
["name"] = "郧县";
};
[4] = {
["id"] = "420322";
["name"] = "郧西县";
};
[5] = {
["id"] = "420323";
["name"] = "竹山县";
};
[6] = {
["id"] = "420324";
["name"] = "竹溪县";
};
[7] = {
["id"] = "420325";
["name"] = "房县";
};
[8] = {
["id"] = "420381";
["name"] = "丹江口";
};
};
};
[4] = {
["id"] = "420500";
["name"] = "宜昌";
["children"] = {
[1] = {
["id"] = "420502";
["name"] = "西陵区";
};
[2] = {
["id"] = "420503";
["name"] = "伍家岗区";
};
[3] = {
["id"] = "420504";
["name"] = "点军区";
};
[4] = {
["id"] = "420505";
["name"] = "猇亭区";
};
[5] = {
["id"] = "420506";
["name"] = "夷陵区";
};
[6] = {
["id"] = "420525";
["name"] = "远安县";
};
[7] = {
["id"] = "420526";
["name"] = "兴山县";
};
[8] = {
["id"] = "420527";
["name"] = "秭归县";
};
[9] = {
["id"] = "420528";
["name"] = "长阳土家族自治县";
};
[10] = {
["id"] = "420529";
["name"] = "五峰土家族自治县";
};
[11] = {
["id"] = "420581";
["name"] = "宜都";
};
[12] = {
["id"] = "420582";
["name"] = "当阳";
};
[13] = {
["id"] = "420583";
["name"] = "枝江";
};
};
};
[5] = {
["id"] = "420600";
["name"] = "襄阳";
["children"] = {
[1] = {
["id"] = "420602";
["name"] = "襄城区";
};
[2] = {
["id"] = "420606";
["name"] = "樊城区";
};
[3] = {
["id"] = "420607";
["name"] = "襄州区";
};
[4] = {
["id"] = "420624";
["name"] = "南漳县";
};
[5] = {
["id"] = "420625";
["name"] = "谷城县";
};
[6] = {
["id"] = "420626";
["name"] = "保康县";
};
[7] = {
["id"] = "420682";
["name"] = "老河口";
};
[8] = {
["id"] = "420683";
["name"] = "枣阳";
};
[9] = {
["id"] = "420684";
["name"] = "宜城";
};
};
};
[6] = {
["id"] = "420700";
["name"] = "鄂州";
["children"] = {
[1] = {
["id"] = "420702";
["name"] = "梁子湖区";
};
[2] = {
["id"] = "420703";
["name"] = "华容区";
};
[3] = {
["id"] = "420704";
["name"] = "鄂城区";
};
};
};
[7] = {
["id"] = "420800";
["name"] = "荆门";
["children"] = {
[1] = {
["id"] = "420802";
["name"] = "东宝区";
};
[2] = {
["id"] = "420804";
["name"] = "掇刀区";
};
[3] = {
["id"] = "420821";
["name"] = "京山县";
};
[4] = {
["id"] = "420822";
["name"] = "沙洋县";
};
[5] = {
["id"] = "420881";
["name"] = "钟祥";
};
};
};
[8] = {
["id"] = "420900";
["name"] = "孝感";
["children"] = {
[1] = {
["id"] = "420902";
["name"] = "孝南区";
};
[2] = {
["id"] = "420921";
["name"] = "孝昌县";
};
[3] = {
["id"] = "420922";
["name"] = "大悟县";
};
[4] = {
["id"] = "420923";
["name"] = "云梦县";
};
[5] = {
["id"] = "420981";
["name"] = "应城";
};
[6] = {
["id"] = "420982";
["name"] = "安陆";
};
[7] = {
["id"] = "420984";
["name"] = "汉川";
};
};
};
[9] = {
["id"] = "421000";
["name"] = "荆州";
["children"] = {
[1] = {
["id"] = "421002";
["name"] = "沙区";
};
[2] = {
["id"] = "421003";
["name"] = "荆州区";
};
[3] = {
["id"] = "421022";
["name"] = "公安县";
};
[4] = {
["id"] = "421023";
["name"] = "监利县";
};
[5] = {
["id"] = "421024";
["name"] = "江陵县";
};
[6] = {
["id"] = "421081";
["name"] = "石首";
};
[7] = {
["id"] = "421083";
["name"] = "洪湖";
};
[8] = {
["id"] = "421087";
["name"] = "松滋";
};
};
};
[10] = {
["id"] = "421100";
["name"] = "黄冈";
["children"] = {
[1] = {
["id"] = "421102";
["name"] = "黄州区";
};
[2] = {
["id"] = "421121";
["name"] = "团风县";
};
[3] = {
["id"] = "421122";
["name"] = "红安县";
};
[4] = {
["id"] = "421123";
["name"] = "罗田县";
};
[5] = {
["id"] = "421124";
["name"] = "英山县";
};
[6] = {
["id"] = "421125";
["name"] = "浠水县";
};
[7] = {
["id"] = "421126";
["name"] = "蕲春县";
};
[8] = {
["id"] = "421127";
["name"] = "黄梅县";
};
[9] = {
["id"] = "421181";
["name"] = "麻城";
};
[10] = {
["id"] = "421182";
["name"] = "武穴";
};
};
};
[11] = {
["id"] = "421200";
["name"] = "咸宁";
["children"] = {
[1] = {
["id"] = "421202";
["name"] = "咸安区";
};
[2] = {
["id"] = "421221";
["name"] = "嘉鱼县";
};
[3] = {
["id"] = "421222";
["name"] = "通城县";
};
[4] = {
["id"] = "421223";
["name"] = "崇阳县";
};
[5] = {
["id"] = "421224";
["name"] = "通山县";
};
[6] = {
["id"] = "421281";
["name"] = "赤壁";
};
};
};
[12] = {
["id"] = "421300";
["name"] = "随州";
["children"] = {
[1] = {
["id"] = "421303";
["name"] = "曾都区";
};
[2] = {
["id"] = "421321";
["name"] = "随县";
};
[3] = {
["id"] = "421381";
["name"] = "广水";
};
};
};
[13] = {
["id"] = "422800";
["name"] = "恩施";
["children"] = {
[1] = {
["id"] = "422801";
["name"] = "恩施";
};
[2] = {
["id"] = "422802";
["name"] = "利川";
};
[3] = {
["id"] = "422822";
["name"] = "建始县";
};
[4] = {
["id"] = "422823";
["name"] = "巴东县";
};
[5] = {
["id"] = "422825";
["name"] = "宣恩县";
};
[6] = {
["id"] = "422826";
["name"] = "咸丰县";
};
[7] = {
["id"] = "422827";
["name"] = "来凤县";
};
[8] = {
["id"] = "422828";
["name"] = "鹤峰县";
};
};
};
[14] = {
["id"] = "429004";
["name"] = "仙桃";
};
[15] = {
["id"] = "429005";
["name"] = "潜江";
};
[16] = {
["id"] = "429006";
["name"] = "天门";
};
[17] = {
["id"] = "429021";
["name"] = "神农架";
};
};
};
[18] = {
["id"] = "430000";
["name"] = "湖南";
["children"] = {
[1] = {
["id"] = "430100";
["name"] = "长沙";
["children"] = {
[1] = {
["id"] = "430102";
["name"] = "芙蓉区";
};
[2] = {
["id"] = "430103";
["name"] = "天心区";
};
[3] = {
["id"] = "430104";
["name"] = "岳麓区";
};
[4] = {
["id"] = "430105";
["name"] = "开福区";
};
[5] = {
["id"] = "430111";
["name"] = "雨花区";
};
[6] = {
["id"] = "430112";
["name"] = "望城区";
};
[7] = {
["id"] = "430121";
["name"] = "长沙县";
};
[8] = {
["id"] = "430124";
["name"] = "宁乡县";
};
[9] = {
["id"] = "430181";
["name"] = "浏阳";
};
};
};
[2] = {
["id"] = "430200";
["name"] = "株洲";
["children"] = {
[1] = {
["id"] = "430202";
["name"] = "荷塘区";
};
[2] = {
["id"] = "430203";
["name"] = "芦淞区";
};
[3] = {
["id"] = "430204";
["name"] = "石峰区";
};
[4] = {
["id"] = "430211";
["name"] = "天元区";
};
[5] = {
["id"] = "430221";
["name"] = "株洲县";
};
[6] = {
["id"] = "430223";
["name"] = "攸县";
};
[7] = {
["id"] = "430224";
["name"] = "茶陵县";
};
[8] = {
["id"] = "430225";
["name"] = "炎陵县";
};
[9] = {
["id"] = "430281";
["name"] = "醴陵";
};
};
};
[3] = {
["id"] = "430300";
["name"] = "湘潭";
["children"] = {
[1] = {
["id"] = "430302";
["name"] = "雨湖区";
};
[2] = {
["id"] = "430304";
["name"] = "岳塘区";
};
[3] = {
["id"] = "430321";
["name"] = "湘潭县";
};
[4] = {
["id"] = "430381";
["name"] = "湘乡";
};
[5] = {
["id"] = "430382";
["name"] = "韶山";
};
};
};
[4] = {
["id"] = "430400";
["name"] = "衡阳";
["children"] = {
[1] = {
["id"] = "430405";
["name"] = "珠晖区";
};
[2] = {
["id"] = "430406";
["name"] = "雁峰区";
};
[3] = {
["id"] = "430407";
["name"] = "石鼓区";
};
[4] = {
["id"] = "430408";
["name"] = "蒸湘区";
};
[5] = {
["id"] = "430412";
["name"] = "南岳区";
};
[6] = {
["id"] = "430421";
["name"] = "衡阳县";
};
[7] = {
["id"] = "430422";
["name"] = "衡南县";
};
[8] = {
["id"] = "430423";
["name"] = "衡山县";
};
[9] = {
["id"] = "430424";
["name"] = "衡东县";
};
[10] = {
["id"] = "430426";
["name"] = "祁东县";
};
[11] = {
["id"] = "430481";
["name"] = "耒阳";
};
[12] = {
["id"] = "430482";
["name"] = "常宁";
};
};
};
[5] = {
["id"] = "430500";
["name"] = "邵阳";
["children"] = {
[1] = {
["id"] = "430502";
["name"] = "双清区";
};
[2] = {
["id"] = "430503";
["name"] = "大祥区";
};
[3] = {
["id"] = "430511";
["name"] = "北塔区";
};
[4] = {
["id"] = "430521";
["name"] = "邵东县";
};
[5] = {
["id"] = "430522";
["name"] = "新邵县";
};
[6] = {
["id"] = "430523";
["name"] = "邵阳县";
};
[7] = {
["id"] = "430524";
["name"] = "隆回县";
};
[8] = {
["id"] = "430525";
["name"] = "洞口县";
};
[9] = {
["id"] = "430527";
["name"] = "绥宁县";
};
[10] = {
["id"] = "430528";
["name"] = "新宁县";
};
[11] = {
["id"] = "430529";
["name"] = "城步苗族自治县";
};
[12] = {
["id"] = "430581";
["name"] = "武冈";
};
};
};
[6] = {
["id"] = "430600";
["name"] = "岳阳";
["children"] = {
[1] = {
["id"] = "430602";
["name"] = "岳阳楼区";
};
[2] = {
["id"] = "430603";
["name"] = "云溪区";
};
[3] = {
["id"] = "430611";
["name"] = "君山区";
};
[4] = {
["id"] = "430621";
["name"] = "岳阳县";
};
[5] = {
["id"] = "430623";
["name"] = "华容县";
};
[6] = {
["id"] = "430624";
["name"] = "湘阴县";
};
[7] = {
["id"] = "430626";
["name"] = "平江县";
};
[8] = {
["id"] = "430681";
["name"] = "汨罗";
};
[9] = {
["id"] = "430682";
["name"] = "临湘";
};
};
};
[7] = {
["id"] = "430700";
["name"] = "常德";
["children"] = {
[1] = {
["id"] = "430702";
["name"] = "武陵区";
};
[2] = {
["id"] = "430703";
["name"] = "鼎城区";
};
[3] = {
["id"] = "430721";
["name"] = "安乡县";
};
[4] = {
["id"] = "430722";
["name"] = "汉寿县";
};
[5] = {
["id"] = "430723";
["name"] = "澧县";
};
[6] = {
["id"] = "430724";
["name"] = "临澧县";
};
[7] = {
["id"] = "430725";
["name"] = "桃源县";
};
[8] = {
["id"] = "430726";
["name"] = "石门县";
};
[9] = {
["id"] = "430781";
["name"] = "津";
};
};
};
[8] = {
["id"] = "430800";
["name"] = "张家界";
["children"] = {
[1] = {
["id"] = "430802";
["name"] = "永定区";
};
[2] = {
["id"] = "430811";
["name"] = "武陵源区";
};
[3] = {
["id"] = "430821";
["name"] = "慈利县";
};
[4] = {
["id"] = "430822";
["name"] = "桑植县";
};
};
};
[9] = {
["id"] = "430900";
["name"] = "益阳";
["children"] = {
[1] = {
["id"] = "430902";
["name"] = "资阳区";
};
[2] = {
["id"] = "430903";
["name"] = "赫山区";
};
[3] = {
["id"] = "430921";
["name"] = "南县";
};
[4] = {
["id"] = "430922";
["name"] = "桃江县";
};
[5] = {
["id"] = "430923";
["name"] = "安化县";
};
[6] = {
["id"] = "430981";
["name"] = "沅江";
};
};
};
[10] = {
["id"] = "431000";
["name"] = "郴州";
["children"] = {
[1] = {
["id"] = "431002";
["name"] = "北湖区";
};
[2] = {
["id"] = "431003";
["name"] = "苏仙区";
};
[3] = {
["id"] = "431021";
["name"] = "桂阳县";
};
[4] = {
["id"] = "431022";
["name"] = "宜章县";
};
[5] = {
["id"] = "431023";
["name"] = "永兴县";
};
[6] = {
["id"] = "431024";
["name"] = "嘉禾县";
};
[7] = {
["id"] = "431025";
["name"] = "临武县";
};
[8] = {
["id"] = "431026";
["name"] = "汝城县";
};
[9] = {
["id"] = "431027";
["name"] = "桂东县";
};
[10] = {
["id"] = "431028";
["name"] = "安仁县";
};
[11] = {
["id"] = "431081";
["name"] = "资兴";
};
};
};
[11] = {
["id"] = "431100";
["name"] = "永州";
["children"] = {
[1] = {
["id"] = "431102";
["name"] = "零陵区";
};
[2] = {
["id"] = "431103";
["name"] = "冷水滩区";
};
[3] = {
["id"] = "431121";
["name"] = "祁阳县";
};
[4] = {
["id"] = "431122";
["name"] = "东安县";
};
[5] = {
["id"] = "431123";
["name"] = "双牌县";
};
[6] = {
["id"] = "431124";
["name"] = "道县";
};
[7] = {
["id"] = "431125";
["name"] = "江永县";
};
[8] = {
["id"] = "431126";
["name"] = "宁远县";
};
[9] = {
["id"] = "431127";
["name"] = "蓝山县";
};
[10] = {
["id"] = "431128";
["name"] = "新田县";
};
[11] = {
["id"] = "431129";
["name"] = "江华瑶族自治县";
};
};
};
[12] = {
["id"] = "431200";
["name"] = "怀化";
["children"] = {
[1] = {
["id"] = "431202";
["name"] = "鹤城区";
};
[2] = {
["id"] = "431221";
["name"] = "中方县";
};
[3] = {
["id"] = "431222";
["name"] = "沅陵县";
};
[4] = {
["id"] = "431223";
["name"] = "辰溪县";
};
[5] = {
["id"] = "431224";
["name"] = "溆浦县";
};
[6] = {
["id"] = "431225";
["name"] = "会同县";
};
[7] = {
["id"] = "431226";
["name"] = "麻阳苗族自治县";
};
[8] = {
["id"] = "431227";
["name"] = "新晃侗族自治县";
};
[9] = {
["id"] = "431228";
["name"] = "芷江侗族自治县";
};
[10] = {
["id"] = "431229";
["name"] = "靖州苗族侗族自治县";
};
[11] = {
["id"] = "431230";
["name"] = "通道侗族自治县";
};
[12] = {
["id"] = "431281";
["name"] = "洪江";
};
};
};
[13] = {
["id"] = "431300";
["name"] = "娄底";
["children"] = {
[1] = {
["id"] = "431302";
["name"] = "娄星区";
};
[2] = {
["id"] = "431321";
["name"] = "双峰县";
};
[3] = {
["id"] = "431322";
["name"] = "新化县";
};
[4] = {
["id"] = "431381";
["name"] = "冷水江";
};
[5] = {
["id"] = "431382";
["name"] = "涟源";
};
};
};
[14] = {
["id"] = "433100";
["name"] = "湘西";
["children"] = {
[1] = {
["id"] = "433101";
["name"] = "吉首";
};
[2] = {
["id"] = "433122";
["name"] = "泸溪县";
};
[3] = {
["id"] = "433123";
["name"] = "凤凰县";
};
[4] = {
["id"] = "433124";
["name"] = "花垣县";
};
[5] = {
["id"] = "433125";
["name"] = "保靖县";
};
[6] = {
["id"] = "433126";
["name"] = "古丈县";
};
[7] = {
["id"] = "433127";
["name"] = "永顺县";
};
[8] = {
["id"] = "433130";
["name"] = "龙山县";
};
};
};
};
};
[19] = {
["id"] = "440000";
["name"] = "广东";
["children"] = {
[1] = {
["id"] = "440100";
["name"] = "广州";
["children"] = {
[1] = {
["id"] = "440103";
["name"] = "荔湾区";
};
[2] = {
["id"] = "440104";
["name"] = "越秀区";
};
[3] = {
["id"] = "440105";
["name"] = "海珠区";
};
[4] = {
["id"] = "440106";
["name"] = "天河区";
};
[5] = {
["id"] = "440111";
["name"] = "白云区";
};
[6] = {
["id"] = "440112";
["name"] = "黄埔区";
};
[7] = {
["id"] = "440113";
["name"] = "番禺区";
};
[8] = {
["id"] = "440114";
["name"] = "花都区";
};
[9] = {
["id"] = "440115";
["name"] = "南沙区";
};
[10] = {
["id"] = "440116";
["name"] = "萝岗区";
};
[11] = {
["id"] = "440183";
["name"] = "增城";
};
[12] = {
["id"] = "440184";
["name"] = "从化";
};
};
};
[2] = {
["id"] = "440200";
["name"] = "韶关";
["children"] = {
[1] = {
["id"] = "440203";
["name"] = "武江区";
};
[2] = {
["id"] = "440204";
["name"] = "浈江区";
};
[3] = {
["id"] = "440205";
["name"] = "曲江区";
};
[4] = {
["id"] = "440222";
["name"] = "始兴县";
};
[5] = {
["id"] = "440224";
["name"] = "仁化县";
};
[6] = {
["id"] = "440229";
["name"] = "翁源县";
};
[7] = {
["id"] = "440232";
["name"] = "乳源瑶族自治县";
};
[8] = {
["id"] = "440233";
["name"] = "新丰县";
};
[9] = {
["id"] = "440281";
["name"] = "乐昌";
};
[10] = {
["id"] = "440282";
["name"] = "南雄";
};
};
};
[3] = {
["id"] = "440300";
["name"] = "深圳";
["children"] = {
[1] = {
["id"] = "440303";
["name"] = "罗湖区";
};
[2] = {
["id"] = "440304";
["name"] = "福田区";
};
[3] = {
["id"] = "440305";
["name"] = "南山区";
};
[4] = {
["id"] = "440306";
["name"] = "宝安区";
};
[5] = {
["id"] = "440307";
["name"] = "龙岗区";
};
[6] = {
["id"] = "440308";
["name"] = "盐田区";
};
};
};
[4] = {
["id"] = "440400";
["name"] = "珠海";
["children"] = {
[1] = {
["id"] = "440402";
["name"] = "香洲区";
};
[2] = {
["id"] = "440403";
["name"] = "斗门区";
};
[3] = {
["id"] = "440404";
["name"] = "金湾区";
};
};
};
[5] = {
["id"] = "440500";
["name"] = "汕头";
["children"] = {
[1] = {
["id"] = "440507";
["name"] = "龙湖区";
};
[2] = {
["id"] = "440511";
["name"] = "金平区";
};
[3] = {
["id"] = "440512";
["name"] = "濠江区";
};
[4] = {
["id"] = "440513";
["name"] = "潮阳区";
};
[5] = {
["id"] = "440514";
["name"] = "潮南区";
};
[6] = {
["id"] = "440515";
["name"] = "澄海区";
};
[7] = {
["id"] = "440523";
["name"] = "南澳县";
};
};
};
[6] = {
["id"] = "440600";
["name"] = "佛山";
["children"] = {
[1] = {
["id"] = "440604";
["name"] = "禅城区";
};
[2] = {
["id"] = "440605";
["name"] = "南海区";
};
[3] = {
["id"] = "440606";
["name"] = "顺德区";
};
[4] = {
["id"] = "440607";
["name"] = "三水区";
};
[5] = {
["id"] = "440608";
["name"] = "高明区";
};
};
};
[7] = {
["id"] = "440700";
["name"] = "江门";
["children"] = {
[1] = {
["id"] = "440703";
["name"] = "蓬江区";
};
[2] = {
["id"] = "440704";
["name"] = "江海区";
};
[3] = {
["id"] = "440705";
["name"] = "新会区";
};
[4] = {
["id"] = "440781";
["name"] = "台山";
};
[5] = {
["id"] = "440783";
["name"] = "开平";
};
[6] = {
["id"] = "440784";
["name"] = "鹤山";
};
[7] = {
["id"] = "440785";
["name"] = "恩平";
};
};
};
[8] = {
["id"] = "440800";
["name"] = "湛江";
["children"] = {
[1] = {
["id"] = "440802";
["name"] = "赤坎区";
};
[2] = {
["id"] = "440803";
["name"] = "霞山区";
};
[3] = {
["id"] = "440804";
["name"] = "坡头区";
};
[4] = {
["id"] = "440811";
["name"] = "麻章区";
};
[5] = {
["id"] = "440823";
["name"] = "遂溪县";
};
[6] = {
["id"] = "440825";
["name"] = "徐闻县";
};
[7] = {
["id"] = "440881";
["name"] = "廉江";
};
[8] = {
["id"] = "440882";
["name"] = "雷州";
};
[9] = {
["id"] = "440883";
["name"] = "吴川";
};
};
};
[9] = {
["id"] = "440900";
["name"] = "茂名";
["children"] = {
[1] = {
["id"] = "440902";
["name"] = "茂南区";
};
[2] = {
["id"] = "440903";
["name"] = "茂港区";
};
[3] = {
["id"] = "440923";
["name"] = "电白县";
};
[4] = {
["id"] = "440981";
["name"] = "高州";
};
[5] = {
["id"] = "440982";
["name"] = "化州";
};
[6] = {
["id"] = "440983";
["name"] = "信宜";
};
};
};
[10] = {
["id"] = "441200";
["name"] = "肇庆";
["children"] = {
[1] = {
["id"] = "441202";
["name"] = "端州区";
};
[2] = {
["id"] = "441203";
["name"] = "鼎湖区";
};
[3] = {
["id"] = "441223";
["name"] = "广宁县";
};
[4] = {
["id"] = "441224";
["name"] = "怀集县";
};
[5] = {
["id"] = "441225";
["name"] = "封开县";
};
[6] = {
["id"] = "441226";
["name"] = "德庆县";
};
[7] = {
["id"] = "441283";
["name"] = "高要";
};
[8] = {
["id"] = "441284";
["name"] = "四会";
};
};
};
[11] = {
["id"] = "441300";
["name"] = "惠州";
["children"] = {
[1] = {
["id"] = "441302";
["name"] = "惠城区";
};
[2] = {
["id"] = "441303";
["name"] = "惠阳区";
};
[3] = {
["id"] = "441322";
["name"] = "博罗县";
};
[4] = {
["id"] = "441323";
["name"] = "惠东县";
};
[5] = {
["id"] = "441324";
["name"] = "龙门县";
};
};
};
[12] = {
["id"] = "441400";
["name"] = "梅州";
["children"] = {
[1] = {
["id"] = "441402";
["name"] = "梅江区";
};
[2] = {
["id"] = "441421";
["name"] = "梅县";
};
[3] = {
["id"] = "441422";
["name"] = "大埔县";
};
[4] = {
["id"] = "441423";
["name"] = "丰顺县";
};
[5] = {
["id"] = "441424";
["name"] = "五华县";
};
[6] = {
["id"] = "441426";
["name"] = "平远县";
};
[7] = {
["id"] = "441427";
["name"] = "蕉岭县";
};
[8] = {
["id"] = "441481";
["name"] = "兴宁";
};
};
};
[13] = {
["id"] = "441500";
["name"] = "汕尾";
["children"] = {
[1] = {
["id"] = "441502";
["name"] = "城区";
};
[2] = {
["id"] = "441521";
["name"] = "海丰县";
};
[3] = {
["id"] = "441523";
["name"] = "陆河县";
};
[4] = {
["id"] = "441581";
["name"] = "陆丰";
};
};
};
[14] = {
["id"] = "441600";
["name"] = "河源";
["children"] = {
[1] = {
["id"] = "441602";
["name"] = "源城区";
};
[2] = {
["id"] = "441621";
["name"] = "紫金县";
};
[3] = {
["id"] = "441622";
["name"] = "龙川县";
};
[4] = {
["id"] = "441623";
["name"] = "连平县";
};
[5] = {
["id"] = "441624";
["name"] = "和平县";
};
[6] = {
["id"] = "441625";
["name"] = "东源县";
};
};
};
[15] = {
["id"] = "441700";
["name"] = "阳江";
["children"] = {
[1] = {
["id"] = "441702";
["name"] = "江城区";
};
[2] = {
["id"] = "441721";
["name"] = "阳西县";
};
[3] = {
["id"] = "441723";
["name"] = "阳东县";
};
[4] = {
["id"] = "441781";
["name"] = "阳春";
};
};
};
[16] = {
["id"] = "441800";
["name"] = "清远";
["children"] = {
[1] = {
["id"] = "441802";
["name"] = "清城区";
};
[2] = {
["id"] = "441803";
["name"] = "清新区";
};
[3] = {
["id"] = "441821";
["name"] = "佛冈县";
};
[4] = {
["id"] = "441823";
["name"] = "阳山县";
};
[5] = {
["id"] = "441825";
["name"] = "连山壮族瑶族自治县";
};
[6] = {
["id"] = "441826";
["name"] = "连南瑶族自治县";
};
[7] = {
["id"] = "441881";
["name"] = "英德";
};
[8] = {
["id"] = "441882";
["name"] = "连州";
};
};
};
[17] = {
["id"] = "441900";
["name"] = "东莞";
};
[18] = {
["id"] = "442000";
["name"] = "中山";
};
[19] = {
["id"] = "445100";
["name"] = "潮州";
["children"] = {
[1] = {
["id"] = "445102";
["name"] = "湘桥区";
};
[2] = {
["id"] = "445103";
["name"] = "潮安区";
};
[3] = {
["id"] = "445122";
["name"] = "饶平县";
};
};
};
[20] = {
["id"] = "445200";
["name"] = "揭阳";
["children"] = {
[1] = {
["id"] = "445202";
["name"] = "榕城区";
};
[2] = {
["id"] = "445203";
["name"] = "揭东区";
};
[3] = {
["id"] = "445222";
["name"] = "揭西县";
};
[4] = {
["id"] = "445224";
["name"] = "惠来县";
};
[5] = {
["id"] = "445281";
["name"] = "普宁";
};
};
};
[21] = {
["id"] = "445300";
["name"] = "云浮";
["children"] = {
[1] = {
["id"] = "445302";
["name"] = "云城区";
};
[2] = {
["id"] = "445321";
["name"] = "新兴县";
};
[3] = {
["id"] = "445322";
["name"] = "郁南县";
};
[4] = {
["id"] = "445323";
["name"] = "云安县";
};
[5] = {
["id"] = "445381";
["name"] = "罗定";
};
};
};
};
};
[20] = {
["id"] = "450000";
["name"] = "广西";
["children"] = {
[1] = {
["id"] = "450100";
["name"] = "南宁";
["children"] = {
[1] = {
["id"] = "450102";
["name"] = "兴宁区";
};
[2] = {
["id"] = "450103";
["name"] = "青秀区";
};
[3] = {
["id"] = "450105";
["name"] = "江南区";
};
[4] = {
["id"] = "450107";
["name"] = "西乡塘区";
};
[5] = {
["id"] = "450108";
["name"] = "良庆区";
};
[6] = {
["id"] = "450109";
["name"] = "邕宁区";
};
[7] = {
["id"] = "450122";
["name"] = "武鸣县";
};
[8] = {
["id"] = "450123";
["name"] = "隆安县";
};
[9] = {
["id"] = "450124";
["name"] = "马山县";
};
[10] = {
["id"] = "450125";
["name"] = "上林县";
};
[11] = {
["id"] = "450126";
["name"] = "宾阳县";
};
[12] = {
["id"] = "450127";
["name"] = "横县";
};
};
};
[2] = {
["id"] = "450200";
["name"] = "柳州";
["children"] = {
[1] = {
["id"] = "450202";
["name"] = "城中区";
};
[2] = {
["id"] = "450203";
["name"] = "鱼峰区";
};
[3] = {
["id"] = "450204";
["name"] = "柳南区";
};
[4] = {
["id"] = "450205";
["name"] = "柳北区";
};
[5] = {
["id"] = "450221";
["name"] = "柳江县";
};
[6] = {
["id"] = "450222";
["name"] = "柳城县";
};
[7] = {
["id"] = "450223";
["name"] = "鹿寨县";
};
[8] = {
["id"] = "450224";
["name"] = "融安县";
};
[9] = {
["id"] = "450225";
["name"] = "融水苗族自治县";
};
[10] = {
["id"] = "450226";
["name"] = "三江侗族自治县";
};
};
};
[3] = {
["id"] = "450300";
["name"] = "桂林";
["children"] = {
[1] = {
["id"] = "450302";
["name"] = "秀峰区";
};
[2] = {
["id"] = "450303";
["name"] = "叠彩区";
};
[3] = {
["id"] = "450304";
["name"] = "象山区";
};
[4] = {
["id"] = "450305";
["name"] = "七星区";
};
[5] = {
["id"] = "450311";
["name"] = "雁山区";
};
[6] = {
["id"] = "450312";
["name"] = "临桂区";
};
[7] = {
["id"] = "450321";
["name"] = "阳朔县";
};
[8] = {
["id"] = "450323";
["name"] = "灵川县";
};
[9] = {
["id"] = "450324";
["name"] = "全州县";
};
[10] = {
["id"] = "450325";
["name"] = "兴安县";
};
[11] = {
["id"] = "450326";
["name"] = "永福县";
};
[12] = {
["id"] = "450327";
["name"] = "灌阳县";
};
[13] = {
["id"] = "450328";
["name"] = "龙胜各族自治县";
};
[14] = {
["id"] = "450329";
["name"] = "资源县";
};
[15] = {
["id"] = "450330";
["name"] = "平乐县";
};
[16] = {
["id"] = "450331";
["name"] = "荔浦县";
};
[17] = {
["id"] = "450332";
["name"] = "恭城瑶族自治县";
};
};
};
[4] = {
["id"] = "450400";
["name"] = "梧州";
["children"] = {
[1] = {
["id"] = "450403";
["name"] = "万秀区";
};
[2] = {
["id"] = "450405";
["name"] = "长洲区";
};
[3] = {
["id"] = "450406";
["name"] = "龙圩区";
};
[4] = {
["id"] = "450421";
["name"] = "苍梧县";
};
[5] = {
["id"] = "450422";
["name"] = "藤县";
};
[6] = {
["id"] = "450423";
["name"] = "蒙山县";
};
[7] = {
["id"] = "450481";
["name"] = "岑溪";
};
};
};
[5] = {
["id"] = "450500";
["name"] = "北海";
["children"] = {
[1] = {
["id"] = "450502";
["name"] = "海城区";
};
[2] = {
["id"] = "450503";
["name"] = "银海区";
};
[3] = {
["id"] = "450512";
["name"] = "铁山港区";
};
[4] = {
["id"] = "450521";
["name"] = "合浦县";
};
};
};
[6] = {
["id"] = "450600";
["name"] = "防城港";
["children"] = {
[1] = {
["id"] = "450602";
["name"] = "港口区";
};
[2] = {
["id"] = "450603";
["name"] = "防城区";
};
[3] = {
["id"] = "450621";
["name"] = "上思县";
};
[4] = {
["id"] = "450681";
["name"] = "东兴";
};
};
};
[7] = {
["id"] = "450700";
["name"] = "钦州";
["children"] = {
[1] = {
["id"] = "450702";
["name"] = "钦南区";
};
[2] = {
["id"] = "450703";
["name"] = "钦北区";
};
[3] = {
["id"] = "450721";
["name"] = "灵山县";
};
[4] = {
["id"] = "450722";
["name"] = "浦北县";
};
};
};
[8] = {
["id"] = "450800";
["name"] = "贵港";
["children"] = {
[1] = {
["id"] = "450802";
["name"] = "港北区";
};
[2] = {
["id"] = "450803";
["name"] = "港南区";
};
[3] = {
["id"] = "450804";
["name"] = "覃塘区";
};
[4] = {
["id"] = "450821";
["name"] = "平南县";
};
[5] = {
["id"] = "450881";
["name"] = "桂平";
};
};
};
[9] = {
["id"] = "450900";
["name"] = "玉林";
["children"] = {
[1] = {
["id"] = "450902";
["name"] = "玉州区";
};
[2] = {
["id"] = "450903";
["name"] = "福绵区";
};
[3] = {
["id"] = "450921";
["name"] = "容县";
};
[4] = {
["id"] = "450922";
["name"] = "陆川县";
};
[5] = {
["id"] = "450923";
["name"] = "博白县";
};
[6] = {
["id"] = "450924";
["name"] = "兴业县";
};
[7] = {
["id"] = "450981";
["name"] = "北流";
};
};
};
[10] = {
["id"] = "451000";
["name"] = "百色";
["children"] = {
[1] = {
["id"] = "451002";
["name"] = "右江区";
};
[2] = {
["id"] = "451021";
["name"] = "田阳县";
};
[3] = {
["id"] = "451022";
["name"] = "田东县";
};
[4] = {
["id"] = "451023";
["name"] = "平果县";
};
[5] = {
["id"] = "451024";
["name"] = "德保县";
};
[6] = {
["id"] = "451025";
["name"] = "靖西县";
};
[7] = {
["id"] = "451026";
["name"] = "那坡县";
};
[8] = {
["id"] = "451027";
["name"] = "凌云县";
};
[9] = {
["id"] = "451028";
["name"] = "乐业县";
};
[10] = {
["id"] = "451029";
["name"] = "田林县";
};
[11] = {
["id"] = "451030";
["name"] = "西林县";
};
[12] = {
["id"] = "451031";
["name"] = "隆林各族自治县";
};
};
};
[11] = {
["id"] = "451100";
["name"] = "贺州";
["children"] = {
[1] = {
["id"] = "451102";
["name"] = "八步区";
};
[2] = {
["id"] = "451121";
["name"] = "昭平县";
};
[3] = {
["id"] = "451122";
["name"] = "钟山县";
};
[4] = {
["id"] = "451123";
["name"] = "富川瑶族自治县";
};
};
};
[12] = {
["id"] = "451200";
["name"] = "河池";
["children"] = {
[1] = {
["id"] = "451202";
["name"] = "金城江区";
};
[2] = {
["id"] = "451221";
["name"] = "南丹县";
};
[3] = {
["id"] = "451222";
["name"] = "天峨县";
};
[4] = {
["id"] = "451223";
["name"] = "凤山县";
};
[5] = {
["id"] = "451224";
["name"] = "东兰县";
};
[6] = {
["id"] = "451225";
["name"] = "罗城仫佬族自治县";
};
[7] = {
["id"] = "451226";
["name"] = "环江毛南族自治县";
};
[8] = {
["id"] = "451227";
["name"] = "巴马瑶族自治县";
};
[9] = {
["id"] = "451228";
["name"] = "都安瑶族自治县";
};
[10] = {
["id"] = "451229";
["name"] = "大化瑶族自治县";
};
[11] = {
["id"] = "451281";
["name"] = "宜州";
};
};
};
[13] = {
["id"] = "451300";
["name"] = "来宾";
["children"] = {
[1] = {
["id"] = "451302";
["name"] = "兴宾区";
};
[2] = {
["id"] = "451321";
["name"] = "忻城县";
};
[3] = {
["id"] = "451322";
["name"] = "象州县";
};
[4] = {
["id"] = "451323";
["name"] = "武宣县";
};
[5] = {
["id"] = "451324";
["name"] = "金秀瑶族自治县";
};
[6] = {
["id"] = "451381";
["name"] = "合山";
};
};
};
[14] = {
["id"] = "451400";
["name"] = "崇左";
["children"] = {
[1] = {
["id"] = "451402";
["name"] = "江州区";
};
[2] = {
["id"] = "451421";
["name"] = "扶绥县";
};
[3] = {
["id"] = "451422";
["name"] = "宁明县";
};
[4] = {
["id"] = "451423";
["name"] = "龙州县";
};
[5] = {
["id"] = "451424";
["name"] = "大新县";
};
[6] = {
["id"] = "451425";
["name"] = "天等县";
};
[7] = {
["id"] = "451481";
["name"] = "凭祥";
};
};
};
};
};
[21] = {
["id"] = "460000";
["name"] = "海南";
["children"] = {
[1] = {
["id"] = "460100";
["name"] = "海口";
["children"] = {
[1] = {
["id"] = "460105";
["name"] = "秀英区";
};
[2] = {
["id"] = "460106";
["name"] = "龙华区";
};
[3] = {
["id"] = "460107";
["name"] = "琼山区";
};
[4] = {
["id"] = "460108";
["name"] = "美兰区";
};
};
};
[2] = {
["id"] = "460200";
["name"] = "三亚";
};
[3] = {
["id"] = "460300";
["name"] = "三沙";
["children"] = {
[1] = {
["id"] = "460321";
["name"] = "西沙群岛";
};
[2] = {
["id"] = "460322";
["name"] = "南沙群岛";
};
[3] = {
["id"] = "460323";
["name"] = "中沙群岛的岛礁及其海域";
};
};
};
[4] = {
["id"] = "469001";
["name"] = "五指山";
};
[5] = {
["id"] = "469002";
["name"] = "琼海";
};
[6] = {
["id"] = "469003";
["name"] = "儋州";
};
[7] = {
["id"] = "469005";
["name"] = "文昌";
};
[8] = {
["id"] = "469006";
["name"] = "万宁";
};
[9] = {
["id"] = "469007";
["name"] = "东方";
};
[10] = {
["id"] = "469021";
["name"] = "定安县";
};
[11] = {
["id"] = "469022";
["name"] = "屯昌县";
};
[12] = {
["id"] = "469023";
["name"] = "澄迈县";
};
[13] = {
["id"] = "469024";
["name"] = "临高县";
};
[14] = {
["id"] = "469025";
["name"] = "白沙";
};
[15] = {
["id"] = "469026";
["name"] = "昌江";
};
[16] = {
["id"] = "469027";
["name"] = "乐东";
};
[17] = {
["id"] = "469028";
["name"] = "陵水";
};
[18] = {
["id"] = "469029";
["name"] = "保亭";
};
[19] = {
["id"] = "469030";
["name"] = "琼中";
};
};
};
[22] = {
["id"] = "500000";
["name"] = "重庆";
["children"] = {
[1] = {
["id"] = "500101";
["name"] = "万州区";
};
[2] = {
["id"] = "500102";
["name"] = "涪陵区";
};
[3] = {
["id"] = "500103";
["name"] = "渝中区";
};
[4] = {
["id"] = "500104";
["name"] = "大渡口区";
};
[5] = {
["id"] = "500105";
["name"] = "江北区";
};
[6] = {
["id"] = "500106";
["name"] = "沙坪坝区";
};
[7] = {
["id"] = "500107";
["name"] = "九龙坡区";
};
[8] = {
["id"] = "500108";
["name"] = "南岸区";
};
[9] = {
["id"] = "500109";
["name"] = "北碚区";
};
[10] = {
["id"] = "500110";
["name"] = "綦江区";
};
[11] = {
["id"] = "500111";
["name"] = "大足区";
};
[12] = {
["id"] = "500112";
["name"] = "渝北区";
};
[13] = {
["id"] = "500113";
["name"] = "巴南区";
};
[14] = {
["id"] = "500114";
["name"] = "黔江区";
};
[15] = {
["id"] = "500115";
["name"] = "长寿区";
};
[16] = {
["id"] = "500116";
["name"] = "江津区";
};
[17] = {
["id"] = "500117";
["name"] = "合川区";
};
[18] = {
["id"] = "500118";
["name"] = "永川区";
};
[19] = {
["id"] = "500119";
["name"] = "南川区";
};
[20] = {
["id"] = "500223";
["name"] = "潼南县";
};
[21] = {
["id"] = "500224";
["name"] = "铜梁县";
};
[22] = {
["id"] = "500226";
["name"] = "荣昌县";
};
[23] = {
["id"] = "500227";
["name"] = "璧山县";
};
[24] = {
["id"] = "500228";
["name"] = "梁平县";
};
[25] = {
["id"] = "500229";
["name"] = "城口县";
};
[26] = {
["id"] = "500230";
["name"] = "丰都县";
};
[27] = {
["id"] = "500231";
["name"] = "垫江县";
};
[28] = {
["id"] = "500232";
["name"] = "武隆县";
};
[29] = {
["id"] = "500233";
["name"] = "忠县";
};
[30] = {
["id"] = "500234";
["name"] = "开县";
};
[31] = {
["id"] = "500235";
["name"] = "云阳县";
};
[32] = {
["id"] = "500236";
["name"] = "奉节县";
};
[33] = {
["id"] = "500237";
["name"] = "巫山县";
};
[34] = {
["id"] = "500238";
["name"] = "巫溪县";
};
[35] = {
["id"] = "500240";
["name"] = "石柱县";
};
[36] = {
["id"] = "500241";
["name"] = "秀山县";
};
[37] = {
["id"] = "500242";
["name"] = "酉阳县";
};
[38] = {
["id"] = "500243";
["name"] = "彭水县";
};
};
};
[23] = {
["id"] = "510000";
["name"] = "四川";
["children"] = {
[1] = {
["id"] = "510100";
["name"] = "成都";
["children"] = {
[1] = {
["id"] = "510104";
["name"] = "锦江区";
};
[2] = {
["id"] = "510105";
["name"] = "青羊区";
};
[3] = {
["id"] = "510106";
["name"] = "金牛区";
};
[4] = {
["id"] = "510107";
["name"] = "武侯区";
};
[5] = {
["id"] = "510108";
["name"] = "成华区";
};
[6] = {
["id"] = "510112";
["name"] = "龙泉驿区";
};
[7] = {
["id"] = "510113";
["name"] = "青白江区";
};
[8] = {
["id"] = "510114";
["name"] = "新都区";
};
[9] = {
["id"] = "510115";
["name"] = "温江区";
};
[10] = {
["id"] = "510121";
["name"] = "金堂县";
};
[11] = {
["id"] = "510122";
["name"] = "双流县";
};
[12] = {
["id"] = "510124";
["name"] = "郫县";
};
[13] = {
["id"] = "510129";
["name"] = "大邑县";
};
[14] = {
["id"] = "510131";
["name"] = "蒲江县";
};
[15] = {
["id"] = "510132";
["name"] = "新津县";
};
[16] = {
["id"] = "510181";
["name"] = "都江堰";
};
[17] = {
["id"] = "510182";
["name"] = "彭州";
};
[18] = {
["id"] = "510183";
["name"] = "邛崃";
};
[19] = {
["id"] = "510184";
["name"] = "崇州";
};
};
};
[2] = {
["id"] = "510300";
["name"] = "自贡";
["children"] = {
[1] = {
["id"] = "510302";
["name"] = "自流井区";
};
[2] = {
["id"] = "510303";
["name"] = "贡井区";
};
[3] = {
["id"] = "510304";
["name"] = "大安区";
};
[4] = {
["id"] = "510311";
["name"] = "沿滩区";
};
[5] = {
["id"] = "510321";
["name"] = "荣县";
};
[6] = {
["id"] = "510322";
["name"] = "富顺县";
};
};
};
[3] = {
["id"] = "510400";
["name"] = "攀枝花";
["children"] = {
[1] = {
["id"] = "510402";
["name"] = "东区";
};
[2] = {
["id"] = "510403";
["name"] = "西区";
};
[3] = {
["id"] = "510411";
["name"] = "仁和区";
};
[4] = {
["id"] = "510421";
["name"] = "米易县";
};
[5] = {
["id"] = "510422";
["name"] = "盐边县";
};
};
};
[4] = {
["id"] = "510500";
["name"] = "泸州";
["children"] = {
[1] = {
["id"] = "510502";
["name"] = "江阳区";
};
[2] = {
["id"] = "510503";
["name"] = "纳溪区";
};
[3] = {
["id"] = "510504";
["name"] = "龙马潭区";
};
[4] = {
["id"] = "510521";
["name"] = "泸县";
};
[5] = {
["id"] = "510522";
["name"] = "合江县";
};
[6] = {
["id"] = "510524";
["name"] = "叙永县";
};
[7] = {
["id"] = "510525";
["name"] = "古蔺县";
};
};
};
[5] = {
["id"] = "510600";
["name"] = "德阳";
["children"] = {
[1] = {
["id"] = "510603";
["name"] = "旌阳区";
};
[2] = {
["id"] = "510623";
["name"] = "中江县";
};
[3] = {
["id"] = "510626";
["name"] = "罗江县";
};
[4] = {
["id"] = "510681";
["name"] = "广汉";
};
[5] = {
["id"] = "510682";
["name"] = "什邡";
};
[6] = {
["id"] = "510683";
["name"] = "绵竹";
};
};
};
[6] = {
["id"] = "510700";
["name"] = "绵阳";
["children"] = {
[1] = {
["id"] = "510703";
["name"] = "涪城区";
};
[2] = {
["id"] = "510704";
["name"] = "游仙区";
};
[3] = {
["id"] = "510722";
["name"] = "三台县";
};
[4] = {
["id"] = "510723";
["name"] = "盐亭县";
};
[5] = {
["id"] = "510724";
["name"] = "安县";
};
[6] = {
["id"] = "510725";
["name"] = "梓潼县";
};
[7] = {
["id"] = "510726";
["name"] = "北川羌族自治县";
};
[8] = {
["id"] = "510727";
["name"] = "平武县";
};
[9] = {
["id"] = "510781";
["name"] = "江油";
};
};
};
[7] = {
["id"] = "510800";
["name"] = "广元";
["children"] = {
[1] = {
["id"] = "510802";
["name"] = "利州区";
};
[2] = {
["id"] = "510811";
["name"] = "元坝区";
};
[3] = {
["id"] = "510812";
["name"] = "朝天区";
};
[4] = {
["id"] = "510821";
["name"] = "旺苍县";
};
[5] = {
["id"] = "510822";
["name"] = "青川县";
};
[6] = {
["id"] = "510823";
["name"] = "剑阁县";
};
[7] = {
["id"] = "510824";
["name"] = "苍溪县";
};
};
};
[8] = {
["id"] = "510900";
["name"] = "遂宁";
["children"] = {
[1] = {
["id"] = "510903";
["name"] = "船山区";
};
[2] = {
["id"] = "510904";
["name"] = "安居区";
};
[3] = {
["id"] = "510921";
["name"] = "蓬溪县";
};
[4] = {
["id"] = "510922";
["name"] = "射洪县";
};
[5] = {
["id"] = "510923";
["name"] = "大英县";
};
};
};
[9] = {
["id"] = "511000";
["name"] = "内江";
["children"] = {
[1] = {
["id"] = "511002";
["name"] = "中区";
};
[2] = {
["id"] = "511011";
["name"] = "东兴区";
};
[3] = {
["id"] = "511024";
["name"] = "威远县";
};
[4] = {
["id"] = "511025";
["name"] = "资中县";
};
[5] = {
["id"] = "511028";
["name"] = "隆昌县";
};
};
};
[10] = {
["id"] = "511100";
["name"] = "乐山";
["children"] = {
[1] = {
["id"] = "511102";
["name"] = "中区";
};
[2] = {
["id"] = "511111";
["name"] = "沙湾区";
};
[3] = {
["id"] = "511112";
["name"] = "五通桥区";
};
[4] = {
["id"] = "511113";
["name"] = "金口河区";
};
[5] = {
["id"] = "511123";
["name"] = "犍为县";
};
[6] = {
["id"] = "511124";
["name"] = "井研县";
};
[7] = {
["id"] = "511126";
["name"] = "夹江县";
};
[8] = {
["id"] = "511129";
["name"] = "沐川县";
};
[9] = {
["id"] = "511132";
["name"] = "峨边彝族自治县";
};
[10] = {
["id"] = "511133";
["name"] = "马边彝族自治县";
};
[11] = {
["id"] = "511181";
["name"] = "峨眉山";
};
};
};
[11] = {
["id"] = "511300";
["name"] = "南充";
["children"] = {
[1] = {
["id"] = "511302";
["name"] = "顺庆区";
};
[2] = {
["id"] = "511303";
["name"] = "高坪区";
};
[3] = {
["id"] = "511304";
["name"] = "嘉陵区";
};
[4] = {
["id"] = "511321";
["name"] = "南部县";
};
[5] = {
["id"] = "511322";
["name"] = "营山县";
};
[6] = {
["id"] = "511323";
["name"] = "蓬安县";
};
[7] = {
["id"] = "511324";
["name"] = "仪陇县";
};
[8] = {
["id"] = "511325";
["name"] = "西充县";
};
[9] = {
["id"] = "511381";
["name"] = "阆中";
};
};
};
[12] = {
["id"] = "511400";
["name"] = "眉山";
["children"] = {
[1] = {
["id"] = "511402";
["name"] = "东坡区";
};
[2] = {
["id"] = "511421";
["name"] = "仁寿县";
};
[3] = {
["id"] = "511422";
["name"] = "彭山县";
};
[4] = {
["id"] = "511423";
["name"] = "洪雅县";
};
[5] = {
["id"] = "511424";
["name"] = "丹棱县";
};
[6] = {
["id"] = "511425";
["name"] = "青神县";
};
};
};
[13] = {
["id"] = "511500";
["name"] = "宜宾";
["children"] = {
[1] = {
["id"] = "511502";
["name"] = "翠屏区";
};
[2] = {
["id"] = "511503";
["name"] = "南溪区";
};
[3] = {
["id"] = "511521";
["name"] = "宜宾县";
};
[4] = {
["id"] = "511523";
["name"] = "江安县";
};
[5] = {
["id"] = "511524";
["name"] = "长宁县";
};
[6] = {
["id"] = "511525";
["name"] = "高县";
};
[7] = {
["id"] = "511526";
["name"] = "珙县";
};
[8] = {
["id"] = "511527";
["name"] = "筠连县";
};
[9] = {
["id"] = "511528";
["name"] = "兴文县";
};
[10] = {
["id"] = "511529";
["name"] = "屏山县";
};
};
};
[14] = {
["id"] = "511600";
["name"] = "广安";
["children"] = {
[1] = {
["id"] = "511602";
["name"] = "广安区";
};
[2] = {
["id"] = "511603";
["name"] = "前锋区";
};
[3] = {
["id"] = "511621";
["name"] = "岳池县";
};
[4] = {
["id"] = "511622";
["name"] = "武胜县";
};
[5] = {
["id"] = "511623";
["name"] = "邻水县";
};
[6] = {
["id"] = "511681";
["name"] = "华蓥";
};
};
};
[15] = {
["id"] = "511700";
["name"] = "达州";
["children"] = {
[1] = {
["id"] = "511702";
["name"] = "通川区";
};
[2] = {
["id"] = "511703";
["name"] = "达川区";
};
[3] = {
["id"] = "511722";
["name"] = "宣汉县";
};
[4] = {
["id"] = "511723";
["name"] = "开江县";
};
[5] = {
["id"] = "511724";
["name"] = "大竹县";
};
[6] = {
["id"] = "511725";
["name"] = "渠县";
};
[7] = {
["id"] = "511781";
["name"] = "万源";
};
};
};
[16] = {
["id"] = "511800";
["name"] = "雅安";
["children"] = {
[1] = {
["id"] = "511802";
["name"] = "雨城区";
};
[2] = {
["id"] = "511803";
["name"] = "名山区";
};
[3] = {
["id"] = "511822";
["name"] = "荥经县";
};
[4] = {
["id"] = "511823";
["name"] = "汉源县";
};
[5] = {
["id"] = "511824";
["name"] = "石棉县";
};
[6] = {
["id"] = "511825";
["name"] = "天全县";
};
[7] = {
["id"] = "511826";
["name"] = "芦山县";
};
[8] = {
["id"] = "511827";
["name"] = "宝兴县";
};
};
};
[17] = {
["id"] = "511900";
["name"] = "巴中";
["children"] = {
[1] = {
["id"] = "511902";
["name"] = "巴州区";
};
[2] = {
["id"] = "511903";
["name"] = "恩阳区";
};
[3] = {
["id"] = "511921";
["name"] = "通江县";
};
[4] = {
["id"] = "511922";
["name"] = "南江县";
};
[5] = {
["id"] = "511923";
["name"] = "平昌县";
};
};
};
[18] = {
["id"] = "512000";
["name"] = "资阳";
["children"] = {
[1] = {
["id"] = "512002";
["name"] = "雁江区";
};
[2] = {
["id"] = "512021";
["name"] = "安岳县";
};
[3] = {
["id"] = "512022";
["name"] = "乐至县";
};
[4] = {
["id"] = "512081";
["name"] = "简阳";
};
};
};
[19] = {
["id"] = "513200";
["name"] = "阿坝";
["children"] = {
[1] = {
["id"] = "513221";
["name"] = "汶川县";
};
[2] = {
["id"] = "513222";
["name"] = "理县";
};
[3] = {
["id"] = "513223";
["name"] = "茂县";
};
[4] = {
["id"] = "513224";
["name"] = "松潘县";
};
[5] = {
["id"] = "513225";
["name"] = "九寨沟县";
};
[6] = {
["id"] = "513226";
["name"] = "金川县";
};
[7] = {
["id"] = "513227";
["name"] = "小金县";
};
[8] = {
["id"] = "513228";
["name"] = "黑水县";
};
[9] = {
["id"] = "513229";
["name"] = "马尔康县";
};
[10] = {
["id"] = "513230";
["name"] = "壤塘县";
};
[11] = {
["id"] = "513231";
["name"] = "阿坝县";
};
[12] = {
["id"] = "513232";
["name"] = "若尔盖县";
};
[13] = {
["id"] = "513233";
["name"] = "红原县";
};
};
};
[20] = {
["id"] = "513300";
["name"] = "甘孜";
["children"] = {
[1] = {
["id"] = "513321";
["name"] = "康定县";
};
[2] = {
["id"] = "513322";
["name"] = "泸定县";
};
[3] = {
["id"] = "513323";
["name"] = "丹巴县";
};
[4] = {
["id"] = "513324";
["name"] = "九龙县";
};
[5] = {
["id"] = "513325";
["name"] = "雅江县";
};
[6] = {
["id"] = "513326";
["name"] = "道孚县";
};
[7] = {
["id"] = "513327";
["name"] = "炉霍县";
};
[8] = {
["id"] = "513328";
["name"] = "甘孜县";
};
[9] = {
["id"] = "513329";
["name"] = "新龙县";
};
[10] = {
["id"] = "513330";
["name"] = "德格县";
};
[11] = {
["id"] = "513331";
["name"] = "白玉县";
};
[12] = {
["id"] = "513332";
["name"] = "石渠县";
};
[13] = {
["id"] = "513333";
["name"] = "色达县";
};
[14] = {
["id"] = "513334";
["name"] = "理塘县";
};
[15] = {
["id"] = "513335";
["name"] = "巴塘县";
};
[16] = {
["id"] = "513336";
["name"] = "乡城县";
};
[17] = {
["id"] = "513337";
["name"] = "稻城县";
};
[18] = {
["id"] = "513338";
["name"] = "得荣县";
};
};
};
[21] = {
["id"] = "513400";
["name"] = "凉山";
["children"] = {
[1] = {
["id"] = "513401";
["name"] = "西昌";
};
[2] = {
["id"] = "513422";
["name"] = "木里藏族自治县";
};
[3] = {
["id"] = "513423";
["name"] = "盐源县";
};
[4] = {
["id"] = "513424";
["name"] = "德昌县";
};
[5] = {
["id"] = "513425";
["name"] = "会理县";
};
[6] = {
["id"] = "513426";
["name"] = "会东县";
};
[7] = {
["id"] = "513427";
["name"] = "宁南县";
};
[8] = {
["id"] = "513428";
["name"] = "普格县";
};
[9] = {
["id"] = "513429";
["name"] = "布拖县";
};
[10] = {
["id"] = "513430";
["name"] = "金阳县";
};
[11] = {
["id"] = "513431";
["name"] = "昭觉县";
};
[12] = {
["id"] = "513432";
["name"] = "喜德县";
};
[13] = {
["id"] = "513433";
["name"] = "冕宁县";
};
[14] = {
["id"] = "513434";
["name"] = "越西县";
};
[15] = {
["id"] = "513435";
["name"] = "甘洛县";
};
[16] = {
["id"] = "513436";
["name"] = "美姑县";
};
[17] = {
["id"] = "513437";
["name"] = "雷波县";
};
};
};
};
};
[24] = {
["id"] = "520000";
["name"] = "贵州";
["children"] = {
[1] = {
["id"] = "520100";
["name"] = "贵阳";
["children"] = {
[1] = {
["id"] = "520102";
["name"] = "南明区";
};
[2] = {
["id"] = "520103";
["name"] = "云岩区";
};
[3] = {
["id"] = "520111";
["name"] = "花溪区";
};
[4] = {
["id"] = "520112";
["name"] = "乌当区";
};
[5] = {
["id"] = "520113";
["name"] = "白云区";
};
[6] = {
["id"] = "520115";
["name"] = "观山湖区";
};
[7] = {
["id"] = "520121";
["name"] = "开阳县";
};
[8] = {
["id"] = "520122";
["name"] = "息烽县";
};
[9] = {
["id"] = "520123";
["name"] = "修文县";
};
[10] = {
["id"] = "520181";
["name"] = "清镇";
};
};
};
[2] = {
["id"] = "520200";
["name"] = "六盘水";
["children"] = {
[1] = {
["id"] = "520201";
["name"] = "钟山区";
};
[2] = {
["id"] = "520203";
["name"] = "六枝特区";
};
[3] = {
["id"] = "520221";
["name"] = "水城县";
};
[4] = {
["id"] = "520222";
["name"] = "盘县";
};
};
};
[3] = {
["id"] = "520300";
["name"] = "遵义";
["children"] = {
[1] = {
["id"] = "520302";
["name"] = "红花岗区";
};
[2] = {
["id"] = "520303";
["name"] = "汇川区";
};
[3] = {
["id"] = "520321";
["name"] = "遵义县";
};
[4] = {
["id"] = "520322";
["name"] = "桐梓县";
};
[5] = {
["id"] = "520323";
["name"] = "绥阳县";
};
[6] = {
["id"] = "520324";
["name"] = "正安县";
};
[7] = {
["id"] = "520325";
["name"] = "道真仡佬族苗族自治县";
};
[8] = {
["id"] = "520326";
["name"] = "务川仡佬族苗族自治县";
};
[9] = {
["id"] = "520327";
["name"] = "凤冈县";
};
[10] = {
["id"] = "520328";
["name"] = "湄潭县";
};
[11] = {
["id"] = "520329";
["name"] = "余庆县";
};
[12] = {
["id"] = "520330";
["name"] = "习水县";
};
[13] = {
["id"] = "520381";
["name"] = "赤水";
};
[14] = {
["id"] = "520382";
["name"] = "仁怀";
};
};
};
[4] = {
["id"] = "520400";
["name"] = "安顺";
["children"] = {
[1] = {
["id"] = "520402";
["name"] = "西秀区";
};
[2] = {
["id"] = "520421";
["name"] = "平坝县";
};
[3] = {
["id"] = "520422";
["name"] = "普定县";
};
[4] = {
["id"] = "520423";
["name"] = "镇宁布依族苗族自治县";
};
[5] = {
["id"] = "520424";
["name"] = "关岭布依族苗族自治县";
};
[6] = {
["id"] = "520425";
["name"] = "紫云苗族布依族自治县";
};
};
};
[5] = {
["id"] = "520500";
["name"] = "毕节";
["children"] = {
[1] = {
["id"] = "520502";
["name"] = "七星关区";
};
[2] = {
["id"] = "520521";
["name"] = "大方县";
};
[3] = {
["id"] = "520522";
["name"] = "黔西县";
};
[4] = {
["id"] = "520523";
["name"] = "金沙县";
};
[5] = {
["id"] = "520524";
["name"] = "织金县";
};
[6] = {
["id"] = "520525";
["name"] = "纳雍县";
};
[7] = {
["id"] = "520526";
["name"] = "威宁彝族回族苗族自治县";
};
[8] = {
["id"] = "520527";
["name"] = "赫章县";
};
};
};
[6] = {
["id"] = "520600";
["name"] = "铜仁";
["children"] = {
[1] = {
["id"] = "520602";
["name"] = "碧江区";
};
[2] = {
["id"] = "520603";
["name"] = "万山区";
};
[3] = {
["id"] = "520621";
["name"] = "江口县";
};
[4] = {
["id"] = "520622";
["name"] = "玉屏侗族自治县";
};
[5] = {
["id"] = "520623";
["name"] = "石阡县";
};
[6] = {
["id"] = "520624";
["name"] = "思南县";
};
[7] = {
["id"] = "520625";
["name"] = "印江土家族苗族自治县";
};
[8] = {
["id"] = "520626";
["name"] = "德江县";
};
[9] = {
["id"] = "520627";
["name"] = "沿河土家族自治县";
};
[10] = {
["id"] = "520628";
["name"] = "松桃苗族自治县";
};
};
};
[7] = {
["id"] = "522300";
["name"] = "黔西南";
["children"] = {
[1] = {
["id"] = "522301";
["name"] = "兴义";
};
[2] = {
["id"] = "522322";
["name"] = "兴仁县";
};
[3] = {
["id"] = "522323";
["name"] = "普安县";
};
[4] = {
["id"] = "522324";
["name"] = "晴隆县";
};
[5] = {
["id"] = "522325";
["name"] = "贞丰县";
};
[6] = {
["id"] = "522326";
["name"] = "望谟县";
};
[7] = {
["id"] = "522327";
["name"] = "册亨县";
};
[8] = {
["id"] = "522328";
["name"] = "安龙县";
};
};
};
[8] = {
["id"] = "522600";
["name"] = "黔东南";
["children"] = {
[1] = {
["id"] = "522601";
["name"] = "凯里";
};
[2] = {
["id"] = "522622";
["name"] = "黄平县";
};
[3] = {
["id"] = "522623";
["name"] = "施秉县";
};
[4] = {
["id"] = "522624";
["name"] = "三穗县";
};
[5] = {
["id"] = "522625";
["name"] = "镇远县";
};
[6] = {
["id"] = "522626";
["name"] = "岑巩县";
};
[7] = {
["id"] = "522627";
["name"] = "天柱县";
};
[8] = {
["id"] = "522628";
["name"] = "锦屏县";
};
[9] = {
["id"] = "522629";
["name"] = "剑河县";
};
[10] = {
["id"] = "522630";
["name"] = "台江县";
};
[11] = {
["id"] = "522631";
["name"] = "黎平县";
};
[12] = {
["id"] = "522632";
["name"] = "榕江县";
};
[13] = {
["id"] = "522633";
["name"] = "从江县";
};
[14] = {
["id"] = "522634";
["name"] = "雷山县";
};
[15] = {
["id"] = "522635";
["name"] = "麻江县";
};
[16] = {
["id"] = "522636";
["name"] = "丹寨县";
};
};
};
[9] = {
["id"] = "522700";
["name"] = "黔南";
["children"] = {
[1] = {
["id"] = "522701";
["name"] = "都匀";
};
[2] = {
["id"] = "522702";
["name"] = "福泉";
};
[3] = {
["id"] = "522722";
["name"] = "荔波县";
};
[4] = {
["id"] = "522723";
["name"] = "贵定县";
};
[5] = {
["id"] = "522725";
["name"] = "瓮安县";
};
[6] = {
["id"] = "522726";
["name"] = "独山县";
};
[7] = {
["id"] = "522727";
["name"] = "平塘县";
};
[8] = {
["id"] = "522728";
["name"] = "罗甸县";
};
[9] = {
["id"] = "522729";
["name"] = "长顺县";
};
[10] = {
["id"] = "522730";
["name"] = "龙里县";
};
[11] = {
["id"] = "522731";
["name"] = "惠水县";
};
[12] = {
["id"] = "522732";
["name"] = "三都水族自治县";
};
};
};
};
};
[25] = {
["id"] = "530000";
["name"] = "云南";
["children"] = {
[1] = {
["id"] = "530100";
["name"] = "昆明";
["children"] = {
[1] = {
["id"] = "530102";
["name"] = "五华区";
};
[2] = {
["id"] = "530103";
["name"] = "盘龙区";
};
[3] = {
["id"] = "530111";
["name"] = "官渡区";
};
[4] = {
["id"] = "530112";
["name"] = "西山区";
};
[5] = {
["id"] = "530113";
["name"] = "东川区";
};
[6] = {
["id"] = "530114";
["name"] = "呈贡区";
};
[7] = {
["id"] = "530122";
["name"] = "晋宁县";
};
[8] = {
["id"] = "530124";
["name"] = "富民县";
};
[9] = {
["id"] = "530125";
["name"] = "宜良县";
};
[10] = {
["id"] = "530126";
["name"] = "石林彝族自治县";
};
[11] = {
["id"] = "530127";
["name"] = "嵩明县";
};
[12] = {
["id"] = "530128";
["name"] = "禄劝彝族苗族自治县";
};
[13] = {
["id"] = "530129";
["name"] = "寻甸回族彝族自治县";
};
[14] = {
["id"] = "530181";
["name"] = "安宁";
};
};
};
[2] = {
["id"] = "530300";
["name"] = "曲靖";
["children"] = {
[1] = {
["id"] = "530302";
["name"] = "麒麟区";
};
[2] = {
["id"] = "530321";
["name"] = "马龙县";
};
[3] = {
["id"] = "530322";
["name"] = "陆良县";
};
[4] = {
["id"] = "530323";
["name"] = "师宗县";
};
[5] = {
["id"] = "530324";
["name"] = "罗平县";
};
[6] = {
["id"] = "530325";
["name"] = "富源县";
};
[7] = {
["id"] = "530326";
["name"] = "会泽县";
};
[8] = {
["id"] = "530328";
["name"] = "沾益县";
};
[9] = {
["id"] = "530381";
["name"] = "宣威";
};
};
};
[3] = {
["id"] = "530400";
["name"] = "玉溪";
["children"] = {
[1] = {
["id"] = "530402";
["name"] = "红塔区";
};
[2] = {
["id"] = "530421";
["name"] = "江川县";
};
[3] = {
["id"] = "530422";
["name"] = "澄江县";
};
[4] = {
["id"] = "530423";
["name"] = "通海县";
};
[5] = {
["id"] = "530424";
["name"] = "华宁县";
};
[6] = {
["id"] = "530425";
["name"] = "易门县";
};
[7] = {
["id"] = "530426";
["name"] = "峨山彝族自治县";
};
[8] = {
["id"] = "530427";
["name"] = "新平彝族傣族自治县";
};
[9] = {
["id"] = "530428";
["name"] = "元江哈尼族彝族傣族自治县";
};
};
};
[4] = {
["id"] = "530500";
["name"] = "保山";
["children"] = {
[1] = {
["id"] = "530502";
["name"] = "隆阳区";
};
[2] = {
["id"] = "530521";
["name"] = "施甸县";
};
[3] = {
["id"] = "530522";
["name"] = "腾冲县";
};
[4] = {
["id"] = "530523";
["name"] = "龙陵县";
};
[5] = {
["id"] = "530524";
["name"] = "昌宁县";
};
};
};
[5] = {
["id"] = "530600";
["name"] = "昭通";
["children"] = {
[1] = {
["id"] = "530602";
["name"] = "昭阳区";
};
[2] = {
["id"] = "530621";
["name"] = "鲁甸县";
};
[3] = {
["id"] = "530622";
["name"] = "巧家县";
};
[4] = {
["id"] = "530623";
["name"] = "盐津县";
};
[5] = {
["id"] = "530624";
["name"] = "大关县";
};
[6] = {
["id"] = "530625";
["name"] = "永善县";
};
[7] = {
["id"] = "530626";
["name"] = "绥江县";
};
[8] = {
["id"] = "530627";
["name"] = "镇雄县";
};
[9] = {
["id"] = "530628";
["name"] = "彝良县";
};
[10] = {
["id"] = "530629";
["name"] = "威信县";
};
[11] = {
["id"] = "530630";
["name"] = "水富县";
};
};
};
[6] = {
["id"] = "530700";
["name"] = "丽江";
["children"] = {
[1] = {
["id"] = "530702";
["name"] = "古城区";
};
[2] = {
["id"] = "530721";
["name"] = "玉龙纳西族自治县";
};
[3] = {
["id"] = "530722";
["name"] = "永胜县";
};
[4] = {
["id"] = "530723";
["name"] = "华坪县";
};
[5] = {
["id"] = "530724";
["name"] = "宁蒗彝族自治县";
};
};
};
[7] = {
["id"] = "530800";
["name"] = "普洱";
["children"] = {
[1] = {
["id"] = "530802";
["name"] = "思茅区";
};
[2] = {
["id"] = "530821";
["name"] = "宁洱哈尼族彝族自治县";
};
[3] = {
["id"] = "530822";
["name"] = "墨江哈尼族自治县";
};
[4] = {
["id"] = "530823";
["name"] = "景东彝族自治县";
};
[5] = {
["id"] = "530824";
["name"] = "景谷傣族彝族自治县";
};
[6] = {
["id"] = "530825";
["name"] = "镇沅彝族哈尼族拉祜族自治县";
};
[7] = {
["id"] = "530826";
["name"] = "江城哈尼族彝族自治县";
};
[8] = {
["id"] = "530827";
["name"] = "孟连傣族拉祜族佤族自治县";
};
[9] = {
["id"] = "530828";
["name"] = "澜沧拉祜族自治县";
};
[10] = {
["id"] = "530829";
["name"] = "西盟佤族自治县";
};
};
};
[8] = {
["id"] = "530900";
["name"] = "临沧";
["children"] = {
[1] = {
["id"] = "530902";
["name"] = "临翔区";
};
[2] = {
["id"] = "530921";
["name"] = "凤庆县";
};
[3] = {
["id"] = "530922";
["name"] = "云县";
};
[4] = {
["id"] = "530923";
["name"] = "永德县";
};
[5] = {
["id"] = "530924";
["name"] = "镇康县";
};
[6] = {
["id"] = "530925";
["name"] = "双江拉祜族佤族布朗族傣族自治县";
};
[7] = {
["id"] = "530926";
["name"] = "耿马傣族佤族自治县";
};
[8] = {
["id"] = "530927";
["name"] = "沧源佤族自治县";
};
};
};
[9] = {
["id"] = "532300";
["name"] = "楚雄";
["children"] = {
[1] = {
["id"] = "532301";
["name"] = "楚雄";
};
[2] = {
["id"] = "532322";
["name"] = "双柏县";
};
[3] = {
["id"] = "532323";
["name"] = "牟定县";
};
[4] = {
["id"] = "532324";
["name"] = "南华县";
};
[5] = {
["id"] = "532325";
["name"] = "姚安县";
};
[6] = {
["id"] = "532326";
["name"] = "大姚县";
};
[7] = {
["id"] = "532327";
["name"] = "永仁县";
};
[8] = {
["id"] = "532328";
["name"] = "元谋县";
};
[9] = {
["id"] = "532329";
["name"] = "武定县";
};
[10] = {
["id"] = "532331";
["name"] = "禄丰县";
};
};
};
[10] = {
["id"] = "532500";
["name"] = "红河";
["children"] = {
[1] = {
["id"] = "532501";
["name"] = "个旧";
};
[2] = {
["id"] = "532502";
["name"] = "开远";
};
[3] = {
["id"] = "532503";
["name"] = "蒙自";
};
[4] = {
["id"] = "532504";
["name"] = "弥勒";
};
[5] = {
["id"] = "532523";
["name"] = "屏边苗族自治县";
};
[6] = {
["id"] = "532524";
["name"] = "建水县";
};
[7] = {
["id"] = "532525";
["name"] = "石屏县";
};
[8] = {
["id"] = "532527";
["name"] = "泸西县";
};
[9] = {
["id"] = "532528";
["name"] = "元阳县";
};
[10] = {
["id"] = "532529";
["name"] = "红河县";
};
[11] = {
["id"] = "532530";
["name"] = "金平苗族瑶族傣族自治县";
};
[12] = {
["id"] = "532531";
["name"] = "绿春县";
};
[13] = {
["id"] = "532532";
["name"] = "河口瑶族自治县";
};
};
};
[11] = {
["id"] = "532600";
["name"] = "文山";
["children"] = {
[1] = {
["id"] = "532601";
["name"] = "文山";
};
[2] = {
["id"] = "532622";
["name"] = "砚山县";
};
[3] = {
["id"] = "532623";
["name"] = "西畴县";
};
[4] = {
["id"] = "532624";
["name"] = "麻栗坡县";
};
[5] = {
["id"] = "532625";
["name"] = "马关县";
};
[6] = {
["id"] = "532626";
["name"] = "丘北县";
};
[7] = {
["id"] = "532627";
["name"] = "广南县";
};
[8] = {
["id"] = "532628";
["name"] = "富宁县";
};
};
};
[12] = {
["id"] = "532800";
["name"] = "西双版纳";
["children"] = {
[1] = {
["id"] = "532801";
["name"] = "景洪";
};
[2] = {
["id"] = "532822";
["name"] = "勐海县";
};
[3] = {
["id"] = "532823";
["name"] = "勐腊县";
};
};
};
[13] = {
["id"] = "532900";
["name"] = "大理";
["children"] = {
[1] = {
["id"] = "532901";
["name"] = "大理";
};
[2] = {
["id"] = "532922";
["name"] = "漾濞彝族自治县";
};
[3] = {
["id"] = "532923";
["name"] = "祥云县";
};
[4] = {
["id"] = "532924";
["name"] = "宾川县";
};
[5] = {
["id"] = "532925";
["name"] = "弥渡县";
};
[6] = {
["id"] = "532926";
["name"] = "南涧彝族自治县";
};
[7] = {
["id"] = "532927";
["name"] = "巍山彝族回族自治县";
};
[8] = {
["id"] = "532928";
["name"] = "永平县";
};
[9] = {
["id"] = "532929";
["name"] = "云龙县";
};
[10] = {
["id"] = "532930";
["name"] = "洱源县";
};
[11] = {
["id"] = "532931";
["name"] = "剑川县";
};
[12] = {
["id"] = "532932";
["name"] = "鹤庆县";
};
};
};
[14] = {
["id"] = "533100";
["name"] = "德宏";
["children"] = {
[1] = {
["id"] = "533102";
["name"] = "瑞丽";
};
[2] = {
["id"] = "533103";
["name"] = "芒";
};
[3] = {
["id"] = "533122";
["name"] = "梁河县";
};
[4] = {
["id"] = "533123";
["name"] = "盈江县";
};
[5] = {
["id"] = "533124";
["name"] = "陇川县";
};
};
};
[15] = {
["id"] = "533300";
["name"] = "怒江";
["children"] = {
[1] = {
["id"] = "533321";
["name"] = "泸水县";
};
[2] = {
["id"] = "533323";
["name"] = "福贡县";
};
[3] = {
["id"] = "533324";
["name"] = "贡山独龙族怒族自治县";
};
[4] = {
["id"] = "533325";
["name"] = "兰坪白族普米族自治县";
};
};
};
[16] = {
["id"] = "533400";
["name"] = "迪庆";
["children"] = {
[1] = {
["id"] = "533421";
["name"] = "香格里拉县";
};
[2] = {
["id"] = "533422";
["name"] = "德钦县";
};
[3] = {
["id"] = "533423";
["name"] = "维西傈僳族自治县";
};
};
};
};
};
[26] = {
["id"] = "540000";
["name"] = "西藏";
["children"] = {
[1] = {
["id"] = "540100";
["name"] = "拉萨";
["children"] = {
[1] = {
["id"] = "540102";
["name"] = "城关区";
};
[2] = {
["id"] = "540121";
["name"] = "林周县";
};
[3] = {
["id"] = "540122";
["name"] = "当雄县";
};
[4] = {
["id"] = "540123";
["name"] = "尼木县";
};
[5] = {
["id"] = "540124";
["name"] = "曲水县";
};
[6] = {
["id"] = "540125";
["name"] = "堆龙德庆县";
};
[7] = {
["id"] = "540126";
["name"] = "达孜县";
};
[8] = {
["id"] = "540127";
["name"] = "墨竹工卡县";
};
};
};
[2] = {
["id"] = "542100";
["name"] = "昌都";
["children"] = {
[1] = {
["id"] = "542121";
["name"] = "昌都县";
};
[2] = {
["id"] = "542122";
["name"] = "江达县";
};
[3] = {
["id"] = "542123";
["name"] = "贡觉县";
};
[4] = {
["id"] = "542124";
["name"] = "类乌齐县";
};
[5] = {
["id"] = "542125";
["name"] = "丁青县";
};
[6] = {
["id"] = "542126";
["name"] = "察雅县";
};
[7] = {
["id"] = "542127";
["name"] = "八宿县";
};
[8] = {
["id"] = "542128";
["name"] = "左贡县";
};
[9] = {
["id"] = "542129";
["name"] = "芒康县";
};
[10] = {
["id"] = "542132";
["name"] = "洛隆县";
};
[11] = {
["id"] = "542133";
["name"] = "边坝县";
};
};
};
[3] = {
["id"] = "542200";
["name"] = "山南";
["children"] = {
[1] = {
["id"] = "542221";
["name"] = "乃东县";
};
[2] = {
["id"] = "542222";
["name"] = "扎囊县";
};
[3] = {
["id"] = "542223";
["name"] = "贡嘎县";
};
[4] = {
["id"] = "542224";
["name"] = "桑日县";
};
[5] = {
["id"] = "542225";
["name"] = "琼结县";
};
[6] = {
["id"] = "542226";
["name"] = "曲松县";
};
[7] = {
["id"] = "542227";
["name"] = "措美县";
};
[8] = {
["id"] = "542228";
["name"] = "洛扎县";
};
[9] = {
["id"] = "542229";
["name"] = "加查县";
};
[10] = {
["id"] = "542231";
["name"] = "隆子县";
};
[11] = {
["id"] = "542232";
["name"] = "错那县";
};
[12] = {
["id"] = "542233";
["name"] = "浪卡子县";
};
};
};
[4] = {
["id"] = "542300";
["name"] = "日喀则";
["children"] = {
[1] = {
["id"] = "542301";
["name"] = "日喀则";
};
[2] = {
["id"] = "542322";
["name"] = "南木林县";
};
[3] = {
["id"] = "542323";
["name"] = "江孜县";
};
[4] = {
["id"] = "542324";
["name"] = "定日县";
};
[5] = {
["id"] = "542325";
["name"] = "萨迦县";
};
[6] = {
["id"] = "542326";
["name"] = "拉孜县";
};
[7] = {
["id"] = "542327";
["name"] = "昂仁县";
};
[8] = {
["id"] = "542328";
["name"] = "谢通门县";
};
[9] = {
["id"] = "542329";
["name"] = "白朗县";
};
[10] = {
["id"] = "542330";
["name"] = "仁布县";
};
[11] = {
["id"] = "542331";
["name"] = "康马县";
};
[12] = {
["id"] = "542332";
["name"] = "定结县";
};
[13] = {
["id"] = "542333";
["name"] = "仲巴县";
};
[14] = {
["id"] = "542334";
["name"] = "亚东县";
};
[15] = {
["id"] = "542335";
["name"] = "吉隆县";
};
[16] = {
["id"] = "542336";
["name"] = "聂拉木县";
};
[17] = {
["id"] = "542337";
["name"] = "萨嘎县";
};
[18] = {
["id"] = "542338";
["name"] = "岗巴县";
};
};
};
[5] = {
["id"] = "542400";
["name"] = "那曲";
["children"] = {
[1] = {
["id"] = "542421";
["name"] = "那曲县";
};
[2] = {
["id"] = "542422";
["name"] = "嘉黎县";
};
[3] = {
["id"] = "542423";
["name"] = "比如县";
};
[4] = {
["id"] = "542424";
["name"] = "聂荣县";
};
[5] = {
["id"] = "542425";
["name"] = "安多县";
};
[6] = {
["id"] = "542426";
["name"] = "申扎县";
};
[7] = {
["id"] = "542427";
["name"] = "索县";
};
[8] = {
["id"] = "542428";
["name"] = "班戈县";
};
[9] = {
["id"] = "542429";
["name"] = "巴青县";
};
[10] = {
["id"] = "542430";
["name"] = "尼玛县";
};
[11] = {
["id"] = "542431";
["name"] = "双湖县";
};
};
};
[6] = {
["id"] = "542500";
["name"] = "阿里";
["children"] = {
[1] = {
["id"] = "542521";
["name"] = "普兰县";
};
[2] = {
["id"] = "542522";
["name"] = "札达县";
};
[3] = {
["id"] = "542523";
["name"] = "噶尔县";
};
[4] = {
["id"] = "542524";
["name"] = "日土县";
};
[5] = {
["id"] = "542525";
["name"] = "革吉县";
};
[6] = {
["id"] = "542526";
["name"] = "改则县";
};
[7] = {
["id"] = "542527";
["name"] = "措勤县";
};
};
};
[7] = {
["id"] = "542600";
["name"] = "林芝";
["children"] = {
[1] = {
["id"] = "542621";
["name"] = "林芝县";
};
[2] = {
["id"] = "542622";
["name"] = "工布江达县";
};
[3] = {
["id"] = "542623";
["name"] = "米林县";
};
[4] = {
["id"] = "542624";
["name"] = "墨脱县";
};
[5] = {
["id"] = "542625";
["name"] = "波密县";
};
[6] = {
["id"] = "542626";
["name"] = "察隅县";
};
[7] = {
["id"] = "542627";
["name"] = "朗县";
};
};
};
};
};
[27] = {
["id"] = "610000";
["name"] = "陕西";
["children"] = {
[1] = {
["id"] = "610100";
["name"] = "西安";
["children"] = {
[1] = {
["id"] = "610102";
["name"] = "新城区";
};
[2] = {
["id"] = "610103";
["name"] = "碑林区";
};
[3] = {
["id"] = "610104";
["name"] = "莲湖区";
};
[4] = {
["id"] = "610111";
["name"] = "灞桥区";
};
[5] = {
["id"] = "610112";
["name"] = "未央区";
};
[6] = {
["id"] = "610113";
["name"] = "雁塔区";
};
[7] = {
["id"] = "610114";
["name"] = "阎良区";
};
[8] = {
["id"] = "610115";
["name"] = "临潼区";
};
[9] = {
["id"] = "610116";
["name"] = "长安区";
};
[10] = {
["id"] = "610122";
["name"] = "蓝田县";
};
[11] = {
["id"] = "610124";
["name"] = "周至县";
};
[12] = {
["id"] = "610125";
["name"] = "户县";
};
[13] = {
["id"] = "610126";
["name"] = "高陵县";
};
};
};
[2] = {
["id"] = "610200";
["name"] = "铜川";
["children"] = {
[1] = {
["id"] = "610202";
["name"] = "王益区";
};
[2] = {
["id"] = "610203";
["name"] = "印台区";
};
[3] = {
["id"] = "610204";
["name"] = "耀州区";
};
[4] = {
["id"] = "610222";
["name"] = "宜君县";
};
};
};
[3] = {
["id"] = "610300";
["name"] = "宝鸡";
["children"] = {
[1] = {
["id"] = "610302";
["name"] = "渭滨区";
};
[2] = {
["id"] = "610303";
["name"] = "金台区";
};
[3] = {
["id"] = "610304";
["name"] = "陈仓区";
};
[4] = {
["id"] = "610322";
["name"] = "凤翔县";
};
[5] = {
["id"] = "610323";
["name"] = "岐山县";
};
[6] = {
["id"] = "610324";
["name"] = "扶风县";
};
[7] = {
["id"] = "610326";
["name"] = "眉县";
};
[8] = {
["id"] = "610327";
["name"] = "陇县";
};
[9] = {
["id"] = "610328";
["name"] = "千阳县";
};
[10] = {
["id"] = "610329";
["name"] = "麟游县";
};
[11] = {
["id"] = "610330";
["name"] = "凤县";
};
[12] = {
["id"] = "610331";
["name"] = "太白县";
};
};
};
[4] = {
["id"] = "610400";
["name"] = "咸阳";
["children"] = {
[1] = {
["id"] = "610402";
["name"] = "秦都区";
};
[2] = {
["id"] = "610403";
["name"] = "杨陵区";
};
[3] = {
["id"] = "610404";
["name"] = "渭城区";
};
[4] = {
["id"] = "610422";
["name"] = "三原县";
};
[5] = {
["id"] = "610423";
["name"] = "泾阳县";
};
[6] = {
["id"] = "610424";
["name"] = "乾县";
};
[7] = {
["id"] = "610425";
["name"] = "礼泉县";
};
[8] = {
["id"] = "610426";
["name"] = "永寿县";
};
[9] = {
["id"] = "610427";
["name"] = "彬县";
};
[10] = {
["id"] = "610428";
["name"] = "长武县";
};
[11] = {
["id"] = "610429";
["name"] = "旬邑县";
};
[12] = {
["id"] = "610430";
["name"] = "淳化县";
};
[13] = {
["id"] = "610431";
["name"] = "武功县";
};
[14] = {
["id"] = "610481";
["name"] = "兴平";
};
};
};
[5] = {
["id"] = "610500";
["name"] = "渭南";
["children"] = {
[1] = {
["id"] = "610502";
["name"] = "临渭区";
};
[2] = {
["id"] = "610521";
["name"] = "华县";
};
[3] = {
["id"] = "610522";
["name"] = "潼关县";
};
[4] = {
["id"] = "610523";
["name"] = "大荔县";
};
[5] = {
["id"] = "610524";
["name"] = "合阳县";
};
[6] = {
["id"] = "610525";
["name"] = "澄城县";
};
[7] = {
["id"] = "610526";
["name"] = "蒲城县";
};
[8] = {
["id"] = "610527";
["name"] = "白水县";
};
[9] = {
["id"] = "610528";
["name"] = "富平县";
};
[10] = {
["id"] = "610581";
["name"] = "韩城";
};
[11] = {
["id"] = "610582";
["name"] = "华阴";
};
};
};
[6] = {
["id"] = "610600";
["name"] = "延安";
["children"] = {
[1] = {
["id"] = "610602";
["name"] = "宝塔区";
};
[2] = {
["id"] = "610621";
["name"] = "延长县";
};
[3] = {
["id"] = "610622";
["name"] = "延川县";
};
[4] = {
["id"] = "610623";
["name"] = "子长县";
};
[5] = {
["id"] = "610624";
["name"] = "安塞县";
};
[6] = {
["id"] = "610625";
["name"] = "志丹县";
};
[7] = {
["id"] = "610626";
["name"] = "吴起县";
};
[8] = {
["id"] = "610627";
["name"] = "甘泉县";
};
[9] = {
["id"] = "610628";
["name"] = "富县";
};
[10] = {
["id"] = "610629";
["name"] = "洛川县";
};
[11] = {
["id"] = "610630";
["name"] = "宜川县";
};
[12] = {
["id"] = "610631";
["name"] = "黄龙县";
};
[13] = {
["id"] = "610632";
["name"] = "黄陵县";
};
};
};
[7] = {
["id"] = "610700";
["name"] = "汉中";
["children"] = {
[1] = {
["id"] = "610702";
["name"] = "汉台区";
};
[2] = {
["id"] = "610721";
["name"] = "南郑县";
};
[3] = {
["id"] = "610722";
["name"] = "城固县";
};
[4] = {
["id"] = "610723";
["name"] = "洋县";
};
[5] = {
["id"] = "610724";
["name"] = "西乡县";
};
[6] = {
["id"] = "610725";
["name"] = "勉县";
};
[7] = {
["id"] = "610726";
["name"] = "宁强县";
};
[8] = {
["id"] = "610727";
["name"] = "略阳县";
};
[9] = {
["id"] = "610728";
["name"] = "镇巴县";
};
[10] = {
["id"] = "610729";
["name"] = "留坝县";
};
[11] = {
["id"] = "610730";
["name"] = "佛坪县";
};
};
};
[8] = {
["id"] = "610800";
["name"] = "榆林";
["children"] = {
[1] = {
["id"] = "610802";
["name"] = "榆阳区";
};
[2] = {
["id"] = "610821";
["name"] = "神木县";
};
[3] = {
["id"] = "610822";
["name"] = "府谷县";
};
[4] = {
["id"] = "610823";
["name"] = "横山县";
};
[5] = {
["id"] = "610824";
["name"] = "靖边县";
};
[6] = {
["id"] = "610825";
["name"] = "定边县";
};
[7] = {
["id"] = "610826";
["name"] = "绥德县";
};
[8] = {
["id"] = "610827";
["name"] = "米脂县";
};
[9] = {
["id"] = "610828";
["name"] = "佳县";
};
[10] = {
["id"] = "610829";
["name"] = "吴堡县";
};
[11] = {
["id"] = "610830";
["name"] = "清涧县";
};
[12] = {
["id"] = "610831";
["name"] = "子洲县";
};
};
};
[9] = {
["id"] = "610900";
["name"] = "安康";
["children"] = {
[1] = {
["id"] = "610902";
["name"] = "汉滨区";
};
[2] = {
["id"] = "610921";
["name"] = "汉阴县";
};
[3] = {
["id"] = "610922";
["name"] = "石泉县";
};
[4] = {
["id"] = "610923";
["name"] = "宁陕县";
};
[5] = {
["id"] = "610924";
["name"] = "紫阳县";
};
[6] = {
["id"] = "610925";
["name"] = "岚皋县";
};
[7] = {
["id"] = "610926";
["name"] = "平利县";
};
[8] = {
["id"] = "610927";
["name"] = "镇坪县";
};
[9] = {
["id"] = "610928";
["name"] = "旬阳县";
};
[10] = {
["id"] = "610929";
["name"] = "白河县";
};
};
};
[10] = {
["id"] = "611000";
["name"] = "商洛";
["children"] = {
[1] = {
["id"] = "611002";
["name"] = "商州区";
};
[2] = {
["id"] = "611021";
["name"] = "洛南县";
};
[3] = {
["id"] = "611022";
["name"] = "丹凤县";
};
[4] = {
["id"] = "611023";
["name"] = "商南县";
};
[5] = {
["id"] = "611024";
["name"] = "山阳县";
};
[6] = {
["id"] = "611025";
["name"] = "镇安县";
};
[7] = {
["id"] = "611026";
["name"] = "柞水县";
};
};
};
};
};
[28] = {
["id"] = "620000";
["name"] = "甘肃";
["children"] = {
[1] = {
["id"] = "620100";
["name"] = "兰州";
["children"] = {
[1] = {
["id"] = "620102";
["name"] = "城关区";
};
[2] = {
["id"] = "620103";
["name"] = "七里河区";
};
[3] = {
["id"] = "620104";
["name"] = "西固区";
};
[4] = {
["id"] = "620105";
["name"] = "安宁区";
};
[5] = {
["id"] = "620111";
["name"] = "红古区";
};
[6] = {
["id"] = "620121";
["name"] = "永登县";
};
[7] = {
["id"] = "620122";
["name"] = "皋兰县";
};
[8] = {
["id"] = "620123";
["name"] = "榆中县";
};
};
};
[2] = {
["id"] = "620200";
["name"] = "嘉峪关";
};
[3] = {
["id"] = "620300";
["name"] = "金昌";
["children"] = {
[1] = {
["id"] = "620302";
["name"] = "金川区";
};
[2] = {
["id"] = "620321";
["name"] = "永昌县";
};
};
};
[4] = {
["id"] = "620400";
["name"] = "白银";
["children"] = {
[1] = {
["id"] = "620402";
["name"] = "白银区";
};
[2] = {
["id"] = "620403";
["name"] = "平川区";
};
[3] = {
["id"] = "620421";
["name"] = "靖远县";
};
[4] = {
["id"] = "620422";
["name"] = "会宁县";
};
[5] = {
["id"] = "620423";
["name"] = "景泰县";
};
};
};
[5] = {
["id"] = "620500";
["name"] = "天水";
["children"] = {
[1] = {
["id"] = "620502";
["name"] = "秦州区";
};
[2] = {
["id"] = "620503";
["name"] = "麦积区";
};
[3] = {
["id"] = "620521";
["name"] = "清水县";
};
[4] = {
["id"] = "620522";
["name"] = "秦安县";
};
[5] = {
["id"] = "620523";
["name"] = "甘谷县";
};
[6] = {
["id"] = "620524";
["name"] = "武山县";
};
[7] = {
["id"] = "620525";
["name"] = "张家川回族自治县";
};
};
};
[6] = {
["id"] = "620600";
["name"] = "武威";
["children"] = {
[1] = {
["id"] = "620602";
["name"] = "凉州区";
};
[2] = {
["id"] = "620621";
["name"] = "民勤县";
};
[3] = {
["id"] = "620622";
["name"] = "古浪县";
};
[4] = {
["id"] = "620623";
["name"] = "天祝藏族自治县";
};
};
};
[7] = {
["id"] = "620700";
["name"] = "张掖";
["children"] = {
[1] = {
["id"] = "620702";
["name"] = "甘州区";
};
[2] = {
["id"] = "620721";
["name"] = "肃南裕固族自治县";
};
[3] = {
["id"] = "620722";
["name"] = "民乐县";
};
[4] = {
["id"] = "620723";
["name"] = "临泽县";
};
[5] = {
["id"] = "620724";
["name"] = "高台县";
};
[6] = {
["id"] = "620725";
["name"] = "山丹县";
};
};
};
[8] = {
["id"] = "620800";
["name"] = "平凉";
["children"] = {
[1] = {
["id"] = "620802";
["name"] = "崆峒区";
};
[2] = {
["id"] = "620821";
["name"] = "泾川县";
};
[3] = {
["id"] = "620822";
["name"] = "灵台县";
};
[4] = {
["id"] = "620823";
["name"] = "崇信县";
};
[5] = {
["id"] = "620824";
["name"] = "华亭县";
};
[6] = {
["id"] = "620825";
["name"] = "庄浪县";
};
[7] = {
["id"] = "620826";
["name"] = "静宁县";
};
};
};
[9] = {
["id"] = "620900";
["name"] = "酒泉";
["children"] = {
[1] = {
["id"] = "620902";
["name"] = "肃州区";
};
[2] = {
["id"] = "620921";
["name"] = "金塔县";
};
[3] = {
["id"] = "620922";
["name"] = "瓜州县";
};
[4] = {
["id"] = "620923";
["name"] = "肃北蒙古族自治县";
};
[5] = {
["id"] = "620924";
["name"] = "阿克塞哈萨克族自治县";
};
[6] = {
["id"] = "620981";
["name"] = "玉门";
};
[7] = {
["id"] = "620982";
["name"] = "敦煌";
};
};
};
[10] = {
["id"] = "621000";
["name"] = "庆阳";
["children"] = {
[1] = {
["id"] = "621002";
["name"] = "西峰区";
};
[2] = {
["id"] = "621021";
["name"] = "庆城县";
};
[3] = {
["id"] = "621022";
["name"] = "环县";
};
[4] = {
["id"] = "621023";
["name"] = "华池县";
};
[5] = {
["id"] = "621024";
["name"] = "合水县";
};
[6] = {
["id"] = "621025";
["name"] = "正宁县";
};
[7] = {
["id"] = "621026";
["name"] = "宁县";
};
[8] = {
["id"] = "621027";
["name"] = "镇原县";
};
};
};
[11] = {
["id"] = "621100";
["name"] = "定西";
["children"] = {
[1] = {
["id"] = "621102";
["name"] = "安定区";
};
[2] = {
["id"] = "621121";
["name"] = "通渭县";
};
[3] = {
["id"] = "621122";
["name"] = "陇西县";
};
[4] = {
["id"] = "621123";
["name"] = "渭源县";
};
[5] = {
["id"] = "621124";
["name"] = "临洮县";
};
[6] = {
["id"] = "621125";
["name"] = "漳县";
};
[7] = {
["id"] = "621126";
["name"] = "岷县";
};
};
};
[12] = {
["id"] = "621200";
["name"] = "陇南";
["children"] = {
[1] = {
["id"] = "621202";
["name"] = "武都区";
};
[2] = {
["id"] = "621221";
["name"] = "成县";
};
[3] = {
["id"] = "621222";
["name"] = "文县";
};
[4] = {
["id"] = "621223";
["name"] = "宕昌县";
};
[5] = {
["id"] = "621224";
["name"] = "康县";
};
[6] = {
["id"] = "621225";
["name"] = "西和县";
};
[7] = {
["id"] = "621226";
["name"] = "礼县";
};
[8] = {
["id"] = "621227";
["name"] = "徽县";
};
[9] = {
["id"] = "621228";
["name"] = "两当县";
};
};
};
[13] = {
["id"] = "622900";
["name"] = "临夏";
["children"] = {
[1] = {
["id"] = "622901";
["name"] = "临夏";
};
[2] = {
["id"] = "622921";
["name"] = "临夏县";
};
[3] = {
["id"] = "622922";
["name"] = "康乐县";
};
[4] = {
["id"] = "622923";
["name"] = "永靖县";
};
[5] = {
["id"] = "622924";
["name"] = "广河县";
};
[6] = {
["id"] = "622925";
["name"] = "和政县";
};
[7] = {
["id"] = "622926";
["name"] = "东乡族自治县";
};
[8] = {
["id"] = "622927";
["name"] = "积石山保安族东乡族撒拉族自治县";
};
};
};
[14] = {
["id"] = "623000";
["name"] = "甘南";
["children"] = {
[1] = {
["id"] = "623001";
["name"] = "合作";
};
[2] = {
["id"] = "623021";
["name"] = "临潭县";
};
[3] = {
["id"] = "623022";
["name"] = "卓尼县";
};
[4] = {
["id"] = "623023";
["name"] = "舟曲县";
};
[5] = {
["id"] = "623024";
["name"] = "迭部县";
};
[6] = {
["id"] = "623025";
["name"] = "玛曲县";
};
[7] = {
["id"] = "623026";
["name"] = "碌曲县";
};
[8] = {
["id"] = "623027";
["name"] = "夏河县";
};
};
};
};
};
[29] = {
["id"] = "630000";
["name"] = "青海";
["children"] = {
[1] = {
["id"] = "630100";
["name"] = "西宁";
["children"] = {
[1] = {
["id"] = "630102";
["name"] = "城东区";
};
[2] = {
["id"] = "630103";
["name"] = "城中区";
};
[3] = {
["id"] = "630104";
["name"] = "城西区";
};
[4] = {
["id"] = "630105";
["name"] = "城北区";
};
[5] = {
["id"] = "630121";
["name"] = "大通回族土族自治县";
};
[6] = {
["id"] = "630122";
["name"] = "湟中县";
};
[7] = {
["id"] = "630123";
["name"] = "湟源县";
};
};
};
[2] = {
["id"] = "630200";
["name"] = "海东";
["children"] = {
[1] = {
["id"] = "630202";
["name"] = "乐都区";
};
[2] = {
["id"] = "630221";
["name"] = "平安县";
};
[3] = {
["id"] = "630222";
["name"] = "民和回族土族自治县";
};
[4] = {
["id"] = "630223";
["name"] = "互助土族自治县";
};
[5] = {
["id"] = "630224";
["name"] = "化隆回族自治县";
};
[6] = {
["id"] = "630225";
["name"] = "循化撒拉族自治县";
};
};
};
[3] = {
["id"] = "632200";
["name"] = "海北";
["children"] = {
[1] = {
["id"] = "632221";
["name"] = "门源回族自治县";
};
[2] = {
["id"] = "632222";
["name"] = "祁连县";
};
[3] = {
["id"] = "632223";
["name"] = "海晏县";
};
[4] = {
["id"] = "632224";
["name"] = "刚察县";
};
};
};
[4] = {
["id"] = "632300";
["name"] = "黄南";
["children"] = {
[1] = {
["id"] = "632321";
["name"] = "同仁县";
};
[2] = {
["id"] = "632322";
["name"] = "尖扎县";
};
[3] = {
["id"] = "632323";
["name"] = "泽库县";
};
[4] = {
["id"] = "632324";
["name"] = "河南蒙古族自治县";
};
};
};
[5] = {
["id"] = "632500";
["name"] = "海南";
["children"] = {
[1] = {
["id"] = "632521";
["name"] = "共和县";
};
[2] = {
["id"] = "632522";
["name"] = "同德县";
};
[3] = {
["id"] = "632523";
["name"] = "贵德县";
};
[4] = {
["id"] = "632524";
["name"] = "兴海县";
};
[5] = {
["id"] = "632525";
["name"] = "贵南县";
};
};
};
[6] = {
["id"] = "632600";
["name"] = "果洛";
["children"] = {
[1] = {
["id"] = "632621";
["name"] = "玛沁县";
};
[2] = {
["id"] = "632622";
["name"] = "班玛县";
};
[3] = {
["id"] = "632623";
["name"] = "甘德县";
};
[4] = {
["id"] = "632624";
["name"] = "达日县";
};
[5] = {
["id"] = "632625";
["name"] = "久治县";
};
[6] = {
["id"] = "632626";
["name"] = "玛多县";
};
};
};
[7] = {
["id"] = "632700";
["name"] = "玉树";
["children"] = {
[1] = {
["id"] = "632701";
["name"] = "玉树";
};
[2] = {
["id"] = "632722";
["name"] = "杂多县";
};
[3] = {
["id"] = "632723";
["name"] = "称多县";
};
[4] = {
["id"] = "632724";
["name"] = "治多县";
};
[5] = {
["id"] = "632725";
["name"] = "囊谦县";
};
[6] = {
["id"] = "632726";
["name"] = "曲麻莱县";
};
};
};
[8] = {
["id"] = "632800";
["name"] = "海西";
["children"] = {
[1] = {
["id"] = "632801";
["name"] = "格尔木";
};
[2] = {
["id"] = "632802";
["name"] = "德令哈";
};
[3] = {
["id"] = "632821";
["name"] = "乌兰县";
};
[4] = {
["id"] = "632822";
["name"] = "都兰县";
};
[5] = {
["id"] = "632823";
["name"] = "天峻县";
};
};
};
};
};
[30] = {
["id"] = "640000";
["name"] = "宁夏";
["children"] = {
[1] = {
["id"] = "640100";
["name"] = "银川";
["children"] = {
[1] = {
["id"] = "640104";
["name"] = "兴庆区";
};
[2] = {
["id"] = "640105";
["name"] = "西夏区";
};
[3] = {
["id"] = "640106";
["name"] = "金凤区";
};
[4] = {
["id"] = "640121";
["name"] = "永宁县";
};
[5] = {
["id"] = "640122";
["name"] = "贺兰县";
};
[6] = {
["id"] = "640181";
["name"] = "灵武";
};
};
};
[2] = {
["id"] = "640200";
["name"] = "石嘴山";
["children"] = {
[1] = {
["id"] = "640202";
["name"] = "大武口区";
};
[2] = {
["id"] = "640205";
["name"] = "惠农区";
};
[3] = {
["id"] = "640221";
["name"] = "平罗县";
};
};
};
[3] = {
["id"] = "640300";
["name"] = "吴忠";
["children"] = {
[1] = {
["id"] = "640302";
["name"] = "利通区";
};
[2] = {
["id"] = "640303";
["name"] = "红寺堡区";
};
[3] = {
["id"] = "640323";
["name"] = "盐池县";
};
[4] = {
["id"] = "640324";
["name"] = "同心县";
};
[5] = {
["id"] = "640381";
["name"] = "青铜峡";
};
};
};
[4] = {
["id"] = "640400";
["name"] = "固原";
["children"] = {
[1] = {
["id"] = "640402";
["name"] = "原州区";
};
[2] = {
["id"] = "640422";
["name"] = "西吉县";
};
[3] = {
["id"] = "640423";
["name"] = "隆德县";
};
[4] = {
["id"] = "640424";
["name"] = "泾源县";
};
[5] = {
["id"] = "640425";
["name"] = "彭阳县";
};
};
};
[5] = {
["id"] = "640500";
["name"] = "中卫";
["children"] = {
[1] = {
["id"] = "640502";
["name"] = "沙坡头区";
};
[2] = {
["id"] = "640521";
["name"] = "中宁县";
};
[3] = {
["id"] = "640522";
["name"] = "海原县";
};
};
};
};
};
[31] = {
["id"] = "650000";
["name"] = "新疆";
["children"] = {
[1] = {
["id"] = "650100";
["name"] = "乌鲁木齐";
["children"] = {
[1] = {
["id"] = "650102";
["name"] = "天山区";
};
[2] = {
["id"] = "650103";
["name"] = "沙依巴克区";
};
[3] = {
["id"] = "650104";
["name"] = "新区";
};
[4] = {
["id"] = "650105";
["name"] = "水磨沟区";
};
[5] = {
["id"] = "650106";
["name"] = "头屯河区";
};
[6] = {
["id"] = "650107";
["name"] = "达坂城区";
};
[7] = {
["id"] = "650109";
["name"] = "米东区";
};
[8] = {
["id"] = "650121";
["name"] = "乌鲁木齐县";
};
};
};
[2] = {
["id"] = "650200";
["name"] = "克拉玛依";
["children"] = {
[1] = {
["id"] = "650202";
["name"] = "独山子区";
};
[2] = {
["id"] = "650203";
["name"] = "克拉玛依区";
};
[3] = {
["id"] = "650204";
["name"] = "白碱滩区";
};
[4] = {
["id"] = "650205";
["name"] = "乌尔禾区";
};
};
};
[3] = {
["id"] = "652100";
["name"] = "吐鲁番";
["children"] = {
[1] = {
["id"] = "652101";
["name"] = "吐鲁番";
};
[2] = {
["id"] = "652122";
["name"] = "鄯善县";
};
[3] = {
["id"] = "652123";
["name"] = "托克逊县";
};
};
};
[4] = {
["id"] = "652200";
["name"] = "哈密";
["children"] = {
[1] = {
["id"] = "652201";
["name"] = "哈密";
};
[2] = {
["id"] = "652222";
["name"] = "巴里坤哈萨克自治县";
};
[3] = {
["id"] = "652223";
["name"] = "伊吾县";
};
};
};
[5] = {
["id"] = "652300";
["name"] = "昌吉";
["children"] = {
[1] = {
["id"] = "652301";
["name"] = "昌吉";
};
[2] = {
["id"] = "652302";
["name"] = "阜康";
};
[3] = {
["id"] = "652323";
["name"] = "呼图壁县";
};
[4] = {
["id"] = "652324";
["name"] = "玛纳斯县";
};
[5] = {
["id"] = "652325";
["name"] = "奇台县";
};
[6] = {
["id"] = "652327";
["name"] = "吉木萨尔县";
};
[7] = {
["id"] = "652328";
["name"] = "木垒哈萨克自治县";
};
};
};
[6] = {
["id"] = "652700";
["name"] = "博尔塔拉";
["children"] = {
[1] = {
["id"] = "652701";
["name"] = "博乐";
};
[2] = {
["id"] = "652702";
["name"] = "阿拉山口";
};
[3] = {
["id"] = "652722";
["name"] = "精河县";
};
[4] = {
["id"] = "652723";
["name"] = "温泉县";
};
};
};
[7] = {
["id"] = "652800";
["name"] = "巴音郭楞";
["children"] = {
[1] = {
["id"] = "652801";
["name"] = "库尔勒";
};
[2] = {
["id"] = "652822";
["name"] = "轮台县";
};
[3] = {
["id"] = "652823";
["name"] = "尉犁县";
};
[4] = {
["id"] = "652824";
["name"] = "若羌县";
};
[5] = {
["id"] = "652825";
["name"] = "且末县";
};
[6] = {
["id"] = "652826";
["name"] = "焉耆回族自治县";
};
[7] = {
["id"] = "652827";
["name"] = "和静县";
};
[8] = {
["id"] = "652828";
["name"] = "和硕县";
};
[9] = {
["id"] = "652829";
["name"] = "博湖县";
};
};
};
[8] = {
["id"] = "652900";
["name"] = "阿克苏";
["children"] = {
[1] = {
["id"] = "652901";
["name"] = "阿克苏";
};
[2] = {
["id"] = "652922";
["name"] = "温宿县";
};
[3] = {
["id"] = "652923";
["name"] = "库车县";
};
[4] = {
["id"] = "652924";
["name"] = "沙雅县";
};
[5] = {
["id"] = "652925";
["name"] = "新和县";
};
[6] = {
["id"] = "652926";
["name"] = "拜城县";
};
[7] = {
["id"] = "652927";
["name"] = "乌什县";
};
[8] = {
["id"] = "652928";
["name"] = "阿瓦提县";
};
[9] = {
["id"] = "652929";
["name"] = "柯坪县";
};
};
};
[9] = {
["id"] = "653000";
["name"] = "克孜勒苏";
["children"] = {
[1] = {
["id"] = "653001";
["name"] = "阿图什";
};
[2] = {
["id"] = "653022";
["name"] = "阿克陶县";
};
[3] = {
["id"] = "653023";
["name"] = "阿合奇县";
};
[4] = {
["id"] = "653024";
["name"] = "乌恰县";
};
};
};
[10] = {
["id"] = "653100";
["name"] = "喀什";
["children"] = {
[1] = {
["id"] = "653101";
["name"] = "喀什";
};
[2] = {
["id"] = "653121";
["name"] = "疏附县";
};
[3] = {
["id"] = "653122";
["name"] = "疏勒县";
};
[4] = {
["id"] = "653123";
["name"] = "英吉沙县";
};
[5] = {
["id"] = "653124";
["name"] = "泽普县";
};
[6] = {
["id"] = "653125";
["name"] = "莎车县";
};
[7] = {
["id"] = "653126";
["name"] = "叶城县";
};
[8] = {
["id"] = "653127";
["name"] = "麦盖提县";
};
[9] = {
["id"] = "653128";
["name"] = "岳普湖县";
};
[10] = {
["id"] = "653129";
["name"] = "伽师县";
};
[11] = {
["id"] = "653130";
["name"] = "巴楚县";
};
[12] = {
["id"] = "653131";
["name"] = "塔什库尔干塔吉克自治县";
};
};
};
[11] = {
["id"] = "653200";
["name"] = "和田";
["children"] = {
[1] = {
["id"] = "653201";
["name"] = "和田";
};
[2] = {
["id"] = "653221";
["name"] = "和田县";
};
[3] = {
["id"] = "653222";
["name"] = "墨玉县";
};
[4] = {
["id"] = "653223";
["name"] = "皮山县";
};
[5] = {
["id"] = "653224";
["name"] = "洛浦县";
};
[6] = {
["id"] = "653225";
["name"] = "策勒县";
};
[7] = {
["id"] = "653226";
["name"] = "于田县";
};
[8] = {
["id"] = "653227";
["name"] = "民丰县";
};
};
};
[12] = {
["id"] = "654000";
["name"] = "伊犁";
["children"] = {
[1] = {
["id"] = "654002";
["name"] = "伊宁";
};
[2] = {
["id"] = "654003";
["name"] = "奎屯";
};
[3] = {
["id"] = "654021";
["name"] = "伊宁县";
};
[4] = {
["id"] = "654022";
["name"] = "察布查尔锡伯自治县";
};
[5] = {
["id"] = "654023";
["name"] = "霍城县";
};
[6] = {
["id"] = "654024";
["name"] = "巩留县";
};
[7] = {
["id"] = "654025";
["name"] = "新源县";
};
[8] = {
["id"] = "654026";
["name"] = "昭苏县";
};
[9] = {
["id"] = "654027";
["name"] = "特克斯县";
};
[10] = {
["id"] = "654028";
["name"] = "尼勒克县";
};
};
};
[13] = {
["id"] = "654200";
["name"] = "塔城";
["children"] = {
[1] = {
["id"] = "654201";
["name"] = "塔城";
};
[2] = {
["id"] = "654202";
["name"] = "乌苏";
};
[3] = {
["id"] = "654221";
["name"] = "额敏县";
};
[4] = {
["id"] = "654223";
["name"] = "沙湾县";
};
[5] = {
["id"] = "654224";
["name"] = "托里县";
};
[6] = {
["id"] = "654225";
["name"] = "裕民县";
};
[7] = {
["id"] = "654226";
["name"] = "和布克赛尔蒙古自治县";
};
};
};
[14] = {
["id"] = "654300";
["name"] = "阿勒泰";
["children"] = {
[1] = {
["id"] = "654301";
["name"] = "阿勒泰";
};
[2] = {
["id"] = "654321";
["name"] = "布尔津县";
};
[3] = {
["id"] = "654322";
["name"] = "富蕴县";
};
[4] = {
["id"] = "654323";
["name"] = "福海县";
};
[5] = {
["id"] = "654324";
["name"] = "哈巴河县";
};
[6] = {
["id"] = "654325";
["name"] = "青河县";
};
[7] = {
["id"] = "654326";
["name"] = "吉木乃县";
};
};
};
[15] = {
["id"] = "659001";
["name"] = "石河子";
};
[16] = {
["id"] = "659002";
["name"] = "阿拉尔";
};
[17] = {
["id"] = "659003";
["name"] = "图木舒克";
};
[18] = {
["id"] = "659004";
["name"] = "五家渠";
};
};
};
[32] = {
["id"] = "710000";
["name"] = "台湾";
};
[33] = {
["id"] = "810000";
["name"] = "香港";
};
[34] = {
["id"] = "820000";
["name"] = "澳门";
};
};
|
local evo = {}
function evo:draw()
self.canvas:clear()
lg.push()
lg.setCanvas(self.canvas)
love.graphics.setShader( outline )
-- self.anim:draw(math.floor(self.x), math.floor(self.y), 0, .5, .5, self.frSz / 2, self.frSz - 80)
lg.origin()
self.anim:draw(0, 0, 0, 1, 1)
love.graphics.setShader()
lg.setCanvas(canvas)
lg.pop()
love.graphics.setColor(wlight)
lg.draw(self.canvas, math.floor(self.x), math.floor(self.y), 0, .5, .5, self.frSz / 2, self.frSz - 80)
self.anim:draw(math.floor(self.x), math.floor(self.y), 0, .5, .5, self.frSz / 2, self.frSz - 80)
-- lg.draw(self.canvas, 0, 0)
end
function evo:update(dt, collision)
self.outlinezoom = maths.clamp(.002/cam.zoom + .001, .001, .006)
outline:send( "stepSize",{self.outlinezoom, self.outlinezoom} )
-- outline:send( "stepSize", self.outlinezoom )
-- Update Evo's coordinates
self.xvel, self.yvel = self.body:getLinearVelocity()
self.xvel, self.yvel = math.floor(self.xvel), maths.round(self.yvel)
local ex, ey, er = self:input(collision)
-- Evo's physics
self.x, self.y = self.body:getWorldCenter()
self.body:setLinearVelocity(self.xvel + ex, self.yvel + ey)
self:astateUpdate()
self.anim:update(dt)
end
function evo:init()
self.frSz = 192
self.frDr = 1/10 -- 1 / fps = frame duration
self.canvas = lg.newCanvas(256, 256)
-- outline:send( "stepSize",{.002*cam.zoom,.002*cam.zoom} )
self.img = { -- First we set up sprite sheets
I = love.graphics.newImage('gfx/evo/idle.png'),
J = love.graphics.newImage('gfx/evo/jump.png'),
}
-- for i=1, #self.img do
-- self.img[i]:setWrap("clamp", "clamp")
-- end
-- self.img.I:setWrap("clamp", "clamp")
-- self.img.J:setWrap("clamp", "clamp")
self.anims = {
idle = newAnimation(self.img.I, self.frSz, self.frSz, self.frDr, 18),
idleL = newAnimation(self.img.I, self.frSz, self.frSz, self.frDr, 18),
jump = newAnimation(self.img.J, self.frSz, self.frSz, self.frDr, 2),
}
self.h = 95
self.x = 260
self.y = 448
self.r = 0
self.xvel = 0
self.yvel = 0
self.name = "Evo"
-- Get a smaller local handle
-- local ara = layer.ara
-- local evo = layer.evo
--local ct = layer.checktile
evo.anim = evo.anims.idle -- evo starts Idle
evo.state = {
facing = "left",
}
self.anims.idleL:flipH()
self.body = love.physics.newBody(world, self.x, self.y, "dynamic")
self.originSh = love.physics.newCircleShape(24)
self.originFi = love.physics.newFixture(self.body, self.originSh)
self.originFi:setUserData(self)
self.body:setMassData( 0, 0, 81, 1 )
self.body:setLinearDamping(.5)
end
function evo:input()
local x, y = 0, 0
local down = love.keyboard.isDown
local xvel, yvel = evo.body:getLinearVelocity()
if down("lalt") then
lalt = true
end
if down("lctrl") then
lctrl = true
elseif down("lshift") then
if down("kp8") then end
if down("kp5") then end
if down("kp4") then end
if down("kp6") then end
else
if down("kp8") then y = y - 50 end
if down("kp5") then y = y + 10 end
if down("kp4") then x = x - 10 end
if down("kp6") then x = x + 10 end
end
return x, y, self.r
end
function evo:astateUpdate()
if (math.abs(evo.xvel) > 0) then
evo.state.facing = "left" evo.anim = evo.anims.idleL
else
evo.state.facing = "right" evo.anim = evo.anims.idle
end
end
return evo
|
--[[ Netherstorm -- Pentatharon.lua
This script was written and is protected
by the GPL v2. This script was released
by BlackHer0 of the BLUA Scripting
Project. Please give proper accredidations
when re-releasing or sharing this script
with others in the emulation community.
~~End of License Agreement
-- BlackHer0, September, 29th, 2008. ]]
function Pentatharon_OnEnterCombat(Unit,Event)
Unit:RegisterEvent("Pentatharon_Swarm",4000,0)
end
function Pentatharon_Swarm(Unit,Event)
Unit:FullCastSpellOnTarget(36039,Unit:ClosestPlayer())
end
function Pentatharon_OnLeaveCombat(Unit,Event)
Unit:RemoveEvents()
end
function Pentatharon_OnDied(Unit,Event)
Unit:RemoveEvents()
end
RegisterUnitEvent (20215, 1, "Pentatharon_OnEnterCombat")
RegisterUnitEvent (20215, 2, "Pentatharon_OnLeaveCombat")
RegisterUnitEvent (20215, 4, "Pentatharon_OnDied")
|
local http_client = require("rubberduck.http_client")
local github_repositories = {}
local configuration = {
base_url = "https://api.github.com/search/repositories",
default_params = { }
}
local function parse_result(result)
if type(result) ~= "table" then return {} end
if type(result.body) ~= "table" then return {} end
if type(result.body.items) ~= "table" then return {} end
local parsed_results = {}
for i, item in ipairs(result.body.items) do
parsed_results[i] = {
title = item.full_name,
link = item.html_url
}
end
return parsed_results
end
local function build_search_params(q)
return {
order = configuration.default_params.order,
site = configuration.default_params.site,
sort = configuration.default_params.sort,
q = q
}
end
function github_repositories.search(q)
local params = build_search_params(q)
local result = http_client.get(configuration.base_url, params)
return parse_result(result)
end
return github_repositories
|
--[[
luna class library https://github.com/BradSharp/luna
MIT License Copyright (c) 2016 Brad Sharp
]]
if not (setfenv or getfenv) then
local envs = setmetatable({}, {__mode = "k"}) -- Annoying work around
local getinfo = debug.getinfo
local getupvalue = debug.getupvalue
local upvaluejoin = debug.upvaluejoin
setfenv = function (fn, env)
fn = type(fn) == "function" and fn or
getinfo(fn and fn + 1 or 1, "f").func
envs[fn] = env
local i = 1 repeat
local name = getupvalue(fn, i)
if name == "_ENV" then
upvaluejoin(fn, i, (function()
return env
end), 1)
break
elseif name == nil then
break
end
i = i + 1
until false
end
getfenv = function (fn)
fn = type(fn) == "function" and fn or
getinfo(fn and fn + 1 or 1, "f").func
if envs[fn] then
return envs[fn]
end
local i = 1 repeat
local name, value = getupvalue(fn, i)
if name == "_ENV" then
return value
elseif name == nil then
break
end
i = i + 1
until false
end
end
function createObject(definitionWrap, ...)
local definition = definitionWrap.__definition
local object = {__properties = {}, __private = {}}
setmetatable(object, definition.__metatable)
local constructor = definition.__construct
if constructor then
constructor(object, ...)
end
return object
end
function getIndex(definition, index)
local value = rawget(definition, index)
if value then
return value
else
for _, v in ipairs(definition.__inherits) do
value = getIndex(v, index)
if value then
return value
end
end
end
end
function getMetamethods(definition)
local methods = {}
local function recurse(def)
for i, v in pairs(def) do
if string.sub(i, 1, 2) == "__" then
if not methods[i] then
methods[i] = v
end
end
end
for _, v in ipairs(def.__inherits) do
recurse(v)
end
end
recurse(definition)
return methods
end
local constructClass do
local definitionBase = {
GetProperties = function (wrapper)
local definition = wrapper.__definition
local properties = {}
for i, v in pairs(definition) do
if string.sub(i, 1, 2) ~= "__" then
local valueType = type(v)
if valueType == "table" then
if not (v.set or v.get) then
properties[i] = v
end
elseif valueType ~= "function" then
properties[i] = v
end
end
end
return properties
end,
GetMetamethods = function (wrapper)
local definition = wrapper.__definition
local methods = {}
for i, v in pairs(definition) do
if string.sub(i, 1, 2) == "__" then
local valueType = type(v)
if valueType == "function" then
methods[i] = v
end
end
end
return methods
end,
GetMethods = function (wrapper)
local definition = wrapper.__definition
local methods = {}
for i, v in pairs(definition) do
if string.sub(i, 1, 2) ~= "__" then
local valueType = type(v)
if valueType == "function" then
methods[i] = v
end
end
end
return methods
end,
GetAccessors = function (wrapper)
local definition = wrapper.__definition
local accessors = {}
for i, v in pairs(definition) do
local valueType = type(v)
if valueType == "table" then
if v.get then
accessors[i] = v.get
end
end
end
return accessors
end,
GetMutators = function (wrapper)
local definition = wrapper.__definition
local mutators = {}
for i, v in pairs(definition) do
local valueType = type(v)
if valueType == "table" then
if v.set then
mutators[i] = v.set
end
end
end
return mutators
end
}
local function definitionIndex(wrapper, index)
if definitionBase[index] then
return definitionBase[index]
else
return getIndex(wrapper.__definition, index)
end
end
local function throwIndexError()
error("Definition is locked from editing", 2)
end
local definitionMetatable = {
__call = createObject,
__index = definitionIndex,
__newindex = throwIndexError
}
local function duplicateTable(t)
local t2 = {}
for i, v in pairs(t) do
t2[i] = v
end
return t2
end
local function convertType(value, _type)
local valueType = type(value)
if _type == valueType then
return value
elseif _type == "string" then
if valueType == "number" then
return tostring(value)
end
elseif _type == "number" then
if valueType == "string" then
return tonumber(value)
end
end
end
local function privenv(fn, priv)
local env = getfenv(fn)
setfenv(fn, setmetatable(priv, {
__index = env,
__newindex = env
}))
end
function constructClass(definition, inherits)
local wrapper = {__definition = definition}
do local priv = {
base = wrapper,
__priv = true
}
for i, v in pairs(definition) do
if type(i) ~= "string" then
error("Invalid index " .. tostring(i) ..
" for " .. tostring(v), 2)
else
local valueType = type(v)
if valueType == "userdata" then
error("Attempt to create property " .. i ..
" of type userdata use an accessor instead", 2)
elseif valueType == "function" then
privenv(v, duplicateTable(priv))
elseif type(v) == "table" then
if v.get then privenv(v.get, duplicateTable(priv)) end
if v.set then privenv(v.set, duplicateTable(priv)) end
end
end
end
end
definition.__inherits = {}
for _, v in ipairs(inherits or {}) do
table.insert(definition.__inherits, v.__definition)
end
local metamethods = getMetamethods(definition)
local metatable = {
__index = function (this, index)
if string.sub(index, 1, 2) == "__" then
error("Metaindexing is forbidden", 2)
end
local public = rawget(this, "__properties")
local value = public[index]
if value then
return value
else -- It doesn't exist, it's a function or, an accessor
value = getIndex(definition, index)
if value then
local valueType = type(value)
if valueType == "function" then
return value
elseif valueType == "table" then
if value.get then
return value.get(this)
else
local value = duplicateTable(value)
public[index] = value
return value
end
else
-- Assign it to the object
public[index] = value
return value
end
else
do
local env = getfenv(2)
if env and env.__priv then
return rawget(this, "__private")[index]
end
end
print(metamethods.__index)
if metamethods.__index then
return metamethods.__index(this, index)
else
error("'" .. index .. "' is not a valid member of "
.. tostring(this), 2)
end
end
end
end,
__newindex = function (this, index, value)
if string.sub(index, 1, 2) == "__" then
error("Metaindexing is forbidden", 2)
end
if metamethods.__newindex then
if metamethods.__newindex(this, index, value) then
return
end
end
local public = rawget(this, "__properties")
local currentValue = public[index]
if currentValue then
local newValue = convertType(value, type(currentValue))
if newValue then
public[index] = newValue
else
error("Incompatible type", 1)
end
else
currentValue = getIndex(definition, index)
if currentValue then
local currentValueType = type(currentValue)
local newValue = convertType(value, currentValueType)
local valueType = type(value)
if currentValueType == "table" and currentValue.set then
currentValue.set(this, value)
elseif valueType == "function" then
error(index .. " is not a valid member of "
.. tostring(this), 1)
elseif newValue then
public[index] = newValue
else
error("Incompatible type", 1)
end
else
local internal do
local env = getfenv(2)
internal = env and env.__priv or false
end
if internal then
local private = rawget(this, "__private")
private[index] = value
else
error("'" .. index .. "' is not a valid member of "
.. tostring(this), 1)
end
end
end
end,
__call = function ()
return definition
end
}
for i, v in pairs(metamethods) do
local method = string.sub(i, 3)
if not (method == "index" or method == "newindex"
or method == "call") then
metatable[i] = v
end
end
definition.__construct = metamethods.__construct
definition.__metatable = metatable
return setmetatable(wrapper, definitionMetatable)
end
end
function class(...)
local parameters = {...}
if rawget(parameters[1], "__definition") then
return function (definition)
return constructClass(definition, parameters)
end
else
return constructClass(parameters[1])
end
end
return class
|
--- Global Synchronized Identifier generator.
-- Its main advantages are simplicity and ability to revert its inner state.
-- @classmod l2df.manager.gsid
-- @author Abelidze
-- @copyright Atom-TM 2020
local core = l2df or require((...):match('(.-)manager.+$') or '' .. 'core')
assert(type(core) == 'table' and core.version >= 1.0, 'GSID works only with l2df v1.0 and higher')
local step = 1
local state = 1
local salt = 1
local counter = 0
local accumulator = 0
local ceil = math.ceil
local floor = math.floor
local strsub = string.sub
local strjoin = table.concat
local HEXES = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}
local function i2h(x, l)
local s, l, d = '', l or 4
while x > 0 do
d = x % 16 + 1
x = floor(x / 16)
s = HEXES[d] .. s
end
while #s < l do s = '0' .. s end
return s
end
local function xor(a, b)
local p, c = 1, 0
while a > 0 and b > 0 do
local ra, rb = a % 2, b % 2
if ra ~= rb then c = c + p end
a, b, p = (a - ra) / 2, (b - rb) / 2, p * 2
end
if a < b then a = b end
while a > 0 do
local ra = a % 2
if ra > 0 then c = c + p end
a, p = (a - ra) / 2, p * 2
end
return c
end
local Manager = { }
--- Configure @{l2df.manager.gsid|GSID} manager.
-- @param[opt] table kwargs
-- @param[opt=1] number kwargs.seed Generator needs a number to start with (a `seed` value), to be able
-- to generate GSID's sequences.
-- @param[opt=1] number kwargs.step Generator's fixed step value for updating the inner state by calling
-- @{Manager:advance|GSID:advance()} method.
-- @param[opt=1] number kwargs.salt Additional salt used in hash generation. Can be used to generate different
-- GSID's sequences for the same initial `seed`.
-- @return l2df.manager.gsid
function Manager:init(kwargs)
kwargs = kwargs or { }
state = kwargs.seed or state or 1
step = kwargs.step or step or 1
salt = kwargs.salt or salt or 1
counter = salt
accumulator = 0
return self
end
--- Advances inner counter used for generation of GSIDs.
-- Note that it doesn't affect generator's state immediately because it updates with the @{Manager:init|fixed step}.
-- So the specified delta will be accumulated and applied to the state as soon as it achieves the step value.
-- @param number dt Delta value to advance the inner generator's counter. Could be a positive or negative number.
function Manager:advance(dt)
accumulator = accumulator + dt
local delta = 0
if accumulator >= step then
delta = floor(accumulator / step)
accumulator = accumulator % step
elseif accumulator < 0 then
delta = -ceil(-accumulator / step)
accumulator = -(-accumulator % step)
end
if delta ~= 0 then
state = state + delta
counter = salt
end
end
--- Generates next GSID @{Manager:hash|hash} value from the inner state.
-- @return string HEX representation of the generated GSID.
function Manager:generate()
local h = self:hash(state, counter)
counter = counter + 1
return h
end
local function hash(state, salt)
state = xor(floor(state / 65536), state) * 73244475 % 4294967296
state = xor(floor(state / 65536), state) * 73244475 % 4294967296
state = xor(floor(state / 65536), state) % 4294967296
salt = xor(floor(salt / 256), salt) * 2654435761 % 65536
salt = xor(floor(salt / 256), salt) * 2654435761 % 65536
salt = xor(floor(salt / 256), salt) % 65536
return state, salt
end
--- Generates new GSID hash value using specified `state` and `salt`.
-- @param number state Source state value. Must be greater than `zero`.
-- @param number salt Additional salt value. Must be greater than `zero`.
-- @return string HEX representation of the generated GSID.
function Manager:hash(state, salt)
state, salt = hash(state, salt)
return i2h(floor(state / 65536)) .. i2h(state % 65536) .. i2h(salt)
end
--- Generates random GSID.
-- @return number Number representation of the generated GSID.
function Manager:rand()
local a, b = hash(state, counter)
counter = counter + 1
return a * 65536 + b
end
return setmetatable(Manager, { __call = Manager.init })
|
UndoStack = {}
UndoStack.__index = UndoStack
function UndoStack.create()
local stack = {}
setmetatable(stack, UndoStack)
stack.items = {}
stack.undoneItems = {}
return stack
end
function UndoStack:pushItem(item)
table.insert(self.items, item)
end
function UndoStack:pushRedoItem(item)
table.insert(self.undoneItems, item)
end
function UndoStack:removeUndoItem(callback)
local size = #self.items
for i = 1, size do
if callback(self.items[i]) then
self.items[i] = nil
return true
end
end
return false
end
function UndoStack:undo()
local index = #self.items
if index == 0 then
return nil
end
local topItem = self.items[index]
if not topItem then
return nil
end
table.insert(self.undoneItems, topItem)
self.items[index] = nil
return topItem
end
function UndoStack:redo()
local index = #self.undoneItems
if index == 0 then
return nil
end
local topItem = self.undoneItems[index]
if not topItem then
return nil
end
self.undoneItems[index] = nil
table.insert(self.items, topItem)
return topItem
end
|
return function()
local params = {
command = '_typescript.organizeImports',
arguments = { vim.api.nvim_buf_get_name(0) },
title = ''
}
vim.lsp.buf.execute_command(params)
end
|
local path = (...):gsub("%.init$", "") .. "."
return {
tile = require(path .. "tile"),
maleHuman = require(path .. "maleHuman"),
femaleHuman = require(path .. "femaleHuman"),
door = require(path .. "door")
}
|
-- this runs once at the beginning
function initLuau (files)
for file,k in string.gmatch(files, "([^;]*)") do
local f = assert(loadfile(file))
f ()
initMod ()
end
return 0
end
-- this runs every tick
function runLuau (files)
for file,k in string.gmatch(files, "([^;]*)") do
local f = assert(loadfile(file))
f ()
runMod ()
end
return 0
end
game = game or {}
function game.print(str)
rawPrint(str)
end
|
---
--- xclass
---
--- Copyright (C) 2018 Xrysnow. All rights reserved.
---
---Extends [Class] function so that you can use ClassName(...) to create an instance of lstg object.
---Example: `classname = xclass(object)`
---@param base table
---@param define table
---@return object
function xclass(base, define)
local ret = Class(base, define)
local mt = { __call = function(t, ...)
return New(ret, ...)
end }
return setmetatable(ret, mt)
end
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:28' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
ZO_TradingHouseSearchCategoryFeature_Keyboard = ZO_TradingHouseSearchCategoryFeature_Shared:Subclass()
function ZO_TradingHouseSearchCategoryFeature_Keyboard:New(...)
return ZO_TradingHouseSearchCategoryFeature_Shared.New(self, ...)
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:AttachToControl(categoryControl, subcategoryControl, featuresParentControl)
self:InitializeFeatures(featuresParentControl)
self:InitializeSubcategoryTabs(subcategoryControl)
self:InitializeCategoryList(categoryControl)
self:PopulateCategoryList()
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:InitializeFeatures(featuresParentControl)
self.featureKeyToFeatureObjectMap = {}
for _, categoryParams in ipairs(ZO_TRADING_HOUSE_CATEGORY_PARAMS_LIST) do
for _, featureKey in categoryParams:FeatureKeyIterator() do
if self.featureKeyToFeatureObjectMap[featureKey] == nil then
local feature = ZO_TradingHouse_CreateKeyboardFeature(featureKey)
feature:CreateControl(featuresParentControl)
self.featureKeyToFeatureObjectMap[featureKey] = feature
end
end
end
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:InitializeSubcategoryTabs(subcategoryControl)
self.tabs = subcategoryControl
self.activeTabLabel = subcategoryControl:GetNamedChild("Active")
self.currentTabDescriptor = nil
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:InitializeCategoryList(container)
local SHARED_INDENT = 55
local HEADER_SPACING = -10
local CATEGORY_SPACING = 0
self.categoryListTree = ZO_Tree:New(container:GetNamedChild("ScrollChild"), SHARED_INDENT, HEADER_SPACING, container:GetWidth())
self.categoryListTree:SetExclusive(true)
self.categoryListTree:SetOpenAnimation("ZO_TreeOpenAnimation")
-- Template helpers
local function SelectCategoryParams(control, categoryParams, selected, reselectingDuringRebuild)
local oldCategoryParams = self.selectedCategoryParams
control:SetSelected(selected)
self.selectedCategoryParams = categoryParams
if selected and not reselectingDuringRebuild then
self:OnCategorySelected(categoryParams, oldCategoryParams)
end
end
-- Search Header Data
local function SetupIconHeader(control, header, open)
control.text:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
control.text:SetText(GetString("SI_TRADINGHOUSECATEGORYHEADER", header))
local icons = internalassert(ZO_ItemFilterUtils.GetTradingHouseCategoryHeaderIcons(header), string.format("missing icon for header(%d)", header))
control.icon:SetTexture(open and icons.down or icons.up)
control.iconHighlight:SetTexture(icons.over)
ZO_IconHeader_Setup(control, open)
end
-- Top-level header. Used to group categories
local function TreeHeaderSetup(node, control, header, open, userRequested)
SetupIconHeader(control, header, open)
if open and userRequested then
self.categoryListTree:SelectFirstChild(node)
end
end
local NO_SELECTION_FUNCTION, NO_EQUALITY_FUNCTION = nil, nil
self.categoryListTree:AddTemplate("ZO_IconHeader", TreeHeaderSetup, NO_SELECTION_FUNCTION, NO_EQUALITY_FUNCTION, SHARED_INDENT, CATEGORY_SPACING)
-- Category. Represents a specific categoryParams object.
local function TreeCategorySetup(node, control, categoryParams, open)
control:SetText(categoryParams:GetFormattedName())
end
local function TreeCategoryOnSelected(control, categoryParams, selected, reselectingDuringRebuild)
SelectCategoryParams(control, categoryParams, selected, reselectingDuringRebuild)
end
self.categoryListTree:AddTemplate("ZO_TradingHouse_CategoryLabel", TreeCategorySetup, TreeCategoryOnSelected)
-- Childless header. Used when a header has only one category, and behaves like a category.
local function ChildlessTreeHeaderSetup(node, control, categoryParams, open, userRequested)
SetupIconHeader(control, categoryParams:GetHeader(), open)
end
local function ChildlessTreeHeaderOnSelected(control, categoryParams, selected, reselectingDuringRebuild)
SetupIconHeader(control, categoryParams:GetHeader(), selected)
SelectCategoryParams(control, categoryParams, selected, reselectingDuringRebuild)
end
self.categoryListTree:AddTemplate("ZO_IconChildlessHeader", ChildlessTreeHeaderSetup, ChildlessTreeHeaderOnSelected)
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:PopulateCategoryList()
self.categoryListTree:Reset()
local numCategoriesForHeader = {}
for _, categoryParams in ipairs(ZO_TRADING_HOUSE_CATEGORY_PARAMS_LIST) do
local header = categoryParams:GetHeader()
numCategoriesForHeader[header] = (numCategoriesForHeader[header] or 0) + 1
end
local NO_PARENT = nil
local currentHeaderNode, lastHeader = nil, nil
for _, categoryParams in ipairs(ZO_TRADING_HOUSE_CATEGORY_PARAMS_LIST) do
local header = categoryParams:GetHeader()
if numCategoriesForHeader[header] == 1 then
self.categoryListTree:AddNode("ZO_IconChildlessHeader", categoryParams)
else
if lastHeader ~= header then
currentHeaderNode = self.categoryListTree:AddNode("ZO_IconHeader", header)
end
self.categoryListTree:AddNode("ZO_TradingHouse_CategoryLabel", categoryParams, currentHeaderNode)
end
lastHeader = header
end
self.categoryListTree:Commit()
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:PopulateSubcategoryTabs(categoryParams, oldSubcategoryKey)
local function OnTabSelected(tabData)
self.activeTabLabel:SetText(tabData.activeTabText)
self.selectedSubcategoryKey = tabData.descriptor
TRADING_HOUSE_SEARCH:HandleSearchCriteriaChanged(self)
end
local nextSubcategoryKey = "AllSubcategories"
ZO_MenuBar_ClearButtons(self.tabs)
-- Menubars expect buttons to be added from right to left
for subcategoryIndex = categoryParams:GetNumSubcategories(), 1, -1 do
local key = categoryParams:GetSubcategoryKey(subcategoryIndex)
local name = categoryParams:GetSubcategoryName(subcategoryIndex)
local icons = categoryParams:GetSubcategoryIcons(subcategoryIndex)
if key == "AllSubcategories" then
-- Gamepad needs more descriptive names, but we want a generic "all" menu option across category types.
name = GetString(SI_TRADING_HOUSE_BROWSE_ITEM_TYPE_ALL)
end
local tabData =
{
activeTabText = name,
tooltipText = name,
descriptor = key,
normal = icons.up,
pressed = icons.down,
highlight = icons.over,
disabled = icons.disabled,
visible = nil,
callback = OnTabSelected,
}
ZO_MenuBar_AddButton(self.tabs, tabData)
if key == oldSubcategoryKey then
nextSubcategoryKey = key
end
end
ZO_MenuBar_SelectDescriptor(self.tabs, nextSubcategoryKey)
end
function ZO_TradingHouseSearchCategoryFeature_Keyboard:OnCategorySelected(categoryParams, oldCategoryParams)
local oldSubcategoryKey = nil
local oldFeatureSet = {}
if oldCategoryParams then
for _, featureKey in oldCategoryParams:FeatureKeyIterator() do
local feature = self:GetFeatureForKey(featureKey)
feature:Hide()
oldFeatureSet[featureKey] = true
end
oldSubcategoryKey = self.selectedSubcategoryKey
end
self:PopulateSubcategoryTabs(categoryParams, oldSubcategoryKey)
local lastControl = nil
-- We parent from right to left
for _, featureKey in categoryParams:FeatureKeyReverseIterator() do
local feature = self:GetFeatureForKey(featureKey)
feature:Show()
-- We should reset state unless this feature was previously visible, in which case that state is probably still good
if not oldFeatureSet[featureKey] then
feature:ResetSearch()
end
local control = feature:GetControl()
if not lastControl then
control:SetAnchor(TOPRIGHT, nil, TOPRIGHT, -5, 9)
else
control:SetAnchor(TOPRIGHT, lastControl, TOPLEFT, -5, 0)
end
lastControl = control
end
if oldCategoryParams ~= categoryParams then
TRADING_HOUSE_SEARCH:HandleSearchCriteriaChanged(self)
end
end
-- Override
function ZO_TradingHouseSearchCategoryFeature_Keyboard:SelectCategoryParams(categoryParams, subcategoryKey)
if categoryParams then
local node = self.categoryListTree:GetTreeNodeByData(categoryParams)
self.categoryListTree:SelectNode(node)
if subcategoryKey then
ZO_MenuBar_SelectDescriptor(self.tabs, subcategoryKey)
end
end
end
-- Override
function ZO_TradingHouseSearchCategoryFeature_Keyboard:GetCategoryParams()
return self.selectedCategoryParams
end
-- Override
function ZO_TradingHouseSearchCategoryFeature_Keyboard:GetSubcategoryKey()
return self.selectedSubcategoryKey
end
-- Override
function ZO_TradingHouseSearchCategoryFeature_Keyboard:GetFeatureForKey(featureKey)
return self.featureKeyToFeatureObjectMap[featureKey]
end
|
a=game.Players.LocalPlayer.Chance
while true do
wait()
a.Value=a.Value+100
end
|
hook.Add( "PopulateWeapons", "AddWeaponContent", function( pnlContent, tree, node )
-- Loop through the weapons and add them to the menu
local Weapons = list.Get( "Weapon" )
local Categorised = {}
-- Build into categories
for k, weapon in pairs( Weapons ) do
if ( !weapon.Spawnable ) then continue end
Categorised[ weapon.Category ] = Categorised[ weapon.Category ] or {}
table.insert( Categorised[ weapon.Category ], weapon )
end
Weapons = nil
-- Loop through each category
for CategoryName, v in SortedPairs( Categorised ) do
-- Add a node to the tree
local node = tree:AddNode( CategoryName, "icon16/gun.png" );
-- When we click on the node - populate it using this function
node.DoPopulate = function( self )
-- If we've already populated it - forget it.
if ( self.PropPanel ) then return end
-- Create the container panel
self.PropPanel = vgui.Create( "ContentContainer", pnlContent )
self.PropPanel:SetVisible( false )
self.PropPanel:SetTriggerSpawnlistChange( false )
for k, ent in SortedPairsByMemberValue( v, "PrintName" ) do
spawnmenu.CreateContentIcon( ent.ScriptedEntityType or "weapon", self.PropPanel,
{
nicename = ent.PrintName or ent.ClassName,
spawnname = ent.ClassName,
material = "entities/"..ent.ClassName..".png",
admin = ent.AdminOnly
})
end
end
-- If we click on the node populate it and switch to it.
node.DoClick = function( self )
self:DoPopulate()
pnlContent:SwitchPanel( self.PropPanel );
end
end
-- Select the first node
local FirstNode = tree:Root():GetChildNode( 0 )
if ( IsValid( FirstNode ) ) then
FirstNode:InternalDoClick()
end
end )
spawnmenu.AddCreationTab( "#spawnmenu.category.weapons", function()
local ctrl = vgui.Create( "SpawnmenuContentPanel" )
ctrl:CallPopulateHook( "PopulateWeapons" );
return ctrl
end, "icon16/gun.png", 10 )
|
-- SilentsReplacement
-- PhysicsThreshold
-- September 08, 2021
--[[
PhysicsThreshold.ComputeMaxVerticalSpeed(playerProfile : PlayerProfile, verticalSpeed : number) --> nil []
PhysicsThreshold.ComputeMaxHorizontalSpeed(playerProfile : PlayerProfile, horizontalSpeed : number) --> nil []
]]
local PhysicsThreshold = {}
local detections = script:FindFirstAncestor("Octagon").Server.Detections
local VerticalSpeed = require(detections.Physics.VerticalSpeed)
local HorizontalSpeed = require(detections.Physics.HorizontalSpeed)
local LocalConstants = {
MaxServerFPS = 60,
AdditionalVerticalSpeedLeeway = 12,
}
function PhysicsThreshold.ComputeMaxVerticalSpeed(playerProfile, verticalSpeed)
local verticalSpeedLeeway = VerticalSpeed.Leeway / 100
playerProfile.PhysicsThresholds.VerticalSpeed = verticalSpeed
+ math.sqrt(
verticalSpeed * VerticalSpeed.LeewayMultiplier
) * VerticalSpeed.LeewayMultiplier
+ VerticalSpeed.LeewayMultiplier * (LocalConstants.MaxServerFPS * verticalSpeedLeeway)
+ playerProfile:GetPhysicsThresholdIncrement(
"VerticalSpeed"
)
+ LocalConstants.AdditionalVerticalSpeedLeeway
return nil
end
function PhysicsThreshold.ComputeMaxHorizontalSpeed(playerProfile, horizontalSpeed)
local horizontalSpeedLeeway = HorizontalSpeed.Leeway / 100
playerProfile.PhysicsThresholds.HorizontalSpeed = horizontalSpeed
+ math.sqrt(
horizontalSpeed * HorizontalSpeed.LeewayMultiplier
) * HorizontalSpeed.LeewayMultiplier
+ HorizontalSpeed.LeewayMultiplier * (LocalConstants.MaxServerFPS * horizontalSpeedLeeway)
+ playerProfile:GetPhysicsThresholdIncrement("HorizontalSpeed")
return nil
end
return PhysicsThreshold
|
local base_manager =
{
_database = nil,
_bases = {},
};
local core = require("util/core");
local FactionBase = require("gamemodes/freeroam/class_base");
function base_manager:GetBaseList()
self:Dump();
return self._bases;
end
function base_manager:FixFactionSpawns( faction_id )
local only_base = nil;
for i,v in pairs(self._bases) do
if (v:GetFactionOwner() == faction_id and v:HasSpawn()) then
if (only_base == nil) then
only_base = v;
else
warn("Fixed a faction (" .. faction_id .. ") base (" .. i .. ") due to multiple spawns.");
v:DisableSpawn();
end
end
end
end
function base_manager:GetFactionSpawnBase( faction_id )
local found_base = nil;
-- Ensure the bases owned by the factions only have
-- one enabled spawn.
self:FixFactionSpawns(faction_id);
for i,v in pairs(self._bases) do
if (v:GetFactionOwner() == faction_id and v:HasSpawn()) then
found_base = v;
break;
end
end
-- Base might have been captured, check for other bases owned by
-- the faction and make that the spawn location.
-- TODO: Distance based assignment.
if (found_base == nil) then
for i,v in pairs(self._bases) do
if (v:GetFactionOwner() == faction_id) then
found_base = v;
-- Flag the base as now being the faction's spawn location.
v:EnableSpawn();
break;
end
end
end
return found_base;
end
function base_manager:GetFactionOwnedBases( faction_id )
local bases = {};
for i,v in pairs(self._bases) do
if (v:GetFactionOwner() == faction_id and v:HasSpawn()) then
table.insert(bases, v);
end
end
return bases;
end
function base_manager:CreateBase( display_name )
local creation_result = self._database:Query( string.format("INSERT INTO " .. SERVER.DBInfo.db .. ".game_bases (display_name) VALUES (%q)", display_name) );
if (not(creation_result)) then
return nil, "Database failure on creation.";
end
-- Get the last created item ID.
local faction_id = self._database:Query( "SELECT LAST_INSERT_ID() FROM " .. SERVER.DBInfo.db .. ".game_bases LIMIT 1", true );
if (faction_id == nil) then
return nil, "Database failure on returning created row.";
end
-- Parse the result ID from the returned rows.
faction_id = faction_id["0"]["LAST_INSERT_ID()"];
if (faction_id == nil) then
return nil, "Database failure on getting last ID.";
end
-- Finally store the new base into the base_manager.
local data = self._database:Query(string.format("SELECT * FROM " .. SERVER.DBInfo.db .. ".game_bases WHERE id = %d", faction_id), true);
if (data == nil or table.length(data) == 0) then
tprint(data);
return nil, "Database failure on data retrieval.";
end
local base = self:_LoadBase( data["0"] );
base:SetDisplayName( display_name );
return base;
end
function base_manager:DeleteBase( query_id )
query_id = tonumber( query_id );
local existing_base = self._database:Query(string.format("SELECT id FROM " .. SERVER.DBInfo.db .. ".game_bases WHERE id = %d", query_id), true);
if (existing_base == nil or table.length(existing_base) == 0) then
return false, string.format("Base ID %d not found", query_id);
end
self._database:Query(string.format("DELETE FROM " .. SERVER.DBInfo.db .. ".game_bases WHERE id = %d", query_id), false);
self:_RemoveBase(query_id);
return true;
end
function base_manager:SendBaseList( player )
for i,v in pairs(self._bases) do
v:SendPlayerNodes( player );
end
end
function base_manager:_LoadBase( data_row )
local row_id = "base_" .. tostring(data_row.id);
self._bases[row_id] = FactionBase:Create();
self._bases[row_id]:Load( self._database, data_row );
return self._bases[row_id];
end
function base_manager:_GetBaseIndex( id )
id = tonumber(id);
for i,v in pairs(self._bases) do
if (v:GetID() == id) then
return i;
end
end
return nil;
end
function base_manager:_RemoveBase( id )
local idx = self:_GetBaseIndex(id);
if (idx == nil) then
self:Dump();
error("Index not found.");
return;
end
self._bases[ idx ]:Unload();
self._bases[ idx ] = nil;
self:Dump();
-- TODO: Unregister base from Base entity manager.
end
function base_manager:Dump()
for i,v in pairs(self._bases) do
print( i .. " (" .. type(i) .. ")", v:GetDisplayName() );
end
end
function base_manager:Load( database )
SERVER:ForceUpdateFactionData();
self._database = database;
-- Load all factions
local bases = self._database:Query("SELECT * FROM " .. SERVER.DBInfo.db .. ".game_bases", true);
if (bases == nil) then
error("Initial bases query failed.");
end
-- Construct faction data
for i,v in pairs(bases) do
local base = self:_LoadBase( v );
print("Loaded base " .. base:GetDisplayName());
end
self:Dump();
end
function base_manager:GetBaseLocal( base_id )
base_id = tonumber(base_id);
local idx = self:_GetBaseIndex( base_id );
if (idx == nil) then
return nil, "Base not found.";
end
return self._bases[ idx ];
end
return base_manager;
|
--[[
desc:成扑隐射
auth:Carol Luo
]]
local kz111 = {[1]=3}
local kz222 = {[2]=3}
local kz333 = {[3]=3}
local kz444 = {[4]=3}
local kz555 = {[5]=3}
local kz666 = {[6]=3}
local kz777 = {[7]=3}
local kz888 = {[8]=3}
local kz999 = {[9]=3}
local sz123 = {[1]=1,[2]=1,[3]=1}
local sz234 = {[2]=1,[3]=1,[4]=1}
local sz345 = {[3]=1,[4]=1,[5]=1}
local sz456 = {[4]=1,[5]=1,[6]=1}
local sz567 = {[5]=1,[6]=1,[7]=1}
local sz678 = {[6]=1,[7]=1,[8]=1}
local sz789 = {[7]=1,[8]=1,[9]=1}
---@type mjSnapsMap
return {
[1] = {sz123,kz111},
[2] = {sz123,sz234,kz222},
[3] = {sz123,sz234,sz345,kz333},
[4] = {sz234,sz345,sz456,kz444},
[5] = {sz345,sz456,sz567,kz555},
[6] = {sz456,sz567,sz678,kz666},
[7] = {sz567,sz678,sz789,kz777},
[8] = {sz678,sz789,kz888},
[9] = {sz789,kz999},
}
|
-- Mimics a FIFO queue, OOP style
local class = require 'class'
local fifo = class()
fifo._queue = {}
-- Pushes a value at the tail of the heap
function fifo:push(value) table.insert(self._queue, value) end
-- Remove and return the value at the head of the heap
function fifo:pop()
local head = self._queue[1]
table.remove(self._queue, 1)
return head
end
-- Clears the heap
function fifo:clear(f) self._queue = {} end
-- Checks if the heap is empty
function fifo:isEmpty() return #self._queue == 0 end
return fifo
|
-- -- Copyright 2012 Rackspace
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
module(..., package.seeall);
local util = require 'util'
local Check = util.Check
local log = util.log
local nicesize = util.nicesize
local io = require 'io'
local function sigar_net_interface_stat(args)
-- Issues: (rand) interfaces are eth0-eth7, not clear which....
-- (rand) sigar looks to be the culprit for the huge mem leaks
local si = equus.sigar_create()
assert(si)
local ni = equus.sigar_net_interface_stat_t()
log.dbg("calling sigar_net_interface_stat_get(%s)", args.if_name)
local r = {}
r["in_packets"] = 0
local rv = equus.sigar_net_interface_stat_get(si, args.if_name, ni)
if rv == 0 then
--ni.rx_dropped))
--ni.rx_overruns))
--ni.rx_frame))
--ni.tx_dropped))
--ni.tx_overruns))
--tostring(ni.tx_collisions))
--ni.tx_carrier))
--ni.speed))
r["in_bytes"] = ni.rx_bytes
r["in_packets"] = ni.rx_packets
r["in_err"] = ni.rx_errors
r["in_mcast"] = 0
r["out_bytes"] = ni.tx_bytes
r["out_packets"] = ni.tx_packets
r["out_err"] = ni.tx_errors
log.dbg("in_packets " .. tostring(r["in_packets"]))
log.dbg("in_bytes " .. tostring(r["in_bytes"]))
log.dbg("out_packets " .. tostring(r["out_packets"]))
log.dbg("out_bytes " .. tostring(r["out_bytes"]))
end
equus.sigar_destroy(si)
return r
end
local function readdos(cmd)
local f = nil
f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*l'))
s = assert(f:read('*l'))
s = assert(f:read('*l'))
s = assert(f:read('*l'))
local bytes = assert(f:read('*l'))
local packets = assert(f:read('*l'))
local mcast = assert(f:read('*l'))
s = assert(f:read('*l'))
local err = assert(f:read('*l'))
f:close()
in_bytes = string.gsub(bytes, "[^%d]+(%d+).*", "%1")
out_bytes = string.gsub(bytes, "[^%d]+%d+%s+(%d+).*", "%1")
if equus.p_is_darwin() == 1 then
args.if_name = 'en1'
end
in_packets = string.gsub(packets, "[^%d]+(%d+).*", "%1")
out_packets = string.gsub(packets, "[^%d]+%d+%s+(%d+).*", "%1")
in_mcast = string.gsub(mcast, "[^%d]+(%d+).*", "%1")
out_mcast = string.gsub(mcast, "[^%d]+%d+%s+(%d+).*", "%1")
in_err = string.gsub(err, "[^%d]+(%d+).*", "%1")
out_err = string.gsub(err, "[^%d]+%d+%s+(%d+).*", "%1")
local r = {}
r["in_bytes"] = tonumber(in_bytes)
r["in_packets"] = tonumber(in_packets)
r["in_err"] = tonumber(in_err)
r["in_mcast"] = tonumber(in_mcast)
r["out_bytes"] = tonumber(out_bytes)
r["out_packets"] = tonumber(out_packets)
r["out_err"] = tonumber(out_err)
r["out_mcast"] = tonumber(out_mcast)
return r
end
local function readproc(args)
-- See proc(5):
-- <http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html>
local r = {}
local i = 0
file = assert(io.open("/proc/net/dev", "r"))
for line in file:lines() do
i = i + 1
if i > 2 then
local l = util.split(line)
local name = l[1]:sub(1, l[1]:find(':')-1)
-- linux sometimes does this:
-- eth0:6832715943
-- (see, no whitespace between the interface and the first number. yay.)
if string.len(l[1]) ~= l[1]:find(':') then
table.insert(l, 2, l[1]:sub(l[1]:find(':')+1))
end
if l[11] ~= '0' and name == args.if_name then
r["in_bytes"] = tonumber(l[2])
r["in_packets"] = tonumber(l[3])
r["in_err"] = tonumber(l[4])
r["in_mcast"] = tonumber(l[9])
r["out_bytes"] = tonumber(l[10])
r["out_packets"] = tonumber(l[11])
r["out_err"] = tonumber(l[12])
end
end
end
file:close()
return r
end
local function getvalue(args)
local a
if equus.p_is_windows() == 1 or equus.p_is_darwin() == 1 then
a = readdos('netstat -e')
-- a = sigar_net_interface_stat(args)
-- elseif equus.p_is_freebsd() == 1 then
-- a = sigar_net_interface_stat(args)
else
a = readproc(args)
end
return a
end
function run(rcheck, args)
if equus.p_is_windows() == 0 and
equus.p_is_linux() == 0 and
equus.p_is_darwin() == 0 then
rcheck:set_error("net check is only supported on windows, linux and freebsd")
return rcheck
end
if args.if_name == nil then
if equus.p_is_windows() == 1 then
args.if_name = 'unknown'
end
if equus.p_is_linux() == 1 then
args.if_name = 'eth0'
end
if equus.p_is_darwin() == 1 then
args.if_name = 'en1'
end
else
args.if_name = args.if_name[1]
end
local rv, r = pcall(getvalue, args)
if rv then
if r['in_packets'] ~= nil then
for k,v in pairs(r) do
rcheck:add_metric(k, v, Check.enum.gauge)
end
rcheck:set_status('interface %s in/out:%s/%s, in/out packets:%s/%s',
args.if_name, nicesize(tonumber(r["in_bytes"])), nicesize(tonumber(r["out_bytes"])),
r['in_packets'], r['out_packets'])
else
rcheck:set_error('interface %s not found or missing traffic', args.if_name)
log.err("didn't find data for interface %s", args.if_name)
end
else
rcheck:set_error('interface %s not found', args.if_name)
log.err("net failed err: %s", tostring(r))
end
return rcheck
end
|
return {
code = 'SUIT_STATE_ERROR',
key = "SUIT_STATE_ERROR",
}
|
-- Copyright 2022 philh30
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
local caps = require("st.capabilities")
local config = require("config")
local get_inputs = require("inputs")
local inputCapability = config.inputCapability
--- @param device st.Device
local function map(device)
local commands = {
['main'] = {
[caps.switch.ID] = {
[caps.switch.switch.ID] = {
cmd = 'PWR',
on = '01',
off = '00',
all = 'ALL',
query = 'QSTN',
},
},
[caps.audioMute.ID] = {
[caps.audioMute.mute.ID] = {
cmd = 'AMT',
muted = '01',
unmuted = '00',
query = 'QSTN',
},
},
[caps.audioVolume.ID] = {
[caps.audioVolume.volume.ID] = {
cmd = 'MVL',
query = 'QSTN'
},
},
[inputCapability.ID] = {
[inputCapability.inputSource.ID] = get_inputs(device),
},
},
['zone2'] = {
[caps.switch.ID] = {
[caps.switch.switch.ID] = {
cmd = 'ZPW',
on = '01',
off = '00',
query = 'QSTN',
},
},
[caps.audioMute.ID] = {
[caps.audioMute.mute.ID] = {
cmd = 'ZMT',
muted = '01',
unmuted = '00',
query = 'QSTN',
},
},
[caps.audioVolume.ID] = {
[caps.audioVolume.volume.ID] = {
cmd = 'ZVL',
query = 'QSTN'
},
},
[inputCapability.ID] = {
[inputCapability.inputSource.ID] = get_inputs(device),
},
}
}
commands['zone2'][inputCapability.ID][inputCapability.inputSource.ID].cmd = 'SLZ'
commands['main'][inputCapability.ID][inputCapability.inputSource.ID].cmd = 'SLI'
return commands
end
return map
|
-- register aliases for retro compat
minetest.register_alias("ks_flora:maple_planks", "ks_flora:holly_planks")
minetest.register_alias("ks_flora:maple_living_branch", "ks_flora:holly_living_log")
minetest.register_alias("ks_flora:maple_living_log", "ks_flora:holly_living_log")
minetest.register_alias("ks_flora:maple_log", "ks_flora:holly_log")
minetest.register_node("ks_flora:juniper_planks", {
description = "Juniper-Wood Planks",
tiles = {"flora.juniper_wood.png", "flora.juniper_wood.png", "flora.juniper_wood_end.png", "flora.juniper_wood_end.png", "flora.juniper_wood.png", "flora.juniper_wood.png"},
groups = {woodplank = 1, choppable = 1, flammable = 1},
paramtype2 = "facedir",
is_ground_content = true,
sounds = ks_sounds.woodennode_sounds,
})
minetest.register_node("ks_flora:holly_planks", {
description = "Holly-Wood Planks",
tiles = {"flora.holly_wood.png", "flora.holly_wood.png", "flora.holly_wood_end.png", "flora.holly_wood_end.png", "flora.holly_wood.png", "flora.holly_wood.png"},
groups = {woodplank = 1, choppable = 1, flammable = 1},
paramtype2 = "facedir",
is_ground_content = true,
sounds = ks_sounds.woodennode_sounds,
})
minetest.register_node("ks_flora:douglasfir_planks", {
description = "Douglas Fir-Wood Planks",
tiles = {"flora.douglasfir_wood.png", "flora.douglasfir_wood.png", "flora.douglasfir_wood_end.png", "flora.douglasfir_wood_end.png", "flora.douglasfir_wood.png", "flora.douglasfir_wood.png"},
groups = {woodplank = 1, choppable = 1, flammable = 1},
paramtype2 = "facedir",
is_ground_content = true,
sounds = ks_sounds.woodennode_sounds,
})
minetest.register_node("ks_flora:juniper_living_log", {
description = "Living Juniper Log",
tiles = {"flora.juniper_log_top.png", "flora.juniper_log_top.png", "flora.juniper_log.png"},
groups = {woodlog = 1, choppable = 2, falling_node = 1, flammable = 1},
is_ground_content = true,
drop = "ks_flora:juniper_log",
sounds = ks_sounds.loggynode_sounds,
})
minetest.register_node("ks_flora:juniper_living_leaves", {
description = "Living Juniper Leaves",
tiles = {"flora.juniper_leaves.png"},
paramtype = "light",
drawtype = "allfaces_optional",
groups = {sliceable = 1, juniper_leaves = 1, light_flammable = 1},
drop = {
max_items = 1,
items = {
{items = {"ks_tools:juniper_stick"}, rarity = 4},
}
},
is_ground_content = true,
sounds = ks_sounds.leafynode_sounds,
})
minetest.register_node("ks_flora:juniper_living_leaves_with_berries", {
description = "Living Juniper Leaves with Juniper Berries",
tiles = {"flora.juniper_leaves.png^flora.juniper_berries_overlay.png"},
paramtype = "light",
drawtype = "allfaces_optional",
groups = {grabbable = 1, juniper_leaves = 1, light_flammable = 1},
drop = "ks_flora:juniper_berries",
is_ground_content = true,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
minetest.set_node(pos, {name = "ks_flora:juniper_living_leaves"})
end,
sounds = ks_sounds.leafynode_sounds,
})
minetest.register_node("ks_flora:douglasfir_living_log", {
description = "Living Douglas Fir Log",
tiles = {"flora.douglasfir_log_top.png", "flora.douglasfir_log_top.png", "flora.douglasfir_log.png"},
groups = {woodlog = 1, choppable = 2, falling_node = 1, flammable = 1},
is_ground_content = true,
drop = "ks_flora:douglasfir_log",
sounds = ks_sounds.loggynode_sounds,
})
minetest.register_node("ks_flora:douglasfir_living_leaves", {
description = "Living Douglas Fir Leaves",
tiles = {"flora.douglasfir_leaves.png"},
paramtype = "light",
drawtype = "allfaces_optional",
groups = {sliceable = 1, douglasfir_leaves = 1, light_flammable = 1},
drop = {
max_items = 1,
items = {
{items = {"ks_tools:douglasfir_stick"}, rarity = 4},
}
},
is_ground_content = true,
sounds = ks_sounds.leafynode_sounds,
})
minetest.register_node("ks_flora:holly_living_log", {
description = "Living Holly Log",
tiles = {"flora.holly_log_top.png", "flora.holly_log_top.png", "flora.holly_log.png"},
groups = {woodlog = 1, choppable = 2, falling_node = 1, flammable = 1},
is_ground_content = true,
drop = "ks_flora:holly_log",
sounds = ks_sounds.loggynode_sounds,
})
minetest.register_node("ks_flora:holly_living_leaves", {
description = "Living Holly Leaves",
tiles = {"flora.holly_leaves.png"},
paramtype = "light",
drawtype = "allfaces_optional",
groups = {sliceable = 1, holly_leaves = 1, light_flammable = 1},
drop = {
max_items = 1,
items = {
{items = {"ks_tools:holly_stick"}, rarity = 4},
}
},
is_ground_content = true,
sounds = ks_sounds.leafynode_sounds,
})
minetest.register_node("ks_flora:holly_living_leaves_with_holly_berries", {
description = "Living Holly Leaves with Holly Berries",
tiles = {"flora.holly_leaves.png^flora.holly_berries_overlay.png"},
paramtype = "light",
drawtype = "allfaces_optional",
groups = {grabbable = 1, holly_leaves = 1, light_flammable = 1},
drop = "ks_flora:holly_berries",
is_ground_content = true,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
minetest.set_node(pos, {name = "ks_flora:holly_living_leaves"})
end,
sounds = ks_sounds.leafynode_sounds,
})
minetest.register_node("ks_flora:juniper_log", {
description = "Juniper Log",
tiles = {"flora.juniper_log_top.png", "flora.juniper_log_top.png", "flora.juniper_log.png"},
groups = {woodlog = 1, choppable = 2, flammable = 1},
is_ground_content = true,
sounds = ks_sounds.loggynode_sounds,
})
minetest.register_node("ks_flora:holly_log", {
description = "Holly Log",
tiles = {"flora.holly_log_top.png", "flora.holly_log_top.png", "flora.holly_log.png"},
groups = {woodlog = 1, choppable = 2, flammable = 1},
is_ground_content = true,
sounds = ks_sounds.loggynode_sounds,
})
minetest.register_node("ks_flora:douglasfir_log", {
description = "Douglas Fir Log",
tiles = {"flora.douglasfir_log_top.png", "flora.douglasfir_log_top.png", "flora.douglasfir_log.png"},
groups = {woodlog = 1, choppable = 2, flammable = 1},
is_ground_content = true,
sounds = ks_sounds.loggynode_sounds,
})
|
RMenu.Add('Ltd', 'Principal', RageUI.CreateMenu("", "Article disponible", nil, nil, "root_cause", "Banner"), true)
RMenu:Get('Ltd', 'Principal'):DisplayGlare(false);
RMenu:Get('Ltd', 'Principal').Closable = false;
RMenu.Add('Weapon', 'Principal', RageUI.CreateMenu("", "Article disponible", nil, nil, "root_cause", "Banner"), true)
RMenu:Get('Weapon', 'Principal'):DisplayGlare(false);
RMenu:Get('Weapon', 'Principal').Closable = false;
RMenu.Add('Mask', 'Principal', RageUI.CreateMenu("", "Article disponible", nil, nil, "root_cause", "Banner"), true)
RMenu:Get('Mask', 'Principal'):DisplayGlare(false);
RMenu:Get('Mask', 'Principal').Closable = false;
RMenu.Add('Barber', 'Principal', RageUI.CreateMenu("", "Coupe possible", nil, nil, "root_cause", "Banner"), true)
RMenu:Get('Barber', 'Principal'):DisplayGlare(false);
RMenu:Get('Barber', 'Principal').Closable = false;
RMenu.Add('Tatoo', 'Principal', RageUI.CreateMenu("", "Tatouage disponible", nil, nil, "root_cause", "Banner"), true)
RMenu:Get('Tatoo', 'Principal'):DisplayGlare(false);
RMenu:Get('Tatoo', 'Principal').Closable = false;
RMenu.Add('Clothe', 'Principal', RageUI.CreateMenu("", "Magasin de vêtements", nil, nil, "root_cause", "Banner"), true)
RMenu:Get('Clothe', 'Principal'):DisplayGlare(false);
RMenu:Get('Clothe', 'Principal').Closable = false;
RMenu.Add('Clothe', 'Vetements', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Principal'), "", ""))
RMenu:Get('Clothe', 'Vetements'):SetSubtitle("Vêtements disponible")
RMenu:Get('Clothe', 'Vetements'):DisplayGlare(false);
RMenu.Add('Clothe', 'Tshirt', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Vetements'), "", ""))
RMenu:Get('Clothe', 'Tshirt'):SetSubtitle("T-hsirts disponibles")
RMenu:Get('Clothe', 'Tshirt'):DisplayGlare(false);
RMenu.Add('Clothe', 'Vestes', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Vetements'), "", ""))
RMenu:Get('Clothe', 'Vestes'):SetSubtitle("Vestes disponibles")
RMenu:Get('Clothe', 'Vestes'):DisplayGlare(false);
RMenu.Add('Clothe', 'Pantalons', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Vetements'), "", ""))
RMenu:Get('Clothe', 'Pantalons'):SetSubtitle("Pantalons disponibles")
RMenu:Get('Clothe', 'Pantalons'):DisplayGlare(false);
RMenu.Add('Clothe', 'Chaussures', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Vetements'), "", ""))
RMenu:Get('Clothe', 'Chaussures'):SetSubtitle("Chaussures disponibles")
RMenu:Get('Clothe', 'Chaussures'):DisplayGlare(false);
RMenu.Add('Clothe', 'Accessorie', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Principal'), "", ""))
RMenu:Get('Clothe', 'Accessorie'):SetSubtitle("Accessoires disponibles")
RMenu:Get('Clothe', 'Accessorie'):DisplayGlare(false);
RMenu.Add('Clothe', 'Lunettes', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Accessorie'), "", ""))
RMenu:Get('Clothe', 'Lunettes'):SetSubtitle("Lunettes disponibles")
RMenu:Get('Clothe', 'Lunettes'):DisplayGlare(false);
RMenu.Add('Clothe', 'Chaines', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Accessorie'), "", ""))
RMenu:Get('Clothe', 'Chaines'):SetSubtitle("Chaines disponibles")
RMenu:Get('Clothe', 'Chaines'):DisplayGlare(false);
RMenu.Add('Clothe', 'Chapeaux', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Accessorie'), "", ""))
RMenu:Get('Clothe', 'Chapeaux'):SetSubtitle("Chapeaux disponibles")
RMenu:Get('Clothe', 'Chapeaux'):DisplayGlare(false);
RMenu.Add('Clothe', 'Boucles', RageUI.CreateSubMenu(RMenu:Get('Clothe', 'Accessorie'), "", ""))
RMenu:Get('Clothe', 'Boucles'):SetSubtitle("Boucles d'oreilles disponibles")
RMenu:Get('Clothe', 'Boucles'):DisplayGlare(false);
RMenu.Add('BlackMarket', 'Principal', RageUI.CreateMenu("", "Magasin illégale", nil, nil, "ShopDict", "BlackBanner"), true)
RMenu:Get('BlackMarket', 'Principal'):DisplayGlare(false);
RMenu:Get('BlackMarket', 'Principal').Closable = false;
function ShowMenu(Type)
RageUI.Visible(RMenu:Get(Type, 'Principal'), not RageUI.Visible(RMenu:Get(Type, 'Principal')))
FreezeEntityPosition(PlayerPedId(), true)
InMenu = true
while InMenu do
Citizen.Wait(0)
RageUI.IsVisible(RMenu:Get('Ltd', 'Principal'), function()
RageUI.Item.Separator("[Prix] : ~g~"..FinalPrice.." $")
for _,v in pairs (Shops.Ltd.Items) do
MxQte = {}
for i = 0 , v.MaxNbr, 1 do
MxQte[i] = i
end
RageUI.Item.List(v.Name, MxQte, 1, nil, {}, true, {
onListChange = function(Index, Items)
FinalPrice = v.Price * Index
end,
onSelected = function (Index, Items)
ItemChoose = {Token = json.encode(TokenGen), Label = v.Name, Name = v.Value, Price = v.Price, Count = Index}
TriggerServerEvent('BuyItems', v.Type, json.encode(ItemChoose))
end,
})
end
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
Timing = 2000
FreezeEntityPosition(PlayerPedId(), false)
RageUI.CloseAll()
Citizen.Wait(Timing)
InMenu = false
end,
})
end)
RageUI.IsVisible(RMenu:Get('Weapon', 'Principal'), function()
RageUI.Item.Separator("[Prix] : ~g~"..FinalPrice.." $")
RageUI.Item.List("Armes contendante", Shops.Weapon.ItemsMelee, 1, nil, {}, true, {
onListChange = function(Index, Items)
FinalPrice = Items.Price
end,
onSelected = function(Index, Items)
MeleeWeapons = {Token = json.encode(TokenGen), Label = Items.Name, Name = Items.Value, Price = Items.Price}
TriggerServerEvent('BuyItems', Items.Type, json.encode(MeleeWeapons))
end,
})
RageUI.Item.List("Armes de poing", Shops.Weapon.ItemsHand, 1, nil, {}, true, {
onListChange = function(Index, Items)
FinalPrice = Items.Price
end,
onSelected = function(Index, Items)
HandWeapons = {Token = json.encode(TokenGen), Label = Items.Name, Name = string.upper(Items.Value), Price = Items.Price}
TriggerServerEvent('BuyItems', Items.Type, json.encode(HandWeapons))
ESX.ShowNotification(json.encode(TokenGen))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
Timing = 2000
FreezeEntityPosition(PlayerPedId(), false)
RageUI.CloseAll()
Citizen.Wait(Timing)
InMenu = false
end,
})
end)
RageUI.IsVisible(RMenu:Get('BlackMarket', 'Principal'), function()
RageUI.Item.Separator("[Prix] : ~g~"..FinalPrice.." $")
for _,v in pairs (Config.BlackMarket.Items) do
MxQte = {}
for i = 0 , v.MaxNbr, 1 do
MxQte[i] = i
end
RageUI.Item.List(v.Label, MxQte, 1, nil, {}, true, {
onListChange = function(Index, Items)
FinalPrice = v.Price * Index
end,
onSelected = function (Index, Items)
ItemChoose = {Token = json.encode(TokenGen), Label = v.Name, Name = v.Value, Price = v.Price, Count = Index}
TriggerServerEvent('BuyItem', ItemChoose)
end
})
end
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
InMenu = false
FreezeEntityPosition(PlayerPedId(), false)
RageUI.CloseAll()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Principal'), function()
RageUI.Item.Button("Acheter des vêtements", nil, {RightLabel = "👕"}, true, {
},RMenu:Get('Clothe', 'Vetements'))
RageUI.Item.Button("Acheter des accessoires", nil, {RightLabel = "💎"}, true, {
},RMenu:Get('Clothe', 'Accessorie'))
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
Timing = 2000
ESX.TriggerServerCallback('GetPlySkin', function(Skin)
TriggerEvent('ApplySkin', GetPlayerPed(-1), Skin)
end)
FreezeEntityPosition(PlayerPedId(), false)
RageUI.CloseAll()
Citizen.Wait(Timing)
InMenu = false
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Vetements'), function()
RageUI.Item.Separator("[Prix] : ~g~"..Shops.Clothe.Price.Vet.." $")
RageUI.Item.Button("Tshirt", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Tshirt'))
RageUI.Item.Button("Vestes", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Vestes'))
RageUI.Item.Button("Pantalons", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Pantalons'))
RageUI.Item.Button("Chaussures", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Chaussures'))
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Tshirt'), function()
TshirtFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 8), 1 do
TshirtFound[i] = i
end
RageUI.Item.List("Tshirt", TshirtFound, Shops.Clothe.TshirtIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.TshirtIndex = Index
SetPedComponentVariation(PlayerPedId(), 8, Shops.Clothe.TshirtIndex, Shops.Clothe.TshirtIndex2, 2)
end,
})
TshirtColorFound = {}
for i = 0 , GetNumberOfPedTextureVariations(PlayerPedId(), 8, Shops.Clothe.TshirtIndex), 1 do
TshirtColorFound[i] = i
end
RageUI.Item.List("Couleur du tshirt", TshirtColorFound, Shops.Clothe.TshirtIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.TshirtIndex2 = Index
SetPedComponentVariation(PlayerPedId(), 8, Shops.Clothe.TshirtIndex, Shops.Clothe.TshirtIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Tshirt", Index = Shops.Clothe.TshirtIndex, Color = Shops.Clothe.TshirtIndex2, Price = Shops.Clothe.Price.Vet}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Vestes'), function()
VesteFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 11), 1 do
VesteFound[i] = i
end
RageUI.Item.List("Veste", VesteFound, Shops.Clothe.VesteIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.VesteIndex = Index
SetPedComponentVariation(PlayerPedId(), 11, Shops.Clothe.VesteIndex, Shops.Clothe.VesteIndex2, 2)
end,
})
VesteColorFound = {}
for i = 0 , GetNumberOfPedTextureVariations(PlayerPedId(), 11, Shops.Clothe.VesteIndex), 1 do
VesteColorFound[i] = i
end
RageUI.Item.List("Couleur de la veste", VesteColorFound, Shops.Clothe.VesteIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.VesteIndex2 = Index
SetPedComponentVariation(PlayerPedId(), 11, Shops.Clothe.VesteIndex, Shops.Clothe.VesteIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Vestes", Index = Shops.Clothe.VesteIndex, Color = Shops.Clothe.VesteIndex2, Price = Shops.Clothe.Price.Vet}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Pantalons'), function()
PantalonFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 4), 1 do
PantalonFound[i] = i
end
RageUI.Item.List("Pantalon", PantalonFound, Shops.Clothe.PantalonIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.PantalonIndex = Index
SetPedComponentVariation(PlayerPedId(), 4, Shops.Clothe.PantalonIndex, Shops.Clothe.PantalonIndex2, 2)
end,
})
PantalonColorFound = {}
for i = 0 , GetNumberOfPedTextureVariations(PlayerPedId(), 4, Shops.Clothe.PantalonIndex), 1 do
PantalonColorFound[i] = i
end
RageUI.Item.List("Couleur du pantalon", PantalonColorFound, Shops.Clothe.PantalonIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.PantalonIndex2 = Index
SetPedComponentVariation(PlayerPedId(), 4, Shops.Clothe.PantalonIndex, Shops.Clothe.PantalonIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Pantalons", Index = Shops.Clothe.PantalonIndex, Color = Shops.Clothe.PantalonIndex, Price = Shops.Clothe.Price.Vet}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Chaussures'), function()
ChaussureFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 6), 1 do
ChaussureFound[i] = i
end
RageUI.Item.List("Chaussure", ChaussureFound, Shops.Clothe.ChaussureIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.ChaussureIndex = Index
SetPedComponentVariation(PlayerPedId(), 6, Shops.Clothe.ChaussureIndex, Shops.Clothe.ChaussureIndex2, 2)
end,
})
ChaussureColorFound = {}
for i = 0 , GetNumberOfPedTextureVariations(PlayerPedId(), 6, Shops.Clothe.ChaussureIndex), 1 do
ChaussureColorFound[i] = i
end
RageUI.Item.List("Couleur des chaussures", ChaussureColorFound, Shops.Clothe.ChaussureIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.ChaussureIndex2 = Index
SetPedComponentVariation(PlayerPedId(), 6, Shops.Clothe.ChaussureIndex, Shops.Clothe.ChaussureIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Chaussures", Index = Shops.Clothe.ChaussureIndex, Color = Shops.Clothe.ChaussureIndex2, Price = Shops.Clothe.Price.Vet}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Accessorie'), function()
RageUI.Item.Separator("[Prix] : ~g~"..Shops.Clothe.Price.Acc.." $")
RageUI.Item.Button("Lunettes", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Lunettes'))
RageUI.Item.Button("Chaines", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Chaines'))
RageUI.Item.Button("Chapeaux", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Chapeaux'))
RageUI.Item.Button("Boucles d'oreille", nil, {RightLabel = "→→→"}, true, {
},RMenu:Get('Clothe', 'Boucles'))
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Lunettes'), function()
LunetteFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 1) ,1 do
LunetteFound[i] = i
end
RageUI.Item.List("Lunettes", LunetteFound, Shops.Clothe.LunetteIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.LunetteIndex = Index
SetPedPropIndex(PlayerPedId(), 1, Shops.Clothe.LunetteIndex, Shops.Clothe.LunetteIndex2, 2)
end,
})
LunetteColorFound = {}
for i = 0 , GetNumberOfPedPropTextureVariations(PlayerPedId(), 1, Shops.Clothe.LunetteIndex), 1 do
LunetteColorFound[i] = i
end
RageUI.Item.List("Couleur des lunettes", LunetteColorFound, Shops.Clothe.LunetteIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.LunetteIndex2 = Index
SetPedPropIndex(PlayerPedId(), 1, Shops.Clothe.LunetteIndex, Shops.Clothe.LunetteIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Lunettes", Index = Shops.Clothe.LunetteIndex, Color = Shops.Clothe.LunetteIndex2, Price = Shops.Clothe.Price.Acc}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Chaines'), function()
ChainesFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 7) ,1 do
ChainesFound[i] = i
end
RageUI.Item.List("Chaines", ChainesFound, Shops.Clothe.ChainesIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.ChainesIndex = Index
SetPedComponentVariation(PlayerPedId(), 7, Shops.Clothe.ChainesIndex, Shops.Clothe.ChainesIndex2, 2)
end,
})
ChainesColorFound = {}
for i = 0 , GetNumberOfPedPropTextureVariations(PlayerPedId(), 7, Shops.Clothe.ChainesIndex), 1 do
ChainesColorFound[i] = i
end
RageUI.Item.List("Couleur de la chaine", ChainesColorFound, Shops.Clothe.ChainesIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.ChainesIndex2 = Index
SetPedComponentVariation(PlayerPedId(), 7, Shops.Clothe.ChainesIndex, Shops.Clothe.ChainesIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Chaines", Index = Shops.Clothe.ChainesIndex, Color = Shops.Clothe.ChainesIndex2, Price = Shops.Clothe.Price.Acc}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Chapeaux'), function()
ChapeauxFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 0) ,1 do
ChapeauxFound[i] = i
end
RageUI.Item.List("Chapeaux", ChapeauxFound, Shops.Clothe.ChapeauxIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.ChapeauxIndex = Index
SetPedPropIndex(PlayerPedId(), 0, Shops.Clothe.ChapeauxIndex, Shops.Clothe.ChapeauxIndex2, 2)
end,
})
ChapeauxColorFound = {}
for i = 0 , GetNumberOfPedPropTextureVariations(PlayerPedId(), 0, Shops.Clothe.ChapeauxIndex), 1 do
ChapeauxColorFound[i] = i
end
RageUI.Item.List("Couleur du chapeau", ChapeauxColorFound, Shops.Clothe.ChapeauxIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.ChapeauxIndex2 = Index
SetPedPropIndex(PlayerPedId(), 0, Shops.Clothe.ChapeauxIndex, Shops.Clothe.ChapeauxIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Chapeaux", Index = Shops.Clothe.ChapeauxIndex, Color = Shops.Clothe.ChapeauxIndex2, Price = Shops.Clothe.Price.Acc}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Clothe', 'Boucles'), function()
BouclesFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 2) ,1 do
BouclesFound[i] = i
end
RageUI.Item.List("Boucles d'oreilles", BouclesFound, Shops.Clothe.BouclesIndex, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.BouclesIndex = Index
SetPedPropIndex(PlayerPedId(), 2, Shops.Clothe.BouclesIndex, Shops.Clothe.BouclesIndex2, 2)
end,
})
BouclesColorFound = {}
for i = 0 , GetNumberOfPedPropTextureVariations(PlayerPedId(), 2, Shops.Clothe.BouclesIndex), 1 do
BouclesColorFound[i] = i
end
RageUI.Item.List("Couleur des boucles d'oreilles", BouclesColorFound, Shops.Clothe.BouclesIndex2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Clothe.BouclesIndex2 = Index
SetPedPropIndex(PlayerPedId(), 2, Shops.Clothe.BouclesIndex, Shops.Clothe.BouclesIndex2, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Boucles", Index = Shops.Clothe.BouclesIndex, Color = Shops.Clothe.BouclesIndex2, Price = Shops.Clothe.Price.Acc}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
RageUI.GoBack()
end,
})
end)
RageUI.IsVisible(RMenu:Get('Barber', 'Principal'), function()
RageUI.Item.Separator("[Prix] : ~g~"..Shops.Barber.Price.." $")
Coiffure = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 2)-1, 1 do
Coiffure[i] = i
end
RageUI.Item.List("Cheveux", Coiffure, Shops.Barber.Index, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Barber.Index = Index
SetPedComponentVariation(PlayerPedId(), 2, Shops.Barber.Index, 1, 2)
end,
})
Barbes = {}
for i = 0 , GetNumHeadOverlayValues(1)-1, 1 do
Barbes[i] = i
end
RageUI.Item.List("Barbes", Barbes, Shops.Barber.Index2, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Barber.Index2 = Index
SetPedHeadOverlay(PlayerPedId(), 1, Shops.Barber.Index2, 1 + 0.0)
SetPedHeadOverlayColor(PlayerPedId(), 1, 1, 1, 1)
end,
})
Couleur = {}
for i = 0 , GetNumHairColors()-1 do
Couleur[i] = i
end
RageUI.Item.List("Couleur cheveux/barbes", Couleur, Shops.Barber.Color, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Barber.Color = Index
SetPedHairColor(PlayerPedId(), Shops.Barber.Color, Shops.Barber.Color)
SetPedHeadOverlayColor(PlayerPedId(), 1, 1, Shops.Barber.Color, Shops.Barber.Color)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Check = {Token = json.encode(TokenGen), Type = "Barber", Price = Shops.Barber.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
DoScreenFadeOut(1500)
Citizen.Wait(750)
ESX.TriggerServerCallback('GetPlySkin', function(Skin)
TriggerEvent('ApplySkin', GetPlayerPed(-1), Skin)
end)
SetEntityCoords(PlayerPedId(), Shops.Barber.Out.X, Shops.Barber.Out.Y, Shops.Barber.Out.Z - 0.98)
SetEntityHeading(PlayerPedId(), Shops.Barber.Out.H)
FreezeEntityPosition(PlayerPedId(), false)
RageUI.CloseAll()
Citizen.Wait(750)
Timing = 2000
DoScreenFadeIn(1500)
Citizen.Wait(Timing)
InMenu = false
end,
})
end)
RageUI.IsVisible(RMenu:Get('Tatoo', 'Principal'), function()
RageUI.Item.Separator("[Prix] : ~g~"..Shops.Tatoo.Price.." $")
RageUI.Item.List("Tête", TatooList.HeadTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Cou", TatooList.NeckTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Torse", TatooList.ChestTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Dos", TatooList.BackTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Bras droit", TatooList.RArmsTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Bras gauche", TatooList.LArmsTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Epaule", TatooList.ShouldTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Ventre", TatooList.StomachTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Jambe droite", TatooList.RLegTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Jambe gauche", TatooList.LLegTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Hipster", TatooList.HipsterTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Multiplayer", TatooList.MpTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Noël~", TatooList.NoelTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Luxe", TatooList.LuxeTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Low rider", TatooList.LowRiderTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Stunt", TatooList.StuntTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Biker", TatooList.BikerTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Import/Export", TatooList.ExportTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.List("Gun running", TatooList.GunTatooList, 1, nil, {}, true, {
onListChange = function(Index, Items)
ClearPedDecorations(PlayerPedId())
AddPedDecorationFromHashes(PlayerPedId(), Items.Value, GetHashKey(Items.Hash))
end,
onSelected = function (Index, Items)
Check = {Token = json.encode(TokenGen), Type = "Tatoo", Name = Items.Hash, Collection = Items.Value, Price = Shops.Tatoo.Price}
TriggerServerEvent('CheckMoney', json.encode(Check))
end
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function ()
DoScreenFadeOut(1500)
Citizen.Wait(750)
ESX.TriggerServerCallback('GetPlySkin', function(Skin)
TriggerEvent('ApplySkin', GetPlayerPed(-1), Skin)
end)
ESX.TriggerServerCallback('GetPlyTatoo', function(Tatoo)
for _,v in pairs (Tatoo) do
AddPedDecorationFromHashes(GetPlayerPed(-1), v.Collection, GetHashKey(v.Tatoo))
end
end)
SetEntityCoords(PlayerPedId(), Shops.Tatoo.Out.X, Shops.Tatoo.Out.Y, Shops.Tatoo.Out.Z - 0.98)
SetEntityHeading(PlayerPedId(), Shops.Tatoo.Out.H)
FreezeEntityPosition(PlayerPedId(), false)
RageUI.CloseAll()
Citizen.Wait(750)
Timing = 2000
DoScreenFadeIn(1500)
Citizen.Wait(Timing)
InMenu = false
end,
})
end)
RageUI.IsVisible(RMenu:Get('Mask', 'Principal'), function()
RageUI.Item.Separator("[Prix] : ~g~"..Shops.Mask.Price.." $")
MaskFound = {}
for i = 0 , GetNumberOfPedDrawableVariations(PlayerPedId(), 1) - 1, 1 do
MaskFound[i] = i
end
for _,v in pairs (MaskFound) do
RageUI.Item.List("Masque", Index, Shops.Mask.Index, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Mask.Index = Index
ESX.ShowNotification(Shops.Mask.Color)
Shops.Mask.Color = 0
SetPedComponentVariation(PlayerPedId(), 1, Shops.Mask.Index, Shops.Mask.Color, 2)
end,
})
end
Color = {}
for i = 0 , GetNumberOfPedTextureVariations(PlayerPedId(), 1, Shops.Mask.Index) - 1, 1 do
Color[i] = i
end
RageUI.Item.List("Variation", Color, Shops.Mask.Color, nil, {}, true, {
onListChange = function(Index, Items)
Shops.Mask.Color = Index
SetPedComponentVariation(PlayerPedId(), 1, Shops.Mask.Index, Shops.Mask.Color, 2)
end,
})
RageUI.Item.Button("Acheter", nil, {RightLabel = "→→→"}, true, {
onSelected = function()
Stuff = {Token = json.encode(TokenGen), Name = "Masque", Index = Shops.Mask.Index, Color = Shops.Mask.Color, Price = Shops.Mask.Price}
TriggerServerEvent("BuyStuff", json.encode(Stuff))
end,
})
RageUI.Item.Button("Retour", nil, {RightLabel = "←←←"}, true, {
onSelected = function()
Timing = 2000
SetPedComponentVariation(PlayerPedId(), 1, 0, 0, 2)
FreezeEntityPosition(PlayerPedId(), false)
DeleteCams()
RageUI.CloseAll()
Citizen.Wait(Timing)
InMenu = false
end,
})
end)
end
end
|
require 'torch';
-- returns size of string array
function size_of(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
-- returns the mean and std dev of each channel (3x1 tensor for each)
function get_data_stats( data )
mean = {} -- store the mean, to normalize the test set in the future
stdv = {} -- store the standard-deviation for the future
for i = 1,3 do -- over each image channel
mean[i] = data[{ {}, {i}, {}, {} }]:mean() -- mean estimation
stdv[i] = data[{ {}, {i}, {}, {} }]:std() -- std estimation
print( 'mean = ' .. mean[i] .. ' | std_dev = ' .. stdv[i] )
end
return mean, stdv
end
-- normalize the dataset with the given mean and std dev
function normalize_data( data, mean, stdv )
for i = 1,3 do -- over each image channel
data[{ {}, {i}, {}, {} }]:add(-mean[i]) -- mean subtraction
data[{ {}, {i}, {}, {} }]:div(stdv[i]) -- std scaling
end
return data
end
|
local cpath = select(1, ...) or "" -- callee path
local function nTimes(n, f, x) for i = 0, n - 1 do x = f(x) end return x end -- calls n times f(x)
local function rmlast(str) return str:sub(1, -2):match(".+[%./]") or "" end -- removes last dir / file from the callee path
local cdpath = rmlast(cpath) -- callee dir path
local cppdpath = nTimes(3, rmlast, cpath) -- callee parent of parent dir path
local Lib = require (cppdpath .. "Lib/Lib")
local PokemonEV = require (cppdpath .. "Maps/Pokemon/PokemonEV")
-- get EV of pokemon
local function getPokemonEV(pokemonName, effort) -- optional parameter effort
effort = effort or nil
if Lib.inTable({"HP","ATK","DEF","SPATK","SPDEF","SPD"}, effort) then
return PokemonEV[pokemonName][effort]
else
return PokemonEV[pokemonName]
end
end
return {
getPokemonEV = getPokemonEV
}
|
local mod = get_mod("InventoryFavorites")
local pl = require'pl.import_into'()
-- luacheck: globals Favorite_keymaps Colors table UITooltipPasses UIPasses
-- luacheck: globals UIFrameSettings Managers ItemGridUI Localize UIUtils
-- luacheck: globals BackendInterfaceCommon ItemMasterList UISettings
-- luacheck: globals UISettings UIFontByResolution UIGetFontHeight UIRenderer RESOLUTION_LOOKUP
-- luacheck: globals HeroWindowLoadoutInventory
-- needs to be global for create_input_service
Favorite_keymaps = {
win32 = {
fav = {
"keyboard",
"f",
"pressed"
},
junk = {
"keyboard",
"j",
"pressed"
},
}
}
Favorite_keymaps.xb1 = Favorite_keymaps.win32
local fav_item_text_style = {
horizontal_alignment = "left",
color = {
100,
220,
20,
60
},
texture_size = {
20,
20
},
offset = {
220+28,
35-8,
6
},
vertical_alignment = "center"
}
local junk_item_text_style = {
horizontal_alignment = "left",
color = {
75,
255,
255,
255
},
texture_size = {
20,
20
},
offset = {
220+28,
35-8,
6
},
vertical_alignment = "center"
}
mod.FAVS_SETTINGS_KEY = "favs"
mod.JUNK_SETTINGS_KEY = "junk"
mod.favs_table = pl.List(mod:get(mod.FAVS_SETTINGS_KEY) or {})
mod.junk_table = pl.List(mod:get(mod.JUNK_SETTINGS_KEY) or {})
local reload = false
mod.remove_passes = function(widget)
local passes = widget.element.passes
-- widget.element.dirty = true
-- local favorite_pass_index = nil
-- for i, pass in ipairs(passes) do
-- if pass.texture_id == "texture_fav" then
-- favorite_pass_index = i
-- break
-- end
-- end
-- local junk_pass_index = nil
-- for i, pass in ipairs(passes) do
-- if pass.texture_id == "texture_junk" then
-- junk_pass_index = i
-- break
-- end
-- end
-- if junk_pass_index then
-- table.remove(passes, junk_pass_index)
-- end
-- if favorite_pass_index then
-- table.remove(passes, favorite_pass_index)
-- end
local new_passes
mod:pcall(function()
new_passes = pl.seq(passes):filter(
function(pass)
return not pass.texture_id or (pass.texture_id ~= 'texture_fav' and pass.texture_id ~= 'texture_junk')
end):copy()
end)
if new_passes then
widget.element.passes = new_passes
end
widget.element.dirty = true
end
mod.create_passes = function(widget)
local passes = widget.element.passes
local content = widget.content
local rows = content.rows
local columns = content.columns
for i = 1, rows, 1 do
for k = 1, columns, 1 do
if widget.content["item_" .. tostring(i) .. "_" .. tostring(k)] then
local fav_style_key = "text_favorite_" .. tostring(i) .. "_" .. tostring(k)
local junk_style_key = "text_junk_" .. tostring(i) .. "_" .. tostring(k)
widget.style[fav_style_key] = table.clone(fav_item_text_style)
widget.style[junk_style_key] = table.clone(junk_item_text_style)
widget.style[fav_style_key].offset = table.clone(widget.style["item_icon_" .. tostring(i) .. "_" .. tostring(k)].offset)
widget.style[fav_style_key].offset[1] = widget.style[fav_style_key].offset[1] + 8
widget.style[fav_style_key].offset[2] = widget.style[fav_style_key].offset[2] - 60 - 250 - 19 + 45 + 1
widget.style[fav_style_key].offset[3] = 10
widget.style[junk_style_key].offset = table.clone(widget.style["item_icon_" .. tostring(i) .. "_" .. tostring(k)].offset)
widget.style[junk_style_key].offset[1] = widget.style[junk_style_key].offset[1] + 54
widget.style[junk_style_key].offset[2] = widget.style[junk_style_key].offset[2] - 60 - 250 - 19
widget.style[junk_style_key].offset[3] = 10
widget.content["item_" .. tostring(i) .. "_" .. tostring(k)].texture_junk = "trash"
widget.content["item_" .. tostring(i) .. "_" .. tostring(k)].texture_fav = "heart"
passes[#passes + 1] =
{
pass_type = "texture",
style_id = fav_style_key,
content_id = "item_" .. tostring(i) .. "_" .. tostring(k),
texture_id = "texture_fav",
content_check_function = function(content, style)
return table.contains(mod.favs_table, content.backend_id)
end,
}
widget.element.pass_data[#passes] = {
style_id = fav_style_key,
content_id = "item_" .. tostring(i) .. "_" .. tostring(k),
texture_id = "texture_fav",
}
passes[#passes + 1] =
{
pass_type = "texture",
style_id = junk_style_key,
content_id = "item_" .. tostring(i) .. "_" .. tostring(k),
texture_id = "texture_junk",
content_check_function = function(content, style)
return table.contains(mod.junk_table, content.backend_id)
end,
}
widget.element.pass_data[#passes] = {
style_id = junk_style_key,
content_id = "item_" .. tostring(i) .. "_" .. tostring(k),
texture_id = "texture_junk",
}
end
end
end
end
mod:hook(HeroWindowLoadoutInventory, "on_exit", function (func, self, ...)
reload = true
local widget = self._item_grid._widget
mod.remove_passes(widget)
return func(self, ...)
end)
mod:hook(HeroWindowLoadoutInventory, "update", function (func, self, ...)
local widget = self._item_grid._widget
if not widget.content.item_1_2 then
mod.remove_passes(widget)
return func(self, ...)
end
if not self._created_favs or reload then
mod.create_passes(widget)
self._created_favs = true
end
widget.element.dirty = true
if reload then
reload = false
end
return func(self, ...)
end)
local function item_sort_func(item_1, item_2)
local item_data_1 = item_1.data
local item_data_2 = item_2.data
local item_1_rarity = item_1.rarity or item_data_1.rarity
local item_2_rarity = item_2.rarity or item_data_2.rarity
local item_rarity_order = UISettings.item_rarity_order
local item_1_rarity_order = item_rarity_order[item_1_rarity]
local item_2_rarity_order = item_rarity_order[item_2_rarity]
local backend_id_1 = item_1.backend_id
local backend_id_2 = item_2.backend_id
local is_fav_1 = mod.favs_table:contains(backend_id_1)
local is_fav_2 = mod.favs_table:contains(backend_id_2)
if is_fav_1 and not is_fav_2 then
return true
elseif is_fav_2 and not is_fav_1 then
return false
end
if item_1_rarity_order == item_2_rarity_order then
local item_type_1 = Localize(item_data_1.item_type)
local item_type_2 = Localize(item_data_2.item_type)
if item_type_1 == item_type_2 then
local _, item_1_display_name = UIUtils.get_ui_information_from_item(item_1)
local _, item_2_display_name = UIUtils.get_ui_information_from_item(item_2)
local item_name_1 = Localize(item_1_display_name)
local item_name_2 = Localize(item_2_display_name)
return item_name_1 < item_name_2
else
return item_type_1 < item_type_2
end
else
return item_1_rarity_order < item_2_rarity_order
end
end
local function junk_last_item_sort_func(item_1, item_2)
local backend_id_1 = item_1.backend_id
local backend_id_2 = item_2.backend_id
local is_junk_1 = mod.junk_table:contains(backend_id_1)
local is_junk_2 = mod.junk_table:contains(backend_id_2)
if is_junk_1 and not is_junk_2 then
return false
elseif is_junk_2 and not is_junk_1 then
return true
end
return item_sort_func(item_1, item_2)
end
local function junk_item_sort_func(item_1, item_2)
local backend_id_1 = item_1.backend_id
local backend_id_2 = item_2.backend_id
local is_junk_1 = mod.junk_table:contains(backend_id_1)
local is_junk_2 = mod.junk_table:contains(backend_id_2)
if is_junk_1 and not is_junk_2 then
return true
elseif is_junk_2 and not is_junk_1 then
return false
end
return item_sort_func(item_1, item_2)
end
mod:hook(ItemGridUI, "change_item_filter", function (func, self, item_filter, change_page)
if pl.stringx.count(item_filter, "can_salvage") > 0 then
item_filter = "not is_favorite and " .. item_filter
self:apply_item_sorting_function(junk_item_sort_func)
elseif pl.stringx.count(item_filter, "slot_type == loot_chest") == 0 then
self:apply_item_sorting_function(junk_last_item_sort_func)
end
return func(self, item_filter, change_page)
end)
mod.serialize = function()
mod:set(mod.FAVS_SETTINGS_KEY, mod.favs_table)
mod:set(mod.JUNK_SETTINGS_KEY, mod.junk_table)
end
mod.is_favorite = function(backend_id)
return mod.favs_table:contains(backend_id)
end
mod.is_junk = function(backend_id)
return mod.junk_table:contains(backend_id)
end
mod.remove_item_from_junk = function(backend_id)
if mod.junk_table:contains(backend_id) then
mod.junk_table:remove_value(backend_id)
mod.serialize()
end
end
mod.toggle_item_as_favorite = function(backend_id)
if mod.favs_table:contains(backend_id) then
mod.favs_table:remove_value(backend_id)
else
mod.remove_item_from_junk(backend_id)
mod.favs_table:append(backend_id)
end
mod.serialize()
end
mod.toggle_item_as_junk = function(backend_id)
if mod.junk_table:contains(backend_id) then
mod.junk_table:remove_value(backend_id)
else
mod.junk_table:append(backend_id)
end
mod.serialize()
end
mod.get_fav_input_service = function()
if not Managers.input:get_input_service("favorite_input_service") then
Managers.input:create_input_service("favorite_input_service", "Favorite_keymaps")
Managers.input:map_device_to_service("favorite_input_service", "keyboard")
Managers.input:map_device_to_service("favorite_input_service", "mouse")
Managers.input:map_device_to_service("favorite_input_service", "gamepad")
end
Managers.input:device_unblock_service("keyboard", 1, "favorite_input_service")
return Managers.input:get_input_service("favorite_input_service")
end
mod:hook(ItemGridUI, "_populate_inventory_page", function (func, self, ...)
local widget = self._widget
mod.remove_passes(widget)
func(self, ...)
mod.create_passes(widget)
end)
-- variable for enforcing a delay between fav/junk toggle on an item in an item grid
-- without delay we get one toggle registering as multiple through successive draw function calls
local toggled_time = -math.huge
local DEFAULT_START_LAYER = 994
local function get_text_height(ui_renderer, size, ui_style, ui_content, text, ui_style_global)
local widget_scale = nil
if ui_style_global then
widget_scale = ui_style_global.scale
end
local font_material, font_size, font_name = nil
if ui_style.font_type then
local font, size_of_font = UIFontByResolution(ui_style, widget_scale)
font_name = font[3]
font_size = font[2]
font_material = font[1]
font_size = size_of_font
else
local font = ui_style.font
font_name = font[3]
font_size = font[2]
font_material = font[1]
if not ui_style.font_size then
end
end
if ui_style.localize then
text = Localize(text)
end
local font_height, font_min, font_max = UIGetFontHeight(ui_renderer.gui, font_name, font_size)
local texts = UIRenderer.word_wrap(ui_renderer, text, font_material, font_size, size[1])
local text_start_index = ui_content.text_start_index or 1
local max_texts = ui_content.max_texts or #texts
local num_texts = math.min(#texts - text_start_index - 1, max_texts)
local inv_scale = RESOLUTION_LOOKUP.inv_scale
local full_font_height = (font_max + math.abs(font_min))*inv_scale*num_texts
return full_font_height
end
local function is_chest(item_data)
local item_type = item_data.item_type
return item_type == "loot_chest"
end
--NOTE: can refactor this to create UITooltipPasses.junk from UITooltipPasses.fav
UITooltipPasses.fav = {
setup_data = function ()
local data = {
text_pass_data = {
text_id = "text"
},
text_size = {},
content = {
prefix_text = "Favorite"
},
style = {
text = {
vertical_alignment = "center",
name = "description",
localize = false,
word_wrap = true,
font_size = 18,
horizontal_alignment = "center",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("orange", 255)
}
}
}
return data
end,
draw = function (draw, ui_renderer, pass_data, ui_scenegraph, pass_definition, ui_style, ui_content, position, size, input_service, dt, ui_style_global, item, data, draw_downwards)
local alpha_multiplier = pass_data.alpha_multiplier
local alpha = 255 * alpha_multiplier
local start_layer = pass_data.start_layer or DEFAULT_START_LAYER
local frame_margin = data.frame_margin or 0
local style = data.style
local content = data.content
if is_chest(item.data) then
return 0
end
local backend_id = item.backend_id
if mod.favs_table:contains(backend_id) then
content.text = content.prefix_text
local position_x = position[1]
local position_y = position[2]
local position_z = position[3]
position[3] = start_layer + 5
local text_style = style.text
local text_pass_data = data.text_pass_data
local text_size = data.text_size
text_size[1] = size[1] - frame_margin * 2
text_size[2] = 0
local text_height = -1*get_text_height(ui_renderer, text_size, text_style, content, content.text, ui_style_global)
text_size[2] = text_height
if draw then
position[1] = position_x + frame_margin
position[2] = position[2] - text_height
text_style.text_color[1] = alpha
UIPasses.text.draw(ui_renderer, text_pass_data, ui_scenegraph, pass_definition, text_style, content, position, text_size, input_service, dt, ui_style_global)
end
position[1] = position_x
position[2] = position_y
position[3] = position_z
return text_height
else
return 0
end
end
}
UITooltipPasses.junk = {
setup_data = function ()
local data = {
text_pass_data = {
text_id = "text"
},
text_size = {},
content = {
prefix_text = "Junk"
},
style = {
text = {
vertical_alignment = "center",
name = "description",
localize = false,
word_wrap = true,
font_size = 18,
horizontal_alignment = "center",
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("white", 255)
}
}
}
return data
end,
draw = function (draw, ui_renderer, pass_data, ui_scenegraph, pass_definition, ui_style, ui_content, position, size, input_service, dt, ui_style_global, item, data, draw_downwards)
local alpha_multiplier = pass_data.alpha_multiplier
local alpha = 255 * alpha_multiplier
local start_layer = pass_data.start_layer or DEFAULT_START_LAYER
local frame_margin = data.frame_margin or 0
local style = data.style
local content = data.content
if is_chest(item.data) then
return 0
end
local backend_id = item.backend_id
if mod.junk_table:contains(backend_id) then
content.text = content.prefix_text
local position_x = position[1]
local position_y = position[2]
local position_z = position[3]
position[3] = start_layer + 5
local text_style = style.text
local text_pass_data = data.text_pass_data
local text_size = data.text_size
text_size[1] = size[1] - frame_margin * 2
text_size[2] = 0
local text_height = -1*get_text_height(ui_renderer, text_size, text_style, content, content.text, ui_style_global)
text_size[2] = text_height
if draw then
position[1] = position_x + frame_margin
position[2] = position[2] - text_height
text_style.text_color[1] = alpha
UIPasses.text.draw(ui_renderer, text_pass_data, ui_scenegraph, pass_definition, text_style, content, position, text_size, input_service, dt, ui_style_global)
end
position[1] = position_x
position[2] = position_y
position[3] = position_z
return text_height
else
return 0
end
end
}
UITooltipPasses.advanced_input_helper_favorite = {
setup_data = function ()
local frame_name = "item_tooltip_frame_01"
local frame_settings = UIFrameSettings[frame_name]
local data = {
frame_name = "item_tooltip_frame_01",
background_color = {
240,
3,
3,
3
},
text_pass_data = {
text_id = "text"
},
text_size = {},
frame_pass_data = {},
frame_pass_definition = {
texture_id = "frame",
style_id = "frame"
},
frame_size = {
0,
0
},
content = {
text = "",
frame = frame_settings.texture
},
style = {
frame = {
texture_size = frame_settings.texture_size,
texture_sizes = frame_settings.texture_sizes,
color = {
255,
255,
255,
255
},
offset = {
0,
0,
1
}
},
text = {
vertical_alignment = "center",
font_size = 16,
horizontal_alignment = "center",
word_wrap = true,
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("font_title", 255)
},
background = {
color = {
255,
10,
10,
10
},
offset = {
0,
0,
-1
}
}
}
}
return data
end,
draw = function (draw, ui_renderer, pass_data, ui_scenegraph, pass_definition, ui_style, ui_content, position, size, input_service, dt, ui_style_global, item, data, draw_downwards)
local alpha_multiplier = pass_data.alpha_multiplier
local alpha = 255 * alpha_multiplier
local start_layer = pass_data.start_layer or DEFAULT_START_LAYER
local frame_margin = data.frame_margin or 0
local style = data.style
local content = data.content
if is_chest(item.data) then
return 0
end
local position_x = position[1]
local position_y = position[2]
local position_z = position[3]
local total_height = 0
position[3] = start_layer - 6
if (#pass_data.items == 2 or #pass_data.items == 3) and item ~= pass_data.items[1] then
return 0
end
local backend_id = item.backend_id
mod:pcall(function()
local fav_input_service = mod.get_fav_input_service()
if fav_input_service:get("fav") or fav_input_service:get("junk") then
local current_time = Managers.time:time("main")
-- if 2 tooltips open while in comparison make sure we're changing the correct one
if #pass_data.items == 1
or #pass_data.items == 2 and item == pass_data.items[1] then
if toggled_time + 0.1 < current_time then
toggled_time = current_time
if fav_input_service:get("fav") then
mod.toggle_item_as_favorite(backend_id)
end
if fav_input_service:get("junk") then
if not mod.favs_table:contains(backend_id) then
mod.toggle_item_as_junk(backend_id)
end
end
end
end
end
end)
if mod.is_favorite(backend_id) then
content.text = "Click [f] to unmark as favorite."
else
content.text = "Click [f] to mark as favorite."
end
if true then
local text_style = style.text
local text_pass_data = data.text_pass_data
local text = content.text
local text_size = data.text_size
text_size[1] = size[1] - frame_margin*2
text_size[2] = 0
local text_height = -1 * get_text_height(ui_renderer, text_size, text_style, content, text, ui_style_global)
total_height = total_height + text_height
text_size[2] = text_height
local frame_size = data.frame_size
local frame_pass_data = data.frame_pass_data
local frame_pass_definition = data.frame_pass_definition
local frame_content = data.content
local frame_style = data.style.frame
frame_size[1] = text_size[1]
frame_size[2] = text_size[2] + frame_margin/2
total_height = total_height + frame_size[2]
position[2] = position[2] - frame_size[2] - frame_margin/2
position[1] = position[1] + frame_margin
local old_y_position = position[2]
if draw then
local frame_color = frame_style.color
frame_color[1] = alpha
UIPasses.texture_frame.draw(ui_renderer, frame_pass_data, ui_scenegraph, frame_pass_definition, frame_style, frame_content, position, frame_size, input_service, dt, ui_style_global)
local background_style = data.style.background
local background_color = background_style.color
background_color[1] = alpha
position[3] = position[3] - 1
UIRenderer.draw_rect(ui_renderer, position, frame_size, background_color)
position[3] = position[3] + 1
end
position[2] = old_y_position + frame_margin/4
text_size[1] = frame_size[1]
if draw then
local text_color = text_style.text_color
text_color[1] = alpha
UIPasses.text.draw(ui_renderer, text_pass_data, ui_scenegraph, pass_definition, text_style, content, position, text_size, input_service, dt, ui_style_global)
end
position[1] = position_x
position[2] = position_y
position[3] = position_z
return 0
end
end
}
UITooltipPasses.advanced_input_helper_junk = {
setup_data = function ()
local frame_name = "item_tooltip_frame_01"
local frame_settings = UIFrameSettings[frame_name]
local data = {
frame_name = "item_tooltip_frame_01",
background_color = {
240,
3,
3,
3
},
text_pass_data = {
text_id = "text"
},
text_size = {},
frame_pass_data = {},
frame_pass_definition = {
texture_id = "frame",
style_id = "frame"
},
frame_size = {
0,
0
},
content = {
text = "",
frame = frame_settings.texture
},
style = {
frame = {
texture_size = frame_settings.texture_size,
texture_sizes = frame_settings.texture_sizes,
color = {
255,
255,
255,
255
},
offset = {
0,
0,
1
}
},
text = {
vertical_alignment = "center",
font_size = 16,
horizontal_alignment = "center",
word_wrap = true,
font_type = "hell_shark",
text_color = Colors.get_color_table_with_alpha("font_title", 255)
},
background = {
color = {
255,
10,
10,
10
},
offset = {
0,
0,
-1
}
}
}
}
return data
end,
draw = function (draw, ui_renderer, pass_data, ui_scenegraph, pass_definition, ui_style, ui_content, position, size, input_service, dt, ui_style_global, item, data, draw_downwards)
local alpha_multiplier = pass_data.alpha_multiplier
local alpha = 255 * alpha_multiplier
local start_layer = pass_data.start_layer or DEFAULT_START_LAYER
local frame_margin = data.frame_margin or 0
local style = data.style
local content = data.content
if is_chest(item.data) then
return 0
end
local position_x = position[1]
local position_y = position[2]
local position_z = position[3]
local total_height = 0
position[3] = start_layer - 6
if (#pass_data.items == 2 or #pass_data.items == 3) and item ~= pass_data.items[1] then
return 0
end
local backend_id = item.backend_id
if mod.is_favorite(backend_id) then
return 0
end
if mod.is_junk(backend_id) then
content.text = "Click [j] to unmark as junk."
else
content.text = "Click [j] to mark as junk."
end
if true then
local text_style = style.text
local text_pass_data = data.text_pass_data
local text = content.text
local text_size = data.text_size
text_size[1] = size[1] - frame_margin*2
text_size[2] = 0
local text_height = -1 * get_text_height(ui_renderer, text_size, text_style, content, text, ui_style_global)
total_height = total_height + text_height
text_size[2] = text_height
local frame_size = data.frame_size
local frame_pass_data = data.frame_pass_data
local frame_pass_definition = data.frame_pass_definition
local frame_content = data.content
local frame_style = data.style.frame
frame_size[1] = text_size[1]
frame_size[2] = text_size[2] + frame_margin/2
total_height = total_height + frame_size[2]
position[2] = position[2] - frame_size[2] - frame_margin/2 - 28
position[1] = position[1] + frame_margin
local old_y_position = position[2]
if draw then
local frame_color = frame_style.color
frame_color[1] = alpha
UIPasses.texture_frame.draw(ui_renderer, frame_pass_data, ui_scenegraph, frame_pass_definition, frame_style, frame_content, position, frame_size, input_service, dt, ui_style_global)
local background_style = data.style.background
local background_color = background_style.color
background_color[1] = alpha
position[3] = position[3] - 1
UIRenderer.draw_rect(ui_renderer, position, frame_size, background_color)
position[3] = position[3] + 1
end
position[2] = old_y_position + frame_margin/4
text_size[1] = frame_size[1]
if draw then
local text_color = text_style.text_color
text_color[1] = alpha
UIPasses.text.draw(ui_renderer, text_pass_data, ui_scenegraph, pass_definition, text_style, content, position, text_size, input_service, dt, ui_style_global)
end
end
position[1] = position_x
position[2] = position_y
position[3] = position_z
return 0
end
}
mod:hook(UIPasses.item_tooltip, "init", function(func, pass_definition, ui_content, ui_style, style_global)
local pass_data = func(pass_definition, ui_content, ui_style, style_global)
table.insert(pass_data.passes, 4, {
data = UITooltipPasses.fav.setup_data(),
draw = UITooltipPasses.fav.draw
})
table.insert(pass_data.passes, 5, {
data = UITooltipPasses.junk.setup_data(),
draw = UITooltipPasses.junk.draw
})
table.insert(pass_data.passes, #pass_data.passes + 1, {
data = UITooltipPasses.advanced_input_helper_favorite.setup_data(),
draw = UITooltipPasses.advanced_input_helper_favorite.draw
})
table.insert(pass_data.passes, #pass_data.passes + 1, {
data = UITooltipPasses.advanced_input_helper_junk.setup_data(),
draw = UITooltipPasses.advanced_input_helper_junk.draw
})
return pass_data
end)
local filter_operators = {
["not"] = {
4,
1,
function (op1)
return not op1
end
},
["<"] = {
3,
2,
function (op1, op2)
return op1 < op2
end
},
[">"] = {
3,
2,
function (op1, op2)
return op2 < op1
end
},
["<="] = {
3,
2,
function (op1, op2)
return op1 <= op2
end
},
[">="] = {
3,
2,
function (op1, op2)
return op2 <= op1
end
},
["~="] = {
3,
2,
function (op1, op2)
return op1 ~= op2
end
},
["=="] = {
3,
2,
function (op1, op2)
return op1 == op2
end
},
["and"] = {
2,
2,
function (op1, op2)
return op1 and op2
end
},
["or"] = {
1,
2,
function (op1, op2)
return op1 or op2
end
}
}
local filter_macros = {
is_favorite = function (item, backend_id)
return mod.favs_table:contains(backend_id)
end,
item_key = function (item, backend_id)
local item_data = item.data
return item_data.key
end,
item_rarity = function (item, backend_id)
local item_data = item.data
local backend_items = Managers.backend:get_interface("items")
local rarity = backend_items:get_item_rarity(backend_id)
return rarity
end,
slot_type = function (item, backend_id)
local item_data = item.data
return item_data.slot_type
end,
item_type = function (item, backend_id)
local item_data = item.data
return item_data.item_type
end,
chest_category = function (item, backend_id)
local item_data = item.data
return item_data.chest_category
end,
trinket_as_hero = function (item, backend_id)
local item_data = item.data
if item_data.traits then
for _, trait_name in ipairs(item_data.traits) do
local trait_config = BuffTemplates[trait_name]
local roll_dice_as_hero = trait_config.roll_dice_as_hero
if roll_dice_as_hero then
return true
end
end
end
return
end,
equipped_by_current_career = function (item, backend_id, params)
local item_data = item.data
local profile_synchronizer = Managers.state.network.profile_synchronizer
local player = nil
if params and params.player then
player = params.player
else
player = Managers.player:local_player()
end
if not player then
return false
end
local profile_index = player:profile_index()
if not profile_index or profile_index == 0 then
return false
end
local career_index = player:career_index()
if not career_index or career_index == 0 then
return false
end
local hero_data = SPProfiles[profile_index]
local career_data = hero_data.careers[career_index]
local career_name = career_data.name
local backend_items = Managers.backend:get_interface("items")
local career_names = backend_items:equipped_by(backend_id)
return table.contains(career_names, career_name)
end,
is_equipped = function (item, backend_id)
local item_data = item.data
local backend_items = Managers.backend:get_interface("items")
local career_names = backend_items:equipped_by(backend_id)
if 0 < #career_names then
return true
end
return false
end,
is_equipment_slot = function (item, backend_id)
local item_data = item.data
local is_slot = false
for _, slot in ipairs(InventorySettings.equipment_slots) do
if item_data.slot_type == slot.type then
is_slot = true
break
end
end
return is_slot
end,
current_hero = function (item, backend_id)
local item_data = item.data
local profile_synchronizer = Managers.state.network.profile_synchronizer
local player = Managers.player:local_player()
local profile_index = profile_synchronizer:profile_by_peer(player:network_id(), player:local_player_id())
local hero_data = SPProfiles[profile_index]
local hero_name = hero_data.display_name
return hero_name
end,
can_wield_by_current_career = function (item, backend_id)
local item_data = item.data
local profile_synchronizer = Managers.state.network.profile_synchronizer
local player = Managers.player:local_player()
local profile_index = player:profile_index()
local career_index = player:career_index()
local hero_data = SPProfiles[profile_index]
local career_data = hero_data.careers[career_index]
local career_name = career_data.name
local item_can_wield = item_data.can_wield
return table.contains(item_can_wield, career_name)
end,
can_wield_by_current_hero = function (item, backend_id)
local item_data = item.data
local profile_synchronizer = Managers.state.network.profile_synchronizer
local player = Managers.player:local_player()
local profile_index = player:profile_index()
local career_index = player:career_index()
local hero_data = SPProfiles[profile_index]
local careers = hero_data.careers
local item_can_wield = item_data.can_wield
for career_index, career in ipairs(careers) do
local career_name = career.name
if table.contains(item_can_wield, career_name) then
return true
end
end
return false
end,
can_wield_bright_wizard = function (item, backend_id)
local item_data = item.data
local hero_name = "bright_wizard"
local can_wield = item_data.can_wield
return table.contains(can_wield, hero_name)
end,
can_wield_dwarf_ranger = function (item, backend_id)
local item_data = item.data
local hero_name = "dwarf_ranger"
local can_wield = item_data.can_wield
return table.contains(can_wield, hero_name)
end,
can_wield_empire_soldier = function (item, backend_id)
local item_data = item.data
local hero_name = "empire_soldier"
local can_wield = item_data.can_wield
return table.contains(can_wield, hero_name)
end,
can_wield_witch_hunter = function (item, backend_id)
local item_data = item.data
local hero_name = "witch_hunter"
local can_wield = item_data.can_wield
return table.contains(can_wield, hero_name)
end,
can_wield_wood_elf = function (item, backend_id)
local item_data = item.data
local hero_name = "wood_elf"
local can_wield = item_data.can_wield
return table.contains(can_wield, hero_name)
end,
player_owns_item_key = function (item, backend_id)
local item_data = item.data
local backend_items = Managers.backend:get_interface("items")
local all_items = backend_items:get_all_backend_items()
for backend_id, config in pairs(all_items) do
if item_data.key == config.key then
return true
end
end
return false
end,
can_salvage = function (item, backend_id)
local item_data = item.data
local slot_type = item_data.slot_type
if slot_type == "ranged" or slot_type == "melee" or slot_type == "ring" or slot_type == "necklace" or slot_type == "trinket" or slot_type == "hat" then
local backend_items = Managers.backend:get_interface("items")
local rarity = backend_items:get_item_rarity(backend_id)
if rarity ~= "default" then
local career_names = backend_items:equipped_by(backend_id)
if #career_names == 0 then
return true
end
end
end
return false
end,
has_properties = function (item, backend_id)
if item.properties then
return true
end
return false
end,
has_traits = function (item, backend_id)
if item.traits then
return true
end
return false
end,
has_applied_skin = function (item, backend_id)
local item_data = item.data
local slot_type = item_data.slot_type
if item.skin and slot_type ~= "weapon_skin" then
return true
end
return false
end,
can_apply_skin = function (item, backend_id)
local item_data = item.data
local slot_type = item_data.slot_type
if (slot_type == "ranged" or slot_type == "melee") and not item.skin then
local backend_items = Managers.backend:get_interface("items")
local career_names = backend_items:equipped_by(backend_id)
if #career_names == 0 then
local weapon_skin_name = item_data.key .. "_skin"
return backend_items:has_item(weapon_skin_name)
end
end
return false
end,
can_upgrade = function (item, backend_id)
local item_data = item.data
local slot_type = item_data.slot_type
if slot_type == "ranged" or slot_type == "melee" or slot_type == "ring" or slot_type == "necklace" or slot_type == "trinket" then
local backend_items = Managers.backend:get_interface("items")
local rarity = backend_items:get_item_rarity(backend_id)
if rarity == "plentiful" or rarity == "common" or rarity == "rare" then
return true
end
end
return
end,
can_craft_with = function (item, backend_id)
local item_data = item.data
local slot_type = item_data.slot_type
if slot_type == "ranged" or slot_type == "melee" or slot_type == "ring" or slot_type == "necklace" or slot_type == "trinket" then
local backend_items = Managers.backend:get_interface("items")
local rarity = backend_items:get_item_rarity(backend_id)
if rarity == "default" then
return true
end
end
return
end
}
local empty_params = {}
mod:hook_origin(BackendInterfaceCommon, "filter_items", function (self, items, filter_infix, params)
local filter_postfix = BackendInterfaceCommon.filter_postfix_cache[filter_infix]
if not filter_postfix then
filter_postfix = self:_infix_to_postfix_item_filter(filter_infix)
BackendInterfaceCommon.filter_postfix_cache[filter_infix] = filter_postfix
end
local item_master_list = ItemMasterList
local stack = {}
local passed = {}
for backend_id, item in pairs(items) do
local key = item.key
local item_data = item_master_list[key]
table.clear(stack)
for i = 1, #filter_postfix, 1 do
local token = filter_postfix[i]
if filter_operators[token] then
local num_params = filter_operators[token][2]
local op_func = filter_operators[token][3]
local op1 = table.remove(stack)
if num_params == 1 then
stack[#stack + 1] = op_func(op1)
else
local op2 = table.remove(stack)
stack[#stack + 1] = op_func(op1, op2)
end
else
local macro_func = filter_macros[token]
if macro_func then
stack[#stack + 1] = macro_func(item, backend_id, params or empty_params)
else
stack[#stack + 1] = token
end
end
end
if stack[1] == true then
local item = table.clone(item)
passed[#passed + 1] = item
end
end
return passed
end)
-- sublime lua reformat loses its wits here
mod:hook_origin(BackendInterfaceCommon, "_infix_to_postfix_item_filter", function (self, filter_infix)
local output = {}
local stack = {}
for token in string.gmatch(filter_infix, "%S+") do
if filter_operators[token] then
while 0 < #stack do
local top = stack[#stack]
if filter_operators[top] and filter_operators[token][1] <= filter_operators[top][1] then
output[#output + 1] = table.remove(stack)
else
break
end
end
stack[#stack + 1] = token
elseif token == "(" then
stack[#stack + 1] = "("
elseif token == ")" then
while 0 < #stack do
local top = stack[#stack]
if top ~= "(" then
output[#output + 1] = table.remove(stack)
else
stack[#stack] = nil
break
end
end
else
output[#output + 1] = token
end
end
while 0 < #stack do
output[#output + 1] = table.remove(stack)
end
for i = 1, #output, 1 do
local token = output[i]
if token == "true" then
output[i] = true
elseif token == "false" then
output[i] = false
elseif tonumber(token) then
output[i] = tonumber(token)
end
end
return output
end)
|
------------------------------------------------------------------------------------------------------------
if(ffi == nil) then ffi = require( "ffi" ) end
------------------------------------------------------------------------------------------------------------
sdl = require( "ffi/sdl" )
sdl_image = require("ffi/sdl_image")
egl = require( "ffi/egl" )
------------------------------------------------------------------------------------------------------------
-- This is global.. because it damn well should be!!!
WM_frameMs = 0.0
WM_fps = 0
------------------------------------------------------------------------------------------------------------
-- Some platform specifics
local attrib_list = {}
if ffi.os == "OSX" then
--print('wm.display/dpy/r', wm.display, dpy, r)
attrib_list = {
-- egl.EGL_LEVEL, 0,
-- egl.EGL_SURFACE_TYPE, egl.EGL_WINDOW_BIT,
egl.EGL_RENDERABLE_TYPE, egl.EGL_OPENGL_ES2_BIT,
-- egl.EGL_NATIVE_RENDERABLE, egl.EGL_FALSE,
egl.EGL_DEPTH_SIZE, egl.EGL_DONT_CARE,
egl.EGL_NONE, egl.EGL_NONE
}
elseif ffi.os == "Windows" or ffi.os == "Linux" then
--print('wm.display/dpy/r', wm.display, dpy, r)
attrib_list = {
-- egl.EGL_LEVEL, 0,
-- egl.EGL_SURFACE_TYPE, egl.EGL_WINDOW_BIT,
egl.EGL_RENDERABLE_TYPE, egl.EGL_OPENGL_ES2_BIT,
-- egl.EGL_NATIVE_RENDERABLE, egl.EGL_FALSE,
egl.EGL_DEPTH_SIZE, 24,
egl.EGL_NONE, egl.EGL_NONE
}
end
------------------------------------------------------------------------------------------------------------
--- Only bother using SDL for Win/Linux/OSX platforms!!
--- Use EGL only for Android and IOS.
------------------------------------------------------------------------------------------------------------
-- SDL Initialisation
-- Use SDL for windowing and events
-- TODO: Clean this up so the system can switch between pure EGL and SDL.
-- SDL will eventually only be for byt3d Editor.
------------------------------------------------------------------------------------------------------------
function VideoMode(ww, wh, fs)
local sdlbits = bit.bor(sdl.SDL_RESIZABLE, sdl.SDL_HWSURFACE, sdl.SDL_DOUBLEBUF, sdl.SDL_OPENGL )
if(fs == 1) then sdlbits = bit.bor(sdl.SDL_HWSURFACE, sdl.SDL_FULLSCREEN, sdl.SDL_DOUBLEBUF, sdl.SDL_OPENGL ) end
-- TODO: This needs to be able to be cross platform.
local screen = sdl.SDL_SetVideoMode( ww, wh, 32, sdlbits )
print("Screen:", screen.w, screen.h )
sdl_screen = screen
gl.glViewport( 0, 0, screen.w, screen.h )
end
------------------------------------------------------------------------------------------------------------
function InitSDL(ww, wh, fs)
print("InitSDL:",ww, wh, fs)
VideoMode(ww, wh, fs)
-- Get Window info
local wminfo = ffi.new( "SDL_SysWMinfo" )
sdl.SDL_GetVersion( wminfo.version )
sdl.SDL_GetWMInfo( wminfo )
sdl_image.IMG_Init( bit.bor(sdl_image.IMG_INIT_PNG, sdl_image.IMG_INIT_JPG) )
local systems = { "win", "x11", "dfb", "cocoa", "uikit" }
local subsystem = wminfo.subsystem
local wminfo = wminfo.info[systems[tonumber(subsystem)]]
local window = wminfo.window
-- local display = nil
-- if systems[subsystem]=="x11" then
-- display = wminfo.display
-- print('X11', display, window)
-- end
-- Setup SDL Events - this is only temporary - will not use this for all.
local event = ffi.new( "SDL_Event" )
local prev_time, curr_time, fps = 0, 0, 0
-- Build a window structure used for the EGL display setup.
local windowStruct = {}
windowStruct.window = window
windowStruct.display = display
windowStruct.screen = sdl_screen
windowStruct.MouseButton = {}
windowStruct.MouseMove = { x=0, y=0 }
windowStruct.KeyUp = {}
windowStruct.KeyDown = {}
windowStruct.Swapbuffers = function()
egl.eglSwapBuffers(windowStruct.display, windowStruct.surface)
end
-- Update window function
windowStruct.Update = function()
-- Calculate the frame rate
prev_time, curr_time = curr_time, os.clock()
WM_frameMs = curr_time - prev_time + 0.00001
WM_fps = 1.0/WM_frameMs
-- Update the window caption with statistics
sdl.SDL_WM_SetCaption( string.format("%dx%d | %.2f fps | %.2f mps", sdl_screen.w, sdl_screen.h, fps, fps * (sdl_screen.w * sdl_screen.h) / (1024*1024)), nil )
-- Clear the KeyBuffers every frame - we dont keep crap lying around (do it yourself if you want!!)
windowStruct.KeyUp = {}
windowStruct.KeyDown = {}
windowStruct.MouseButton[10] = 0.0
local kd = 1
local ku = 1
while sdl.SDL_PollEvent( event ) ~= 0 do
if event.type == sdl.SDL_QUIT then
return false
end
if event.type == sdl.SDL_VIDEORESIZE then
VideoMode(event.resize.w, event.resize.h, 0)
if Gcairo then Gcairo:UpdateSize() end
end
if event.type == sdl.SDL_MOUSEWHEEL then
local x, y = event.wheel.x, event.wheel.y
windowStruct.MouseButton[10] = y
end
if event.type == sdl.SDL_MOUSEMOTION then
local motion, button = event.motion, event.button.button
windowStruct.MouseMove.x = motion.x
windowStruct.MouseMove.y = motion.y
end
if event.type == sdl.SDL_MOUSEBUTTONDOWN then
local motion, button = event.motion, event.button.button
windowStruct.MouseButton[button] = true
end
if event.type == sdl.SDL_MOUSEBUTTONUP then
local motion, button = event.motion, event.button.button
windowStruct.MouseButton[button] = false
end
if event.type == sdl.SDL_KEYDOWN then
windowStruct.KeyDown[kd] = { scancode = event.key.keysym.scancode,
sym = event.key.keysym.sym,
mod = event.key.keysym.mod }; kd = kd + 1
end
if event.type == sdl.SDL_KEYUP then
windowStruct.KeyUp[ku] = { scancode = event.key.keysym.scancode,
sym = event.key.keysym.sym,
mod = event.key.keysym.mod }; ku = ku + 1
end
if event.type == sdl.SDL_KEYUP and event.key.keysym.sym == sdl.SDLK_ESCAPE then
event.type = sdl.SDL_QUIT
sdl.SDL_PushEvent( event )
end
end
return true
end
-- Quit Window Function
windowStruct.Exit = function()
egl.eglDestroyContext( windowStruct.display, windowStruct.context )
egl.eglDestroySurface( windowStruct.display, windowStruct.surface )
egl.eglTerminate( windowStruct.display )
sdl.SDL_Quit()
end
return windowStruct
end
------------------------------------------------------------------------------------------------------------
function InitEGL(wm)
--print('DISPLAY',wm.display)
if wm.display == nil then
wm.display = egl.EGL_DEFAULT_DISPLAY
end
-- Need this for latest EGL support
if(ffi.os == "Windows") then ffi.C.LoadLibraryA("d3dcompiler_43.dll") end
local dpy = egl.eglGetDisplay( egl.EGL_DEFAULT_DISPLAY )
if dpy == egl.EGL_NO_DISPLAY then print("Cannot get current display.") end
local initctx = egl.eglInitialize( dpy, nil, nil )
if(initctx == 0) then print("Failed to initialize EGL.") end
local attsize = table.getn(attrib_list)
local cfg_attr = ffi.new( "EGLint["..attsize.."]", attrib_list )
local cfg = ffi.new( "EGLConfig[1]" )
local n_cfg = ffi.new( "EGLint[1]" )
--print('wm.window', wm.window)
local r0 = egl.eglChooseConfig( dpy, cfg_attr, cfg, 1, n_cfg )
if(r0 == nil) then print("Cannot find valid config: ", egl.eglGetError()) end
local attrValues = { egl.EGL_RENDER_BUFFER, egl.EGL_BACK_BUFFER, egl.EGL_NONE }
local attrList = ffi.new( "EGLint[3]", attrValues)
local surf = egl.eglCreateWindowSurface( dpy, cfg[0], wm.window, attrList )
if(surf == nil) then print("Cannot create surface: ", egl.eglGetError()) end
attrValues = { egl.EGL_CONTEXT_CLIENT_VERSION, 2, egl.EGL_NONE }
attrList = ffi.new( "EGLint[3]", attrValues)
local cfg_ctx = egl.eglCreateContext( dpy, cfg[0], nil, attrList )
if(cfg_ctx == nil) then print("Cannot create EGL Context:", egl.eglGetError()) end
local r = egl.eglMakeCurrent( dpy, surf, surf, cfg_ctx )
--print('surf/ctx', surf, r0, ctx, r, n_cfg[0])
local dpymode = ffi.new("SDL_DisplayMode[1]")
local currdpy = sdl.SDL_GetCurrentDisplayMode();
local res = sdl.SDL_GetDesktopDisplayMode(currdpy, dpymode)
print("Screen Display:", dpymode[0].w, dpymode[0].h, dpymode[0].refresh_rate)
-- Enable "Free Running" mode - non VSync
egl.eglSwapInterval( dpy, 0 )
-- Put egl info back into window struct!
wm.surface = surf
wm.context = cfg_ctx
wm.display = dpy
return { surf=surf, ctx=cfg_ctx, dpy=dpy, config=cfg[0], rconf=r, display=dpymode[0] }
end
------------------------------------------------------------------------------------------------------------
|
require 'torch'
-- get max value in a table
-- t: table
-- fn: function to compare two elements in the table
function max(t, fn)
if #t == 0 then return nil, nil end
local value = t[1]
for i = 2, #t do
if fn(value, t[i]) then
value = t[i]
end
end
return value
end
-- get model by path (path is the relative path to the checkpoint file)
function get_model_by_path(path)
local checkpoint = torch.load(path)
return checkpoint.model
end
-- get model by path with GPU (path is the relative path to the checkpoint file)
function get_model_by_path_with_GPU(path)
require 'cutorch'
require 'cunn'
cutorch.setDevice(1)
local checkpoint = torch.load(path)
local model = checkpoint.model
model:cuda()
return model
end
-- return a string containing all the characters in a model
function get_all_chars_in_model(model)
-- geting a sample
local opt = {}
opt.gpu = -1
opt.start_text = 'a'
local sample = model:probs(opt)
model:resetStates()
-- decoding a string of all char, sorted by its decoded index
local encoded = torch.Tensor(sample:size()[1])
for i=1, sample:size()[1] do
encoded[i] = i
end
all_chars_in_model = model:decode_string(encoded)
return all_chars_in_model
end
-- find a char which is not in the sample character's set, to denote the gap
function find_char_to_represent_gap(model)
all_chars_in_model = get_all_chars_in_model(model)
for i = 128, 255 do
if not string.find(all_chars_in_model, string.char(i)) then
return string.char(i)
end
end
return false
end
|
os.loadAPI("ws/Peripherals.lua"); local Peripherals = _G["Peripherals.lua"]
--TODO: Move this to a better place
if not os.getComputerLabel() then
os.setComputerLabel("Unnamed"..os.getComputerID())
end
local LEVEL_TRACE = 1
local LEVEL_DEBUG = 2
local LEVEL_INFO = 3
local LEVEL_WARN = 4
local LEVEL_ERROR = 5
local LEVEL_NAMES = {
[LEVEL_TRACE] = "TRACE",
[LEVEL_DEBUG] = "DEBUG",
[LEVEL_INFO] = "INFO",
[LEVEL_WARN] = "WARN",
[LEVEL_ERROR] = "ERROR"
}
local LEVEL_COLORS = {
[LEVEL_TRACE] = colors.gray,
[LEVEL_DEBUG] = colors.lightGray,
[LEVEL_INFO] = colors.white,
[LEVEL_WARN] = colors.yellow,
[LEVEL_ERROR] = colors.red
}
local LOG_LEVEL = LEVEL_DEBUG
local LOG_DIR = "ws/logs/"
local res = http.get("http://www.timeapi.org/utc/now")
local date = string.match(res.readAll(), "^(%d%d%d%d%-%d%d%-%d%d)")
local LOG_FILE = LOG_DIR..os.computerLabel().."_"..date..".log"
local LOG_FD = fs.open(LOG_FILE, "a")
function log(level, message)
if level >= LOG_LEVEL and level <= LEVEL_ERROR then
local time = os.clock()
local msg = message
if(not message) then
msg = "nil"
end
local msg = LEVEL_NAMES[level].." ["..time.."]: "..msg
LOG_FD.writeLine(msg)
LOG_FD.flush()
print(msg)
if Peripherals.monitor ~= nil then
local prevColor = Peripherals.monitor.getTextColor()
Peripherals.monitor.setTextColor(LEVEL_COLORS[level])
Peripherals.monitorWrite(msg)
Peripherals.monitor.setTextColor(prevColor)
end
end
end
function trace(message)
log(LEVEL_TRACE, message)
end
function debug(message)
log(LEVEL_DEBUG, message)
end
function info(message)
log(LEVEL_INFO, message)
end
function warn(message)
log(LEVEL_WARN, message)
end
function error(message)
log(LEVEL_ERROR, message)
end
|
#!/usr/bin/env lua
local VERSION = '@LUAVM_VERSION@'
local function run(luafile)
local chunk = loadfile(luafile)
local g = {}
setfenv(chunk, g)
return g, chunk()
end
local function loadvars(luadir)
local _, site_config = run(luadir..'/lua/luarocks/site_config.lua')
local g, _ = run(luadir..'/config.lua') -- load variables.MSVCRT as global
local major, minor = g.variables.MSVCRT:match('VCR%u*(%d+)(%d)$') -- MSVCR<x><y> or VCRUNTIME<x><y>
local VCVERSION = major..'.'..minor
local wsdkvers = {
['9.0'] = '6.1',
['10.0'] = '7.1'
}
return {
VCVER = VCVERSION,
WSDKVER = wsdkvers[VCVERSION],
CPUARCH = site_config.LUAROCKS_UNAME_M:find('64') ~= nil and 'amd64' or 'x86',
PREFIX = site_config.LUAROCKS_PREFIX
}
end
local function scan_path_related_files(bindir)
local rv = {
bindir..'/lua/luarocks/site_config.lua',
bindir..'/config.lua',
}
local h = io.popen(('dir /B "%s\\*.bat"'):format(bindir:gsub('/', '\\')))
for line in h:lines() do
rv[#rv+1] = bindir..'/'..line
end
return rv
end
local function read(file)
local f = io.open(file, 'rb')
if not f then return nil end
local d = f:read('*a')
f:close()
return d
end
local function write(file, content)
local f = io.open(file, 'wb')
if not f then return nil end
f:write(content)
f:close()
end
local function relocate_bin_scripts(files, oldroot, newroot)
local oldroot2 = oldroot:gsub('/', '\\')
newroot = newroot:gsub('\\', '/')
for _, f in ipairs(files) do
local text = read(f)
if text then
local relocated = text:gsub(oldroot, newroot):gsub(oldroot2, newroot)
if relocated ~= text then
-- print('Relocating:', f)
write(f, relocated)
end
end
end
end
local function exists(filename)
local f = io.open(filename, "r")
if f~=nil then
io.close(f) return true
else
return false
end
end
-- get a string value from windows registry.
local function get_registry(paths)
if type(paths) == 'string' then paths = {paths} end
for _, path in ipairs(paths) do
local key, value = path:match('^(.+):([^:]+)$')
local h = io.popen('reg query "'..key..'" /v '..value..' 2>NUL')
local output = h:read("*a")
h:close()
local v = (output:match("REG_SZ%s+([^\n]+)"))
if v ~= nil then return v end
end
return nil
end
local function trim_path(s)
return s:match'^["%s]*(.-)["%s]*$' or ''
end
-- Get environment variable from windows registry or current session
-- - source: 'machine' or 'user' or 'session'
-- - varname: the name of environment variable.
local function getenv(source, varname)
if source == 'session' then return os.getenv(varname) end
local sources = {
machine = [[HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]],
user = [[HKCU\Environment]]
}
local key = sources[source]
if not key then error('Unknown environment source: '..source) end
local h = io.popen('reg query "'..key..'" /v '..varname..' 2>NUL')
local output = h:read("*a")
h:close()
return (output:match("REG_[^%s]+%s+([^\n]+)"))
end
local function execf(fmt,...)
local cmd = fmt:format(...)
--print(cmd)
local r = os.execute(cmd)
assert(r == 0 or r == true, 'error while executing: ' .. cmd)
end
-- Set environment variable into windows registry or current session
-- - source: 'machine' or 'user' or 'session'
-- - varname: the name of environment variable.
-- - value: the value of environment variable.
local function setenv(source, varname, value)
if source == 'session' then
local tempfile = io.open(os.getenv('SESSION_UPDATE_BATCH'), 'w')
tempfile:write(('set %s=%s'):format(varname, value))
tempfile:close()
end
if source == 'user' then
execf('setx "%s" "%s" >NUL', varname, value)
end
if source == 'machine' then
execf('setx /M "%s" "%s" >NUL', varname, value)
end
end
local function portable_slash(path)
return path:gsub('\\', '/')
end
-- returns the batch command and arg to setup msvc compiler path.
-- or return 2 empty string (eg. '', '') if not found
local function get_msvc_env_setup_cmd(vcver, wsdkver, needs64)
-- 1. try visual studio command line tools
local vcdir = get_registry({
[[HKLM\Software\Wow6432Node\Microsoft\VisualStudio\]]..vcver..[[\Setup\VC:ProductDir]],
[[HKLM\Software\Microsoft\VisualStudio\]]..vcver..[[\Setup\VC:ProductDir]],
[[HKLM\Software\Wow6432Node\Microsoft\VCExpress\]]..vcver..[[\Setup\VS:ProductDir]],
[[HKLM\Software\Microsoft\VCExpress\]]..vcver..[[\Setup\VS:ProductDir]],
})
if vcdir then
-- 1.1. try vcvarsall.bat
local vcvarsall = vcdir .. 'vcvarsall.bat'
if exists(vcvarsall) then
return portable_slash(vcvarsall), needs64 and 'amd64' or 'x86'
end
-- 1.2. try vcvars32.bat / vcvars64.bat
local relative_path = needs64 and 'bin/amd64/vcvars64.bat' or 'bin/vcvars32.bat'
local full_path = vcdir .. relative_path
if exists(full_path) then
return portable_slash(full_path), ''
end
end
-- 2. try for Windows SDKs command line tools.
if wsdkver then
local wsdkdir = get_registry({
[[HKLM\Software\Microsoft\Microsoft SDKs\Windows\v]]..wsdkver..[[:InstallationFolder]],
[[HKLM\Software\Microsoft\Microsoft SDKs\Windows\v]]..wsdkver..[[:InstallationFolder]],
})
if wsdkdir then
local setenvcmd = wsdkdir..'Bin/SetEnv.cmd'
if exists(setenvcmd) then
return portable_slash(setenvcmd), needs64 and 'x64' or 'x86'
end
end
end
-- finally, we can't detect more, just don't setup the msvc compiler in luarocks.bat.
return '', ''
end
local function update_vcvars(file, vccmd, vcarg)
local content = read(file)
if not content then return end
local modified = content:gsub('(SET VCBAT=)[^\r\n]*', '%1'..vccmd):gsub('(SET VCARG=)[^\r\n]*', '%1'..vcarg)
if modified ~= content then
write(file, modified)
end
end
local function allowed_versions(home)
local h = io.popen(([[dir /B "%s\versions\*"]]):format(home))
local versions = {}
for v in h:lines() do
versions[v] = true
versions[#versions+1] = v
end
return versions
end
local function list(home)
io.stdout:write(' ', table.concat(allowed_versions(home), '\n '), '\n')
os.exit(0)
end
local function filter_path(s, new, fn)
local paths = {new}
if type(fn) == 'string' then
local regx = fn
fn = function(p) return (p:find(regx)) end
end
for p in s:gmatch('([^;]+)') do
p = trim_path(p)
if not fn(p) then
paths[#paths+1] = p
end
end
return table.concat(paths, ';')
end
local function update_path(sources, newpath, oldregx)
for source in sources:gmatch('([^:]+)') do
setenv(source, 'Path', filter_path(getenv(source, 'Path'), newpath, oldregx))
end
end
local function use(home, version)
local versions = allowed_versions(home)
if not versions[version] then
io.stderr:write(('invalid version: "%s"\n'):format(version))
io.stderr:write(('installed versions: \n "%s"\n'):format(table.concat(versions, '\n ')))
os.exit(1)
end
local bindir = home..[[\versions\]]..version
-- print[[1. update path in registry and current session]]
update_path('user:session', bindir, '\\LuaVM\\versions\\[^\\]+$')
-- print[[3. update install directory for lua bin scripts]]
local vars = loadvars(bindir)
relocate_bin_scripts(scan_path_related_files(bindir), vars.PREFIX, bindir:gsub('\\', '/'))
-- print[[4. update visual c++ compiler command for luarocks.]]
local vccmd, vcarg = get_msvc_env_setup_cmd(vars.VCVER, vars.WSDKVER, vars.CPUARCH:find('64') ~= nil)
update_vcvars(bindir..[[\luarocks.bat]], vccmd, vcarg)
end
local function migrate(mode, path)
if mode == 'install' then
update_path('user:session', path, '\\LuaVM$')
update_path('user:session', path..'\\externals\\bin', '\\LuaVM\\externals\\bin$')
elseif mode == 'remove' then
update_path('user:session', nil, '\\LuaVM$')
update_path('user:session', nil, '\\LuaVM\\externals\\bin$')
update_path('user:session', nil, '\\LuaVM\\versions\\[^\\]+$')
else
print('Usage: luavm migrate install')
print(' or: luavm migrate remove')
os.exit(1)
end
end
local function usage(code)
print [=[usage: luavm <command> [<args>]
The commands are:
use Use specified version of Lua.
list List all installed versions of Lua.
migrate Install or remove luavm in system PATH.
]=]
os.exit(code or 0)
end
local function main()
local home = arg[0]:match([[^([A-Z]:.+\LuaVM)\luavm.lua$]])
if not home then
error('Need to run luavm.lua with full path.')
os.exit(1)
end
if not arg[1] then usage() end
local commands = {
migrate = function() migrate(arg[2], home) end,
list = function() list(home) end,
use = function() use(home, arg[2]) end,
version = function() print(VERSION) end,
}
if not commands[arg[1]] then
error(('Unknown command %s.'):format(arg[1]))
os.exit(1)
end
commands[arg[1]]()
end
main()
|
TextInput = {}
TextInput.__index = TextInput
local INVALID_BOX_NOT_FOCUSED_OR_HOVER_FILL_COLOUR = { r = 1, g = 0.85, b = 0.95, a = 1 }
local BOX_NOT_FOCUSED_OR_HOVER_FILL_COLOUR = { r = 0.9, g = 0.95, b = 1, a = 1 }
local INVALID_BOX_FOCUSED_OR_HOVER_FILL_COLOUR = { r = 1, g = 0.95, b = 0.95, a = 1 }
local BOX_FOCUSED_OR_HOVER_FILL_COLOUR = { r = 0.95, g = 0.95, b = 1, a = 1 }
local BOX_OUTLINE_COLOUR = { r = 0, g = 0, b = 0, a = 1 }
local BOX_OUTLINE_COLOUR_INVALID = { r = 0.8, g = 0, b = 0.1, a = 1 }
local TEXT_COLOUR = { r = 0.2, g = 0.2, b = 0.2, a = 1 }
local INVALID_TEXT_COLOUR = { r = 0.3, g = 0.1, b = 0.1, a = 1 }
local PLACEHOLDER_COLOUR = { r = 0.2, g = 0.2, b = 0.2, a = 0.7 }
local BORDER_RADIUS = 5
local TEXT_PADDING_LEFT = 5
local TEXT_PADDING_TOP = 5
local TEXT_PADDING_DOWN = 5
local CARLITO_FONT_PATH = 'fonts/carlito.ttf'
local TEXT_FONT_SIZE = 14
local TEXT_FONT = love.graphics.newFont(CARLITO_FONT_PATH, TEXT_FONT_SIZE)
local INPUT_HEIGHT = TEXT_FONT_SIZE + TEXT_PADDING_TOP + TEXT_PADDING_DOWN
local BLINKER_INTERVAL = 0.5 -- [s]
local HOVER_CURSOR = love.mouse.getSystemCursor("ibeam")
local HOVER_CURSOR_HALF_WIDTH = 2
local function isKebabCase(value)
return string.find(value, "^[a-z0-9][-a-z0-9]*$") ~= nil
and string.find(value, "%-%-") == nil
and value:sub(#value, #value) ~= "-"
end
local function isNotEmpty(value)
return #value > 0
end
local function isPositiveNumber(value)
local asNumber = tonumber(value)
return asNumber ~= nil and asNumber > 0
end
local function isInteger(value)
local asNumber = tonumber(value)
return asNumber ~= nil and math.floor(asNumber) == asNumber
end
--- A simple single-line text input
-- be configured
-- @param width {int} - The width of the input
-- @param placeholder {string} - The text to display when the input is empty
-- @param initialValue {string} - The initial value
function TextInput:create(width, placeholder, initialValue, options)
options = options or {}
local this = {
x = 0,
y = 0,
width = width,
height = INPUT_HEIGHT,
value = nil,
text = nil,
placeholderText = placeholder and love.graphics.newText(TEXT_FONT, placeholder) or nil,
focusedSince = nil,
valid = true,
isHovered = false,
isValid = true,
validations = options.validations or {},
caretIndex = 0,
selectionFromIndex = 0,
outlineRadius = BORDER_RADIUS,
confirmHandlers = {},
}
setmetatable(this, self)
if options.kebabCase then
this.validations[#this.validations + 1] = isKebabCase
end
if options.nonEmpty then
this.validations[#this.validations + 1] = isNotEmpty
end
if options.positive then
this.validations[#this.validations + 1] = isPositiveNumber
end
if options.integer then
this.validations[#this.validations + 1] = isInteger
end
this:setValue(initialValue)
return this
end
--- Change the position of this element
-- @param x {number} The new X left position
-- @param y {number} The new Y top position
function TextInput:setPosition(x, y) self.x, self.y = x, y end
--- Get both the X and the Y position of this element
-- @returns {int}, {int}
function TextInput:getPosition() return self.x, self.y end
--- Change the size of this element
-- @param width {number} The new width
-- @param height {number} The new height
function TextInput:setSize(width, height) self.width, self.height = width, height end
--- Get the size of this element
-- @returns {int}, {int}
function TextInput:getSize() return self.width, self.height end
local function getClickedIndex(text, relativeMouseX)
relativeMouseX = relativeMouseX + HOVER_CURSOR_HALF_WIDTH
local from, to = 0, #text
local closestIndex, closestDistance, mid
while from <= to do
mid = math.floor((from + to) / 2)
local x = TEXT_FONT:getWidth(string.sub(text, 1, mid))
local distance = math.abs(relativeMouseX - x)
if closestIndex == nil or distance < closestDistance then
closestIndex, closestDistance = mid, distance
end
if relativeMouseX < x then to = mid - 1 else from = mid + 1 end
end
return closestIndex
end
function TextInput:onConfirm(handler)
self.confirmHandlers[#self.confirmHandlers + 1] = handler
end
--- LOVE update handler
function TextInput:update()
local mouseInfo = love.mouse.registerSolid(self)
if mouseInfo.dragStarted then
self.selectionFromIndex = getClickedIndex(self.value, mouseInfo.drag.fromX - self.x - TEXT_PADDING_LEFT)
end
if mouseInfo.drag then
self.caretIndex = getClickedIndex(self.value, mouseInfo.drag.toX - self.x - TEXT_PADDING_LEFT)
end
self.isFocused = love.keyboard.registerFocusable(self)
if self.isFocused then
-- Confirming
if love.keyboard.returnIsPressed then for _, handler in ipairs(self.confirmHandlers) do handler() end end
-- Typing
if #love.keyboard.input > 0 then
if self:hasSelectedText() then
self:deleteSelectedText()
end
self:setValue(string.sub(self.value, 1, self.caretIndex) ..
love.keyboard.input ..
string.sub(self.value, self.caretIndex + 1))
self.caretIndex = self.caretIndex + #love.keyboard.input
self.selectionFromIndex = self.caretIndex
end
-- Caret movement
if love.keyboard.keysPressed["left"] then
if love.keyboard.shiftIsDown then
self.caretIndex = math.max(self.caretIndex - 1, 0)
elseif self:hasSelectedText() then
self.caretIndex = math.min(self.caretIndex, self.selectionFromIndex)
self.selectionFromIndex = self.caretIndex
else
self.caretIndex = math.max(self.caretIndex - 1, 0)
self.selectionFromIndex = self.caretIndex
end
end
if love.keyboard.keysPressed["right"] then
if love.keyboard.shiftIsDown then
self.caretIndex = math.min(self.caretIndex + 1, #self.value)
elseif self:hasSelectedText() then
self.caretIndex = math.max(self.caretIndex, self.selectionFromIndex)
self.selectionFromIndex = self.caretIndex
else
self.caretIndex = math.min(self.caretIndex + 1, #self.value)
self.selectionFromIndex = self.caretIndex
end
end
if love.keyboard.keysPressed["up"] then
self.caretIndex = 0
if not love.keyboard.shiftIsDown then
self.selectionFromIndex = self.caretIndex
end
end
if love.keyboard.keysPressed["down"] then
self.caretIndex = #self.value
if not love.keyboard.shiftIsDown then
self.selectionFromIndex = self.caretIndex
end
end
if love.keyboard.keysPressed["a"] and love.keyboard.controlIsDown then
self.selectionFromIndex, self.caretIndex = 0, #self.value
end
-- Deletion
if love.keyboard.keysPressed["backspace"] then
if self:hasSelectedText() then
self:deleteSelectedText()
elseif self.caretIndex > 0 then
self:setValue(string.sub(self.value, 1, self.caretIndex - 1) .. string.sub(self.value, self.caretIndex + 1))
self.caretIndex = math.max(self.caretIndex - 1, 0)
self.selectionFromIndex = self.caretIndex
end
end
if love.keyboard.keysPressed["delete"] then
if self:hasSelectedText() then
self:deleteSelectedText()
elseif self.caretIndex < #self.value then
self:setValue(string.sub(self.value, 1, self.caretIndex) .. string.sub(self.value, self.caretIndex + 2))
end
end
end
self.isHovered = mouseInfo.isHovered
if self.isHovered then
love.mouse.cursor = HOVER_CURSOR
end
end
--- Returns whether there is any selected text (i.e. a non-zero-length selection).
-- @return {boolean}
function TextInput:hasSelectedText()
return self.caretIndex ~= self.selectionFromIndex
end
--- Deletes all text that is selected. If none is selected, nothing happens.
function TextInput:deleteSelectedText()
local selectionFrom = math.min(self.caretIndex, self.selectionFromIndex)
local selectionTo = math.max(self.caretIndex, self.selectionFromIndex)
self:setValue(string.sub(self.value, 1, selectionFrom) .. string.sub(self.value, selectionTo + 1))
self.caretIndex, self.selectionFromIndex = selectionFrom, selectionFrom
end
function TextInput:setValue(newValue)
self.value = newValue
self.text = love.graphics.newText(TEXT_FONT, newValue)
for _, validation in ipairs(self.validations) do
self.isValid = validation(newValue)
if not self.isValid then
break
end
end
end
local function setColour(colour)
if not colour then
return false
end
love.graphics.setColor(colour.r, colour.g, colour.b, colour.a == nil and 1 or colour.a)
return true
end
function TextInput:onForcedFocus()
self.selectionFromIndex, self.caretIndex = 0, #self.value
end
function TextInput:onTabFocus()
self.selectionFromIndex, self.caretIndex = 0, #self.value
end
--- LOVE draw handler
function TextInput:draw()
love.graphics.drawFocusOutline(self)
local backgroundColour = (self.isFocused or self.isHovered)
and (self.isValid and BOX_FOCUSED_OR_HOVER_FILL_COLOUR or INVALID_BOX_FOCUSED_OR_HOVER_FILL_COLOUR)
or (self.isValid and BOX_NOT_FOCUSED_OR_HOVER_FILL_COLOUR or INVALID_BOX_NOT_FOCUSED_OR_HOVER_FILL_COLOUR);
setColour(backgroundColour)
love.graphics.rectangle("fill", self.x, self.y, self.width, self.height, BORDER_RADIUS, BORDER_RADIUS)
if self.isFocused and self.selectionFromIndex ~= self.caretIndex then
local x1 = self.x + TEXT_PADDING_LEFT + TEXT_FONT:getWidth(string.sub(self.value, 1, self.caretIndex))
local x2 = self.x + TEXT_PADDING_LEFT + TEXT_FONT:getWidth(string.sub(self.value, 1, self.selectionFromIndex))
local xFrom, xTo = math.min(x1, x2), math.max(x1, x2)
local topY = self.y + TEXT_PADDING_TOP
love.graphics.setColor(0.2, 0.6, 1, 0.5)
love.graphics.rectangle("fill", xFrom, topY, xTo - xFrom, TEXT_FONT_SIZE)
love.graphics.reset()
end
if self.value and #self.value > 0 then
setColour(self.isValid and TEXT_COLOUR or INVALID_TEXT_COLOUR)
love.graphics.draw(self.text, self.x + TEXT_PADDING_LEFT, self.y + TEXT_PADDING_TOP)
elseif self.placeholderText then
setColour(PLACEHOLDER_COLOUR)
love.graphics.draw(self.placeholderText, self.x + TEXT_PADDING_LEFT, self.y + TEXT_PADDING_TOP)
end
if self.isFocused and
math.floor((love.timer.getTime() - love.keyboard.focusedSince) / BLINKER_INTERVAL) % 2 == 0 then
setColour(TEXT_COLOUR)
local x = self.x + TEXT_PADDING_LEFT + TEXT_FONT:getWidth(string.sub(self.value, 1, self.caretIndex))
local topY = self.y + TEXT_PADDING_TOP
love.graphics.line(x, topY, x, topY + TEXT_FONT_SIZE)
end
local outlineColour = self.isValid and BOX_OUTLINE_COLOUR or BOX_OUTLINE_COLOUR_INVALID
love.graphics.setColor(outlineColour.r, outlineColour.g, outlineColour.b, outlineColour.a)
love.graphics.rectangle("line", self.x, self.y, self.width, self.height, BORDER_RADIUS, BORDER_RADIUS)
love.graphics.reset()
end
|
Citizen.CreateThread(function()
while true do
RemoveWeaponDrops()
Citizen.Wait(1000)
end
end)
function RemoveWeaponDrops()
local pickupList = {`PICKUP_AMMO_BULLET_MP`,`PICKUP_AMMO_FIREWORK`,`PICKUP_AMMO_FLAREGUN`,`PICKUP_AMMO_GRENADELAUNCHER`,`PICKUP_AMMO_GRENADELAUNCHER_MP`,`PICKUP_AMMO_HOMINGLAUNCHER`,`PICKUP_AMMO_MG`,`PICKUP_AMMO_MINIGUN`,`PICKUP_AMMO_MISSILE_MP`,`PICKUP_AMMO_PISTOL`,`PICKUP_AMMO_RIFLE`,`PICKUP_AMMO_RPG`,`PICKUP_AMMO_SHOTGUN`,`PICKUP_AMMO_SMG`,`PICKUP_AMMO_SNIPER`,`PICKUP_ARMOUR_STANDARD`,`PICKUP_CAMERA`,`PICKUP_CUSTOM_SCRIPT`,`PICKUP_GANG_ATTACK_MONEY`,`PICKUP_HEALTH_SNACK`,`PICKUP_HEALTH_STANDARD`,`PICKUP_MONEY_CASE`,`PICKUP_MONEY_DEP_BAG`,`PICKUP_MONEY_MED_BAG`,`PICKUP_MONEY_PAPER_BAG`,`PICKUP_MONEY_PURSE`,`PICKUP_MONEY_SECURITY_CASE`,`PICKUP_MONEY_VARIABLE`,`PICKUP_MONEY_WALLET`,`PICKUP_PARACHUTE`,`PICKUP_PORTABLE_CRATE_FIXED_INCAR`,`PICKUP_PORTABLE_CRATE_UNFIXED`,`PICKUP_PORTABLE_CRATE_UNFIXED_INCAR`,`PICKUP_PORTABLE_CRATE_UNFIXED_INCAR_SMALL`,`PICKUP_PORTABLE_CRATE_UNFIXED_LOW_GLOW`,`PICKUP_PORTABLE_DLC_VEHICLE_PACKAGE`,`PICKUP_PORTABLE_PACKAGE`,`PICKUP_SUBMARINE`,`PICKUP_VEHICLE_ARMOUR_STANDARD`,`PICKUP_VEHICLE_CUSTOM_SCRIPT`,`PICKUP_VEHICLE_CUSTOM_SCRIPT_LOW_GLOW`,`PICKUP_VEHICLE_HEALTH_STANDARD`,`PICKUP_VEHICLE_HEALTH_STANDARD_LOW_GLOW`,`PICKUP_VEHICLE_MONEY_VARIABLE`,`PICKUP_VEHICLE_WEAPON_APPISTOL`,`PICKUP_VEHICLE_WEAPON_ASSAULTSMG`,`PICKUP_VEHICLE_WEAPON_COMBATPISTOL`,`PICKUP_VEHICLE_WEAPON_GRENADE`,`PICKUP_VEHICLE_WEAPON_MICROSMG`,`PICKUP_VEHICLE_WEAPON_MOLOTOV`,`PICKUP_VEHICLE_WEAPON_PISTOL`,`PICKUP_VEHICLE_WEAPON_PISTOL50`,`PICKUP_VEHICLE_WEAPON_SAWNOFF`,`PICKUP_VEHICLE_WEAPON_SMG`,`PICKUP_VEHICLE_WEAPON_SMOKEGRENADE`,`PICKUP_VEHICLE_WEAPON_STICKYBOMB`,`PICKUP_WEAPON_ADVANCEDRIFLE`,`PICKUP_WEAPON_APPISTOL`,`PICKUP_WEAPON_ASSAULTRIFLE`,`PICKUP_WEAPON_ASSAULTSHOTGUN`,`PICKUP_WEAPON_ASSAULTSMG`,`PICKUP_WEAPON_AUTOSHOTGUN`,`PICKUP_WEAPON_BAT`,`PICKUP_WEAPON_BATTLEAXE`,`PICKUP_WEAPON_BOTTLE`,`PICKUP_WEAPON_BULLPUPRIFLE`,`PICKUP_WEAPON_BULLPUPSHOTGUN`,`PICKUP_WEAPON_CARBINERIFLE`,`PICKUP_WEAPON_COMBATMG`,`PICKUP_WEAPON_COMBATPDW`,`PICKUP_WEAPON_COMBATPISTOL`,`PICKUP_WEAPON_COMPACTLAUNCHER`,`PICKUP_WEAPON_COMPACTRIFLE`,`PICKUP_WEAPON_CROWBAR`,`PICKUP_WEAPON_DAGGER`,`PICKUP_WEAPON_DBSHOTGUN`,`PICKUP_WEAPON_FIREWORK`,`PICKUP_WEAPON_FLAREGUN`,`PICKUP_WEAPON_FLASHLIGHT`,`PICKUP_WEAPON_GRENADE`,`PICKUP_WEAPON_GRENADELAUNCHER`,`PICKUP_WEAPON_GUSENBERG`,`PICKUP_WEAPON_GOLFCLUB`,`PICKUP_WEAPON_HAMMER`,`PICKUP_WEAPON_HATCHET`,`PICKUP_WEAPON_HEAVYPISTOL`,`PICKUP_WEAPON_HEAVYSHOTGUN`,`PICKUP_WEAPON_HEAVYSNIPER`,`PICKUP_WEAPON_HOMINGLAUNCHER`,`PICKUP_WEAPON_KNIFE`,`PICKUP_WEAPON_KNUCKLE`,`PICKUP_WEAPON_MACHETE`,`PICKUP_WEAPON_MACHINEPISTOL`,`PICKUP_WEAPON_MARKSMANPISTOL`,`PICKUP_WEAPON_MARKSMANRIFLE`,`PICKUP_WEAPON_MG`,`PICKUP_WEAPON_MICROSMG`,`PICKUP_WEAPON_MINIGUN`,`PICKUP_WEAPON_MINISMG`,`PICKUP_WEAPON_MOLOTOV`,`PICKUP_WEAPON_MUSKET`,`PICKUP_WEAPON_NIGHTSTICK`,`PICKUP_WEAPON_PETROLCAN`,`PICKUP_WEAPON_PIPEBOMB`,`PICKUP_WEAPON_PISTOL`,`PICKUP_WEAPON_PISTOL50`,`PICKUP_WEAPON_POOLCUE`,`PICKUP_WEAPON_PROXMINE`,`PICKUP_WEAPON_PUMPSHOTGUN`,`PICKUP_WEAPON_RAILGUN`,`PICKUP_WEAPON_REVOLVER`,`PICKUP_WEAPON_RPG`,`PICKUP_WEAPON_SAWNOFFSHOTGUN`,`PICKUP_WEAPON_SMG`,`PICKUP_WEAPON_SMOKEGRENADE`,`PICKUP_WEAPON_SNIPERRIFLE`,`PICKUP_WEAPON_SNSPISTOL`,`PICKUP_WEAPON_SPECIALCARBINE`,`PICKUP_WEAPON_STICKYBOMB`,`PICKUP_WEAPON_STUNGUN`,`PICKUP_WEAPON_SWITCHBLADE`,`PICKUP_WEAPON_VINTAGEPISTOL`,`PICKUP_WEAPON_WRENCH`}
local PlayerPed = PlayerPedId()
local pedPos = GetEntityCoords(PlayerPed, false)
for a = 1, #pickupList do
if IsPickupWithinRadius(pickupList[a], pedPos.x, pedPos.y, pedPos.z, 200.0) then
RemoveAllPickupsOfType(pickupList[a])
end
end
end
|
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
return true
end
player:setStorageValue(Storage.QueenOfBansheesQuest.LastSeal, 1)
player:teleportTo(Position(32269, 31853, 15))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end
|
function bringDonorAnnouncement(plr, amount, de)
triggerClientEvent(root, "AURanndonor.drawDonorDx", root, plr, tostring(amount), de)
--local _, speech, URL = convertTextToSpeech(de, getPlayerFromName("[AUR]Curt"), "en")
end
function doTestDonation (plr)
if (getTeamName(getPlayerTeam(plr)) == "Staff") then
bringDonorAnnouncement(getPlayerName(plr), 30, "This is a test donation for dollar.")
end
end
addCommandHandler("dotestdonation", doTestDonation)
function skipdonatestaff (plr)
if (getTeamName(getPlayerTeam(plr)) == "Staff") then
triggerClientEvent(root, "AURanndonor.skipDonation", root, true)
end
end
addCommandHandler("skipdonatestaff", skipdonatestaff)
function demospeech (plr)
triggerClientEvent(plr, "AURanndonor.drawDonorDx", plr, "AuroraRPG", tostring(1), "This is a test donation for dollar and this is a demo speech for announce speech item at aurorarpg dot com slash v i p.")
end
addCommandHandler("demospeech", demospeech)
|
-- Minetest 0.5 mod: bones
-- See README.txt for licensing and other information.
--REVISED 20151117 by maikerumine for adding bones to inventory after punch
bones = {}
local share_bones_time = (tonumber(minetest.setting_get("share_bones_time")) or 1800)
bones.bones_formspec =
"size[14,9]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"list[current_name;main;0,0.3;14,4;]"..
"list[current_player;main;3,4.85;8,1;]"..
"list[current_player;main;3,6.08;8,3;8]"..
"listring[current_name;main]"..
"listring[current_player;main]" ..
default.get_hotbar_bg(3,4.85)
minetest.register_node("bones:bones", {
description = "Bones",
tiles = {
"bones_top.png",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {cracky = 2, oddly_breakable_by_hand = 2},
stack_max = 999,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.5},
dug = {name="default_gravel_footstep", gain=1.0},
}),
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
return inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
return stack:get_count()
end,
on_punch = function(pos, node, player)
-- only owner can punch bones to directly add to inventory
local owner = minetest.get_meta(pos):get_string("owner")
if owner ~= player:get_player_name() then
return
end
local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory()
for i=1, inv:get_size("main") do
local stk = inv:get_stack("main", i)
if player_inv:room_for_item("main", stk) then
inv:set_stack("main", i, nil)
player_inv:add_item("main", stk)
end
end
if inv:is_empty("main") then
minetest.remove_node(pos)
end
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
if meta:get_inventory():is_empty("main") then
minetest.remove_node(pos)
return
end
local time = meta:get_int("time") + elapsed
if time < share_bones_time then
meta:set_int("time", time)
return true
else
minetest.remove_node(pos)
end
end,
on_blast = function(pos)
local drops = {}
default.get_inventory_drops(pos, "main", drops)
drops[#drops+1] = "bones:bones"
minetest.remove_node(pos)
return drops
end,
})
local find_best_node = function(pos)
local nodes = minetest.find_nodes_in_area(
{x=pos.x-2,y=pos.y, z=pos.z-2},
{x=pos.x+2,y=pos.y+2, z=pos.z+2},
{"air"}
)
if #nodes > 0 then
return nodes[1]
end
nodes = minetest.find_nodes_in_area(
{x=pos.x-2,y=pos.y, z=pos.z-2},
{x=pos.x+2,y=pos.y+2, z=pos.z+2},
{"group:liquid"}
)
if #nodes > 0 then
return nodes[1]
end
nodes = minetest.find_nodes_in_area(
{x=pos.x-2,y=pos.y, z=pos.z-2},
{x=pos.x+2,y=pos.y+2, z=pos.z+2},
{"group:leaves", "group:plant", "group:flower"}
)
if #nodes > 0 then
return nodes[1]
end
return nil
end
minetest.register_on_dieplayer(function(player)
if minetest.setting_getbool("creative_mode") or not player then
return
end
local player_name = player:get_player_name()
if player_name == "" then return end
local pos = player:getpos()
pos.y = math.floor(pos.y + 0.5)
minetest.chat_send_player(player_name, 'Died at '..math.floor(pos.x)..','..math.floor(pos.y)..','..math.floor(pos.z))
local bones_pos = nil
local node = minetest.get_node_or_nil(pos)
if node and node.name == "air" then
bones_pos = pos
else
bones_pos = find_best_node(pos)
end
if not bones_pos then return end -- no pos to place bones
minetest.set_node(bones_pos, {name="bones:bones"})
local meta = minetest.get_meta(bones_pos)
meta:set_string("formspec", bones.bones_formspec)
meta:set_string("owner", player_name)
meta:set_string("infotext", player_name.."'s bones")
local time = os.date("*t")
meta:set_int("time", 0)
local bones_inv = meta:get_inventory()
bones_inv:set_size("main", 14*4)
local player_inv = player:get_inventory()
-- main inventory
for i=1, player_inv:get_size("main") do
local stack = player_inv:get_stack("main", i)
if stack then
local stack_name = stack:get_name()
if not pclasses.data.reserved_items[stack_name] or
not pclasses.api.util.can_have_item(player_name, stack_name) then
bones_inv:add_item("main", stack)
player_inv:set_stack("main", i, nil)
end
end
end
-- craft inventory
for i=1, player_inv:get_size("craft") do
local stack = player_inv:get_stack("craft", i)
if stack then
bones_inv:add_item("main", stack)
player_inv:set_stack("craft", i, nil)
end
end
-- unified_inventory bags
if minetest.get_modpath("unified_inventory") then
for n = 1, 4 do
local stack = unified_inventory.extract_bag(player, n)
if stack then
bones_inv:add_item("main", stack)
end
end
end
--3d_armor
if minetest.get_modpath("3d_armor") then
local name, player_inv, armor_inv, pos = armor:get_valid_player(player, "[on_dieplayer]")
if name then
for i=1, player_inv:get_size("armor") do
local stack = armor_inv:get_stack("armor", i)
if stack:get_count() > 0 and (not pclasses.data.reserved_items[stack:get_name()] or
not pclasses.api.util.can_have_item(name, stack:get_name())) then
bones_inv:add_item("main", stack)
armor_inv:set_stack("armor", i, nil)
player_inv:set_stack("armor", i, nil)
end
end
armor:set_player_armor(player)
end
end
minetest.chat_send_player(player_name, 'Your bones is at '..math.floor(bones_pos.x)..','..math.floor(bones_pos.y)..','..math.floor(bones_pos.z))
minetest.get_node_timer(bones_pos):start(10)
end)
|
local Stream = require("stream")
local mt = {}
function mt:__tostring()
return string.format([=[
ID: %i
CLASS NAME: %s
COUNT: %i
FORMAT: %s
REFERENTS: [ %s ]]=],
self.id, self.name, self.count, self.format == 0 and "NORMAL" or "SERVICE", table.concat(self.referents, ", "))
end
local chunk = {}
function chunk.decode(chunk)
local stream = Stream(chunk.data)
local classId = stream.readLEUInt32()
local className = stream.readString()
local format = stream.readByte()
local instanceCount = stream.readLEUInt32()
local referentArray = stream.readReferents(instanceCount)
if format ~= 0 then
assert(stream.readSetLengthString(instanceCount) == string.rep("\1", instanceCount), "malformed file: INST chunk has invalid service marker")
end
return setmetatable({
id = classId,
name = className,
format = format,
count = instanceCount,
referents = referentArray,
_chunk = chunk
}, mt)
end
function chunk.encode(id, className, refTable)
print(string.format("INST #%i Name: %s Refs: %i", id, className, #refTable))
local stream = Stream()
stream.writeLEUInt32(id) -- INST id
stream.writeString(className) -- class
stream.writeByte(0) -- Service marker
stream.writeLEUInt32(#refTable) -- Ref array length
stream.writeReferents(refTable) -- Ref array
--todo service marker
return stream
end
return chunk
|
local CalcEquipAdd = {}
function CalcEquipAdd.calc(level)
return 0.01 * level
end
function CalcEquipAdd.calcChance(level)
if level > 60 then level = 60 end
local min = 1
local max = 60
local ret = 1 - (level - min) / (max - min) * (1 - 0.2)
return ret
end
function CalcEquipAdd.calcCost(level)
if level > 60 then level = 60 end
local min = 1
local max = 60
local ret = (level - min) / (max - min) * (5000 - 30) + 30
return ret
end
local names = {
{ '木手斧' },
{ '冷铁头盔' },
{ '紫藤甲' },
{ '紫藤护足' },
}
function CalcEquipAdd.getEquipName(index,level)
return names[index][1]
end
local attributes = {
'伤害加成',
'物防加成',
'魔防加成',
'闪避加成',
}
function CalcEquipAdd.getEquipAddName(index)
return attributes[index]
end
function CalcEquipAdd.getEquipPath(level)
local index = math.floor(level / 5)
if index > 7 then
index = 7
end
return index
end
return CalcEquipAdd
|
-----------------------------------------------------------------------------------------------
-- Client Lua Script for ChatFontSize
-----------------------------------------------------------------------------------------------
require "Window"
require "ChatSystemLib"
-----------------------------------------------------------------------------------------------
-- ChatFontSize Module Definition
-----------------------------------------------------------------------------------------------
local ChatFontSize = {}
-----------------------------------------------------------------------------------------------
-- Constants
-----------------------------------------------------------------------------------------------
-- e.g. local kiExampleVariableMax = 999
local ktFontResourceNames = {
[1] = "CRB_InterfaceSmall",
[2] = "CRB_InterfaceMedium",
[3] = "CRB_InterfaceLarge",
[12] = "CRB_Interface12",
[14] = "CRB_Interface14",
[16] = "CRB_Interface16",
}
local ktFontNames = {
[1] = "Small",
[2] = "Medium",
[3] = "Large",
[12] = "12",
[14] = "14",
[16] = "16",
}
-- Bottom anchor coordinate of the input window
local kBottomOffsetDefault = -5
local kBottomOffsetModified = 0
-- Top anchor coordinate of the input window
local kTopOffsetDefault = -25
local kTopOffsetModified = -30
-----------------------------------------------------------------------------------------------
-- Initialization
-----------------------------------------------------------------------------------------------
function ChatFontSize:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
-- initialize variables here
o.nCurrentFontSize = 2 -- Medium is the default
o.bSetInputSize = false -- Whether or not to set the input font size equal to output
o.bSetSizeFromTimer = false
o.strChatAddon = "ChatLog"
--o.codeMarker = ""
return o
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize Init
-----------------------------------------------------------------------------------------------
function ChatFontSize:Init()
local bHasConfigureFunction = false
local strConfigureButtonText = ""
local tDependencies = {
"ChatLog",
-- "UnitOrPackageName",
}
Apollo.RegisterAddon(self, bHasConfigureFunction, strConfigureButtonText, tDependencies)
return true
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize OnLoad
-----------------------------------------------------------------------------------------------
function ChatFontSize:OnLoad()
-- Register handlers for events, slash commands and timer, etc.
-- load our form file
Apollo.RegisterSlashCommand("fontsize", "OnFontSize", self)
self.xmlDoc = XmlDoc.CreateFromFile("ChatFontSize.xml")
self.xmlDoc:RegisterCallback("OnDocLoaded", self)
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize OnSave
-----------------------------------------------------------------------------------------------
function ChatFontSize:OnSave(eType)
if eType ~= GameLib.CodeEnumAddonSaveLevel.Character then return nil end
local tSave =
{
nCurrentFontSize = self.nCurrentFontSize,
bSetInputSize = self.bSetInputSize,
nVersion = 1,
}
return tSave
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize OnRestore
-----------------------------------------------------------------------------------------------
function ChatFontSize:OnRestore(eType, tSavedData)
if eType ~= GameLib.CodeEnumAddonSaveLevel.Character then return nil end
if tSavedData and tSavedData.nVersion == 1 then
--self.codeMarker = self.codeMarker .. ", OnRestore"
if tSavedData.nCurrentFontSize ~= nil then
self.nCurrentFontSize = tSavedData.nCurrentFontSize
end
if tSavedData.bSetInputSize ~= nil then
self.bSetInputSize = tSavedData.bSetInputSize
end
self:SetFontSize(self.nCurrentFontSize)
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize OnDocLoaded
-----------------------------------------------------------------------------------------------
function ChatFontSize:OnDocLoaded()
if self.xmlDoc ~= nil and self.xmlDoc:IsLoaded() then
self.wndFontData = Apollo.LoadForm(self.xmlDoc, "FontData", self, self)
self:ReplaceChatLogOnConfigure()
-- if the xmlDoc is no longer needed, you should set it to nil
-- self.xmlDoc = nil
-- Register handlers for events, slash commands and timer, etc.
-- e.g. Apollo.RegisterEventHandler("KeyDown", "OnKeyDown", self)
-- Set a timer to set the font when the ChatLog addon is finished loading
self.timer = ApolloTimer.Create(1.0, true, "OnTimer", self)
self:SetFontSize(self.nCurrentFontSize)
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize OnTimer
-----------------------------------------------------------------------------------------------
function ChatFontSize:OnTimer()
local chatAddon = Apollo.GetAddon(self.strChatAddon)
if self.bSetSizeFromTimer == true then
if chatAddon.wndChatOptions ~= nil then
--Print("OnTimer: Setting font size from timer to font size " .. tostring(self.nCurrentFontSize))
self:SetFontSize(self.nCurrentFontSize)
self.bSetSizeFromTimer = false
end
else
-- Once we can get the chatlog window, we don't need the timer
if chatAddon.wndChatOptions ~= nil then
--Print("OnTimer: Deleting timer, chatAddon is loaded")
self.timer = nil
end
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize Functions
-----------------------------------------------------------------------------------------------
-- Define general functions here
-----------------------------------------------------------------------------------------------
-- ChatFontSize ReplaceChatLogOnConfigure
-----------------------------------------------------------------------------------------------
function ChatFontSize:ReplaceChatLogOnConfigure()
-- Replace the ChatLog:OnConfigure routine with ours
local chatAddon = Apollo.GetAddon(self.strChatAddon)
self.ChatLogOnConfigure = chatAddon.OnConfigure
chatAddon.OnConfigure = function(...)
if self.wndFontSizeContainer == nil then
-- Load our font selector form
self.wndFontSizeContainer = Apollo.LoadForm(self.xmlDoc, "FontSizeContainer", chatAddon.wndChatOptions:FindChild("ChatOptionsContent"), self)
-- Hide the default font size radio buttons
chatAddon.wndChatOptions:FindChild("ChatOptionsContent:FontSizeSmall"):Show(false)
chatAddon.wndChatOptions:FindChild("ChatOptionsContent:FontSizeMedium"):Show(false)
chatAddon.wndChatOptions:FindChild("ChatOptionsContent:FontSizeLarge"):Show(false)
-- Display it
self.wndFontSizeContainer:Show(true)
end
-- Set the button text to the current font size
self:UpdateFontButtonText()
-- Make sure the button isn't checked
self.wndFontSizeContainer:FindChild("OutputSizeButton"):SetCheck(false)
-- Set the "input matches output" button to the right state
self.wndFontSizeContainer:FindChild("InputSizeButton"):SetCheck(self.bSetInputSize)
-- Call the original OnConfigure
self.ChatLogOnConfigure(...)
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize UpdateFontButtonText
-----------------------------------------------------------------------------------------------
function ChatFontSize:UpdateFontButtonText()
if self.wndFontSizeContainer ~= nil then
local outputSizeButton = self.wndFontSizeContainer:FindChild("OutputSizeButton")
outputSizeButton:SetText(self:GetCurrentFontStr())
self.wndFontSizeContainer:Show(true)
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize GetCurrentFontStr
-----------------------------------------------------------------------------------------------
function ChatFontSize:GetCurrentFontStr()
local chatAddon = Apollo.GetAddon(self.strChatAddon)
-- 1..3 are the defaults for "Small", "Medium", and "Large"
if self.nCurrentFontSize == 1 then
return chatAddon.wndChatOptions:FindChild("ChatOptionsContent:FontSizeSmall"):GetText()
elseif self.nCurrentFontSize == 2 then
return chatAddon.wndChatOptions:FindChild("ChatOptionsContent:FontSizeMedium"):GetText()
elseif self.nCurrentFontSize == 3 then
return chatAddon.wndChatOptions:FindChild("ChatOptionsContent:FontSizeLarge"):GetText()
else
-- The remainder are our custom sizes
return tostring(self.nCurrentFontSize)
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize OnFontSize
-----------------------------------------------------------------------------------------------
function ChatFontSize:OnFontSize(strCmd, strArg)
local size = tonumber(strArg)
if size == nil and strArg ~= "small" and strArg ~= "medium" and strArg ~= "large" then
self:DisplayHelp()
return
end
if size == nil then
-- Small, Medium, or Large
local newSize = 0
if strArg == "small" then
newSize = 1
elseif strArg == "medium" then
newSize = 2
else -- "large"
newSize = 3
end
self:SetFontSize(newSize)
elseif size == 12 or size == 14 or size == 16 then
self:SetFontSize(size)
else
-- Invalid size
self:DisplayHelp()
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize SetFontSize
-----------------------------------------------------------------------------------------------
function ChatFontSize:SetFontSize(size)
--self.codeMarker = self.codeMarker .. ", SetFontSize(" .. tostring(self.nCurrentFontSize) .. "->" .. size .. ")"
local bChangedFontSize = self.nCurrentFontSize ~= size
self.nCurrentFontSize = size
local chatAddon = Apollo.GetAddon(self.strChatAddon)
if not chatAddon then
--self.codeMarker = "SetFontSize: Failed to get addon " .. self.strChatAddon
return
end
if chatAddon.wndChatOptions == nil then
-- Try again from the timer (let chatAddon have a chance to load)
self.bSetSizeFromTimer = true
return
end
if size >= 1 and size <= 3 then
local wndChatOptionsContent = chatAddon.wndChatOptions:FindChild("ChatOptionsContent")
local wndFontControl = nil
if size == 1 then
wndFontControl = wndChatOptionsContent:FindChild("FontSizeSmall")
elseif size == 2 then
wndFontControl = wndChatOptionsContent:FindChild("FontSizeMedium")
else
wndFontControl = wndChatOptionsContent:FindChild("FontSizeLarge")
end
chatAddon:OnFontSizeOption(wndFontControl, wndFontControl)
else
local tFont = {
strNormal = "CRB_Interface" .. size,
strAlien = "CRB_AlienLarge", -- Largest alien font available
strRP = "CRB_Interface" .. size .. "_I",
}
self.wndFontData:SetData(tFont)
chatAddon:OnFontSizeOption(self.wndFontData, self.wndFontData)
end
-- Update the button text
self:UpdateFontButtonText()
-- Adjust the input font size as appropriate
self:UpdateInputFontSize(chatAddon, size)
if bChangedFontSize then
ChatSystemLib.PostOnChannel(ChatSystemLib.ChatChannel_Command, "Way to go, cupcake! You're at font size: " .. ktFontNames[self.nCurrentFontSize])
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize UpdateInputFontSize
-----------------------------------------------------------------------------------------------
function ChatFontSize:UpdateInputFontSize( chatAddon, size )
if chatAddon == nil or chatAddon.tChatWindows == nil then return end
-- If input size is set to output size, adjust the font
-- in all the input controls, too.
for idx, wnd in ipairs(chatAddon.tChatWindows) do
local w = wnd:FindChild("Input")
if w ~= nil then
local offsets = {w:GetAnchorOffsets()}
if self.bSetInputSize then
w:SetFont(ktFontResourceNames[size])
-- Adjust the height of the input box for larger fonts
offsets[2] = (size == 14 or size == 16) and kTopOffsetModified or kTopOffsetDefault
offsets[4] = (size == 14 or size == 16) and kBottomOffsetModified or kBottomOffsetDefault
else
w:SetFont(ktFontResourceNames[2]) -- Medium, default
offsets[2] = kTopOffsetDefault
offsets[4] = kBottomOffsetDefault
end
w:SetAnchorOffsets(offsets[1], offsets[2], offsets[3], offsets[4])
end
end
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize DisplayHelp
-----------------------------------------------------------------------------------------------
function ChatFontSize:DisplayHelp()
ChatSystemLib.PostOnChannel(ChatSystemLib.ChatChannel_Command, "ChatFontSize usage: /fontsize [small|medium|large|12|14|16]")
end
---------------------------------------------------------------------------------------------------
-- ChatFontSize OnOutputSizeDropdownButton
---------------------------------------------------------------------------------------------------
function ChatFontSize:OnOutputSizeDropdownButton( wndHandler, wndControl, eMouseButton )
local strNewFontSize = string.match(wndControl:GetName(), '%d+')
local nNewFontSize = tonumber(strNewFontSize)
self:SetFontSize(nNewFontSize)
-- Hide the flyout window
self.wndOutputSizeDropdown:Show(false)
self.wndFontSizeContainer:FindChild("OutputSizeButton"):SetCheck(false)
end
---------------------------------------------------------------------------------------------------
-- ChatFontSize ToggleOutputSizeDropdown
---------------------------------------------------------------------------------------------------
function ChatFontSize:ToggleOutputSizeDropdown( wndHandler, wndControl, eMouseButton )
-- Toggle the drop-down
self.wndOutputSizeDropdown = self.wndFontSizeContainer:FindChild("OutputSizeDropdown")
local isVisible = self.wndOutputSizeDropdown:IsVisible()
self.wndOutputSizeDropdown:Show(not isVisible)
wndControl:SetCheck(not isVisible)
end
---------------------------------------------------------------------------------------------------
-- ChatFontSize OnInputSizeButton
---------------------------------------------------------------------------------------------------
function ChatFontSize:OnInputSizeButton( wndHandler, wndControl, eMouseButton )
if wndHandler ~= wndControl then return end
self.bSetInputSize = not self.bSetInputSize
wndControl:SetCheck(self.bSetInputSize)
self:SetFontSize(self.nCurrentFontSize)
end
-----------------------------------------------------------------------------------------------
-- ChatFontSize Instance
-----------------------------------------------------------------------------------------------
local ChatFontSizeInst = ChatFontSize:new()
if ChatFontSizeInst:Init() == false then
ChatFontSizeInst = nil
end
|
require "uri-test"
local URI = require "uri"
local Util = require "uri._util"
local testcase = TestCase("Test uri.urn.isbn")
local have_isbn_module = Util.attempt_require("isbn")
function testcase:test_isbn ()
-- Example from RFC 2288
local u = URI:new("URN:ISBN:0-395-36341-1")
is(have_isbn_module and "urn:isbn:0-395-36341-1" or "urn:isbn:0395363411",
u:uri())
is("urn", u:scheme())
is("isbn", u:nid())
is(have_isbn_module and "0-395-36341-1" or "0395363411", u:nss())
is("0395363411", u:isbn_digits())
u = URI:new("URN:ISBN:0395363411")
is(have_isbn_module and "urn:isbn:0-395-36341-1" or "urn:isbn:0395363411",
u:uri())
is("urn", u:scheme())
is("isbn", u:nid())
is(have_isbn_module and "0-395-36341-1" or "0395363411", u:nss())
is("0395363411", u:isbn_digits())
if have_isbn_module then
local isbn = u:isbn()
assert_table(isbn)
is("0-395-36341-1", tostring(isbn))
is("0", isbn:group_code())
is("395", isbn:publisher_code())
is("978-0-395-36341-6", tostring(isbn:as_isbn13()))
end
assert_true(URI.eq("urn:isbn:088730866x", "URN:ISBN:0-88-73-08-66-X"))
end
function testcase:test_set_nss ()
local uri = assert(URI:new("urn:isbn:039-53-63411"))
is(have_isbn_module and "0-395-36341-1" or "0395363411",
uri:nss("088-7308-66x"))
is(have_isbn_module and "urn:isbn:0-88730-866-X" or "urn:isbn:088730866X",
tostring(uri))
is(have_isbn_module and "0-88730-866-X" or "088730866X", uri:nss())
end
function testcase:test_set_bad_nss ()
local uri = assert(URI:new("urn:ISBN:039-53-63411"))
assert_error("set NSS to non-string value", function () uri:nss({}) end)
assert_error("set NSS to empty", function () uri:nss("") end)
assert_error("set NSS to wrong length", function () uri:nss("123") end)
-- None of that should have had any affect
is(have_isbn_module and "urn:isbn:0-395-36341-1" or "urn:isbn:0395363411",
tostring(uri))
is(have_isbn_module and "0-395-36341-1" or "0395363411", uri:nss())
is("0395363411", uri:isbn_digits())
is("uri.urn.isbn", uri._NAME)
end
function testcase:test_set_path ()
local uri = assert(URI:new("urn:ISBN:039-53-63411"))
is(have_isbn_module and "isbn:0-395-36341-1" or "isbn:0395363411",
uri:path("ISbn:088-73-0866x"))
is(have_isbn_module and "urn:isbn:0-88730-866-X" or "urn:isbn:088730866X",
tostring(uri))
assert_error("bad path", function () uri:path("isbn:1234567") end)
is(have_isbn_module and "urn:isbn:0-88730-866-X" or "urn:isbn:088730866X",
tostring(uri))
is(have_isbn_module and "isbn:0-88730-866-X" or "isbn:088730866X",
uri:path())
end
function testcase:test_isbn_setting_digits ()
local u = assert(URI:new("URN:ISBN:0395363411"))
local old = u:isbn_digits("0-88730-866-x")
is("0395363411", old)
is("088730866X", u:isbn_digits())
is(have_isbn_module and "0-88730-866-X" or "088730866X", u:nss())
if have_isbn_module then
is("0-88730-866-X", tostring(u:isbn()))
end
end
function testcase:test_isbn_setting_object ()
if have_isbn_module then
local ISBN = require "isbn"
local u = assert(URI:new("URN:ISBN:0395363411"))
local old = u:isbn(ISBN:new("0-88730-866-x"))
assert_table(old)
is("0-395-36341-1", tostring(old))
is("088730866X", u:isbn_digits())
is("0-88730-866-X", u:nss())
local new = u:isbn()
assert_table(new)
is("0-88730-866-X", tostring(new))
end
end
function testcase:test_illegal_isbn ()
is_bad_uri("invalid characters", "urn:ISBN:abc")
if have_isbn_module then
is_bad_uri("bad checksum", "urn:isbn:0395363412")
is_bad_uri("wrong length", "urn:isbn:03953634101")
end
end
lunit.run()
-- vi:ts=4 sw=4 expandtab
|
local redis = require "resty.redis"
return {
fields = {
session_key = { type = "string", default="SESSION" },
redis_session_prefix = { type = "string", default = "" },
redis_host = { type = "string" },
redis_port = { type = "number", default = 6379 },
redis_password = { type = "string" },
redis_timeout = { type = "number", default = 2000 },
hash_key = { type = "string", default="JWT" },
},
self_check = function(schema, plugin_t, dao, is_updating)
if not plugin_t.redis_host then
return false, string.format "You need to specify a Redis host"
elseif not plugin_t.redis_port then
return false, string.format "You need to specify a Redis port"
elseif not plugin_t.redis_timeout then
return false, string.format "You need to specify a Redis timeout"
end
kong.log('before redis new');
local red = redis:new()
kong.log('after redis new');
red:set_timeout(plugin_t.redis_timeout)
kong.log('after redis set timeout');
local ok, err = red:connect(plugin_t.redis_host, plugin_t.redis_port)
if not ok then
kong.log('redis host err', err);
return false, string.format "Redis Host unreachable: " .. err
end
kong.log('before redis conn pwd');
if plugin_t.redis_password and plugin_t.redis_password ~= "" then
local ok, err = red:auth(plugin_t.redis_password)
if not ok then
kong.log('redis auth err ', err);
return false, string.format "Redis Invalid Credentials: " .. err
end
end
return true
end
}
|
local ffi = require( "ffi" )
local glfw = require( "ffi/glfw" )
local moo = require( "lib/moo" )
local int1, int2 = ffi.new( "int" ), ffi.new( "int" )
local notify = moo.notify
local function update(self)
if self.window == nil then
self:init()
end
assert(self.window)
if glfw.glfwGetWindowParam(self.window, glfw.GLFW_CLOSE_REQUESTED) then
notify(self, "exiting")
self.window = false
notify(self, "exited")
self.update = function() return false end
return false
end
glfw.SwapBuffers()
glfw.PollEvents()
-- Polling mouse
glfw.glfwGetCursorPos(window, int1, int2)
local mx, my = int1[0], int2[0]
if self.mx ~= mx or self.my ~= my then
self.mx, self.my = mx, my
notify(self, "mouse_moved")
end
-- Detecting window size changes
glfw.glfwGetWindowSize(window, int1, int2)
local width, height = int1[0], int2[0]
if self.width ~= width or self.height ~= height then
self.width, self.height = width, height
notify(self, "resized")
end
[sdl.SDL_MOUSEBUTTONDOWN] = function() self.mb[ bn ] = true end,
[sdl.SDL_MOUSEBUTTONUP] = function() self.mb[ bn ] = false end,
[sdl.SDL_KEYDOWN] =
function()
self.kb, self.km = ks.sym, ks.mod
notify(self, "key_pressed")
end,
[sdl.SDL_VIDEORESIZE] =
function()
self.width, self.height = self.event.resize.w, self.event.resize.h
notify(self, "resizing")
self.window = glfw.glfwCreateWindow(
self.width, self.height,
glfw.GLFW_WINDOWED, "", nil
)
notify(self, "resized")
end,
return true
end
local function init(self, width, height)
assert(self.window == nil)
assert(glfw.glfwInit())
self.width = width or self.width or 640
self.height = height or self.height or 480
self.mx, self.my, self.mb = 0, 0, {}
self.kb, self.km = 0, 0
self.update = self.update or update
end
local function exit(self)
self.event.type = sdl.SDL_QUIT
sdl.SDL_PushEvent(self.event)
end
local function new()
return {
new = new,
init = init,
update = update,
exit = exit,
}
end
if ... then
return new()
end
-- mocking require, making sure argument (module to be loaded) is ignored
require = function() new() end
-- Test1
do
local wm = require( "lib/wm/lua....but-it-does-not-matter-we-are-testing-this-here" )
function wm:resizing()
print( 'Resizing to', self.width, self.height )
end
function wm:resized()
print( 'Resized to', self.width, self.height )
end
function wm:exiting()
assert(self.window)
print( 'Exiting' )
end
function wm:exited()
assert(self.window == nil)
print( 'Exited' )
end
function wm:key_pressed()
print( 'Key pressed', wm.kb )
if wm.kb == 27 then
wm:exit()
end
end
local frame = 0
assert(wm.window == nil)
while wm:update() do
if wm.kb == 32 then
-- polling exit
wm:exit()
end
if wm.kb == 50 then
end
if frame > 100 then
wm:exit()
end
frame = frame + 1
end
assert(wm.window == nil)
end
|
credits = {}
function credits:enter(previous)
self.slide = 1
self.timer=0
output:play_playlist("credits")
end
function credits:draw()
setColor(255,255,255,255)
local width, height = love.graphics:getWidth(),love.graphics:getHeight()
setColor(255,255,255,255)
love.graphics.setFont(fonts.graveFontBig)
setColor(255,255,255,255)
love.graphics.printf("Possession",14,100,width-28,"center")
if self.slide == 1 then
love.graphics.setFont(fonts.graveFontSmall)
love.graphics.printf("Programming, Graphics, Music",math.floor(width/3),240,math.floor(width/3),"center")
love.graphics.setFont(fonts.textFont)
love.graphics.printf("Taylor Vaughan",math.floor(width/3),270,math.floor(width/3),"center")
elseif self.slide == 2 then
love.graphics.setFont(fonts.graveFontSmall)
love.graphics.printf("Beta Testing",math.floor(width/3),240,math.floor(width/3),"center")
love.graphics.setFont(fonts.textFont)
love.graphics.printf([[]],math.floor(width/3),270,math.floor(width/3),"center")
elseif self.slide == 3 then
love.graphics.setFont(fonts.graveFontSmall)
love.graphics.printf("Uses Sounds Created By",math.floor(width/3),200,math.floor(width/3),"center")
love.graphics.setFont(fonts.textFont)
love.graphics.printf([[
Kenney Vleugels
http://www.kenney.nl
Iwan Gabovitch "qubodup"
http://qubodup.net
InspectorJ
http://www.jshaw.co.uk
ZapSplat
https://www.zapsplat.com/
FreeSFX
http://www.freesfx.co.uk]],math.floor(width/3),230,math.floor(width/3),"center")
elseif self.slide == 4 then
love.graphics.setFont(fonts.graveFontSmall)
love.graphics.printf("Uses Sounds Created By",math.floor(width/3),140,math.floor(width/3),"center")
love.graphics.setFont(fonts.textFont)
love.graphics.printf([[
Tuomo Untinen "Reemax"
http://opengameart.org/users/reemax
Jesús Lastra "Jalastram"
http://opengameart.org/users/jalastram
spookeymodem
http://opengameart.org/users/spookymodem
JaggedStone
http://opengameart.org/users/jaggedstone
Vataaa
http://freesound.org/people/vataaa/
3bagbrew
http://freesound.org/people/3bagbrew/
unfa
http://freesound.org/people/unfa/
]],math.floor(width/3)-5,170,math.floor(width/3)+10,"center")
elseif self.slide == 5 then
love.graphics.setFont(fonts.graveFontSmall)
love.graphics.printf("Some Music Samples From",math.floor(width/3),140,math.floor(width/3),"center")
love.graphics.printf("Fonts",math.floor(width/3),340,math.floor(width/3),"center")
love.graphics.setFont(fonts.textFont)
love.graphics.printf([[
Farmer's Samplepacks
Copyright 1997 Louis Gorenfeld
]],math.floor(width/3)-5,170,math.floor(width/3)+10,"center")
love.graphics.printf([[Venice Classic, freeware by soixantedeux.
]],math.floor(width/3)-5,370,math.floor(width/3)+10,"center")
elseif self.slide == 6 then
love.graphics.setFont(fonts.graveFontSmall)
love.graphics.printf("External Libraries",math.floor(width/3),140,math.floor(width/3),"center")
love.graphics.setFont(fonts.textFont)
love.graphics.printf([[LÖVE game development framework, ZLIB License.
An implementaion of the Bresenham Line Algorithm
by Enrique García Cota, Yuichi Tateno, Emmanuel Oga, MIT license.
Jumper by Roland Yonaba, MIT License.
Lady by Robin Wellner, MIT License.
Luasteam, USPGameDev, MIT License.
Helper Utilities for Massive Progression by Matthias Richter, MIT License.
Ripple by Andrew Minnich, MIT license.
]],math.floor(width/3),170,math.floor(width/3),"center")
end
setColor(255,255,255,255)
end
function credits:keypressed(key)
key = input:parse_key(key)
if key == "escape" then
Gamestate.switch(menu)
end
end
function credits:update(dt)
self.timer = self.timer+dt
if self.timer >= 3 then
if self.slide == 6 then
Gamestate.switch(menu)
else
self.slide = self.slide+1
self.timer=0
end
end
end
|
--Cache messages to be sent.
local characters = dofile(path.."settings/characters.lua")
local SC = ""
local CharsCheck = ""
for i=1,#characters do
SC = SC..characters[i].."#"
--CharsCheck = CharsCheck.."0#"
end
local music = dofile(path.."settings/music.lua")
local musiccount = 0
local SM = ""
SM = SM .. music[1].."#"
SM = SM .. music[2].."#"
for k in pairs(music.games) do SM = SM ..k.."#"; musiccount = musiccount+1 end
SM = SM .. music[3].."#"
for k,t in pairs(music.themes) do SM = SM ..t.."#"; musiccount = musiccount+1 end
SM = SM .. music[4].."#"
for k,c in pairs(music.charthemes) do SM = SM ..c.."#"; musiccount = musiccount+1 end
SM = SM .. music[5].."#"
for k,m in pairs(music.misc) do SM = SM ..m.."#"; musiccount = musiccount+1 end
musiccount = musiccount+5
local SI = #characters.."#0#"..musiccount.."#"
local backgrounds = dofile(path.."settings/backgrounds.lua")
--Localization or something
local text = dofile(path.."settings/text.lua")
--Feature locks
dofile(path.."settings/features.lua")
--Filters for spam or language.
local filters = dofile(path.."settings/filters.lua")
--TODO
--Character analytics
--Music analytics
--/ignore command
----Re-add need with a feature lock.
--Add ao1 char loading and messages
--OOC spam prevention
local rooms = dofile(path.."settings/rooms.lua")
local staticrooms = #rooms
local bans = loadlist(path.."bans.txt")
--Initialize rooms
function initializeroom(i)
local v = rooms[i]
v.id = i
v.count = 0
v.clients = {}
if v.kind == "court" then
v.hp={10,10}
v.status="IDLE"
v.evidence = {}
end
if v.kind ~= "echo" then
v.mbuffer = {} --Message buffer.
end
if v.kind == "portal" then
v.socket = socket.tcp()
v.socket:settimeout(0)
v.socket:connect(v.ip,v.port)
end
if feature_replay then
v.replay = {}
end
end
for i=1,#rooms do initializeroom(i) end
local clientcount = 0
local viewers = {}
local clients = {}
function doaccept(socket)
local ip,port = socket:getpeername()
viewers[socket] = {
viewtime = os.time(), --If they continue viewing for a minute, it will automatically disconnect them to free up room.
spamcounter = 0,
count=0,
buffer="",
socket=socket,
ip=ip,
port=port,
}
--print(tostring(ip)..":"..tostring(port).." is viewing.")
if clientcount < maxplayers then
local isbanned = table.find(bans,ip)
if not isbanned then
buffersend(socket,"decryptor#34#%")
buffersend(socket,"HI#AOls#beta#%")
buffersend(socket,"ID#"..firstempty(clients).."#AOls#beta#%")
buffersend(socket,"PN#"..clientcount.."#"..maxplayers.."#%")
else
doclosed(socket)
print("Banned client tried to connect! IP: "..tostring(ip))
end
else
doclosed(socket)
end
end
function doclosed(socket)
local client = clients[socket]
if client then
local id = client.id
if client.room then
clientcount=clientcount-1
end
leaveroom(client,"disconnected.")
clients[id] = nil
clients[socket] = nil
print("Client["..id.."] disconnected.")
end
local viewer = viewers[socket]
if viewer then
viewers[socket] = nil
end
if socket then
socket:close()
end
end
function dosubcommand(socket,sc)
local client = viewers[socket] or clients[socket]
local subcommand = sc
if subcommand:sub(1,1) == "#" then subcommand = subcommand:sub(2,-1) end
local args = string.split(subcommand,"#")
if #args[1] == 4 then args[1] = decryptStr(hexToString(args[1]), 5) end
if not client then
if args[2] ~= "ms2" then --Ignore ms2 prober's second message.
print("Received message from unknown client!",table.concat(args,"#"),socket:getpeername())
end
return
end
--print(subcommand)
--print(table.concat(args,"#"))
--Handshake
if args[1] == "HI" then
client.hardwareid = args[2]
buffersend(socket,"FL#yellowtext#customobjections#flipping#fastloading#deskmod#noencryption#%")
end
if args[1] == "ID" then client.software = args[2] end
--Start join
if args[1] == "askchaa" and not client.id then --Id is added when the client sends this message, so this will prevent accidental extra joins.
local id = firstempty(clients)
local ip,port = client.socket:getpeername()
print(tostring(ip)..":"..tostring(port).." is now joining with id: "..id.."\n"..tostring(client.software).." "..tostring(client.hardwareid))
buffersend(socket,"SI#"..SI.."%")
clients[id] = client
clients[client.socket] = client
viewers[socket] = nil
client.id = id
end
--Loading 2.0
if args[1] == "RC" then buffersend(socket,"SC#"..SC.."%")
elseif args[1] == "RM" then buffersend(socket,"SM#"..SM.."%")
end
--End of loading.
if args[1] == "RD" then
--buffersend(socket,"CharsCheck#"..CharsCheck.."%")
buffersend(socket,"DONE#%")
if text.motd then
botmessage(socket,text.motd)
end
CTcommand(client,"","/area")
joinroom(client,1,"connected to the server.")
clientcount=clientcount+1
end
--Keep clients updated.
if args[1] == "CH" then buffersend(socket,"CHECK#%") end
--Character Picking
if args[1] == "CC" then CC(client,tonumber(args[3])) end
--Mod call
if args[1] == "ZZ" then
print("Client["..client.id.."] called for mods in room "..(client.room.id))
for i,v in ipairs(clients) do
if v.mod then
buffersend(v.socket,"CT#"..escapeChat(serverooc).."#["..(client.room.id).."][("..(client.id)..")"..getcharname(client.charid).."] called for a mod.#%")
end
end
end
--Room Commands:
--Messaging
if args[1] == "CT" then CT(client,client.nick or (args[2] ~= "" and args[2]) or tostring("client"..client.id), args[3]) end
--The big one ^^;
if args[1] == "MS" then
local room = client.room
if not client.charid then return end --You can't use MS as spectator!
if room.roommute and not client.mod then return end
if client.muted then return end
local desk = client.desk or args[2]
if desk ~= "0" and desk ~= "1" and desk ~= "chat" then return end
local pre_emote = args[3]
local character = feature_iniswap and args[4] or getcharname(client.charid)
local emote = args[5]
local message = args[6]
local side = args[7]
if side ~= "def" and side ~= "pro" and side ~= "jud" and side ~= "wit" and side ~= "hld" and side ~= "hlp" then return end
if not client.pos then setnewpos(client,side) end --Reminder: Position is reset when you join a new room.
side = client.pos
--Check for room pos!
local sfx_name = args[8]
local emote_modifier = tonumber(args[9])
if not emote_modifier or emote_modifier < 0 or emote_modifier > 6 or emote_modifier ~= math.floor(emote_modifier) then return end
local char_id = client.charid --Ignore args[10]
local sfx_delay = tonumber(args[11]) or 0
if not sfx_delay or sfx_delay ~= math.floor(sfx_delay) then return end
local shout_modifier = tonumber(args[12]) or 0
if not shout_modifier or shout_modifier ~= math.floor(shout_modifier) then return end
local evidence = tonumber(args[13]) or 0
if not evidence or evidence ~= math.floor(evidence) then return end
local flip = args[14] --Replace with char_id for 1.x versions
if flip ~= "0" and flip ~= "1" then return end
local realization = args[15]
if realization ~= "0" and realization ~= "1" then return end
local text_color = tonumber(args[16])
if not text_color or text_color < 0 or text_color > 6 then return end
if text_color == 0 and feature_autocolor then --Ignore if the user wants a different color.
if message:find("^%([^%(].-[^%)]%)$") then text_color = 4 end --(Thinking brackets are most likely blue)!
if message:find("^%*.-%*$") then text_color = 3 end --Action text *Is orange*
end
if message:sub(1,9) == "<percent>" then
local tc
local i = 10
if string.lower(message:sub(i,i)) == "w" then tc = 0
elseif string.lower(message:sub(i,i)) == "g" then tc = 1
elseif string.lower(message:sub(i,i)) == "r" then tc = 2
elseif string.lower(message:sub(i,i)) == "o" then tc = 3
elseif string.lower(message:sub(i,i)) == "b" then tc = 4
elseif string.lower(message:sub(i,i)) == "y" then tc = 5
elseif string.lower(message:sub(i,i)) == "s" then tc = 6
end
if tc then
message = message:sub(11,-1)
text_color = tc
end
end
if text_color == 6 and not feature_rainbowtext then text_color = 0 end --We don't need that eyebleeder :P
if #message > icmaxlength then message = message:sub(1,icmaxlength) end
if spamcheck(client,message) then
message = "*****"
end
local msg = "MS#"..table.concat({desk, pre_emote, character, emote, message, side, sfx_name, emote_modifier, char_id, sfx_delay, shout_modifier, evidence, flip, realization, text_color},"#").."#%"
local sent = false
if room and room.kind ~= "echo" then
if msg ~= client.lm then
client.lm = msg
if room.lmt then
if #room.mbuffer < 5 then --If somebody gets to this point, it's spamming.
room.mbuffer[#room.mbuffer+1] = msg
sent = true
end
else
broadcastroom(room,msg)
room.lmt = msgbuffertime
sent = true
end
end
else
buffersend(socket,msg)
end
if sent then
print("Client["..(client.id).."]["..getcharname(client.charid).."]["..tostring(client.room and client.room.name).."]: "..message)
if feature_replay then
table.insert(room.replay,{os.time(), "MS", desk, pre_emote, character, emote, message, side, sfx_name, emote_modifier, char_id, sfx_delay, shout_modifier, 0, flip, realization, text_color})
end
end
end
--Music
if args[1] == "MC" then
local track = args[2]
--Game selector.
if not client.musictheme then client.musictheme = "AA" end
for k,v in pairs(music.games) do
if args[2] == k then
track = nil
client.musictheme = k
botmessage(socket,string.format(text.musictheme,k))
break
end
end
--Game theme.
for k,v in pairs(music.themes) do
if args[2] == v then
track = music.games[client.musictheme][v]
break
end
end
if args[2]:sub(1,1):find("[^0-9a-zA-Z]") then
track = music[1]
end
--Otherwise, just a misc music track.
if track and client.charid then
if client.room and client.room.kind ~= "echo" and not client.muted then
if track ~= client.room.music then
client.room.music = track
broadcastroom(client.room,"MC#"..track.."#"..client.charid.."#%")
client.room.lastplay = os.time()
if feature_replay then
table.insert(client.room.replay,{os.time(), "MC", track, client.charid})
end
end
else
buffersend(socket,"MC#"..track.."#"..client.charid.."#%")
end
end
end
--Courtroom commands!
--WT woosh!
if args[1] == "RT" then
if args[2] == "testimony1" or args[2] == "testimony2" then
if client.room.kind == "court" and not client.muted then
broadcastroom(client.room,"RT#"..args[2].."#%")
if feature_replay then
table.insert(client.room.replay,{os.time(), "RT", args[2]})
end
elseif client.room.kind == "echo" and not client.muted then
buffersend(client.socket,"RT#"..args[2].."#%")
end
if client.lastwoosh then
if os.clock() <= client.lastwoosh+1/11 then
client.spamcounter = client.spamcounter + 1
end
end
client.lastwoosh = os.clock()
end
end
--HP!
if args[1] == "HP" then
local hpbar = tonumber(args[2])
local amount = tonumber(args[3])
if hpbar and amount then
if amount >= 0 and amount <= 10 then
if client.room.kind == "court" and not client.muted then
client.room.hp[hpbar]=amount
broadcastroom(client.room,"HP#"..hpbar.."#"..amount.."#%")
if feature_replay then
table.insert(client.room.replay,{os.time(), "HP", hpbar, amount})
end
elseif client.room.kind == "echo" then
buffersend(client.socket,"HP#"..hpbar.."#"..amount.."#%")
end
end
end
end
--Evidence
if client.room and client.room.kind == "court" and not client.muted then
if args[1] == "PE" and #client.room.evidence < maxevidence then --Add
table.insert(client.room.evidence,{"name","description",args[4]})
listevidence(client,true)
elseif args[1] == "DE" then --Delete
if client.room.evidence[1] then
table.remove(client.room.evidence,(tonumber(args[2]) or 0)+1)
end
listevidence(client,true)
elseif args[1] == "EE" then --Edit
client.room.evidence[(tonumber(args[2]) or 0)+1] = {args[3],args[4],args[5]}
listevidence(client,true)
end
end
end
function listevidence(client,update)
if client.room and client.room.evidence then
if not client.room.evidencestring or update then
local evidence = "LE#"
for i,v in ipairs(client.room.evidence) do
evidence = evidence .. v[1] .. "&" .. v[2] .. "&" .. v[3] .. "#"
end
evidence = evidence .. "%"
client.room.evidencestring = evidence
broadcastroom(client.room,client.room.evidencestring)
else
buffersend(client.socket,client.room.evidencestring)
end
else
buffersend(client.socket,"LE#%")
end
end
function doupdate(dt)
local currenttime = os.time()
local subtract = 0
for i=#rooms,1,-1 do local v = rooms[i]
v.id = v.id - subtract
if v.kind ~= "echo" then
if v.lmt then
v.lmt = v.lmt - dt
if v.lmt <= 0 then
local msg = v.mbuffer[#v.mbuffer]
if msg then
broadcastroom(v,v.mbuffer[#v.mbuffer])
v.mbuffer[#v.mbuffer] = nil
v.lmt = msgbuffertime
else
v.lmt = nil
end
end
end
if v.lastplay then
local track = v.music
if music.lengths[track] then
local length = music.lengths[track]
if currenttime > v.lastplay+length then
broadcastroom(v,"MC#"..track.."#-1#%")
v.lastplay = currenttime
end
end
end
end
if v.kind == "court" and i > staticrooms then
if v.count == 0 then
subtract = subtract + 1
table.remove(rooms,i)
end
end
end
for i,v in pairs(clients) do
if tonumber(i) then
if v.spamcounter > 10 then
doclosed(v.socket)
print("Client["..i.."] was automatically kicked due to spamming!")
break
end
v.spamcounter = math.max(v.spamcounter-(1/10),0)
end
if v.replay then
if v.room.replay[v.replay] and os.time()-v.replayoffset > v.room.replay[v.replay][1] then
local data = {unpack(v.room.replay[v.replay])}
table.remove(data,1)
buffersend(v.socket, table.concat(data,"#").."#%")
v.replay = v.replay+1
end
if v.replay > v.replayend then
v.replay = nil
v.replayend = nil
v.replayoffset = nil
end
end
end
for k,v in pairs(viewers) do
if os.time() > v.viewtime+60 then
if v.ip ~= mservip then
doclosed(v.socket)
--print("Client["..i.."] timed out viewing the server!")
end
end
end
end
function CT(client, name,message)
local socket = client.socket
if not name:find("[a-zA-Z]") then botmessage(socket,text.OOCnoletters);return end
if #name > oocmaxnamelength then botmessage(socket,string.format(text.OOClongname,oocmaxnamelength));return end
if #message > oocmaxlength then
botmessage(socket,string.format(text.OOClongmsg,oocmaxlength))
message:sub(1,oocmaxlength)
end
if message:sub(1,1) == "/" then
if not CTcommand(client, name,message) then
botmessage(socket,text.invalidcommand)
end
return
end
if client.room then
broadcastroom(client.room,"CT#["..client.id.."] "..name.."#"..message.."#%")
end
end
--TODO: Make a hash-table function list, much better than if-thens.
function CTcommand(client, name,message) --Return true to say that the command was valid.
local socket = client.socket
local args = string.split(message," ")
if name ~= "" then print("Client["..(client.id).."]["..name.."]["..tostring(client.room and client.room.name).."]: "..message) end
if feature_replay and args[1] == "/replay" then
if tonumber(args[2]) then
botmessage(client.socket,"Playing replay from -"..tostring(args[2]).." seconds ago to now.")
for i=#client.room.replay,1,-1 do
if os.time()-tonumber(args[2]) < client.room.replay[i][1] then
client.replay = i
break
end
end
if client.replay then
client.replayend = #client.room.replay
client.replayoffset = tonumber(args[2])
end
end
return true
end
--Regular commands.
if args[1] == "/motd" then
if text.motd then
botmessage(client.socket,text.motd)
return true
end
end
if args[1] == "/help" then
if text.help then
botmessage(client.socket,text.help)
return true
end
end
if args[1] == "/rules" then
if text.rules then
botmessage(client.socket,text.rules)
return true
end
end
if args[1] == "/files" then
if text.files then
botmessage(client.socket,text.files)
return true
end
end
if args[1] == "/area" or args[1] == "/areas" then
if client.trapped then return false end
if args[2] then
if tonumber(args[2]) then
local room = rooms[tonumber(args[2])]
if room then
if not room.lock or room.lock == args[3] then
if not room.modlock or room.modlock and client.mod then
joinroom(client,tonumber(args[2]))
botmessage(client.socket,text.joiningheader.."\n"..string.format(text.changedroom,client.room.name))
if client.room.desc then
botmessage(client.socket,client.room.desc)
end
else
botmessage(client.socket,"Warning: This room is locked to moderators only!")
end
else
botmessage(client.socket,"Warning: This room is locked. Please add the correct passcode to your command.")
end
else
botmessage(client.socket,"Warning: A room with that id doesn't exist!")
end
elseif args[2] == "+" and feature_dynamicrooms then
local name = message:sub(9,-1)
if name == "" then name = nil end
local newroomid = #rooms+1
rooms[newroomid] = {
name = name or "New Courtroom",
desc = nil,
bg=backgrounds[math.random(1,#backgrounds)],
music="No Music",
kind="court",
}
initializeroom(newroomid)
joinroom(client,newroomid)
else --Find by name?
--
local search = string.lower(message:sub(7,-1))
if search ~= "" then
local found = false
for i=1,#rooms do local v = rooms[i]
if string.lower(v.name):find(search) and not v.lock and (not v.modlock or v.modlock and client.mod) then
joinroom(client,i)
botmessage(client.socket,text.joiningheader.."\n"..string.format(text.changedroom,client.room.name))
if client.room.desc then
botmessage(client.socket,client.room.desc)
end
found = true
break
end
end
if not found then
botmessage(client.socket,string.format("Warning: Could not find room with search '%s'",search))
end
else
botmessage(client.socket,text.notanumber)
end
end
else
local msg = text.roomlistheader.."\n"
for i=1, #rooms do local v = rooms[i]
if i <= staticrooms then
msg = msg .. i ..": "..v.name
else
msg = msg ..i..": \""..v.name.."\""
end
msg = msg .." "
if v.lock then
msg = msg .."[Pass]"
end
if v.modlock then
msg = msg .."[Mods]"
end
if v.kind == "court" then
msg = msg .."["..v.status.."]"
end
msg = msg .." ("..v.count..")"
msg = msg.."\n"
end
if feature_dynamicrooms then
msg = msg.."+: (Make Courtroom)"
end
botmessage(client.socket,msg)
end
return true
end
if args[1] == "/getarea" or args[1] == "/whois" then
if tonumber(args[2]) then --Get person details
local target = clients[tonumber(args[2])]
if target then
if target.room then
if target.room == client.room then
botmessage(client.socket,string.format(text.whoisuinroom,target.id,getcharname(target.charid),target.pos or "N/A"))
else
botmessage(client.socket,string.format(text.whoisufindroom,target.id,target.room.id,target.room.name))
end
else
botmessage(client.socket,string.format(text.whoisunoroom,args[2]))
end
else
botmessage(client.socket,text.whoisunotfound)
end
else --Get room list.
local msg = client.room.count.." people in this room.".."\n"..text.whoisheader.."\n"
for cli in pairs(client.room.clients) do
msg = msg .. string.format(text.whoisformat, cli.id, getcharname(cli.charid), cli.pos or "N/A")
end
botmessage(client.socket,msg)
end
return true
end
if args[1] == "/getareas" then
local msg = ""
for i=1,#rooms do local v = rooms[i]
if v.count > 0 then
msg = msg .. "=="..v.name.."==\n"
for cli in pairs(v.clients) do
msg = msg .. string.format(text.whoisformat, cli.id, getcharname(cli.charid), cli.pos or "N/A")
end
end
end
botmessage(client.socket,msg)
return true
end
if args[1] == "/players" then
botmessage(client.socket,clientcount.." players online.")
return true
end
if not client.muted and args[1] == "/g" then
if args[2] then
for k,v in pairs(clients) do
if not tonumber(k) then
buffersend(v.socket,"CT#"..escapeChat(serverooc)..getroomname(client.room).."(["..(client.id).."] "..name..")#"..escapeChat(message:sub(4,-1)).."#%" )
end
end
else
botmessage(client.socket,text.ghelp)
end
return true
end
if feature_need and not client.muted and args[1] == "/need" then
if args[2] then
for i=1,#clients do local v = clients[i]
if v then
buffersend(v.socket,"CT#"..escapeChat(serverooc).."#"..escapeChat(text.needheader.."(["..(client.id).."] "..name..") in "..getroomname(client.room).." needs "..message:sub(7,-1)..text.needfooter).."\n#%" )
end
end
else
botmessage(client.socket,text.needhelp)
end
return true
end
if not client.muted and args[1] == "/pm" then
if tonumber(args[2]) then
local target = clients[tonumber(args[2])]
if target then
botmessage(client.socket, string.format(text.pmtotarget,target.id,message:sub(5+#args[2]+1,-1)) )
botmessage(target.socket, string.format(text.pmtosender,client.id,message:sub(5+#args[2]+1,-1)) )
else
botmessage(client.socket, text.pmnofind)
end
print("Client["..client.id.."] pm'd a message to client["..target.id.."]")
else
botmessage(client.socket,text.pmhelp)
end
return true
end
if not client.muted and args[1] == "/coinflip" then
local result = "Heads"
local rand = math.random(1,2)
if rand == 2 then result = "Tails" end
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat(name.." flipped a coin and got "..result.."!").."#%")
return true
end
if not client.muted and args[1] == "/roll" then
local range = tonumber(args[2]) or 6
local rand = math.random(1,math.max(range,1))
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat(name.." rolled a "..range.."-sided die and got "..rand.."!").."#%")
return true
end
if args[1] == "/randomchar" then
CC(client,math.random(1,#characters))
return true
end
if args[1] == "/switch" then
local search = string.lower(message:sub(9,-1))
for i,v in ipairs(characters) do
if string.lower(v):find(search) then
if CC(client,i-1) then
botmessage(client.socket,string.format("Changed character to %s",v))
return true
end
end
end
botmessage(client.socket,string.format("Warning: Could not find character with search '%s'",search))
return true
end
if args[1] == "/pos" then
if args[2] then
local p = string.lower(args[2]:sub(1,3))
if p == "jud" or p == "wit" or p == "def" or p == "pro" or p == "hld" or p == "hlp" then
setnewpos(client,p)
botmessage(client.socket,string.format("Changed position to '%s'",client.pos))
else
botmessage(client.socket,"Warning: Invalid position.\nHere is a list of valid positions: def, pro, jud, wit, hld, hlp")
end
else
botmessage(client.socket,"Warning: No position specified!\nHere is a list of valid positions: def, pro, jud, wit, hld, hlp")
end
return true
end
if args[1] == "/desk" then
if args[2] then
if args[2] == "0" or args[2] == "1" or args[2] == "default" then
client.desk = args[2]
if args[2] == "default" then client.desk = nil end
botmessage(client.socket,string.format("Desk changed to %s",args[2]))
else
botmessage(client.socket,"Warning: Invalid value!\nAll values: 0, 1, default")
end
else
botmessage(client.socket,"All values: 0, 1, default")
end
return true
end
if args[1] == "/bg" then
if not client.room.bglock or client.mod then
for i,v in ipairs(backgrounds) do
if string.lower(v) == string.lower(args[2]) then
if client.room.kind ~= "echo" then
client.room.bg = args[2]
broadcastroom(client.room,"BN#"..args[2].."#%")
else
buffersend(client.socket,"BN#"..args[2].."#%")
end
botmessage(client.socket,string.format(text.changedbg,args[2]))
return true
end
end
botmessage(client.socket,text.invalidbg)
else
botmessage(client.socket,"Warning: This room is BG-locked!")
end
return true
end
if not client.muted and args[1] == "/nick" then
local nick = message:sub(7,-1)
if args[2] then
client.nick = nick
botmessage(client,"Nickname set: "..tostring(client.nick))
else
botmessage(client,"Nickname cleared.")
client.nick = nil
end
return true
end
if not client.muted and args[1] == "/name" then
local name = message:sub(7,-1)
if args[2] and client.room.id > staticrooms then
client.room.name = name
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] updated the courtroom name.").."#%")
else
botmessage(client.socket, client.room.name)
end
return true
end
if not client.muted and args[1] == "/desc" then
local desc = message:sub(7,-1)
if args[2] and client.room.id > staticrooms then
client.room.desc = desc
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] updated the courtroom description.").."#%")
else
botmessage(client.socket, client.room.desc)
end
return true
end
if client.room and client.room.kind == "court" then
if args[1] == "/status" then
if args[2] then
local status = string.upper(args[2])
if status == "IDLE"
or status == "BUILDING"
or status == "RUNNING"
or status == "RECESS"
or status == "FINISHED" then
client.room.status = status
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] changed the room status to ".. status).."#%")
else
botmessage(client.socket,"Warning: Invalid status name!\nHere are the valid statuses: IDLE, BUILDING, RUNNING, RECESS, FINISHED")
end
else
botmessage(client.socket,"The room's current status is "..tostring(client.room.status))
end
return true
end
if args[1] == "/doc" then
if args[2] and not client.muted then
if args[2]:find("%w") then
client.room.doc = args[2]
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] updated the doc link.").."#%")
else
client.room.doc = nil
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] removed the doc link.").."#%")
end
else
if client.room.doc then
botmessage(client.socket,client.room.doc)
else
botmessage(client.socket,"There is no doc set!")
end
end
return true
end
if args[1] == "/leave" and not client.trapped then
joinroom(client,1)
return true
end
if args[1] == "/lock" and client.room.id > staticrooms then
local pass = args[2]
if pass and pass:find("%S") then
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] locked the courtroom with passcode: '"..pass.."'.").."#%")
client.room.lock = pass
end
return true
end
if args[1] == "/unlock" and client.room.id > staticrooms then
if client.room.lock then
client.room.lock = false
broadcastroom(client.room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] unlocked the courtroom.").."#%")
end
return true
end
end
--Moderator tools
if args[1] == "/modpass" then
local pass = message:sub(10,-1)
for i,v in ipairs(modpasses) do
if pass == v then
client.mod = true
botmessage(client.socket,"Added moderator status.")
print("Mod["..(client.id).."]["..name.."] entered moderator status.")
return true
end
end
end
if client.mod then
if args[1] == "/mute" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target then
target.muted = true
botmessage(client.socket,"Muted ["..(target.id).."]")
print("Mod["..(client.id).."]["..name.."] muted user ["..(target.id).."]")
else
botmessage(client.socket,"Warning: Invalid target.")
end
end
return true
end
if args[1] == "/unmute" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target then
target.muted = false
botmessage(client.socket,"Unmuted ["..(target.id).."]")
print("Mod["..(client.id).."]["..name.."] unmuted user ["..(target.id).."]")
else
botmessage(client.socket,"Warning: Invalid target.")
end
end
return true
end
if args[1] == "/kick" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target then
botmessage(client.socket,"Kicked ["..(target.id).."]")
print("Mod["..(client.id).."]["..name.."] kicked user ["..(target.id).."]")
doclosed(target.socket)
else
botmessage(client.socket,"Warning: Invalid target.")
end
end
return true
end
if args[1] == "/ban" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target then
botmessage(client.socket,"Banned ["..(target.id).."]. IP: "..tostring(target.ip))
print("Mod["..(client.id).."]["..name.."] banned user ["..(target.id).."]! IP: "..tostring(target.ip))
table.insert(bans,target.ip)
doclosed(target.socket)
savelist(bans,path.."bans.txt")
else
botmessage(client.socket,"Warning: Invalid target.")
end
end
return true
end
if args[1] == "/unban" then
local ip = args[2]
if ip then
local unbanned = false
for i=#bans,1,-1 do local v = bans[i]
if v == ip then
unbanned = true
table.remove(bans,i)
end
end
if unbanned then
savelist(bans,path.."bans.txt")
botmessage(client.socket,"Unbanned IP: "..tostring(ip))
print("Mod["..(client.id).."]["..name.."] unbanned ip: "..tostring(ip))
else
botmessage(client.socket,"Warning: IP was not found in the list.")
end
end
return true
end
if args[1] == "/move" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target and tonumber(args[3]) and tonumber(args[3]) >= 0 and tonumber(args[3]) <= #rooms then
joinroom(target,tonumber(args[3]))
botmessage(client.socket,"Moved ["..(target.id).."] to room "..args[3])
print("Mod["..(client.id).."]["..name.."] moved user ["..(target.id).."] to room "..args[3])
else
botmessage(client.socket,"Warning: Invalid target or room.")
end
end
return true
end
if args[1] == "/trap" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target and tonumber(args[3]) and tonumber(args[3]) >= 0 and tonumber(args[3]) <= #rooms then
target.trapped = true
joinroom(target,tonumber(args[3]))
botmessage(client.socket,"Trapped ["..(target.id).."] in room "..args[3])
print("Mod["..(client.id).."]["..name.."] trapped user ["..(target.id).."] to room "..args[3])
else
botmessage(client.socket,"Warning: Invalid target or room.")
end
end
return true
end
if args[1] == "/untrap" then
local userid = tonumber(args[2])
if userid then
local target = clients[userid]
if target then
target.trapped = false
botmessage(client.socket,"Un-trapped ["..(target.id).."]")
print("Mod["..(client.id).."]["..name.."] un-trapped user ["..(target.id).."]")
else
botmessage(client.socket,"Warning: Invalid target or room.")
end
end
return true
end
if args[1] == "/reload" then
print("Reloading!")
for k,v in pairs(viewers) do
if v and v.socket then
doclosed(v.socket)
end
end
for k,v in pairs(clients) do
if v and v.socket then
doclosed(v.socket)
else
print(k,"doesn't exist or has a connection.")
end
end
masterserver:makeHeartbeat()
reload()
return true
end
if args[1] == "/muteroom" then --Mutes everyone in the room except mods.
client.room.roommute = true
botmessage(client.socket,"Room muted.")
return true
end
if args[1] == "/unmuteroom" then --Mutes everyone in the room except mods.
client.room.roommute = false
botmessage(client.socket,"Room unmuted.")
return true
end
if args[1] == "/modlock" then --Make room only open to mods or trapped users.
botmessage(client.socket,"The current room is now mod locked!")
client.room.modlock = true
return true
end
if args[1] == "/unmodlock" then
botmessage(client.socket,"Mod lock removed.")
client.room.modlock = false
return true
end
end
end
function CC(client,charid) --Change character! I get it!
if charid and charid >= 0 and charid < #characters then
--if client.room and client.room.kind ~= "echo" and client.room.chars[charid] then return end --Fail if someone else is already this character!
buffersend(client.socket,"PV#"..client.id.."#CID#"..charid.."#%")
client.charid = charid
client.pos = nil
print("Client["..client.id.."] changed character to "..getcharname(charid))
return true
end
end
function setnewpos(client,target)
local room = client.room
if room and room.kind ~= "echo" then
local taken = {}
for k,v in pairs(room.clients) do
if client.id ~= v.id
and v.pos ~= nil
and v.charid == client.charid then
taken[v.pos] = true
end
end
if taken[target] then
local found = false
local spots = {"def","pro","wit","hld","hlp","jud"}
for i,v in ipairs(spots) do
if not taken[v] then
found = v
break
end
end
if found then
client.pos = found
botmessage(client.socket,"Warning: This position is already taken by the same character.")
else
client.pos = "hld"
botmessage(client.socket,"Warning: All positions are already taken. Using 'hld'")
end
else
client.pos = target
end
else
client.pos = target
end
end
function joinroom(client,roomid,r)
local reason = r or "joined this room."
local room = rooms[roomid]
if room then
leaveroom(client,"left to room "..tostring(room.name))
client.room = room
room.count = room.count + 1
room.clients[client] = client
buffersend(client.socket,"BN#"..(room.bg).."#%")
buffersend(client.socket,"MC#"..(room.music).."#-1#%")
if room.kind == "court" then
buffersend(client.socket,"HP#1#"..room.hp[1].."#%")
buffersend(client.socket,"HP#2#"..room.hp[2].."#%")
else
buffersend(client.socket,"HP#1#0#%HP#2#0#%")
end
listevidence(client)
broadcastroom(room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] "..reason).."#%")
return true
else
botmessage(client.socket,text.invalidroom)
end
end
function leaveroom(client,message)
local msg = message or "left this room."
if client.room then
client.pos = nil
local room = client.room
room.count = room.count - 1
room.clients[client] = nil
--print(client.id,"Left room: ",room.id)
broadcastroom(room,"CT#"..escapeChat(serverooc).."#"..escapeChat("["..client.id.."] "..msg).."#%")
return true
end
end
function broadcastroom(room,message)
for k,v in pairs(room.clients) do
buffersend(v.socket,message)
end
end
function getcharname(charid)
return characters[(charid or -2)+1] or "A spectator"
end
function getroomname(room)
local name = room and room.name or "Void"
if room and room.id > staticrooms then name = "\""..name.."\"" end
return name
end
function getroom(id)
return rooms[tonumber(id)]
end
function getuser(id)
return rooms[tonumber(id)]
end
function spamcheck(client,message)
local result
local msg = string.lower(string.gsub(message,"%W",""))
for i,v in ipairs(filters) do
if msg:find(v) then
result = true
break
end
end
if result then
client.spamcounter = client.spamcounter + 5
return true
end
end
|
local cli = require("neogit.lib.git.cli")
local util = require("neogit.lib.util")
return {
list = function(options)
local output = cli.run("log --oneline " .. options)
local output_len = #output
local commits = {}
for i=1,output_len do
local matches = vim.fn.matchlist(output[i], "^\\([| \\*]*\\)\\([a-zA-Z0-9]*\\) \\((.*)\\)\\? \\?\\(.*\\)")
if #matches ~= 0 and matches[3] ~= "" then
local commit = {
level = util.str_count(matches[2], "|"),
hash = matches[3],
remote = matches[4],
message = matches[5]
}
table.insert(commits, commit)
end
end
return commits
end
}
|
------------------------------------
-- Beastmen Treasure side quests
-- https://ffxiclopedia.fandom.com/wiki/Beastmen_Treasure
------------------------------------
require('scripts/globals/keyitems')
require('scripts/globals/quests')
require('scripts/globals/status')
require('scripts/globals/weather')
require('scripts/globals/zone')
------------------------------------
tpz = tpz or {}
tpz.beastmentreasure = tpz.beastmentreasure or {}
local zoneData = {
[tpz.zone.YUHTUNGA_JUNGLE] =
{
statusvar = 'BMT_Lowlands_Status',
dsvar = 'BMT_Lowlands_Digsite',
mapid = tpz.ki.MAP_OF_THE_ELSHIMO_REGIONS,
day = tpz.day.WINDSDAY,
fetchitems =
{
1480, -- Mermaid Head
1481, -- Mermaid Body
1482, -- Mermaid Hands
1483 -- Mermaid Tail
},
loot =
{
unique = {[14626] = 5}, -- Mermaid's Ring
racial = {[887] = 3} -- Coral Fragment
}
},
[tpz.zone.YHOATOR_JUNGLE] =
{
statusvar = 'BMT_Uplands_Status',
dsvar = 'BMT_Uplands_Digsite',
mapid = tpz.ki.MAP_OF_THE_ELSHIMO_REGIONS,
day = tpz.day.LIGHTNINGDAY,
fetchitems =
{
1484, -- Rancor Mantle
1485, -- Rancor Globe
1486, -- Rancor Tank
1487 -- Rancor Handle
},
loot =
{
unique = {[13400] = 5}, -- Bitter Earring
racial = {[4158] = 3} -- Venom Potion
}
},
[tpz.zone.WESTERN_ALTEPA_DESERT] =
{
statusvar = 'BMT_Kuzotz_Status',
dsvar = 'BMT_Kuzotz_Digsite',
mapid = tpz.ki.MAP_OF_THE_KUZOTZ_REGION,
day = tpz.day.EARTHSDAY,
fetchitems =
{
1476, -- Xhifhut Strings
1477, -- Xhifhut Body
1478, -- Xhifhut Bow
1479 -- Xhifhut Head
},
loot =
{
unique = {[13655] = 5}, -- Sand Mantle
racial = {[645] = 3} -- Darksteel Ore
}
}
}
local sharedLoot = {
-- All items are assigned a "weight" here
rocksgems =
{
[769] = 1, -- Red rock
[770] = 1, -- Blue rock
[771] = 1, -- Yellow rock
[772] = 1, -- Green rock
[773] = 1, -- Translucent rock
[774] = 1, -- Purple rock
[775] = 1, -- Black rock
[776] = 1, -- White rock
-- Tier 1 gems
[795] = 2, -- Lapis Lazuli (blue)
[796] = 2, -- Light Opal (white)
[799] = 2, -- Onyx (black)
[800] = 2, -- Amethyst (purple)
[806] = 2, -- Tourmaline (green)
[807] = 2, -- Sardonyx (red)
[809] = 2, -- Clear Topaz (translucent)
[814] = 2, -- Amber (yellow)
},
seeds =
{
[572] = 1, -- Herb seeds
[573] = 1, -- Vegetable seeds
[574] = 1, -- Fruit seeds
[575] = 1, -- Grain seeds
},
coins =
{
[748] = 1, -- Gold beastcoin
[749] = 1, -- Mythril beastcoin
[750] = 1, -- Silver beastcoin
},
seals =
{
[1126] = 2 -- Beastmen's Seal
}
}
local function convertToWeighted(loot)
-- Takes a loot table formatted like the members of `sharedloot` and returns a weighted version that can be indexed
local weightedLoot = {}
for item, weight in pairs(loot) do
for i = 1, weight do
table.insert(weightedLoot, item)
end
end
return weightedLoot
end
local function addLoot(t1, t2)
-- Used for non-destructively combining a table containing a single weighted item (`t2`)
-- and an existing loot table containing one or more weighted items (`t1`).
newTable = {}
newItem = table.maxn(t2)
-- Copy the contents of the first table so that we don't modify the global version
for item, weight in pairs(t1) do
newTable[item] = weight
end
-- Add in our new item
newTable[newItem] = t2[newItem]
return newTable
end
-- Generate weighted loot tables now (on server init) so it doesn't have to be done at runtime
local w_rocksgems = convertToWeighted(sharedLoot.rocksgems)
local w_seedsracial =
{
[tpz.zone.YUHTUNGA_JUNGLE] = convertToWeighted(addLoot(sharedLoot.seeds, zoneData[tpz.zone.YUHTUNGA_JUNGLE].loot.racial)),
[tpz.zone.YHOATOR_JUNGLE] = convertToWeighted(addLoot(sharedLoot.seeds, zoneData[tpz.zone.YHOATOR_JUNGLE].loot.racial)),
[tpz.zone.WESTERN_ALTEPA_DESERT] = convertToWeighted(addLoot(sharedLoot.seeds, zoneData[tpz.zone.WESTERN_ALTEPA_DESERT].loot.racial))
}
local w_coins = convertToWeighted(sharedLoot.coins)
local w_sealsunique =
{
[tpz.zone.YUHTUNGA_JUNGLE] = convertToWeighted(addLoot(sharedLoot.seals, zoneData[tpz.zone.YUHTUNGA_JUNGLE].loot.unique)),
[tpz.zone.YHOATOR_JUNGLE] = convertToWeighted(addLoot(sharedLoot.seals, zoneData[tpz.zone.YHOATOR_JUNGLE].loot.unique)),
[tpz.zone.WESTERN_ALTEPA_DESERT] = convertToWeighted(addLoot(sharedLoot.seals, zoneData[tpz.zone.WESTERN_ALTEPA_DESERT].loot.unique)),
}
local function weightedRandomSelect(w_loot)
-- Takes a weighted loot table and returns a single random result
return w_loot[math.random(#w_loot)]
end
local function getAssignedDigSite(player)
-- Returns the player's assigned digsite for the zone they're currently in
return player:getCharVar(zoneData[player:getZoneID()].dsvar)
end
local function startMapMarkerEvent(eventid,player,digsiteids)
--[[ Map marker event notes:
Event 101 creates the "Treasure" map marker using coordinate args
Event 103 shows the "Treasure" map marker using coordinate args
Event 105, played on excavation, deletes the "Treasure" map marker
Parameters for events 101/103 are as follows:
1: zone id
2: unknown, seems static
3: (x position of qm) * 1000
4: (z position of qm) * 1000
5: unknown, dynamic
6: unknown, dynamic
7: unknown, seems static
8: unknown*, seems static (possibly y position of qm + 95)
Example: `player:startEvent(101, 123, 0, 369795, 201805, 0, 0, 0, 4095)`
...plays event 101 in Yuhtunga Jungle (zone 123), which creates a map marker
corresponding to the QM at position (369.795, 4.0, 201.805)
Full args from a retail capture for this point were:
101, 123, 32, 369795, 201805, 425920, 760, 529191, 4095
103, 123, 32, 369795, 201805, 308060, 1694, 529191, 4095 ]]--
local pos = GetNPCByID(digsiteids[getAssignedDigSite(player)]):getPos()
player:startEvent(eventid, player:getZoneID(), 0, pos.x * 1000, pos.z * 1000)
end
tpz.beastmentreasure.handleNpcOnTrigger = function(player,digsiteids)
local zd = zoneData[player:getZoneID()]
local status = player:getCharVar(zd.statusvar)
if not player:hasKeyItem(zd.mapid) then
player:startEvent(102) -- Peddlestox lectures you for not having a map
elseif status == QUEST_AVAILABLE then
player:startEvent(100) -- Peddlestox says go fetch
elseif status == QUEST_ACCEPTED then
player:startEvent(104) -- "What do I look like, a charity?"
elseif status == QUEST_COMPLETED then
-- Note: Quest will be "completed" after trading the correct items,
-- but will be set to available again after excavating the reward.
startMapMarkerEvent(103,player,digsiteids) -- Peddlestox reminds you where your digsite is
end
end
tpz.beastmentreasure.handleNpcOnTrade = function(player,trade,digsiteids)
local zd = zoneData[player:getZoneID()]
if player:getCharVar(zd.statusvar) == QUEST_ACCEPTED and npcUtil.tradeHasExactly(trade, zd.fetchitems) then
-- Assign a random dig site to the player
player:setCharVar(zd.dsvar, math.random(1,8))
startMapMarkerEvent(101,player,digsiteids) -- Peddlestox shows you where to dig
end
end
tpz.beastmentreasure.handleNpcOnEventFinish = function(player,csid)
local zd = zoneData[player:getZoneID()]
if csid == 100 then
player:addCharVar(zd.statusvar, QUEST_ACCEPTED)
elseif csid == 101 then
player:confirmTrade()
player:setCharVar(zd.statusvar, QUEST_COMPLETED)
end
end
tpz.beastmentreasure.updatePeddlestox = function(zone, peddlestox)
--[[ Allows Peddlestox to appear on the appropriate day and disappear when the day is over.
This function is called by each of the three zones where Peddlestox can appear: once on init,
and once at the start of each new game day. Since Peddlestox is disabled in the db by default, we
only need to enable her on the appropriate day and disable her on the following day. ]]--
local peddlestox = GetNPCByID(peddlestox)
if zoneData[zone].day == VanadielDayElement() then
peddlestox:setStatus(tpz.status.NORMAL)
elseif peddlestox:getStatus() == tpz.status.NORMAL then
--[[
TODO: Peddlestox should play a teleport animation and then fade out. On retail this is an 0x03A
packet with animation id 122. Currently 0x3A is not implemented in Topaz. Retail capture of
the correct animation packet is as follows:
| 0 1 2 3 4 5 6 7 8 9 A B C D E F | 0123456789ABCDEF
-----+---------------------------------------------------- -+------------------
0 | 3A 0A B5 00 67 B2 07 01 67 B2 07 01 67 02 67 02 | :...g...g...g.g.
10 | 7A 00 00 BF | z...
An incomplete but similar 0x38 animation can be achieved with `entityAnimationPacket("shwh")`
]]--
peddlestox:setStatus(tpz.status.DISAPPEAR)
end
end
tpz.beastmentreasure.handleQmOnTrigger = function(player,npc,buriedtext,nothingtext,digsiteids)
local digsiteid = digsiteids[getAssignedDigSite(player)]
local qmid = npc:getID()
if digsiteid == nil or digsiteid ~= qmid then
player:messageSpecial(nothingtext)
elseif digsiteid == qmid then
-- "It looks like something is buried here. If you had a <pickaxe> you could dig it up."
player:messageSpecial(buriedtext, 605)
end
end
tpz.beastmentreasure.handleQmOnTrade = function(player,npc,trade,digsiteids)
local zoneid = player:getZoneID()
local digsite = getAssignedDigSite(player)
if npcUtil.tradeHasExactly(trade, 605)
and player:getCharVar(zoneData[zoneid].statusvar) == QUEST_COMPLETED
and npc:getID() == digsiteids[digsite] then
--[[ Event 105 needs args to spawn and animate a treasure chest
Example args from retail capture: 105 123 450762 1745 201805 7 723 490292 4095
An arg in the 5th parameter will spawn and animate a chest somewhere in the zone
based on some internal list in the game files. For example, an arg of 7, as
in the retail capture above, will spawn and animate a chest at Yuhtunga Jungle
qm10. Chests will spawn at a static location regardless of whether or not
coordinates are passed in, and will always be rotated to face the player.
]]--
player:startEvent(105, zoneid, 0, 0, 0, digsite - 1)
end
end
tpz.beastmentreasure.handleQmOnEventFinish = function(player,csid)
local zoneid = player:getZoneID()
if csid == 105 then
-- Successfully excavating a dig site rewards 4000 gil plus the following items:
-- First reward is 1 item from the rocks and gems pool
local item1 = weightedRandomSelect(w_rocksgems)
-- Second reward is 1 item from a pool containing seeds and the zone's "racial" junk
local item2 = weightedRandomSelect(w_seedsracial[zoneid])
-- Third reward is a silver, gold, or mythril beastcoin
local item3 = weightedRandomSelect(w_coins)
-- Final reward is a seal or the region's exclusive item
local item4 = weightedRandomSelect(w_sealsunique[zoneid])
-- Distribute rewards
player:confirmTrade()
player:addGil(4000)
player:addTreasure(item1)
player:addTreasure(item2)
player:addTreasure(item3)
player:addTreasure(item4)
-- Reset player vars
player:setCharVar(zoneData[zoneid].statusvar, QUEST_AVAILABLE)
player:setCharVar(zoneData[zoneid].dsvar, 0)
end
end
tpz.bmt = tpz.beastmentreasure
|
--[[ tonum - a slightly better tonumber 002 ]]
local function tonum(v)
if type(v)=="boolean" then
return v and 1 or 0
end
return tonumber(v)
end
--[[ Bounds checking 003 ]]
-- replace the placeholders MIN_X, MAX_X, etc...
local function inbounds(x,y)
return x>=MIN_X and x<MAX_X and y>=MIN_Y and y<MAX_Y
end
local function outbounds(x,y)
return x<MIN_X and x>=MAX_X and y<MIN_Y and y>=MAX_Y
end
|
---
--- Created by Ray1184.
--- DateTime: 04/07/2021 17:04
---
--- Abstract 2D item on screen.
---
dependencies = { 'libs/utils/MathUtils.lua',
'libs/utils/Utils.lua' }
area_2d = {}
TYPE_CIRCLE = 0
TYPE_POLYGON = 1
function area_2d:new(type, data, x, y)
local this = {
type = type,
data = data,
x = x or 0,
y = y or 0
}
setmetatable(this, self)
self.__index = self
function area_2d:point_inside(px, py)
if self.type == TYPE_CIRCLE then
return point_inside_circle(px, py, self.x, self.y, data)
elseif self.type == TYPE_POLYGON then
return point_inside_polygon(px, py, self.x, self.y, data)
else
log_error('Only CIRCLE (0) and POLYGON (1) types are supported. Currently using: ' .. self.type)
return false
end
end
function area_2d:set_position(dx, dy)
self.x = dx
self.y = dy
end
return this
end
|
local shared = require("migrations.shared")
function create_all(stackable_items, stage_prefix, create_function)
for mod,items in pairs(stackable_items) do
if mods[mod] then
for _,item in pairs(items) do
if item.tech then
create_function(item.item, item.icon, item.tech)
else
create_function(item.item, item.icon, stage_prefix..item.stage)
end
end
end
end
end
if deadlock_stacking then
create_all(shared.STACKABLES, shared.STACKING_PREFIX, deadlock_stacking.create)
end
if deadlock_crating then
create_all(shared.STACKABLES, shared.CRATING_PREFIX, function(item, icon, tech) deadlock_crating.create(item, tech) end)
end
|
local serialize = require("serialize")
local filesystem = require("filesystem")
local requireUtils = require("require_utils")
local utils = {}
utils.serialize = serialize.serialize
utils.unserialize = serialize.unserialize
function utils.stripByteOrderMark(s)
if s:byte(1) == 0xef and s:byte(2) == 0xbb and s:byte(3) == 0xbf then
return s:sub(4, #s)
end
return s
end
function utils.rectangle(x, y, width, height)
return {x = x, y = y, width = width, height = height}
end
function utils.point(x, y)
return {x = x, y = y, width = 1, height = 1}
end
function utils.aabbCheck(r1, r2)
return not (r2.x >= r1.x + r1.width or r2.x + r2.width <= r1.x or r2.y >= r1.y + r1.height or r2.y + r2.height <= r1.y)
end
function utils.getFileHandle(path, mode, internal)
if internal then
return love.filesystem.newFile(path, mode:gsub("b", ""))
else
return io.open(path, mode)
end
end
function utils.readAll(path, mode, internal)
local file = utils.getFileHandle(path, mode or "rb", internal)
if file then
local res = internal and file:read() or file:read("*a")
file:close()
return res
end
end
function utils.trim(s)
return string.match(s, "^%s*(.*%S)") or ""
end
function utils.humanizeVariableName(name)
local res = name
res := gsub("_", " ")
res := gsub("/", " ")
res := gsub("(%l)(%u)", function(a, b) return a .. " " .. b end)
res := gsub("(%a)(%a*)", function(a, b) return string.upper(a) .. b end)
res := gsub("%s+", " ")
res := match("^%s*(.*)%s*$")
return res
end
function utils.parseHexColor(color)
color := match("^#?([0-9a-fA-F]+)$")
if color and #color == 6 then
local number = tonumber(color, 16)
local r, g, b = number / 256^2 % 256, number / 256 % 256, number % 256
return true, r / 255, g / 255, b / 255
end
return false, 0, 0, 0
end
function utils.typeof(v)
local typ = type(v)
if typ == "table" and v._type then
return v._type
else
return typ
end
end
function utils.group(t, by)
local res = {}
for k, v <- t do
local key = by(k, v)
res[key] = res[key] or {}
table.insert(res[key], v)
end
return res
end
utils.countKeys = serialize.countKeys
-- Return the 1 index based tile indices for the coordinates
function utils.pixelsToTiles(x, y)
return math.floor(x / 8) + 1, math.floor(y / 8) + 1
end
function utils.getRoomAtCoords(x, y, map)
for i, room <- map.rooms do
if x >= room.x and x <= room.x + room.width and y >= room.y and y <= room.y + room.height then
return room
end
end
return false
end
function utils.mod1(n, d)
local m = n % d
return m == 0 and d or m
end
function utils.setRandomSeed(v)
if type(v) == "number" then
math.randomseed(v)
elseif type(v) == "string" and #v >= 1 then
local s = string.byte(v, 1)
for i = 2, #v do
s *= 256
s += string.byte(v)
end
math.randomseed(s)
end
end
function utils.deepcopy(v)
if type(v) == "table" then
local res = {}
for key, value <- v do
res[key] = utils.deepcopy(value)
end
return res
else
return v
end
end
function utils.clamp(value, min, max)
return math.min(math.max(value, min), max)
end
-- Add all of require utils into utils
for k, v <- requireUtils do
utils[k] = v
end
-- Add all of filesystem helper into utils
for k, v <- filesystem do
utils[k] = v
end
-- Add filesystem specific helper methods
local osFilename = love.system.getOS():lower():gsub(" ", "_")
local osHelper = require("os_helpers." .. osFilename)
function utils.getProcessId()
return osHelper.getProcessId and osHelper.getProcessId()
end
return utils
|
function Initialize(a_Plugin)
a_Plugin:SetName(g_PluginInfo.Name)
a_Plugin:SetVersion(g_PluginInfo.Version)
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_TICK, TickCatastrophes)
-- Load all the known catastrophes into g_Catastrophes.
LoadCatastrophes()
-- Load the configuration
InitializeConfiguration(a_Plugin:GetLocalFolder() .. "/config.cfg")
-- Initializes the natural catastrophe spawner
InitializeSpawner()
-- Load the InfoReg library file for registering the Info.lua command table:
dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")
-- Register commands:
RegisterPluginInfoCommands()
LOG(g_PluginInfo.Name .. " v." .. g_PluginInfo.Version .. " has initialized")
return true
end
|
Global( "PlayerAFK", {} )
function PlayerAFK:Init(anID)
self.playerID = anID
self.unitParams = {}
self.isAfk = false
self.lastAfk = -1
self.eventFunc = self:GetEventFunc()
self.base = copyTable(PlayerBase)
self.base:Init()
self:RegisterEvent(anID)
end
function PlayerAFK:ClearLastValues()
self.lastAfk = -1
end
function PlayerAFK:SubscribeTargetGui(aLitener)
-- self:ClearLastValues()
-- self.base:SubscribeTargetGui(self.playerID, aLitener, self.eventFunc)
end
function PlayerAFK:UnsubscribeTargetGui()
-- self.base:UnsubscribeTargetGui()
end
function PlayerAFK:SubscribeRaidGui(aLitener)
self:ClearLastValues()
self.base:SubscribeRaidGui(self.playerID, aLitener, self.eventFunc)
end
function PlayerAFK:UnsubscribeRaidGui()
self.base:UnsubscribeRaidGui()
end
function PlayerAFK:TryDestroy()
if self.base:CanDestroy() then
self:UnRegisterEvent()
return true
end
return false
end
function PlayerAFK:UpdateValueIfNeeded()
if self.isAfk ~= self.lastAfk then
self.lastAfk = self.isAfk
local res = self.base.guiRaidListener and self.base.guiRaidListener.listenerAfk(self.isAfk, self.base.guiRaidListener)
res = self.base.guiTargetListener and self.base.guiTargetListener.listenerAfk(self.isAfk, self.base.guiTargetListener)
end
end
function PlayerAFK:GetEventFunc()
return function(aParams)
self.isAfk = aParams.isAfk
if aParams.isAfk == nil and aParams.unitId and isExist(aParams.unitId) and unit.IsPlayer(aParams.unitId) then
self.isAfk = unit.IsAfk(aParams.unitId)
end
end
end
function PlayerAFK:RegisterEvent(anID)
end
function PlayerAFK:UnRegisterEvent()
end
|
-----------------------------------
-- Area: Zhayolm Remnants
-- NM: Battleclad Chariot
-----------------------------------
require("scripts/globals/titles")
-----------------------------------
function onMobDeath(mob, player, isKiller)
player:addTitle(tpz.title.STAR_CHARIOTEER)
end
|
fx_version 'bodacious'
games { 'gta5' }
ui_page 'html/index.html'
client_scripts {
'client/storage.lua',
'client/main.lua'
}
files {
'html/index.html',
'html/style.css',
'html/main.js'
}
|
---=====================================
---th style boss
---=====================================
----------------------------------------
---boss base
---@class boss @东方风boss
boss = Class(enemybase)
function boss:init(x, y, name, cards, bg, diff)
enemybase.init(self,999999999)
self.x = x
self.y = y
self.img = 'undefined'
--boss魔法阵
self.aura_alpha = 255 --法阵透明度
self.aura_alpha_d = 4 --法阵透明度单帧变化值
self.aura_scale = 1 --法阵大小比例
--boss系统
self._bosssys = BossSystem(self, name, cards, bg, diff)
--boss行走图系统
self._wisys = BossWalkImageSystem(self)
self._wisys:SetFloat(function(ani)
return 0, 4 * sin(ani * 4)
end)
--boss ex
if self.ex == nil then
Kill(self) --开始执行通常符卡系统
end
ex.AddBoss(self) --加入ex的boss表中
lstg.tmpvar.boss = self
end
function boss:frame()
--出屏判定关闭
SetAttr(self, 'colli', BoxCheck(self, lstg.world.boundl, lstg.world.boundr, lstg.world.boundb, lstg.world.boundt) and self._colli)
--血量下限
self.hp = max(0, self.hp)
--符卡系统检查hp
self._bosssys:CheckHP()
--执行自身task
self._bosssys:DoTask()
--行走图系统帧逻辑
self._wisys:frame()
--受击闪烁
if self.dmgt then
self.dmgt = max(0, self.dmgt - 1)
end
--boss系统帧逻辑
self._bosssys:frame()
--魔法阵透明度更新
self.aura_alpha = self.aura_alpha + self.aura_alpha_d
self.aura_alpha = min(max(0, self.aura_alpha), 128)
end
function boss:render()
for i=1,25 do
SetImageState('boss_aura_3D'..i, 'mul+add', Color(self.aura_alpha, 255, 255, 255))
end
Render('boss_aura_3D'..self.ani % 25 + 1, self.x, self.y, self.ani * 0.75, 0.92 * self.aura_scale, (0.8 + 0.12 * cos(self.ani * 0.75)) * self.aura_scale)
self._bosssys:render()
self._wisys:render(self.dmgt, self.dmgmaxt) --by OLC,行走图系统
end
function boss:kill()
_kill_servants(self)
self._bosssys:kill()
--boss行为更新
if self.ex then --执行boss ex逻辑时不执行boss逻辑
do return end
elseif self._bosssys:next() then --切换到下一个行为
PreserveObject(self)
else --没有下一个行为了,清除自身和附属的组件
boss.del(self)
end
end
function boss:del()
self._bosssys:del()
if self.class.defeat then self.class.defeat(self) end
ex.RemoveBoss(self)
end
----------------------------------------
---boss函数库和资源
local patch="Thlib\\enemy\\"
LoadTexture('boss',patch..'boss.png')
LoadImageGroup('bossring1','boss',80,0,16,8,1,16)
for i=1,16 do SetImageState('bossring1'..i,'mul+add',Color(0x80FFFFFF)) end
LoadImageGroup('bossring2','boss',48,0,16,8,1,16)
for i=1,16 do SetImageState('bossring2'..i,'mul+add',Color(0x80FFFFFF)) end
LoadImage('spell_card_ef','boss',96,0,16,128)
LoadImage('hpbar','boss',116,0,8,128)
--LoadImage('hpbar1','boss',116,0,2,2)
LoadImage('hpbar2','boss',116,0,2,2)
SetImageCenter('hpbar',0,0)
LoadTexture('undefined',patch..'undefined.png')
LoadImage('undefined','undefined',0,0,128,128,16,16)
SetImageState('undefined','mul+add',Color(0x80FFFFFF))
LoadImageFromFile('base_hp',patch..'ring00.png')
SetImageState('base_hp','',Color(0xFFFF0000))
LoadTexture('lifebar',patch..'lifebar.png')
LoadImage('life_node','lifebar',20,0,12,16)
LoadImage('hpbar1','lifebar',4,0,2,2)
SetImageState('hpbar1','',Color(0xFFFFFFFF))
SetImageState('hpbar2','',Color(0x77D5CFFF))
LoadTexture('magicsquare',patch..'eff_magicsquare.png')
LoadImageGroup('boss_aura_3D','magicsquare',0,0,256,256,5,5)
LoadImageFromFile('dialog_box',patch..'dialog_box.png')
Include(patch.."boss_system.lua")--boss行为逻辑
Include(patch.."boss_function.lua")--boss额外函数
Include(patch.."boss_card.lua")--boss非符、符卡
Include(patch.."boss_dialog.lua")--boss对话
Include(patch.."boss_other.lua")--杂项、boss移动、特效
Include(patch.."boss_ui.lua")--boss ui
|
#!/usr/bin/env lua
package.path = '../src/?.lua;' .. package.path
local split = require 'split'
local spliter = split.spliterator
local each = split.each
local t = require 'tapered'
local str, expected, actual
t.same(spliter, each, "spliterator should be an alias for each.")
str = 'a,foo,bar,bizz,buzz,,b'
expected = { 'a', 'foo', 'bar', 'bizz', 'buzz', '', 'b' }
actual = {}
for p in each(str, ',') do
actual[#actual + 1] = p
end
t.same(actual, expected, "each(str, ',') should iterate over the string.")
str = 'a foo bar bizz buzz b'
expected = { 'a', 'foo', 'bar', 'bizz', 'buzz', 'b' }
actual = {}
for p in each(str) do
actual[#actual + 1] = p
end
t.same(actual, expected, "each(str) should properly handle nil delimiter.")
str = 'foo'
expected = { 'f', 'o', 'o' }
actual = {}
for p in each(str, '') do
actual[#actual + 1] = p
end
t.same(actual, expected, "each(str, '') should iterate over each character.")
str = 'f.o.o'
expected = { 'f', 'o', 'o' }
actual = {}
for p in each(str, '%.') do
actual[#actual + 1] = p
end
t.same(actual, expected, "each(str, '%.') should split on a literal period.")
str = ',foo,bar,bizz,buzz,,'
expected = { 'zzz', 'zzzfoo', 'zzzbar', 'zzzbizz', 'zzzbuzz', 'zzz', 'zzz' }
actual = {}
for p in each(str, ',') do
actual[#actual + 1] = 'zzz' .. p
end
t.same(actual, expected,
"each(str, ',') should be able to change returned items.")
str = ''
expected = {}
actual = {}
for p in each(str, '|') do
actual[#actual + 1] = p
end
t.same(actual, expected, "each('', '|') should return no results.")
str = 'foobar'
expected = { 'foobar' }
actual = {}
for p in each(str, '|') do
actual[#actual + 1] = p
end
t.is(#actual, 1, "each('foobar', '|') should yield one item.")
t.same(actual, expected, "each('foobar', '|') should return { 'foobar' }.")
local explode = function (pat)
for _ in each('foo', pat) do
end
end
t.boom(explode,{'%d*'}, "Deviant pattern should throw error in each.")
t.done()
|
--[[
Do MD5 sumcheck of Arduino bootloader .hex file
Nick Gammon
5 May 2012
Amended 10 October 2014, to get PROGMEM line right for IDE 1.5.8
To use:
1. Download MUSHclient from: http://www.gammon.com.au/downloads/dlmushclient.htm
MUSHclient is free and open source.
Source code at: https://github.com/nickgammon/mushclient
You are not required to enter any personal information to obtain the download.
2. Install MUSHclient (requires Windows, or Wine on Linx and OS/X)
3. Run MUSHclient (click past all the introductory screens)
4. Make a "new world" in MUSHclient (File menu -> New World)
5. Fill in the fields:
World name: Arduino (doesn't really matter what it is)
TCP/IP address: 0.0.0.0
Port: 4000 (doesn't really matter what it is)
6. A window will open with various messages about the version number, etc.
7. Open an Immediate scripting window (Game menu -> Immediate).
Pressing Ctrl+I is a shortcut for this.
8. Copy this script and paste it into the Immediate window (RH-click to do this)
9. Click the Run button.
10. Navigate to the bootloader .hex file that you want to process.
11. Click "Open".
12. Assuming no errors, close the Immediate window.
13. In the output window you should see a whole lot of hex codes.
14. Scroll back to the line of hyphens, and copy from the line below that, eg.
------------------------------------------------------------
// File = Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex
// Loader start: 3000, length: 4096
// MD5 sum = D8 8C 70 6D FE 1F DC 38 82 1E CE AE 23 B2 E6 E7
const byte Arduino_COMBINED_dfu_usbserial_atmega16u2_Uno_Rev3_hex [] PROGMEM = {
0x4B, 0xC0, 0x00, 0x00, 0x64, 0xC0, 0x00, 0x00, 0x62, 0xC0, 0x00, 0x00, 0x60, 0xC0, 0x00, 0x00,
...
}; // end of <whatever your file name was>
That stuff is your bootloader as an array of bytes.
--]]
require "getlines"
loader = nil
adder = 0
-- given a start address, deduce where the bootloader ends
end_addresses = {
[0x1000] = 0x2000,
[0x1C00] = 0x2000,
[0x1D00] = 0x2000,
[0x1E00] = 0x2000,
[0x3000] = 0x4000,
[0x3800] = 0x4000,
[0x3E00] = 0x4000,
[0x7000] = 0x8000,
[0x7800] = 0x8000,
[0x7E00] = 0x8000,
[0xF800] = 0x10000,
[0x1F000] = 0x20000,
[0x1FC00] = 0x20000,
[0x3E000] = 0x40000,
}
function process (size, address, rectype, data)
size = tonumber (size, 16)
address = tonumber (address, 16) + adder
rectype = tonumber (rectype)
local binarydata = utils.fromhex (data)
if rectype == 2 then -- Extended Segment Address Record
adder = tonumber (data, 16) * 16 -- high order address byte
elseif rectype == 0 then -- data record
if loader == nil then
start_address = address
end_address = end_addresses [address]
if end_address == nil then
ColourNote ("red", "", "Don't know end address for " .. bit.tostring (address, 16))
ColourNote ("red", "", "Please add to table: end_addresses")
error "Cannot continue"
end -- if end address not found
-- work out loader length
length = end_address - address
-- pre-fill with 0xFF in case not every byte supplied
loader = string.rep ("\255", length)
print (string.format ("// Loader start: %X, length: %i", address, length))
end -- no loader yet
-- insert data over where the 0xFF was
if address >= start_address and (address + size) <= end_address then
loader = loader:sub (1, address - start_address) ..
binarydata ..
loader:sub (address - start_address + size + 1, length)
else
ColourNote ("red", "", "Address " .. bit.tostring (address, 16) .. " out of expected range.")
end -- if in range
end -- if
end -- function process
print (string.rep ("-", 60))
-- get bootloader file
filename = utils.filepicker ("Choose a bootloader", nil, "hex", { hex = "Hex files" })
-- none chosen, give up
if not filename then return end
-- show file
local fn = string.match (filename, "\\([^\\]+)$")
print ("// File = ", fn)
-- process each line
for line in io.lines (filename) do
size, address, rectype, data = string.match (line, "^:(%x%x)(%x%x%x%x)(%x%x)(%x+)%s*$")
if size then
process (size, address, rectype, data:sub (1, -3))
else
ColourNote ("red", "", "Discarded line: " .. line)
end -- if
end -- for loop
--print (utils.tohex (loader))
-- sumcheck it
Tell ("// MD5 sum = ")
md5sum = utils.tohex (utils.md5 (loader))
print ((string.gsub (md5sum, "(%x%x)", "%1 ")))
print ""
-- show bootloader in hex
-- convert into C array
print (string.format ("const byte %s [] PROGMEM = {",
string.gsub (fn, "[^%a%d]", "_")))
for i = 1, #loader do
Tell (string.format ("0x%02X, ", loader:sub (i, i):byte ()))
if (i - 1) % 16 == 15 then print "" end
end -- of for each byte
print (string.format ("}; // end of %s", string.gsub (fn, "[^%a%d]", "_")))
|
local PANEL = {}
local function TextSize(font, text)
surface.SetFont(font)
return surface.GetTextSize(text)
end
function PANEL:Init()
local Frame = self
self:SetTitle( "" )
self:SetVisible(true)
self:SetDraggable(false)
self:SetBackgroundBlur(true)
self:ShowCloseButton(false)
self.Font = "ZEDFont40"
self.BackgroundColor = Color(40, 40, 40, 255)
local w,h = TextSize(self.Font, "X")
self.CloseButton = vgui.Create( "ZButton", self )
self.CloseButton:SetPos( 0, 0 )
self.CloseButton:SetText( "X" )
self.CloseButton:SetFont( self.Font )
self.CloseButton:SetSize(w,h)
self.CloseButton.DoClick = function()
Frame:Close()
if type(Frame.onClose) == "function" then
Frame:onClose()
end
end
end
function PANEL:SetFont(c)
self.CloseButton:SetFont(c)
end
function PANEL:GetFont()
return self.CloseButton:GetFont()
end
function PANEL:SetBackgroundColor(c)
self.BackgroundColor = c
end
function PANEL:GetBackgroundColor()
return self.BackgroundColor
end
function PANEL:Paint()
surface.SetDrawColor( self:GetBackgroundColor() )
surface.DrawRect( 0, 0, self:GetWide(), self:GetTall() )
end
function PANEL:PerformLayout()
self.BaseClass.PerformLayout(self);
w,h = TextSize(self.CloseButton:GetFont(), "X")
self.CloseButton:SetPos( self:GetWide() - w*1.2, 0 )
self.CloseButton:SetFont( "ZEDFont40" )
self.CloseButton:SetSize(w,h)
end
vgui.Register("ZFrame",PANEL,"DFrame");
|
local Spell = { }
Spell.LearnTime = 900
Spell.Description = [[
Rips your target's
body with demonic harpoons.
100% brutal.
]]
Spell.FlyEffect = "hpw_dragoner_main"
Spell.ApplyDelay = 0.6
Spell.AccuracyDecreaseVal = 0.4
Spell.Category = HpwRewrite.CategoryNames.Special
Spell.SpriteColor = Color(155, 255, 155)
Spell.NodeOffset = Vector(-332, -890, 0)
Spell.ForceAnim = { ACT_VM_PRIMARYATTACK_5 }
if SERVER then
util.AddNetworkString("hpwrewrite_winborium_handler")
else
local max = 2^32
local function spawn(mdl, pos, dir)
util.PrecacheModel(mdl)
local myPos = pos + VectorRand() * 25
local prop = ents.CreateClientProp()
prop:SetModel(mdl)
prop:SetPos(myPos)
prop:SetAngles((pos - myPos):Angle())
prop:Spawn()
prop:PhysicsInit(SOLID_VPHYSICS)
prop:SetSolid(SOLID_VPHYSICS)
prop:SetMoveType(MOVETYPE_VPHYSICS)
prop:SetRenderMode(RENDERMODE_TRANSALPHA)
local decay = math.random(400, 800)
local alpha = 255
local dir = AngleRand()
local name = "hpwrewrite_winborium_handler" .. math.random(-max, max)
hook.Add("Think", name, function()
if not IsValid(prop) then hook.Remove("Think", name) return end
prop:SetPos(prop:GetPos() + (dir and prop:GetForward() or prop:GetUp()) * FrameTime() * 350)
prop:SetAngles(prop:GetAngles() + dir * FrameTime() * 7)
prop:SetColor(Color(255, 0, 0, alpha))
alpha = alpha - FrameTime() * decay
if alpha <= 0 then prop:Remove() end
end)
end
net.Receive("hpwrewrite_winborium_handler", function()
local pos = net.ReadVector()
for i = 1, 20 do
spawn("models/weapons/w_knife_t.mdl", pos)
end
for i = 1, 8 do
spawn("models/props_junk/harpoon002a.mdl", pos, true)
end
end)
end
function Spell:Draw(spell)
self:DrawGlow(spell)
end
function Spell:OnSpellSpawned(wand, spell)
wand:PlayCastSound()
end
function Spell:OnFire(wand)
return true
end
function Spell:AfterCollide(spell, data, doef)
local dir = IsValid(spell) and spell:GetFlyDirection() or vector_origin
local ent = data.HitEntity
local rag, func, tName, hName = HpwRewrite:ThrowEntity(ent, -dir, 3000, 3, self.Owner)
if IsValid(rag) then
if hName then hook.Remove("EntityTakeDamage", hName) end
net.Start("hpwrewrite_winborium_handler")
net.WriteVector(rag:GetPos() - dir * 100)
net.Broadcast()
local name = "hpwrewrite_winborium_handler" .. rag:EntIndex()
timer.Create(name, 0.2, 1, function()
if IsValid(rag) then
net.Start("hpwrewrite_winborium_handler")
net.WriteVector(rag:GetPos())
net.Broadcast()
sound.Play("physics/flesh/flesh_bloody_break.wav", rag:GetPos(), 70)
for i = 0, rag:GetBoneCount() - 1 do
local pos, ang = rag:GetBonePosition(i)
local ef = EffectData()
ef:SetOrigin(pos)
util.Effect("BloodImpact", ef, true, true)
if math.random(1, 2) == 1 then
sound.Play("physics/flesh/flesh_squishy_impact_hard" .. math.random(1, 4) .. ".wav", pos, 69)
end
end
local newEnt = func()
if IsValid(newEnt) then
if newEnt:IsNPC() then
newEnt:Remove()
elseif newEnt:IsPlayer() then
newEnt:TakeDamage(newEnt:Health(), self.Owner, HpwRewrite:GetWand(self.Owner))
SafeRemoveEntity(newEnt:GetRagdollEntity())
end
end
end
end)
else
if doef == nil then doef = true end
if doef then
local ef = EffectData()
ef:SetOrigin(data.HitPos)
ef:SetNormal(data.HitNormal)
util.Effect("EffectHpwRewriteSmoke", ef, true, true)
end
end
end
HpwRewrite:AddSpell("Winborium", Spell)
-- Duo
local Spell = { }
Spell.Base = "Winborium"
Spell.LearnTime = 1020
Spell.OnlyIfLearned = { "Winborium", "Gonfiare" }
Spell.NodeOffset = Vector(-227, -993, 0)
Spell.ForceAnim = { ACT_VM_PRIMARYATTACK_1 }
Spell.DoSparks = true
Spell.Description = [[
Rips bodies of everyone
who is close to spell impact.
100% brutal.
]]
function Spell:AfterCollide(spell, data)
local ef = true
for k, v in pairs(ents.FindInSphere(data.HitPos, 200)) do
if not (v:IsNPC() or v:IsPlayer()) then continue end
data.HitEntity = v
self.BaseClass.AfterCollide(self, spell, data, ef)
ef = false
end
end
HpwRewrite:AddSpell("Winborium Duo", Spell)
-- Holy shit
local Spell = { }
Spell.Base = "Winborium"
Spell.LearnTime = 1350
Spell.OnlyIfLearned = { "Winborium Duo" }
Spell.NodeOffset = Vector(-214, -1124, 0)
Spell.ForceAnim = { ACT_VM_PRIMARYATTACK_4 }
Spell.DoSparks = true
Spell.Description = [[
Kills everyone around you
in a big radius.
]]
function Spell:OnFire()
for k, v in pairs(ents.FindInSphere(self.Owner:GetPos(), 500)) do
if v == self.Owner or not (v:IsNPC() or v:IsPlayer()) then continue end
local data = { }
data.HitPos = v:GetPos()
data.HitNormal = vector_origin
data.HitEntity = v
self.BaseClass.AfterCollide(self, nil, data)
end
end
HpwRewrite:AddSpell("Winborium Maxima", Spell)
|
-- Copyright (C) 2018-2020 DBotThePony
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-- of the Software, and to permit persons to whom the Software is furnished to do so,
-- subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all copies
-- or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
gui.misc.apply = 'Применить'
gui.misc.cancel = 'Отмена'
gui.misc.yes = 'Да'
gui.misc.no = 'Нет'
gui.entry.invalidsymbol = 'Символ не разрешён.'
gui.entry.limit = 'Превышена максимальная длинна значения.'
gui.dlib.hudcommons.reset = 'Сбросить'
info.dlib.tformat.seconds = 'секунд'
info.dlib.tformat.minutes = 'минут'
info.dlib.tformat.hours = 'часов'
info.dlib.tformat.days = 'дней'
info.dlib.tformat.weeks = 'недель'
info.dlib.tformat.months = 'месяцев'
info.dlib.tformat.years = 'лет'
info.dlib.tformat.centuries = 'веков'
info.dlib.tformat.long = 'Никогда™'
info.dlib.tformat.now = 'Прямо сейчас'
info.dlib.tformat.past = 'В прошлом'
local function define(from, to, target, form1, form2, form3)
for i = from, to do
local div = i % 10
if i == 0 or i > 9 and i < 19 or div > 4 or div == 0 then
target[tostring(i)] = i .. ' ' .. form1
elseif div == 1 then
target[tostring(i)] = i .. ' ' .. form2
elseif div == 2 or div == 3 or div == 4 then
target[tostring(i)] = i .. ' ' .. form3
end
end
end
define(1, 60, info.dlib.tformat.countable.second, 'секунд', 'секунда', 'секунды')
define(1, 60, info.dlib.tformat.countable.minute, 'минут', 'минута', 'минуты')
define(1, 24, info.dlib.tformat.countable.hour, 'часов', 'час', 'часа')
define(1, 7, info.dlib.tformat.countable.day, 'день', 'дня', 'дней')
define(1, 4, info.dlib.tformat.countable.week, 'неделя', 'недели', 'недель')
define(1, 12, info.dlib.tformat.countable.month, 'месяц', 'месяца', 'месяцев')
define(1, 100, info.dlib.tformat.countable.year, 'год', 'года', 'лет')
define(1, 100, info.dlib.tformat.countable.century, 'век', 'века', 'веков')
define(1, 60, info.dlib.tformat.countable_ago.second, 'секунд', 'секунду', 'секунды')
define(1, 60, info.dlib.tformat.countable_ago.minute, 'минут', 'минуту', 'минуты')
define(1, 24, info.dlib.tformat.countable_ago.hour, 'часов', 'час', 'часа')
define(1, 7, info.dlib.tformat.countable_ago.day, 'дней', 'день', 'дня')
define(1, 4, info.dlib.tformat.countable_ago.week, 'недель', 'неделю', 'недели')
define(1, 12, info.dlib.tformat.countable_ago.month, 'месяцев', 'месяц', 'месяца')
define(1, 100, info.dlib.tformat.countable_ago.year, 'лет', 'год', 'года')
define(1, 100, info.dlib.tformat.countable_ago.century, 'веков', 'век', 'века')
info.dlib.tformat.ago = '%s тому назад'
info.dlib.tformat.ago_inv = 'Через %s'
gui.dlib.friends.title = 'DLib друзья'
gui.dlib.friends.open = 'Отрыть меню друзей'
gui.dlib.friends.edit.add_title = 'Добавление %s <%s> как друга'
gui.dlib.friends.edit.edit_title = 'Редактирование настроек друга %s <%s>'
gui.dlib.friends.edit.going = 'Вы будете другом с %s в...'
gui.dlib.friends.edit.youare = 'Вы являетесь другом с %s в...'
gui.dlib.friends.edit.remove = 'Удалить друга'
gui.dlib.friends.invalid.title = 'Неверный SteamID'
gui.dlib.friends.invalid.ok = 'Окай :('
gui.dlib.friends.invalid.desc = '%q не выглядит как SteamID!'
gui.dlib.friends.settings.steam = 'Считать Steam друзей как DLib друзей'
gui.dlib.friends.settings.your = 'Ваши друзья ->'
gui.dlib.friends.settings.server = 'Игроки на сервере ->'
gui.dlib.friends.settings.foreign = '[Внешний] '
gui.dlib.donate.top = 'DLib: Сделаете пожертвование?'
gui.dlib.donate.button.yes = 'Так и сделать (Яндекс.Деньги)!'
gui.dlib.donate.button.paypal = 'Так и сделать, только на PayPal!'
gui.dlib.donate.button.no = 'Спросить меня позже'
gui.dlib.donate.button.never = 'Больше никогда не спрашивать'
gui.dlib.donate.button.learnabout = 'Прочитать про "Donationware"...'
gui.dlib.donate.button.learnabout_url = 'https://ru.wikipedia.org/wiki/Donationware'
message.dlib.hudcommons.edit.notice = 'Нажмите ESC для выхода из режима редактирования'
gui.dlib.donate.text = [[Привет! Как я вижу, Вы были долго не за клавиатурой, чтож... Я хотел бы Вас попросить:
Сделайте пожалуйста пожертвование! DLib как и аддоны котороые базируются на нем являются Donationware
Тоесть, данное ПО существует только из-за энтузиазма и (возможно) регулярных пожертвований пользователей
для поддержания автора данного ПО! Я понимаю, что времена сейчас тугие, и не прошу вас "Пожертвуй сейчас!"
Но хотел что бы Вы хотя бы прочитали данное обращение. Как вы знаете - что к примеру 50₽ это мало,
примерно столько же стоит проезд в автобусе в Москве, но давайте вдумаемся в статистику: если сейчас
абсолютно все, кто использует DLib и другие аддоны пожертвуют 50₽ каждый, то этого будет достаточно
что бы покрыть все кредиты моих родителей, а так же помочь моей Матери, которая работает с 5 утра до 22 вечера
ради того, что бы придти потом домой поспать и не высыпаться на следующий рабочий день.
Если вы сделаете пожертвование, это окажет помощь следующим аддонам, которые используются:
DLib%s]]
gui.dlib.donate.more = ' и еще %i аддонов!..'
|
------------------------------------------------
----[ COMMANDS ]------------------------
------------------------------------------------
local Commands = SS.Commands:New("Commands")
// Commands command
function Commands.Command(Player, Args)
local Panel = SS.Panel:New(Player, "Commands")
for K, V in pairs(SS.Commands.List) do
if (SS.Flags.PlayerHas(Player, V.Restrict)) then
Panel:Button(SS.Commands.Prefix()..K, 'ss commandscommand "'..K..'"')
end
end
Panel:Send()
end
// View command
function Commands.View(Player, Args)
for K, V in pairs(SS.Commands.List) do
if (K == Args[1]) then
local Panel = SS.Panel:New(Player, SS.Commands.Prefix()..K)
Panel:Words("Help: "..V.Help)
Panel:Words("Syntax: "..V.Syntax)
Panel:Send()
return
end
end
SS.PlayerMessage(Player, "No command found: '"..Args[1].."'", 1)
end
SS.ConsoleCommand.Simple("commandscommand", Commands.View, 1)
Commands:Create(Commands.Command, {"basic"}, "View commands you can do")
SS.Adverts.Add("Type "..SS.Commands.Prefix().."commands to see what commands you can do")
|
local ThreatLib = LibStub and LibStub("ThreatClassic-1.0", true)
if not ThreatLib then return end
if select(2, _G.UnitClass("player")) ~= "SHAMAN" then return end
local _G = _G
local ipairs = _G.ipairs
local select = _G.select
local GetTalentInfo = _G.GetTalentInfo
local Shaman = ThreatLib:GetOrCreateModule("Player")
local healingSpellIDs = {
-- Lesser Healing Wave
8004, 8008, 8010, 10466, 10467, 10468,
-- Healing Wave
331, 332, 547, 913, 939, 959, 8005, 10395, 10396, 25357,
-- Chain Heal
1064, 10622, 10623,
}
local clIDs = {
-- Chain Lightning
421, 930, 2860, 10605
}
local lbIDs = {
-- Lightning Bolt
403, 529, 548, 915, 943, 6041, 10391, 10392, 15207, 15208
}
local earthShockIDs = { 8042, 8044, 8045, 8046, 10412, 10413, 10414 }
function Shaman:ClassInit()
-- ThreatMods should return the modifications (if any) to the threat passed in
for _,v in ipairs(healingSpellIDs) do
self.AbilityHandlers[v] = self.HealingSpells
end
healingSpellIDs = nil
for _, v in ipairs(earthShockIDs) do
self.AbilityHandlers[v] = self.EarthShock
end
earthShockIDs = nil
for _,v in ipairs(clIDs) do
self.AbilityHandlers[v] = self.ChainLightning
self.CastMissHandlers[v] = self.ChainLightningMiss
self.CastHandlers[v] = self.StartCLCast
end
clIDs = nil
for _,v in ipairs(lbIDs) do
self.AbilityHandlers[v] = self.LightningBolt
self.CastMissHandlers[v] = self.LightningBoltMiss
self.CastHandlers[v] = self.StartLBCast
end
lbIDs = nil
self.lastCLCast = 0
self.lastCLHitTime = 0
self.lastLBCast = 0
self.lastLBHitTime = 0
end
function Shaman:ClassEnable()
self.passiveThreatModifiers = 1
end
function Shaman:ScanTalents()
-- Scan talents
if ThreatLib.Classic then
self.HealingGrace = 1 - 0.05 * select(5, GetTalentInfo(3,9))
else
self.HealingGrace = 1 -- for when testing in retail
end
end
function Shaman:HealingSpells(amt)
return amt * self.HealingGrace
end
function Shaman:EarthShock(amt)
return amt * 2
end
function Shaman:ChainLightning(amt)
local t = GetTime()
if self.lastCLHitTime == 0 then
self.lastCLHitTime = t
end
if t - self.lastCLHitTime <= 0.045 then
return amt
else
return 0
end
end
function Shaman:LightningBolt(amt)
ThreatLib:Debug("Lightning bolt damage!")
if self.lastLBHitTime == 0 then
self.lastLBHitTime = GetTime()
return amt
else
return 0
end
end
function Shaman:ChainLightningMiss(spellID)
local t = GetTime()
if self.lastCLHitTime == 0 then
self.lastCLHitTime = t
end
end
function Shaman:LightningBoltMiss(spellID)
ThreatLib:Debug("Missed lightning bolt! (%s)", spellID)
local t = GetTime()
if self.lastLBHitTime == 0 then
self.lastLBHitTime = t
end
end
function Shaman:StartCLCast()
self.lastCLCast = GetTime()
self.lastCLHitTime = 0
end
function Shaman:StartLBCast()
ThreatLib:Debug("Casting Lightning bolt...")
self.lastLBCast = GetTime()
self.lastLBHitTime = 0
end
|
engine = {}
local engine_mt = {__index = engine}
function engine.new(...)
local ret = setmetatable({}, engine_mt)
ret:init(...)
return ret
end
function engine:init()
self.sprites = {}
self.controls = {}
end
function engine:add_control(control)
table.insert(self.controls, control)
if control.add then
control:add(self)
end
end
function engine:rm_control(control)
for key, val in ipairs(self.controls) do
if val == control then
table.remove(self.controls, key)
if control.drop then
control:drop(self)
end
break
end
end
end
function engine:add_sprite(sprite)
table.insert(self.sprites, sprite)
end
function engine:rm_sprite(sprite)
for key, val in ipairs(self.sprites) do
if val == sprite then
table.remove(self.sprites, key)
break
end
end
end
function engine:control(event, ...)
for key, val in ipairs(self.controls) do
if val[event] and not val[event](val, ...) then
break
end
end
end
function engine:update(...)
self:control('update', ...)
end
function engine:mousepressed(...)
self:control('mousepressed', ...)
end
function engine:mousereleased(...)
self:control('mousereleased', ...)
end
function engine:mousemoved(...)
self:control('mousemoved', ...)
end
function engine:draw()
for key, val in ipairs(self.sprites) do
val:draw()
end
end
|
local ABGS = require(script:GetCustomProperty("APIBasicGameState"))
local ROOT = script:GetCustomProperty("Tags"):WaitForObject()
local isEnabled = ROOT:GetCustomProperty("ENABLED")
if not isEnabled then
return
end
local AMMOUNT = script:GetCustomProperty("AMMOUNT"):WaitForObject()
local UIPanel = script:GetCustomProperty("UIPanel"):WaitForObject()
local LOCAL_PLAYER = Game.GetLocalPlayer()
local PICKUP_SFX = script:GetCustomProperty("GAMEMODE_TagPickup_Audio")
local TURN_IN_SFX = script:GetCustomProperty("GAMEMODE_TagTurnIn_Audio")
local isEnabled = false
function Tick()
if _G.META_GAME_MODES then
local tags = LOCAL_PLAYER:GetResource(_G.META_GAME_MODES.TAG_NAME)
if tags > 0 then
UIPanel.visibility = Visibility.FORCE_ON
AMMOUNT.text = tostring(tags)
else
UIPanel.visibility = Visibility.FORCE_OFF
end
end
Task.Wait(1)
end
function OnResourceChanged(player, resName, resAmt)
if ABGS.GetGameState() == ABGS.GAME_STATE_ROUND then
if player == LOCAL_PLAYER and resName == "GM.TAGS" then
if resAmt > 0 then
World.SpawnAsset(PICKUP_SFX, {position = player:GetWorldPosition()})
elseif resAmt == 0 then
World.SpawnAsset(TURN_IN_SFX, {position = player:GetWorldPosition()})
end
end
end
end
LOCAL_PLAYER.resourceChangedEvent:Connect(OnResourceChanged)
|
local BasePlugin = require("orange.plugins.base_handler")
local orange_db = require("orange.store.orange_db")
local judge_util = require("orange.utils.judge")
local extractor_util = require("orange.utils.extractor")
local handle_util = require("orange.utils.handle")
local utils = require("orange.utils.utils")
local function filter_rules( sid, plugin, ngx_var )
local rules = orange_db.get_json(plugin .. ".selector." .. sid .. ".rules")
if not rules or type(rules) ~= "table" or #rules <= 0 then
return false
end
for _, rule in ipairs(rules) do
if rule.handle and rule.handle.log == true then
ngx.log(ngx.INFO, "[Mirror][Start To Pass Through Rule:", rule.id, "]")
end
if rule.enable == true then
-- judge阶段
local pass = judge_util.judge_rule(rule, plugin)
-- extract阶段
local variables = extractor_util.extract_variables(rule.extractor)
-- handle阶段
if pass then
local handle = rule.handle
if handle and handle.log == true then
ngx.log(ngx.INFO, "[Mirror][Match-Rule:", rule.id, "]")
end
if not ngx_var.junhai_trace_id or ngx_var.junhai_trace_id == "" or ngx_var.junhai_trace_id == "-" then
ngx_var.junhai_trace_id = utils.new_id() -- set new trace id
end
local extractor_type = rule.extractor.type
local method = ngx_var.request_method
local mirror_host_tmp = ngx_var.host
local mirror_url_tmp = "http://backend"
local mirror_name_tmp = "default_upstream"
local methods = {
GET = ngx.HTTP_GET,
POST = ngx.HTTP_POST,
PUT = ngx.HTTP_PUT,
DELETE = ngx.HTTP_DELETE
}
if handle and (handle.mirror_url or handle.mirror_name) then
if handle.mirror_host and handle.mirror_host ~= "" then -- mirror_host默认取请求的host
mirror_host_tmp = handle_util.build_upstream_host(extractor_type, handle.mirror_host, variables, plugin)
end
if handle.mirror_url and handle.mirror_url ~= "" then -- mirror_url默认取 http://backend
mirror_url_tmp = handle_util.build_upstream_url(extractor_type, handle.mirror_url, variables, plugin)
end
if handle.mirror_name and handle.mirror_name ~= "" then -- mirror_name默认取 default_upstream
mirror_name_tmp = handle.mirror_name
end
ngx.req.read_body()
local options = {
method = methods[method],
ctx = {
sub_origin_uri = ngx_var.uri,
sub_upstream_host = mirror_host_tmp,
sub_upstream_url = mirror_url_tmp,
sub_upstream_name = mirror_name_tmp,
sub_junhai_trace_id = ngx_var.junhai_trace_id
},
always_forward_body = true
}
local subquest_uri = "/mirror-plugin-of-api-gateway"
if ngx_var.args then
subquest_uri = subquest_uri.."?"..ngx_var.args
end
local multiple = handle.multiple or 1
local multi_t = {}
for var = 1, multiple do
table.insert(multi_t, {subquest_uri,options})
end
local ok,err = pcall(ngx.location.capture_multi, multi_t)
if ok then
ngx_var.mirror_url = mirror_url_tmp
ngx_var.mirror_host = mirror_host_tmp
ngx_var.mirror_name = mirror_name_tmp
if handle.log == true then
ngx.log(ngx.INFO, "[Mirror][Mirror-To] mirrot_host:"..mirror_host_tmp..", mirror_url:"..mirror_url_tmp..", mirror_name:"..mirror_name_tmp)
end
else
if handle.log == true then
ngx.log(ngx.ERR, "[Mirror][Match-Rule-Error] failed to issues subquest:"..tostring(ok)..","..err)
end
end
else
if handle.log == true then
ngx.log(ngx.ERR, "[Mirror][Match-Rule-Error] no handle or mirror_url")
end
end
return true
else
if rule.handle and rule.handle.log == true then
ngx.log(ngx.INFO, "[Mirror][NotMatch-Rule:", rule.id, "]")
end
end
end
end
return false
end
local MirrorHandler = BasePlugin:extend()
MirrorHandler.PRIORITY = 2000
function MirrorHandler:new(store)
MirrorHandler.super.new(self, "Mirror-plugin")
self.store = store
end
function MirrorHandler:mirror()
MirrorHandler.super.mirror(self)
local enable = orange_db.get("mirror.enable")
local meta = orange_db.get_json("mirror.meta")
local selectors = orange_db.get_json("mirror.selectors")
local ordered_selectors = meta and meta.selectors
if not enable or enable ~= true or not meta or not ordered_selectors or not selectors then
return
end
local ngx_var = ngx.var
for i, sid in ipairs(ordered_selectors) do
local selector = selectors[sid]
if selector.handle and selector.handle.log == true then
ngx.log(ngx.INFO, "[Mirror][Start To Pass Through Selector:", sid, "]")
end
if selector and selector.enable == true then
local selector_pass
if selector.type == 0 then -- 全流量selector
selector_pass = true
else
selector_pass = judge_util.judge_selector(selector, "mirror") -- selector judge
end
if selector_pass then
if selector.handle and selector.handle.log == true then
ngx.log(ngx.INFO, "[Mirror][Pass-Selector:", sid, "]")
end
local stop = filter_rules(sid, "mirror", ngx_var)
if stop then -- 已匹配该selector中的rule,不再进行执行通过后续的selector
return
end
if selector.handle and selector.handle.log == true then
ngx.log(ngx.INFO, "[Mirror][NotMatch-Any-Rule-In-Selector:", sid, "]")
end
else
if selector.handle and selector.handle.log == true then
ngx.log(ngx.INFO, "[Mirror][Not-Pass-Selector:", sid, "]")
end
end
-- 没有通过该selector或不匹配该selector中的所有rule,判断是否继续匹配下面的selector
if selector.handle and selector.handle.continue == true then
-- continue next selector
else
break
end
end
end
end
return MirrorHandler
|
-- ViewmodelPage.lua
-- ArsonistD
-- Started : 12/09/2021
-- Last Edit : 12/09/2021
local framework = require(script.Parent.Parent.Parent.ArsonsPluginFramework)
local Roact = require(script.Parent.Parent.Parent.Packages.Roact)
ViewmodelPage = Roact.Component:extend(
"ViewmodelPage"
)
function ViewmodelPage:init()
self.Viewmodel = framework.GetModule("Viewmodel")
self.Group = framework.GetComponent("Group")
self.Setting = framework.GetComponent("Setting")
self.Bool = framework.GetComponent("Bool")
self.NumberBox = framework.GetComponent("NumberBox")
end
function ViewmodelPage:render()
return Roact.createFragment({
})
end
function ViewmodelPage:didMount()
end
function ViewmodelPage:willUnmount()
end
return ViewmodelPage
|
local sound = require 'vendor/TEsound'
local Timer = require('vendor/timer')
local tween = require 'vendor/tween'
local character = require 'character'
local Gamestate = require 'vendor/gamestate'
local utils = require 'utils'
local anim8 = require 'vendor/anim8'
local Dialog = require 'dialog'
local Quest = require 'quest'
local quests = require 'npcs/quests/hermitquest'
local prompt = require 'prompt'
return {
width = 24,
height = 48,
animations = {
default = {
'loop',{'5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','5,1','1,1','2,1','1,1','2,1'},0.28,
},
},
talk_items = {
{ ['text']='i am done with you' },
{ ['text']='Any useful info for me?' },
{ ['text']='Why do you live out here?' },
{ ['text']='Talk about quests' },
},
talk_commands = {
['Talk about quests'] = function(npc, player)
if player.quest == 'To Slay an Acorn - Find the Old Hermit at Stonerspeak' then
Quest.removeQuestItem(player)
Quest:activate(npc, player, quests.berry)
elseif player.quest == 'To Slay An Acorn - Collect the Special Berry' then
Quest:activate(npc, player, quests.berry)
else
Dialog.new("The woods here are dangerous these days, you gotta keep your wits about you!", function()
npc.menu:close(player)
end)
end
end,
},
talk_responses = {
["Any useful info for me?"]={
"There's a buncha' chests hidden around these parts for some reason, check them out to see what you get!",
},
["Why do you live out here?"]={
"The nature, the trees, the wee-I mean, the water.",
"Though it's getting dangerous these days with all them angry acorns out and about...",
},
},
}
|
-- Copyright (C) 2016 Pau Carré Cardona - All Rights Reserved
-- You may use, distribute and modify this code under the
-- terms of the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt).
local search_commons = {}
function search_commons.sortCmpTable(a, b)
return a[2] > b[2]
end
function search_commons.printCmpTable(cmpTable)
for i = 1, #cmpTable do
print(cmpTable[i][1] .. ' ' .. cmpTable[i][2])
end
end
return search_commons
|
dwarf_bantha = Creature:new {
objectName = "@mob/creature_names:dwarf_bantha",
socialGroup = "bantha",
faction = "",
level = 11,
chanceHit = 0.29,
damageMin = 90,
damageMax = 110,
baseXp = 356,
baseHAM = 1200,
baseHAMmax = 1400,
armor = 0,
resists = {0,0,0,115,0,0,0,-1,-1},
meatType = "meat_herbivore",
meatAmount = 300,
hideType = "hide_wooly",
hideAmount = 200,
boneType = "bone_mammal",
boneAmount = 100,
milkType = "milk_wild",
milk = 150,
tamingChance = 0.25,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = HERD,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/dwarf_bantha.iff"},
hues = { 0, 1, 2, 3, 4, 5, 6, 7 },
scale = 0.75,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"",""},
{"stunattack",""}
}
}
CreatureTemplates:addCreatureTemplate(dwarf_bantha, "dwarf_bantha")
|
-- Autogenerated from KST: please remove this line if doing any edits by hand!
local luaunit = require("luaunit")
require("params_pass_array_struct")
TestParamsPassArrayStruct = {}
function TestParamsPassArrayStruct:test_params_pass_array_struct()
local r = ParamsPassArrayStruct:from_file("src/position_to_end.bin")
luaunit.assertEquals(#r.pass_structs.structs, 2)
luaunit.assertEquals(r.pass_structs.structs[1].f, 1)
luaunit.assertEquals(r.pass_structs.structs[2].b, 2)
end
|
function a()
end
<caret>
|
return function(mt)
mt.__index = mt
local M = {}
function M.new(...)
local obj = setmetatable({}, mt)
if obj.ctor then
obj:ctor(...)
end
return obj
end
return M
end
|
local playsession = {
{"Felgon", {71906}},
{"Houdi", {71893}},
{"LetsAgree", {1791}},
{"ratboyboxshall", {4261}},
{"Phil87", {17915}}
}
return playsession
|
local fs = require('efmls-configs.fs')
local formatter = 'dotnet'
local command = string.format('%s format ${ROOT}', fs.executable(formatter))
return {
formatCommand = command,
formatStdin = false,
}
|
UIMenuProgressItem = setmetatable({}, UIMenuProgressItem)
UIMenuProgressItem.__index = UIMenuProgressItem
UIMenuProgressItem.__call = function() return "UIMenuItem", "UIMenuProgressItem" end
---New
---@param Text string
---@param Items table
---@param Index number
---@param Description string
---@param Counter boolean
function UIMenuProgressItem.New(Text, Max, Index, Description, sliderColor, color, highlightColor, textColor, highlightedTextColor)
local _UIMenuProgressItem = {
Base = UIMenuItem.New(Text or "", Description or "", color or 117, highlightColor or 1, textColor or 1, highlightedTextColor or 2),
_Max = Max or 100,
_Multiplier = 5,
_Index = Index or 0,
Panels = {},
SidePanel = nil,
SliderColor = sliderColor or 116,
BackgroundSliderColor = backgroundSliderColor or 117,
ItemId = 4,
OnProgressChanged = function(menu, item, newindex) end,
OnProgressSelected = function(menu, item, newindex) end,
}
return setmetatable(_UIMenuProgressItem, UIMenuProgressItem)
end
---SetParentMenu
---@param Menu table
function UIMenuProgressItem:SetParentMenu(Menu)
if Menu() == "UIMenu" then
self.Base.ParentMenu = Menu
else
return self.Base.ParentMenu
end
end
function UIMenuProgressItem:AddSidePanel(sidePanel)
if sidePanel() == "UIMissionDetailsPanel" then
sidePanel:SetParentItem(self)
self.SidePanel = sidePanel
if self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible() then
ScaleformUI.Scaleforms._ui:CallFunction("ADD_SIDE_PANEL_TO_ITEM", false, IndexOf(self.Base.ParentMenu.Items, self) - 1, 0, sidePanel.PanelSide, sidePanel.TitleType, sidePanel.Title, sidePanel.TitleColor, sidePanel.TextureDict, sidePanel.TextureName)
end
elseif sidePanel() == "UIVehicleColorPickerPanel" then
sidePanel:SetParentItem(self)
self.SidePanel = sidePanel
if self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible() then
ScaleformUI.Scaleforms._ui:CallFunction("ADD_SIDE_PANEL_TO_ITEM", false, IndexOf(self.ParentMenu.Items, self) - 1, 1, sidePanel.PanelSide, sidePanel.TitleType, sidePanel.Title, sidePanel.TitleColor)
end
end
end
---Selected
---@param bool number
function UIMenuProgressItem:Selected(bool)
if bool ~= nil then
self.Base:Selected(tobool(bool), self)
else
return self.Base._Selected
end
end
---Hovered
---@param bool boolean
function UIMenuProgressItem:Hovered(bool)
if bool ~= nil then
self.Base._Hovered = tobool(bool)
else
return self.Base._Hovered
end
end
---Enabled
---@param bool boolean
function UIMenuProgressItem:Enabled(bool)
if bool ~= nil then
self.Base:Enabled(bool, self)
else
return self.Base._Enabled
end
end
---Description
---@param str string
function UIMenuProgressItem:Description(str)
if tostring(str) and str ~= nil then
self.Base:Description(tostring(str), self)
else
return self.Base._Description
end
end
---Text
---@param Text string
function UIMenuProgressItem:Label(Text)
if tostring(Text) and Text ~= nil then
self.Base:Label(tostring(Text), self)
else
return self.Base:Label()
end
end
function UIMenuProgressItem:MainColor(color)
if(color)then
self.Base._mainColor = color
if(self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible()) then
ScaleformUI.Scaleforms._ui:CallFunction("UPDATE_COLORS", false, IndexOf(self.Base.ParentMenu.Items, self) - 1, self.Base._mainColor, self.Base._highlightColor, self.Base._textColor, self.Base._highlightedTextColor)
end
else
return self.Base._mainColor
end
end
function UIMenuProgressItem:TextColor(color)
if(color)then
self.Base._textColor = color
if(self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible()) then
ScaleformUI.Scaleforms._ui:CallFunction("UPDATE_COLORS", false, IndexOf(self.Base.ParentMenu.Items, self) - 1, self.Base._mainColor, self.Base._highlightColor, self.Base._textColor, self.Base._highlightedTextColor)
end
else
return self.Base._textColor
end
end
function UIMenuProgressItem:HighlightColor(color)
if(color)then
self.Base._highlightColor = color
if(self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible()) then
ScaleformUI.Scaleforms._ui:CallFunction("UPDATE_COLORS", false, IndexOf(self.Base.ParentMenu.Items, self) - 1, self.Base._mainColor, self.Base._highlightColor, self.Base._textColor, self.Base._highlightedTextColor)
end
else
return self.Base._highlightColor
end
end
function UIMenuProgressItem:HighlightedTextColor(color)
if(color)then
self.Base._highlightedTextColor = color
if(self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible()) then
ScaleformUI.Scaleforms._ui:CallFunction("UPDATE_COLORS", false, IndexOf(self.Base.ParentMenu.Items, self) - 1, self.Base._mainColor, self.Base._highlightColor, self.Base._textColor, self.Base._highlightedTextColor)
end
else
return self.Base._highlightedTextColor
end
end
function UIMenuProgressItem:SliderColor(color)
if(color)then
self.SliderColor = color
if(self.Base.ParentMenu ~= nil and self.Base.ParentMenu:Visible()) then
ScaleformUI.Scaleforms._ui:CallFunction("UPDATE_COLORS", false, IndexOf(self.Base.ParentMenu.Items, self) - 1, self.Base._mainColor, self.Base._highlightColor, self.Base._textColor, self.Base._highlightedTextColor, self.SliderColor)
end
else
return self.SliderColor
end
end
function UIMenuProgressItem:BlinkDescription(bool)
if bool ~= nil then
self.Base:BlinkDescription(bool, self)
else
return self.Base:BlinkDescription()
end
end
---Index
---@param Index table
function UIMenuProgressItem:Index(Index)
if tonumber(Index) then
if Index > self._Max then
self._Index = self._Max
elseif Index < 0 then
self._Index = 0
else
self._Index = Index
end
self.OnProgressChanged(self._Index)
else
return self._Index
end
end
---LeftBadge
function UIMenuProgressItem:LeftBadge(Badge)
if tonumber(Badge) then
self.Base:LeftBadge(Badge, self)
else
return self.Base:LeftBadge()
end
end
---RightBadge
function UIMenuProgressItem:RightBadge()
error("This item does not support badges")
end
---RightLabel
function UIMenuProgressItem:RightLabel()
error("This item does not support a right label")
end
|
--清除掉目标身上所有的 buff, target参数指定消除哪个目标身上的 buff,clear_type 指定消除哪些类型的 buff,见:SceneConst.ClearBuffType 枚举,有三种:所有,坏的和好的 buff.
local Ac = require "Action"
local FightHelper = require("game.scene.FightHelper")
local SceneConst = require "game.scene.SceneConst"
local BuffActions = require("game.scene.fight.BuffActions")
--对于造成临时效果,比如晕眩或一定时间内降低属性的 buff,只需要快速播放至结束就好了
local HandleDurationBuff = function ( self, buffAction )
while true do
buffAction:Update(100000000000)
if buffAction:IsDone() then
self.actionMgr:RemoveAction(buffAction)
break
end
end
end
--对于造成不可恢复效果的,直接结束播放就行了
local HandleUnrecoverableBuff = function ( self, buffAction )
self.actionMgr:RemoveAction(buffAction)
end
--有些 buff 虽然造成不可恢复的效果,但不能直接删掉该 action,比如冰冻,它会每隔一定时间就扣血,所以不能快速把它播放完。但它还会减你速度,直到播放结束时才把速度还原,所以不能直接把它给删了,不然就跳过了还原速度的处理。所以这种 buff 需要特殊处理
local HandleSpecialBuff = function ( self, buffAction )
local clearer = BuffActions:GetActionClearer(buffAction.buffData.buff_id)
if clearer then
clearer()
end
end
local BuffTypeMap = {
[400000] = HandleDurationBuff,
[400001] = HandleUnrecoverableBuff,
[400002] = HandleDurationBuff,
[400003] = HandleSpecialBuff,
}
local BadBuffDic = {
[400000] = true,
[400001] = true,
[400002] = true,
[400003] = true,
}
local ClearBuff = Ac.OO.Class {
type = "ClearBuff",
__index = {
Start = function(self, buffData)
self.buffData = buffData
self.sceneMgr = buffData.sceneMgr
self.actionMgr = self.sceneMgr.actionMgr
end,
IsDone = function(self)
return true
end,
Update = function(self, deltaTime)
local target = self[1]
local clearType = self[2]
--针对不同的 buff 类型做处理
local targetEntity
if target == SceneConst.SkillTargetType.Enemy then
targetEntity = self.buffData.victim_entity
elseif target == SceneConst.SkillTargetType.Me then
targetEntity = self.buffData.caster_entity
end
local buffList = self.entityMgr:GetComponentData(targetEntity, "UMO.Buff")
for i,v in ipairs(buffList) do
local needClear = false
if clearType == SceneConst.ClearBuffType.All then
needClear = true
elseif clearType == SceneConst.ClearBuffType.Bad then
needClear = BadBuffDic[v.buff_id]
else
needClear = true
end
if needClear then
local handler = BuffTypeMap[v.buff_id]
if handler then
handler(v.action)
end
end
end
end,
},
}
return ClearBuff
|
local module = ...
local function set(name, value)
if not value then return end
local fn = name .. '.lua'
local f = file.open(fn, "w")
f.writeline("local " .. name .. " = " .. value)
f.writeline("return " .. name)
f.close()
node.compile(fn)
file.remove(fn)
print("Heap: ", node.heap(), "Wrote: ", fn)
package.loaded[name] = nil
collectgarbage()
end
return function(name, value)
if package.loaded[module] then
package.loaded[module] = nil
end
module = nil
set(name, value)
end
|
setfenv(1, require "sysapi-ns")
local bor, lshift = bit.bor, bit.lshift
-- Language Identifier Constants and Strings
-- https://docs.microsoft.com/en-us/windows/win32/intl/language-identifier-constants-and-strings
LANG_ENGLISH = 0x09
SUBLANG_ENGLISH_US = 0x01
-- #define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
function MAKELANGID(p, s)
return bor(lshift(ffi.cast("WORD", s), 10), ffi.cast("WORD", p))
end
|
local class = require 'middleclass'
local data = class('db.prometheus.data')
function data:initialize()
self._list = {}
end
function data:add_metric(metric)
table.insert(self._list, metric)
end
function data:encode(auto_clean)
local data = {}
for _, v in ipairs(self._list) do
local lines = v:encode(auto_clean)
table.move(lines, 1, #lines, #data + 1, data)
end
return table.concat(data, '\n')
end
return data
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.