Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                                                                                                                            --[[
  2.     Copyright (C) 2013-2015 - DiamondGamers.net
  3.  
  4.     Unauthorized copying of this file, via any medium is strictly prohibited
  5.     Proprietary and confidential
  6.  
  7.     Written by GhoulofGSG9 (GhoulofGSG9@gmail.com) and Rusty01 <vanfenix1@gmail.com>
  8. ]]
  9.  
  10. DMDSkinHandler = {}
  11.  
  12. local function JoinTableWithEnum( tbl, tb2 )
  13.  
  14.     local maxVal = 0
  15.     for i, _ in ipairs(tbl) do
  16.         maxVal = i
  17.     end
  18.  
  19.     for i, v in ipairs(tb2) do
  20.         rawset( tbl, v, maxVal + i )
  21.         rawset( tbl, maxVal + i, v )
  22.     end
  23.  
  24.     return maxVal
  25. end
  26.  
  27. local VarianDataQueue = {}
  28. local function JoinTwoTablesWithIds( t1, t2 )
  29.     for i, t in pairs( t2 ) do
  30.         if not rawget(t1, i) then
  31.             rawset(t1, i, t)
  32.         end
  33.     end
  34.  
  35.     VarianDataQueue[#VarianDataQueue + 1] = t1
  36. end
  37.  
  38. local Checks = {}
  39. function DMDSkinHandler.AddOptionCheck( Option, maxNum )
  40.     Checks[Option] = maxNum
  41. end
  42.  
  43. function DMDSkinHandler.GetOptionCheck()
  44.     return Checks
  45. end
  46.  
  47. function DMDSkinHandler:InitialiseMarineSkins()
  48.     local DMDVariants = { "medic", "hev", "guns2", "red", "hellokitty", "hudson", "bluefire", "ghost", "rainbow", "redeclipse", "tundra" }
  49.  
  50.     local NumVannilaVariants = JoinTableWithEnum( kMarineVariant, DMDVariants )
  51.  
  52.     self.AddOptionCheck("marineVariant", NumVannilaVariants )
  53.  
  54.     kMedicProductId = 4939
  55.     kHevProductId = 4938
  56.     kGunsv2ProductId = 4937
  57.     kRedProductId = 4936
  58.     kHelloKittyProductId = 4935
  59.     kHudsonProductId = 49350
  60.     kBluefireProductId = 49351
  61.     kGhostProductId = 49352
  62.     kRainbowProductID = 49353
  63.     kRedeclipseProductID = 49354
  64.         kTundraProductID = 101
  65.  
  66.     local kDmdVariantData =
  67.     {
  68.         [kMarineVariant.medic] = { productId = kMedicProductId, displayName = "DMD-Anarchist Medic", modelFilePart = "_medic", viewModelFilePart = "" },
  69.         [kMarineVariant.hev] = { productId = kHevProductId, displayName = "DMD-Gordon", modelFilePart = "_hev", viewModelFilePart = "" },
  70.         [kMarineVariant.guns2] = { productId = kGunsv2ProductId, displayName = "DMD-Gunslinger", modelFilePart = "_gunsv2", viewModelFilePart = "" },
  71.         [kMarineVariant.red] = { productId = kRedProductId, displayName = "DMD-Ferrari", modelFilePart = "_red", viewModelFilePart = "" },
  72.         [kMarineVariant.hellokitty] = { productId = kHelloKittyProductId, displayName = "DMD-Barbi", modelFilePart = "_hellokitty", viewModelFilePart = "" },
  73.         [kMarineVariant.hudson] = { productId = kHudsonProductId, displayName = "DMD-Hudson", modelFilePart = "_hudson", viewModelFilePart = "" },
  74.         [kMarineVariant.bluefire] = { productId = kBluefireProductId, displayName = "DMD-Bluefire", modelFilePart = "_bluefire", viewModelFilePart = "" },
  75.         [kMarineVariant.ghost] = { productId = kGhostProductId, displayName = "DMD-Ghost", modelFilePart = "_ghost", viewModelFilePart = "" },
  76.         [kMarineVariant.rainbow] = { productId = kRainbowProductID, displayName = "DMD-Slick", modelFilePart = "_rainbow", viewModelFilePart = "" },
  77.         [kMarineVariant.redeclipse] = { productId = kRedeclipseProductID, displayName = "DMD-Redfox", modelFilePart = "_redeclipse", viewModelFilePart = "" },
  78.                 [kMarineVariant.tundra] = { productId = kTundraProductID, displayName = "DMD-Tundra", modelFilePart = "_tundra", viewModelFilePart = "_tundra" }
  79.     }
  80.     JoinTwoTablesWithIds( kMarineVariantData, kDmdVariantData )
  81. end
  82.  
  83. function DMDSkinHandler:InitialiseExoSkins()
  84.     local DMDVariants = {  "camo", "catalyst", "explorer", "warmonger", "eclipse", "bluewater" }
  85.  
  86.     local NumVannilaVariants = JoinTableWithEnum( kExoVariant, DMDVariants )
  87.  
  88.     self.AddOptionCheck("exoVariant", NumVannilaVariants )
  89.  
  90.     kCamoExoProductId = 49450
  91.     kCatalystExoProductId = 49451
  92.     kExplorerExoProductId = 49452
  93.     kWarmongerExoProductId = 49453
  94.     kEclipseExoProductId = 49454
  95.     kBluewaterExoProductId = 49455
  96.  
  97.     local kDmdVariantData =
  98.     {
  99.         [kExoVariant.camo] = { productId = kCamoExoProductId, displayName = "DMD-Camo", modelFilePart = "", viewModelFilePart = "" },
  100.         [kExoVariant.catalyst] = { productId = kCatalystExoProductId, displayName = "DMD-Catalyst", modelFilePart = "", viewModelFilePart = "" },
  101.         [kExoVariant.explorer] = { productId = kExplorerExoProductId, displayName = "DMD-Explorer", modelFilePart = "_2", viewModelFilePart = "" },
  102.         [kExoVariant.warmonger] = { productId = kWarmongerExoProductId, displayName = "DMD-WarMonger", modelFilePart = "", viewModelFilePart = "" },
  103.         [kExoVariant.eclipse] = { productId = kEclipseExoProductId, displayName = "DMD-Eclipse", modelFilePart = "", viewModelFilePart = "" },
  104.         [kExoVariant.bluewater] = { productId = kBluewaterExoProductId, displayName = "DMD-Bluewater", modelFilePart = "", viewModelFilePart = "" }
  105.     }
  106.     JoinTwoTablesWithIds( kExoVariantData, kDmdVariantData )
  107. end
  108.  
  109. function DMDSkinHandler:InitialiseSkulkSkins()
  110.     local DMDVariants = { "classic", "tron", "dread", "alien", "kodiak", "reaper" }
  111.  
  112.     local NumVannilaVariants = JoinTableWithEnum( kSkulkVariant, DMDVariants )
  113.  
  114.     self.AddOptionCheck("skulkVariant", NumVannilaVariants )
  115.  
  116.     kTronProductId = 49301
  117.     kskulkalienProductId = 49311
  118.     kskulkdreadProductId = 49321
  119.     kskulkclassicProductId = 49331
  120.         kskulkkodiakProductId = 205
  121.         kskulkreaperProductId = 302
  122.  
  123.     local kDmdVariantData =
  124.     {
  125.         [kSkulkVariant.classic] = { productId = kskulkclassicProductId, displayName = "DMD-Jungle", modelFilePart = "_classic", viewModelFilePart = "" },
  126.         [kSkulkVariant.tron] = { productId = kTronProductId, displayName = "DMD-Recognizer", modelFilePart = "_tron", viewModelFilePart = "" },
  127.         [kSkulkVariant.dread] = { productId = kskulkdreadProductId, displayName = "DMD-Tank", modelFilePart = "_dread", viewModelFilePart = "" },
  128.         [kSkulkVariant.alien] = { productId = kskulkalienProductId, displayName = "DMD-Skeletor", modelFilePart = "_alien", viewModelFilePart = "" },
  129.                 [kSkulkVariant.kodiak] = { productId = kskulkkodiakProductId, displayName = "kodiak", modelFilePart = "_kodiak", viewModelFilePart = "" },
  130.                 [kSkulkVariant.reaper] = { productId = kskulkreaperProductId, displayName = "reaper", modelFilePart = "_albino", viewModelFilePart = "_albino" }
  131.  
  132.     }
  133.     JoinTwoTablesWithIds( kSkulkVariantData, kDmdVariantData )
  134. end
  135.  
  136. function DMDSkinHandler:InitialiseGorgeSkins()
  137.     local DMDVariants = { "dread","purple","classic","alien" }
  138.  
  139.     local NumVannilaVariants = JoinTableWithEnum( kGorgeVariant, DMDVariants )
  140.  
  141.     self.AddOptionCheck("gorgeVariant", NumVannilaVariants )
  142.  
  143.     kgorgedreadProductId = 49322
  144.     kgorgepurpleProductId = 49324
  145.     kgorgeclassicProductId = 49332
  146.     kgorgealienProductId = 49312
  147.  
  148.     local kDmdVariantData =
  149.     {
  150.         [kGorgeVariant.dread] = { productId = kgorgedreadProductId, displayName = "DMD-Tank", modelFilePart = "_dread", viewModelFilePart = "" },
  151.         [kGorgeVariant.purple] = { productId = kgorgepurpleProductId, displayName = "DMD-Purple", modelFilePart = "_purple", viewModelFilePart = "" },
  152.         [kGorgeVariant.classic] = { productId = kgorgeclassicProductId, displayName = "DMD-Jungle", modelFilePart = "_classic", viewModelFilePart = "" },
  153.         [kGorgeVariant.alien] = { productId = kgorgealienProductId, displayName = "DMD-Skeletor", modelFilePart = "_alien", viewModelFilePart = "" },
  154.     }
  155.     JoinTwoTablesWithIds( kGorgeVariantData, kDmdVariantData )
  156. end
  157.  
  158. function DMDSkinHandler:InitialiseFadeSkins()
  159.     local DMDVariants = { "purple", "predator" }
  160.  
  161.     local NumVannilaVariants = JoinTableWithEnum( kFadeVariant, DMDVariants )
  162.  
  163.     self.AddOptionCheck("fadeVariant", NumVannilaVariants )
  164.  
  165.     kfadepurpleProductId = 49420
  166.     kfadepredatorProductId = 49421
  167.  
  168.     local kDmdVariantData =
  169.     {
  170.         [kFadeVariant.purple] = { productId = kfadepurpleProductId, displayName = "DMD-Purpler", modelFilePart = "_purple", viewModelFilePart = "" },
  171.         [kFadeVariant.predator] = { productId = kfadepredatorProductId, displayName = "DMD-Predator", modelFilePart = "_predator", viewModelFilePart = "" },
  172.     }
  173.     JoinTwoTablesWithIds( kFadeVariantData, kDmdVariantData )
  174. end
  175.  
  176.  
  177. function DMDSkinHandler:InitialiseRifleSkins()
  178.     local DMDVariants = { "tundra"  }
  179.  
  180.     local NumVannilaVariants = JoinTableWithEnum( kRifleVariant, DMDVariants )
  181.  
  182.     self.AddOptionCheck("rifleVariant", NumVannilaVariants )
  183.  
  184.     kTundraRifleItemId=103
  185.  
  186.     local kDmdVariantData =
  187.     {
  188.                 [kRifleVariant.tundra] = { productId = kTundraRifleProductId, displayName = "Tundra", modelFilePart = "_tundra", viewModelFilePart = "" },
  189.  
  190.     }
  191.     JoinTwoTablesWithIds( kRifleVariantData, kDmdVariantData )
  192. end
  193.  
  194.  
  195. function DMDSkinHandler:InitialiseLerkSkins()
  196.     local DMDVariants = { "alien", "dread", "purple", "classic"  }
  197.  
  198.     local NumVannilaVariants = JoinTableWithEnum( kLerkVariant, DMDVariants )
  199.  
  200.     self.AddOptionCheck("lerkVariant", NumVannilaVariants )
  201.  
  202.     klerkalienProductId = 49313
  203.     klerkdreadProductId = 49323
  204.     klerkpurpleProductId = 49343
  205.     klerkclassicProductId = 49333
  206.  
  207.     local kDmdVariantData =
  208.     {
  209.         [kLerkVariant.alien] = { productId = klerkalienProductId, displayName = "DMD-Skeletor", modelFilePart = "_alien", viewModelFilePart = "" },
  210.         [kLerkVariant.dread] = { productId = klerkdreadProductId, displayName = "DMD-Tank", modelFilePart = "_dread", viewModelFilePart = "" },
  211.         [kLerkVariant.purple] = { productId = klerkpurpleProductId, displayName = "DMD-Purple", modelFilePart = "_purple", viewModelFilePart = "" },
  212.         [kLerkVariant.classic] = { productId = klerkclassicProductId, displayName = "DMD-Jungle", modelFilePart = "_classic", viewModelFilePart = "" },
  213.     }
  214.     JoinTwoTablesWithIds( kLerkVariantData, kDmdVariantData )
  215. end
  216.  
  217. function DMDSkinHandler:IntialiseDLCIds()
  218.     local DLCIds = {}
  219.     local i = 1
  220.     for _, variants in ipairs(VarianDataQueue) do
  221.         for _, data in pairs(variants) do
  222.  
  223.             --some skins have mutliple ids so we have to treat all productId entries as table
  224.             local ids = data.productId
  225.             if type(ids) ~= "table" then
  226.                 ids = { ids }
  227.             end
  228.  
  229.             for _, id in ipairs( ids ) do
  230.                 if not DLCIds[id] then
  231.                     DLCIds[i] = id
  232.                     DLCIds[id] = i
  233.                     i = i + 1
  234.                 end
  235.             end
  236.         end
  237.     end
  238.     self.DLCIds = DLCIds
  239. end
  240.  
  241. function DMDSkinHandler:GetDLCIds()
  242.     return self.DLCIds
  243. end
  244.  
  245. function DMDSkinHandler:InitialiseShoulderPad()
  246.     kDMDPadProductId = 49401
  247.  
  248.     kShoulderPad2ItemId[#kShoulderPad2ItemId + 1] = kDMDPadProductId
  249.     kShoulderPadNames[#kShoulderPadNames + 1] = "DMD"
  250.  
  251.     --As usual ns2 has no real system model consistency so we have to work around by faking a table for the pads
  252.     VarianDataQueue[#VarianDataQueue + 1] = {{productId = kDMDPadProductId}}
  253. end
  254.  
  255. function DMDSkinHandler:InitialiseSkins()
  256.     --Pad Stuff
  257.  
  258.     --Todo Exo and Shoulder Skins need art atlasing fixed
  259.     --self:InitialiseShoulderPad()
  260.     --self:InitialiseExoSkins()
  261.     self:InitialiseFadeSkins()
  262.     self:InitialiseGorgeSkins()
  263.     self:InitialiseLerkSkins()
  264.     self:InitialiseMarineSkins()
  265.     self:InitialiseSkulkSkins()
  266.     self:InitialiseRifleSkins()
  267.  
  268.     self:IntialiseDLCIds()
  269. end
  270.  
  271. do
  272.     DMDSkinHandler:InitialiseSkins()
  273. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement