Skip to content

Commit

Permalink
fix for new their server version
Browse files Browse the repository at this point in the history
  • Loading branch information
merlokk committed Jan 15, 2013
1 parent e447e8e commit 62b7f28
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
23 changes: 16 additions & 7 deletions uFasade.pas
Expand Up @@ -124,10 +124,10 @@ procedure TMPFasade.PaintGraf(world: TMWorld; cnv: TCanvas);
maxItems,
delta,
tall: integer;
data: array[0..2] of TFieldGraf;
data: array[0..3] of TFieldGraf;
room: TMRoom;
begin
for i := 0 to 2 do
for i := 0 to 3 do
begin
room := world.GetRoom(i);
if room = nil then continue;
Expand All @@ -146,6 +146,7 @@ procedure TMPFasade.PaintGraf(world: TMWorld; cnv: TCanvas);
maxItems := Max(maxItems, data[0][i]);
maxItems := Max(maxItems, data[1][i]);
maxItems := Max(maxItems, data[2][i]);
maxItems := Max(maxItems, data[3][i]);
end;

if maxItems = 0 then exit;
Expand All @@ -167,23 +168,31 @@ procedure TMPFasade.PaintGraf(world: TMWorld; cnv: TCanvas);
cnv.FillRect(Rect(
i * delta + 4,
tall - max(Trunc(data[0][i] / maxItems * tall), 1),
i * delta + 4 + (delta div 3 - 1),
i * delta + 4 + (delta div 4 - 1),
tall));

cnv.Brush.Color := clOlive;
if data[1][i] > 0 then
cnv.FillRect(Rect(
i * delta + 4 + (delta div 3),
i * delta + 4 + (delta div 4),
tall - max(Trunc(data[1][i] / maxItems * tall), 1),
i * delta + 4 + ((delta div 3)*2 - 1),
i * delta + 4 + ((delta div 4)*2 - 1),
tall));

cnv.Brush.Color := clNavy;
if data[2][i] > 0 then
cnv.FillRect(Rect(
i * delta + 4 + (delta div 3)*2,
i * delta + 4 + (delta div 4)*2,
tall - max(Trunc(data[2][i] / maxItems * tall), 1),
i * delta + 4 + ((delta div 3)*3 - 1),
i * delta + 4 + ((delta div 4)*3 - 1),
tall));

cnv.Brush.Color := clPurple;
if data[3][i] > 0 then
cnv.FillRect(Rect(
i * delta + 4 + (delta div 4)*3,
tall - max(Trunc(data[2][i] / maxItems * tall), 1),
i * delta + 4 + ((delta div 4)*4 - 1),
tall));
end;

Expand Down
1 change: 1 addition & 0 deletions uGameItems.pas
Expand Up @@ -279,6 +279,7 @@ TMFieldCoastHotel = class (TMFieldFactory)
end;

TWorldHeader = packed record
RollCounter: int64;
NextTick: cardinal;
RoomInformation,
WishListStr: String;
Expand Down
6 changes: 5 additions & 1 deletion uMPServ.pas
Expand Up @@ -217,7 +217,7 @@ constructor TMPServer.Create;
clHttpRequest.Header.AcceptEncoding := 'gzip,deflate,sdch';
clHttpRequest.Header.AcceptCharSet := 'windows-1251,utf-8;q=0.7,*;q=0.3';
clHttpRequest.Header.AcceptLanguage := 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4';
clHttpRequest.Header.Referer := 'http://cs6151.vkontakte.ru/u6148904/2432d91261070e.zip';
clHttpRequest.Header.Referer := 'http://cs6176.vkontakte.ru/[[IMPORT]]/mb.static.socialquantum.ru/assets_vk_city_prod/loader.swf?refs=1358241303';
clHttpRequest.Header.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11';

clHttpRequest2 := TclHttpRequest.Create(Nil);
Expand Down Expand Up @@ -770,6 +770,9 @@ function TMWorldHelper.LoadFromXML(RoomID: integer; data: string): boolean;

// process header
LastHeader.ProcessResponseHeader(root);
if LastHeader.RollCounter > TActionQueue.GetInstance.RollCounter then
TActionQueue.GetInstance.RollCounter := LastHeader.RollCounter;

if room.ID <> LastHeader.RoomID then exit;
room.Header := LastHeader;

Expand Down Expand Up @@ -835,6 +838,7 @@ function TWorldHeaderHelper.ProcessResponseHeader(root: IXMLNode): boolean;
if OwnerID <= 0 then exit;

// my world
RollCounter := VarToIntDef(root.Attributes['roll_counter'], 0);
NextTick := VarToIntDef(root.Attributes['next_tick'], 0);
WishListStr := VarToStr(root.Attributes['wish_list']);
Population := VarToIntDef(root.Attributes['population'], 0);
Expand Down
6 changes: 6 additions & 0 deletions uMain.dfm
Expand Up @@ -146,6 +146,12 @@ object MainFrm: TMainFrm
Width = 75
Height = 25
Caption = 'Load'
Font.Charset = DEFAULT_CHARSET
Font.Color = clPurple
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
TabOrder = 5
OnClick = btParamLoadClick
end
Expand Down
5 changes: 3 additions & 2 deletions uQueue.pas
Expand Up @@ -40,7 +40,8 @@ TActionQueue = class
FQuElm: array of TActionQueueElm;
public
OwnerID,
CurrentXP: int64;
CurrentXP,
RollCounter: int64;

class function GetInstance: TActionQueue;
constructor Create;
Expand Down Expand Up @@ -140,7 +141,7 @@ procedure AddCached(indx: integer; name, value: string);
AddCached(i, 'room_id', IntToStr(FQuElm[i].RoomID));
AddCached(i, 'ago', IntToStr(ago));
AddCached(i, 'command', FA_STR[FQuElm[i].AType]);
AddCached(i, 'roll_counter', '1');
AddCached(i, 'roll_counter', IntToStr(RollCounter));
AddCached(i, 'exp', IntToStr(CurrentXP));
CurrentXP := CurrentXP + FQuElm[i].DeltaXP;

Expand Down
2 changes: 2 additions & 0 deletions uTasks.pas
Expand Up @@ -726,6 +726,8 @@ procedure TMTaskWorldUpdate.IntExecute;
room0 := world.GetRoom(0);
room := room0;

TActionQueue.GetInstance.RollCounter := world.LastHeader.RollCounter;

sleep(1000);
AddLog('command: confirm_friends >>>');
elm := FQu.Add(room.ID, 0, 'confirm_friends', faConfirmFriendsIds);
Expand Down

0 comments on commit 62b7f28

Please sign in to comment.