Refining

Mu online season 21 - grand opening

ibby

I'm a massive prick
Dedicated Member
Jan 10, 2017
895
151
85
is it possible to get 100% chance?
 

Taising

Loyal Member
Loyal Member
Jan 11, 2017
16
1
15
To be honest, I would rather we had good old Carlos in than a window with a % chance and random item throw in.

It was fun working out recipe's in Euro and I was looking forward to maybe testing the same on here, only after a couple of days you put in refine npc and closed Carlos's house.... was a big sigh for me.
 

Jamie

LOMCN Developer
Developer
Mar 29, 2003
4,862
418
350
United Kingdom
To be honest, I would rather we had good old Carlos in than a window with a % chance and random item throw in.

It was fun working out recipe's in Euro and I was looking forward to maybe testing the same on here, only after a couple of days you put in refine npc and closed Carlos's house.... was a big sigh for me.

There were never any Recipe's on Euro. Anymore than the two best items and 5 BlackIronOre was literally destroyed and not used.
 

WelshSteel

Hallucination Critic
Dedicated Member
Dec 15, 2016
699
203
85
To be honest, I would rather we had good old Carlos in than a window with a % chance and random item throw in.

It was fun working out recipe's in Euro and I was looking forward to maybe testing the same on here, only after a couple of days you put in refine npc and closed Carlos's house.... was a big sigh for me.

I hated these secrets, takes time from the actual game and some taking advanatge with 9+ refining,
 

Taising

Loyal Member
Loyal Member
Jan 11, 2017
16
1
15
Erm no is my answer to that, i spent Million and Millions working out and testing combinations, and found different results, it added to the game not took from it, especially when you had worked out how to make say 5,6th refine, to then risk going for the 7th. It added to the risk/reward and gave the game more to do then just the grind. Where as now, its throw 12 x the highest dc/sc/mc item in and watch the % go up.
 

Jamie

LOMCN Developer
Developer
Mar 29, 2003
4,862
418
350
United Kingdom
Erm no is my answer to that, i spent Million and Millions working out and testing combinations, and found different results, it added to the game not took from it, especially when you had worked out how to make say 5,6th refine, to then risk going for the 7th. It added to the risk/reward and gave the game more to do then just the grind. Where as now, its throw 12 x the highest dc/sc/mc item in and watch the % go up.

Not sure if you missed my reply,

There was no recipe, all it did was take the two best items and after that it was RNG.

The chance of the refine working from +15 -> +16 was the same as +0 -> +1 (assuming you used the same items).

The Cap was ALSO 85% (As it is now; which is why I chose 85%).

TopDC = Total DC on the best item (Added and normal)
DCSec = Total DC on the second best item (added and normal)

DCChance = (TopDC + (TopDC / 5) + DCSec / 3) * 7 + WeaponLuck - WeaponCurse + BodyLuck (-10 to +5)

Lowest of either (85 or DCChance) out of 100 = your success rate.

if you were successfull it was DC+1

but then

If you DCChance > 63 && 1 in 30 chance it would be DC+2

finally if you had DCChance > 79 and 1 in 200 chance it would be DC+3.

BlackIronOre ONLY effected the Durability. nothing else

Code:
procedure TMerchant.UserSelectUpgradeWeapon(hum: TUserHuman);

  procedure PrepareWeaponUpgrade(ilist: TList; var adc, asc, amc, dura: byte);
  var
    i, k, d, s, m, dctop, dcsec, sctop, scsec, mctop, mcsec, durasum,
    duracount: integer;
    ps:      PTStdItem;
    dellist: TStringList;
    sumlist: TList;
    std:     TStdItem;
  begin
    dctop     := 0;
    dcsec     := 0;
    sctop     := 0;
    scsec     := 0;
    mctop     := 0;
    mcsec     := 0;
    durasum   := 0;
    duracount := 0;
    dellist   := nil;
    sumlist   := TList.Create;

    for i := ilist.Count - 1 downto 0 do begin
      if UserEngine.GetStdItemName(PTUserItem(ilist[i]).Index) = __BlackStone then
      begin
        sumlist.Add(pointer(Round(PTUserItem(ilist[i]).dura / 1000)));
        //durasum := durasum +
        //Inc (duracount);

        if dellist = nil then
          dellist := TStringList.Create;
        dellist.AddObject(__BlackStone, TObject(PTUserItem(ilist[i]).MakeIndex));

        Dispose(PTUserItem(ilist[i]));
        ilist.Delete(i);
      end else begin
        if IsUpgradeWeaponStuff(PTUserItem(ilist[i]).Index) then begin
          ps := UserEngine.GetStdItem(PTUserItem(ilist[i]).Index);
          if ps <> nil then begin
            std := ps^;
            ItemMan.GetUpgradeStdItem(PTUserItem(ilist[i])^, std);

            d := 0;
            s := 0;
            m := 0;

            case std.StdMode of
              19, 20, 21: begin  //¸ñ°ÉÀÌ
                d := Lobyte(std.DC) + Hibyte(std.DC);
                s := Lobyte(std.SC) + Hibyte(std.SC);
                m := Lobyte(std.MC) + Hibyte(std.MC);
              end;
              22, 23: begin     //¹ÝÁö
                d := Lobyte(std.DC) + Hibyte(std.DC);
                s := Lobyte(std.SC) + Hibyte(std.SC);
                m := Lobyte(std.MC) + Hibyte(std.MC);
              end;
              24, 26: begin     //ÆÈÂî
                d := Lobyte(std.DC) + Hibyte(std.DC) + 1;
                s := Lobyte(std.SC) + Hibyte(std.SC) + 1;
                m := Lobyte(std.MC) + Hibyte(std.MC) + 1;
              end;
            end;

            if dctop < d then begin
              dcsec := dctop;
              dctop := d;
            end else if dcsec < d then
              dcsec := d;

            if sctop < s then begin
              scsec := sctop;
              sctop := s;
            end else if scsec < s then
              scsec := s;

            if mctop < m then begin
              mcsec := mctop;
              mctop := m;
            end else if mcsec < m then
              mcsec := m;

            if dellist = nil then
              dellist := TStringList.Create;
            dellist.AddObject(ps.Name, TObject(PTUserItem(ilist[i]).MakeIndex));

            //·Î±×³²±è
            AddUserLog('26'#9 + //¾÷Àç_
              hum.MapName + ''#9 + IntToStr(hum.CX) + ''#9 +
              IntToStr(hum.CY) + ''#9 + hum.UserName + ''#9 +
              UserEngine.GetStdItemName(PTUserItem(ilist[i]).Index) + ''#9 +
              IntToStr(PTUserItem(ilist[i]).MakeIndex) + ''#9 + '1'#9 +
              ItemOptionToStr(PTUserItem(ilist[i]).desc));
            Dispose(PTUserItem(ilist[i]));
            ilist.Delete(i);
          end;
        end;
      end;
    end;
    for i := 0 to sumlist.Count - 1 do begin
      for k := sumlist.Count - 1 downto i + 1 do begin
        if integer(sumlist[k]) > integer(sumlist[k - 1]) then begin
          sumlist.Exchange(k, k - 1);
        end;
      end;
    end;
    for i := 0 to sumlist.Count - 1 do begin
      durasum := durasum + integer(sumlist[i]);
      Inc(duracount);
      if duracount >= 5 then
        break;
    end;

    //³»±¸ Æò±Õ, 5°³ ±îÁö ¸¹ÀÌ ³ÖÀ¸¸é ¾îµåº¥Å×Áö
    dura := Round(_MIN(5, duracount) + (durasum / duracount) / 5 * _MIN(5, duracount));

    adc := dctop + dctop div 5 + dcsec div 3;  //ÆÄ±« 5ÀÌ»ó °¡ÁßÄ¡
    asc := sctop + sctop div 5 + scsec div 3;
    amc := mctop + mctop div 5 + mcsec div 3;

    if dellist <> nil then begin
      hum.SendMsg(hum, RM_DELITEMS, 0, integer(dellist), 0, 0, '');
      //dellist ´Â RM_DELITEMS ¿¡¼* FREE µÈ´Ù.
    end;

    if sumlist <> nil then
      sumlist.Free;
  end;

var
  i:    integer;
  flag: boolean;
  pup:  PTUpgradeInfo;
  pstd: PTStdItem;
begin
  flag := False;
  //µé°í ÀÖ´Â ¹«±âÀÇ ¾÷±×·¹À̵带 ¸Ã±ä´Ù.
  for i := 0 to UpgradingList.Count - 1 do begin
    if hum.UserName = PTUpgradeInfo(UpgradingList[i]).UserName then begin
      NpcSayTitle(hum, '~@upgradenow_ing');
      exit;
    end;
  end;

  if hum.UseItems[U_WEAPON].Index <> 0 then begin
    //--------------------------------------
    //À¯´ÏÅ©¾ÆÀÌÅÛÀº Á¦·Ã ¸ø¸Ã±â°Ô...
    pstd := UserEngine.GetStdItem(hum.UseItems[U_WEAPON].Index);
    if pstd <> nil then begin
      if pstd.UniqueItem = 1 then begin
        hum.BoxMsg('The unique item cannot be refined.', 0);
        exit;
      end;
    end;
    //--------------------------------------

    if hum.Gold >= UPGRADEWEAPONFEE then begin  //µ·ÀÌ ÀÖ´ÂÁö
      if hum.FindItemName(__BlackStone) <> nil then begin  //ÈæÃ¶À» °¡Áö°í ÀÖ´ÂÁö
        hum.DecGold(UPGRADEWEAPONFEE);
        if BoCastleManage then  //5%ÀÇ ¼¼±ÝÀÌ °ÈÈù´Ù.
          UserCastle.PayTax(UPGRADEWEAPONFEE);
        hum.GoldChanged;

        //°¡¹æ¿¡ ÀÖ´Â ¾ÆÀÌÅÛÀ» ¸ù¶¥ ³Ö´Â´Ù.
        new(pup);
        pup.UserName := hum.UserName;
        pup.uitem    := hum.UseItems[U_WEAPON];

        //·Î±×³²±è
        AddUserLog('25'#9 + //¾÷¸Â_ +
          hum.MapName + ''#9 + IntToStr(hum.CX) + ''#9 +
          IntToStr(hum.CY) + ''#9 + hum.UserName + ''#9 +
          UserEngine.GetStdItemName(hum.UseItems[U_WEAPON].Index) +
          ''#9 + IntToStr(hum.UseItems[U_WEAPON].MakeIndex) +
          ''#9 + '1'#9 + ItemOptionToStr(UseItems[U_WEAPON].desc));

        hum.SendDelItem(hum.UseItems[U_WEAPON]); //Ŭ¶óÀÌ¾ðÆ®¿¡ ¾ø¾îÁø°Å º¸³¿
        hum.UseItems[U_WEAPON].Index := 0;
        hum.RecalcAbilitys;
        hum.FeatureChanged;
        hum.SendMsg(hum, RM_ABILITY, 0, 0, 0, 0, '');
        //hum.SendMsg (hum, RM_SUBABILITY, 0, 0, 0, 0, '');

        PrepareWeaponUpgrade(hum.ItemList, pup^.updc, pup^.upsc,
          pup^.upmc, pup^.durapoint);

        pup.readydate  := Now;
        pup.readycount := GetTickCount;

        UpgradingList.Add(pup);
        SaveUpgradeItemList;

        flag := True;
      end;
    end;

  end;
  if flag then
    NpcSayTitle(hum, '~@upgradenow_ok')
  else
    NpcSayTitle(hum, '~@upgradenow_fail');
end;

procedure TMerchant.UserSelectGetBackUpgrade(hum: TUserHuman);
var
  i, per, n: integer;
  state, rand: integer;
  pup: PTUpgradeInfo;
  pu:  PTUserItem;
begin
  state := 0;
  pup   := nil;
  if hum.CanAddItem then begin
    for i := 0 to UpgradingList.Count - 1 do begin
      if hum.UserName = PTUpgradeInfo(UpgradingList[i]).UserName then begin
        state := 1;  //¸Ã±ä °ÍÀÌ ÀÖÀ½
        if (GetTickCount - PTUpgradeInfo(UpgradingList[i]).readycount >
          60 * 60 * 1000) or (hum.UserDegree >= UD_ADMIN) then begin
          //´Ù µÇ¾úÀ¸¸é
          pup := PTUpgradeInfo(UpgradingList[i]);
          UpgradingList.Delete(i);
          SaveUpgradeItemList;
          state := 2;
          break;
        end;
      end;
    end;
    if (pup <> nil) then begin
      //³»±¸ °áÁ¤
      case pup.durapoint of
        0..8: begin
          //                  n := _MAX(3000, pup.uitem.DuraMax div 2);
          if pup.uitem.DuraMax > 3000 then
            pup.uitem.DuraMax := pup.uitem.DuraMax - 3000
          else
            pup.uitem.DuraMax := pup.uitem.DuraMax div 2;
          if pup.uitem.Dura > pup.uitem.DuraMax then
            pup.uitem.Dura := pup.uitem.DuraMax;
        end;
        9..15: begin
          if Random(pup.durapoint) < 6 then
            pup.uitem.DuraMax := _MAX(0, pup.uitem.DuraMax - 1000);
          //DURAMAX¼öÁ¤
        end;
        //16..19
        18..255: begin
          case Random(pup.durapoint - 18) of
            1..4: pup.uitem.DuraMax   := pup.uitem.DuraMax + 1000;
            5..7: pup.uitem.DuraMax   := pup.uitem.DuraMax + 2000;
            8..255: pup.uitem.DuraMax := pup.uitem.DuraMax + 4000;
          end;
        end;
      end;

      if (pup.updc = pup.upmc) and (pup.upmc = pup.upsc) then begin
        rand := Random(3);
      end else
        rand := -1;

      //´É·ÂÄ¡
      if (pup.updc >= pup.upmc) and (pup.updc >= pup.upsc) or (rand = 0) then
      begin //ÆÄ±«¾÷
            //¹«±âÀÇ Çà¿îµµ °ü·Ã ÀÖÀ½
        per := _MIN(85, 10 + _MIN(11, pup.updc) * 7 + pup.uitem.Desc[3]{Çà¿î} -
          pup.uitem.Desc[4] + hum.BodyLuckLevel);
        if Random(100) < per then begin
          pup.uitem.Desc[10] := 10;
          if (per > 63) and (Random(30) = 0) then
            pup.uitem.Desc[10] := 11;
          if (per > 79) and (Random(200) = 0) then
            pup.uitem.Desc[10] := 12;
        end else
          pup.uitem.Desc[10] := 1;
      end;
      if (pup.upmc >= pup.updc) and (pup.upmc >= pup.upsc) or (rand = 1) then
      begin //¸¶·Â¾÷
            //¹«±âÀÇ Çà¿îµµ °ü·Ã ÀÖÀ½
        per := _MIN(85, 10 + _MIN(11, pup.upmc) * 7 + pup.uitem.Desc[3] -
          pup.uitem.Desc[4] + hum.BodyLuckLevel);
        if Random(100) < per then begin
          pup.uitem.Desc[10] := 20;
          if (per > 63) and (Random(30) = 0) then
            pup.uitem.Desc[10] := 21;
          if (per > 79) and (Random(200) = 0) then
            pup.uitem.Desc[10] := 22;
        end else
          pup.uitem.Desc[10] := 1;
      end;
      if (pup.upsc >= pup.upmc) and (pup.upsc >= pup.updc) or (rand = 2) then
      begin //µµ·Â¾÷
            //¹«±âÀÇ Çà¿îµµ °ü·Ã ÀÖÀ½
        per := _MIN(85, 10 + _MIN(11, pup.upsc) * 7 + pup.uitem.Desc[3] -
          pup.uitem.Desc[4] + hum.BodyLuckLevel);
        if Random(100) < per then begin
          pup.uitem.Desc[10] := 30;
          if (per > 63) and (Random(30) = 0) then
            pup.uitem.Desc[10] := 31;
          if (per > 79) and (Random(200) = 0) then
            pup.uitem.Desc[10] := 32;
        end else
          pup.uitem.Desc[10] := 1;
      end;

      new(pu);
      pu^ := pup.uitem;
      Dispose(pup);

      //·Î±×³²±è
      AddUserLog('24'#9 + //¾÷ã_ +
        hum.MapName + ''#9 + IntToStr(hum.CX) + ''#9 + IntToStr(hum.CY) +
        ''#9 + hum.UserName + ''#9 + UserEngine.GetStdItemName(pu.Index) +
        ''#9 + IntToStr(pu.MakeIndex) + ''#9 + '1'#9 + ItemOptionToStr(pu.desc));

      hum.AddItem(pu);
      hum.SendAddItem(pu^);

    end;

    case state of
      2: NpcSayTitle(hum, '~@getbackupgnow_ok');   //¿Ï¼º
      1: NpcSayTitle(hum, '~@getbackupgnow_ing');  //ÀÛ¾÷Áß
      0: NpcSayTitle(hum, '~@getbackupgnow_fail');
    end;
  end else begin
      {$IFDEF KOREA} hum.SysMsg ('´õ ÀÌ»ó µé ¼ö ¾ø½À´Ï´Ù.', 0);
      {$ELSE}
    hum.SysMsg('You cannot carry any more.', 0);
      {$ENDIF}
    NpcSayTitle(hum, '@exit');
  end;
end;
 

phoenixdancer

LOMCN Veteran
Veteran
May 3, 2011
334
0
44
Not sure if you missed my reply,

There was no recipe, all it did was take the two best items and after that it was RNG.

The chance of the refine working from +15 -> +16 was the same as +0 -> +1 (assuming you used the same items).

The Cap was ALSO 85% (As it is now; which is why I chose 85%).

TopDC = Total DC on the best item (Added and normal)
DCSec = Total DC on the second best item (added and normal)

DCChance = (TopDC + (TopDC / 5) + DCSec / 3) * 7 + WeaponLuck - WeaponCurse + BodyLuck (-10 to +5)

Lowest of either (85 or DCChance) out of 100 = your success rate.

if you were successfull it was DC+1

but then

If you DCChance > 63 && 1 in 30 chance it would be DC+2

finally if you had DCChance > 79 and 1 in 200 chance it would be DC+3.

BlackIronOre ONLY effected the Durability. nothing else

Code:
procedure TMerchant.UserSelectUpgradeWeapon(hum: TUserHuman);

  procedure PrepareWeaponUpgrade(ilist: TList; var adc, asc, amc, dura: byte);
  var
    i, k, d, s, m, dctop, dcsec, sctop, scsec, mctop, mcsec, durasum,
    duracount: integer;
    ps:      PTStdItem;
    dellist: TStringList;
    sumlist: TList;
    std:     TStdItem;
  begin
    dctop     := 0;
    dcsec     := 0;
    sctop     := 0;
    scsec     := 0;
    mctop     := 0;
    mcsec     := 0;
    durasum   := 0;
    duracount := 0;
    dellist   := nil;
    sumlist   := TList.Create;

    for i := ilist.Count - 1 downto 0 do begin
      if UserEngine.GetStdItemName(PTUserItem(ilist[i]).Index) = __BlackStone then
      begin
        sumlist.Add(pointer(Round(PTUserItem(ilist[i]).dura / 1000)));
        //durasum := durasum +
        //Inc (duracount);

        if dellist = nil then
          dellist := TStringList.Create;
        dellist.AddObject(__BlackStone, TObject(PTUserItem(ilist[i]).MakeIndex));

        Dispose(PTUserItem(ilist[i]));
        ilist.Delete(i);
      end else begin
        if IsUpgradeWeaponStuff(PTUserItem(ilist[i]).Index) then begin
          ps := UserEngine.GetStdItem(PTUserItem(ilist[i]).Index);
          if ps <> nil then begin
            std := ps^;
            ItemMan.GetUpgradeStdItem(PTUserItem(ilist[i])^, std);

            d := 0;
            s := 0;
            m := 0;

            case std.StdMode of
              19, 20, 21: begin  //¸ñ°ÉÀÌ
                d := Lobyte(std.DC) + Hibyte(std.DC);
                s := Lobyte(std.SC) + Hibyte(std.SC);
                m := Lobyte(std.MC) + Hibyte(std.MC);
              end;
              22, 23: begin     //¹ÝÁö
                d := Lobyte(std.DC) + Hibyte(std.DC);
                s := Lobyte(std.SC) + Hibyte(std.SC);
                m := Lobyte(std.MC) + Hibyte(std.MC);
              end;
              24, 26: begin     //ÆÈÂî
                d := Lobyte(std.DC) + Hibyte(std.DC) + 1;
                s := Lobyte(std.SC) + Hibyte(std.SC) + 1;
                m := Lobyte(std.MC) + Hibyte(std.MC) + 1;
              end;
            end;

            if dctop < d then begin
              dcsec := dctop;
              dctop := d;
            end else if dcsec < d then
              dcsec := d;

            if sctop < s then begin
              scsec := sctop;
              sctop := s;
            end else if scsec < s then
              scsec := s;

            if mctop < m then begin
              mcsec := mctop;
              mctop := m;
            end else if mcsec < m then
              mcsec := m;

            if dellist = nil then
              dellist := TStringList.Create;
            dellist.AddObject(ps.Name, TObject(PTUserItem(ilist[i]).MakeIndex));

            //·Î±×³²±è
            AddUserLog('26'#9 + //¾÷Àç_
              hum.MapName + ''#9 + IntToStr(hum.CX) + ''#9 +
              IntToStr(hum.CY) + ''#9 + hum.UserName + ''#9 +
              UserEngine.GetStdItemName(PTUserItem(ilist[i]).Index) + ''#9 +
              IntToStr(PTUserItem(ilist[i]).MakeIndex) + ''#9 + '1'#9 +
              ItemOptionToStr(PTUserItem(ilist[i]).desc));
            Dispose(PTUserItem(ilist[i]));
            ilist.Delete(i);
          end;
        end;
      end;
    end;
    for i := 0 to sumlist.Count - 1 do begin
      for k := sumlist.Count - 1 downto i + 1 do begin
        if integer(sumlist[k]) > integer(sumlist[k - 1]) then begin
          sumlist.Exchange(k, k - 1);
        end;
      end;
    end;
    for i := 0 to sumlist.Count - 1 do begin
      durasum := durasum + integer(sumlist[i]);
      Inc(duracount);
      if duracount >= 5 then
        break;
    end;

    //³»±¸ Æò±Õ, 5°³ ±îÁö ¸¹ÀÌ ³ÖÀ¸¸é ¾îµåº¥Å×Áö
    dura := Round(_MIN(5, duracount) + (durasum / duracount) / 5 * _MIN(5, duracount));

    adc := dctop + dctop div 5 + dcsec div 3;  //ÆÄ±« 5ÀÌ»ó °¡ÁßÄ¡
    asc := sctop + sctop div 5 + scsec div 3;
    amc := mctop + mctop div 5 + mcsec div 3;

    if dellist <> nil then begin
      hum.SendMsg(hum, RM_DELITEMS, 0, integer(dellist), 0, 0, '');
      //dellist ´Â RM_DELITEMS ¿¡¼* FREE µÈ´Ù.
    end;

    if sumlist <> nil then
      sumlist.Free;
  end;

var
  i:    integer;
  flag: boolean;
  pup:  PTUpgradeInfo;
  pstd: PTStdItem;
begin
  flag := False;
  //µé°í ÀÖ´Â ¹«±âÀÇ ¾÷±×·¹À̵带 ¸Ã±ä´Ù.
  for i := 0 to UpgradingList.Count - 1 do begin
    if hum.UserName = PTUpgradeInfo(UpgradingList[i]).UserName then begin
      NpcSayTitle(hum, '~@upgradenow_ing');
      exit;
    end;
  end;

  if hum.UseItems[U_WEAPON].Index <> 0 then begin
    //--------------------------------------
    //À¯´ÏÅ©¾ÆÀÌÅÛÀº Á¦·Ã ¸ø¸Ã±â°Ô...
    pstd := UserEngine.GetStdItem(hum.UseItems[U_WEAPON].Index);
    if pstd <> nil then begin
      if pstd.UniqueItem = 1 then begin
        hum.BoxMsg('The unique item cannot be refined.', 0);
        exit;
      end;
    end;
    //--------------------------------------

    if hum.Gold >= UPGRADEWEAPONFEE then begin  //µ·ÀÌ ÀÖ´ÂÁö
      if hum.FindItemName(__BlackStone) <> nil then begin  //ÈæÃ¶À» °¡Áö°í ÀÖ´ÂÁö
        hum.DecGold(UPGRADEWEAPONFEE);
        if BoCastleManage then  //5%ÀÇ ¼¼±ÝÀÌ °ÈÈù´Ù.
          UserCastle.PayTax(UPGRADEWEAPONFEE);
        hum.GoldChanged;

        //°¡¹æ¿¡ ÀÖ´Â ¾ÆÀÌÅÛÀ» ¸ù¶¥ ³Ö´Â´Ù.
        new(pup);
        pup.UserName := hum.UserName;
        pup.uitem    := hum.UseItems[U_WEAPON];

        //·Î±×³²±è
        AddUserLog('25'#9 + //¾÷¸Â_ +
          hum.MapName + ''#9 + IntToStr(hum.CX) + ''#9 +
          IntToStr(hum.CY) + ''#9 + hum.UserName + ''#9 +
          UserEngine.GetStdItemName(hum.UseItems[U_WEAPON].Index) +
          ''#9 + IntToStr(hum.UseItems[U_WEAPON].MakeIndex) +
          ''#9 + '1'#9 + ItemOptionToStr(UseItems[U_WEAPON].desc));

        hum.SendDelItem(hum.UseItems[U_WEAPON]); //Ŭ¶óÀÌ¾ðÆ®¿¡ ¾ø¾îÁø°Å º¸³¿
        hum.UseItems[U_WEAPON].Index := 0;
        hum.RecalcAbilitys;
        hum.FeatureChanged;
        hum.SendMsg(hum, RM_ABILITY, 0, 0, 0, 0, '');
        //hum.SendMsg (hum, RM_SUBABILITY, 0, 0, 0, 0, '');

        PrepareWeaponUpgrade(hum.ItemList, pup^.updc, pup^.upsc,
          pup^.upmc, pup^.durapoint);

        pup.readydate  := Now;
        pup.readycount := GetTickCount;

        UpgradingList.Add(pup);
        SaveUpgradeItemList;

        flag := True;
      end;
    end;

  end;
  if flag then
    NpcSayTitle(hum, '~@upgradenow_ok')
  else
    NpcSayTitle(hum, '~@upgradenow_fail');
end;

procedure TMerchant.UserSelectGetBackUpgrade(hum: TUserHuman);
var
  i, per, n: integer;
  state, rand: integer;
  pup: PTUpgradeInfo;
  pu:  PTUserItem;
begin
  state := 0;
  pup   := nil;
  if hum.CanAddItem then begin
    for i := 0 to UpgradingList.Count - 1 do begin
      if hum.UserName = PTUpgradeInfo(UpgradingList[i]).UserName then begin
        state := 1;  //¸Ã±ä °ÍÀÌ ÀÖÀ½
        if (GetTickCount - PTUpgradeInfo(UpgradingList[i]).readycount >
          60 * 60 * 1000) or (hum.UserDegree >= UD_ADMIN) then begin
          //´Ù µÇ¾úÀ¸¸é
          pup := PTUpgradeInfo(UpgradingList[i]);
          UpgradingList.Delete(i);
          SaveUpgradeItemList;
          state := 2;
          break;
        end;
      end;
    end;
    if (pup <> nil) then begin
      //³»±¸ °áÁ¤
      case pup.durapoint of
        0..8: begin
          //                  n := _MAX(3000, pup.uitem.DuraMax div 2);
          if pup.uitem.DuraMax > 3000 then
            pup.uitem.DuraMax := pup.uitem.DuraMax - 3000
          else
            pup.uitem.DuraMax := pup.uitem.DuraMax div 2;
          if pup.uitem.Dura > pup.uitem.DuraMax then
            pup.uitem.Dura := pup.uitem.DuraMax;
        end;
        9..15: begin
          if Random(pup.durapoint) < 6 then
            pup.uitem.DuraMax := _MAX(0, pup.uitem.DuraMax - 1000);
          //DURAMAX¼öÁ¤
        end;
        //16..19
        18..255: begin
          case Random(pup.durapoint - 18) of
            1..4: pup.uitem.DuraMax   := pup.uitem.DuraMax + 1000;
            5..7: pup.uitem.DuraMax   := pup.uitem.DuraMax + 2000;
            8..255: pup.uitem.DuraMax := pup.uitem.DuraMax + 4000;
          end;
        end;
      end;

      if (pup.updc = pup.upmc) and (pup.upmc = pup.upsc) then begin
        rand := Random(3);
      end else
        rand := -1;

      //´É·ÂÄ¡
      if (pup.updc >= pup.upmc) and (pup.updc >= pup.upsc) or (rand = 0) then
      begin //ÆÄ±«¾÷
            //¹«±âÀÇ Çà¿îµµ °ü·Ã ÀÖÀ½
        per := _MIN(85, 10 + _MIN(11, pup.updc) * 7 + pup.uitem.Desc[3]{Çà¿î} -
          pup.uitem.Desc[4] + hum.BodyLuckLevel);
        if Random(100) < per then begin
          pup.uitem.Desc[10] := 10;
          if (per > 63) and (Random(30) = 0) then
            pup.uitem.Desc[10] := 11;
          if (per > 79) and (Random(200) = 0) then
            pup.uitem.Desc[10] := 12;
        end else
          pup.uitem.Desc[10] := 1;
      end;
      if (pup.upmc >= pup.updc) and (pup.upmc >= pup.upsc) or (rand = 1) then
      begin //¸¶·Â¾÷
            //¹«±âÀÇ Çà¿îµµ °ü·Ã ÀÖÀ½
        per := _MIN(85, 10 + _MIN(11, pup.upmc) * 7 + pup.uitem.Desc[3] -
          pup.uitem.Desc[4] + hum.BodyLuckLevel);
        if Random(100) < per then begin
          pup.uitem.Desc[10] := 20;
          if (per > 63) and (Random(30) = 0) then
            pup.uitem.Desc[10] := 21;
          if (per > 79) and (Random(200) = 0) then
            pup.uitem.Desc[10] := 22;
        end else
          pup.uitem.Desc[10] := 1;
      end;
      if (pup.upsc >= pup.upmc) and (pup.upsc >= pup.updc) or (rand = 2) then
      begin //µµ·Â¾÷
            //¹«±âÀÇ Çà¿îµµ °ü·Ã ÀÖÀ½
        per := _MIN(85, 10 + _MIN(11, pup.upsc) * 7 + pup.uitem.Desc[3] -
          pup.uitem.Desc[4] + hum.BodyLuckLevel);
        if Random(100) < per then begin
          pup.uitem.Desc[10] := 30;
          if (per > 63) and (Random(30) = 0) then
            pup.uitem.Desc[10] := 31;
          if (per > 79) and (Random(200) = 0) then
            pup.uitem.Desc[10] := 32;
        end else
          pup.uitem.Desc[10] := 1;
      end;

      new(pu);
      pu^ := pup.uitem;
      Dispose(pup);

      //·Î±×³²±è
      AddUserLog('24'#9 + //¾÷ã_ +
        hum.MapName + ''#9 + IntToStr(hum.CX) + ''#9 + IntToStr(hum.CY) +
        ''#9 + hum.UserName + ''#9 + UserEngine.GetStdItemName(pu.Index) +
        ''#9 + IntToStr(pu.MakeIndex) + ''#9 + '1'#9 + ItemOptionToStr(pu.desc));

      hum.AddItem(pu);
      hum.SendAddItem(pu^);

    end;

    case state of
      2: NpcSayTitle(hum, '~@getbackupgnow_ok');   //¿Ï¼º
      1: NpcSayTitle(hum, '~@getbackupgnow_ing');  //ÀÛ¾÷Áß
      0: NpcSayTitle(hum, '~@getbackupgnow_fail');
    end;
  end else begin
      {$IFDEF KOREA} hum.SysMsg ('´õ ÀÌ»ó µé ¼ö ¾ø½À´Ï´Ù.', 0);
      {$ELSE}
    hum.SysMsg('You cannot carry any more.', 0);
      {$ENDIF}
    NpcSayTitle(hum, '@exit');
  end;
end;

nevermind
 
Last edited: