This goes to Hybird From HCO so huge thanks
Ok, For example heres Hercules, // Will be any comments (Comments are on the right of the slashes)
Note this is only suitable for PHYSICAL attacks, Not magic like Fire Circle or w/e.1115: // Hercules
begin
if Lvl > 4 then Exit; // Invalid Spell if Level is higher than 4
if Attacker.Character.Stamina < 25 then Exit; // check stamina
if (Attacker.Character.Equipment[ItemPos_Lefthand].ItemID div 1000) <>
(Attacker.Character.Equipment[ItemPos_Righthand].ItemID div 1000) then
Exit;
// above checks if their two weapon-types match
Attacker.Character.Stamina := Attacker.Character.Stamina - 25;
// update stamina
Attacker.SendPacket(StatTypePacket(Attacker.Character.CharacterID, Attacker.Character.Stamina, ST_STAMINA, Attacker.Character.CurrentHP));
// send new stamina to client
Targets := TargetsInRange(Attacker, Damage, Lvl+1, DT_PHYSICAL, 0.25);
// lvl+1 is the range
// 0.25 is the offset of how much to cut off the damage
Packet := MAttackPacket(Attacker.Character.CharacterID,
X, Y, SpellID, Lvl, Targets);
Attacker.SendPacket(Packet);
SendRangePacket(Attacker.Character, MaxViewDistance, MaxViewDistance, Packet);
// above sends and constructs the packet
Targets.Free; // dispose of the memory used by 'targets' hashtable
end;
This is how it should be done
(spell id): // (spell name)
begin
if Lvl > (highest level) then Exit; // Invalid Spell if Level is higher than ( highest level of the spell)
if Attacker.Character.Stamina < (amount of stanima) then Exit; // check stamina
if (Attacker.Character.Equipment[ItemPos_Lefthand].ItemID div 1000) <>
(Attacker.Character.Equipment[ItemPos_Righthand].ItemID div 1000) then
Exit;
// above checks if their two weapon-types match
Attacker.Character.Stamina := Attacker.Character.Stamina - (amount of stanima;
// update stamina
Attacker.SendPacket(StatTypePacket(Attacker.Character.CharacterID, Attacker.Character.Stamina, ST_STAMINA, Attacker.Character.CurrentHP));
// send new stamina to client
Targets := TargetsInRange(Attacker, Damage, Lvl+1, DT_PHYSICAL, 0.25);
// lvl+1 is the range
// 0.25 is the offset of how much to cut off the damage
Packet := MAttackPacket(Attacker.Character.CharacterID,
X, Y, SpellID, Lvl, Targets);
Attacker.SendPacket(Packet);
SendRangePacket(Attacker.Character, MaxViewDistance, MaxViewDistance, Packet);
// above sends and constructs the packet
Targets.Free; // dispose of the memory used by 'targets' hashtable
end;
^^^^ was done by me well some of it
Thanks