Redux v2 - Official 5065 Classic Source

01/03/2014 14:59 mujake#691
So far things are well onlive server.
Also i have started working at Wuxing oven and thanks to Fang I found old pictures with it.
Below is the Composition so far only for +1 to +9 and +9 to +10 (rest i'll finish them tonight)
also for enchanting i don't know what window to pop up so i place the compose window so far for testing


Also i am interested in that function just like items checking for more than one but now for deleting to improve it's performance later on.
01/03/2014 16:10 Aceking#692
Quote:
Originally Posted by mujake View Post
So far things are well onlive server.
Also i have started working at Wuxing oven and thanks to Fang I found old pictures with it.
Below is the Composition so far only for +1 to +9 and +9 to +10 (rest i'll finish them tonight)
also for enchanting i don't know what window to pop up so i place the compose window so far for testing


Also i am interested in that function just like items checking for more than one but now for deleting to improve it's performance later on.
Try
Code:
_client.Send(GeneralActionPacket.Create(_client.UID, Enum.DataAction.OpenCustom, 1091));
01/03/2014 18:08 pro4never#693
Also - please refer to the sample code we gave you earlier for the socket npc...

Code:
  case 11:
                case 12:
                case 13:
                case 15:
                case 16:
                case 18:
                    {
                        var equipment = _client.Equipment.GetItemBySlot((Enum.ItemLocation)(_linkback % 10));
                        if(equipment == null)
                            AddText("There must be some mistake., You must be wearing an item before you may socket it!");
                        if (equipment.Gem2 != 0 || equipment.Gem1 != 0)
                            AddText("There must be some mistake. This item already has a socket!");
                        else if (!_client.HasItem(1088000, 12))
                            AddText("There must be some mistake. You do not have the 12 DragonBalls required to socket this item!");
                        else
                        {
                            for (var i = 0; i < 12; i++)
                                _client.DeleteItem(1088000);
                            equipment.Gem1 = 255;
                            _client.Send(ItemInformationPacket.Create(equipment));
                            AddText("It is done! Please enjoy your new equipment.");
                        }
                        AddOption("Nevermind", 255);
                        break;
                    }

That's the test code I wrote for adding first socket. Use it as an example for how you could handle doing your stuff. Good code should not be duplicated.
01/03/2014 18:21 Wuscheli#694
small question..

I've added a new npc in my database and also created a .cs for it but it's still not working if i click on the new npc =/
01/03/2014 18:21 mujake#695
I guess I could try as it simplifies lots of lines .I will try it and after i get it all done i'll post the NPC and maybe i caould do the Blessing NPC for tortoise ..or it was added later?the part to pay 5 gems to make it -1 I mean.


Let me know if I got it right, this is what I have done with the sample code you posted for items socketing.

01/03/2014 18:42 pro4never#696
Quote:
Originally Posted by Wuscheli View Post
small question..

I've added a new npc in my database and also created a .cs for it but it's still not working if i click on the new npc =/
The only thing required to make an npc work is a properly written script file.

Proper structure of that file places it with the namespace Redux.Npcs and the class name as NPC_####: INpc with a constructor which requires the parameter of type Game_Server.Player and and override void name Run accepting the parameters Game_Server.Player and ushort


Make sure that the class itself is given the correct ID (class name, constructor and ID value) and that you re-build/debug the source once the changes are made.


Here's an example npc script to base yours around


Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Redux.Packets.Game;

namespace Redux.Npcs
{

    public class NPC_#### : INpc
    {
        /// <summary>
        /// Handles NPC usage for [####] Npc Name
        /// </summary>
        public NPC_####(Game_Server.Player _client)
            : base(_client)
        {
            ID = ####;
            Face = #;
        }

        public override void Run(Game_Server.Player _client, ushort _linkback)
        {
            Responses = new List<NpcDialogPacket>();
            AddAvatar();
            switch (_linkback)
            {
                case 0:
                    AddText("I'm an empty npc!");
                    AddOption("Thanks", 255);
                    break;
            }
            AddFinish();
            Send();

        }
    }
}

Quote:
Originally Posted by mujake View Post
I guess I could try as it simplifies lots of lines .I will try it and after i get it all done i'll post the NPC and maybe i caould do the Blessing NPC for tortoise ..or it was added later?the part to pay 5 gems to make it -1 I mean.


Let me know if I got it right, this is what I have done with the sample code you posted for items socketing.



the modulo operator (%) gives you the remainder left after doing a standard division. Your naming of linkbacks has the value in the left most digit meaning you'd want to be dividing by 10 rather than finding the remainder of dividing by 10 (which will always be 0 as the right most digit in these linkbacks are all 0)


Either is fine but you have to decide on a standard and then use it properly. Personally I prefer to use the right most digit as being the item being operated and the left most digit(s) as the type of operation being performed.


eg: 11-19 = First socket in slots 1 through 9
eg: 21-29 = Second socket in slots 1 through 9

In these examples you pull the slot being operated on through linkback % 10 and the type of operation being performed through linkback / 10

It's just easier to read in my opinion
01/03/2014 18:42 turk55#697
Quote:
Originally Posted by mujake View Post
I guess I could try as it simplifies lots of lines .I will try it and after i get it all done i'll post the NPC and maybe i caould do the Blessing NPC for tortoise ..or it was added later?the part to pay 5 gems to make it -1 I mean.


Let me know if I got it right, this is what I have done with the sample code you posted for items socketing.

Why am I getting the idea that you are going to repeat this code for +10 to +11 and +11 to +12?
01/03/2014 18:48 pro4never#698
Quote:
Originally Posted by turk55 View Post
Why am I getting the idea that you are going to repeat this code for +10 to +11 and +11 to +12?
Indeed. I'd do one single page of slots (what item do you want to upgrade) which links to a confirmation page (say 1X linkbacks) telling you how much it will cost and asking that you agree which links to an actual upgrade page (say 2X linkbacks) which confirms all costs and items required and then does the actual upgrade.


3 total scripts handling everything to do with composing past +9 with no duplication of code past that which is necessary (validating that they still have item equipped on the actual upgrade portion and such)
01/03/2014 20:03 mujake#699
Quote:
Originally Posted by pro4never View Post
Indeed. I'd do one single page of slots (what item do you want to upgrade) which links to a confirmation page (say 1X linkbacks) telling you how much it will cost and asking that you agree which links to an actual upgrade page (say 2X linkbacks) which confirms all costs and items required and then does the actual upgrade.


3 total scripts handling everything to do with composing past +9 with no duplication of code past that which is necessary (validating that they still have item equipped on the actual upgrade portion and such)
Well this is what i have made starting from the code you have posted.

Gear Socket NPC(for now are all in one ,I am planning to separate the market one from the one that should be in BI)


And this is the finished composition NPC

01/03/2014 20:25 turk55#700
Just like I said in my previous post, he just repeated the code. =/
01/03/2014 20:45 mujake#701
Quote:
Originally Posted by turk55 View Post
Just like I said in my previous post, he just repeated the code. =/
I am not that much of expert when comes to coding ..most of time I make things logically and by trial and error, and constantly learning...so I think that not being able to make best decision when comes to performance of an script or other things normal for an rookie.
01/03/2014 21:19 Wuscheli#702
i have to debug the whole project right? but i just can open every single .cs file cannot see any project data =/
01/03/2014 21:25 turk55#703
Quote:
Originally Posted by mujake View Post
I am not that much of expert when comes to coding ..most of time I make things logically and by trial and error, and constantly learning...so I think that not being able to make best decision when comes to performance of an script or other things normal for an rookie.
Before you posted your code, you could of read the post pro4never posted.

Quote:
Originally Posted by pro4never View Post
Indeed. I'd do one single page of slots (what item do you want to upgrade) which links to a confirmation page (say 1X linkbacks) telling you how much it will cost and asking that you agree which links to an actual upgrade page (say 2X linkbacks) which confirms all costs and items required and then does the actual upgrade.


3 total scripts handling everything to do with composing past +9 with no duplication of code past that which is necessary (validating that they still have item equipped on the actual upgrade portion and such)
--

Quote:
Originally Posted by Wuscheli View Post
i have to debug the whole project right? but i just can open every single .cs file cannot see any project data =/
Open the .csproj or .sln file.
01/03/2014 21:53 pro4never#704
Quote:
Originally Posted by Wuscheli View Post
i have to debug the whole project right? but i just can open every single .cs file cannot see any project data =/
Open the solution, edit code of the project using the solution explorer and then recompile/debug the project to build a new .exe



Think of it like writing a paper. You write a text document with your essay and make your changes saving periodically. This process is similar to editing the .cs files. You're making changes but you're not finalizing or 'using' them.

Compiling or debugging the project builds a new .exe which can be run and used. This can be thought of much like printing out your essay to be submitted. It's the 'finalized' version that has been proofread and is now printed off and ready to be 'used'.


TL: DR - Must be opening the full project and then recompiling before any code changes will take effect.


Quote:
Originally Posted by mujake View Post
I am not that much of expert when comes to coding ..most of time I make things logically and by trial and error, and constantly learning...so I think that not being able to make best decision when comes to performance of an script or other things normal for an rookie.

If you refer to my previous post, we broke it down into the most basic steps you should take for maximum efficiency.

Before writing any script you should do a quick shorthand representation of the goals it should accomplish and then break those down into individual steps.

Writing pseudo code will greatly decrease the time you spend writing scripts and highly increase both your understanding of the code and the efficiency/portability of it as well.

Program planning and design is a very important field and I wish more people would put more emphasis on it. Any solid programming degree will include at LEAST a few classes covering it as it's every bit as important as knowledge of any particular scripting language.
01/03/2014 21:56 Wuscheli#705
#edited nvm got it thanks