aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-08-24 20:32:34 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-08-24 20:32:34 -0400
commit233e478e40d72a091f70f18dc6846066a4f52016 (patch)
treecf34be714088889731736c81bd44e198c792625a /gamemode/shared
parent61bc16dae5a1b61bcd237d9f0be36125829d95b1 (diff)
downloadartery-233e478e40d72a091f70f18dc6846066a4f52016.tar.gz
artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.bz2
artery-233e478e40d72a091f70f18dc6846066a4f52016.zip
Fix all linter warnings
Diffstat (limited to 'gamemode/shared')
-rw-r--r--gamemode/shared/inventory.lua798
-rw-r--r--gamemode/shared/inventory_common.lua386
-rw-r--r--gamemode/shared/loaditems.lua122
-rw-r--r--gamemode/shared/loadnpcs.lua78
-rw-r--r--gamemode/shared/loadprayers.lua246
-rw-r--r--gamemode/shared/prayersystem/prayers/lesserevasion.lua132
-rw-r--r--gamemode/shared/prayersystem/prayers/ninelives.lua100
-rw-r--r--gamemode/shared/prayersystem/prayers/notdarkrp.lua154
-rw-r--r--gamemode/shared/prayersystem/prayers/preditorinstinct.lua136
-rw-r--r--gamemode/shared/prayersystem/prayers/thickskin.lua120
-rw-r--r--gamemode/shared/questsystem/examplequest.lua28
-rw-r--r--gamemode/shared/questsystem/subterr_generator.lua50
-rw-r--r--gamemode/shared/sh_setup.lua336
-rw-r--r--gamemode/shared/shop.lua350
-rw-r--r--gamemode/shared/sparkel.lua9
15 files changed, 1524 insertions, 1521 deletions
diff --git a/gamemode/shared/inventory.lua b/gamemode/shared/inventory.lua
index f06d053..b89deac 100644
--- a/gamemode/shared/inventory.lua
+++ b/gamemode/shared/inventory.lua
@@ -1,399 +1,399 @@
-do return end
-
---[[
- Various functions to work with inventories
- player:GetCredits()
- player:SetCredits(number credits)
-
- concommands:
- artery_showinventory
- artery_setcredits [playername=admin] numcredits
-]]
---- Various functions to deal with inventories.
--- @module Player
-local pmeta = FindMetaTable("Player")
-local emeta = FindMetaTable("Entity")
-local invfuncs = include("inventory_common.lua")
-
---A 2d array of the inventory.
-pmeta.Inventory = pmeta.Inventory or {}
-
---Money
-pmeta.Inventory.Credits = pmeta.Inventory.Credits or 0
---each backpack has 1:a tbl containing items or false, 2: a tbl {width,height} and 3:name
-pmeta.Inventory.Backpacks = pmeta.Inventory.Backpacks or {}
-
---Eqiped stuff at base, player has 1=Head, 2=Body, 3=Legs, 4=Boots, 5=Gloves, 6=Left Hand, 7=Right Hand
-pmeta.Inventory.Equiped = pmeta.Inventory.Equiped or {}
-local equipedslots = {
- "Head","Body","Legs","Boots","Gloves","Left","Right"
-}
-for _,v in pairs(equipedslots) do
- pmeta.Inventory.Equiped[v] = pmeta.Inventory.Equiped[v] or false
-end
-
-if SERVER then
- --- Gets a player's credits.
- -- Gets the number of credits a player has
- -- @return The number of credits for this player
- function pmeta:GetCredits()
- return self.Inventory.Credits
- end
-
- util.AddNetworkString( "art_synch_credits" )
- local function SynchCredits(ply)
- net.Start("art_synch_credits")
- net.WriteUInt(ply.Inventory.Credits,32)
- net.Send(ply)
- end
-
- --- Sets a player's credits.
- -- Sets the number of credits this player has. Credits are synchronized after every set
- -- @param num The number of credits to set on the player
- function pmeta:SetCredits(num)
- assert(type(num) == "number","Attempted to set credits to something other than a number:" .. type(num))
- self.Inventory.Credits = num
- SynchCredits(self)
- end
-
-end
-
-if CLIENT then
- net.Receive("art_synch_credits",function()
- ART.Credits = net.ReadUInt(32)
- print("I updated my credits! now:", ART.Credits)
- end)
-end
-
---- Puts an item in the inventory.
--- Puts an item in an inventory, overwriteing all other items it might be overlapping, you should check to make sure you're not over writeing something first.
--- @param backpack the backpack number this item should be placed in
--- @param x the column in the backpack this item should be placed in
--- @param y the row in the backpack this item should be placed in
--- @param item the item to place in the backpack.
--- @see Player.FindSpotForItem
-function pmeta:PutInvItem(backpack,x,y,item)
- invfuncs.PutItemInBackpack(self.Inventory.Backpacks[backpack],x,y,item)
-end
-
---- Finds a spot for an item.
--- Finds a backpack, row, and column for an item in a player's inventory.
--- @param item The item to try and fit into the backpack.
--- @return row The row where a spot was found
--- @return col The column where a spot was found
--- @return n The backpack number where a spot was found
-function pmeta:FindSpotForItem(item)
- for n,v in pairs(self.Inventory.Backpacks) do
- for row = 1,v[2][2] do
- for col = 1,v[2][1] do
- if self:CanFitInBackpack(v,row,col,item) then
- return row,col,n
- end
- end
- end
- end
-end
-
-local function DefaultCompare(item, itemname)
- return item.Name == itemname
-end
-
---- Checks if the player has an item.
--- Check to see if the player has an item. Supply the name of the item, or supply a function that takes 2 items, and returns true if they are equial. If any of the returns are nil, then all the the returns will be nil, and the item could not be found.
--- @param nameorcomparitor The item name as a string, or a function that returns true when given an item that you want.
--- @return row The row the items was found in
--- @return col The column the item was found in
--- @return n The backpack number the item was found in.
-function pmeta:HasItem(nameorcomparitor)
- local comparitor
- if type(nameorcomparitor) == "string" then
- comparitor = function(t) return t.Name == nameorcomparitor end
- else
- comparitor = nameorcomparitor
- end
- for n,v in pairs(self.Inventory.Backpacks) do
- for row = 1,v[2][2] do
- for col = 1,v[2][1] do
- local itemin = v[1][row][col]
- if (type(itemin) ~= "boolean") and comparitor(itemin) then
- return row,col,n
- end
- end
- end
- end
-end
-
---- Removes an item.
--- Remoes an item in the backpack of the player
--- @param backpack The backpack to remove the item from
--- @param row The row in the backpack the item is located at
--- @param col The column in the backpack the item is located at
-function pmeta:RemoveItemAt(backpack,row,col)
- local item = self.Inventory.Backpacks[backpack][1][row][col]
- for k = 1,#item.Shape do
- for i = 1,#(item.Shape[k]) do
- self.Inventory.Backpacks[backpack][1][row + k - 1][col + i - 1] = false
- end
- end
- self:SynchronizeInventory()
-end
-
---- Gives an item to a player.
--- Gives an item to the player in the next avaliable slot the item can fit in
--- @param item The item to give the player
-function pmeta:GiveItem(item)
- local x,y,b = self:FindSpotForItem(item)
- print("putting in ",x,y,b)
- if x and y and b then
- self:PutInvItem(b,x,y,item)
- self:SynchronizeInventory()
- return true
- else
- return false
- end
-end
-
---- Check if an item can fit in a position in a backpack
--- Check if an item can fit in a specific position in a specific backpack
--- @param backpack The backpack to try to fit the item in
--- @param x The row to try to fit the item in
--- @param y The column to try to fit the item in
--- @return bool If the item can fit in the backpack
-function pmeta:CanFitInBackpack(backpack,x,y,item)
- return invfuncs.CanFitInBackpack(backpack,x,y,item)
-end
-
-if SERVER then
- util.AddNetworkString("synchinventory")
- util.AddNetworkString("moveitem")
- util.AddNetworkString("equipitem")
- util.AddNetworkString("unequipitem")
- util.AddNetworkString("buyitem")
-end
-
---- Unequips an item.
--- Unequips an item, and puts it in the specified backpack (makes sure that it's possible first)
--- @param equipslot The equipment slot the item is in right now
--- @param backpack The destination backpack to put the item into
--- @param row The row in the backpack to put the item
--- @param col The column in the backpack to put the item
-function pmeta:UnEquip(equipslot, backpack, row, col)
- local item = self.Inventory.Equiped[equipslot]
- local tobackpack = self.Inventory.Backpacks[backpack]
- print("Unequiping into backpack", tobackpack)
- if self:CanFitInBackpack(
- tobackpack,
- row,
- col,
- item
- ) then
- self.Inventory.Equiped[equipslot] = false
- self:PutInvItem(backpack,row,col,item)
- if item.onUnEquip ~= nil then
- item:onUnEquip(self)
- end
- self:SynchronizeInventory()
- else
- error("Could not fit item in backpack, client might be de-synchronized")
- end
-end
-
-net.Receive("unequipitem",function(len,ply)
- local itemslot = net.ReadString()
- local tobackpack = net.ReadUInt(16)
- local row = net.ReadUInt(16)
- local col = net.ReadUInt(16)
-
- ply:UnEquip(itemslot,tobackpack,row,col)
-end)
-
---- Equips an item
--- Moves an item from a backpack to an equiped slot, makes sure the item can be equiped in that slot first
--- @param frombackpack The backpack to take the item from
--- @param fromrow The row to take the item from
--- @param fromcol The column to take the item from
--- @param toslo The equipment slot to put the item into
-function pmeta:EquipItem(frombackpack, fromrow, fromcol, toslot)
- local item = self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol]
- if item.Equipable ~= nil and item.Equipable == toslot then
- --Remove from the backpack
- for k = 1,#item.Shape do
- for i = 1,#item.Shape[k] do
- if k == 1 and i == 1 then continue end
- self.Inventory.Backpacks[frombackpack][1][fromrow + k - 1][fromcol + i - 1] = false
- end
- end
- self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol] = false
- self.Inventory.Equiped[toslot] = item
- if item.onEquip ~= nil then
- item:onEquip(self)
- end
- self:SynchronizeInventory()
- end
-end
-
-net.Receive("equipitem",function(len,ply)
- local backpacknum = net.ReadUInt(16)
- local fromrow = net.ReadUInt(16)
- local fromcol = net.ReadUInt(16)
- local equippos = net.ReadString()
- ply:EquipItem(backpacknum,fromrow,fromcol,equippos)
-end)
-
-net.Receive("buyitem",function(len,ply)
- local itemname = net.ReadString()
- local backpack = net.ReadUInt(8)
- local j = net.ReadUInt(8)
- local i = net.ReadUInt(8)
- local item = ART.GetItemByName(itemname)
- local nearshops = ents.FindInSphere( ply:GetPos(), 100 )
- local cost
- for k,v in pairs(nearshops) do
- if v:GetClass() ~= "npc_shop" then goto nextent end
- print("Checking if ", v, " has a ", itemname)
- print("Shop items were")
- PrintTable(v.shopitems)
- for i,j in pairs(v.shopitems) do
- if j[1] == itemname then
- cost = j[2]
- goto itemfound
- end
- end
- ::nextent::
- end
- ::itemfound::
- if cost == nil then
- ply:ChatPrint("Could not find a shop selling that!")
- return false
- end
- print("Found item, cost was ", cost,"type",type(cost))
- local playercreds = ply:GetCredits()
- print("player credits:",playercreds,"type:",type(playercreds))
- local tbp = ply.Inventory.Backpacks[backpack]
- local canfit = invfuncs.CanFitInBackpack(tbp,j,i,item)
- print("Can fit?",canfit)
- if playercreds < cost then
- ply:ChatPrint("You don't have enough credits to buy that!")
- return false
- end
- if not canfit then
- ply:ChatPrint("You can't put that into your packpack there!")
- return false
- end
- ply:SetCredits(playercreds - cost)
- invfuncs.PutItemInBackpack(tbp,j,i,item)
- ply:SynchronizeInventory()
- return true
-end)
-
-net.Receive("moveitem",function(len,ply)
- local froment = net.ReadEntity()
- local toent = net.ReadEntity()
-
- local frombackpack = net.ReadUInt(16)
- local tobackpack = net.ReadUInt(16)
-
- local frompos = {net.ReadUInt(16),net.ReadUInt(16)}
- local topos = {net.ReadUInt(16),net.ReadUInt(16)}
-
- if froment:IsPlayer() and toent:IsPlayer() and (froment ~= toent) then--Just don't allow stealing between players, anything else is fine
- ply:PrintMessage( HUD_PRINTCENTER, "You can't steal from this person!" )
- return
- end
- local item = froment.Inventory.Backpacks[frombackpack][1][frompos[1]][frompos[2]]
-
- --Set the shape it was at to false
- for k = 1,#item.Shape do
- for i = 1,#(item.Shape[k]) do
- if k == 1 and i == 1 then continue end
- froment.Inventory.Backpacks[frombackpack][1][frompos[1] + k - 1][frompos[2] + i - 1] = false
- end
- end
- froment.Inventory.Backpacks[frombackpack][1][frompos[1]][frompos[2]] = false
- --now check if it can fit in the backpack
- if invfuncs.CanFitInBackpack(toent.Inventory.Backpacks[tobackpack],topos[1],topos[2],item) then
- invfuncs.PutItemInBackpack(toent.Inventory.Backpacks[tobackpack],topos[1],topos[2],item)
- else
- invfuncs.PutItemInBackpack(froment.Inventory.Backpacks[frombackpack],frompos[1],frompos[2],item)
- end
- froment:SynchronizeInventory()
- toent:SynchronizeInventory()
-end)
-
---- Networks a player's inventory
--- Makes sure the client's version of the inventory matches up to the server's version, this should be called after manipulateing the client's inventory in any way.
-function pmeta:SynchronizeInventory()
- net.Start("synchinventory")
- net.WriteEntity(self)
- net.WriteFloat(#self.Inventory.Backpacks)
- for k,v in pairs(self.Inventory.Backpacks) do
- invfuncs.SerializeBackpack(v)
- end
- for k,v in pairs(equipedslots) do
- if self.Inventory.Equiped and self.Inventory.Equiped[v] ~= false then
- net.WriteString(v)
- local data = self.Inventory.Equiped[v]:Serialize()
- net.WriteString(self.Inventory.Equiped[v].Name)
- net.WriteUInt(#data,32)
- net.WriteData(data,#data)
- end
- end
- net.WriteString("END_EQUIPED")
- net.Send(self)
-end
-if CLIENT then
- net.Receive("synchinventory",function(len,ply)
- if LocalPlayer().invdisplays == nil then
- LocalPlayer().invdisplays = {}
- end
- local what = net.ReadEntity()
- what.Inventory.Backpacks = {}
- local numbackpacks = net.ReadFloat()
- for k = 1,numbackpacks do
- local tbackpack = invfuncs.DeSerializeBackpack()
- table.insert(what.Inventory.Backpacks,tbackpack)
- end
- local neq = net.ReadString()
- local updated_slots = {}
- while neq ~= "END_EQUIPED" do
- local itemslot = neq
- local itemname = net.ReadString()
- local itemdata = net.ReadData(net.ReadUInt(32))
- local item = ART.GetItemByName(itemname):DeSerialize(itemdata)
- what.Inventory.Equiped[itemslot] = item
- updated_slots[itemslot] = true
- neq = net.ReadString()
- end
- if what.Inventory.Equiped ~= nil then
- for k,v in pairs(equipedslots) do
- if updated_slots[v] then continue end
- what.Inventory.Equiped[v] = false
- end
- end
- ART.RefreshDisplays()
- end)
-end
-
-concommand.Add("artery_showinventory",function(ply,cmd,args)
- PrintTable(ply.Inventory)
- PrintTable(ply.ClientInventory)
-end)
-
-concommand.Add("artery_setcredits",function(ply,cmd,args)
- if not (ply:IsValid() and ply:IsAdmin()) then return end
- local e
- local i = false
- for k,v in pairs(player.GetAll()) do
- if v:Nick() == args[1] then
- e = v
- i = true
- break
- end
- end
- e = e or ply
- e:SetCredits(tonumber(args[i and 2 or 1]))
-end)
-
-hook.Add( "PlayerSpawn", "artery_disable_sprint", function(ply)
- ply:SetRunSpeed(ply:GetWalkSpeed())
-end )
+-- do return end
+--
+-- --[[
+-- Various functions to work with inventories
+-- player:GetCredits()
+-- player:SetCredits(number credits)
+--
+-- concommands:
+-- artery_showinventory
+-- artery_setcredits [playername=admin] numcredits
+-- ]]
+-- --- Various functions to deal with inventories.
+-- -- @module Player
+-- local pmeta = FindMetaTable("Player")
+-- local emeta = FindMetaTable("Entity")
+-- local invfuncs = include("inventory_common.lua")
+--
+-- --A 2d array of the inventory.
+-- pmeta.Inventory = pmeta.Inventory or {}
+--
+-- --Money
+-- pmeta.Inventory.Credits = pmeta.Inventory.Credits or 0
+-- --each backpack has 1:a tbl containing items or false, 2: a tbl {width,height} and 3:name
+-- pmeta.Inventory.Backpacks = pmeta.Inventory.Backpacks or {}
+--
+-- --Eqiped stuff at base, player has 1=Head, 2=Body, 3=Legs, 4=Boots, 5=Gloves, 6=Left Hand, 7=Right Hand
+-- pmeta.Inventory.Equiped = pmeta.Inventory.Equiped or {}
+-- local equipedslots = {
+-- "Head","Body","Legs","Boots","Gloves","Left","Right"
+-- }
+-- for _,v in pairs(equipedslots) do
+-- pmeta.Inventory.Equiped[v] = pmeta.Inventory.Equiped[v] or false
+-- end
+--
+-- if SERVER then
+-- --- Gets a player's credits.
+-- -- Gets the number of credits a player has
+-- -- @return The number of credits for this player
+-- function pmeta:GetCredits()
+-- return self.Inventory.Credits
+-- end
+--
+-- util.AddNetworkString( "art_synch_credits" )
+-- local function SynchCredits(ply)
+-- net.Start("art_synch_credits")
+-- net.WriteUInt(ply.Inventory.Credits,32)
+-- net.Send(ply)
+-- end
+--
+-- --- Sets a player's credits.
+-- -- Sets the number of credits this player has. Credits are synchronized after every set
+-- -- @param num The number of credits to set on the player
+-- function pmeta:SetCredits(num)
+-- assert(type(num) == "number","Attempted to set credits to something other than a number:" .. type(num))
+-- self.Inventory.Credits = num
+-- SynchCredits(self)
+-- end
+--
+-- end
+--
+-- if CLIENT then
+-- net.Receive("art_synch_credits",function()
+-- ART.Credits = net.ReadUInt(32)
+-- print("I updated my credits! now:", ART.Credits)
+-- end)
+-- end
+--
+-- --- Puts an item in the inventory.
+-- -- Puts an item in an inventory, overwriteing all other items it might be overlapping, you should check to make sure you're not over writeing something first.
+-- -- @param backpack the backpack number this item should be placed in
+-- -- @param x the column in the backpack this item should be placed in
+-- -- @param y the row in the backpack this item should be placed in
+-- -- @param item the item to place in the backpack.
+-- -- @see Player.FindSpotForItem
+-- function pmeta:PutInvItem(backpack,x,y,item)
+-- invfuncs.PutItemInBackpack(self.Inventory.Backpacks[backpack],x,y,item)
+-- end
+--
+-- --- Finds a spot for an item.
+-- -- Finds a backpack, row, and column for an item in a player's inventory.
+-- -- @param item The item to try and fit into the backpack.
+-- -- @return row The row where a spot was found
+-- -- @return col The column where a spot was found
+-- -- @return n The backpack number where a spot was found
+-- function pmeta:FindSpotForItem(item)
+-- for n,v in pairs(self.Inventory.Backpacks) do
+-- for row = 1,v[2][2] do
+-- for col = 1,v[2][1] do
+-- if self:CanFitInBackpack(v,row,col,item) then
+-- return row,col,n
+-- end
+-- end
+-- end
+-- end
+-- end
+--
+-- local function DefaultCompare(item, itemname)
+-- return item.Name == itemname
+-- end
+--
+-- --- Checks if the player has an item.
+-- -- Check to see if the player has an item. Supply the name of the item, or supply a function that takes 2 items, and returns true if they are equial. If any of the returns are nil, then all the the returns will be nil, and the item could not be found.
+-- -- @param nameorcomparitor The item name as a string, or a function that returns true when given an item that you want.
+-- -- @return row The row the items was found in
+-- -- @return col The column the item was found in
+-- -- @return n The backpack number the item was found in.
+-- function pmeta:HasItem(nameorcomparitor)
+-- local comparitor
+-- if type(nameorcomparitor) == "string" then
+-- comparitor = function(t) return t.Name == nameorcomparitor end
+-- else
+-- comparitor = nameorcomparitor
+-- end
+-- for n,v in pairs(self.Inventory.Backpacks) do
+-- for row = 1,v[2][2] do
+-- for col = 1,v[2][1] do
+-- local itemin = v[1][row][col]
+-- if (type(itemin) ~= "boolean") and comparitor(itemin) then
+-- return row,col,n
+-- end
+-- end
+-- end
+-- end
+-- end
+--
+-- --- Removes an item.
+-- -- Remoes an item in the backpack of the player
+-- -- @param backpack The backpack to remove the item from
+-- -- @param row The row in the backpack the item is located at
+-- -- @param col The column in the backpack the item is located at
+-- function pmeta:RemoveItemAt(backpack,row,col)
+-- local item = self.Inventory.Backpacks[backpack][1][row][col]
+-- for k = 1,#item.Shape do
+-- for i = 1,#(item.Shape[k]) do
+-- self.Inventory.Backpacks[backpack][1][row + k - 1][col + i - 1] = false
+-- end
+-- end
+-- self:SynchronizeInventory()
+-- end
+--
+-- --- Gives an item to a player.
+-- -- Gives an item to the player in the next avaliable slot the item can fit in
+-- -- @param item The item to give the player
+-- function pmeta:GiveItem(item)
+-- local x,y,b = self:FindSpotForItem(item)
+-- print("putting in ",x,y,b)
+-- if x and y and b then
+-- self:PutInvItem(b,x,y,item)
+-- self:SynchronizeInventory()
+-- return true
+-- else
+-- return false
+-- end
+-- end
+--
+-- --- Check if an item can fit in a position in a backpack
+-- -- Check if an item can fit in a specific position in a specific backpack
+-- -- @param backpack The backpack to try to fit the item in
+-- -- @param x The row to try to fit the item in
+-- -- @param y The column to try to fit the item in
+-- -- @return bool If the item can fit in the backpack
+-- function pmeta:CanFitInBackpack(backpack,x,y,item)
+-- return invfuncs.CanFitInBackpack(backpack,x,y,item)
+-- end
+--
+-- if SERVER then
+-- util.AddNetworkString("synchinventory")
+-- util.AddNetworkString("moveitem")
+-- util.AddNetworkString("equipitem")
+-- util.AddNetworkString("unequipitem")
+-- util.AddNetworkString("buyitem")
+-- end
+--
+-- --- Unequips an item.
+-- -- Unequips an item, and puts it in the specified backpack (makes sure that it's possible first)
+-- -- @param equipslot The equipment slot the item is in right now
+-- -- @param backpack The destination backpack to put the item into
+-- -- @param row The row in the backpack to put the item
+-- -- @param col The column in the backpack to put the item
+-- function pmeta:UnEquip(equipslot, backpack, row, col)
+-- local item = self.Inventory.Equiped[equipslot]
+-- local tobackpack = self.Inventory.Backpacks[backpack]
+-- print("Unequiping into backpack", tobackpack)
+-- if self:CanFitInBackpack(
+-- tobackpack,
+-- row,
+-- col,
+-- item
+-- ) then
+-- self.Inventory.Equiped[equipslot] = false
+-- self:PutInvItem(backpack,row,col,item)
+-- if item.onUnEquip ~= nil then
+-- item:onUnEquip(self)
+-- end
+-- self:SynchronizeInventory()
+-- else
+-- error("Could not fit item in backpack, client might be de-synchronized")
+-- end
+-- end
+--
+-- net.Receive("unequipitem",function(len,ply)
+-- local itemslot = net.ReadString()
+-- local tobackpack = net.ReadUInt(16)
+-- local row = net.ReadUInt(16)
+-- local col = net.ReadUInt(16)
+--
+-- ply:UnEquip(itemslot,tobackpack,row,col)
+-- end)
+--
+-- --- Equips an item
+-- -- Moves an item from a backpack to an equiped slot, makes sure the item can be equiped in that slot first
+-- -- @param frombackpack The backpack to take the item from
+-- -- @param fromrow The row to take the item from
+-- -- @param fromcol The column to take the item from
+-- -- @param toslo The equipment slot to put the item into
+-- function pmeta:EquipItem(frombackpack, fromrow, fromcol, toslot)
+-- local item = self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol]
+-- if item.Equipable ~= nil and item.Equipable == toslot then
+-- --Remove from the backpack
+-- for k = 1,#item.Shape do
+-- for i = 1,#item.Shape[k] do
+-- if k == 1 and i == 1 then continue end
+-- self.Inventory.Backpacks[frombackpack][1][fromrow + k - 1][fromcol + i - 1] = false
+-- end
+-- end
+-- self.Inventory.Backpacks[frombackpack][1][fromrow][fromcol] = false
+-- self.Inventory.Equiped[toslot] = item
+-- if item.onEquip ~= nil then
+-- item:onEquip(self)
+-- end
+-- self:SynchronizeInventory()
+-- end
+-- end
+--
+-- net.Receive("equipitem",function(len,ply)
+-- local backpacknum = net.ReadUInt(16)
+-- local fromrow = net.ReadUInt(16)
+-- local fromcol = net.ReadUInt(16)
+-- local equippos = net.ReadString()
+-- ply:EquipItem(backpacknum,fromrow,fromcol,equippos)
+-- end)
+--
+-- net.Receive("buyitem",function(len,ply)
+-- local itemname = net.ReadString()
+-- local backpack = net.ReadUInt(8)
+-- local j = net.ReadUInt(8)
+-- local i = net.ReadUInt(8)
+-- local item = ART.GetItemByName(itemname)
+-- local nearshops = ents.FindInSphere( ply:GetPos(), 100 )
+-- local cost
+-- for k,v in pairs(nearshops) do
+-- if v:GetClass() ~= "npc_shop" then goto nextent end
+-- print("Checking if ", v, " has a ", itemname)
+-- print("Shop items were")
+-- PrintTable(v.shopitems)
+-- for i,j in pairs(v.shopitems) do
+-- if j[1] == itemname then
+-- cost = j[2]
+-- goto itemfound
+-- end
+-- end
+-- ::nextent::
+-- end
+-- ::itemfound::
+-- if cost == nil then
+-- ply:ChatPrint("Could not find a shop selling that!")
+-- return false
+-- end
+-- print("Found item, cost was ", cost,"type",type(cost))
+-- local playercreds = ply:GetCredits()
+-- print("player credits:",playercreds,"type:",type(playercreds))
+-- local tbp = ply.Inventory.Backpacks[backpack]
+-- local canfit = invfuncs.CanFitInBackpack(tbp,j,i,item)
+-- print("Can fit?",canfit)
+-- if playercreds < cost then
+-- ply:ChatPrint("You don't have enough credits to buy that!")
+-- return false
+-- end
+-- if not canfit then
+-- ply:ChatPrint("You can't put that into your packpack there!")
+-- return false
+-- end
+-- ply:SetCredits(playercreds - cost)
+-- invfuncs.PutItemInBackpack(tbp,j,i,item)
+-- ply:SynchronizeInventory()
+-- return true
+-- end)
+--
+-- net.Receive("moveitem",function(len,ply)
+-- local froment = net.ReadEntity()
+-- local toent = net.ReadEntity()
+--
+-- local frombackpack = net.ReadUInt(16)
+-- local tobackpack = net.ReadUInt(16)
+--
+-- local frompos = {net.ReadUInt(16),net.ReadUInt(16)}
+-- local topos = {net.ReadUInt(16),net.ReadUInt(16)}
+--
+-- if froment:IsPlayer() and toent:IsPlayer() and (froment ~= toent) then--Just don't allow stealing between players, anything else is fine
+-- ply:PrintMessage( HUD_PRINTCENTER, "You can't steal from this person!" )
+-- return
+-- end
+-- local item = froment.Inventory.Backpacks[frombackpack][1][frompos[1]][frompos[2]]
+--
+-- --Set the shape it was at to false
+-- for k = 1,#item.Shape do
+-- for i = 1,#(item.Shape[k]) do
+-- if k == 1 and i == 1 then continue end
+-- froment.Inventory.Backpacks[frombackpack][1][frompos[1] + k - 1][frompos[2] + i - 1] = false
+-- end
+-- end
+-- froment.Inventory.Backpacks[frombackpack][1][frompos[1]][frompos[2]] = false
+-- --now check if it can fit in the backpack
+-- if invfuncs.CanFitInBackpack(toent.Inventory.Backpacks[tobackpack],topos[1],topos[2],item) then
+-- invfuncs.PutItemInBackpack(toent.Inventory.Backpacks[tobackpack],topos[1],topos[2],item)
+-- else
+-- invfuncs.PutItemInBackpack(froment.Inventory.Backpacks[frombackpack],frompos[1],frompos[2],item)
+-- end
+-- froment:SynchronizeInventory()
+-- toent:SynchronizeInventory()
+-- end)
+--
+-- --- Networks a player's inventory
+-- -- Makes sure the client's version of the inventory matches up to the server's version, this should be called after manipulateing the client's inventory in any way.
+-- function pmeta:SynchronizeInventory()
+-- net.Start("synchinventory")
+-- net.WriteEntity(self)
+-- net.WriteFloat(#self.Inventory.Backpacks)
+-- for k,v in pairs(self.Inventory.Backpacks) do
+-- invfuncs.SerializeBackpack(v)
+-- end
+-- for k,v in pairs(equipedslots) do
+-- if self.Inventory.Equiped and self.Inventory.Equiped[v] ~= false then
+-- net.WriteString(v)
+-- local data = self.Inventory.Equiped[v]:Serialize()
+-- net.WriteString(self.Inventory.Equiped[v].Name)
+-- net.WriteUInt(#data,32)
+-- net.WriteData(data,#data)
+-- end
+-- end
+-- net.WriteString("END_EQUIPED")
+-- net.Send(self)
+-- end
+-- if CLIENT then
+-- net.Receive("synchinventory",function(len,ply)
+-- if LocalPlayer().invdisplays == nil then
+-- LocalPlayer().invdisplays = {}
+-- end
+-- local what = net.ReadEntity()
+-- what.Inventory.Backpacks = {}
+-- local numbackpacks = net.ReadFloat()
+-- for k = 1,numbackpacks do
+-- local tbackpack = invfuncs.DeSerializeBackpack()
+-- table.insert(what.Inventory.Backpacks,tbackpack)
+-- end
+-- local neq = net.ReadString()
+-- local updated_slots = {}
+-- while neq ~= "END_EQUIPED" do
+-- local itemslot = neq
+-- local itemname = net.ReadString()
+-- local itemdata = net.ReadData(net.ReadUInt(32))
+-- local item = ART.GetItemByName(itemname):DeSerialize(itemdata)
+-- what.Inventory.Equiped[itemslot] = item
+-- updated_slots[itemslot] = true
+-- neq = net.ReadString()
+-- end
+-- if what.Inventory.Equiped ~= nil then
+-- for k,v in pairs(equipedslots) do
+-- if updated_slots[v] then continue end
+-- what.Inventory.Equiped[v] = false
+-- end
+-- end
+-- ART.RefreshDisplays()
+-- end)
+-- end
+--
+-- concommand.Add("artery_showinventory",function(ply,cmd,args)
+-- PrintTable(ply.Inventory)
+-- PrintTable(ply.ClientInventory)
+-- end)
+--
+-- concommand.Add("artery_setcredits",function(ply,cmd,args)
+-- if not (ply:IsValid() and ply:IsAdmin()) then return end
+-- local e
+-- local i = false
+-- for k,v in pairs(player.GetAll()) do
+-- if v:Nick() == args[1] then
+-- e = v
+-- i = true
+-- break
+-- end
+-- end
+-- e = e or ply
+-- e:SetCredits(tonumber(args[i and 2 or 1]))
+-- end)
+--
+-- hook.Add( "PlayerSpawn", "artery_disable_sprint", function(ply)
+-- ply:SetRunSpeed(ply:GetWalkSpeed())
+-- end )
diff --git a/gamemode/shared/inventory_common.lua b/gamemode/shared/inventory_common.lua
index c5553fe..c5b8fc3 100644
--- a/gamemode/shared/inventory_common.lua
+++ b/gamemode/shared/inventory_common.lua
@@ -1,193 +1,193 @@
---[[
- Some functions that are needed multiple places in the code, to deal with player inventories.
-]]
-do return end
-print("Hello from inventory_common.lua")
-local invfuncs = {}
-
---Forcibly put an item in a backpack, you should check to make sure there's room first
-invfuncs.PutItemInBackpack = function(backpack,x,y,item)
- backpack[1][x][y] = item
- for k = 1,#item.Shape do
- for i = 1,#(item.Shape[k]) do
- if k == 1 and i == 1 then continue end
- backpack[1][x + k - 1][y + i - 1] = item.Shape[k][i]
- end
- end
-end
-
---Writes a backpack to the net stream
-invfuncs.SerializeBackpack = function(backpack)
- net.WriteString(backpack[3]) --Name
- net.WriteUInt(backpack[2][1],16) --width
- net.WriteUInt(backpack[2][2],16) --height
- for k,v in pairs(backpack[1]) do
- for i,j in pairs(v) do
- if type(j) ~= "table" then continue end
- net.WriteString(j.Name)
- net.WriteUInt(k,16)
- net.WriteUInt(i,16)
- local data = j:Serialize()
- net.WriteUInt(#data,32)
- net.WriteData(data,#data)
- end
- end
- net.WriteString("END_ITEMS")
-end
-
---Loads a backpack from the net stream
-invfuncs.DeSerializeBackpack = function()
- local backpackname = net.ReadString()
- local width = net.ReadUInt(16)
- local height = net.ReadUInt(16)
- --Build the backpack
- local tb = {}
- tb[1] = {}
- tb[2] = {width,height}
- tb[3] = backpackname
- for x = 1,width do
- tb[1][x] = {}
- for y = 1,height do
- tb[1][x][y] = false
- end
- end
-
- local nitemname = net.ReadString()
- while nitemname ~= "END_ITEMS" do
- local xpos = net.ReadUInt(16)
- local ypos = net.ReadUInt(16)
- local data = net.ReadData(net.ReadUInt(32))
- local nitem = ART.GetItemByName(nitemname):DeSerialize(data)
- invfuncs.PutItemInBackpack(tb,xpos,ypos,nitem)
- nitemname = net.ReadString()
- end
-
- return tb
-
-end
-
---Checks to see if an item can fit in the backpack at a certain position
-invfuncs.CanFitInBackpack = function(backpack,x,y,item)
- for k,v in pairs(item.Shape) do
- for i,j in pairs(v) do
- if not j then continue end
- if backpack[1][x + k - 1] == nil then
- return false
- end
- if backpack[1][x + k - 1][y + i - 1] or backpack[1][x + k - 1][y + i - 1] == nil then
- return false
- end
- end
- end
- return true
-end
-
---Creates a new backpack, this is NOT called when players join the server, even new ones.
-invfuncs.CreateBackpack = function(name,width,height)
- local backpack = {}
- backpack[1] = {}
- backpack[2] = {width,height}
- backpack[3] = name
- for i = 1,width do --the width of the backpack.
- backpack[1][i] = {}
- end
- for k,v in pairs(backpack[1]) do
- for i = 1,height do --the height of the backpack.
- backpack[1][k][i] = false
- end
- end
- return backpack
-end
-
---Draws a backpack on the dpanel, client side only
-invfuncs.DrawBackpackOnDPanel = function(dp, backpack, backpacknum, tent)
- local width = ScrW()
- local height = ScrH()
- local slotsize = math.Round(width / 32)
- local backgrid = vgui.Create( "DGrid", dp )
- backgrid:SetPos( 10, 30 )
- backgrid:SetCols( backpack[2][1] )
- backgrid:SetColWide( backpack[2][2] )
- backgrid:Dock(FILL)
- for i = 1,#(backpack[1]) do
- for j = 1,#(backpack[1][i]) do
- local item = backpack[1][j][i]
- if type(backpack[1][j][i]) == "table" then
- local itemwidth = 0
- for _,l in pairs(item.Shape) do
- itemwidth = math.Max(itemwidth,#l)
- end
- local itemheight = #item.Shape
- local invicon = vgui.Create( "DButton", dp )
- invicon:SetSize(slotsize * itemwidth, slotsize * itemheight)
- invicon:SetPos(slotsize * (i - 1), slotsize * (j - 1))
- invicon:SetText(item.Name)
- if item.Tooltip then
- invicon:SetTooltip(item.Tooltip)
- end
- --invicon.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,100,0)) end
- invicon.DoClick = function()
- if not item.GetOptions then return end
- local menu = vgui.Create("DMenu")
- createMenuFor(menu,item:GetOptions())
- menu:Open()
- end
- invicon.Item = item
- invicon.invpos = {j,i}
- invicon.ent = tent
- invicon.backpacknum = backpacknum
- invicon:Droppable("Inventory")
- elseif not backpack[1][j][i] then
- local emptyslot = vgui.Create("DPanel", dp)
- emptyslot:SetSize(slotsize,slotsize)
- emptyslot:SetPos(slotsize * (i - 1), slotsize * (j - 1))
- --emptyslot.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,0,100)) end
- emptyslot:Receiver( "Inventory", function( receiver, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
- if not isDropped then return end
- local icon = tableOfDroppedPanels[1]
- local item = icon.Item
- local curpos = icon.invpos
- --Set the shape it was at to false
- if not icon.wasequiped and icon.ent == tent then
- assert(curpos ~= nil, "print curpos was nil when not equiped")
- for k = 1,#item.Shape do
- for l = 1,#(item.Shape[k]) do
- if k == 1 and l == 1 then continue end
- backpack[1][curpos[1] + k - 1][curpos[2] + l - 1] = false
- end
- end
- backpack[1][curpos[1]][curpos[2]] = false
- end
- if invfuncs.CanFitInBackpack(backpack,j,i,item) then
- local fromtbl = icon.invpos
- local wasequiped = icon.wasequiped
- if wasequiped then
- net.Start("unequipitem")
- net.WriteString(wasequiped)
- net.WriteUInt(backpacknum,16)
- net.WriteUInt(i,16)
- net.WriteUInt(j,16)
- net.SendToServer()
- else
- net.Start("moveitem")
- net.WriteEntity(icon.ent) -- from ent
- net.WriteEntity(tent) -- to ent
- net.WriteUInt(icon.backpacknum,16) -- from backpack number
- net.WriteUInt(backpacknum,16) -- to backpack number
- net.WriteUInt(fromtbl[1],16) -- From position
- net.WriteUInt(fromtbl[2],16)
- net.WriteUInt(j,16) -- To position
- net.WriteUInt(i,16)
- net.SendToServer()
- if item.onEquip ~= nil then
- item:onEquip(LocalPlayer())
- end
- end
- end
- end, {} )
- end
- end
- end
-end
-ART.invfuncs = invfuncs
-return invfuncs
+-- --[[
+-- Some functions that are needed multiple places in the code, to deal with player inventories.
+-- ]]
+-- do return end
+-- print("Hello from inventory_common.lua")
+-- local invfuncs = {}
+--
+-- --Forcibly put an item in a backpack, you should check to make sure there's room first
+-- invfuncs.PutItemInBackpack = function(backpack,x,y,item)
+-- backpack[1][x][y] = item
+-- for k = 1,#item.Shape do
+-- for i = 1,#(item.Shape[k]) do
+-- if k == 1 and i == 1 then continue end
+-- backpack[1][x + k - 1][y + i - 1] = item.Shape[k][i]
+-- end
+-- end
+-- end
+--
+-- --Writes a backpack to the net stream
+-- invfuncs.SerializeBackpack = function(backpack)
+-- net.WriteString(backpack[3]) --Name
+-- net.WriteUInt(backpack[2][1],16) --width
+-- net.WriteUInt(backpack[2][2],16) --height
+-- for k,v in pairs(backpack[1]) do
+-- for i,j in pairs(v) do
+-- if type(j) ~= "table" then continue end
+-- net.WriteString(j.Name)
+-- net.WriteUInt(k,16)
+-- net.WriteUInt(i,16)
+-- local data = j:Serialize()
+-- net.WriteUInt(#data,32)
+-- net.WriteData(data,#data)
+-- end
+-- end
+-- net.WriteString("END_ITEMS")
+-- end
+--
+-- --Loads a backpack from the net stream
+-- invfuncs.DeSerializeBackpack = function()
+-- local backpackname = net.ReadString()
+-- local width = net.ReadUInt(16)
+-- local height = net.ReadUInt(16)
+-- --Build the backpack
+-- local tb = {}
+-- tb[1] = {}
+-- tb[2] = {width,height}
+-- tb[3] = backpackname
+-- for x = 1,width do
+-- tb[1][x] = {}
+-- for y = 1,height do
+-- tb[1][x][y] = false
+-- end
+-- end
+--
+-- local nitemname = net.ReadString()
+-- while nitemname ~= "END_ITEMS" do
+-- local xpos = net.ReadUInt(16)
+-- local ypos = net.ReadUInt(16)
+-- local data = net.ReadData(net.ReadUInt(32))
+-- local nitem = ART.GetItemByName(nitemname):DeSerialize(data)
+-- invfuncs.PutItemInBackpack(tb,xpos,ypos,nitem)
+-- nitemname = net.ReadString()
+-- end
+--
+-- return tb
+--
+-- end
+--
+-- --Checks to see if an item can fit in the backpack at a certain position
+-- invfuncs.CanFitInBackpack = function(backpack,x,y,item)
+-- for k,v in pairs(item.Shape) do
+-- for i,j in pairs(v) do
+-- if not j then continue end
+-- if backpack[1][x + k - 1] == nil then
+-- return false
+-- end
+-- if backpack[1][x + k - 1][y + i - 1] or backpack[1][x + k - 1][y + i - 1] == nil then
+-- return false
+-- end
+-- end
+-- end
+-- return true
+-- end
+--
+-- --Creates a new backpack, this is NOT called when players join the server, even new ones.
+-- invfuncs.CreateBackpack = function(name,width,height)
+-- local backpack = {}
+-- backpack[1] = {}
+-- backpack[2] = {width,height}
+-- backpack[3] = name
+-- for i = 1,width do --the width of the backpack.
+-- backpack[1][i] = {}
+-- end
+-- for k,v in pairs(backpack[1]) do
+-- for i = 1,height do --the height of the backpack.
+-- backpack[1][k][i] = false
+-- end
+-- end
+-- return backpack
+-- end
+--
+-- --Draws a backpack on the dpanel, client side only
+-- invfuncs.DrawBackpackOnDPanel = function(dp, backpack, backpacknum, tent)
+-- local width = ScrW()
+-- local height = ScrH()
+-- local slotsize = math.Round(width / 32)
+-- local backgrid = vgui.Create( "DGrid", dp )
+-- backgrid:SetPos( 10, 30 )
+-- backgrid:SetCols( backpack[2][1] )
+-- backgrid:SetColWide( backpack[2][2] )
+-- backgrid:Dock(FILL)
+-- for i = 1,#(backpack[1]) do
+-- for j = 1,#(backpack[1][i]) do
+-- local item = backpack[1][j][i]
+-- if type(backpack[1][j][i]) == "table" then
+-- local itemwidth = 0
+-- for _,l in pairs(item.Shape) do
+-- itemwidth = math.Max(itemwidth,#l)
+-- end
+-- local itemheight = #item.Shape
+-- local invicon = vgui.Create( "DButton", dp )
+-- invicon:SetSize(slotsize * itemwidth, slotsize * itemheight)
+-- invicon:SetPos(slotsize * (i - 1), slotsize * (j - 1))
+-- invicon:SetText(item.Name)
+-- if item.Tooltip then
+-- invicon:SetTooltip(item.Tooltip)
+-- end
+-- --invicon.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,100,0)) end
+-- invicon.DoClick = function()
+-- if not item.GetOptions then return end
+-- local menu = vgui.Create("DMenu")
+-- createMenuFor(menu,item:GetOptions())
+-- menu:Open()
+-- end
+-- invicon.Item = item
+-- invicon.invpos = {j,i}
+-- invicon.ent = tent
+-- invicon.backpacknum = backpacknum
+-- invicon:Droppable("Inventory")
+-- elseif not backpack[1][j][i] then
+-- local emptyslot = vgui.Create("DPanel", dp)
+-- emptyslot:SetSize(slotsize,slotsize)
+-- emptyslot:SetPos(slotsize * (i - 1), slotsize * (j - 1))
+-- --emptyslot.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,0,100)) end
+-- emptyslot:Receiver( "Inventory", function( receiver, tableOfDroppedPanels, isDropped, menuIndex, mouseX, mouseY )
+-- if not isDropped then return end
+-- local icon = tableOfDroppedPanels[1]
+-- local item = icon.Item
+-- local curpos = icon.invpos
+-- --Set the shape it was at to false
+-- if not icon.wasequiped and icon.ent == tent then
+-- assert(curpos ~= nil, "print curpos was nil when not equiped")
+-- for k = 1,#item.Shape do
+-- for l = 1,#(item.Shape[k]) do
+-- if k == 1 and l == 1 then continue end
+-- backpack[1][curpos[1] + k - 1][curpos[2] + l - 1] = false
+-- end
+-- end
+-- backpack[1][curpos[1]][curpos[2]] = false
+-- end
+-- if invfuncs.CanFitInBackpack(backpack,j,i,item) then
+-- local fromtbl = icon.invpos
+-- local wasequiped = icon.wasequiped
+-- if wasequiped then
+-- net.Start("unequipitem")
+-- net.WriteString(wasequiped)
+-- net.WriteUInt(backpacknum,16)
+-- net.WriteUInt(i,16)
+-- net.WriteUInt(j,16)
+-- net.SendToServer()
+-- else
+-- net.Start("moveitem")
+-- net.WriteEntity(icon.ent) -- from ent
+-- net.WriteEntity(tent) -- to ent
+-- net.WriteUInt(icon.backpacknum,16) -- from backpack number
+-- net.WriteUInt(backpacknum,16) -- to backpack number
+-- net.WriteUInt(fromtbl[1],16) -- From position
+-- net.WriteUInt(fromtbl[2],16)
+-- net.WriteUInt(j,16) -- To position
+-- net.WriteUInt(i,16)
+-- net.SendToServer()
+-- if item.onEquip ~= nil then
+-- item:onEquip(LocalPlayer())
+-- end
+-- end
+-- end
+-- end, {} )
+-- end
+-- end
+-- end
+-- end
+-- ART.invfuncs = invfuncs
+-- return invfuncs
diff --git a/gamemode/shared/loaditems.lua b/gamemode/shared/loaditems.lua
index 9975bb3..dba80e8 100644
--- a/gamemode/shared/loaditems.lua
+++ b/gamemode/shared/loaditems.lua
@@ -1,61 +1,61 @@
-do return end
---[=[
---[[
- This file loads in all the items
-]]
-local concmd = include("concommands.lua")
---local autolua = include("../autolua.lua")
-print("Hello from LoadItems.lua!")
-ART.Items = {}
-local requiredfields = {
- "Name",
- "Shape",
- "Serialize",
- "DeSerialize",
-}
-local defaultfields = {
- ["Serialize"] = function(self) return "" end,
- ["DeSerialize"] = function(self,string) return self end,
- ["Shape"] = {{true}},
-}
-function ART.RegisterItem(tbl)
- --print("Registering item:" .. tbl.Name)
- for k,v in pairs(requiredfields) do
- assert(tbl[v] ~= nil, "Attempted to register an item without field:" .. v)
- end
- assert(ART.Items[tbl.Name] == nil, "Attempted to register 2 items with the same name!")
- for k,v in pairs(defaultfields) do
- if tbl[k] == nil then
- tbl[k] = v
- end
- end
- ART.Items[tbl.Name] = tbl
- --print("Art is now:")
- --PrintTable(ART)
-end
-
---autolua.AddLuaSHFolder("/shared/itemsystem")
-
-function ART.GiveItem(player,name)
- assert(ART.Items[name] ~= nil, "Attempted to give a nil item!")
- player:GiveItem(ART.Items[name])
- player:SynchronizeInventory()
-end
-
-function ART.GetItemByName(name)
- assert(ART.Items[name] ~= nil,"Attempted to get a nil item:" .. name)
- return ART.Items[name]
-end
-
-concommand.Add("artery_printitems",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- print("Items table:")
- PrintTable(ART.Items)
-end)
-
-concommand.Add("artery_giveitem",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- print("Trying to give an item:" .. args[1])
- ART.GiveItem(ply,args[1])
-end, concmd.AutocompleteFunction(table.GetKeys(ART.Items)), "Give an item to the specified player, or yourself if no player is specified.")
-]=]
+-- do return end
+-- --[=[
+-- --[[
+-- This file loads in all the items
+-- ]]
+-- local concmd = include("concommands.lua")
+-- --local autolua = include("../autolua.lua")
+-- print("Hello from LoadItems.lua!")
+-- ART.Items = {}
+-- local requiredfields = {
+-- "Name",
+-- "Shape",
+-- "Serialize",
+-- "DeSerialize",
+-- }
+-- local defaultfields = {
+-- ["Serialize"] = function(self) return "" end,
+-- ["DeSerialize"] = function(self,string) return self end,
+-- ["Shape"] = {{true}},
+-- }
+-- function ART.RegisterItem(tbl)
+-- --print("Registering item:" .. tbl.Name)
+-- for k,v in pairs(requiredfields) do
+-- assert(tbl[v] ~= nil, "Attempted to register an item without field:" .. v)
+-- end
+-- assert(ART.Items[tbl.Name] == nil, "Attempted to register 2 items with the same name!")
+-- for k,v in pairs(defaultfields) do
+-- if tbl[k] == nil then
+-- tbl[k] = v
+-- end
+-- end
+-- ART.Items[tbl.Name] = tbl
+-- --print("Art is now:")
+-- --PrintTable(ART)
+-- end
+--
+-- --autolua.AddLuaSHFolder("/shared/itemsystem")
+--
+-- function ART.GiveItem(player,name)
+-- assert(ART.Items[name] ~= nil, "Attempted to give a nil item!")
+-- player:GiveItem(ART.Items[name])
+-- player:SynchronizeInventory()
+-- end
+--
+-- function ART.GetItemByName(name)
+-- assert(ART.Items[name] ~= nil,"Attempted to get a nil item:" .. name)
+-- return ART.Items[name]
+-- end
+--
+-- concommand.Add("artery_printitems",function(ply,cmd,args)
+-- if not ply:IsAdmin() then return end
+-- print("Items table:")
+-- PrintTable(ART.Items)
+-- end)
+--
+-- concommand.Add("artery_giveitem",function(ply,cmd,args)
+-- if not ply:IsAdmin() then return end
+-- print("Trying to give an item:" .. args[1])
+-- ART.GiveItem(ply,args[1])
+-- end, concmd.AutocompleteFunction(table.GetKeys(ART.Items)), "Give an item to the specified player, or yourself if no player is specified.")
+-- ]=]
diff --git a/gamemode/shared/loadnpcs.lua b/gamemode/shared/loadnpcs.lua
index 2906597..de411df 100644
--- a/gamemode/shared/loadnpcs.lua
+++ b/gamemode/shared/loadnpcs.lua
@@ -1,39 +1,39 @@
-do return end
-local f = include("concommands.lua")
-
-ART = ART or {}
-
-local npcs = {}
-local autocompletef
-
-function ART.RegisterNPC(npc)
- assert(npc ~= nil, "Attempted to register a nil npc")
- assert(npc.Name ~= nil, "Attempted to register an npc without a name")
- npcs[npc.Name] = npc
- autocompletef = f.AutocompleteFunction(npcs)
-end
-
-function ART.CreateNPCByName(npcname, pos)
- print("Createing a " ,npcname ," at ", pos)
- local npctbl = npcs[npcname]
- local npc = ents.Create("npc_huntable")
- npc:SetPos(pos)
- for k,v in pairs(npctbl) do
- npc[k] = v
- end
- npc:Spawn()
- return npc
-end
-
-
-if SERVER then
- autocompletef = nil
-else
- autocompletef = f.AutocompleteFunction(npcs)
-end
-concommand.Add("artery_makenpc",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- local n = args[1]
- ART.CreateNPCByName(n,ply:GetEyeTrace().HitPos)
-end,
-autocompletef)
+-- do return end
+-- local f = include("concommands.lua")
+--
+-- ART = ART or {}
+--
+-- local npcs = {}
+-- local autocompletef
+--
+-- function ART.RegisterNPC(npc)
+-- assert(npc ~= nil, "Attempted to register a nil npc")
+-- assert(npc.Name ~= nil, "Attempted to register an npc without a name")
+-- npcs[npc.Name] = npc
+-- autocompletef = f.AutocompleteFunction(npcs)
+-- end
+--
+-- function ART.CreateNPCByName(npcname, pos)
+-- print("Createing a " ,npcname ," at ", pos)
+-- local npctbl = npcs[npcname]
+-- local npc = ents.Create("npc_huntable")
+-- npc:SetPos(pos)
+-- for k,v in pairs(npctbl) do
+-- npc[k] = v
+-- end
+-- npc:Spawn()
+-- return npc
+-- end
+--
+--
+-- if SERVER then
+-- autocompletef = nil
+-- else
+-- autocompletef = f.AutocompleteFunction(npcs)
+-- end
+-- concommand.Add("artery_makenpc",function(ply,cmd,args)
+-- if not ply:IsAdmin() then return end
+-- local n = args[1]
+-- ART.CreateNPCByName(n,ply:GetEyeTrace().HitPos)
+-- end,
+-- autocompletef)
diff --git a/gamemode/shared/loadprayers.lua b/gamemode/shared/loadprayers.lua
index 01d538c..551ab1b 100644
--- a/gamemode/shared/loadprayers.lua
+++ b/gamemode/shared/loadprayers.lua
@@ -1,123 +1,123 @@
---[[
- This file loads in all the prayers
-]]
-do return end
-local concmd = include("concommands.lua")
---local autolua = include("../autolua.lua")
-print("Hello from LoadItems.lua!")
-ART.Prayer = {}
-local requiredfields = {
- "Name",
- "Pray",
-}
-local defaultfields = {
- ["Serialize"] = function(self) return "" end,
- ["DeSerialize"] = function(self,string) return self end,
- ["Shape"] = {{true}},
-}
-
---- Adds the given prayer table to the global list of prayers.
--- Make sure that you do not accidentally register the same prayer twice, all prayers MUST have unique names
--- @param tbl The prayer to reigster
-function ART.RegisterPrayer(tbl)
- --print("Registering item:" .. tbl.Name)
- for k,v in pairs(requiredfields) do
- assert(tbl[v] ~= nil, "Attempted to register an prayer without field:" .. v)
- end
- assert(ART.Prayer[tbl.Name] == nil, "Attempted to register 2 Prayers with the same name!")
- for k,v in pairs(defaultfields) do
- if tbl[k] == nil then
- tbl[k] = v
- end
- end
- ART.Prayer[tbl.Name] = tbl
- --print("Art is now:")
- --PrintTable(ART)
-end
-
---autolua.AddLuaSHFolder("/shared/itemsystem")
-
-local meta = FindMetaTable("Player")
-
-
-if SERVER then
- meta.Inventory.Prayers = {}
-
- -- TODO:Make prayers limited or something
- function meta:HasPrayer(prayername)
- return self.Inventory.Prayers[prayername]
- end
-
- function meta:RemovePrayer(prayername)
- self.Inventory.Prayers[prayername] = nil
- self:SynchPrayers()
- end
-
- function ART.RemovePrayer(player,prayername)
- player:RemovePrayer(prayername)
- end
-
- function meta:GivePrayer(prayername)
- print("Prayers are:")
- PrintTable(ART.Prayer)
- assert(ART.Prayer[prayername] ~= nil, "Attempted to give a nil prayer \"" .. prayername .. "\"")
- self.Inventory.Prayers[prayername] = true
- self:SynchPrayers()
- end
-
- function ART.GivePrayer(player,prayername)
- player:GivePrayer(prayername)
- end
-
- util.AddNetworkString( "art_synch_prayers" )
- util.AddNetworkString( "equiphelpprayer" )
-
- function meta:SynchPrayers()
- print("Sending " .. table.Count(self.Inventory.Prayers) .. " prayers:")
- PrintTable(self.Inventory.Prayers)
- net.Start("art_synch_prayers")
- net.WriteUInt(table.Count(self.Inventory.Prayers),16)
- for k,v in pairs(self.Inventory.Prayers) do
- print("Writeing " .. k)
- net.WriteString(k)
- end
- net.Send(self)
- end
-end
-
-concommand.Add("artery_giveprayer",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- ply:GivePrayer(args[1])
-end, concmd.AutocompleteFunction(table.GetKeys(ART.Prayer)), "Give an instance of a prayer to yourself")
-
-if CLIENT then
- ART.MyPrayer = {}
- net.Receive("art_synch_prayers",function()
- ART.MyPrayer = {}
- for k = 1,net.ReadUInt(16) do
- local pstr = net.ReadString()
- print("Reading prayer " .. pstr)
- ART.MyPrayer[pstr] = true
- end
- print("Recived prayers:")
- PrintTable(ART.MyPrayer)
- ART.RefreshDisplays()
- end)
-end
-
-function ART.GetPrayerByName(name)
- assert(ART.Prayer[name] ~= nil,"Attempted to get a nil prayer:" .. name)
- return ART.Prayer[name]
-end
-
-concommand.Add("artery_printprayers",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- print("Items table:")
- PrintTable(ART.Prayer)
-end)
-
-concommand.Add("artery_giveprayer",function(ply,cmd,args)
- if not ply:IsAdmin() then return end
- print("Trying to give an prayer:" .. args[1])
- ART.GivePrayer(ply,args[1])
-end, concmd.AutocompleteFunction(table.GetKeys(ART.Prayer)), "Give an item to the specified player, or yourself if no player is specified.")
+-- --[[
+-- This file loads in all the prayers
+-- ]]
+-- do return end
+-- local concmd = include("concommands.lua")
+-- --local autolua = include("../autolua.lua")
+-- print("Hello from LoadItems.lua!")
+-- ART.Prayer = {}
+-- local requiredfields = {
+-- "Name",
+-- "Pray",
+-- }
+-- local defaultfields = {
+-- ["Serialize"] = function(self) return "" end,
+-- ["DeSerialize"] = function(self,string) return self end,
+-- ["Shape"] = {{true}},
+-- }
+--
+-- --- Adds the given prayer table to the global list of prayers.
+-- -- Make sure that you do not accidentally register the same prayer twice, all prayers MUST have unique names
+-- -- @param tbl The prayer to reigster
+-- function ART.RegisterPrayer(tbl)
+-- --print("Registering item:" .. tbl.Name)
+-- for k,v in pairs(requiredfields) do
+-- assert(tbl[v] ~= nil, "Attempted to register an prayer without field:" .. v)
+-- end
+-- assert(ART.Prayer[tbl.Name] == nil, "Attempted to register 2 Prayers with the same name!")
+-- for k,v in pairs(defaultfields) do
+-- if tbl[k] == nil then
+-- tbl[k] = v
+-- end
+-- end
+-- ART.Prayer[tbl.Name] = tbl
+-- --print("Art is now:")
+-- --PrintTable(ART)
+-- end
+--
+-- --autolua.AddLuaSHFolder("/shared/itemsystem")
+--
+-- local meta = FindMetaTable("Player")
+--
+--
+-- if SERVER then
+-- meta.Inventory.Prayers = {}
+--
+-- -- TODO:Make prayers limited or something
+-- function meta:HasPrayer(prayername)
+-- return self.Inventory.Prayers[prayername]
+-- end
+--
+-- function meta:RemovePrayer(prayername)
+-- self.Inventory.Prayers[prayername] = nil
+-- self:SynchPrayers()
+-- end
+--
+-- function ART.RemovePrayer(player,prayername)
+-- player:RemovePrayer(prayername)
+-- end
+--
+-- function meta:GivePrayer(prayername)
+-- print("Prayers are:")
+-- PrintTable(ART.Prayer)
+-- assert(ART.Prayer[prayername] ~= nil, "Attempted to give a nil prayer \"" .. prayername .. "\"")
+-- self.Inventory.Prayers[prayername] = true
+-- self:SynchPrayers()
+-- end
+--
+-- function ART.GivePrayer(player,prayername)
+-- player:GivePrayer(prayername)
+-- end
+--
+-- util.AddNetworkString( "art_synch_prayers" )
+-- util.AddNetworkString( "equiphelpprayer" )
+--
+-- function meta:SynchPrayers()
+-- print("Sending " .. table.Count(self.Inventory.Prayers) .. " prayers:")
+-- PrintTable(self.Inventory.Prayers)
+-- net.Start("art_synch_prayers")
+-- net.WriteUInt(table.Count(self.Inventory.Prayers),16)
+-- for k,v in pairs(self.Inventory.Prayers) do
+-- print("Writeing " .. k)
+-- net.WriteString(k)
+-- end
+-- net.Send(self)
+-- end
+-- end
+--
+-- concommand.Add("artery_giveprayer",function(ply,cmd,args)
+-- if not ply:IsAdmin() then return end
+-- ply:GivePrayer(args[1])
+-- end, concmd.AutocompleteFunction(table.GetKeys(ART.Prayer)), "Give an instance of a prayer to yourself")
+--
+-- if CLIENT then
+-- ART.MyPrayer = {}
+-- net.Receive("art_synch_prayers",function()
+-- ART.MyPrayer = {}
+-- for k = 1,net.ReadUInt(16) do
+-- local pstr = net.ReadString()
+-- print("Reading prayer " .. pstr)
+-- ART.MyPrayer[pstr] = true
+-- end
+-- print("Recived prayers:")
+-- PrintTable(ART.MyPrayer)
+-- ART.RefreshDisplays()
+-- end)
+-- end
+--
+-- function ART.GetPrayerByName(name)
+-- assert(ART.Prayer[name] ~= nil,"Attempted to get a nil prayer:" .. name)
+-- return ART.Prayer[name]
+-- end
+--
+-- concommand.Add("artery_printprayers",function(ply,cmd,args)
+-- if not ply:IsAdmin() then return end
+-- print("Items table:")
+-- PrintTable(ART.Prayer)
+-- end)
+--
+-- concommand.Add("artery_giveprayer",function(ply,cmd,args)
+-- if not ply:IsAdmin() then return end
+-- print("Trying to give an prayer:" .. args[1])
+-- ART.GivePrayer(ply,args[1])
+-- end, concmd.AutocompleteFunction(table.GetKeys(ART.Prayer)), "Give an item to the specified player, or yourself if no player is specified.")
diff --git a/gamemode/shared/prayersystem/prayers/lesserevasion.lua b/gamemode/shared/prayersystem/prayers/lesserevasion.lua
index 15077d3..040189e 100644
--- a/gamemode/shared/prayersystem/prayers/lesserevasion.lua
+++ b/gamemode/shared/prayersystem/prayers/lesserevasion.lua
@@ -1,66 +1,66 @@
-do return end
---[[
- An example item
-]]
-print("Hello from lesser evasion.lua")
-local prayer = {}
-
---Required, a name, all prayer names must be unique
-prayer.Name = "Lesser Evasion"
-
---Optional, a tooltip to display when hovered over
-prayer.Tooltip = "A prayer to the rouge god to allow you to quickly dodge to the left or right"
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
-local prayedplayers = {}
-local prayedplayerstime = {}
-if SERVER then
- util.AddNetworkString("art_prayer_lesserevasion")
- net.Receive("art_prayer_lesserevasion",function(ln,ply)
- if ply:HasPrayer(prayer.Name) and (prayedplayers[ply] == nil or CurTime() > prayedplayerstime[ply] + 5) then
- prayedplayers[ply] = true
- prayedplayerstime[ply] = CurTime()
- end
- end)
-end
-
-
-local lastprayer = CurTime()
-prayer.Pray = function(self)
- if SERVER then return end
- if CurTime() > lastprayer + 0 then
- net.Start("art_prayer_lesserevasion")
- net.SendToServer()
- lastprayer = CurTime()
- end
-end
-
-
-hook.Add( "SetupMove", "artery_prayer_lesserevasion", function( ply, mv, cmd )
- if prayedplayers[ply] and not ply:OnGround() then
- local mdir = ART.playermovedir(ply)
- if mdir == "left" or mdir == "right" then
- local noup = mv:GetVelocity()
- noup.z = 0
- local pow = 600 - noup:Length()
- mv:SetVelocity((noup * pow) + Vector(0, 0, 20))
- prayedplayers[ply] = false
- end
- end
-end )
-
-function prayer.DisplayHelp(panel)
- local helptxt = vgui.Create("DLabel",panel)
- helptxt:SetWrap(true)
- helptxt:SetText("Your reflexes quicken, allowing you to dodge eto the left or right every 5 seconds. Start moveing left or right, then jump")
- helptxt:SetSize(ScrW() / 4,ScrH() / 8)
- helptxt:SetDark(true)
-end
-
---Optional. Something run once when this item is drawn in a backpack
-function prayer.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "prayericons/lesserevasion.png")
-end
-
-
-ART.RegisterPrayer(prayer)
+-- do return end
+-- --[[
+-- An example item
+-- ]]
+-- print("Hello from lesser evasion.lua")
+-- local prayer = {}
+--
+-- --Required, a name, all prayer names must be unique
+-- prayer.Name = "Lesser Evasion"
+--
+-- --Optional, a tooltip to display when hovered over
+-- prayer.Tooltip = "A prayer to the rouge god to allow you to quickly dodge to the left or right"
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
+-- local prayedplayers = {}
+-- local prayedplayerstime = {}
+-- if SERVER then
+-- util.AddNetworkString("art_prayer_lesserevasion")
+-- net.Receive("art_prayer_lesserevasion",function(ln,ply)
+-- if ply:HasPrayer(prayer.Name) and (prayedplayers[ply] == nil or CurTime() > prayedplayerstime[ply] + 5) then
+-- prayedplayers[ply] = true
+-- prayedplayerstime[ply] = CurTime()
+-- end
+-- end)
+-- end
+--
+--
+-- local lastprayer = CurTime()
+-- prayer.Pray = function(self)
+-- if SERVER then return end
+-- if CurTime() > lastprayer + 0 then
+-- net.Start("art_prayer_lesserevasion")
+-- net.SendToServer()
+-- lastprayer = CurTime()
+-- end
+-- end
+--
+--
+-- hook.Add( "SetupMove", "artery_prayer_lesserevasion", function( ply, mv, cmd )
+-- if prayedplayers[ply] and not ply:OnGround() then
+-- local mdir = ART.playermovedir(ply)
+-- if mdir == "left" or mdir == "right" then
+-- local noup = mv:GetVelocity()
+-- noup.z = 0
+-- local pow = 600 - noup:Length()
+-- mv:SetVelocity((noup * pow) + Vector(0, 0, 20))
+-- prayedplayers[ply] = false
+-- end
+-- end
+-- end )
+--
+-- function prayer.DisplayHelp(panel)
+-- local helptxt = vgui.Create("DLabel",panel)
+-- helptxt:SetWrap(true)
+-- helptxt:SetText("Your reflexes quicken, allowing you to dodge eto the left or right every 5 seconds. Start moveing left or right, then jump")
+-- helptxt:SetSize(ScrW() / 4,ScrH() / 8)
+-- helptxt:SetDark(true)
+-- end
+--
+-- --Optional. Something run once when this item is drawn in a backpack
+-- function prayer.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "prayericons/lesserevasion.png")
+-- end
+--
+--
+-- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/ninelives.lua b/gamemode/shared/prayersystem/prayers/ninelives.lua
index 44b3099..707e8b6 100644
--- a/gamemode/shared/prayersystem/prayers/ninelives.lua
+++ b/gamemode/shared/prayersystem/prayers/ninelives.lua
@@ -1,50 +1,50 @@
-do return end
---[[
- An example prayer
-]]
-local prayer = {}
-
---Required, a name, all item names must be unique
-prayer.Name = "Nine Lives"
-
---Optional, a tooltip to display when hovered over
-prayer.Tooltip = "A prayer to the rouge god to prevent fall dammage for the next 9 falls that you would have taken dammage, or for 5 minutes, whichever comes first."
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
-local prayedplayers = {}
-if SERVER then
- util.AddNetworkString("art_prayer_ninelives")
- net.Receive("art_prayer_ninelives",function(ln,ply)
- if ply:HasPrayer("Nine Lives") then
- prayedplayers[ply] = 9
- timer.Simple(60 * 5,function()
- prayedplayers[ply] = nil
- end)
- end
- end)
-end
-
-
-local lastprayer = CurTime()
-prayer.Pray = function(self)
- if SERVER then return end
- if CurTime() > lastprayer + 0 then
- net.Start("art_prayer_ninelives")
- net.SendToServer()
- lastprayer = CurTime()
- end
-end
-
-hook.Add( "EntityTakeDamage" , "artery_ninelives" , function(ent,info)
- if info:GetDamageType() == DMG_FALL and prayedplayers[ent] ~= nil and prayedplayers[ent] > 0 then
- info:SetDamage(0)
- end
-end)
-
---Optional. Something run once when this item is drawn in a backpack
-function prayer.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "prayericons/ninelives.png")
-end
-
-
-ART.RegisterPrayer(prayer)
+-- do return end
+-- --[[
+-- An example prayer
+-- ]]
+-- local prayer = {}
+--
+-- --Required, a name, all item names must be unique
+-- prayer.Name = "Nine Lives"
+--
+-- --Optional, a tooltip to display when hovered over
+-- prayer.Tooltip = "A prayer to the rouge god to prevent fall dammage for the next 9 falls that you would have taken dammage, or for 5 minutes, whichever comes first."
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
+-- local prayedplayers = {}
+-- if SERVER then
+-- util.AddNetworkString("art_prayer_ninelives")
+-- net.Receive("art_prayer_ninelives",function(ln,ply)
+-- if ply:HasPrayer("Nine Lives") then
+-- prayedplayers[ply] = 9
+-- timer.Simple(60 * 5,function()
+-- prayedplayers[ply] = nil
+-- end)
+-- end
+-- end)
+-- end
+--
+--
+-- local lastprayer = CurTime()
+-- prayer.Pray = function(self)
+-- if SERVER then return end
+-- if CurTime() > lastprayer + 0 then
+-- net.Start("art_prayer_ninelives")
+-- net.SendToServer()
+-- lastprayer = CurTime()
+-- end
+-- end
+--
+-- hook.Add( "EntityTakeDamage" , "artery_ninelives" , function(ent,info)
+-- if info:GetDamageType() == DMG_FALL and prayedplayers[ent] ~= nil and prayedplayers[ent] > 0 then
+-- info:SetDamage(0)
+-- end
+-- end)
+--
+-- --Optional. Something run once when this item is drawn in a backpack
+-- function prayer.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "prayericons/ninelives.png")
+-- end
+--
+--
+-- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/notdarkrp.lua b/gamemode/shared/prayersystem/prayers/notdarkrp.lua
index 426500b..a7a5761 100644
--- a/gamemode/shared/prayersystem/prayers/notdarkrp.lua
+++ b/gamemode/shared/prayersystem/prayers/notdarkrp.lua
@@ -1,77 +1,77 @@
-do return end
---[[
- A default prayer given to new players who try to press f4
-]]
-local prayer = {}
-
---Required, a name, all prayer names must be unique
-prayer.Name = "Noob Help"
-
---Optional, a tooltip to display when hovered over
-prayer.Tooltip = "Hello, and welcome to Artery, Enjoy your stay"
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
-
-local lastpray = CurTime()
-
-function prayer.Pray(self)
- if SERVER then return end
- if CurTime() > lastpray + 5 then
- local helppanel = vgui.Create("DFrame")
- helppanel:SetSize(ScrW()/3,ScrH())
- helppanel:Center()
- helppanel:MakePopup()
- helppanel:SetText("Help")
-
- lastpray = CurTime()
- end
-end
-
-if SERVER then
- util.AddNetworkString( "art_prayer_darkrphelp" )
-
- net.Receive( "art_prayer_darkrphelp", function(ln,ply)
- print("Prayer received")
- if ply:HasPrayer("Noob Help") then
- ply:RemovePrayer("Noob Help")
- ply:SetCredits(ply:GetCredits() + 100)
- else
- print("You don't have that prayer!")
- end
- end)
-end
-
-function prayer.DisplayHelp(panel)
- print("Help displayed")
- local dll = vgui.Create( "DListLayout", panel)
- dll:Dock(FILL)
- local helptxt = vgui.Create("DLabel")
- helptxt:SetWrap(true)
- helptxt:SetText("Welcome to Artery! Since you don't really need this help anymore, you can click below to redeem it for 100 credits!")
- helptxt:SetSize(ScrW()/4,ScrH()/8)
- helptxt:SetDark(true)
- dll:Add(helptxt)
- local redeembutton = vgui.Create("DButton")
- dll:Add(redeembutton)
- redeembutton:Dock(BOTTOM)
- --helptxt:Dock(TOP)
- redeembutton:SetText("Redeem")
- redeembutton.DoClick = function(self)
- print("You clicked redeem!")
- net.Start("art_prayer_darkrphelp")
- net.SendToServer()
- end
-end
-
---Optional. Something run once when this item is drawn in a backpack
-function prayer.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
-end
-
---Optional. Called continuously, use if you need the item to display different stuff at different tiems
-function prayer.Paint(self,width,height)
- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
-end
-
-print("Hello from prayersystem/prayers/lesserevasion.lua")
-ART.RegisterPrayer(prayer)
+-- do return end
+-- --[[
+-- A default prayer given to new players who try to press f4
+-- ]]
+-- local prayer = {}
+--
+-- --Required, a name, all prayer names must be unique
+-- prayer.Name = "Noob Help"
+--
+-- --Optional, a tooltip to display when hovered over
+-- prayer.Tooltip = "Hello, and welcome to Artery, Enjoy your stay"
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
+--
+-- local lastpray = CurTime()
+--
+-- function prayer.Pray(self)
+-- if SERVER then return end
+-- if CurTime() > lastpray + 5 then
+-- local helppanel = vgui.Create("DFrame")
+-- helppanel:SetSize(ScrW()/3,ScrH())
+-- helppanel:Center()
+-- helppanel:MakePopup()
+-- helppanel:SetText("Help")
+--
+-- lastpray = CurTime()
+-- end
+-- end
+--
+-- if SERVER then
+-- util.AddNetworkString( "art_prayer_darkrphelp" )
+--
+-- net.Receive( "art_prayer_darkrphelp", function(ln,ply)
+-- print("Prayer received")
+-- if ply:HasPrayer("Noob Help") then
+-- ply:RemovePrayer("Noob Help")
+-- ply:SetCredits(ply:GetCredits() + 100)
+-- else
+-- print("You don't have that prayer!")
+-- end
+-- end)
+-- end
+--
+-- function prayer.DisplayHelp(panel)
+-- print("Help displayed")
+-- local dll = vgui.Create( "DListLayout", panel)
+-- dll:Dock(FILL)
+-- local helptxt = vgui.Create("DLabel")
+-- helptxt:SetWrap(true)
+-- helptxt:SetText("Welcome to Artery! Since you don't really need this help anymore, you can click below to redeem it for 100 credits!")
+-- helptxt:SetSize(ScrW()/4,ScrH()/8)
+-- helptxt:SetDark(true)
+-- dll:Add(helptxt)
+-- local redeembutton = vgui.Create("DButton")
+-- dll:Add(redeembutton)
+-- redeembutton:Dock(BOTTOM)
+-- --helptxt:Dock(TOP)
+-- redeembutton:SetText("Redeem")
+-- redeembutton.DoClick = function(self)
+-- print("You clicked redeem!")
+-- net.Start("art_prayer_darkrphelp")
+-- net.SendToServer()
+-- end
+-- end
+--
+-- --Optional. Something run once when this item is drawn in a backpack
+-- function prayer.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
+-- end
+--
+-- --Optional. Called continuously, use if you need the item to display different stuff at different tiems
+-- function prayer.Paint(self,width,height)
+-- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
+-- end
+--
+-- print("Hello from prayersystem/prayers/lesserevasion.lua")
+-- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
index e317dd5..b056f74 100644
--- a/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
+++ b/gamemode/shared/prayersystem/prayers/preditorinstinct.lua
@@ -1,68 +1,68 @@
-do return end
---[[
- An example item
-]]
-local prayer = {}
-
---Required, a name, all item names must be unique
-prayer.Name = "Preditor Instinct"
-
---Optional, a tooltip to display when hovered over
-prayer.Tooltip = "A prayer to the rouge god to grant you 30% movement when chaseing a wounded target"
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
-local prayedplayers = {}
-if SERVER then
- util.AddNetworkString("art_prayer_preditorinstinct")
- net.Receive("art_prayer_preditorinstinct",function(ln,ply)
- if ply:HasItem(item.Name) then
- prayedplayers[ply] = true
- timer.Simple(60,function()
- prayedplayers[ply] = nil
- end)
- end
- end)
-end
-
-local lastprayer = CurTime()
-prayer.Pray = function(self)
- if SERVER then return end
- if CurTime() > lastprayer + 0 then
- net.Start("art_prayer_preditorinstinct")
- net.SendToServer()
- lastprayer = CurTime()
- end
-end
---called continuously to buff players
-local buffedplayers = {}
-local function buffplayers()
- for k,v in pairs(prayedplayers) do
- if buffedplayers[k] ~= nil then continue end
- --Find nearby wounded players or npcs
- print("Checking if ", k, "should be buffed")
- local wents = ents.FindInSphere(k:GetPos()+Vector(0,0,64),500)
- for i,j in pairs(wents) do
- print("Checking if ",j, "has taken dammage")
- if k ~= j and j:Health() < j:GetMaxHealth() then
- print("I buffed a player",k, "because ", j ,"has taken dammage")
- k:SetWalkSpeed(k:GetWalkSpeed()*1.3)
- buffedplayers[k] = true
- timer.Simple(60,function()
- k:SetWalkSpeed(k:GetWalkSpeed()*(1/1.3))
- buffedplayers[k] = nil
- end)
- goto nextply
- end
- end
- ::nextply::
- end
- timer.Simple(2,buffplayers)
-end
-buffplayers()
-
---Optional. Something run once when this item is drawn in a backpack
-function prayer.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "prayericons/preditorinstinct.png")
-end
-
-ART.RegisterPrayer(prayer)
+-- do return end
+-- --[[
+-- An example item
+-- ]]
+-- local prayer = {}
+--
+-- --Required, a name, all item names must be unique
+-- prayer.Name = "Preditor Instinct"
+--
+-- --Optional, a tooltip to display when hovered over
+-- prayer.Tooltip = "A prayer to the rouge god to grant you 30% movement when chaseing a wounded target"
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
+-- local prayedplayers = {}
+-- if SERVER then
+-- util.AddNetworkString("art_prayer_preditorinstinct")
+-- net.Receive("art_prayer_preditorinstinct",function(ln,ply)
+-- if ply:HasItem(item.Name) then
+-- prayedplayers[ply] = true
+-- timer.Simple(60,function()
+-- prayedplayers[ply] = nil
+-- end)
+-- end
+-- end)
+-- end
+--
+-- local lastprayer = CurTime()
+-- prayer.Pray = function(self)
+-- if SERVER then return end
+-- if CurTime() > lastprayer + 0 then
+-- net.Start("art_prayer_preditorinstinct")
+-- net.SendToServer()
+-- lastprayer = CurTime()
+-- end
+-- end
+-- --called continuously to buff players
+-- local buffedplayers = {}
+-- local function buffplayers()
+-- for k,v in pairs(prayedplayers) do
+-- if buffedplayers[k] ~= nil then continue end
+-- --Find nearby wounded players or npcs
+-- print("Checking if ", k, "should be buffed")
+-- local wents = ents.FindInSphere(k:GetPos()+Vector(0,0,64),500)
+-- for i,j in pairs(wents) do
+-- print("Checking if ",j, "has taken dammage")
+-- if k ~= j and j:Health() < j:GetMaxHealth() then
+-- print("I buffed a player",k, "because ", j ,"has taken dammage")
+-- k:SetWalkSpeed(k:GetWalkSpeed()*1.3)
+-- buffedplayers[k] = true
+-- timer.Simple(60,function()
+-- k:SetWalkSpeed(k:GetWalkSpeed()*(1/1.3))
+-- buffedplayers[k] = nil
+-- end)
+-- goto nextply
+-- end
+-- end
+-- ::nextply::
+-- end
+-- timer.Simple(2,buffplayers)
+-- end
+-- buffplayers()
+--
+-- --Optional. Something run once when this item is drawn in a backpack
+-- function prayer.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "prayericons/preditorinstinct.png")
+-- end
+--
+-- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/prayersystem/prayers/thickskin.lua b/gamemode/shared/prayersystem/prayers/thickskin.lua
index 71f1612..817cb44 100644
--- a/gamemode/shared/prayersystem/prayers/thickskin.lua
+++ b/gamemode/shared/prayersystem/prayers/thickskin.lua
@@ -1,60 +1,60 @@
-do return end
---[[
- An example prayer
-]]
-local prayer = {}
-
---Required, a name, all item names must be unique
-prayer.Name = "Thick Skin"
-
---Optional, a tooltip to display when hovered over
-prayer.Tooltip = "A prayer to the warrior god to grant you 20% resistance to all dammage"
-
---Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
-prayer.Serialize = function(self)
- print("Trying to serailize!")
- return ""
-end
-
---Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
-prayer.DeSerialize = function(self,string)
- print("Trying to deserialize!")
- return self
-end
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
-local prayedplayers = {}
-if SERVER then
- util.AddNetworkString("art_prayer_thickskin")
- net.Receive("art_prayer_thickskin",function(ln,ply)
- if ply:HasItem("Thick Skin") then
- prayedplayers[ply] = true
- timer.Simple(120,function()
- prayedplayers[ply] = nil
- end)
- end
- end)
-end
-
-local lastprayer = CurTime()
-prayer.Pray = function(self)
- if SERVER then return end
- if CurTime() > lastprayer + 0 then
- net.Start("art_prayer_thickskin")
- net.SendToServer()
- lastprayer = CurTime()
- end
-end
-hook.Add( "EntityTakeDamage" , "artery_thickskin" , function(ent,info)
- if prayedplayers[ent] then
- info:SetDamage(info:GetDamage()*0.8)
- end
-end)
-
---Optional. Something run once when this item is drawn in a backpack
-function prayer.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "prayericons/thickskin.png")
-end
-
-
-ART.RegisterPrayer(prayer)
+-- do return end
+-- --[[
+-- An example prayer
+-- ]]
+-- local prayer = {}
+--
+-- --Required, a name, all item names must be unique
+-- prayer.Name = "Thick Skin"
+--
+-- --Optional, a tooltip to display when hovered over
+-- prayer.Tooltip = "A prayer to the warrior god to grant you 20% resistance to all dammage"
+--
+-- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
+-- prayer.Serialize = function(self)
+-- print("Trying to serailize!")
+-- return ""
+-- end
+--
+-- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
+-- prayer.DeSerialize = function(self,string)
+-- print("Trying to deserialize!")
+-- return self
+-- end
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something server side, you'll need to use the net library. Remember that items are in the shared domain, so you can define what it does in the same file!
+-- local prayedplayers = {}
+-- if SERVER then
+-- util.AddNetworkString("art_prayer_thickskin")
+-- net.Receive("art_prayer_thickskin",function(ln,ply)
+-- if ply:HasItem("Thick Skin") then
+-- prayedplayers[ply] = true
+-- timer.Simple(120,function()
+-- prayedplayers[ply] = nil
+-- end)
+-- end
+-- end)
+-- end
+--
+-- local lastprayer = CurTime()
+-- prayer.Pray = function(self)
+-- if SERVER then return end
+-- if CurTime() > lastprayer + 0 then
+-- net.Start("art_prayer_thickskin")
+-- net.SendToServer()
+-- lastprayer = CurTime()
+-- end
+-- end
+-- hook.Add( "EntityTakeDamage" , "artery_thickskin" , function(ent,info)
+-- if prayedplayers[ent] then
+-- info:SetDamage(info:GetDamage()*0.8)
+-- end
+-- end)
+--
+-- --Optional. Something run once when this item is drawn in a backpack
+-- function prayer.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "prayericons/thickskin.png")
+-- end
+--
+--
+-- ART.RegisterPrayer(prayer)
diff --git a/gamemode/shared/questsystem/examplequest.lua b/gamemode/shared/questsystem/examplequest.lua
index 6473044..21c8a7e 100644
--- a/gamemode/shared/questsystem/examplequest.lua
+++ b/gamemode/shared/questsystem/examplequest.lua
@@ -1,14 +1,14 @@
-do return end
-if SERVER then return end
-local quest = {}
-
-quest.Name = "Example Quest"
-
---[[
- Given a DPanel, draw some text that the player can use when going through quests.
-]]
-function quest.DrawQuestInfo(panel, status)
-
-end
-
-ART.RegisterQuest(quest)
+-- do return end
+-- if SERVER then return end
+-- local quest = {}
+--
+-- quest.Name = "Example Quest"
+--
+-- --[[
+-- Given a DPanel, draw some text that the player can use when going through quests.
+-- ]]
+-- function quest.DrawQuestInfo(panel, status)
+--
+-- end
+--
+-- ART.RegisterQuest(quest)
diff --git a/gamemode/shared/questsystem/subterr_generator.lua b/gamemode/shared/questsystem/subterr_generator.lua
index f946a7a..67a1f55 100644
--- a/gamemode/shared/questsystem/subterr_generator.lua
+++ b/gamemode/shared/questsystem/subterr_generator.lua
@@ -1,25 +1,25 @@
-do return end
-if SERVER then return end
-local quest = {}
-
-quest.Name = "Subterr_generator"
-
-local questtext = {
- [1] = "Visit the Tinkerer to see if he has a replacement Toggle Chip",
- [2] = "V̶i̶s̶i̶t̶ ̶t̶h̶e̶ ̶T̶i̶n̶k̶e̶r̶e̶r̶ ̶t̶o̶ ̶s̶e̶e̶ ̶i̶f̶ ̶h̶e̶ ̶h̶a̶s̶ ̶a̶ ̶r̶e̶p̶l̶a̶c̶e̶m̶e̶n̶t̶ ̶T̶o̶g̶g̶l̶e̶ ̶C̶h̶i̶p̶\n\nGet the toggle chip back to Tom",
- [3] = "V̶i̶s̶i̶t̶ ̶t̶h̶e̶ ̶T̶i̶n̶k̶e̶r̶e̶r̶ ̶t̶o̶ ̶s̶e̶e̶ ̶i̶f̶ ̶h̶e̶ ̶h̶a̶s̶ ̶a̶ ̶r̶e̶p̶l̶a̶c̶e̶m̶e̶n̶t̶ ̶T̶o̶g̶g̶l̶e̶ ̶C̶h̶i̶p̶\nG̶e̶t̶ ̶t̶h̶e̶ ̶t̶o̶g̶g̶l̶e̶ ̶c̶h̶i̶p̶ ̶b̶a̶c̶k̶ ̶t̶o̶ ̶T̶o̶m̶\nLooks like the generator is working again!\n(QUEST COMPLETE)"
-}
-
-quest.DrawQuestInfo = function(panel,status)
- print("Drawing quest info!")
- local label = vgui.Create( "DLabel", panel )
- --label:Dock(FILL)
- --label:Dock(BOTTOM)
- label:SetSize((ScrW() / 4) - 20,(ScrH() / 2) - 50)
- --label.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Color(0,160,167)) end
- label:SetWrap(true)
- label:SetText( questtext[status] )
- label:SetDark()
-end
-
-ART.RegisterQuest(quest)
+-- do return end
+-- if SERVER then return end
+-- local quest = {}
+--
+-- quest.Name = "Subterr_generator"
+--
+-- local questtext = {
+-- [1] = "Visit the Tinkerer to see if he has a replacement Toggle Chip",
+-- [2] = "V̶i̶s̶i̶t̶ ̶t̶h̶e̶ ̶T̶i̶n̶k̶e̶r̶e̶r̶ ̶t̶o̶ ̶s̶e̶e̶ ̶i̶f̶ ̶h̶e̶ ̶h̶a̶s̶ ̶a̶ ̶r̶e̶p̶l̶a̶c̶e̶m̶e̶n̶t̶ ̶T̶o̶g̶g̶l̶e̶ ̶C̶h̶i̶p̶\n\nGet the toggle chip back to Tom",
+-- [3] = "V̶i̶s̶i̶t̶ ̶t̶h̶e̶ ̶T̶i̶n̶k̶e̶r̶e̶r̶ ̶t̶o̶ ̶s̶e̶e̶ ̶i̶f̶ ̶h̶e̶ ̶h̶a̶s̶ ̶a̶ ̶r̶e̶p̶l̶a̶c̶e̶m̶e̶n̶t̶ ̶T̶o̶g̶g̶l̶e̶ ̶C̶h̶i̶p̶\nG̶e̶t̶ ̶t̶h̶e̶ ̶t̶o̶g̶g̶l̶e̶ ̶c̶h̶i̶p̶ ̶b̶a̶c̶k̶ ̶t̶o̶ ̶T̶o̶m̶\nLooks like the generator is working again!\n(QUEST COMPLETE)"
+-- }
+--
+-- quest.DrawQuestInfo = function(panel,status)
+-- print("Drawing quest info!")
+-- local label = vgui.Create( "DLabel", panel )
+-- --label:Dock(FILL)
+-- --label:Dock(BOTTOM)
+-- label:SetSize((ScrW() / 4) - 20,(ScrH() / 2) - 50)
+-- --label.Paint = function(self,w,h) draw.RoundedBox(4,0,0,w,h,Color(0,160,167)) end
+-- label:SetWrap(true)
+-- label:SetText( questtext[status] )
+-- label:SetDark()
+-- end
+--
+-- ART.RegisterQuest(quest)
diff --git a/gamemode/shared/sh_setup.lua b/gamemode/shared/sh_setup.lua
index 66fb829..fabfdcf 100644
--- a/gamemode/shared/sh_setup.lua
+++ b/gamemode/shared/sh_setup.lua
@@ -1,168 +1,168 @@
-do return end
---[=[
---[[
- Some values that need to be setup by the server owner
-]]
-
-local aes = include("aes.lua")
-local ECBMode = include("lockbox/ecb.lua")
-local ZeroPadding = include("lockbox/padding.lua")
-local Array = include("lockbox/array.lua")
-local Stream = include("lockbox/stream.lua")
-print("sh_setup included aes successfully")
-
-local valuesneeded = {
- ["mysql DB host"] = "String",
- ["mysql DB dbname"] = "String",
- ["mysql DB uname"] = "String",
- ["mysql DB pass"] = "String",
- ["mysql should encrypt pass"] = "Bool",
- ["mysql encrypt password"] = "String",
- ["world default server ip:port"] = "String",
-}
-
-ART.Config = ART.Config or {}
-
-if SERVER then
- util.AddNetworkString( "ART_CONFIG_WRITE" )
- local function ReadConfig(encryptkey)
- encryptkey = encryptkey or ""
- local ftext = file.Read("artery/config.txt", "DATA")
- if ftext == nil then
- print("Failed to read Config file, if this is a new setup, use art_setup to get started.")
- return
- end
- local tbl = string.Explode("\n",ftext,false)
- local strtbl = {}
- for k,v in pairs(tbl) do
- local ltext = v:Explode(":",false)
- strtbl[ltext[1]] = ltext[2]
- end
- for k,v in pairs(valuesneeded) do
- local tfunc = "to" .. v:lower()
- ART.Config[k] = _G[tfunc](strtbl[k])
- end
- if ART.Config["mysql should encrypt pass"] then
- if encryptkey == "" then
- print("Failed to retrive MySQL database password, please enter it with the \"artery_dbpasswordkey\" command.")
- return
- end
- ART.Config["mysql DB pass"] = aes.decrypt(lockstream.fromString(encryptkey),lockstream.fromString(ART.Config["mysql DB pass"]))
- end
- end
-
- ReadConfig()
-
- net.Receive( "ART_CONFIG_MYSQLPASS", function(len,ply)
- if not ply:IsAdmin() then
- return
- end
- end)
-
- net.Receive( "ART_CONFIG_WRITE", function(len,ply)
- print("Received write signal")
- if not ply:IsAdmin() then return end
- print("You're an admin!")
- for k,v in pairs(valuesneeded) do
- local ftype = "Read" .. v
- ART.Config[k] = net[ftype]()
- end
- if ART.Config["mysql should encrypt pass"] then
- local key = ART.Config["mysql encrypt password"]
- local block = ART.Config["mysql DB pass"]
- local akey = Array.fromString(key)
- local ablock = Array.fromString(block)
- local skey = Stream.fromString(key)
- local sblock = Stream.fromString(block)
- --print("sblock:" .. sblock)
- --print("skey:" .. skey)
- local cipher = ECBMode.Cipher().setKey(akey).setBlockCipher(aes).setPadding(ZeroPadding)
- local ciphertxt = cipher.init().update(sblock).finish().asHex()
- local decipher = ECBMode.Decipher().setKey(akey).setBlockCipher(aes).setPadding(ZeroPadding)
- local deciphertxt = decipher.init().update(Stream.fromHex(ciphertxt)).finish().asHex()
- print("Cyphertext of " .. block .. " is " .. ciphertxt)
- print("Deciphertext of " .. ciphertxt .. " is " .. deciphertxt)
- ART.Config["mysql DB pass"] = ciphertxt
- end
- local ftext = {}
- for k,v in pairs(ART.Config) do
- ftext[#ftext + 1] = k .. "=" .. tostring(v)
- end
- local wtext = table.concat(ftext,"\n")
- print("Writeing:" .. wtext)
- file.Write("artery/config.txt",wtext)
- end)
-
- net.Receive( "ART_CONFIG_REQUEST", function(len,ply)
- if not ply:IsAdmin() then return end
- for k,v in pairs(valuesneeded) do
- local ftype = "Write" .. v
- print("Calling " .. ftype .. " on " .. tostring(tbl[k]))
- net[ftype](tbl[k])
- end
- end)
-end
-
-print("Got to before concommands were added")
-
-concommand.Add("artery_dbpasswordkey",function()
- if CLIENT then return end
-
-end, nil, "Sets the encryption key for the mysql database password")
-
-if CLIENT then
- print("Got to before setup command")
-
- concommand.Add("artery_setup", function(ply,cmd,args)
- print("setup called")
- if SERVER then return end
- print("Got past server gaurd")
- local width = ScrW()
- local height = ScrH()
- local configpanel = vgui.Create( "DFrame" )
- configpanel:SetPos( 0, height/8 )
- configpanel:SetSize( width/4, (height/4)*3 )
- configpanel:SetTitle( "Artery Settings" )
- configpanel:SetDraggable( true )
- configpanel:MakePopup()
- local scrollpanel = vgui.Create( "DScrollPanel", configpanel )
- scrollpanel:Dock(FILL)
- local entries = {}
- for k,v in pairs(valuesneeded) do
- local settinglabel = vgui.Create( "DLabel", scrollpanel )
- settinglabel:Dock(TOP)
- settinglabel:SetText( k )
- scrollpanel:AddItem(settinglabel)
- local settingentry
- if v == "String" then
- settingentry = vgui.Create( "DTextEntry", scrollpanel )
- settingentry:SetSize(width/10,18)
- settingentry:Dock(TOP)
- elseif v == "Bool" then
- settingentry = vgui.Create( "DCheckBox", holder)
- settingentry:Dock(TOP)
- --settingentry:SetSize(18,18)
- end
- scrollpanel:AddItem(settingentry)
- entries[k] = settingentry
- end
- local savebutton = vgui.Create( "DButton",scrollpanel )
- savebutton.DoClick = function()
- net.Start( "ART_CONFIG_WRITE")
- for k,v in pairs(valuesneeded) do
- local nfunc = "Write"..v
- local value = nil
- if v == "String" then value = entries[k]:GetValue()
- elseif v == "Bool" then value = entries[k]:GetChecked() end
- assert(value ~= nil, "Didn't know setting type:" .. v .. " for " .. k)
- print("Doing " .. nfunc .. " on " .. tostring(value))
- net[nfunc](value)
- end
- net.SendToServer()
- end
- savebutton:SetText("Save config")
- savebutton:Dock(TOP)
- scrollpanel:AddItem(savebutton)
- end)
-end
-]=]
+-- do return end
+-- --[=[
+-- --[[
+-- Some values that need to be setup by the server owner
+-- ]]
+--
+-- local aes = include("aes.lua")
+-- local ECBMode = include("lockbox/ecb.lua")
+-- local ZeroPadding = include("lockbox/padding.lua")
+-- local Array = include("lockbox/array.lua")
+-- local Stream = include("lockbox/stream.lua")
+-- print("sh_setup included aes successfully")
+--
+-- local valuesneeded = {
+-- ["mysql DB host"] = "String",
+-- ["mysql DB dbname"] = "String",
+-- ["mysql DB uname"] = "String",
+-- ["mysql DB pass"] = "String",
+-- ["mysql should encrypt pass"] = "Bool",
+-- ["mysql encrypt password"] = "String",
+-- ["world default server ip:port"] = "String",
+-- }
+--
+-- ART.Config = ART.Config or {}
+--
+-- if SERVER then
+-- util.AddNetworkString( "ART_CONFIG_WRITE" )
+-- local function ReadConfig(encryptkey)
+-- encryptkey = encryptkey or ""
+-- local ftext = file.Read("artery/config.txt", "DATA")
+-- if ftext == nil then
+-- print("Failed to read Config file, if this is a new setup, use art_setup to get started.")
+-- return
+-- end
+-- local tbl = string.Explode("\n",ftext,false)
+-- local strtbl = {}
+-- for k,v in pairs(tbl) do
+-- local ltext = v:Explode(":",false)
+-- strtbl[ltext[1]] = ltext[2]
+-- end
+-- for k,v in pairs(valuesneeded) do
+-- local tfunc = "to" .. v:lower()
+-- ART.Config[k] = _G[tfunc](strtbl[k])
+-- end
+-- if ART.Config["mysql should encrypt pass"] then
+-- if encryptkey == "" then
+-- print("Failed to retrive MySQL database password, please enter it with the \"artery_dbpasswordkey\" command.")
+-- return
+-- end
+-- ART.Config["mysql DB pass"] = aes.decrypt(lockstream.fromString(encryptkey),lockstream.fromString(ART.Config["mysql DB pass"]))
+-- end
+-- end
+--
+-- ReadConfig()
+--
+-- net.Receive( "ART_CONFIG_MYSQLPASS", function(len,ply)
+-- if not ply:IsAdmin() then
+-- return
+-- end
+-- end)
+--
+-- net.Receive( "ART_CONFIG_WRITE", function(len,ply)
+-- print("Received write signal")
+-- if not ply:IsAdmin() then return end
+-- print("You're an admin!")
+-- for k,v in pairs(valuesneeded) do
+-- local ftype = "Read" .. v
+-- ART.Config[k] = net[ftype]()
+-- end
+-- if ART.Config["mysql should encrypt pass"] then
+-- local key = ART.Config["mysql encrypt password"]
+-- local block = ART.Config["mysql DB pass"]
+-- local akey = Array.fromString(key)
+-- local ablock = Array.fromString(block)
+-- local skey = Stream.fromString(key)
+-- local sblock = Stream.fromString(block)
+-- --print("sblock:" .. sblock)
+-- --print("skey:" .. skey)
+-- local cipher = ECBMode.Cipher().setKey(akey).setBlockCipher(aes).setPadding(ZeroPadding)
+-- local ciphertxt = cipher.init().update(sblock).finish().asHex()
+-- local decipher = ECBMode.Decipher().setKey(akey).setBlockCipher(aes).setPadding(ZeroPadding)
+-- local deciphertxt = decipher.init().update(Stream.fromHex(ciphertxt)).finish().asHex()
+-- print("Cyphertext of " .. block .. " is " .. ciphertxt)
+-- print("Deciphertext of " .. ciphertxt .. " is " .. deciphertxt)
+-- ART.Config["mysql DB pass"] = ciphertxt
+-- end
+-- local ftext = {}
+-- for k,v in pairs(ART.Config) do
+-- ftext[#ftext + 1] = k .. "=" .. tostring(v)
+-- end
+-- local wtext = table.concat(ftext,"\n")
+-- print("Writeing:" .. wtext)
+-- file.Write("artery/config.txt",wtext)
+-- end)
+--
+-- net.Receive( "ART_CONFIG_REQUEST", function(len,ply)
+-- if not ply:IsAdmin() then return end
+-- for k,v in pairs(valuesneeded) do
+-- local ftype = "Write" .. v
+-- print("Calling " .. ftype .. " on " .. tostring(tbl[k]))
+-- net[ftype](tbl[k])
+-- end
+-- end)
+-- end
+--
+-- print("Got to before concommands were added")
+--
+-- concommand.Add("artery_dbpasswordkey",function()
+-- if CLIENT then return end
+--
+-- end, nil, "Sets the encryption key for the mysql database password")
+--
+-- if CLIENT then
+-- print("Got to before setup command")
+--
+-- concommand.Add("artery_setup", function(ply,cmd,args)
+-- print("setup called")
+-- if SERVER then return end
+-- print("Got past server gaurd")
+-- local width = ScrW()
+-- local height = ScrH()
+-- local configpanel = vgui.Create( "DFrame" )
+-- configpanel:SetPos( 0, height/8 )
+-- configpanel:SetSize( width/4, (height/4)*3 )
+-- configpanel:SetTitle( "Artery Settings" )
+-- configpanel:SetDraggable( true )
+-- configpanel:MakePopup()
+-- local scrollpanel = vgui.Create( "DScrollPanel", configpanel )
+-- scrollpanel:Dock(FILL)
+-- local entries = {}
+-- for k,v in pairs(valuesneeded) do
+-- local settinglabel = vgui.Create( "DLabel", scrollpanel )
+-- settinglabel:Dock(TOP)
+-- settinglabel:SetText( k )
+-- scrollpanel:AddItem(settinglabel)
+-- local settingentry
+-- if v == "String" then
+-- settingentry = vgui.Create( "DTextEntry", scrollpanel )
+-- settingentry:SetSize(width/10,18)
+-- settingentry:Dock(TOP)
+-- elseif v == "Bool" then
+-- settingentry = vgui.Create( "DCheckBox", holder)
+-- settingentry:Dock(TOP)
+-- --settingentry:SetSize(18,18)
+-- end
+-- scrollpanel:AddItem(settingentry)
+-- entries[k] = settingentry
+-- end
+-- local savebutton = vgui.Create( "DButton",scrollpanel )
+-- savebutton.DoClick = function()
+-- net.Start( "ART_CONFIG_WRITE")
+-- for k,v in pairs(valuesneeded) do
+-- local nfunc = "Write"..v
+-- local value = nil
+-- if v == "String" then value = entries[k]:GetValue()
+-- elseif v == "Bool" then value = entries[k]:GetChecked() end
+-- assert(value ~= nil, "Didn't know setting type:" .. v .. " for " .. k)
+-- print("Doing " .. nfunc .. " on " .. tostring(value))
+-- net[nfunc](value)
+-- end
+-- net.SendToServer()
+-- end
+-- savebutton:SetText("Save config")
+-- savebutton:Dock(TOP)
+-- scrollpanel:AddItem(savebutton)
+-- end)
+-- end
+-- ]=]
diff --git a/gamemode/shared/shop.lua b/gamemode/shared/shop.lua
index 679035f..ecb8e71 100644
--- a/gamemode/shared/shop.lua
+++ b/gamemode/shared/shop.lua
@@ -1,175 +1,175 @@
-do return end
---[[
- Displays shop npc's interfaces
-
- public functions:
- (sv)ART.OpenShop(shoptbl, ply) :: nil
- (sv)ART.CreateShop(npctbl) :: nil
- net messages:
- art_openshop
-]]
-
-local ivf = include("inventory_common.lua")
-ART = ART or {}
-
-if SERVER then
- for k,v in pairs({
- "art_openshop",
- "art_buyitem",
- "art_sellitem",
- }) do
- util.AddNetworkString(v)
- end
-
- function ART.OpenShop(tbl, ply)
- print("Called openshop!")
- print("tbl was")
- PrintTable(tbl)
- if CLIENT then return end
- net.Start("art_openshop")
- net.WriteTable(tbl)
- net.Send(ply)
- end
-
- function ART.CreateShop(npc)
- print("Createing shop npc")
- local npcent = ents.Create("npc_shop")
- for k,v in pairs(npc) do
- npcent[k] = v
- end
- npcent:Spawn()
- print("Called spawn")
- end
-
-end
-
-if SERVER then return end
-local w,h = ScrW(),ScrH()
-local function DrawShopItemOnDPanel(dp,itemtbl,cost)
- --An item is a string, and int cost
-
- local shape = itemtbl.Shape
- local twidth,theight = 0,#shape
- for k=1,#shape do
- twidth = math.max(twidth,#shape[k])
- end
-
- local slotsize = math.Round(w / 32)
- local backgrid = vgui.Create( "DGrid", dp )
- backgrid:SetPos( 10, 30 )
- backgrid:SetCols( twidth )
- backgrid:SetColWide( theight )
- backgrid:Dock(LEFT)
-
- local shopicon = vgui.Create( "DImageButton", dp )
- shopicon:SetSize(slotsize * twidth, slotsize * theight)
- shopicon:SetPos(0,0)
- shopicon:SetText(itemtbl.Name)
- if itemtbl.Tooltip then
- shopicon:SetTooltip(itemtbl.Tooltip)
- end
- if itemtbl.Paint then
- shopicon.Paint = itemtbl.Paint
- end
- if itemtbl.DoOnPanel then
- itemtbl.DoOnPanel(shopicon)
- end
- shopicon.Paint = function(self, w, h)
- surface.SetDrawColor( 0, 0, 0, 255 )
- surface.DrawOutlinedRect( 0, 0, w, h)
- end
- shopicon.DoClick = function()
- print("You cliked me!")
- end
- shopicon.Item = itemtbl
- shopicon.Cost = cost
- shopicon:Droppable("Inventory")
- shopicon.ondropped = function(back,j,i,item)
- print("ondropped was called!")
- print("back",back,"j",j,"i",i,"item",item)
- PrintTable(item)
- net.Start("buyitem")
- net.WriteString(item.Name)
- net.WriteUInt(back,8)
- net.WriteUInt(j,8)
- net.WriteUInt(i,8)
- net.SendToServer()
- end
-
- print("Displaying shape:")
- PrintTable(shape)
- for k = 1, twidth do
- for i = 1, theight do
- if not shape[k][i] then
- print("Found false spot:",k,i)
- local emptyslot = vgui.Create("DPanel", dp)
- emptyslot:SetSize(slotsize,slotsize)
- emptyslot:SetPos(slotsize * (i - 1) + 2, slotsize * (k - 1) + 2)
- end
- end
- end
-
-end
-
-local slotsize = math.Round(w / 32)
-
-local function DrawShopOnDPanel(dp,items)
- --This gets pretty involved, lets try to not make it a clusterfuck.
- dp.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(100,0,0)) end
- print("dp",dp)
- local scrollpanel = vgui.Create( "DScrollPanel",dp )
- print("scollpanel",scrollpanel)
- scrollpanel.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,0,100)) end
- scrollpanel:Dock(FILL)
- for k,v in pairs(items) do
- local itemtbl = ART.GetItemByName(v[1])
- local invpanel = vgui.Create( "DPanel", scollpanel)
- invpanel.Paint = function(self, w, h)
- draw.RoundedBox(4, 1,1,w-4,h-4,Color(50,50,50))
- draw.RoundedBox(4, 2,2,w-5,h-5,Color(100,100,100))
- end
- print("invpanel",invpanel)
- DrawShopItemOnDPanel(invpanel,itemtbl,v[2])
- scrollpanel:AddItem(invpanel)
- invpanel:Dock(TOP)
- local x,_ = invpanel:GetSize()
- print("item is",v)
- PrintTable(v)
- invpanel:SetSize(x,slotsize*(#itemtbl.Shape) + 4)
- invpanel:Dock(TOP)
-
- end
-
-end
-
-local shopwindow,shoppanel
-
-local function createshopwindow()
- print("Createing shopwindow")
- shopwindow = vgui.Create( "DFrame" )
- shopwindow:SetPos( w - (w / 4), 0 )
- shopwindow:SetSize( w / 4, h )
- shopwindow:SetTitle( "Unset shop" )
- shopwindow:SetDraggable( true )
- shopwindow.OnClose = function(self)
- self:SetVisible(false)
- print("After onclose, shopwindow was",shopwindow)
- end
- shopwindow:SetVisible(false)
-
- shoppanel = vgui.Create( "DPanel",shopwindow)
- shoppanel:SetPos( 10, 30 ) -- Set the position of the panel
- shoppanel:Dock(FILL)
-end
-createshopwindow()
-
-net.Receive("art_openshop",function()
- print("shopwindows was ",shopwindow)
- if not shopwindow:IsValid() then createshopwindow() end
- assert(shopwindow,"Shopwindow was not created, even after re-createing!")
- ShowInventory()
- shopwindow:SetVisible(true)
- local stock = net.ReadTable()
- DrawShopOnDPanel(shoppanel,stock)
- shopwindow:MakePopup()
-end)
+-- do return end
+-- --[[
+-- Displays shop npc's interfaces
+--
+-- public functions:
+-- (sv)ART.OpenShop(shoptbl, ply) :: nil
+-- (sv)ART.CreateShop(npctbl) :: nil
+-- net messages:
+-- art_openshop
+-- ]]
+--
+-- local ivf = include("inventory_common.lua")
+-- ART = ART or {}
+--
+-- if SERVER then
+-- for k,v in pairs({
+-- "art_openshop",
+-- "art_buyitem",
+-- "art_sellitem",
+-- }) do
+-- util.AddNetworkString(v)
+-- end
+--
+-- function ART.OpenShop(tbl, ply)
+-- print("Called openshop!")
+-- print("tbl was")
+-- PrintTable(tbl)
+-- if CLIENT then return end
+-- net.Start("art_openshop")
+-- net.WriteTable(tbl)
+-- net.Send(ply)
+-- end
+--
+-- function ART.CreateShop(npc)
+-- print("Createing shop npc")
+-- local npcent = ents.Create("npc_shop")
+-- for k,v in pairs(npc) do
+-- npcent[k] = v
+-- end
+-- npcent:Spawn()
+-- print("Called spawn")
+-- end
+--
+-- end
+--
+-- if SERVER then return end
+-- local w,h = ScrW(),ScrH()
+-- local function DrawShopItemOnDPanel(dp,itemtbl,cost)
+-- --An item is a string, and int cost
+--
+-- local shape = itemtbl.Shape
+-- local twidth,theight = 0,#shape
+-- for k=1,#shape do
+-- twidth = math.max(twidth,#shape[k])
+-- end
+--
+-- local slotsize = math.Round(w / 32)
+-- local backgrid = vgui.Create( "DGrid", dp )
+-- backgrid:SetPos( 10, 30 )
+-- backgrid:SetCols( twidth )
+-- backgrid:SetColWide( theight )
+-- backgrid:Dock(LEFT)
+--
+-- local shopicon = vgui.Create( "DImageButton", dp )
+-- shopicon:SetSize(slotsize * twidth, slotsize * theight)
+-- shopicon:SetPos(0,0)
+-- shopicon:SetText(itemtbl.Name)
+-- if itemtbl.Tooltip then
+-- shopicon:SetTooltip(itemtbl.Tooltip)
+-- end
+-- if itemtbl.Paint then
+-- shopicon.Paint = itemtbl.Paint
+-- end
+-- if itemtbl.DoOnPanel then
+-- itemtbl.DoOnPanel(shopicon)
+-- end
+-- shopicon.Paint = function(self, w, h)
+-- surface.SetDrawColor( 0, 0, 0, 255 )
+-- surface.DrawOutlinedRect( 0, 0, w, h)
+-- end
+-- shopicon.DoClick = function()
+-- print("You cliked me!")
+-- end
+-- shopicon.Item = itemtbl
+-- shopicon.Cost = cost
+-- shopicon:Droppable("Inventory")
+-- shopicon.ondropped = function(back,j,i,item)
+-- print("ondropped was called!")
+-- print("back",back,"j",j,"i",i,"item",item)
+-- PrintTable(item)
+-- net.Start("buyitem")
+-- net.WriteString(item.Name)
+-- net.WriteUInt(back,8)
+-- net.WriteUInt(j,8)
+-- net.WriteUInt(i,8)
+-- net.SendToServer()
+-- end
+--
+-- print("Displaying shape:")
+-- PrintTable(shape)
+-- for k = 1, twidth do
+-- for i = 1, theight do
+-- if not shape[k][i] then
+-- print("Found false spot:",k,i)
+-- local emptyslot = vgui.Create("DPanel", dp)
+-- emptyslot:SetSize(slotsize,slotsize)
+-- emptyslot:SetPos(slotsize * (i - 1) + 2, slotsize * (k - 1) + 2)
+-- end
+-- end
+-- end
+--
+-- end
+--
+-- local slotsize = math.Round(w / 32)
+--
+-- local function DrawShopOnDPanel(dp,items)
+-- --This gets pretty involved, lets try to not make it a clusterfuck.
+-- dp.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(100,0,0)) end
+-- print("dp",dp)
+-- local scrollpanel = vgui.Create( "DScrollPanel",dp )
+-- print("scollpanel",scrollpanel)
+-- scrollpanel.Paint = function(self, w, h) draw.RoundedBox(4, 0,0,w,h,Color(0,0,100)) end
+-- scrollpanel:Dock(FILL)
+-- for k,v in pairs(items) do
+-- local itemtbl = ART.GetItemByName(v[1])
+-- local invpanel = vgui.Create( "DPanel", scollpanel)
+-- invpanel.Paint = function(self, w, h)
+-- draw.RoundedBox(4, 1,1,w-4,h-4,Color(50,50,50))
+-- draw.RoundedBox(4, 2,2,w-5,h-5,Color(100,100,100))
+-- end
+-- print("invpanel",invpanel)
+-- DrawShopItemOnDPanel(invpanel,itemtbl,v[2])
+-- scrollpanel:AddItem(invpanel)
+-- invpanel:Dock(TOP)
+-- local x,_ = invpanel:GetSize()
+-- print("item is",v)
+-- PrintTable(v)
+-- invpanel:SetSize(x,slotsize*(#itemtbl.Shape) + 4)
+-- invpanel:Dock(TOP)
+--
+-- end
+--
+-- end
+--
+-- local shopwindow,shoppanel
+--
+-- local function createshopwindow()
+-- print("Createing shopwindow")
+-- shopwindow = vgui.Create( "DFrame" )
+-- shopwindow:SetPos( w - (w / 4), 0 )
+-- shopwindow:SetSize( w / 4, h )
+-- shopwindow:SetTitle( "Unset shop" )
+-- shopwindow:SetDraggable( true )
+-- shopwindow.OnClose = function(self)
+-- self:SetVisible(false)
+-- print("After onclose, shopwindow was",shopwindow)
+-- end
+-- shopwindow:SetVisible(false)
+--
+-- shoppanel = vgui.Create( "DPanel",shopwindow)
+-- shoppanel:SetPos( 10, 30 ) -- Set the position of the panel
+-- shoppanel:Dock(FILL)
+-- end
+-- createshopwindow()
+--
+-- net.Receive("art_openshop",function()
+-- print("shopwindows was ",shopwindow)
+-- if not shopwindow:IsValid() then createshopwindow() end
+-- assert(shopwindow,"Shopwindow was not created, even after re-createing!")
+-- ShowInventory()
+-- shopwindow:SetVisible(true)
+-- local stock = net.ReadTable()
+-- DrawShopOnDPanel(shoppanel,stock)
+-- shopwindow:MakePopup()
+-- end)
diff --git a/gamemode/shared/sparkel.lua b/gamemode/shared/sparkel.lua
index 5882aac..c839059 100644
--- a/gamemode/shared/sparkel.lua
+++ b/gamemode/shared/sparkel.lua
@@ -1,5 +1,6 @@
-function sparkel(...)
+
+local function sparkel(...)
local arg = {...}
local looparg = type(arg[1]) == "string" and string.Explode(" ",arg[1],false) or arg
--One pass to find the high and low point
@@ -9,9 +10,11 @@ function sparkel(...)
max = max > v and max or v
min = min < v and min or v
end
- local scale = (max-min)/7
+ local scale = (max-min) / 7
for k,v in pairs(looparg) do
- Msg(utf8.char(9600+(1+(v/scale))))
+ Msg(utf8.char(9600 + ( 1 + (v / scale))))
end
Msg("\n")
end
+
+return sparkel