Changeset 611

User picture

Author: Pilus

(2012/01/25 22:33) 29 days ago

Receiving an area sound should no longer give an error when trying to print the GHI_Message
Integrated the advanced item menu into the current system. Items can now be converted by pressing the button in the simple menu

Affected files

Updated GHI/ActionExecutors/GHI_AreaSound.lua Download diff

610611
23
	local MAX_RANGE = 50;
23
	local MAX_RANGE = 50;
24
	local log = GHI_Log();
24
	local log = GHI_Log();
25
	local delayedSounds = {};
25
	local delayedSounds = {};
26
	local misc = GHI_MiscAPI().GetAPI();
26
	
27
	
27
	class.PlaySound = function(soundPath,range,delay)
28
	class.PlaySound = function(soundPath,range,delay)
28
		if type(delay) == "number" and delay > 0 then
29
		if type(delay) == "number" and delay > 0 then
...
...
75
							
76
							
76
			PlaySoundFile(soundPath);
77
			PlaySoundFile(soundPath);
77
			if GHI_MiscData["show_area_sound_sender"] then
78
			if GHI_MiscData["show_area_sound_sender"] then
78
				GHI_Message("Area sound by "..(sender or "nil"));
79
				misc.GHI_Message("Area sound by "..(sender or "nil"));
79
			end
80
			end
80
		end		
81
		end		
81
	end
82
	end

Updated GHI/AdvancedItemMenu/GHI_AdvancedItemMenu.lua Download diff

610611
40
		menuFrame.ForceLabel("consumed",item.IsConsumed());
40
		menuFrame.ForceLabel("consumed",item.IsConsumed());
41
		menuFrame.ForceLabel("cooldown",item.GetCooldown());
41
		menuFrame.ForceLabel("cooldown",item.GetCooldown());
42
42
43
		menuFrame.GetLabelFrame("dynamicActions").SetDynamicActionInstanceSet(set);
43
		menuFrame.GetLabelFrame("dynamicActions").SetDynamicActionInstanceSet(item.GetDynamicActionSet());
44
	end
44
	end
45
45
46
	local SetupWithEditItem = function()
46
	local SetupWithEditItem = function()
47
		inUse = true;
47
		inUse = true;
48
		edit = true;
48
		edit = true;
49
49
50
		if not(item.IsAdvanced()) then
51
			item.ConvertToAdvanced();
52
		end
53
50
		UpdateMenu();
54
		UpdateMenu();
51
		UpdateTooltip();
55
		UpdateTooltip();
52
	end
56
	end
...
...
54
	local SetupWithNewItem = function()
58
	local SetupWithNewItem = function()
55
		inUse = true;
59
		inUse = true;
56
		edit = false;
60
		edit = false;
57
		item = GHI_ItemInfo({
61
		item.ConvertToAdvanced();
58
			authorName = UnitName("player"),
62
59
			authorGuid = UnitGUID("player"),
63
60
			guid = guidCreator.MakeGUID();
64
61
		});
62
		set = GHI_DynamicActionInstanceSet();
63
		UpdateMenu();
65
		UpdateMenu();
64
		UpdateTooltip();
66
		UpdateTooltip();
65
	end
67
	end
...
...
433
			},
435
			},
434
436
435
        },
437
        },
436
		title = GHI_CREATE_TITLE,
438
		title = GHI_CREATE_TITLE_ADV,
437
		name = "GHI_Advanced_Item_Menu"..menuIndex,
439
		name = "GHI_Advanced_Item_Menu"..menuIndex,
438
		theme = "BlankWizardTheme",
440
		theme = "BlankWizardTheme",
439
		width = 500,
441
		width = 500,
...
...
450
452
451
	class.IsInUse = function() return inUse end
453
	class.IsInUse = function() return inUse end
452
454
453
	class.New = function()
455
	class.New = function(itemInProgress)
454
		menuFrame:AnimatedShow();
456
		menuFrame.SetPage(1);
457
		menuFrame:Show();
458
		item = itemInProgress;
455
459
456
457
		SetupWithNewItem();
460
		SetupWithNewItem();
458
	end
461
	end
459
462
460
	class.Edit = function(guid)
463
	class.Edit = function(editItem)
461
		local editItem = itemList.GetItemInfo(guid);
462
		if not(editItem.IsEditable() or editItem.IsCreatedByPlayer()) then
464
		if not(editItem.IsEditable() or editItem.IsCreatedByPlayer()) then
463
			miscApi.GHI_Message(GHI_CAN_NOT_EDIT);
465
			miscApi.GHI_Message(GHI_CAN_NOT_EDIT);
464
			menuFrame:Hide();
466
			menuFrame:Hide();
...
...
467
469
468
		item = editItem.CloneItem();
470
		item = editItem.CloneItem();
469
471
472
		menuFrame.SetPage(1);
470
		menuFrame:AnimatedShow();
473
		menuFrame:AnimatedShow();
471
474
475
		edit = true;
472
		SetupWithEditItem();
476
		SetupWithEditItem();
473
	end
477
	end
474
478

Updated GHI/AdvancedItemMenu/GHI_AdvancedItemMenuList.lua Download diff

610611
24
		return menu;
24
		return menu;
25
	end
25
	end
26
26
27
	class.New = function()
27
	class.New = function(itemInProgress)
28
		GetMenu().New();
28
		GetMenu().New(itemInProgress);
29
	end
29
	end
30
	class.Edit = function(guid)
30
	class.Edit = function(itemInProgress)
31
		GetMenu().Edit(guid);
31
		GetMenu().Edit(itemInProgress);
32
	end
32
	end
33
33
34
     return class;
34
     return class;

Updated GHI/Items/GHI_ItemInfo.lua Download diff

610611
16
function GHI_ItemInfo(itemTable)
16
function GHI_ItemInfo(itemTable)
17
	local class = GHClass("GHI_ItemInfo");
17
	local class = GHClass("GHI_ItemInfo");
18
18
19
	local guid, name, itemType, quality, white1, white2, comment, icon, useText, stackSize, version, authorName;
19
	local guid, name, itemType, quality, white1, white2, comment, icon, useText, stackSize, version, authorName, isAdvanced;
20
    local authorGuid, rawData, cooldown, tooltipLines, attributes,lastCastTime,simpleActions;
20
    local authorGuid, rawData, cooldown, tooltipLines, attributes,lastCastTime,simpleActions;
21
	local editableByOthers,copyableByOthers,actionVersion,isAdvancedItem,consumed;
21
	local editableByOthers,copyableByOthers,actionVersion,isAdvancedItem,consumed,dynamicActionSet;
22
	local InitializeItemData,HandleMultiLanguageInputs;
22
	local InitializeItemData,HandleMultiLanguageInputs;
23
23
24
	local errorThrower = GHI_ErrorThrower();
24
	local errorThrower = GHI_ErrorThrower();
...
...
51
		editableByOthers = false;
51
		editableByOthers = false;
52
		isAdvancedItem = false;
52
		isAdvancedItem = false;
53
		consumed = false;
53
		consumed = false;
54
		isAdvanced = false;
54
		
55
		
55
		if type(itemTable)=="table" then
56
		if type(itemTable)=="table" then
56
			local t = itemTable;
57
			local t = itemTable;
...
...
97
					end
98
					end
98
				end
99
				end
99
			end
100
			end
101
102
			isAdvanced = t.isAdvanced;
100
		end
103
		end
101
	end;
104
	end;
102
105
...
...
448
451
449
	end
452
	end
450
453
454
	class.IsAdvanced = function()
455
		return isAdvanced;
456
	end
457
458
	class.ConvertToAdvanced = function()
459
		dynamicActionSet = GHI_DynamicActionInstanceSet();
460
461
		-- todo: change actions into dynamic actions
462
463
464
		isAdvanced = true;
465
	end
466
467
	class.GetDynamicActionSet = function()
468
		if isAdvanced then
469
			return dynamicActionSet;
470
		end
471
	end
472
473
474
451
	class.SetName = function(_name) name = _name; end
475
	class.SetName = function(_name) name = _name; end
452
	class.SetWhite1 = function(_white1) white1 = _white1; end
476
	class.SetWhite1 = function(_white1) white1 = _white1; end
453
	class.SetWhite2 = function(_white2) white2 = _white2; end
477
	class.SetWhite2 = function(_white2) white2 = _white2; end

Updated GHI/Localization/Localization.enUS.lua Download diff

610611
116
116
117
-- Create item menu
117
-- Create item menu
118
GHI_CREATE_TITLE = "Create new GHI item";
118
GHI_CREATE_TITLE = "Create new GHI item";
119
GHI_CREATE_TITLE_ADV = "Create new GHI item (advanced)";
119
GHI_GENERAL_ITEM_INFO = "General Item Info";
120
GHI_GENERAL_ITEM_INFO = "General Item Info";
120
GHI_NAME = "Name:";
121
GHI_NAME = "Name:";
121
GHI_QUALITY = "Quality:";
122
GHI_QUALITY = "Quality:";

Updated GHI/SimpleItemMenu/GHI_SimpleItemMenu.lua Download diff

610611
39
	local inUse = false;
39
	local inUse = false;
40
	local actionDD,actionList,UpdateActionList;
40
	local actionDD,actionList,UpdateActionList;
41
	local actionsChanged;
41
	local actionsChanged;
42
	local advItemMenuList = GHI_AdvancedItemMenuList();
42
43
43
	local menuIndex = 1;
44
	local menuIndex = 1;
44
	while _G["GHI_Simple_Item_Menu"..menuIndex] do menuIndex = menuIndex + 1; end
45
	while _G["GHI_Simple_Item_Menu"..menuIndex] do menuIndex = menuIndex + 1; end
...
...
228
		ToggleDropDownMenu(1, nil, actionDD, self, 0, 0);
229
		ToggleDropDownMenu(1, nil, actionDD, self, 0, 0);
229
	end
230
	end
230
231
232
	local ConvertToAdvItem = function()
233
		if edit then
234
			advItemMenuList.Edit(item);
235
			menuFrame:Hide();
236
		else
237
			advItemMenuList.New(item);
238
			menuFrame:Hide();
239
		end
240
	end
231
241
232
233
	menuFrame = GHM_NewFrame(class,{
242
	menuFrame = GHM_NewFrame(class,{
234
		onOk = function(self) end,
243
		onOk = function(self) end,
235
		{
244
		{

Updated GHM/ghm.lua Download diff

610611
662
					main.bb:Disable();
662
					main.bb:Disable();
663
				else
663
				else
664
					main.bb:Enable();
664
					main.bb:Enable();
665
					local f = _G[main:GetName().."_P"..main.currentPage-1];
665
666
					if f then f:Hide(); end
667
				end
666
				end
668
				main.bb:SetText("< Back");
667
				main.bb:SetText("< Back");
669
				if main.currentPage == main.numPages then
668
				if main.currentPage == main.numPages then
...
...
673
					local f = _G[main:GetName().."_P"..main.currentPage+1];
672
					local f = _G[main:GetName().."_P"..main.currentPage+1];
674
					if f then f:Hide(); end
673
					if f then f:Hide(); end
675
				end
674
				end
675
676
				for i = 1,main.numPages do
677
					local f = _G[main:GetName().."_P"..i];
678
					if f then
679
						f:Hide();
680
					end
681
				end
682
676
				local f = _G[main:GetName().."_P"..main.currentPage];
683
				local f = _G[main:GetName().."_P"..main.currentPage];
677
				if f then 
684
				if f then 
678
					f:Show(); 
685
					f:Show(); 
...
...
701
				end
708
				end
702
				main.UpdatePages()
709
				main.UpdatePages()
703
			end);
710
			end);
711
712
			main.SetPage = function(p)
713
				main.currentPage = p;
714
				main.UpdatePages();
715
			end
704
			
716
			
705
			
717
			
706
			main.UpdatePages();
718
			main.UpdatePages();

Updated GHM/GHM_Inputs.lua Download diff

610611
27
		},
27
		},
28
		validate = function(value) return type(value)=="number" end,
28
		validate = function(value) return type(value)=="number" end,
29
	},
29
	},
30
	-- todo: stringFromTable, boolean, code, color, time, slots, textureFromTable, icon
30
	-- todo: more types. See the wiki on assembla
31
31
32
};
32
};
33
33