Quote:
Originally Posted by pro4never
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
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?