Permalink
Browse files

Added item icons (need to remove unneeded ones)

Added initial items.lua, very primitive

weapons.lua is starting to look like a real page
- genWeapons.lua parses all data it gets given now

Slightly improved template organisation

Added initial setup for UI translations - not happy with it atm so I'm
not actually using it yet
  • Loading branch information...
mikejsavage committed Jan 25, 2011
1 parent 4c27759 commit a9a86b9378d2cd448725c7d52e3b3231cdc0566b
Showing with 405 additions and 36 deletions.
  1. +29 −1 config.lua
  2. +45 −2 css/common.css
  3. BIN data/img/icons/items/CHARM.png
  4. BIN data/img/icons/items/bait.png
  5. BIN data/img/icons/items/ball.png
  6. BIN data/img/icons/items/barrel.png
  7. BIN data/img/icons/items/bbq.png
  8. BIN data/img/icons/items/binoculars.png
  9. BIN data/img/icons/items/bomb.png
  10. BIN data/img/icons/items/bone.png
  11. BIN data/img/icons/items/book.png
  12. BIN data/img/icons/items/boomerang.png
  13. BIN data/img/icons/items/bottle.png
  14. BIN data/img/icons/items/bottle2.png
  15. BIN data/img/icons/items/bug.png
  16. BIN data/img/icons/items/bugnet.png
  17. BIN data/img/icons/items/charm.png
  18. BIN data/img/icons/items/claw.png
  19. BIN data/img/icons/items/coin.png
  20. BIN data/img/icons/items/commodity.png
  21. BIN data/img/icons/items/commodity_rare.png
  22. BIN data/img/icons/items/drink.png
  23. BIN data/img/icons/items/dung.png
  24. BIN data/img/icons/items/edible.png
  25. BIN data/img/icons/items/egg.png
  26. BIN data/img/icons/items/fish.png
  27. BIN data/img/icons/items/furnishing.png
  28. BIN data/img/icons/items/garbage.png
  29. BIN data/img/icons/items/harpoon.png
  30. BIN data/img/icons/items/herb.png
  31. BIN data/img/icons/items/hide.png
  32. BIN data/img/icons/items/horn.png
  33. BIN data/img/icons/items/husk.png
  34. BIN data/img/icons/items/hvnly.png
  35. BIN data/img/icons/items/jewel.png
  36. BIN data/img/icons/items/knife.png
  37. BIN data/img/icons/items/map.png
  38. BIN data/img/icons/items/meat.png
  39. BIN data/img/icons/items/mushroom.png
  40. BIN data/img/icons/items/ore.png
  41. BIN data/img/icons/items/pickaxe.png
  42. BIN data/img/icons/items/polishing.png
  43. BIN data/img/icons/items/sac.png
  44. BIN data/img/icons/items/scale.png
  45. BIN data/img/icons/items/seed.png
  46. BIN data/img/icons/items/shell.png
  47. BIN data/img/icons/items/shot.png
  48. BIN data/img/icons/items/smoke.png
  49. BIN data/img/icons/items/sphere.png
  50. BIN data/img/icons/items/ticket.png
  51. BIN data/img/icons/items/torch.png
  52. BIN data/img/icons/items/trap.png
  53. BIN data/img/icons/items/traptool.png
  54. BIN data/img/icons/items/voucher.png
  55. BIN data/img/icons/items/web.png
  56. BIN data/img/icons/items/webbing.png
  57. BIN data/img/icons/items/whetstone.png
  58. +31 −9 data/temp/genWeapons.lua
  59. +1 −1 data/weapons.json
  60. +3 −0 index.lua
  61. +13 −0 items.lua
  62. +4 −4 templates/header.lua
  63. +1 −4 templates/itemCounts.lua
  64. +1 −0 templates/itemName.lua
  65. +59 −0 templates/weapons/meleeInfo.lua
  66. +45 −0 templates/weapons/meleeTree.lua
  67. +9 −0 templates/weapons/meleeTreeItem.lua
  68. +1 −0 templates/weapons/weaponName.lua
  69. +1 −0 templates/weapons/weaponNameURL.lua
  70. +39 −0 translations/weapons.lua
  71. +43 −2 utils.lua
  72. +80 −13 weapons.lua
View
@@ -1,6 +1,7 @@
DefaultLanguage = "hgg"
TemplatesDir = "templates"
-BaseUrl = "mhp3db/"
+TranslationsDir = "translations"
+BaseUrl = ""
HeaderLinks =
{
@@ -39,3 +40,30 @@ Special =
star = "♩",
note = "♪",
}
+
+-- these are done by eye. I don't really care
+-- if they're off because they still look ok
+RareColors =
+{
+ "ffffff",
+ "875fff",
+ "fafc4f",
+ "f08297",
+ "5dd030",
+ "3581e1",
+ "ff2954",
+}
+
+ItemColors =
+{
+ white = "ffffff",
+ gray = "aaaaaa",
+ green = "6bf36e",
+ yellow = "f7f56b",
+ orange = "f49e62",
+ red = "ff2954",
+ pink = "f599f0",
+ purple = "aa70e0",
+ blue = "718fff",
+ cyan = "a6fcfd",
+}
View
@@ -5,6 +5,10 @@ body {
margin: 0;
}
+a {
+ color: #ccc;
+}
+
/* html5 element styles */
header, nav, footer {
@@ -20,22 +24,29 @@ table {
/* generic header styles */
-h1, h2, h3, h4 {
+h1, h2, h3, h4, h1 a, h2 a, h3 a, a strong {
color: #fff;
}
h1 {
margin-top: 0;
text-align: center;
}
+h2, h3 {
+ margin: 8px 0 4px;
+}
+h2 + h3 {
+ margin-top: 0;
+}
+
/* images */
img {
border: 0; /* for urls */
}
img.icon {
width: 1.2em;
- vertical-align: top;
+ vertical-align: middle;
}
/* content background colour */
@@ -121,6 +132,7 @@ nav {
.main {
border-bottom: 32px solid #1a1a1a;
border-radius: 0 0 32px 32px;
+ line-height: 130%;
margin: 0 auto -32px; /* -ve bottom margin for the footer */
padding: 0 32px 16px;
width: 752px;
@@ -144,11 +156,38 @@ footer {
width: 752px;
}
+/* grids */
+
+.grid {
+ margin: 0 auto;
+}
+.grid td a {
+ display: table-cell;
+ padding: 8px;
+ text-decoration: none;
+}
+.grid img {
+ background-color: #333333;
+ border: 1px solid #CCCCCC;
+ border-radius: 4px;
+ padding: 4px;
+ margin-right: 8px;
+ width: 33px;
+
+ -khtml-border-radius: 4px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+}
+.grid a:hover img {
+ background-color: #666;
+}
+
/* generic data tables */
.data {
font-family: monospace;
font-size: 14px;
+ line-height: 120%;
white-space: pre;
}
@@ -186,6 +225,10 @@ footer {
border-top: 2px solid #333;
}
+.create {
+ font-weight: bold;
+}
+
/* colour spans */
.pos {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
View
@@ -74,7 +74,7 @@ local Items = json.decode( readFile( "../items.json" ) )
function itemID( name )
for id, item in ipairs( Items ) do
- if item.name == name then
+ if item.name.hgg == name then
return id
end
end
@@ -94,8 +94,8 @@ local function parseItem( line )
return itemID( name ), count
end
--- in hindsight perhaps a gigantic FSM was
--- not the best way of doing this
+-- perhaps a gigantic FSM was not
+-- the best way of doing this
local Actions =
{
@@ -183,7 +183,7 @@ local Actions =
if line:sub( -1 ) == "z" then
weapon.price = tonumber( line:sub( 1, -2 ) )
- return "null"
+ return "create"
end
local id, count = parseItem( line )
@@ -194,17 +194,39 @@ local Actions =
return "scraps"
end
- if not weapon.improve then
- print( weapon.name.hgg )
- end
-
table.insert( weapon.improve.materials, { id = id, count = count } )
return "improve"
end,
+ create = function( line, weapon )
+ local id, count = parseItem( line )
+
+ if not id then
+ weapon.description = line
+
+ return "scraps"
+ end
+
+ if not weapon.create then
+ weapon.create = { }
+ end
+
+ table.insert( weapon.create, { id = id, count = count } )
+
+ return "create"
+ end,
+
scraps = function( line, weapon )
- return "null"
+ local id, count = parseItem( line )
+
+ if not weapon.scraps then
+ weapon.scraps = { }
+ end
+
+ table.insert( weapon.scraps, { id = id, count = count } )
+
+ return "scraps"
end,
null = function( line, weapon )
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,3 @@
+#! /usr/bin/lua
+
+print( "hi" )
View
@@ -0,0 +1,13 @@
+require( "cgi" )
+
+--print( "Content-type: text/html\n" )
+
+-- data
+
+Items = data( "items" )
+
+for _, item in ipairs( Items ) do
+ print( T( item.name ) )
+end
+
+print( table.getn( Items ) )
View
@@ -2,16 +2,16 @@
<html>
<head>
- <link rel="stylesheet" type="text/css" href="css/common.css">
+ <link rel="stylesheet" type="text/css" href="{{ U( "css/common.css" ) }}">
- <link rel="shortcut icon" href="favicon.ico">
+ <link rel="shortcut icon" href="{{ U( "favicon.ico" ) }}">
- <title>{{ title and title .. " - " or "" }}P3DB</title>
+ <title>{{ title and title .. " - " or "" }}3rdDB</title>
</head>
<body>
<header>
- <a href="{{ U( "" ) }}" class="home">p3db</a>
+ <a href="{{ U( "" ) }}" class="home">3rddb</a>
<nav>
{%
View
@@ -1,10 +1,7 @@
{%
for _, material in ipairs( materials ) do
local item = Items[ material.id ]
- %}
- {{ item.name }} x{{ material.count }}
-
- {%
+ print( ( "%s <strong>x%d</strong><br>" ):format( itemName( { item = item } ), material.count ) )
end
%}
View
@@ -0,0 +1 @@
+{{ icon( "items/" .. ( item.icon and item.icon or "garbage" ), item.color or "ffffff" ) }} <a href="{{ U( ( "items/%s" ):format( item.name.hgg:urlEscape() ) ) }}">{{ T( item.name ) }}</a>
@@ -0,0 +1,59 @@
+<h1>{{ weaponName( { class = class, weapon = weapon } ) }}</h1>
+
+
+<h2>Stats</h2>
+
+ Attack: {{ weapon.attack }}<br>
+ TATP: ?<br>
+ Sharpness: ?<br>
+
+ Affinity:
+ {%
+ if weapon.affinity ~= 0 then
+ E( "span", weapon.affinity > 0 and "pos" or "neg", weapon.affinity )
+ else
+ print( weapon.affinity )
+ end
+ %}%<br>
+
+ Slots: {{ weapon.slots == 0 and "none" or ( "O" ):rep( weapon.slots ) }}<br>
+ Rarity: <span class="rare{{ weapon.rarity }}">{{ weapon.rarity }}</span>
+
+
+<h2>Crafting</h2>
+
+ {%
+ if weapon.create then
+ print( E( "h3", nil, "Create" ) )
+
+ print( itemCounts( { materials = weapon.create } ) )
+
+ print( ( "Price: %dz" ):format( weapon.price * 1.5 ) )
+
+ if weapon.buyable then
+ print( ( " (buyable for %dz)" ):format( weapon.price * 2 ) )
+ end
+ end
+
+ if weapon.improve then
+ print( E( "h3", nil, ( "Improve from %s" ):format( weaponNameURL( { class = class, weapon = class.weapons[ weapon.improve.from[ 1 ] ] } ) ) ) )
+
+ print( itemCounts( { materials = weapon.improve.materials } ) )
+
+ print( ( "Price: %dz" ):format( weapon.price ) )
+ end
+
+ if weapon.scraps then
+ print( E( "h3", nil, "Scraps" ) )
+
+ print( itemCounts( { materials = weapon.scraps } ) )
+ end
+
+ if weapon.upgrades then
+ print( E( "h3", nil, "Upgrades into" ) )
+
+ for _, id in ipairs( weapon.upgrades ) do
+ print( ( "%s<br>" ):format( weaponNameURL( { class = class, weapon = class.weapons[ id ] } ) ) )
+ end
+ end
+ %}
@@ -0,0 +1,45 @@
+{%
+-- args: class
+
+local treeItem = loadTemplate( "weapons/meleeTreeItem" )
+%}
+
+<h1>{{ icon( "equipment/" .. class.short ) }} {{ T( class.name ) }}</h1>
+
+<table class="data eq weapons">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Atk</th>
+ <th>TATP</th>
+ <th>Element</th>
+ <th>Affn</th>
+ <th>Sharpness</th>
+ <th>Slots</th>
+ </tr>
+ </thead>
+
+ {%
+ function doTree( idx, depth )
+ if not depth then
+ depth = 0
+ end
+
+ local weapon = class.weapons[ idx ]
+
+ print( treeItem( { class = class, weapon = weapon, depth = depth } ) )
+
+ if weapon.upgrades then
+ for _, upgrade in ipairs( weapon.upgrades ) do
+ doTree( upgrade, depth + 1 )
+ end
+ end
+ end
+
+ for i, weapon in ipairs( class.weapons ) do
+ if not weapon.improve then
+ doTree( i )
+ end
+ end
+ %}
+</table>
@@ -0,0 +1,9 @@
+{{ depth == 0 and "<tr class='split'>" or "<tr>" }}
+ <td>{{ ( "&nbsp;&nbsp;&nbsp;" ):rep( depth ) }}<a class="rare{{ weapon.rarity }}{{ weapon.create and " create" or "" }}" href="{{ U( ( "weapons/%s/%s" ):format( class.short, weapon.name.hgg:urlEscape() ) ) }}">{{ weapon.name.hgg }}</td>
+ <td>{{ weapon.attack }}</td>
+ <td>?</td>
+ <td>{{ weapon.element and weapon.elemAttack .. " " .. weapon.element or "-" }}</td>
+ <td>{{ weapon.affinity }}%</td>
+ <td>?</td>
+ <td>{{ weapon.slots == 0 and "-" or ( "O" ):rep( weapon.slots ) }}</td>
+</tr>
@@ -0,0 +1 @@
+{{ icon( "equipment/" .. class.short, rareColor( class.rarity ) ) }} {{ T( weapon.name ) }}
@@ -0,0 +1 @@
+{{ icon( "equipment/" .. class.short, rareColor( class.rarity ) ) }} <a href="{{ U( ( "weapons/%s/%s" ):format( class.short, weapon.name.hgg:urlEscape() ) ) }}">{{ T( weapon.name ) }}</a>
Oops, something went wrong.

0 comments on commit a9a86b9

Please sign in to comment.