Offline TG Trinity source

06/03/2012 20:38 zoro7070#1
how can i Forbidden players from go to OfflineTG from some map like war jail
my idea but did not work
Code:
#region Offline TG (2044)
                case 2044:
                    {
                        OfflineTGRequest otgr = new OfflineTGRequest(false);
                        otgr.Deserialize(packet);
                        switch (otgr.ID)
                        {
                            case OfflineTGRequest.OnTrainingTimeRequested:
                                {
                                    otgr.Minutes = 900;
                                    client.Send(otgr);
                                    break;
                                }
                            case OfflineTGRequest.OnConfirmation:
                                {
                                    client.Entity.PreviousMapID = client.Entity.MapID;
                                    client.Entity.PrevX = client.Entity.X;
                                    client.Entity.PrevY = client.Entity.Y;
                                    client.Entity.MapID = 601;
                                    client.Entity.X = 64;
                                    client.Entity.Y = 56;
                                    client.OfflineTGEnterTime = DateTime.Now;

                                    client.Disconnect();
                                    break;
                                }
                            case OfflineTGRequest.ClaimExperience:
                                {
                                    var T1 = new TimeSpan(DateTime.Now.Ticks);
                                    var T2 = new TimeSpan(client.OfflineTGEnterTime.Ticks);
                                    ushort minutes = (ushort)(T1.TotalMinutes - T2.TotalMinutes);
                                    minutes = (ushort)Math.Min((ushort)900, minutes);
                                    double expballGain = (double)300 * (double)minutes / (double)900;
                                    while (expballGain >= 100)
                                    {
                                        expballGain -= 100;
                                        client.IncreaseExperience(client.ExpBall, false);
                                    }
                                    if (expballGain != 0)
                                        client.IncreaseExperience((uint)(client.ExpBall * (expballGain / 100)), false);

                                    client.Entity.SetLocation(client.Entity.PreviousMapID, client.Entity.PrevX, client.Entity.PrevY);
                                    if (client.Map.ID == 1036 || client.Map.ID == 1039 || client.Map.ID == 1730 || client.Map.ID == 1731 || client.Map.ID == 1732 || client.Map.ID == 1733 || client.Map.ID == 1734 || client.Map.ID == 1735 || client.Map.ID == 1736 || client.Map.ID == 1737 || client.Map.ID == 1950 || client.Map.ID == 3580 || client.Map.ID == 3581 || client.Map.ID == 3582 || client.Map.ID == 3583 || client.Map.ID == 3584 || client.Map.ID == 3585 || client.Map.ID == 3586)
                                        client.Entity.Teleport(1002, 430, 378);
                                    else if (Game.ConquerStructures.Society.GuildWar.IsWar == true && client.Map.ID == 1038 || client.Map.ID == 6001)
                                        client.Entity.Teleport(6001, 31, 74);
                                    else if (client.Map.ID == 6000)
                                        client.Entity.Teleport(6000, 31, 74);
                                    else 
                                    {
                                        switch (client.Map.ID)
                                        {
                                            default:
                                                {
                                                    client.Entity.Teleport(1002, 429, 378);
                                                    break;
                                                }
                                            case 1000:
                                                {
                                                    client.Entity.Teleport(1000, 500, 650);
                                                    break;
                                                }
                                            case 1020:
                                                {
                                                    client.Entity.Teleport(1020, 565, 562);
                                                    break;
                                                }
                                            case 1011:
                                                {
                                                    client.Entity.Teleport(1011, 188, 264);
                                                    break;
                                                }
                                            case 1015:
                                                {
                                                    client.Entity.Teleport(1015, 717, 571);
                                                    break;
                                                }
                                            case 6001:
                                                {
                                                    client.Entity.Teleport(6001, 31, 74);
                                                    break;
                                                }
                                            case 6000:
                                                {
                                                    client.Entity.Teleport(6000, 31, 74);
                                                    break;
                                                }
                                        }
                                    }
                                    client.OfflineTGEnterTime = DateTime.Now;
                                    break;
                                }
                            default:
                                client.Send(otgr);
                                break;
                        }
                        break;
                    }
                #endregion
06/03/2012 20:52 -Shunsui-#2
MAPSTATUS!
06/03/2012 21:11 turk55#3
try this
Code:
 case OfflineTGRequest.OnConfirmation:
                                {
                                 if (client.Entity.MapID != 6003) { // 6003 is botjail if im right you can basically use this idea though
                                    client.Entity.PreviousMapID = client.Entity.MapID;
                                    client.Entity.PrevX = client.Entity.X;
                                    client.Entity.PrevY = client.Entity.Y;
                                    client.Entity.MapID = 601;
                                    client.Entity.X = 64;
                                    client.Entity.Y = 56;
                                    client.OfflineTGEnterTime = DateTime.Now;

                                    client.Disconnect();
                                    break;
                                }
}
06/03/2012 21:18 Zeroxelli#4
If they're getting to TG without speaking to (and being withing "seeing" range of the NPC that sends them there) they should not be teleported to begin with.
06/04/2012 08:05 shadowman123#5
Quote:
Originally Posted by turk55 View Post
try this
Code:
 case OfflineTGRequest.OnConfirmation:
                                {
                                 if (client.Entity.MapID != 6003) { // 6003 is botjail if im right you can basically use this idea though
                                    client.Entity.PreviousMapID = client.Entity.MapID;
                                    client.Entity.PrevX = client.Entity.X;
                                    client.Entity.PrevY = client.Entity.Y;
                                    client.Entity.MapID = 601;
                                    client.Entity.X = 64;
                                    client.Entity.Y = 56;
                                    client.OfflineTGEnterTime = DateTime.Now;
                                    client.Disconnect();
                                    break;
                                }
}
dude ur code is less efficient Cuz he might die In GW Map which is 1038 and then when he become ghost he use it .. so Lets Say it would be Like that

Code:
                       case OfflineTGRequest.OnConfirmation:
                                {
                                 if (client.Entity.MapID != 6003 || client.Entity.MapID != 1038) { // 6003 is botjail if im right you can basically use this idea though
                                    client.Entity.PreviousMapID = client.Entity.MapID;
                                    client.Entity.PrevX = client.Entity.X;
                                    client.Entity.PrevY = client.Entity.Y;
                                    client.Entity.MapID = 601;
                                    client.Entity.X = 64;
                                    client.Entity.Y = 56;
                                    client.OfflineTGEnterTime = DateTime.Now;
                                    client.Disconnect();
                                    break;
                                }
                                else
                                {
                                    client.send(new NpcReply(6, " You Cant Use Offline Training While u r in GuildWar Maps  ") { OptionID = 87 });
                                }
}
06/04/2012 11:37 turk55#6
Quote:
Originally Posted by shadowman123 View Post
.

I know, it was just a example.
06/04/2012 13:01 zoro7070#7
the code works with my source
Code:
case OfflineTGRequest.OnConfirmation:
                                {
                                    if (client.Entity.MapID != 6003 || client.Entity.MapID != 1038 || client.Entity.MapID != 6001 || client.Entity.MapID != 6002)
                                    { 
                                        client.Entity.PreviousMapID = client.Entity.MapID;
                                        client.Entity.PrevX = client.Entity.X;
                                        client.Entity.PrevY = client.Entity.Y;
                                        client.Entity.MapID = 601;
                                        client.Entity.X = 64;
                                        client.Entity.Y = 56;
                                        client.OfflineTGEnterTime = DateTime.Now;
                                        client.Disconnect();
                                        break;
                                    }
                                    else
                                    {
                                        client.Send(new NpcReply(NpcReply.MessageBox, " You can't use Offline Training While you are in GuildWar Maps"));
                                        break;
                                    }
                                }
but i go to 1038 and send my account to offline TG without any problem
06/04/2012 15:21 _DreadNought_#8
Quote:
Originally Posted by shadowman123 View Post
dude ur code is less efficient Cuz he might die In GW Map which is 1038 and then when he become ghost he use it .. so Lets Say it would be Like that

Code:
                       case OfflineTGRequest.OnConfirmation:
                                {
                                 if (client.Entity.MapID != 6003 || client.Entity.MapID != 1038) { // 6003 is botjail if im right you can basically use this idea though
                                    client.Entity.PreviousMapID = client.Entity.MapID;
                                    client.Entity.PrevX = client.Entity.X;
                                    client.Entity.PrevY = client.Entity.Y;
                                    client.Entity.MapID = 601;
                                    client.Entity.X = 64;
                                    client.Entity.Y = 56;
                                    client.OfflineTGEnterTime = DateTime.Now;
                                    client.Disconnect();
                                    break;
                                }
                                else
                                {
                                    client.send(new NpcReply(6, " You Cant Use Offline Training While u r in GuildWar Maps  ") { OptionID = 87 });
                                }
}
Because it would be less efficient, What the fuck does having the wrong id have to do with efficiency? Nubs these days.
06/04/2012 17:16 shadowman123#9
Quote:
Originally Posted by _DreadNought_ View Post
Because it would be less efficient, What the fuck does having the wrong id have to do with efficiency? Nubs these days.
Well i maybe Phrased it wrongly i meant it didnt Fix the Whole Problem ..Thats it
06/04/2012 19:28 Zeroxelli#10
Did anyone notice something extremely obvious?

Code:
if (client.Entity.MapID != 6003 || client.Entity.MapID != 1038 || client.Entity.MapID != 6001 || client.Entity.MapID != 6002)
You're using OR (||) instead of AND (&&) for this check.

Anywho, simpler way?
Code:
List<int> NonTGMaps = new List<int>() { 1038, 6000, 6001, 6002, 6003 }; // Add more here
// ... 
if (!NonTGMaps.Contains(client.Entity.MapID))
{
    // Teleport code here
}
else
{
    // Tell them they can't go to TG from here..
}
or something like that.

Edit: Also, why are you disconnecting them? If you actually send the ConfirmLocation and Map packets, you don't have to do that.
Edit2: Ah, "offline" TG. Silly newer patches.
06/04/2012 20:39 shadowman123#11
Quote:
Originally Posted by Zeroxelli View Post
Did anyone notice something extremely obvious?

Code:
if (client.Entity.MapID != 6003 || client.Entity.MapID != 1038 || client.Entity.MapID != 6001 || client.Entity.MapID != 6002)
You're using OR (||) instead of AND (&&) for this check.

Anywho, simpler way?
Code:
List<int> NonTGMaps = new List<int>() { 1038, 6000, 6001, 6002, 6003 }; // Add more here
// ... 
if (!NonTGMaps.Contains(client.Entity.MapID))
{
    // Teleport code here
}
else
{
    // Tell them they can't go to TG from here..
}
or something like that.

Edit: Also, why are you disconnecting them? If you actually send the ConfirmLocation and Map packets, you don't have to do that.
Edit2: Ah, "offline" TG. Silly newer patches.
oh You r Right About that ..btw i liked Using List Methods :D Awesome
06/04/2012 20:40 Zeroxelli#12
Quote:
Originally Posted by shadowman123 View Post
oh You r Right About that ..btw i liked Using List Methods :D Awesome
Yeah, it's just a tad tidier than a bunch of IF statements, and less typing too.
06/05/2012 22:21 zoro7070#13
Quote:
Originally Posted by Zeroxelli View Post
Did anyone notice something extremely obvious?

Code:
if (client.Entity.MapID != 6003 || client.Entity.MapID != 1038 || client.Entity.MapID != 6001 || client.Entity.MapID != 6002)
You're using OR (||) instead of AND (&&) for this check.

Anywho, simpler way?
Code:
List<int> NonTGMaps = new List<int>() { 1038, 6000, 6001, 6002, 6003 }; // Add more here
// ... 
if (!NonTGMaps.Contains(client.Entity.MapID))
{
    // Teleport code here
}
else
{
    // Tell them they can't go to TG from here..
}
or something like that.

Edit: Also, why are you disconnecting them? If you actually send the ConfirmLocation and Map packets, you don't have to do that.
Edit2: Ah, "offline" TG. Silly newer patches.
thanks for your simpler way ;)
it works fine now
06/05/2012 22:24 Zeroxelli#14
Quote:
Originally Posted by zoro7070 View Post
thanks for your simpler way ;)
it works fine now
Good to know, good luck with your server.