Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] Change glow color? Piece of cake =)

Hybrid
Loyal Member
Joined
Mar 15, 2006
Messages
451
Reaction score
285
[For moderatos] - It's release with explanations, so don't move it to the Guide section =)

Today we will edit glow color in main.exe. The main target is changing items glow(+7 - +13).



1. We will start from theory.

There is a function in main.exe that calcs glow color for most of items +7 - +13, and some mobs. For example, for wings, dinorant-model, darkhorse-model and for some other items this function isn't called, but i was wandering how to change glow color, not in making glow items that doesn't have this attribute ;) May be u'll find it out.

The prototype of this function in c++:
Code:
void __cdecl Glow(DWORD dwItemId, DWORD uk1, DWORD uk2, FRGB& cl, BYTE bUkn);

dwItemId - objectId or index, each object is loaded in a big array of objects, and each object has it's unique index =)

cl - it's a float RGB struct
Code:
struct FRGB
{
	float r, g, b; // range of each color [0, 1]
};
in this variable glow function returns the result color, there are 30(2 equal blues o_O) default glow colors, but who cares? we will make any color

uk1 & uk2 - actually these two are floats, and they are used to calc glow color, but we won't use them :D


bUkn - do u remember 2 kind of balrogs, silver and red? this variable is used only to determine his glow and his bill glow =) silver or red.


If you've already guessed, we have to hook this function and return the color we want.

But u'll ask how to find out the real item's Id, because in function we have object's Id. It's simple, all items are displaced in array of objects on some value. Items Ids remain the same as in item.bmd and in item.txt(itemId = ItemType*MaxItemsInType+ItemIndex)

So if we have ObjectId and Offset of items in array of objects, we can simply calc item's id:
ItemId = ObjectId - Offset;

For Example, let's find the item with ObjectId=0x293 and Offset=0x285, with 512 max items in type:

ItemId = ObjectId - Offset = 0x293 - 0x285 = 0x0E(14)
ItemType = ItemId / MaxItems = 14 / 512 = 0 (integer division)
ItemIndex = ItemId % MaxItems = 14 % 512 = 14 (remainder of the integer division)

if you'll take a look in items.txt or .bmd,
you'll find that item with Type = 0 and Index = 14 is Lightning Sword

Later i'll tell you how to find the "Offset" =)
With these knowledges you can make your own DLL and change glow colors by yourselves, but I made a DLL that will be compatible for people who won't be able to make their own.

2. DLL

Here i'll describe the algorithm of the dll.

This dll supports 32 & 512 MaxItems.
So the best way for a dll, that will be compatible for all, is memory allocation for all the items -

Code:
struct ITEM
{
	BYTE bChng; // i'll tell later
	float r, g, b;
};

sizeof(ITEM) = 3*4 + 1 = 13 bytes
maxtypes = 16

memory = sizeof(ITEM)*maxtypes*maxitemindex = 208*maxitemindex
if maxitemindex = *** then memory = 208*32 = 6 656 bytes ~ 6,5 kb
if maxitemindex = 512, then memory = 208*512 = 106 496 bytes = 104 kb

For maxitemindex = 512 a lot of memory won't be used at all, but this method allows us to use direct addressing, so it is faster then if we had to find the item in the list of items by it's id; and also this method will help us later =)

remember ITEM::bChng? we will mark all changed items(i mean glow).
If item is changed we return our color, if not - we call default glow function.

Here is our new Glow Proc
Code:
void Glow(DWORD dwItemId, DWORD uk1, DWORD uk2, FRGB& fClr, BYTE bUkn)
{

	int id = dwItemId - g_dwOffset; // calc item id

	// if our object is an item and this item should use our glow and it's not a silver balrog :D
	// then we return our color
	// else call the default function
	if( id >=0 && id < g_MaxItems*16 && Glows[id].bIsChanged  && !bUkn)
		fClr = Glows[id].fClr;
	else
		fnOldGlow(dwItemId, uk1, uk2, fClr, bUkn);
}

The Glow Colors dll reads from "glow.gld".
Format of *.gld files:
File header:
Code:
struct GLOW
{
	DWORD signature;	// = 0x574F4C47
	BYTE bType;	// represents max items, 0 - *** else - 512
};

Further, to the end of file, follows items glow info:
Code:
struct ITEM
{
	USHORT usItemId; // item id
	FRGB fClr;	// glow color
};

So we've hooked glow function, we can now force main.exe to use our colors.

3. Glow Editor Tool.
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums


Glow Editor allows you:
-Edit glow color of the items u want,
since it uses Microsoft Jet(.MDB) database u'll be able to add or remove items, it's simple with MS Access.
-Load and Save *.gld files for 32 and 512 maxitems versions of main.exe
-Patch DLL for you main.exe, because function calls and items offset are different
-DLL's shared memory, using File Mapping, + direct addressing( remember?:) ) allows Glow Editor change colors directly in game.

4. DLL Patch.

Glow function calls and items offset are different in different mains, so we have to change these values.
I'll tell you how to find them using ollydbg, but with 1 condition - main.exe must be unpacked.


1. Launch main.exe in ollydbg.

2. Right Button(RB)-> Search for -> all referenced text strings.
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



3. In the appeared window RB -> search for text
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



4. Type "sword"; Uncheck "Case sensitive" and Check "Entire scope"
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



5. Search "Sword" like on the picture using CTR+L(search next)
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



6. When you'll find it, double-click or press ENTER on it, and in the main window u should see smth like
on the picture, the srtring below "Sword" must be "Data\Item" or may be just "Item".

Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



7. Above the function call first push command pushes in stack ObjectId. Items types begin from Swords(Type = 0),
so when main.exe loads models or textures for swords it adds to the item's id the Offset of beginning sword's type section, and if sword's type is the first type of items,
this offset is the Offset of items in array of objects

Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



8. Let's find glow function calls. RB ->search for -> all constants
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



9. We will search for ObjectId of the Lightning Sword(remember how to calc itemid or object id?)
ObjectId = Offset(value that you have found) + ItemdId(0*512+14 = 14(0x0E))
for Offset = 0x285, ObjectId = 0x293

Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



10. In the appeared window find 2 Compare Commands
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



11. Double-click or ENTER on the FIRST command, and you'll be redirected to it
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



12. This is our glow proc, scroll up and find the beginning of it
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



13. Select first command, then RB -> Go to, and you will see 2 calls for glow function
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



if u don't have "CALL from X", then RB -> Analyse-> Analyse code, and trye again step 13
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



now with Offset and 2 func Calls you can patch DLL =)


glowed items
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums


default glow
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums



Default Glows [id - R, G, B preview]:
00 - 1.00, 0.50, 0.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

01 - 1.00, 0.20, 0.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

02 - 0.00, 0.50, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

03 - 0.00, 0.50, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

04 - 0.00, 0.80, 0.40
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

05 - 1.00, 1.00, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

06 - 0.60, 0.20, 0.40
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

07 - 0.90, 0.80, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

08 - 0.80, 0.80, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

09 - 0.50, 0.50, 0.80
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

10 - 0.75, 0.65, 0.50
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

11 - 0.35, 0.35, 0.60
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

12 - 0.47, 0.67, 0.30
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

13 - 0.00, 0.30, 0.60
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

14 - 0.65, 0.65, 0.55
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

15 - 0.20, 0.30, 0.60
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

16 - 0.80, 0.46, 0.25
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

17 - 0.65, 0.45, 0.30
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

18 - 0.50, 0.40, 0.30
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

19 - 0.37, 0.37, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

20 - 0.30, 0.70, 0.30
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

21 - 0.50, 0.40, 1.00
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

22 - 0.45, 0.45, 0.23
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

23 - 0.30, 0.30, 0.45
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

24 - 0.60, 0.50, 0.20
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

25 - 0.60, 0.60, 0.60
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

26 - 0.30, 0.70, 0.30
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

27 - 0.50, 0.60, 0.70
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

28 - 0.45, 0.45, 0.23
Gembrid - [Release] Change glow color? Piece of cake =) - RaGEZONE Forums

29 - 0.45, 0.45, 0.45 forgot to make screen :D

may be later i will add them to the glow editor


Glow Editor:


Fixed DLL patcher


Glow.dll:


Fixed DLL


Glow.dll goes to MuOnline client's folder
Glow.gld goes to MuOnline client's Data\ folder
Don't forget to hook DLL in main.exe

to create glow.gld, just open the tool then File->Save it will create .gld for you

not tested with 32 max items, but should work

Credits:
1. Hybrid - me, it's my original nick, not [CzF]Hybrid :D
2 .Fiuz - for me it's problem running server and client on 1 machine, so he made for me items =)
3. For those who will make mirrors


Report bugs, errors, mistakes etc...
 
Last edited:
Junior Spellweaver
Joined
Oct 4, 2006
Messages
128
Reaction score
0
Re: [Release]Change glow color? Piece of cake =)

nice i will try
 
Experienced Elementalist
Joined
Oct 12, 2007
Messages
219
Reaction score
5
Re: [Release]Change glow color? Piece of cake =)

Wow!!!!!!!
 
Newbie Spellweaver
Joined
Mar 23, 2007
Messages
91
Reaction score
7
Re: [Release]Change glow color? Piece of cake =)

Nice.10/10
 
Newbie Spellweaver
Joined
Jan 6, 2005
Messages
59
Reaction score
8
Re: [Release]Change glow color? Piece of cake =)

NIce, pretty full guide

The first who i know played with glow was sobeih, in his sources... (when he loaded models from la2, he also added them glows...
 
Newbie Spellweaver
Joined
Jan 14, 2008
Messages
57
Reaction score
8
Re: [Release]Change glow color? Piece of cake =)

10000/10 it is very COOL
 
Newbie Spellweaver
Joined
May 1, 2006
Messages
66
Reaction score
8
Re: [Release]Change glow color? Piece of cake =)

Sorry for my stupid question, but can we change glow for new items From L2 :punch:
 
Experienced Elementalist
Loyal Member
Joined
Sep 18, 2007
Messages
252
Reaction score
1
Re: [Release]Change glow color? Piece of cake =)

That' s a great guide!
 
Joined
Jun 6, 2006
Messages
622
Reaction score
4
Re: [Release]Change glow color? Piece of cake =)

i've been waiting for this for years now... this is one great help for the mu community.

thank you very very much.
 
Experienced Elementalist
Joined
Jun 24, 2005
Messages
287
Reaction score
41
Re: [Release]Change glow color? Piece of cake =)

wow,
we still have some good ppl who share their knowledge with us
thanks !!!
 
Newbie Spellweaver
Joined
Jun 29, 2007
Messages
5
Reaction score
0
Re: [Release]Change glow color? Piece of cake =)

Man you are incredible !!!
 
Junior Spellweaver
Joined
Jun 14, 2005
Messages
125
Reaction score
20
Re: [Release]Change glow color? Piece of cake =)

10/10, seems like the l2 items etc get a unique glow now ^^
 
Hybrid
Loyal Member
Joined
Mar 15, 2006
Messages
451
Reaction score
285
Re: [Release]Change glow color? Piece of cake =)

PPL don't forget to hook the DLL, i was in a hurry and forgot it =)
 
Twilight Mu Owner
Loyal Member
Joined
Aug 8, 2005
Messages
505
Reaction score
74
Re: [Release]Change glow color? Piece of cake =)

Mirror Links:



 
Last edited:
Custom Title Activated
Loyal Member
Joined
Apr 11, 2005
Messages
1,048
Reaction score
9
Re: [Release]Change glow color? Piece of cake =)

2 and a half years later and it's finally done :mrgreen:

Such a small thing but makes a big difference for modders! Thanks dude! :thumbup:
 
Joined
Apr 16, 2005
Messages
2,651
Reaction score
655
Re: [Release]Change glow color? Piece of cake =)

Dude, this is fantastic, it's being a long time since this was requested by half the Mu Online community, I love you! xD
 
Newbie Spellweaver
Joined
Nov 22, 2005
Messages
22
Reaction score
1
Re: [Release]Change glow color? Piece of cake =)

it's niceee..
thx for share.. 100/10
 
Initiate Mage
Joined
Sep 10, 2007
Messages
1
Reaction score
0
Re: [Release]Change glow color? Piece of cake =)

This is the best release on last months

Thanks for share =)
 
Newbie Spellweaver
Joined
Jul 29, 2005
Messages
18
Reaction score
0
Re: [Release]Change glow color? Piece of cake =)

wow amazing job thank you so much
 
Back
Top