[Release]SuperGemEffects

01/23/2010 21:51 QuickCo#1
Quote:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace NewestCOServer.Features
{
class GemEffect
{
public static void GemEffects(Game.Item.Gem Gem, Main.GameClient MyClient)
{
switch (Gem)
{
#region GemEffects
case Game.Item.Gem.SuperDragonGem:
{
if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.En tityID, 10, "goldendragon")); }
break;
}
case Game.Item.Gem.SuperPhoenixGem:
{
if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.En tityID, 10, "phoenix")); }
break;
}
case Game.Item.Gem.SuperRainbowGem:
{
if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.En tityID, 10, "rainbow")); }
break;
}
case Game.Item.Gem.SuperMoonGem:
{
if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.En tityID, 10, "moon")); }
break;
}
case Game.Item.Gem.SuperFuryGem:
{
if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.En tityID, 10, "fastflash")); }
break;
}
case Game.Item.Gem.SuperKylinGem:
{
if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.En tityID, 10, "goldenkylin")); }
break;
}
#endregion
}
}
}
}

Second go to Attack.cs in PacketHandling and search for

Code:

Quote:
else if (AttackType == 44)
{
ushort SkillId = 6003;
ushort x = GC.MyChar.Loc.X;
ushort y = GC.MyChar.Loc.Y;
uint Target = GC.MyChar.EntityID;
and paste bellow

Code:
Quote:
for (byte i = 1; i < 8; i++)
{
Game.Item I = GC.MyChar.Equips.Get(i);
if (I.ID != 0 && I.Soc1 != Game.Item.Gem.EmptySocket)
{
Features.GemEffect.GemEffects(I.Soc1, GC);
}
}
and search for

Code:
Quote:
else if (AttackType == 24)
{
ushort SkillId;
long x;
long y;
uint Target;
#region GetSkillID
SkillId = Convert.ToUInt16(((long)Data[24] & 0xFF) | (((long)Data[25] & 0xFF) << 8));
SkillId ^= (ushort)0x915d;
SkillId ^= (ushort)GC.MyChar.EntityID;
SkillId = (ushort)(SkillId << 0x3 | SkillId >> 0xd);
SkillId -= 0xeb42;
#endregion
#region GetCoords
x = (Data[16] & 0xFF) | ((Data[17] & 0xFF) << 8);
x = x ^ (uint)(GC.MyChar.EntityID & 0xffff) ^ 0x2ed6;
x = ((x << 1) | ((x & 0x8000) >> 15)) & 0xffff;
x |= 0xffff0000;
x -= 0xffff22ee;
y = (Data[18] & 0xFF) | ((Data[19] & 0xFF) << 8);
y = y ^ (uint)(GC.MyChar.EntityID & 0xffff) ^ 0xb99b;
y = ((y << 5) | ((y & 0xF800) >> 11)) & 0xffff;
y |= 0xffff0000;
y -= 0xffff8922;
#endregion
#region GetTarget
Target = ((uint)Data[12] & 0xFF) | (((uint)Data[13] & 0xFF) << 8) | (((uint)Data[14] & 0xFF) << 16) | (((uint)Data[15] & 0xFF) << 24);
Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ GC.MyChar.EntityID) - 0x746F4AE6;
#endregion
bellow code, paste

Code:
Quote:
for (byte i = 1; i < 8; i++)
{
Game.Item I = GC.MyChar.Equips.Get(i);
if (I.ID != 0 && I.Soc1 != Game.Item.Gem.EmptySocket)
{
Features.GemEffect.GemEffects(I.Soc1, GC);
}
}

Credits Go To felipeboladao !
01/23/2010 21:56 pro4never#2
Few things that really aren't a problem but I just wanted to bring up.

Instead of using the same or checks for each one, why not just combine the different eq socket checks together and then have them checked for a specific gem.

As it is right now you are A) calculating effects fully separate from eachother (meaning if you have more than 1 type of super gem statistically EVERY ATTACK is going to show a gem effect) B) using a super high chance of success (meaning spammed effects) and C) not using any sort of control to see how often they can come out (not a big deal but even with lower chances of success... archers + cyclone.. holy shit that's alot of sdg effects)

Not a big issue, just thinking of ways it might be able to be improved. Ooh also, this one has no handling for AMOUNT of gems. (so sdg effect chance is the same with 1 sdg as it is with 14). Personal preference I suppose but shouldn't amount of gems change the amount the effect is displayed slightly?
01/23/2010 21:57 QuickCo#3
hmm w8 :) I look on that code
01/23/2010 22:35 coreymills#4
first post got changed
01/24/2010 04:02 felipeboladao#5
hehe, good release, my code is very simple..


First create an GemEffects.cs in PacketHandling and paste the code below

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace NewestCOServer.Features
{
    class GemEffect
    {
        public static void GemEffects(Game.Item.Gem Gem, Main.GameClient MyClient)
        {
            switch (Gem)
            {
                #region GemEffects
                case Game.Item.Gem.SuperDragonGem:
                    {
                        if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "goldendragon")); }
                        break;
                    }
                case Game.Item.Gem.SuperPhoenixGem:
                    {
                        if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "phoenix")); }
                        break;
                    }
                case Game.Item.Gem.SuperRainbowGem:
                    {
                        if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "rainbow")); }
                        break;
                    }
                case Game.Item.Gem.SuperMoonGem:
                    {
                        if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "moon")); }
                        break;
                    }
                case Game.Item.Gem.SuperFuryGem:
                    {
                        if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "fastflash")); }
                        break;
                    }
                case Game.Item.Gem.SuperKylinGem:
                    {
                        if (MyMath.ChanceSuccess(1.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "goldenkylin")); }
                        break;
                    }
                #endregion
            }
        }
    }
}
Second go to Attack.cs in PacketHandling and search for

Code:
                else if (AttackType == 44)
                {
                    ushort SkillId = 6003;
                    ushort x = GC.MyChar.Loc.X;
                    ushort y = GC.MyChar.Loc.Y;
                    uint Target = GC.MyChar.EntityID;
and pasta bellow

Code:
                    for (byte i = 1; i < 8; i++)
                    {
                        Game.Item I = GC.MyChar.Equips.Get(i);
                        if (I.ID != 0 && I.Soc1 != Game.Item.Gem.EmptySocket)
                        {
                            Features.GemEffect.GemEffects(I.Soc1, GC);
                            Features.GemEffect.GemEffects(I.Soc2, GC);
                        }
                    }
and search for

Code:
                else if (AttackType == 24)
                {
                    ushort SkillId;
                    long x;
                    long y;
                    uint Target;
                    #region GetSkillID
                    SkillId = Convert.ToUInt16(((long)Data[24] & 0xFF) | (((long)Data[25] & 0xFF) << 8));
                    SkillId ^= (ushort)0x915d;
                    SkillId ^= (ushort)GC.MyChar.EntityID;
                    SkillId = (ushort)(SkillId << 0x3 | SkillId >> 0xd);
                    SkillId -= 0xeb42;
                    #endregion
                    #region GetCoords
                    x = (Data[16] & 0xFF) | ((Data[17] & 0xFF) << 8);
                    x = x ^ (uint)(GC.MyChar.EntityID & 0xffff) ^ 0x2ed6;
                    x = ((x << 1) | ((x & 0x8000) >> 15)) & 0xffff;
                    x |= 0xffff0000;
                    x -= 0xffff22ee;

                    y = (Data[18] & 0xFF) | ((Data[19] & 0xFF) << 8);
                    y = y ^ (uint)(GC.MyChar.EntityID & 0xffff) ^ 0xb99b;
                    y = ((y << 5) | ((y & 0xF800) >> 11)) & 0xffff;
                    y |= 0xffff0000;
                    y -= 0xffff8922;
                    #endregion
                    #region GetTarget
                    Target = ((uint)Data[12] & 0xFF) | (((uint)Data[13] & 0xFF) << 8) | (((uint)Data[14] & 0xFF) << 16) | (((uint)Data[15] & 0xFF) << 24);
                    Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ GC.MyChar.EntityID) - 0x746F4AE6;
                    #endregion
bellow code, paste

Code:
for (byte i = 1; i < 8; i++)
                    {
                        Game.Item I = GC.MyChar.Equips.Get(i);
                        if (I.ID != 0 && I.Soc1 != Game.Item.Gem.EmptySocket)
                        {
                            Features.GemEffect.GemEffects(I.Soc1, GC);
                            Features.GemEffect.GemEffects(I.Soc2, GC);
                        }
                    }

hehe, this full working??, give me tranks :handsdown: ;D
01/24/2010 05:16 [GM]#6
Quote:
Originally Posted by QuickCo View Post
Search



Under That Add Next code


DragonGem Effects


PheonixGem Effect


RainbowGem

Violet Gem Effect

MoonGem Effect


KylinGem Effect

FuryGem Effect

TortoiseGem Effect



Thanks Me If you Use That Code
where to put this code i mean what is the name of the file?
01/24/2010 06:16 Arcо#7
Quote:
Originally Posted by [GM] View Post
where to put this code i mean what is the name of the file?
Did you search for #region GetTarget?
01/24/2010 15:33 [GM]#8
Quote:
Originally Posted by Hepatitis C View Post
Did you search for #region GetTarget?
yea i did its in Attack.cs
01/24/2010 20:59 .Ryu#9
Goodjob
01/25/2010 00:42 glover#10
Heya dudes, I think if you put it like my code, this work a lot better.
This is for 5165 source.

Try to find in file Attack.cs

Code:
                if (!GC.MyChar.Alive) return;
Try put only this one at below

Code:
                for (byte i = 1; i <= 12; i++)
                {
                    Game.Item I = GC.MyChar.Equips.Get(i);
                    if (I.ID != 0 && I.Soc1 != Game.Item.Gem.EmptySocket)
                        Features.GemEffect.GemEffects(I.Soc1, GC);
                    if (I.ID != 0 && I.Soc2 != Game.Item.Gem.EmptySocket)
                        Features.GemEffect.GemEffects(I.Soc2, GC);
                }
and last, put this into PacketHandling.GemEffects

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace NewestCOServer.Features
{
    class GemEffect
    {
        public static void GemEffects(Game.Item.Gem Gem, Main.GameClient MyClient)
        {
            switch (Gem)
            {
                #region GemEffects
                case Game.Item.Gem.SuperDragonGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "goldendragon")); }
                        break;
                    }
                case Game.Item.Gem.SuperPhoenixGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "phoenix")); }
                        break;
                    }
                case Game.Item.Gem.SuperRainbowGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "rainbow")); }
                        break;
                    }
                case Game.Item.Gem.SuperMoonGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "moon")); }
                        break;
                    }
                case Game.Item.Gem.SuperFuryGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "fastflash")); }
                        break;
                    }
                case Game.Item.Gem.SuperKylinGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "goldenkylin")); }
                        break;
                    }
                case Game.Item.Gem.SuperVioletGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "purpleray")); }
                        break;
                    }
                case Game.Item.Gem.SuperTortoiseGem:
                    {
                        if (MyMath.ChanceSuccess(2.0)) { MyClient.AddSend(Packets.String(MyClient.MyChar.EntityID, 10, "recovery")); }
                        break;
                    }
                #endregion
            }
        }
    }
}
It's work for me with all type attack :rolleyes:
01/25/2010 02:01 copz1337#11
good job.
01/26/2010 18:19 [GM]#12
GemEffects is underlined RED
01/28/2010 11:00 ramix#13
only work when you use your skills :S if you atack normaly not work :S
01/28/2010 16:01 glover#14
ramix you wrong look at page 1 on my post look where i added once this gemeffect checker. it work on any attacks.
01/28/2010 16:25 Jedex#15
What source is this code for?

#edit
Because if it is for 5017 it has already been released a half a dozen times.