[RELEASE] SandRaider NPC

02/11/2010 09:55 DontLookDown#16
Quote:
Originally Posted by Korvacs View Post
Code:
#region SandRaider
                            case 123321:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("Welcome, Here I sell SandRaider Garment!"));
                                        GC.AddSend(Packets.NPCLink("Cool let me in.", 1));
                                        GC.AddSend(Packets.NPCLink("Haa Ok Then", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                    {
                                        GC.AddSend(Packets.NPCSay("Are you interested?"));
                                        GC.AddSend(Packets.NPCLink("SandRaider", 2));
                                        GC.AddSend(Packets.NPCLink("No, thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 2)
                                    {
                                        GC.MyChar.AddItem(183305, 7);
                                        GC.AddSend(Packets.NPCSay("Here you are."));
                                        GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish()); 
                                    }
                                    return;
                                }
#endregion
That would be even better, because it would atually work....and is more efficient. :)
how would that be better and efficient? Hes trying to make a NPC to sell it, that what you did is giving it out for free?
02/11/2010 12:13 Korvacs#17
Quote:
Originally Posted by .Arco View Post
Why return instead of break?
If you break then you end that case, and the thread will continue to do whatever is after the switch, if anything, which is pointless really, if you use return then the thread returns from the method completely, instead of spending cpu time checking to see if it needs to do more work.

@DontLookDown:

I was fixing .Arco's completely broken npc which he posted.
02/11/2010 14:51 Decker_#18
Thanks everyone, this is my first NPC so I hope you like it! :D
02/11/2010 15:42 ASSN9NE#19
Nice,
but not much of a helpfull release since u need more than an npc with the item that is not implemented yet for people that do not have it u need more than that u need dds files like ItemMinIcon,MapItemIcon,texture & console scripts for items in ini and the txt files.
ex:
Code:
183305 SandRaider 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 65535 65535 0 0 0 0 0 0 0 0 00 00 2 2 1 675 0 Garment Fixed. 8
my problem is that i do not have the dds files because i havent been on real co since the release of 1.0

this is the npc i would use if it worked but then this item might not work 4 ervery1
Code:
                            #region SandRaider Garment 2soc -1 Seller SDG & SPG
                            case 666113:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("Are you interested in this 2soc -1 SDG or SPG SandRaider Garment for 5kkCps?"));
                                        GC.AddSend(Packets.NPCLink("SDG SandRaider", 1));
                                        GC.AddSend(Packets.NPCLink("SPG SandRaider", 2));
                                        GC.AddSend(Packets.NPCLink("No, thanks.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (GC.MyChar.Inventory.Count < 40)
                                    {
                                        if (Control == 1)
                                        {
                                            if (GC.MyChar.CPs >= 5000000)
                                            {
                                                GC.MyChar.CPs -= 5000000;
                                                GC.MyChar.AddItem(183305, 0, 0, 1, Game.Item.Gem.SuperDragonGem, Game.Item.Gem.SuperDragonGem);// NormalGoodLuck1

                                                GC.AddSend(Packets.NPCSay("Here you are."));
                                                GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                            else
                                            {
                                                GC.AddSend(Packets.NPCSay("You don't have enough CPs, they cost 5kk each now come on!."));
                                                GC.AddSend(Packets.NPCLink("I see.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }
                                        if (Control == 2)
                                        {
                                            if (GC.MyChar.CPs >= 5000000)
                                            {
                                                GC.MyChar.CPs -= 5000000;
                                                GC.MyChar.AddItem(183305, 0, 0, 1, Game.Item.Gem.SuperPhoenixGem, Game.Item.Gem.SuperPhoenixGem);// NormalGoodLuck1

                                                GC.AddSend(Packets.NPCSay("Here you are."));
                                                GC.AddSend(Packets.NPCLink("Thanks.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                            else
                                            {
                                                GC.AddSend(Packets.NPCSay("You don't have enough CPs, they cost 5kk each now come on!."));
                                                GC.AddSend(Packets.NPCLink("I see.", 255));
                                                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                                GC.AddSend(Packets.NPCFinish());
                                            }
                                        }

                                    }
                                    else
                                    {
                                        GC.AddSend(Packets.NPCSay("Your inventory is full."));
                                        GC.AddSend(Packets.NPCLink("I see.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    break;
                                }
                                #endregion
02/11/2010 18:51 Decker_#20
Well them files have already been released so I don't need to put them on my thread.
If people got them files, then they can use my NPC.
If they don't, well, that's there fault.
02/12/2010 06:20 Arcо#21
Quote:
Originally Posted by Korvacs View Post
If you break then you end that case, and the thread will continue to do whatever is after the switch, if anything, which is pointless really, if you use return then the thread returns from the method completely, instead of spending cpu time checking to see if it needs to do more work.

@DontLookDown:

I was fixing .Arco's completely broken npc which he posted.
Ah so in all retrospect, I should go through all the cases in the source and end them with return rather than break?
02/12/2010 10:10 Korvacs#22
Correct.
02/12/2010 20:47 Olodady#23
Nice job :)
Got a lil idea for you :)
:D
Try making a new shop adding new garments from the official co :p
would be cool :)
Again :)
Nice job and keep up the good work ;)
02/13/2010 00:07 Korvacs#24
Quote:
Originally Posted by .Arco View Post
Ah so in all retrospect, I should go through all the cases in the source and end them with return rather than break?
If your worried about performance at all though you should also apply this to your chat commands, because atleast the npc dialogs are a switch, where as commands are not, however you can change commands over to be a switch aswell, its very simple to do.
02/13/2010 00:10 Arcо#25
Quote:
Originally Posted by Korvacs View Post
If your worried about performance at all though you should also apply this to your chat commands, because atleast the npc dialogs are a switch, where as commands are not, however you can change commands over to be a switch aswell, its very simple to do.
Well item uses are a switch so should I not use the return?
02/13/2010 00:24 Korvacs#26
Depends if theres processing to be done after the switch.