[Help] 5017 Questions.

10/12/2011 03:42 killersub#1
okay so I'm going oldstyle now. back to my 5017 source I had been working on for almost a year.

I'm getting a few problems with the personal shops in the market. I would like some information on how can I show them once the player clicks "Yes" on the dialog, the actual dialog itself when clicked on the player carpet, and the implementation of items with Silvers/CPs, also the taking of away of items once the player clicks "Remove".

I also want to know why the Stylist (a.k.a. face changer) NPC in Twin City doesn't change your face and does not deduce silvers from the char.'s inventory. I would also like some professional advice for this as I have been working with newer sources lately (as you can see) and have not been working with this one in such a long time but would like to see what I can do for it.

Also, items aren't spawning, like when I buy an item it doesn't show in my inventory/it says its added it but it doesn't show up.

And one more thing, FB/SS doesn't seem to show up when I click the skill, come to think of it I've tried a lot of skills and they aren't seem to be working even though they might be coded in the source.

As long as I get "Something" as to why this is happening I'll be satisfied.

The base is from CoFuture, btw.
10/12/2011 13:10 pro4never#2
I seem to remember cofuture being a rather crap base but can't really comment on it without having used it before.

Sounds to me like you're just dealing with features not being coded.

Market gets overhyped by people about how much work it is to code... it's REALLLLYYY simple once you realize how it works.

When you click the flag (There's a flag mesh as well as a npc subtype for shop flags!) and the user clicks ok they should walk to the location and send you a packet subtype requesting to vend (I think it was gendat subtype). You then calculate which npc they used, check if someone is vending there (requires a TINY rework of your npc system to determine if "isVending" based on the npc flag AND a source controlled variable for redundancy checks).

Assuming the shop is not in use you simply...

1: Set the npc to vending
2: Set the shop flag to market stall type vs market flag type (so no one else can get the "want to vend?" msg)
3: Add the carpet mesh with I think it was... +1 -1 offset from flag? I forget but easy to find from other sources. Make sure you give this mesh a UID that makes sense for easy removal!
4: Set up playerShop class/struct to hold any items being sold, keep track of the flag uid and carpet uid.

Now you need to handle all the other subtypes which... once you look at them are REALLY simple to do (View shop... see if they are vending, pull items from their shop if they exist and display to user!... Buy item? Check if item exists in shop and then remove from shop, add to new user, transfer currency... Even simpler then coding trade system!)


Stylist is a general data subtype which just sends the face mesh. Use some integer math to calculate the new mesh, send the mesh update subtype (there may be a face update subtype, I forget) and then save to database. DONE

Items spawning I'd just check over and possibly re-write your shop code.
10/12/2011 13:11 Korvacs#3
Anything written on top of cofuture could very well have issues as it was the first source i ever wrote and itself is heavily based upon coemu.

Your likely having issues with the packets, be that their layout or construction.
10/12/2011 22:59 killersub#4
Quote:
Originally Posted by pro4never View Post
I seem to remember cofuture being a rather crap base but can't really comment on it without having used it before.

Sounds to me like you're just dealing with features not being coded.

Market gets overhyped by people about how much work it is to code... it's REALLLLYYY simple once you realize how it works.

When you click the flag (There's a flag mesh as well as a npc subtype for shop flags!) and the user clicks ok they should walk to the location and send you a packet subtype requesting to vend (I think it was gendat subtype). You then calculate which npc they used, check if someone is vending there (requires a TINY rework of your npc system to determine if "isVending" based on the npc flag AND a source controlled variable for redundancy checks).

Assuming the shop is not in use you simply...

1: Set the npc to vending
2: Set the shop flag to market stall type vs market flag type (so no one else can get the "want to vend?" msg)
3: Add the carpet mesh with I think it was... +1 -1 offset from flag? I forget but easy to find from other sources. Make sure you give this mesh a UID that makes sense for easy removal!
4: Set up playerShop class/struct to hold any items being sold, keep track of the flag uid and carpet uid.

Now you need to handle all the other subtypes which... once you look at them are REALLY simple to do (View shop... see if they are vending, pull items from their shop if they exist and display to user!... Buy item? Check if item exists in shop and then remove from shop, add to new user, transfer currency... Even simpler then coding trade system!)


Stylist is a general data subtype which just sends the face mesh. Use some integer math to calculate the new mesh, send the mesh update subtype (there may be a face update subtype, I forget) and then save to database. DONE

Items spawning I'd just check over and possibly re-write your shop code.
Features ARE coded in the source, I checked.

ScentSword Calculations:
Code:
public class ScentSword
    {
        public ScentSword(int Target, int SkillID, int X, int Y, ref Connection Con)
        {
            Characters Character = Con.Client.Character;
            int CX = Character.PosX;
            int CY = Character.PosY;

            Target D = new Target();

            ArrayList MonstersInMap = MapsClass.MapContents(Character.Map, ObjectType.Monster);
            ArrayList PlayersInMap = MapsClass.MapContents(Character.Map, ObjectType.Player);
            ArrayList Target2 = new ArrayList();

            if (!Character.Skills.ContainsKey(SkillID))
                return;

            Skill TheSkill = Character.Skills[SkillID];

            int n = 0;

            if (Character.Stamina < 10)
                return;

            HeadHandler.DoGemEffect(Character);

            Character.Stamina -= 10;
            Con.Send(UpdatePacket.Character((uint)Character.PlayerID, UpdateChar.Stamina, (uint)Character.Stamina));

            while ((CX != X || CY != Y) && n < 10)
            {
                int NewX = (X) - CX;
                if (NewX >= 1) { NewX = 1; }
                else if (NewX < 0) { NewX = -1; }
                int NewY = (Y) - CY;
                if (NewY >= 1) { NewY = 1; }
                else if (NewY < 0) { NewY = -1; }

                CX += NewX;
                CY += NewY;

                for (int i = 0; i < MonstersInMap.Count; i++)
                {
                    Monster TheMonster = (Monster)MonstersInMap[i];

                    if (TheMonster.X == CX && TheMonster.Y == CY)
                    {
                        D = new Target();

                        D.ID = TheMonster.MonsterID;
                        D.Damage = Math.Max(1, RandomController.RandomGen.Next(Character.MinAttack, Character.MaxAttack) * (Character.Level - TheMonster.Level));

                        TheMonster.Death(Character.PlayerID, 300);

                        Target2.Add(D);
                    }
                }

                if (Character.PKState == PKMode.PK)
                {

                    for (int i = 0; i < PlayersInMap.Count; i++)
                    {
                        Connection CON = (Connection)PlayersInMap[i];

                        if (Database.MapInfo.ContainsKey(Character.Map))
                            if (Database.MapInfo[Character.Map].PKAllowed == false)
                            {
                                Con.SystemChat("PK is forbidden here.", ChatType.Top, 0xFF0000);
                                return;
                            }

                        if (CON.Client.Character.PosX == CX && CON.Client.Character.PosY == CY)
                        {
                            D = new Target();

                            D.ID = CON.Client.Character.PlayerID;

                            if (CON.Client.Character.HP > 0)
                            {
                                int Damage = RandomController.RandomGen.Next(Character.MinAttack, Character.MaxAttack);
                                Damage += (Damage * TheSkill.SkillLevel) / 2;
                                Damage += (Character.Level - CON.Client.Character.Level) * 20;
                                Damage -= CON.Client.Character.Defense;

                                Damage = Math.Max(1, Damage);

                                D.Damage = Damage;

                                if (CON.Client.Character.HP <= Damage)
                                {
                                    CON.Client.Character.HP = 0;
                                    CON.Client.Character.Death(Character.PlayerID, 300, ref CON);

                                    if (!CON.Client.Character.IsBlue())
                                    {
                                        Character.BlueColor(true);
                                        Character.PKPoints += 10;
                                        Con.Send(UpdatePacket.Character((uint)Character.PlayerID, UpdateChar.PKP, (uint)Character.PKPoints));
                                    }
                                }
                                else
                                {
                                    CON.Client.Character.HP -= Damage;
                                }

                                CON.Send(RefreshHP.Packet(CON.Client.Character.PlayerID, CON.Client.Character.HP));

                                Target2.Add(D);
                            }
                        }
                    }
                }
                n++;
            }
            HeadHandler.SendVisibilityfield(AttackSkillList.Packet(Character.PlayerID, SkillID, TheSkill.SkillLevel, X, Y, Target2), Character);
        }
    }
FastBlade Calculations:

Uses the same code as above.

I understand the subtype for the vending in the market, but still I'm a bit puzzled about the items taking a LONG time to load on the server once bough/spawned.

Quote:
Originally Posted by Korvacs View Post
Anything written on top of cofuture could very well have issues as it was the first source i ever wrote and itself is heavily based upon coemu.

Your likely having issues with the packets, be that their layout or construction.
what 5017 source would you recommend, then?
10/12/2011 23:25 Korvacs#5
I would recommend you write your own using others as references.
10/13/2011 03:18 killersub#6
Quote:
Originally Posted by Korvacs View Post
I would recommend you write your own using others as references.
I accidentally posted the wrong source LOL.

I still have 1 question though, whenever my character walks up to the flag to start vending it sends him to the side and says: "You must pick a valid spot for vending!"

Any ideas?
10/13/2011 03:52 pro4never#7
two possibilities...

#1: not flagging it as market in the map info packet (shouldn't matter but possible client doesn't like it if not)

#2: Source isn't calculating flag/vending positions properly (easy to do... just search for that message to see if the problem is source side)
10/14/2011 02:23 killersub#8
Quote:
Originally Posted by pro4never View Post
two possibilities...

#1: not flagging it as market in the map info packet (shouldn't matter but possible client doesn't like it if not)

#2: Source isn't calculating flag/vending positions properly (easy to do... just search for that message to see if the problem is source side)
I tried to check where the source gives off the error, but it doesn't find that line in the source somehow.

by the way, how can I make checks so that any character in the market can't use any of their skills?