1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
using Gtk;
using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
using Mundus.Data.SuperLayers;
namespace Mundus.Service.SuperLayers {
public static class ImageController {
//Set the image to be either the ground layer tile, "blank" icon, item layer tile, mob layer tile or don't set it to anything
//Note: first the ground and the blank icons are printed, then over them are printed the item tiles and over them are mob tiles
public static Image GetScreenImage(int row, int col, int layer) {
ISuperLayer superLayer = LMI.Player.CurrSuperLayer;
Image img = null;
//Layer 0 is GroundLayer, 1 is ItemLayer and 2 is Moblayer
if (layer == 0) {
if (superLayer.GetGroundLayerTile( row, col ) == null) {
img = new Image( "blank", IconSize.Dnd );
}
else {
img = new Image( superLayer.GetGroundLayerTile( row, col ).stock_id, IconSize.Dnd );
}
}
else if (layer == 1 &&
superLayer.GetStructureLayerTile( row, col ) != null) {
img = new Image( superLayer.GetStructureLayerTile( row, col ).stock_id, IconSize.Dnd );
}
else if (layer == 2 &&
superLayer.GetMobLayerTile( row, col ) != null) {
img = new Image( superLayer.GetMobLayerTile( row, col ).stock_id, IconSize.Dnd );
}
return img;
}
//Return a tile if it exists, otherwise return the "blank" icon
public static Image GetGroundImage(int row, int col) {
ISuperLayer superLayer = LMI.Player.CurrSuperLayer;
Image img = new Image("blank", IconSize.Dnd);
if (row >= 0 && col >= 0 && col < MapSizes.CurrSize && row < MapSizes.CurrSize &&
superLayer.GetGroundLayerTile( row, col ) != null) {
img = superLayer.GetGroundLayerTile( row, col ).Texture;
}
return img;
}
//Return a tile if it exists, otherwise return the "blank" icon
public static Image GetItemImage(int row, int col) {
ISuperLayer superLayer = LMI.Player.CurrSuperLayer;
Image img = new Image( "blank", IconSize.Dnd );
if (row >= 0 && col >= 0 && col < MapSizes.CurrSize && row < MapSizes.CurrSize &&
superLayer.GetStructureLayerTile( row, col ) != null) {
img = superLayer.GetStructureLayerTile( row, col ).Texture;
}
return img;
}
public static Image GetHandImage() {
Image img = new Image("blank_hand", IconSize.Dnd);
if (LMI.Player.Inventory.Hand != null) {
img = LMI.Player.Inventory.Hand.Texture;
}
return img;
}
public static Image GetHotbarImage(int index) {
Image img = new Image("blank", IconSize.Dnd);
if (index < LMI.Player.Inventory.Hotbar.Length) {
if (LMI.Player.Inventory.Hotbar[index] != null) {
img = LMI.Player.Inventory.Hotbar[index].Texture;
}
}
return img;
}
public static Image GetInventoryItemImage(int index) {
Image img = new Image("blank", IconSize.Dnd);
if (index < LMI.Player.Inventory.Items.Length) {
if (LMI.Player.Inventory.Items[index] != null) {
img = LMI.Player.Inventory.Items[index].Texture;
}
}
return img;
}
public static Image GetAccessoryImage(int index) {
Image img = new Image("blank_gear", IconSize.Dnd);
if (index < LMI.Player.Inventory.Accessories.Length) {
if (LMI.Player.Inventory.Accessories[index] != null) {
img = LMI.Player.Inventory.Accessories[index].Texture;
}
}
return img;
}
public static Image GetGearImage(int index) {
Image img = new Image("blank_gear", IconSize.Dnd);
if (index < LMI.Player.Inventory.Gear.Length) {
if (LMI.Player.Inventory.Gear[index] != null) {
img = LMI.Player.Inventory.Gear[index].Texture;
}
}
return img;
}
}
}
|